(function(r,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@vue-interface/form-control"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@vue-interface/form-control","vue"],t):(r=typeof globalThis<"u"?globalThis:r||self,t(r.LightSwitchField={},r.VueInterfaceFormControl,r.Vue))})(this,function(r,t,e){"use strict";const d=e.defineComponent({name:"LightSwitchField",extends:t.FormControl,props:{activeClass:{type:String,default:void 0},formControlClass:{type:String,default:"form-switch"},inactiveClass:{type:String,default:void 0},onValue:{type:[String,Number,Boolean,Object,Array],default:1},offValue:{type:[String,Number,Boolean,Object,Array],default:0}},computed:{model:{get(){return this.getModelValue()===this.onValue},set(o){this.setModelValue(o===!0?this.onValue:this.offValue)}},isActive:function(){return this.model===this.onValue},controlSizeClass(){return this.size==="md"?"form-control":this.size&&`form-control-${this.size}`}}}),c=(o,n)=>{const l=o.__vccOpts||o;for(const[s,a]of n)l[s]=a;return l},m=["id","disabled"],f=["for"],p={invalid:"",class:"invalid-feedback"},h=e.createElementVNode("br",null,null,-1),b={valid:"",class:"valid-feedback"};function C(o,n,l,s,a,g){const S=e.resolveComponent("FormControlErrors"),V=e.resolveComponent("FormControlFeedback");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(o.formGroupClasses)},[e.createElementVNode("div",{ref:"input",class:e.normalizeClass(["border-2 border-red-500",{...o.controlClasses,["is-valid"]:o.isValid,["is-invalid"]:o.isInvalid,["is-active"]:o.isActive,[String(o.activeClass)]:o.isActive,[String(o.inactiveClass)]:!o.isActive}])},[e.withDirectives(e.createElementVNode("input",{id:o.id,ref:"input","onUpdate:modelValue":n[0]||(n[0]=i=>o.model=i),disabled:o.controlAttributes.disabled,type:"checkbox",class:"form-check-input"},null,8,m),[[e.vModelCheckbox,o.model]]),e.renderSlot(o.$slots,"label",{},()=>[o.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:o.id,style:{"padding-left":".5em"}},[e.renderSlot(o.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(o.label),1)])],8,f)):e.createCommentVNode("",!0)])],2),e.renderSlot(o.$slots,"errors",e.normalizeProps(e.guardReactiveProps({error:o.error,errors:o.errors,id:o.$attrs.id,name:o.$attrs.name})),()=>[o.error||o.errors?(e.openBlock(),e.createBlock(S,{key:0,id:o.$attrs.id,name:o.$attrs.name,error:o.error,errors:o.errors},{default:e.withCtx(({error:i})=>[e.createElementVNode("div",p,[e.createTextVNode(e.toDisplayString(i),1),h])]),_:1},8,["id","name","error","errors"])):e.createCommentVNode("",!0)]),e.renderSlot(o.$slots,"feedback",e.normalizeProps(e.guardReactiveProps({feedback:o.feedback})),()=>[e.createVNode(V,{feedback:o.feedback},{default:e.withCtx(({feedback:i})=>[e.createElementVNode("div",b,e.toDisplayString(i),1)]),_:1},8,["feedback"])]),e.renderSlot(o.$slots,"help",{},()=>[o.helpText?(e.openBlock(),e.createElementBlock("small",{key:0,ref:"help"},e.toDisplayString(o.helpText),513)):e.createCommentVNode("",!0)])],2)}const k=c(d,[["render",C]]);r.LightSwitchField=k,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=light-switch-field.umd.cjs.map