import{E as k,G as p,g as C,j as u,N as B,o as t,c as r,a as i,L as S,Z as V,K as q,H as $,d as N,t as g,y as s,l as d}from"./entry.9e31e8a4.js";import{t as w}from"./tw-merge.27ca352e.js";import{k as A,u as j}from"./ui.config.7ae255de.js";import{u as G}from"./useFormGroup.38d9f2fe.js";import{_ as D}from"./_plugin-vue_export-helper.c27b6911.js";import"./index.87a09f8b.js";const h=k(p.ui.strategy,p.ui.checkbox,A),E=C({inheritAttrs:!1,props:{value:{type:[String,Number,Boolean,Object],default:null},modelValue:{type:[Boolean,Array],default:null},name:{type:String,default:null},disabled:{type:Boolean,default:!1},checked:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1},help:{type:String,default:null},label:{type:String,default:null},required:{type:Boolean,default:!1},color:{type:String,default:()=>h.default.color,validator(e){return p.ui.colors.includes(e)}},inputClass:{type:String,default:""},ui:{type:Object,default:void 0}},emits:["update:modelValue","change"],setup(e,{emit:l}){const{ui:a,attrs:m}=j("checkbox",e.ui,h,{mergeWrapper:!0}),{emitFormChange:c,formGroup:f}=G(),o=u(()=>f?.error?.value?"red":e.color),b=u({get(){return e.modelValue},set(n){l("update:modelValue",n)}}),v=n=>{l("change",n),c()},y=u(()=>w(B(a.value.base,a.value.rounded,a.value.background,a.value.border,a.value.ring.replaceAll("{color}",o.value),a.value.color.replaceAll("{color}",o.value)),e.inputClass));return{ui:a,attrs:m,toggle:b,inputClass:y,onChange:v}}}),F={class:"flex items-center h-5"},M=["id","name","required","value","disabled","checked","indeterminate"],O={key:0,class:"ms-3 text-sm"},U=["for"];function z(e,l,a,m,c,f){return t(),r("div",{class:s(e.ui.wrapper)},[i("div",F,[S(i("input",q({id:e.name,"onUpdate:modelValue":l[0]||(l[0]=o=>e.toggle=o),name:e.name,required:e.required,value:e.value,disabled:e.disabled,checked:e.checked,indeterminate:e.indeterminate,type:"checkbox",class:["form-checkbox",e.inputClass]},e.attrs,{onChange:l[1]||(l[1]=(...o)=>e.onChange&&e.onChange(...o))}),null,16,M),[[V,e.toggle]])]),e.label||e.$slots.label?(t(),r("div",O,[i("label",{for:e.name,class:s(e.ui.label)},[$(e.$slots,"label",{},()=>[N(g(e.label),1)]),e.required?(t(),r("span",{key:0,class:s(e.ui.required)},"*",2)):d("",!0)],10,U),e.help?(t(),r("p",{key:0,class:s(e.ui.help)},g(e.help),3)):d("",!0)])):d("",!0)],2)}const T=D(E,[["render",z]]);export{T as default};
