// AUTO-GENERATED by scripts/generate-wrappers.mjs — do not edit by hand. import { defineComponent, h, onMounted, onBeforeUnmount } from 'vue'; import { Avatar } from '@42/core/avatar'; import { useC42 } from '../useC42'; /** * Image with initials fallback and optional status dot * * Vue wrapper for the `Avatar` controller (`@42/core/avatar`). 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: 'Avatar', props: { "name": { type: String, required: false }, // string "status": { required: false }, // AvatarStatus | null }, emits: ["avatar:load", "avatar:error", "avatar:statuschange"], setup(props, { slots, emit }) { const options = () => { const out: Record = {}; for (const key of ["name", "status"] as const) { const value = (props as Record)[key]; if (value !== undefined) out[key] = value; } return out as Partial>; }; const el = useC42(Avatar, options); const listeners: Array<[string, (event: Event) => void]> = [ ["avatar:load", (event: Event) => emit("avatar:load", (event as CustomEvent).detail)], ["avatar:error", (event: Event) => emit("avatar:error", (event as CustomEvent).detail)], ["avatar:statuschange", (event: Event) => emit("avatar:statuschange", (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: avatar