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:"e299022b7be4f404c8e35b253efcfd3d51b2dccc",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:"93615159904baf037e35b1f79564884911f034c1",part:"label",id:this.labelId,class:"form-control__label",htmlFor:this.inputId,"aria-hidden":this.label?"false":"true"},h("slot",{key:"d253d7871dc5b82aa999f2e4846b7606e46a40b0",name:"label"},this.label),h("slot",{key:"6c9db77880bb159d6520238a6ba5f64d69bf4150",name:"label-end"}),!!this.required&&h("span",{key:"642ea7e33ee14236ca69ba264fe0f10e96631fb2","aria-hidden":"true",class:"required"}," ","*"),h("sc-visually-hidden",{key:"38fdc95f8da36960994f24635f0bc3f3aced4dc5"},this.required?__("required","surecart"):"")),h("div",{key:"82694c015ea08fdd8bc1ef14494a08d52838bfc6",part:"input",class:"form-control__input"},h("slot",{key:"748d86c8b0f32c1dcb13d26b7ab5036eceb2f13a"})),this.help&&h("div",{key:"ad7a2442106adc6b5184e3ef63324cabfae82c13",part:"help-text",id:this.helpId,class:"form-control__help-text"},h("slot",{key:"61b4fcdfdc23cdaaff72444ce86e8f168cef2929",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"}}