1 |
- import{aV as v,d as m,bJ as D,w as I,cb as _,f as i,bz as f,c0 as b,aY as V,bN as p,bx as w,bA as x,bM as y,l as B,e as u,I as G,bX as $,bD as N,bK as A,bR as F}from"./index-6a437721.js";const[C,K]=v("radio-group"),O={disabled:Boolean,iconSize:f,direction:String,modelValue:b,checkedColor:String},P=Symbol(C);var Y=m({name:C,props:O,emits:["change","update:modelValue"],setup(e,{emit:t,slots:o}){const{linkChildren:l}=D(P),c=a=>t("update:modelValue",a);return I(()=>e.modelValue,a=>t("change",a)),l({props:e,updateValue:c}),_(()=>e.modelValue),()=>{var a;return i("div",{class:K([e.direction]),role:"radiogroup"},[(a=o.default)==null?void 0:a.call(o)])}}});const M=V(Y),S={name:b,shape:p("round"),disabled:Boolean,iconSize:f,modelValue:b,checkedColor:String,labelPosition:String,labelDisabled:Boolean};var j=m({props:w({},S,{bem:x(Function),role:String,parent:Object,checked:Boolean,bindGroup:y}),emits:["click","toggle"],setup(e,{emit:t,slots:o}){const l=B(),c=n=>{if(e.parent&&e.bindGroup)return e.parent.props[n]},a=u(()=>c("disabled")||e.disabled),k=u(()=>c("direction")),z=u(()=>{const n=e.checkedColor||c("checkedColor");if(n&&e.checked&&!a.value)return{borderColor:n,backgroundColor:n}}),R=n=>{const{target:r}=n,d=l.value,s=d===r||(d==null?void 0:d.contains(r));!a.value&&(s||!e.labelDisabled)&&t("toggle"),t("click",n)},g=()=>{const{bem:n,shape:r,checked:d}=e,s=e.iconSize||c("iconSize");return i("div",{ref:l,class:n("icon",[r,{disabled:a.value,checked:d}]),style:{fontSize:$(s)}},[o.icon?o.icon({checked:d,disabled:a.value}):i(G,{name:"success",style:z.value},null)])},h=()=>{if(o.default)return i("span",{class:e.bem("label",[e.labelPosition,{disabled:a.value}])},[o.default()])};return()=>{const n=e.labelPosition==="left"?[h(),g()]:[g(),h()];return i("div",{role:e.role,class:e.bem([{disabled:a.value,"label-disabled":e.labelDisabled},k.value]),tabindex:a.value?void 0:0,"aria-checked":e.checked,onClick:R},[n])}}});const[q,E]=v("radio");var J=m({name:q,props:S,emits:["update:modelValue"],setup(e,{emit:t,slots:o}){const{parent:l}=N(P),c=()=>(l?l.props.modelValue:e.modelValue)===e.name,a=()=>{l?l.updateValue(e.name):t("update:modelValue",e.name)};return()=>i(j,F({bem:E,role:"radio",parent:l,checked:c(),onToggle:a},e),A(o,["default","icon"]))}});const T=V(J);export{M as R,T as a};
|