import{r as t,a as o,h as i}from"./p-wX3eJOEL.js";import{i as e}from"./p-CtINY9El.js";import{d as r,t as a}from"./p-DNHOWgWh.js";const n=class{constructor(o){t(this,o)}errorStates=new Map;get el(){return o(this)}alignment="vertical";size;showGroupLabel;groupLabelText="Group Label Text";showCaption;captionText;showCaptionIcon;required=!1;hasErrors=!1;handleRadioButtonError(t){const o=t.target;"ifx-radio-button"===o.tagName.toLowerCase()&&(this.errorStates.set(o,t.detail),this.updateHasErrors())}async setGroupError(t){Array.from(this.el.querySelectorAll("ifx-radio-button")).forEach((o=>{o.error=t}))}componentWillLoad(){this.initializeState()}async componentDidLoad(){if(!e(this.el)){const t=r();a("ifx-radio-button-group",await t)}}handleSlotChange=()=>{this.initializeState()};initializeState(){this.errorStates.clear(),Array.from(this.el.querySelectorAll("ifx-radio-button")).forEach((t=>{this.errorStates.has(t)||this.errorStates.set(t,t.error||!1)})),this.updateHasErrors()}updateHasErrors(){this.hasErrors=Array.from(this.errorStates.values()).some((t=>t))}render(){return i("div",{key:"0f12c24f5bb36b514322601f6585ba358a105f99",class:"radio-button-group-container"},this.showGroupLabel&&i("div",{key:"dbb800828e6f527f8bed96ca0a8199213fd23427",class:"group-label"},this.groupLabelText,this.required&&i("span",{key:"bb424f58c3259a1ac27ea344f222536e656d1ba4",class:"required "+(this.hasErrors?"error":"")},"*")),i("div",{key:"38816864ff4788e16d6a4fa9f808126ea2401484",class:`radio-button-group ${this.alignment} ${this.size}`},i("slot",{key:"3541e10d35efaae631adfce5eedd3eaf67e18399",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)):"")}};n.style=".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}";export{n as ifx_radio_button_group}