import{r as i,h as o,g as r}from"./p-f06dc8f3.js";import{m as t}from"./p-84ba0a57.js";const e=class{constructor(o){i(this,o),this.joined=!1,this.requiredMessage="Los campos son requeridos",this.containerClass=()=>t("ibk-form-group",[{joined:this.joined}]),this.setFocus=()=>{this._allFields.forEach((i=>{i.addEventListener("onfocus",(o=>{var r;const t=null===(r=i.nextElementSibling)||void 0===r?void 0:r.querySelector(".ibk-textfield__input, .ibk-dropdown__input");t&&null==i.getAttribute("error")&&("in"==o.detail?t.style.borderLeft="1px solid #05be50":"out"==o.detail&&t.removeAttribute("style"))}))}))},this.configFieldProperties=()=>{var i;const o=null===(i=this.fieldsWidth)||void 0===i?void 0:i.split(",");this._allFields.forEach(((i,r)=>{o&&o[r]&&(i.style.width=o[r]+"%"),this.error?i.setAttribute("error",""):i.removeAttribute("error"),this.joined?i.setAttribute("no-handling-error",""):this.required?i.setAttribute("required",""):i.removeAttribute("error")}))}}componentWillLoad(){this._allFields=this.host.querySelectorAll("ibk-textfield, ibk-dropdown"),this.setFocus(),this.configFieldProperties()}watchingError(){this.configFieldProperties()}render(){return o("div",{class:this.containerClass()},this.label&&o("span",{class:"ibk-form-group__label",innerHTML:this.label}),this.subtitle&&o("span",{class:"ibk-form-group__subtitle",innerHTML:this.subtitle}),o("div",{class:"ibk-form-group__list"},o("slot",null)),this.joined&&o("span",{class:"ibk-form-group__error-message",innerHTML:this.error&&this.requiredMessage}))}get host(){return r(this)}static get watchers(){return{error:["watchingError"]}}};e.style=".ibk-form-group{box-sizing:border-box}.ibk-form-group *{box-sizing:border-box}.ibk-form-group__label{color:var(--gray1);font-size:14px;font-family:var(--fontGeometria);font-weight:500;margin-bottom:7px;display:block}.ibk-form-group__subtitle{font-family:var(--fontMontserrat);color:var(--grayText);font-size:14px;font-weight:500;padding-bottom:7px;display:block}.ibk-form-group__list{display:flex;align-items:flex-start;justify-content:space-between}.ibk-form-group ibk-textfield,.ibk-form-group ibk-dropdown{width:100%}.ibk-form-group:not(.ibk-form-group--joined) ibk-textfield:not(:last-child),.ibk-form-group:not(.ibk-form-group--joined) ibk-dropdown:not(:last-child){margin-right:15px}.ibk-form-group__error-message{font-family:var(--fontMontserrat);font-size:12px;color:var(--extendedWatermelon1);font-weight:500;margin-top:7px;display:block;min-height:15px}.ibk-form-group--joined .ibk-textfield__input,.ibk-form-group--joined .ibk-dropdown__input{border-radius:0}.ibk-form-group--joined ibk-textfield:first-child .ibk-textfield__input,.ibk-form-group--joined ibk-dropdown:first-child .ibk-dropdown__input{border-radius:4px 0 0 4px;position:relative}.ibk-form-group--joined ibk-textfield:not(:last-child) .ibk-textfield__input,.ibk-form-group--joined ibk-dropdown:not(:last-child) .ibk-dropdown__input{border-right:0}.ibk-form-group--joined ibk-textfield:last-child .ibk-textfield__input,.ibk-form-group--joined ibk-dropdown:last-child .ibk-dropdown__input{border-radius:0 4px 4px 0}.ibk-form-group--joined ibk-textfield:not(:last-child):hover+ibk-textfield .ibk-textfield__input,.ibk-form-group--joined ibk-textfield:not(:last-child):hover+ibk-dropdown .ibk-dropdown__input,.ibk-form-group--joined ibk-dropdown:not(:last-child):hover+ibk-textfield .ibk-textfield__input,.ibk-form-group--joined ibk-dropdown:not(:last-child):hover+ibk-dropdown .ibk-dropdown__input{border-left:1px solid var(--gray3)}";export{e as ibk_form_group}