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:"6f114b90239a42805e63364a355896c02d3988e9",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:"ccb4e6f7fa4e69af482c53861e45b9d268182be8",part:"label",class:"radio-group__label"},h("slot",{key:"827db49c7427461e220766798e36552911e9a668",name:"label"},this.label)),h("input",{key:"2b548c11043aeb6d84ec64ac8d5cdbd335b72f42",type:"text",class:"radio-group__hidden-input",ref:e=>this.input=e,required:this.required,value:this.value,tabindex:"-1"}),h("div",{key:"345e7b8b616cdae904a9bfa8326d47909fb60ee9",part:"items",class:"radio-group__items"},h("slot",{key:"66b33c676b0875c568266be2053b00f4b48c9b0a"})))}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};