import{r as t,h as i,a as o}from"./p-PqnYwNKt.js";import{d as e,t as r}from"./p-DcmcuUOA.js";import{i as a}from"./p-Bw2fh5LT.js";const n=':root{--ifx-font-family:"Source Sans 3", "Arial, sans-serif"}.radio-button-group-container{display:flex;flex-direction:column}.radio-button-group{display:flex;gap:8px}.radio-button-group.horizontal{flex-direction:row;column-gap:12px}.radio-button-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-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 s=class{constructor(i){t(this,i);this.errorStates=new Map;this.alignment="vertical";this.groupLabelText="Group Label Text";this.required=false;this.hasErrors=false;this.handleSlotChange=()=>{this.initializeState()}}handleRadioButtonError(t){const i=t.target;if(i.tagName.toLowerCase()==="ifx-radio-button"){this.errorStates.set(i,t.detail);this.updateHasErrors()}}async setGroupError(t){const i=Array.from(this.el.querySelectorAll("ifx-radio-button"));i.forEach((i=>{i.error=t}))}componentWillLoad(){this.initializeState()}async componentDidLoad(){if(!a(this.el)){const t=e();r("ifx-radio-button-group",await t)}}initializeState(){this.errorStates.clear();const t=Array.from(this.el.querySelectorAll("ifx-radio-button"));t.forEach((t=>{if(!this.errorStates.has(t)){this.errorStates.set(t,t.error||false)}}));this.updateHasErrors()}updateHasErrors(){console.log("here");this.hasErrors=Array.from(this.errorStates.values()).some((t=>t))}render(){return i("div",{key:"dcd66919142f41e8d51054f7de1663361c273232",class:"radio-button-group-container"},this.showGroupLabel&&i("div",{key:"7765acb090b78c495b03b17f242b0efacba29a10",class:"group-label"},this.groupLabelText,this.required&&i("span",{key:"e500cc4867c756991d6e76b77640b6fc1f052296",class:`required ${this.hasErrors?"error":""}`},"*")),i("div",{key:"05211a3727a84a135588bccee63d22c36511cbee",class:`radio-button-group ${this.alignment} ${this.size}`},i("slot",{key:"4d9cbd4f52276f6c101306208bd6156e01287f2f",onSlotchange:this.handleSlotChange})),this.showCaption?i("div",{class:`caption ${this.hasErrors?"error":"default"}`},this.showCaptionIcon?i("div",{class:"caption-icon"},i("ifx-icon",{icon:"c-info-16"})):"",i("div",{class:"caption-text"},this.captionText)):"")}get el(){return o(this)}};s.style=n;export{s as ifx_radio_button_group};
//# sourceMappingURL=p-9deaa65e.entry.js.map