// AUTO-GENERATED by scripts/generate-wrappers.mjs — do not edit by hand. import { defineComponent, h, onMounted, onBeforeUnmount } from 'vue'; import { Combobox } from '@42/core/combobox'; import { useC42 } from '../useC42'; /** * Autocomplete/multiselect input with filtering * * Vue wrapper for the `Combobox` controller (`@42/core/combobox`). 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: 'Combobox', props: { "multiple": { type: Boolean, required: false }, // boolean "filter": { type: Boolean, required: false }, // boolean "defaultValue": { required: false }, // string | string[] | null }, emits: ["combobox:change", "combobox:open", "combobox:close"], setup(props, { slots, emit }) { const options = () => { const out: Record = {}; for (const key of ["multiple", "filter", "defaultValue"] as const) { const value = (props as Record)[key]; if (value !== undefined) out[key] = value; } return out as Partial>; }; const el = useC42(Combobox, options); const listeners: Array<[string, (event: Event) => void]> = [ ["combobox:change", (event: Event) => emit("combobox:change", (event as CustomEvent).detail)], ["combobox:open", (event: Event) => emit("combobox:open", (event as CustomEvent).detail)], ["combobox:close", (event: Event) => emit("combobox:close", (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: combobox