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:"19de3ea2d4dff87848e2856116036653e12abbb0",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:"09435a5a3886be34e61acd920b781a7727be6e7d",part:"label",id:this.labelId,class:"form-control__label",htmlFor:this.inputId,"aria-hidden":this.label?"false":"true"},h("slot",{key:"183d8f7362426adb3a2548ff42cef9744fcd7e72",name:"label"},this.label),h("slot",{key:"da0c1cee8a09f7b09e3aad7c3dc0cc1bbbdb65db",name:"label-end"}),!!this.required&&h("span",{key:"e0633d36d6dc144d93972f2382d6402216e99cb2","aria-hidden":"true",class:"required"}," ","*"),h("sc-visually-hidden",{key:"94ee412cb7d02e28494012626b0685b4d43245b4"},this.required?wp.i18n.__("required","surecart"):"")),h("div",{key:"dc6e3f87ed5436f75c7d8956bba6ef2aa6d6dd3c",part:"input",class:"form-control__input"},h("slot",{key:"2480c1df16fa6c746ebfa2a14233d372b7bb08a9"})),this.help&&h("div",{key:"0f539eae0a6dd7e57323ef25c5412a8a1cb23183",part:"help-text",id:this.helpId,class:"form-control__help-text"},h("slot",{key:"3d6373c7afbe791a547028786fbf3ba035dc9c3a",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};