Files
tools/vue/primitives/src/selection/select/SelectItemText.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

38 lines
968 B
Vue

<script lang="ts">
import type { PrimitiveProps } from '../../internal/primitive';
/**
* The visible label of a `SelectItem`. Its text is what the root captures to
* show in `SelectValue` once the item is chosen, so each item should contain
* exactly one; use inside a `SelectItem`.
*/
export interface SelectItemTextProps extends PrimitiveProps {}
</script>
<script setup lang="ts">
import { watchPostEffect } from 'vue';
import { useForwardExpose } from '@robonen/vue';
import { Primitive } from '../../internal/primitive';
import { useSelectItemContext } from './context';
const { as = 'span' } = defineProps<SelectItemTextProps>();
const { forwardRef, currentElement } = useForwardExpose();
const itemCtx = useSelectItemContext();
watchPostEffect(() => {
itemCtx.onItemTextChange(currentElement.value);
});
</script>
<template>
<Primitive
:ref="forwardRef"
:as="as"
:id="itemCtx.textId.value"
>
<slot />
</Primitive>
</template>