1 |
- import{O as v,u as g,z as P,d as C,N as S,aB as z,v as y,R as B,y as r,c as d,a5 as x,U as D}from"./index.332c7f08.js";const R={name:v,shape:g("round"),disabled:Boolean,iconSize:P,modelValue:v,checkedColor:String,labelPosition:String,labelDisabled:Boolean};var I=C({props:S({},R,{bem:z(Function),role:String,parent:Object,checked:Boolean,bindGroup:y}),emits:["click","toggle"],setup(e,{emit:s,slots:c}){const u=B(),l=n=>{if(e.parent&&e.bindGroup)return e.parent.props[n]},a=r(()=>l("disabled")||e.disabled),f=r(()=>l("direction")),m=r(()=>{const n=e.checkedColor||l("checkedColor");if(n&&e.checked&&!a.value)return{borderColor:n,backgroundColor:n}}),h=n=>{const{target:i}=n,o=u.value,t=o===i||(o==null?void 0:o.contains(i));!a.value&&(t||!e.labelDisabled)&&s("toggle"),s("click",n)},b=()=>{const{bem:n,shape:i,checked:o}=e,t=e.iconSize||l("iconSize");return d("div",{ref:u,class:n("icon",[i,{disabled:a.value,checked:o}]),style:{fontSize:D(t)}},[c.icon?c.icon({checked:o,disabled:a.value}):d(x,{name:"success",style:m.value},null)])},k=()=>{if(c.default)return d("span",{class:e.bem("label",[e.labelPosition,{disabled:a.value}])},[c.default()])};return()=>{const n=e.labelPosition==="left"?[k(),b()]:[b(),k()];return d("div",{role:e.role,class:e.bem([{disabled:a.value,"label-disabled":e.labelDisabled},f.value]),tabindex:a.value?void 0:0,"aria-checked":e.checked,onClick:h},[n])}}});export{R as c,I as s};
|