// AUTO-GENERATED by scripts/generate-wrappers.mjs — do not edit by hand. import { defineComponent, h, onMounted, onBeforeUnmount } from 'vue'; import { Checkbox } from '@42/core/choice'; import { useC42 } from '../useC42'; /** * Checkbox, switch and radio-group form toggles * * Vue wrapper for the `Checkbox` controller (`@42/core/choice`). Props mirror * the controller options; events are re-emitted with the CustomEvent detail. * Place the controller markup in the default slot. */ export default defineComponent({ name: 'Checkbox', props: { "checked": { type: Boolean, required: false }, // boolean "indeterminate": { type: Boolean, required: false }, // boolean "disabled": { type: Boolean, required: false }, // boolean }, emits: ["checkbox:change", "switch:change", "radio:change"], setup(props, { slots, emit }) { const options = () => { const out: Record = {}; for (const key of ["checked", "indeterminate", "disabled"] as const) { const value = (props as Record)[key]; if (value !== undefined) out[key] = value; } return out as Partial>; }; const el = useC42(Checkbox, options); const listeners: Array<[string, (event: Event) => void]> = [ ["checkbox:change", (event: Event) => emit("checkbox:change", (event as CustomEvent).detail)], ["switch:change", (event: Event) => emit("switch:change", (event as CustomEvent).detail)], ["radio:change", (event: Event) => emit("radio:change", (event as CustomEvent).detail)], ]; onMounted(() => { const node = el.value; if (!node) return; for (const [name, handler] of listeners) node.addEventListener(name, handler); }); onBeforeUnmount(() => { const node = el.value; if (!node) return; for (const [name, handler] of listeners) node.removeEventListener(name, handler); }); return () => h('div', { ref: el }, slots.default ? slots.default() : undefined); }, }); // Component id in @42/core manifest: choice