import{r as e,h as t,a as i}from"./p-DtIEDtZ8.js";import{d as o,t as r}from"./p-DcmcuUOA.js";import{i as s}from"./p-Bw2fh5LT.js";const c=":root{--ifx-font-family:\"Source Sans 3\", 'Arial, sans-serif'}.checkbox-group-container{display:flex;flex-direction:column}.checkbox-group{display:flex;gap:8px}.checkbox-group.horizontal{flex-direction:row;column-gap:12px}.checkbox-group.vertical{flex-direction:column;row-gap:12px}.group-label{font-size:1rem;color:#1D1D1D;line-height:1.5rem;font-weight:400;margin-bottom:8px;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.group-label .required{color:#575352;margin-left:4px}.group-label .required.error{color:#CD002F}.caption{margin-top:8px;align-self:flex-start;display:flex;width:100%;column-gap:8px;justify-content:space-between;align-items:center}.caption.default{color:#1D1D1D}.caption.error{color:#CD002F}.caption-text{font-weight:400;font-size:0.75rem;line-height:1rem;flex:1;text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.caption-icon{flex:0;display:flex}";const a=class{constructor(t){e(this,t);this.errorStates=new Map;this.alignment="vertical";this.groupLabelText="Group Label Text";this.required=false;this.hasErrors=false;this.handleSlotChange=()=>{this.initializeState()}}handleCheckboxError(e){const t=e.target;if(t.tagName.toLowerCase()==="ifx-checkbox"){this.errorStates.set(t,e.detail);this.updateHasErrors()}}async setGroupError(e){const t=Array.from(this.el.querySelectorAll("ifx-checkbox"));t.forEach((t=>{t.error=e}))}componentWillLoad(){this.initializeState()}async componentDidLoad(){if(!s(this.el)){const e=o();r("ifx-checkbox-group",await e)}}initializeState(){this.errorStates.clear();const e=Array.from(this.el.querySelectorAll("ifx-checkbox"));e.forEach((e=>{if(!this.errorStates.has(e)){this.errorStates.set(e,e.error||false)}}));this.updateHasErrors()}updateHasErrors(){this.hasErrors=Array.from(this.errorStates.values()).some((e=>e))}render(){return t("div",{key:"c9424a54db6fcce412275bea3e584b6985cf6479",class:"checkbox-group-container"},this.showGroupLabel&&t("div",{key:"9ebd83b86b4be4de0107edeae3101cd64915e6b1",class:"group-label"},this.groupLabelText,this.required&&t("span",{key:"d83004ec7fc85d23453db833e4b87748be2d088f",class:`required ${this.hasErrors?"error":""}`},"*")),t("div",{key:"647c87572ee92805df964c05b59f59886592c273",class:`checkbox-group ${this.alignment} ${this.size}`},t("slot",{key:"2ed8287636dda53576fd27440ae9d99b569951d8",onSlotchange:this.handleSlotChange})),this.showCaption?t("div",{class:`caption ${this.hasErrors?"error":"default"}`},this.showCaptionIcon?t("div",{class:"caption-icon"},t("ifx-icon",{icon:"c-info-16"})):"",t("div",{class:"caption-text"},this.captionText)):"")}get el(){return i(this)}};a.style=c;export{a as ifx_checkbox_group};
//# sourceMappingURL=p-4850e2df.entry.js.map