import{p as t,H as o,h as e,t as i}from"./p-Bpcl2TqF.js";import{i as r,d as a,t as n}from"./p-94ZtGp9D.js";import{d as s}from"./p-KvSIaMXJ.js";const c=()=>`.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 l=t(class t extends o{constructor(t){super();if(t!==false){this.__registerHost()}this.__attachShadow()}errorStates=new Map;get el(){return this}alignment="vertical";size;showGroupLabel;groupLabelText="Group Label Text";showCaption;captionText;showCaptionIcon;required=false;hasErrors=false;handleRadioButtonError(t){const o=t.target;if(o.tagName.toLowerCase()==="ifx-radio-button"){this.errorStates.set(o,t.detail);this.updateHasErrors()}}async setGroupError(t){const o=Array.from(this.el.querySelectorAll("ifx-radio-button"));o.forEach((o=>{o.error=t}))}componentWillLoad(){this.initializeState()}async componentDidLoad(){if(!r(this.el)){const t=a();n("ifx-radio-button-group",await t)}}handleSlotChange=()=>{this.initializeState()};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 e("div",{key:"f3fc00af2749af273be844693047e1c064ca85f9",class:"radio-button-group-container"},this.showGroupLabel&&e("div",{key:"91be730186fad61451cc30764bbbffc5846130f9",class:"group-label"},this.groupLabelText,this.required&&e("span",{key:"76624127f9a8f9ff3a4685cac80b5282bca4695b",class:`required ${this.hasErrors?"error":""}`},"*")),e("div",{key:"450cbec6c256aada332dca04c998b9569ba881be",class:`radio-button-group ${this.alignment} ${this.size}`},e("slot",{key:"7eea5ff3719c44c2924e6e7760e1850cfd0fb9fd",onSlotchange:this.handleSlotChange})),this.showCaption?e("div",{class:`caption ${this.hasErrors?"error":"default"}`},this.showCaptionIcon?e("div",{class:"caption-icon"},e("ifx-icon",{icon:"c-info-16"})):"",e("div",{class:"caption-text"},this.captionText)):"")}static get style(){return c()}},[769,"ifx-radio-button-group",{alignment:[1],size:[1],showGroupLabel:[4,"show-group-label"],groupLabelText:[1,"group-label-text"],showCaption:[4,"show-caption"],captionText:[1,"caption-text"],showCaptionIcon:[4,"show-caption-icon"],required:[4],hasErrors:[32],setGroupError:[64]},[[0,"ifxError","handleRadioButtonError"]]]);function p(){if(typeof customElements==="undefined"){return}const t=["ifx-radio-button-group","ifx-icon"];t.forEach((t=>{switch(t){case"ifx-radio-button-group":if(!customElements.get(i(t))){customElements.define(i(t),l)}break;case"ifx-icon":if(!customElements.get(i(t))){s()}break}}))}const f=l;const u=p;export{f as IfxRadioButtonGroup,u as defineCustomElement};
//# sourceMappingURL=ifx-radio-button-group.js.map