index.1f05bcbc.js 983 B

1
  1. import{E as g,G as C,I as t,d as h,a$ as f,a2 as k,j as i,aT as w,O as b}from"./ResizeObserver.es.39b48a47.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=h({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(w,{class:l("loading"),color:a},null)}};return f(()=>e.modelValue),()=>{const{size:a,loading:r,disabled:d,activeColor:v,inactiveColor:m}=e,n=o(),V={fontSize:k(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=b(x);export{P as S};