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:"cdc808d857734a2466a835539e63a9ddc8beccd2",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:"0482bdcb5906d8c58d45ffec728f87e3ab972de7",part:"label",id:this.labelId,class:"form-control__label",htmlFor:this.inputId,"aria-hidden":this.label?"false":"true"},h("slot",{key:"bbba092126b95d34a79d67c8e145ab1ebad4eb22",name:"label"},this.label),h("slot",{key:"34a1ce5a91fedb6f247861a711f2ad420e664e7c",name:"label-end"}),!!this.required&&h("span",{key:"aec4775ae4e264ae79c1b2fbd8ba4d3591b48ab1","aria-hidden":"true",class:"required"}," ","*"),h("sc-visually-hidden",{key:"435b9fb16aa5ef979238a40fbd6be56b53c78e55"},this.required?__("required","surecart"):"")),h("div",{key:"c4a0f41aad49fbd96c13b7559ec00c92dd976c00",part:"input",class:"form-control__input"},h("slot",{key:"9dd5dd81926af7afd6d719fd9eaa58b9dd6326e0"})),this.help&&h("div",{key:"37c67f2aab015951aa15be0b40adeafa0d39f731",part:"help-text",id:this.helpId,class:"form-control__help-text"},h("slot",{key:"b037cb074ee3c21be61f9e03d30aa03cc9c6f8fe",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"}}