Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/utils/index.cjs`),t=require(`../../common/mixins/input.cjs`),n=require(`../../_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`../validation-messages/validation-messages.cjs`),i=require(`./checkbox-constants.cjs`);let a=require(`vue`);var o={compatConfig:{MODE:3},name:`DtCheckbox`,components:{DtValidationMessages:r.default},mixins:[t.InputMixin,t.CheckableMixin,t.GroupableMixin,t.MessagesMixin],inheritAttrs:!1,emits:[`input`,`update:modelValue`,`focusin`,`focusout`],computed:{inputValidationClass(){return i.CHECKBOX_INPUT_VALIDATION_CLASSES[this.internalValidationState]},checkboxGroupValueChecked(){return this.groupContext?.selectedValues?.includes(this.value)??!1},hasLabel(){return!!(this.$slots.default||this.label)},hasMessages(){return this.formattedMessages.length&&this.showMessages},inputListeners(){return{input:()=>{},focusin:e=>this.$emit(`focusin`,e),focusout:e=>this.$emit(`focusout`,e),change:e=>this.emitValue(e.target)}}},watch:{checkboxGroupValueChecked:{immediate:!0,handler(e){this.hasGroup&&(this.internalChecked=e)}}},mounted(){this.runValidations()},methods:{removeClassStyleAttrs:e.removeClassStyleAttrs,addClassStyleAttrs:e.addClassStyleAttrs,emitValue(e){let{value:t,checked:n}=e;this.internalIndeterminate&&(n=!1,this.internalIndeterminate=!1,e.checked=!1),this.setGroupValue(t,n),this.$emit(`input`,n),this.$emit(`update:modelValue`,n)},runValidations(){this.validateInputLabels(this.hasLabel,this.$attrs[`aria-label`])}}},s={class:`d-checkbox__input`},c=[`checked`,`name`,`value`,`disabled`,`.indeterminate`],l={key:0,class:`d-checkbox__messages`,"data-qa":`checkbox-description-messages`};function u(e,t,n,r,i,o){let u=(0,a.resolveComponent)(`dt-validation-messages`);return(0,a.openBlock)(),(0,a.createElementBlock)(`div`,(0,a.mergeProps)({class:e.rootClass},o.addClassStyleAttrs(e.$attrs)),[(0,a.createElementVNode)(`label`,{class:(0,a.normalizeClass)([`d-checkbox-group`,{"d-checkbox-group--disabled":e.internalDisabled}])},[(0,a.createElementVNode)(`div`,s,[(0,a.createElementVNode)(`input`,(0,a.mergeProps)({type:`checkbox`,checked:e.internalChecked,name:e.internalName,value:e.value,disabled:e.internalDisabled,class:[`d-checkbox`,o.inputValidationClass,e.inputClass]},o.removeClassStyleAttrs(e.$attrs),{".indeterminate":e.internalIndeterminate},(0,a.toHandlers)(o.inputListeners,!0)),null,48,c)]),o.hasLabel?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,(0,a.mergeProps)({key:0,class:[e.labelClass,`d-checkbox__copy d-checkbox__label`]},e.labelChildProps,{"data-qa":`checkbox-label`}),[(0,a.renderSlot)(e.$slots,`default`,{},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(e.label),1)])],16)):(0,a.createCommentVNode)(``,!0)],2),e.$slots.description||e.description||o.hasMessages?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,l,[e.$slots.description||e.description?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,(0,a.mergeProps)({key:0,class:[`d-description`,e.descriptionClass]},e.descriptionChildProps,{"data-qa":`checkbox-description`}),[(0,a.renderSlot)(e.$slots,`description`,{},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(e.description),1)])],16)):(0,a.createCommentVNode)(``,!0),(0,a.createVNode)(u,(0,a.mergeProps)({"validation-messages":e.formattedMessages,"show-messages":e.showMessages,class:e.messagesClass},e.messagesChildProps,{"data-qa":`dt-checkbox-validation-messages`}),null,16,[`validation-messages`,`show-messages`,`class`])])):(0,a.createCommentVNode)(``,!0)],16)}var d=n.t(o,[[`render`,u]]);exports.default=d;
//# sourceMappingURL=checkbox.cjs.map