import{proxyCustomElement,HTMLElement,h}from"@stencil/core/internal/client";import{i as isRtl}from"./page-align.js";import{d as defineCustomElement$1}from"./sc-visually-hidden2.js";const scFormControlCss=".form-control{font-family:var(--sc-font-sans);font-size:var(--sc-font-size-medium);font-weight:var(--sc-font-weight-normal);display:flex;flex-direction:column;gap:var(--sc-input-label-margin)}.form-control .form-control__label{display:none}.form-control .form-control__help-text{display:none}.form-control--has-label .form-control__label{display:inline-block;color:var(--sc-input-label-color);font-weight:var(--sc-input-label-font-weight);text-transform:var(--sc-input-label-text-transform, none);letter-spacing:var(--sc-input-label-letter-spacing, 0)}.form-control--has-label.form-control--small .form-control__label{font-size:var(--sc-input-label-font-size-small)}.form-control--has-label.form-control--medium .form-control__label{font-size:var(--sc-input-label-font-size-medium)}.form-control--has-label.form-control--large .form-control_label{font-size:var(--sc-input-label-font-size-large)}::slotted(.control--errors){margin-top:var(--sc-spacing-small);color:var(--sc-color-danger-500)}::slotted([slot=label-end]){float:right}.form-control--is-required .required{color:var(--sc-color-danger-500)}.form-control--has-help-text .form-control__help-text{display:block;color:var(--sc-input-help-text-color)}.form-control--has-help-text.form-control--small .form-control__help-text{font-size:var(--sc-input-help-text-font-size-small)}.form-control--has-help-text.form-control--medium .form-control__help-text{font-size:var(--sc-input-help-text-font-size-medium)}.form-control--has-help-text.form-control--large .form-control__help-text{font-size:var(--sc-input-help-text-font-size-large)}.form-control--has-error .form-control__error-text{display:block;color:var(--sc-input-error-text-color)}.form-control--has-error.form-control--small .form-control__error-text{font-size:var(--sc-input-error-text-font-size-small)}.form-control--has-error.form-control--medium .form-control__error-text{font-size:var(--sc-input-error-text-font-size-medium)}.form-control--has-error.form-control--large .form-control__error-text{font-size:var(--sc-input-error-text-font-size-large)}.form-control--has-error ::part(base){border-color:rgb(var(--sl-color-danger-500))}.form-control--is-rtl.form-control--has-label .form-control__label{text-align:right}",ScFormControlStyle0=scFormControlCss,ScFormControl=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),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?wp.i18n.__("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)))}get el(){return this}static get style(){return ScFormControlStyle0}},[1,"sc-form-control",{size:[513],name:[1],showLabel:[4,"show-label"],label:[1],labelId:[1,"label-id"],inputId:[1,"input-id"],required:[4],help:[1],helpId:[1,"help-id"]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-form-control","sc-visually-hidden"].forEach((o=>{switch(o){case"sc-form-control":customElements.get(o)||customElements.define(o,ScFormControl);break;case"sc-visually-hidden":customElements.get(o)||defineCustomElement$1()}}))}export{ScFormControl as S,defineCustomElement as d};