import{b as E,H as $,k as h,Z as w,m as S,j as O,c as v,d as y,u as k,o as B,v as I,x as g,E as z,am as C,e,a3 as N,n as f,r as _,M as F,$ as P,z as A,A as D,f as Q,s as W,p as Z,q as x,t as J,Q as X,h as Y,ae as M}from"./normalize-8d58a40d.js";import{a as T}from"./config-provider-251ddd1f.js";import{U as G,C as ee,b as oe,u as ae,f as le,a as se,e as ne,d as te}from"./el-button-4de18cb6.js";import{_ as V}from"./base-79ac1cb4.js";const K=E({size:T,disabled:Boolean,label:{type:[String,Number,Boolean],default:""}}),re=E({...K,modelValue:{type:[String,Number,Boolean],default:""},name:{type:String,default:""},border:Boolean}),U={[G]:s=>$(s)||h(s)||w(s),[ee]:s=>$(s)||h(s)||w(s)},L=Symbol("radioGroupKey"),j=(s,m)=>{const n=S(),a=O(L,void 0),d=v(()=>!!a),c=v({get(){return d.value?a.modelValue:s.modelValue},set(i){d.value?a.changeEvent(i):m&&m(G,i),n.value.checked=s.modelValue===s.label}}),r=oe(v(()=>a==null?void 0:a.size)),u=ae(v(()=>a==null?void 0:a.disabled)),l=S(!1),p=v(()=>u.value||d.value&&c.value!==s.label?-1:0);return{radioRef:n,isGroup:d,radioGroup:a,focus:l,size:r,disabled:u,tabIndex:p,modelValue:c}},ie=["value","name","disabled"],de=y({name:"ElRadio"}),ue=y({...de,props:re,emits:U,setup(s,{emit:m}){const n=s,a=k("radio"),{radioRef:d,radioGroup:c,focus:r,size:u,disabled:l,modelValue:p}=j(n,m);function i(){P(()=>m("change",p.value))}return(o,t)=>{var b;return B(),I("label",{class:f([e(a).b(),e(a).is("disabled",e(l)),e(a).is("focus",e(r)),e(a).is("bordered",o.border),e(a).is("checked",e(p)===o.label),e(a).m(e(u))])},[g("span",{class:f([e(a).e("input"),e(a).is("disabled",e(l)),e(a).is("checked",e(p)===o.label)])},[z(g("input",{ref_key:"radioRef",ref:d,"onUpdate:modelValue":t[0]||(t[0]=R=>N(p)?p.value=R:null),class:f(e(a).e("original")),value:o.label,name:o.name||((b=e(c))==null?void 0:b.name),disabled:e(l),type:"radio",onFocus:t[1]||(t[1]=R=>r.value=!0),onBlur:t[2]||(t[2]=R=>r.value=!1),onChange:i},null,42,ie),[[C,e(p)]]),g("span",{class:f(e(a).e("inner"))},null,2)],2),g("span",{class:f(e(a).e("label")),onKeydown:t[3]||(t[3]=F(()=>{},["stop"]))},[_(o.$slots,"default",{},()=>[A(D(o.label),1)])],34)],2)}}});var pe=V(ue,[["__file","/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);const me=E({...K,name:{type:String,default:""}}),ce=["value","name","disabled"],fe=y({name:"ElRadioButton"}),be=y({...fe,props:me,setup(s){const m=s,n=k("radio"),{radioRef:a,focus:d,size:c,disabled:r,modelValue:u,radioGroup:l}=j(m),p=v(()=>({backgroundColor:(l==null?void 0:l.fill)||"",borderColor:(l==null?void 0:l.fill)||"",boxShadow:l!=null&&l.fill?`-1px 0 0 0 ${l.fill}`:"",color:(l==null?void 0:l.textColor)||""}));return(i,o)=>{var t;return B(),I("label",{class:f([e(n).b("button"),e(n).is("active",e(u)===i.label),e(n).is("disabled",e(r)),e(n).is("focus",e(d)),e(n).bm("button",e(c))])},[z(g("input",{ref_key:"radioRef",ref:a,"onUpdate:modelValue":o[0]||(o[0]=b=>N(u)?u.value=b:null),class:f(e(n).be("button","original-radio")),value:i.label,type:"radio",name:i.name||((t=e(l))==null?void 0:t.name),disabled:e(r),onFocus:o[1]||(o[1]=b=>d.value=!0),onBlur:o[2]||(o[2]=b=>d.value=!1)},null,42,ce),[[C,e(u)]]),g("span",{class:f(e(n).be("button","inner")),style:Q(e(u)===i.label?e(p):{}),onKeydown:o[3]||(o[3]=F(()=>{},["stop"]))},[_(i.$slots,"default",{},()=>[A(D(i.label),1)])],38)],2)}}});var q=V(be,[["__file","/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);const ve=E({id:{type:String,default:void 0},size:T,disabled:Boolean,modelValue:{type:[String,Number,Boolean],default:""},fill:{type:String,default:""},label:{type:String,default:void 0},textColor:{type:String,default:""},name:{type:String,default:void 0},validateEvent:{type:Boolean,default:!0}}),ge=U,ye=["id","aria-label","aria-labelledby"],Ee=y({name:"ElRadioGroup"}),Re=y({...Ee,props:ve,emits:ge,setup(s,{emit:m}){const n=s,a=k("radio"),d=le(),c=S(),{formItem:r}=se(),{inputId:u,isLabeledByFormItem:l}=ne(n,{formItemContext:r}),p=o=>{m(G,o),P(()=>m("change",o))};W(()=>{const o=c.value.querySelectorAll("[type=radio]"),t=o[0];!Array.from(o).some(b=>b.checked)&&t&&(t.tabIndex=0)});const i=v(()=>n.name||d.value);return Z(L,x({...J(n),changeEvent:p,name:i})),X(()=>n.modelValue,()=>{n.validateEvent&&(r==null||r.validate("change").catch(o=>te()))}),(o,t)=>(B(),I("div",{id:e(u),ref_key:"radioGroupRef",ref:c,class:f(e(a).b("group")),role:"radiogroup","aria-label":e(l)?void 0:o.label||"radio-group","aria-labelledby":e(l)?e(r).labelId:void 0},[_(o.$slots,"default")],10,ye))}});var H=V(Re,[["__file","/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);const _e=Y(pe,{RadioButton:q,RadioGroup:H}),Ge=M(H);M(q);export{_e as E,Ge as a};
