1 |
- import{E as g,G as C,I as t,d as f,bf as h,a2 as b,j as i,aT as k,O as w}from"./ResizeObserver.es.b7226882.js";const[S,l]=g("switch"),y={size:C,loading:Boolean,disabled:Boolean,modelValue:t,activeColor:String,inactiveColor:String,activeValue:{type:t,default:!0},inactiveValue:{type:t,default:!1}};var x=f({name:S,props:y,emits:["change","update:modelValue"],setup(e,{emit:c}){const o=()=>e.modelValue===e.activeValue,s=()=>{if(!e.disabled&&!e.loading){const a=o()?e.inactiveValue:e.activeValue;c("update:modelValue",a),c("change",a)}},u=()=>{if(e.loading){const a=o()?e.activeColor:e.inactiveColor;return i(k,{class:l("loading"),color:a},null)}};return h(()=>e.modelValue),()=>{const{size:a,loading:r,disabled:d,activeColor:v,inactiveColor:m}=e,n=o(),V={fontSize:b(a),backgroundColor:n?v:m};return i("div",{role:"switch",class:l({on:n,loading:r,disabled:d}),style:V,tabindex:d?void 0:0,"aria-checked":n,onClick:s},[i("div",{class:l("node")},[u()])])}}});const P=w(x);export{P as S};
|