import{r as i,h as s,g as t}from"./p-b891c2f1.js";let e=0;const h=class{constructor(s){i(this,s),this.inputId="choices-"+ ++e,this.helpId=`choices-help-text-${e}`,this.labelId=`choices-label-${e}`,this.label="",this.size="medium",this.required=!1,this.showLabel=!0,this.help="",this.hideLabel=!1,this.columns=1,this.errorMessage=""}componentDidLoad(){this.handleRequiredChange(),this.handleResize()}handleRequiredChange(){const i=this.el.querySelectorAll("sc-choice");i.length&&i.forEach((i=>{i.required=this.required}))}handleResize(){"ResizeObserver"in window&&new window.ResizeObserver((i=>{i.forEach((i=>{this.width=i.contentRect.width}))})).observe(this.el)}render(){return s("fieldset",{part:"base",class:{choices:!0,"choices--hide-label":this.hideLabel,"choices--auto-width":this.autoWidth,"breakpoint-sm":this.width<384,"breakpoint-md":this.width>=384&&this.width<576,"breakpoint-lg":this.width>=576&&this.width<768,"breakpoint-xl":this.width>=768},role:"radiogroup"},s("sc-form-control",{size:this.size,required:this.required,label:this.label,showLabel:this.showLabel,help:this.help,inputId:this.inputId,helpId:this.helpId,labelId:this.labelId},s("div",{part:"choices",class:"choices__items"},s("slot",null))))}get el(){return t(this)}static get watchers(){return{required:["handleRequiredChange"]}}};h.style=":host{display:block}.choices ::slotted(div){margin:0;display:flex;flex-wrap:wrap;gap:10px}.choices:not(.choices--auto-width) ::slotted(div){margin:0;display:grid;gap:10px}.breakpoint-lg ::slotted(div),.breakpoint-xl ::slotted(div){grid-template-columns:repeat(var(--columns, 1), 1fr)}.choices .choices__items{margin:0;display:flex;flex-wrap:wrap;gap:10px}.choices:not(.choices--auto-width) .choices__items{display:grid;gap:10px}.choices{border:none;padding:0;margin:0;min-width:0;margin:0}.choices .choices__label{font-family:var(--sc-input-font-family);font-size:var(--sc-input-font-size-medium);font-weight:var(--sc-input-font-weight);color:var(--sc-input-color);padding:0 var(--sc-spacing-xx-small)}.choices__items{display:grid;gap:10px}";export{h as sc_choices}