import{r as t,c as i,h as e,H as s,g as r}from"./p-78e3ebb9.js";const h=class{constructor(e){t(this,e);this.onChange=i(this,"radiochange",7);this.handleClick=t=>{t.stopPropagation();if(this.disabled)return;if(!this.checked)this.checked=true};this.name=undefined;this.value="";this.id=undefined;this.checked=false;this.disabled=false;this.nativeProps={};this.isWillLoadCalled=false}watchChecked(t){if(!this.isWillLoadCalled)return;t&&this.onChange.emit({value:this.value})}watchId(t){if(!this.isWillLoadCalled)return;if(t)this.inputEl.setAttribute("id",t)}componentDidRender(){this.id&&this.el.removeAttribute("id")}componentWillLoad(){this.isWillLoadCalled=true}render(){const{checked:t,name:i,value:r,disabled:h,nativeProps:c}=this;return e(s,{className:"weui-cells_checkbox",onClick:this.handleClick},e("input",Object.assign({ref:t=>{if(!t)return;this.inputEl=t;if(this.id)t.setAttribute("id",this.id)},type:"radio",name:i,value:r,class:"weui-check",checked:t,disabled:h,onChange:t=>t.stopPropagation()},c)),e("i",{class:"weui-icon-checked"}),e("slot",null))}get el(){return r(this)}static get watchers(){return{checked:["watchChecked"],id:["watchId"]}}};const c=class{constructor(e){t(this,e);this.onChange=i(this,"change",7);this.uniqueName=Date.now().toString(36);this.name=undefined}function(t){t.stopPropagation();if(t.target.tagName!=="TARO-RADIO-CORE")return;const i=t.target;if(i.checked){const e=this.el.querySelectorAll("taro-radio-core");e.forEach((t=>{if(t!==i){t.checked=false}}));this.value=t.detail.value;this.onChange.emit({value:this.value})}}componentDidLoad(){const t=this.el.querySelectorAll("taro-radio-core");t.forEach((t=>{t.setAttribute("name",this.name||this.uniqueName)}));Object.defineProperty(this.el,"value",{get:()=>{if(!this.value){const t=this.el.querySelectorAll("taro-radio-core");this.value=this.getValues(t)}return this.value},configurable:true})}getValues(t){let i="";Array.from(t).forEach((t=>{const e=t.querySelector("input");if(e===null||e===void 0?void 0:e.checked){i=e.value||""}}));return i}render(){return e(s,{class:"weui-cells_radiogroup"})}get el(){return r(this)}};export{h as taro_radio_core,c as taro_radio_group_core};
//# sourceMappingURL=p-8594d1e5.entry.js.map