import{proxyCustomElement,HTMLElement,createEvent,h}from"@stencil/core/internal/client";import{i as isRtl}from"./page-align.js";const scRadioGroupCss=':host{display:block}.radio-group{border:none;padding:0;margin:0;min-width:0}.radio-group .radio-group__label{display:inline-block;padding:0;color:var(--sc-input-label-color);font-weight:var(--sc-input-label-font-weight);text-transform:var(--sc-input-label-text-transform, none);letter-spacing:var(--sc-input-label-letter-spacing, 0);margin-bottom:var(--sc-input-label-margin)}.radio-group__hidden-input{position:absolute;opacity:0;padding:0px;margin:0px;pointer-events:none}.radio-group--is-required .radio-group__label:after{content:" *";color:var(--sc-color-danger-500)}::slotted(sc-radio:not(:last-of-type)){display:block;margin-bottom:var(--sc-spacing-x-small)}.radio-group--is-rtl.radio-group,.radio-group--is-rtl.radio-group .radio-group__label{text-align:right}',ScRadioGroupStyle0=scRadioGroupCss,ScRadioGroup=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.scChange=createEvent(this,"scChange",7),this.label="",this.invalid=void 0,this.value="",this.required=void 0}async reportValidity(){return this.invalid=!this.input.checkValidity(),this.input.reportValidity()}handleRadioClick(e){if("SC-RADIO"!==e.target.tagName)return;e.stopImmediatePropagation();const i=e.target;i.disabled||i.checked&&(this.value=i.value,this.scChange.emit(i.value))}componentDidLoad(){[...this.el.querySelectorAll("sc-radio")].forEach((e=>{e.checked&&(this.value=e.value)}))}render(){return h("fieldset",{key:"0d9a4ba13a02ca240257a1ea54439573d4bbd5cc",part:"base",class:{"radio-group":!0,"radio-group--invalid":this.invalid,"radio-group--is-required":this.required,"radio-group--is-rtl":isRtl()},"aria-invalid":this.invalid,role:"radiogroup"},h("legend",{key:"3c21b9c1d8ef448d07edf1e108f6085459dace07",part:"label",class:"radio-group__label"},h("slot",{key:"2c72f2c65b564a707c9dbb25c054f30c816b3ae3",name:"label"},this.label)),h("input",{key:"db34f962b73dc1f4c976b841204963fa3068b05c",type:"text",class:"radio-group__hidden-input",ref:e=>this.input=e,required:this.required,value:this.value,tabindex:"-1"}),h("div",{key:"f6c015bd02e42caf4c1e1a2441f1974ac0b7bf28",part:"items",class:"radio-group__items"},h("slot",{key:"11abc8a0e5f0cf8979820facdf61749dda257d97"})))}get el(){return this}static get style(){return ScRadioGroupStyle0}},[1,"sc-radio-group",{label:[1],invalid:[1540],value:[1537],required:[4],reportValidity:[64]},[[0,"scChange","handleRadioClick"]]]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-radio-group"].forEach((e=>{"sc-radio-group"===e&&(customElements.get(e)||customElements.define(e,ScRadioGroup))}))}export{ScRadioGroup as S,defineCustomElement as d};