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:"5b49f18dc4a05d87f0fa6a5492b068c46f0aba03",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:"2528e85f4e44dd522c67e6365d906da39f46214a",part:"label",class:"radio-group__label"},h("slot",{key:"77dfe4244914ceb81f9e1c16a63423756462da5e",name:"label"},this.label)),h("input",{key:"231db95f2fedbe072631e07ba6880a365ade2d65",type:"text",class:"radio-group__hidden-input",ref:e=>this.input=e,required:this.required,value:this.value,tabindex:"-1"}),h("div",{key:"02a666723e7d58f9b9f3f9d9c94f8d8b2371d981",part:"items",class:"radio-group__items"},h("slot",{key:"43538863b10715646b500d8ed075b5e91833ca4d"})))}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}]}}