From f69a3b0c6580504e9c1136cc52ccb386dcbce983 Mon Sep 17 00:00:00 2001 From: Matthew L McPeak Date: Mon, 13 Jul 2026 18:16:17 -0400 Subject: [PATCH] refactor: rewrite the Select root family without reka-ui Root/Value/Label/Group/Separator/ItemText now share a small provide/inject context. SelectValue's label lookup is backed by an itemLabels map that SelectItem populates on mount (next commit) -- matching the existing behavior where the trigger's displayed label only resolves once the dropdown has opened at least once. --- .../src/components/ui/select/Select.vue | 51 ++++++++++++++----- .../src/components/ui/select/SelectGroup.vue | 19 ++----- .../components/ui/select/SelectItemText.vue | 14 +---- .../src/components/ui/select/SelectLabel.vue | 15 ++---- .../components/ui/select/SelectSeparator.vue | 17 ++----- .../src/components/ui/select/SelectValue.vue | 15 +++--- .../src/components/ui/select/context.ts | 14 +++++ 7 files changed, 76 insertions(+), 69 deletions(-) create mode 100644 packages/library/src/components/ui/select/context.ts diff --git a/packages/library/src/components/ui/select/Select.vue b/packages/library/src/components/ui/select/Select.vue index c94bbe8..bf60823 100644 --- a/packages/library/src/components/ui/select/Select.vue +++ b/packages/library/src/components/ui/select/Select.vue @@ -1,19 +1,46 @@ diff --git a/packages/library/src/components/ui/select/SelectGroup.vue b/packages/library/src/components/ui/select/SelectGroup.vue index 1662d6c..2586d79 100644 --- a/packages/library/src/components/ui/select/SelectGroup.vue +++ b/packages/library/src/components/ui/select/SelectGroup.vue @@ -1,21 +1,12 @@ diff --git a/packages/library/src/components/ui/select/SelectItemText.vue b/packages/library/src/components/ui/select/SelectItemText.vue index b6700b1..91cf967 100644 --- a/packages/library/src/components/ui/select/SelectItemText.vue +++ b/packages/library/src/components/ui/select/SelectItemText.vue @@ -1,15 +1,3 @@ - - diff --git a/packages/library/src/components/ui/select/SelectLabel.vue b/packages/library/src/components/ui/select/SelectLabel.vue index a3dd751..e0ee986 100644 --- a/packages/library/src/components/ui/select/SelectLabel.vue +++ b/packages/library/src/components/ui/select/SelectLabel.vue @@ -1,17 +1,12 @@ diff --git a/packages/library/src/components/ui/select/SelectSeparator.vue b/packages/library/src/components/ui/select/SelectSeparator.vue index 3279645..ca8cb5a 100644 --- a/packages/library/src/components/ui/select/SelectSeparator.vue +++ b/packages/library/src/components/ui/select/SelectSeparator.vue @@ -1,19 +1,10 @@ diff --git a/packages/library/src/components/ui/select/SelectValue.vue b/packages/library/src/components/ui/select/SelectValue.vue index d5ce58b..f54bceb 100644 --- a/packages/library/src/components/ui/select/SelectValue.vue +++ b/packages/library/src/components/ui/select/SelectValue.vue @@ -1,15 +1,16 @@ diff --git a/packages/library/src/components/ui/select/context.ts b/packages/library/src/components/ui/select/context.ts new file mode 100644 index 0000000..e99fcd4 --- /dev/null +++ b/packages/library/src/components/ui/select/context.ts @@ -0,0 +1,14 @@ +import type { InjectionKey, Ref } from 'vue' + +export interface SelectContext { + open: Ref + modelValue: Ref + disabled: Ref + triggerRef: Ref + contentId: string + itemLabels: Map + registerLabel: (value: string, label: string) => void + unregisterLabel: (value: string) => void +} + +export const SelectContextKey: InjectionKey = Symbol('SelectContext')