import{arrayType as e,booleanType as t,functionType as n,stringType as r}from"../_util/type.mjs";import i from"../_util/classNames.mjs";import a from"../config-provider/hooks/useConfigInject.mjs";import o from"../_util/vue-types/index.mjs";import{useInjectFormItemContext as s}from"../form/FormItemContext.mjs";import{useProvideRadioGroupContext as c}from"./context.mjs";import l from"./style/index.mjs";import u from"./Radio.mjs";import{computed as d,createVNode as f,defineComponent as p,nextTick as m,ref as h,watch as g}from"vue";var _=()=>({prefixCls:String,value:o.any,size:r(),options:e(),disabled:t(),name:String,buttonStyle:r(`outline`),id:String,optionType:r(`default`),onChange:n(),"onUpdate:value":n()}),v=p({compatConfig:{MODE:3},name:`ARadioGroup`,inheritAttrs:!1,props:_(),setup(e,{slots:t,emit:n,attrs:r}){let o=s(),{prefixCls:p,direction:_,size:v}=a(`radio`,e),[y,b]=l(p),x=h(e.value),S=h(!1);return g(()=>e.value,e=>{x.value=e,S.value=!1}),c({onChange:t=>{let r=x.value,{value:i}=t.target;`value`in e||(x.value=i),!S.value&&i!==r&&(S.value=!0,n(`update:value`,i),n(`change`,t),o.onFieldChange()),m(()=>{S.value=!1})},value:x,disabled:d(()=>e.disabled),name:d(()=>e.name),optionType:d(()=>e.optionType)}),()=>{let{options:n,buttonStyle:a,id:s=o.id.value}=e,c=`${p.value}-group`,l=i(c,`${c}-${a}`,{[`${c}-${v.value}`]:v.value,[`${c}-rtl`]:_.value===`rtl`},r.class,b.value),d=null;return d=n&&n.length>0?n.map(t=>{if(typeof t==`string`||typeof t==`number`)return f(u,{key:t,prefixCls:p.value,disabled:e.disabled,value:t,checked:x.value===t},{default:()=>[t]});let{value:n,disabled:r,label:i}=t;return f(u,{key:`radio-group-value-options-${n}`,prefixCls:p.value,disabled:r||e.disabled,value:n,checked:x.value===n},{default:()=>[i]})}):t.default?.(),y(f(`div`,{...r,class:l,id:s},[d]))}}});export{v as default,_ as radioGroupProps};