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:"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"})))}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}]}}