import{r as i,c as o,h as e,g as t}from"./p-f06dc8f3.js";import{m as r}from"./p-84ba0a57.js";const s=class{constructor(e){i(this,e),this.oncheckedgroup=o(this,"oncheckedgroup",7),this.inline=!1,this.error=!1,this.required=!1,this.requiredMessage="Selecciona una opción",this.containerClass=()=>r("ibk-checkbox-group",[{inline:this.inline},{error:this.error}]),this.listenSlottedEvents=()=>{const i=this.host.querySelectorAll("ibk-checkbox");let o=[];Array.from(i,(e=>{o.push({checked:!1,value:e.getAttribute("value")}),e.addEventListener("onchecked",(e=>{let t=o.findIndex((i=>i.value==e.detail.value));o[t]=e.detail,this.oncheckedgroup.emit(o),this.error=!1,Array.from(i,(i=>i.removeAttribute("error")))})),this.error&&e.setAttribute("error","")}))}}componentDidLoad(){this.listenSlottedEvents()}render(){return e("div",{class:this.containerClass()},e("div",{class:"ibk-checkbox-group__list"},this.subtitle&&e("p",{class:"ibk-checkbox-group__subtitle",innerHTML:this.subtitle}),e("slot",null)),this.error&&e("span",{class:"ibk-checkbox-group__error-message",innerHTML:this.requiredMessage}))}get host(){return t(this)}};s.style=".ibk-checkbox-group:not(.ibk-checkbox-group--inline) ibk-checkbox:not(:last-child){display:block;margin-bottom:10px}.ibk-checkbox-group__subtitle{margin:0 0 12px 0;font-family:var(--fontMontserrat);font-size:14px}.ibk-checkbox-group__error-message{color:var(--extendedWatermelon1);font-size:12px;font-family:var(--fontMontserrat);font-weight:500;min-height:15px;margin-top:7px;display:block}.ibk-checkbox-group--inline .ibk-checkbox-group__list{display:flex;align-items:center;flex-wrap:wrap}.ibk-checkbox-group--inline ibk-checkbox:not(:last-child){margin-right:30px}.ibk-checkbox-group--inline ibk-checkbox{display:inline-block}";export{s as ibk_checkbox_group}