import{h}from"@stencil/core";import{isRtl}from"../../../functions/page-align";import{__}from"@wordpress/i18n";export class ScFormControl{constructor(){this.size="medium",this.name=void 0,this.showLabel=!0,this.label=void 0,this.labelId=void 0,this.inputId=void 0,this.required=!1,this.help=void 0,this.helpId=void 0}render(){return h("div",{key:"24e43d2d6e2ba673265e023367aeb65701082390",part:"form-control",class:{"form-control":!0,"form-control--small":"small"===this.size,"form-control--medium":"medium"===this.size,"form-control--large":"large"===this.size,"form-control--has-label":!!this.label&&this.showLabel,"form-control--has-help-text":!!this.help,"form-control--is-required":!!this.required,"form-control--is-rtl":isRtl()}},h("label",{key:"1f115a25706725f3933321816751b859b17ee7aa",part:"label",id:this.labelId,class:"form-control__label",htmlFor:this.inputId,"aria-hidden":this.label?"false":"true"},h("slot",{key:"653035aa670583a46d95d63420262a0fe10bec2e",name:"label"},this.label),h("slot",{key:"53a1b86381e4a4d0ae1850af3660f1ca1191cf79",name:"label-end"}),!!this.required&&h("span",{key:"9270a60510aa7a9766387d035f780319d82c2486","aria-hidden":"true",class:"required"}," ","*"),h("sc-visually-hidden",{key:"7800575c5fd78f4482da12b4296d874a5fffa1a3"},this.required?__("required","surecart"):"")),h("div",{key:"c177fa0dc65c59100474674f8c2940ceaf23e10e",part:"input",class:"form-control__input"},h("slot",{key:"183b9c2ec880dbfc6b0f04f93b0bdd42dc63939f"})),this.help&&h("div",{key:"e8d8b2d777016f3a6ecebc338ba456714f988564",part:"help-text",id:this.helpId,class:"form-control__help-text"},h("slot",{key:"b0f80387affd157418d541fd3727b3ab253ef481",name:"help-text"},this.help)))}static get is(){return"sc-form-control"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-form-control.scss"]}}static get styleUrls(){return{$:["sc-form-control.css"]}}static get properties(){return{size:{type:"string",mutable:!1,complexType:{original:"'small' | 'medium' | 'large'",resolved:'"large" | "medium" | "small"',references:{}},required:!1,optional:!1,docs:{tags:[],text:"Size of the label"},attribute:"size",reflect:!0,defaultValue:"'medium'"},name:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Name for the input. Used for validation errors."},attribute:"name",reflect:!1},showLabel:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Show the label."},attribute:"show-label",reflect:!1,defaultValue:"true"},label:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Input label."},attribute:"label",reflect:!1},labelId:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Input label id."},attribute:"label-id",reflect:!1},inputId:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Input id."},attribute:"input-id",reflect:!1},required:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Whether the input is required."},attribute:"required",reflect:!1,defaultValue:"false"},help:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Help text"},attribute:"help",reflect:!1},helpId:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Help id"},attribute:"help-id",reflect:!1}}}static get elementRef(){return"el"}}