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:"aa7c0ca666970c8a942f2125d2fbe24ca53a545a",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:"3547170ef8dfaa178d8f5853155f0978b5cbd62d",part:"label",class:"radio-group__label"},h("slot",{key:"c3690d8d230c302402cd510a961f65ee899c64f2",name:"label"},this.label)),h("input",{key:"3656a3a87c3dc61bda3f04e1f612fb84a59d51e3",type:"text",class:"radio-group__hidden-input",ref:e=>this.input=e,required:this.required,value:this.value,tabindex:"-1"}),h("div",{key:"acee8e4b51d77fa1864d11b6e269b7c45b35b891",part:"items",class:"radio-group__items"},h("slot",{key:"355a1b0c07a78be70c47f736a0cb4823acde9f58"})))}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};