import{h}from"@stencil/core";import{isRtl}from"../../../functions/page-align";export class ScRadioGroup{constructor(){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 t=e.target;t.disabled||t.checked&&(this.value=t.value,this.scChange.emit(t.value))}componentDidLoad(){[...this.el.querySelectorAll("sc-radio")].forEach((e=>{e.checked&&(this.value=e.value)}))}render(){return h("fieldset",{key:"8bd58c819c211da7c51698b21e713902d58d02ab",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:"9f88af737634f9ff44edfbcf3792a4b8340dbc6d",part:"label",class:"radio-group__label"},h("slot",{key:"6d3b5ca6dce5e1a66ba7bd2e697894a27f3b5e6f",name:"label"},this.label)),h("input",{key:"aacd44954b08158476773bed58018ead6f370ae4",type:"text",class:"radio-group__hidden-input",ref:e=>this.input=e,required:this.required,value:this.value,tabindex:"-1"}),h("div",{key:"12c3f5c6e704182102fb9256d340789c96b4741f",part:"items",class:"radio-group__items"},h("slot",{key:"8b94009648800d7cbcdcc709b35b076c628ee0cb"})))}static get is(){return"sc-radio-group"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-radio-group.scss"]}}static get styleUrls(){return{$:["sc-radio-group.css"]}}static get properties(){return{label:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"The radio group label. Required for proper accessibility."},attribute:"label",reflect:!1,defaultValue:"''"},invalid:{type:"boolean",mutable:!0,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"This will be true when the control is in an invalid state. Validity is determined by props such as `type`,\n`required`, `minlength`, `maxlength`, and `pattern` using the browser's constraint validation API."},attribute:"invalid",reflect:!0},value:{type:"string",mutable:!0,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"The selected value of the control."},attribute:"value",reflect:!0,defaultValue:"''"},required:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Is one of these items required."},attribute:"required",reflect:!1}}}static get events(){return[{method:"scChange",name:"scChange",bubbles:!0,cancelable:!0,composed:!0,docs:{tags:[],text:""},complexType:{original:"string",resolved:"string",references:{}}}]}static get methods(){return{reportValidity:{complexType:{signature:"() => Promise<boolean>",parameters:[],references:{Promise:{location:"global",id:"global::Promise"}},return:"Promise<boolean>"},docs:{text:"Checks for validity and shows the browser's validation message if the control is invalid.",tags:[]}}}}static get elementRef(){return"el"}static get listeners(){return[{name:"scChange",method:"handleRadioClick",target:void 0,capture:!1,passive:!1}]}}