1 |
- import{I as v,a0 as g,G as P,d as C,J as S,ax as x,H as z,U as y,W as r,j as d,N as B,a2 as D}from"./ResizeObserver.es.39b48a47.js";const G={name:v,shape:g("round"),disabled:Boolean,iconSize:P,modelValue:v,checkedColor:String,labelPosition:String,labelDisabled:Boolean};var j=C({props:S({},G,{bem:x(Function),role:String,parent:Object,checked:Boolean,bindGroup:z}),emits:["click","toggle"],setup(e,{emit:s,slots:c}){const u=y(),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(B,{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{G as c,j as s};
|