Files
tools/vue/primitives/src/selection/combobox/ComboboxEmpty.vue
T
robonen eefd7abf83 feat(primitives): media-editor components, category reorg, perf + type cleanup
Reorganize components into category folders (forms/canvas/overlays/etc.); add the
media-editor headless family (timeline, curve-editor, waveform, crop, color
picker, etc.); apply perf fixes (O(1) collection lookups, plain-object drag
state, gesture-leak teardown, shallowRef color state, rect caching) and replace
source `any` with proper types.
2026-06-15 16:54:29 +07:00

42 lines
1.0 KiB
Vue

<script lang="ts">
import type { PrimitiveProps } from '../../internal/primitive';
/**
* Fallback content shown when the current search term matches no items. Renders only when
* the filtered count is zero, unless `always` is set.
*/
export interface ComboboxEmptyProps extends PrimitiveProps {
/** Render even when items exist but none are filtered out. */
always?: boolean;
}
</script>
<script setup lang="ts">
import { computed } from 'vue';
import { useForwardExpose } from '@robonen/vue';
import { Primitive } from '../../internal/primitive';
import { useComboboxRootContext } from './context';
const { as = 'div', always = false } = defineProps<ComboboxEmptyProps>();
const { forwardRef } = useForwardExpose();
const rootCtx = useComboboxRootContext();
const shouldRender = computed(() => {
if (always) return true;
return rootCtx.filterState.value.count === 0;
});
</script>
<template>
<Primitive
v-if="shouldRender"
:ref="forwardRef"
:as="as"
role="presentation"
>
<slot />
</Primitive>
</template>