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