import{defineComponent as D,computed as v,ref as G,createVNode as p}from"vue";import U from"../_util/classNames.mjs";import O from"../_util/omit.mjs";import{functionType as a,booleanType as s}from"../_util/type.mjs";import A from"../_util/vue-types/index.mjs";import{useInjectDisabled as h}from"../config-provider/DisabledContext.mjs";import N from"../config-provider/hooks/useConfigInject.mjs";import{useInjectFormItemContext as V,FormItemInputContext as z}from"../form/FormItemContext.mjs";import B from"../vc-checkbox/Checkbox.mjs";import{useInjectRadioOptionTypeContext as E,useInjectRadioGroupContext as M}from"./context.mjs";import q from"./style/index.mjs";const H=()=>({prefixCls:String,checked:s(),disabled:s(),isGroup:s(),value:A.any,name:String,id:String,autofocus:s(),onChange:a(),onFocus:a(),onBlur:a(),onClick:a(),"onUpdate:checked":a(),"onUpdate:value":a()}),ne=D({compatConfig:{MODE:3},name:"ARadio",inheritAttrs:!1,props:H(),setup(l,{emit:r,expose:b,slots:d,attrs:m}){const f=V(),x=z.useInject(),g=E(),n=M(),I=h(),k=v(()=>C.value??I.value),u=G(),{prefixCls:c,direction:y,disabled:C}=N("radio",l),t=v(()=>n?.optionType.value==="button"||g==="button"?`${c.value}-button`:c.value),w=h(),[S,j]=q(c);b({focus:()=>{u.value.focus()},blur:()=>{u.value.blur()}});const P=e=>{const i=e.target.checked;r("update:checked",i),r("update:value",i),r("change",e),f.onFieldChange()},T=e=>{r("change",e),n&&n.onChange&&n.onChange(e)};return()=>{const e=n,{prefixCls:i,id:$=f.id.value,...F}=l,o={prefixCls:t.value,id:$,...O(F,["onUpdate:checked","onUpdate:value"]),disabled:C.value??w.value};e?(o.name=e.name.value,o.onChange=T,o.checked=l.value===e.value.value,o.disabled=k.value||e.disabled.value):o.onChange=P;const R=U({[`${t.value}-wrapper`]:!0,[`${t.value}-wrapper-checked`]:o.checked,[`${t.value}-wrapper-disabled`]:o.disabled,[`${t.value}-wrapper-rtl`]:y.value==="rtl",[`${t.value}-wrapper-in-form-item`]:x.isFormItemInput},m.class,j.value);return S(p("label",{...m,class:R},[p(B,{...o,type:"radio",ref:u},null),d.default&&p("span",null,[d.default()])]))}}});export{ne as default,H as radioProps};
