@neynar/ui 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/accordion.d.ts +1 -25
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +240 -46
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts +73 -11
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +44 -10
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +117 -33
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts +50 -71
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +231 -49
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +189 -71
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/calendar.d.ts +197 -40
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +7 -22
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts +369 -99
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/checkbox.d.ts +110 -38
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/collapsible.d.ts +246 -61
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/combobox.d.ts +207 -159
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/command.d.ts +336 -67
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/container.d.ts +159 -64
- package/dist/components/ui/container.d.ts.map +1 -1
- package/dist/components/ui/context-menu.d.ts +321 -39
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +113 -86
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +106 -25
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts +388 -59
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +521 -74
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/empty-state.d.ts +148 -76
- package/dist/components/ui/empty-state.d.ts.map +1 -1
- package/dist/components/ui/hover-card.d.ts +253 -34
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +143 -44
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +0 -8
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/menubar.d.ts +288 -46
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +444 -127
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/pagination.d.ts +342 -66
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +0 -8
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/progress.d.ts +88 -30
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/radio-group.d.ts +189 -45
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/resizable.d.ts +178 -62
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +180 -21
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +382 -60
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +52 -39
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +144 -27
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +81 -31
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/skeleton.d.ts +94 -32
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.d.ts +37 -31
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/sonner.d.ts +280 -46
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/stack.d.ts +289 -148
- package/dist/components/ui/stack.d.ts.map +1 -1
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/container.stories.d.ts +2 -3
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/stack.stories.d.ts +1 -1
- package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
- package/dist/components/ui/switch.d.ts +44 -38
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -22
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/text-field.d.ts +170 -84
- package/dist/components/ui/text-field.d.ts.map +1 -1
- package/dist/components/ui/textarea.d.ts +106 -29
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.d.ts +190 -65
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme.d.ts +107 -23
- package/dist/components/ui/theme.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +143 -67
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle.d.ts +118 -30
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +152 -28
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +452 -134
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/index.js +9388 -8281
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +173 -3
- package/package.json +5 -2
- package/src/components/ui/accordion.tsx +112 -27
- package/src/components/ui/alert-dialog.tsx +401 -46
- package/src/components/ui/alert.tsx +114 -11
- package/src/components/ui/aspect-ratio.tsx +69 -14
- package/src/components/ui/avatar.tsx +179 -33
- package/src/components/ui/badge.tsx +74 -75
- package/src/components/ui/breadcrumb.tsx +335 -50
- package/src/components/ui/button.tsx +198 -90
- package/src/components/ui/calendar.tsx +867 -43
- package/src/components/ui/card.tsx +140 -33
- package/src/components/ui/carousel.tsx +529 -98
- package/src/components/ui/chart.tsx +222 -1
- package/src/components/ui/checkbox.tsx +176 -38
- package/src/components/ui/collapsible.tsx +321 -67
- package/src/components/ui/combobox.tsx +284 -83
- package/src/components/ui/command.tsx +527 -67
- package/src/components/ui/container.tsx +217 -65
- package/src/components/ui/context-menu.tsx +716 -51
- package/src/components/ui/date-picker.tsx +228 -38
- package/src/components/ui/dialog.tsx +270 -33
- package/src/components/ui/drawer.tsx +546 -67
- package/src/components/ui/dropdown-menu.tsx +657 -74
- package/src/components/ui/empty-state.tsx +241 -82
- package/src/components/ui/hover-card.tsx +328 -39
- package/src/components/ui/input.tsx +207 -44
- package/src/components/ui/label.tsx +98 -8
- package/src/components/ui/menubar.tsx +587 -54
- package/src/components/ui/navigation-menu.tsx +557 -128
- package/src/components/ui/pagination.tsx +561 -79
- package/src/components/ui/popover.tsx +119 -8
- package/src/components/ui/progress.tsx +131 -29
- package/src/components/ui/radio-group.tsx +260 -51
- package/src/components/ui/resizable.tsx +289 -63
- package/src/components/ui/scroll-area.tsx +377 -66
- package/src/components/ui/select.tsx +545 -60
- package/src/components/ui/separator.tsx +146 -40
- package/src/components/ui/sheet.tsx +348 -31
- package/src/components/ui/sidebar.tsx +471 -29
- package/src/components/ui/skeleton.tsx +114 -32
- package/src/components/ui/slider.tsx +77 -31
- package/src/components/ui/sonner.tsx +574 -46
- package/src/components/ui/stack.tsx +423 -101
- package/src/components/ui/switch.tsx +78 -39
- package/src/components/ui/table.tsx +170 -4
- package/src/components/ui/tabs.tsx +108 -22
- package/src/components/ui/text-field.tsx +226 -81
- package/src/components/ui/textarea.tsx +180 -29
- package/src/components/ui/theme-toggle.tsx +313 -65
- package/src/components/ui/theme.tsx +117 -23
- package/src/components/ui/toggle-group.tsx +280 -69
- package/src/components/ui/toggle.tsx +124 -35
- package/src/components/ui/tooltip.tsx +239 -29
- package/src/components/ui/typography.tsx +1115 -165
|
@@ -6,13 +6,176 @@ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
|
6
6
|
|
|
7
7
|
import { cn } from "@/lib/utils";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Props for Select component (Documentation only - NOT used in component implementation)
|
|
11
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
12
|
+
*/
|
|
13
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
14
|
+
type SelectDocsProps = {
|
|
15
|
+
/** The value of the select when initially rendered. Use when you do not need to control the state of the select */
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
/** The controlled value of the select. Must be used in conjunction with onValueChange */
|
|
18
|
+
value?: string;
|
|
19
|
+
/** Event handler called when the value changes */
|
|
20
|
+
onValueChange?: (value: string) => void;
|
|
21
|
+
/** The open state of the select when it is initially rendered. Use when you do not need to control its open state */
|
|
22
|
+
defaultOpen?: boolean;
|
|
23
|
+
/** The controlled open state of the select. Must be used in conjunction with onOpenChange */
|
|
24
|
+
open?: boolean;
|
|
25
|
+
/** Event handler called when the open state of the select changes */
|
|
26
|
+
onOpenChange?: (open: boolean) => void;
|
|
27
|
+
/** The reading direction of the select when applicable. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode @default "ltr" */
|
|
28
|
+
dir?: "ltr" | "rtl";
|
|
29
|
+
/** The name of the select. Submitted with its owning form as part of a name/value pair */
|
|
30
|
+
name?: string;
|
|
31
|
+
/** When true, prevents the user from interacting with the select @default false */
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/** When true, indicates that the user must select a value before the owning form can be submitted @default false */
|
|
34
|
+
required?: boolean;
|
|
35
|
+
} & React.ComponentProps<typeof SelectPrimitive.Root>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Props for SelectGroup component (Documentation only - NOT used in component implementation)
|
|
39
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
40
|
+
*/
|
|
41
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
42
|
+
type SelectGroupDocsProps = {
|
|
43
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
44
|
+
asChild?: boolean;
|
|
45
|
+
} & React.HTMLAttributes<HTMLDivElement> &
|
|
46
|
+
React.RefAttributes<React.ElementRef<typeof SelectPrimitive.Group>>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Props for SelectValue component (Documentation only - NOT used in component implementation)
|
|
50
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
51
|
+
*/
|
|
52
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
53
|
+
type SelectValueDocsProps = {
|
|
54
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
55
|
+
asChild?: boolean;
|
|
56
|
+
/** The content that will be rendered inside the SelectValue when no value or defaultValue is set. Must be a string when used with form submission */
|
|
57
|
+
placeholder?: React.ReactNode;
|
|
58
|
+
} & React.HTMLAttributes<HTMLSpanElement> &
|
|
59
|
+
React.RefAttributes<React.ElementRef<typeof SelectPrimitive.Value>>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Props for SelectTrigger component (Documentation only - NOT used in component implementation)
|
|
63
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
64
|
+
*/
|
|
65
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
66
|
+
type SelectTriggerDocsProps = {
|
|
67
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
68
|
+
asChild?: boolean;
|
|
69
|
+
/** The size variant of the trigger button affecting height and padding @default "default" */
|
|
70
|
+
size?: "sm" | "default";
|
|
71
|
+
} & React.HTMLAttributes<HTMLButtonElement> &
|
|
72
|
+
React.RefAttributes<React.ElementRef<typeof SelectPrimitive.Trigger>>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Props for SelectContent component (Documentation only - NOT used in component implementation)
|
|
76
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
77
|
+
*/
|
|
78
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
79
|
+
type SelectContentDocsProps = {
|
|
80
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
81
|
+
asChild?: boolean;
|
|
82
|
+
/** The positioning strategy to use for the content. "item-aligned" will position based on the active item. "popper" will position according to the side and align props @default "item-aligned" */
|
|
83
|
+
position?: "item-aligned" | "popper";
|
|
84
|
+
/** The preferred side of the anchor to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled @default "bottom" */
|
|
85
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
86
|
+
/** The distance in pixels from the anchor @default 0 */
|
|
87
|
+
sideOffset?: number;
|
|
88
|
+
/** The preferred alignment against the anchor. May change when collisions occur @default "center" */
|
|
89
|
+
align?: "start" | "center" | "end";
|
|
90
|
+
/** An offset in pixels from the "start" or "end" alignment options @default 0 */
|
|
91
|
+
alignOffset?: number;
|
|
92
|
+
/** When true, overrides the side and align preferences to prevent collisions with boundary edges @default true */
|
|
93
|
+
avoidCollisions?: boolean;
|
|
94
|
+
/** The element used as the collision boundary. By default this is the viewport, though you can provide additional element(s) to be included in this check @default [] */
|
|
95
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
96
|
+
/** The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object @default 0 */
|
|
97
|
+
collisionPadding?:
|
|
98
|
+
| number
|
|
99
|
+
| Partial<Record<"top" | "right" | "bottom" | "left", number>>;
|
|
100
|
+
/** The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners @default 0 */
|
|
101
|
+
arrowPadding?: number;
|
|
102
|
+
/** The sticky behavior on the align axis. "partial" will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless @default "partial" */
|
|
103
|
+
sticky?: "partial" | "always";
|
|
104
|
+
/** Whether to hide the content when the trigger becomes fully occluded @default false */
|
|
105
|
+
hideWhenDetached?: boolean;
|
|
106
|
+
} & React.HTMLAttributes<HTMLDivElement> &
|
|
107
|
+
React.RefAttributes<React.ElementRef<typeof SelectPrimitive.Content>>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Props for SelectLabel component (Documentation only - NOT used in component implementation)
|
|
111
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
112
|
+
*/
|
|
113
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
114
|
+
type SelectLabelDocsProps = {
|
|
115
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
116
|
+
asChild?: boolean;
|
|
117
|
+
} & React.HTMLAttributes<HTMLDivElement> &
|
|
118
|
+
React.RefAttributes<React.ElementRef<typeof SelectPrimitive.Label>>;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Props for SelectItem component (Documentation only - NOT used in component implementation)
|
|
122
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
123
|
+
*/
|
|
124
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
125
|
+
type SelectItemDocsProps = {
|
|
126
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
127
|
+
asChild?: boolean;
|
|
128
|
+
/** The value given as data when submitted with a name (required) */
|
|
129
|
+
value: string;
|
|
130
|
+
/** When true, prevents the user from interacting with the item @default false */
|
|
131
|
+
disabled?: boolean;
|
|
132
|
+
/** Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the SelectItem. Use this when the content is complex, or you have non-textual content inside */
|
|
133
|
+
textValue?: string;
|
|
134
|
+
} & React.HTMLAttributes<HTMLDivElement> &
|
|
135
|
+
React.RefAttributes<React.ElementRef<typeof SelectPrimitive.Item>>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Props for SelectSeparator component (Documentation only - NOT used in component implementation)
|
|
139
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
140
|
+
*/
|
|
141
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
142
|
+
type SelectSeparatorDocsProps = {
|
|
143
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
144
|
+
asChild?: boolean;
|
|
145
|
+
} & React.HTMLAttributes<HTMLDivElement> &
|
|
146
|
+
React.RefAttributes<React.ElementRef<typeof SelectPrimitive.Separator>>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Props for SelectScrollUpButton component (Documentation only - NOT used in component implementation)
|
|
150
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
151
|
+
*/
|
|
152
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
153
|
+
type SelectScrollUpButtonDocsProps = {
|
|
154
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
155
|
+
asChild?: boolean;
|
|
156
|
+
} & React.HTMLAttributes<HTMLDivElement> &
|
|
157
|
+
React.RefAttributes<React.ElementRef<typeof SelectPrimitive.ScrollUpButton>>;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Props for SelectScrollDownButton component (Documentation only - NOT used in component implementation)
|
|
161
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
162
|
+
*/
|
|
163
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
164
|
+
type SelectScrollDownButtonDocsProps = {
|
|
165
|
+
/** When true, renders a custom component instead of the default element @default false */
|
|
166
|
+
asChild?: boolean;
|
|
167
|
+
} & React.HTMLAttributes<HTMLDivElement> &
|
|
168
|
+
React.RefAttributes<
|
|
169
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>
|
|
170
|
+
>;
|
|
171
|
+
|
|
9
172
|
/**
|
|
10
173
|
* Select - A dropdown selection component built on Radix UI primitives
|
|
11
174
|
*
|
|
12
175
|
* Provides a dropdown menu for selecting a single option from a list of choices.
|
|
13
176
|
* Features comprehensive keyboard navigation, grouping capabilities, accessibility
|
|
14
177
|
* compliance, and flexible styling options. Perfect for forms, filters, and
|
|
15
|
-
* configuration interfaces.
|
|
178
|
+
* configuration interfaces. Built on Radix UI Select.Root with enhanced styling.
|
|
16
179
|
*
|
|
17
180
|
* @component
|
|
18
181
|
* @example
|
|
@@ -48,7 +211,7 @@ import { cn } from "@/lib/utils";
|
|
|
48
211
|
*
|
|
49
212
|
* @example
|
|
50
213
|
* ```tsx
|
|
51
|
-
* // Grouped options with separators
|
|
214
|
+
* // Grouped options with separators and labels
|
|
52
215
|
* <Select>
|
|
53
216
|
* <SelectTrigger>
|
|
54
217
|
* <SelectValue placeholder="Select a timezone" />
|
|
@@ -58,6 +221,7 @@ import { cn } from "@/lib/utils";
|
|
|
58
221
|
* <SelectLabel>North America</SelectLabel>
|
|
59
222
|
* <SelectItem value="est">Eastern Time (EST)</SelectItem>
|
|
60
223
|
* <SelectItem value="cst">Central Time (CST)</SelectItem>
|
|
224
|
+
* <SelectItem value="pst">Pacific Time (PST)</SelectItem>
|
|
61
225
|
* </SelectGroup>
|
|
62
226
|
* <SelectSeparator />
|
|
63
227
|
* <SelectGroup>
|
|
@@ -69,19 +233,55 @@ import { cn } from "@/lib/utils";
|
|
|
69
233
|
* </Select>
|
|
70
234
|
* ```
|
|
71
235
|
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```tsx
|
|
238
|
+
* // Form integration with validation and required state
|
|
239
|
+
* <form>
|
|
240
|
+
* <Select name="userRole" required defaultValue="">
|
|
241
|
+
* <SelectTrigger id="role" aria-describedby="role-error">
|
|
242
|
+
* <SelectValue placeholder="Choose your role" />
|
|
243
|
+
* </SelectTrigger>
|
|
244
|
+
* <SelectContent>
|
|
245
|
+
* <SelectItem value="admin">Administrator</SelectItem>
|
|
246
|
+
* <SelectItem value="user">User</SelectItem>
|
|
247
|
+
* <SelectItem value="guest">Guest</SelectItem>
|
|
248
|
+
* </SelectContent>
|
|
249
|
+
* </Select>
|
|
250
|
+
* </form>
|
|
251
|
+
* ```
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```tsx
|
|
255
|
+
* // Disabled states and interactions
|
|
256
|
+
* <Select disabled>
|
|
257
|
+
* <SelectTrigger>
|
|
258
|
+
* <SelectValue placeholder="Disabled select" />
|
|
259
|
+
* </SelectTrigger>
|
|
260
|
+
* <SelectContent>
|
|
261
|
+
* <SelectItem value="1">Option 1</SelectItem>
|
|
262
|
+
* <SelectItem value="2" disabled>Option 2 (disabled)</SelectItem>
|
|
263
|
+
* </SelectContent>
|
|
264
|
+
* </Select>
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
72
267
|
* @accessibility
|
|
73
|
-
* -
|
|
74
|
-
* -
|
|
75
|
-
* - Screen
|
|
76
|
-
* -
|
|
77
|
-
* -
|
|
78
|
-
* -
|
|
268
|
+
* - **Keyboard Navigation**: Arrow keys to navigate items, Enter/Space to select, Escape to close
|
|
269
|
+
* - **Focus Management**: Focus trapped within dropdown when open, returns to trigger on close
|
|
270
|
+
* - **Screen Reader Support**: Announces selected values, state changes, and item counts
|
|
271
|
+
* - **ARIA Compliance**: Proper roles (combobox, listbox, option), states (expanded, selected), and properties
|
|
272
|
+
* - **Typeahead**: Type characters to jump to matching items
|
|
273
|
+
* - **Home/End Keys**: Jump to first/last items in the list
|
|
274
|
+
* - **Disabled State**: Properly communicated to assistive technology
|
|
275
|
+
* - **Required Field**: Integrates with form validation and screen reader announcements
|
|
79
276
|
*
|
|
80
277
|
* @see {@link SelectTrigger} - The button that opens the dropdown
|
|
81
278
|
* @see {@link SelectContent} - The dropdown content container
|
|
82
279
|
* @see {@link SelectItem} - Individual selectable options
|
|
83
280
|
* @see {@link SelectGroup} - Container for grouping related items
|
|
84
281
|
* @see {@link SelectValue} - Displays selected value or placeholder
|
|
282
|
+
* @see {@link SelectLabel} - Non-selectable labels for groups
|
|
283
|
+
* @see {@link SelectSeparator} - Visual dividers between groups
|
|
284
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/select} for Radix UI documentation
|
|
85
285
|
* @see {@link https://ui.shadcn.com/docs/components/select} for design patterns
|
|
86
286
|
* @since 1.0.0
|
|
87
287
|
*/
|
|
@@ -95,20 +295,57 @@ function Select({
|
|
|
95
295
|
* SelectGroup - Container for grouping related select items
|
|
96
296
|
*
|
|
97
297
|
* Groups related options together with an optional label for better organization
|
|
98
|
-
* and improved user experience when dealing with many options.
|
|
298
|
+
* and improved user experience when dealing with many options. Built on Radix UI
|
|
299
|
+
* Select.Group with semantic grouping that enhances screen reader navigation.
|
|
99
300
|
*
|
|
100
301
|
* @component
|
|
101
302
|
* @example
|
|
102
303
|
* ```tsx
|
|
304
|
+
* // Basic group with label
|
|
103
305
|
* <SelectGroup>
|
|
104
306
|
* <SelectLabel>Fruits</SelectLabel>
|
|
105
307
|
* <SelectItem value="apple">Apple</SelectItem>
|
|
106
308
|
* <SelectItem value="banana">Banana</SelectItem>
|
|
309
|
+
* <SelectItem value="orange">Orange</SelectItem>
|
|
310
|
+
* </SelectGroup>
|
|
311
|
+
* ```
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```tsx
|
|
315
|
+
* // Multiple groups with separators
|
|
316
|
+
* <SelectContent>
|
|
317
|
+
* <SelectGroup>
|
|
318
|
+
* <SelectLabel>Popular Choices</SelectLabel>
|
|
319
|
+
* <SelectItem value="most-popular">Most Popular</SelectItem>
|
|
320
|
+
* <SelectItem value="trending">Trending</SelectItem>
|
|
321
|
+
* </SelectGroup>
|
|
322
|
+
* <SelectSeparator />
|
|
323
|
+
* <SelectGroup>
|
|
324
|
+
* <SelectLabel>All Options</SelectLabel>
|
|
325
|
+
* <SelectItem value="option1">Option 1</SelectItem>
|
|
326
|
+
* <SelectItem value="option2">Option 2</SelectItem>
|
|
327
|
+
* </SelectGroup>
|
|
328
|
+
* </SelectContent>
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```tsx
|
|
333
|
+
* // Group without label for simple separation
|
|
334
|
+
* <SelectGroup>
|
|
335
|
+
* <SelectItem value="item1">Item 1</SelectItem>
|
|
336
|
+
* <SelectItem value="item2">Item 2</SelectItem>
|
|
107
337
|
* </SelectGroup>
|
|
108
338
|
* ```
|
|
109
339
|
*
|
|
110
|
-
* @
|
|
111
|
-
*
|
|
340
|
+
* @accessibility
|
|
341
|
+
* - **Semantic Grouping**: Creates logical groups that screen readers can navigate
|
|
342
|
+
* - **Label Association**: SelectLabel properly associates with group items
|
|
343
|
+
* - **Focus Management**: Arrow keys move between items within and across groups
|
|
344
|
+
* - **Screen Reader Navigation**: Group boundaries announced to assistive technology
|
|
345
|
+
*
|
|
346
|
+
* @see {@link SelectLabel} - Optional label for the group
|
|
347
|
+
* @see {@link SelectItem} - Individual items within the group
|
|
348
|
+
* @see {@link SelectSeparator} - Visual divider between groups
|
|
112
349
|
* @since 1.0.0
|
|
113
350
|
*/
|
|
114
351
|
function SelectGroup({
|
|
@@ -121,17 +358,56 @@ function SelectGroup({
|
|
|
121
358
|
* SelectValue - Displays the selected value or placeholder
|
|
122
359
|
*
|
|
123
360
|
* Renders the currently selected option's text or a placeholder when no option
|
|
124
|
-
* is selected.
|
|
361
|
+
* is selected. Built on Radix UI Select.Value with proper text truncation and
|
|
362
|
+
* styling. Must be used inside SelectTrigger to display the current selection state.
|
|
125
363
|
*
|
|
126
364
|
* @component
|
|
127
365
|
* @example
|
|
128
366
|
* ```tsx
|
|
367
|
+
* // Basic usage with placeholder
|
|
129
368
|
* <SelectTrigger>
|
|
130
369
|
* <SelectValue placeholder="Choose an option" />
|
|
131
370
|
* </SelectTrigger>
|
|
132
371
|
* ```
|
|
133
372
|
*
|
|
134
|
-
* @
|
|
373
|
+
* @example
|
|
374
|
+
* ```tsx
|
|
375
|
+
* // Custom placeholder styling
|
|
376
|
+
* <SelectTrigger>
|
|
377
|
+
* <SelectValue
|
|
378
|
+
* placeholder={
|
|
379
|
+
* <span className="text-muted-foreground italic">
|
|
380
|
+
* No selection made
|
|
381
|
+
* </span>
|
|
382
|
+
* }
|
|
383
|
+
* />
|
|
384
|
+
* </SelectTrigger>
|
|
385
|
+
* ```
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```tsx
|
|
389
|
+
* // Using asChild for complete custom rendering
|
|
390
|
+
* <SelectValue asChild>
|
|
391
|
+
* <div className="flex items-center gap-2">
|
|
392
|
+
* {selectedItem ? (
|
|
393
|
+
* <>
|
|
394
|
+
* <ItemIcon />
|
|
395
|
+
* <span>{selectedItem.label}</span>
|
|
396
|
+
* </>
|
|
397
|
+
* ) : (
|
|
398
|
+
* <span className="text-muted-foreground">Select item...</span>
|
|
399
|
+
* )}
|
|
400
|
+
* </div>
|
|
401
|
+
* </SelectValue>
|
|
402
|
+
* ```
|
|
403
|
+
*
|
|
404
|
+
* @accessibility
|
|
405
|
+
* - **Value Announcement**: Selected value announced to screen readers
|
|
406
|
+
* - **Placeholder Semantics**: Placeholder properly identified for assistive technology
|
|
407
|
+
* - **Text Truncation**: Long values truncated with ellipsis to prevent layout issues
|
|
408
|
+
* - **Content Updates**: Dynamic content changes announced to screen readers
|
|
409
|
+
*
|
|
410
|
+
* @see {@link SelectTrigger} - Required parent container for the value display
|
|
135
411
|
* @since 1.0.0
|
|
136
412
|
*/
|
|
137
413
|
function SelectValue({
|
|
@@ -144,8 +420,13 @@ function SelectValue({
|
|
|
144
420
|
* SelectTrigger - The button that opens the select dropdown
|
|
145
421
|
*
|
|
146
422
|
* A styled button that displays the current value and triggers the dropdown menu.
|
|
147
|
-
*
|
|
148
|
-
* size variants
|
|
423
|
+
* Built on Radix UI Select.Trigger with enhanced styling including focus states,
|
|
424
|
+
* size variants, and proper hover interactions. Includes a chevron icon to indicate
|
|
425
|
+
* dropdown functionality and supports different size variants for various UI contexts.
|
|
426
|
+
*
|
|
427
|
+
* **Size Variants:**
|
|
428
|
+
* - `default`: Standard height (36px) suitable for most forms and interfaces
|
|
429
|
+
* - `sm`: Compact height (32px) ideal for dense layouts and table interfaces
|
|
149
430
|
*
|
|
150
431
|
* @component
|
|
151
432
|
* @example
|
|
@@ -160,27 +441,42 @@ function SelectValue({
|
|
|
160
441
|
* ```tsx
|
|
161
442
|
* // Small size variant for compact layouts
|
|
162
443
|
* <SelectTrigger size="sm" className="w-[150px]">
|
|
163
|
-
* <SelectValue placeholder="Compact" />
|
|
444
|
+
* <SelectValue placeholder="Compact select" />
|
|
164
445
|
* </SelectTrigger>
|
|
165
446
|
* ```
|
|
166
447
|
*
|
|
167
448
|
* @example
|
|
168
449
|
* ```tsx
|
|
169
|
-
* //
|
|
450
|
+
* // Form integration with accessibility attributes
|
|
451
|
+
* <label htmlFor="user-role">User Role</label>
|
|
170
452
|
* <SelectTrigger id="user-role" aria-describedby="role-help">
|
|
171
453
|
* <SelectValue placeholder="Choose role" />
|
|
172
454
|
* </SelectTrigger>
|
|
455
|
+
* <div id="role-help">Select the appropriate role for this user</div>
|
|
456
|
+
* ```
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```tsx
|
|
460
|
+
* // Custom composition using asChild
|
|
461
|
+
* <SelectTrigger asChild>
|
|
462
|
+
* <button className="custom-trigger-styles">
|
|
463
|
+
* <SelectValue />
|
|
464
|
+
* <CustomChevronIcon />
|
|
465
|
+
* </button>
|
|
466
|
+
* </SelectTrigger>
|
|
173
467
|
* ```
|
|
174
468
|
*
|
|
175
469
|
* @accessibility
|
|
176
|
-
* - Keyboard
|
|
177
|
-
* -
|
|
178
|
-
* -
|
|
179
|
-
* -
|
|
180
|
-
* -
|
|
181
|
-
* - Disabled
|
|
470
|
+
* - **Keyboard Navigation**: Enter/Space to open dropdown, Arrow keys to navigate when closed
|
|
471
|
+
* - **Focus Management**: Clear focus ring for keyboard users, focus returns after selection
|
|
472
|
+
* - **State Announcements**: Screen readers announce open/closed state and selected value
|
|
473
|
+
* - **ARIA Support**: Proper combobox role with expanded state and controls relationship
|
|
474
|
+
* - **Form Integration**: Works with labels, validation, and form submission
|
|
475
|
+
* - **Disabled State**: Properly communicated to assistive technology with reduced opacity
|
|
476
|
+
* - **RTL Support**: Automatically adapts layout for right-to-left reading modes
|
|
182
477
|
*
|
|
183
478
|
* @see {@link SelectValue} - Displays the selected value or placeholder
|
|
479
|
+
* @see {@link SelectContent} - The dropdown content that opens
|
|
184
480
|
* @since 1.0.0
|
|
185
481
|
*/
|
|
186
482
|
function SelectTrigger({
|
|
@@ -189,10 +485,6 @@ function SelectTrigger({
|
|
|
189
485
|
children,
|
|
190
486
|
...props
|
|
191
487
|
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
192
|
-
/**
|
|
193
|
-
* The size variant of the trigger button
|
|
194
|
-
* @default "default"
|
|
195
|
-
*/
|
|
196
488
|
size?: "sm" | "default";
|
|
197
489
|
}) {
|
|
198
490
|
return (
|
|
@@ -217,11 +509,18 @@ function SelectTrigger({
|
|
|
217
509
|
* SelectContent - Container for the dropdown content
|
|
218
510
|
*
|
|
219
511
|
* The dropdown panel that contains all selectable items, groups, and labels.
|
|
220
|
-
*
|
|
512
|
+
* Built on Radix UI Select.Content with Portal rendering for proper layering.
|
|
513
|
+
* Automatically handles scrolling for long lists, collision detection, and
|
|
514
|
+
* positioning relative to the trigger with smooth animations.
|
|
515
|
+
*
|
|
516
|
+
* **Positioning Strategy:**
|
|
517
|
+
* - `popper`: Uses Floating UI for precise positioning with collision detection
|
|
518
|
+
* - `item-aligned`: Aligns content with the selected item for natural feel
|
|
221
519
|
*
|
|
222
520
|
* @component
|
|
223
521
|
* @example
|
|
224
522
|
* ```tsx
|
|
523
|
+
* // Basic content with multiple items
|
|
225
524
|
* <SelectContent>
|
|
226
525
|
* <SelectItem value="1">Option 1</SelectItem>
|
|
227
526
|
* <SelectItem value="2">Option 2</SelectItem>
|
|
@@ -231,19 +530,56 @@ function SelectTrigger({
|
|
|
231
530
|
*
|
|
232
531
|
* @example
|
|
233
532
|
* ```tsx
|
|
234
|
-
* //
|
|
533
|
+
* // Item-aligned positioning (default behavior)
|
|
235
534
|
* <SelectContent position="item-aligned">
|
|
535
|
+
* <SelectItem value="apple">Apple</SelectItem>
|
|
536
|
+
* <SelectItem value="banana">Banana</SelectItem>
|
|
537
|
+
* </SelectContent>
|
|
538
|
+
* ```
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
* ```tsx
|
|
542
|
+
* // Popper positioning with custom placement
|
|
543
|
+
* <SelectContent position="popper" side="top" align="end">
|
|
236
544
|
* <SelectItem value="1">Option 1</SelectItem>
|
|
545
|
+
* <SelectItem value="2">Option 2</SelectItem>
|
|
546
|
+
* </SelectContent>
|
|
547
|
+
* ```
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```tsx
|
|
551
|
+
* // Complex content with groups and scrolling
|
|
552
|
+
* <SelectContent>
|
|
553
|
+
* <SelectGroup>
|
|
554
|
+
* <SelectLabel>Recent Items</SelectLabel>
|
|
555
|
+
* <SelectItem value="recent1">Recently Used 1</SelectItem>
|
|
556
|
+
* <SelectItem value="recent2">Recently Used 2</SelectItem>
|
|
557
|
+
* </SelectGroup>
|
|
558
|
+
* <SelectSeparator />
|
|
559
|
+
* <SelectGroup>
|
|
560
|
+
* <SelectLabel>All Items</SelectLabel>
|
|
561
|
+
* {items.map((item) => (
|
|
562
|
+
* <SelectItem key={item.id} value={item.id}>
|
|
563
|
+
* {item.label}
|
|
564
|
+
* </SelectItem>
|
|
565
|
+
* ))}
|
|
566
|
+
* </SelectGroup>
|
|
237
567
|
* </SelectContent>
|
|
238
568
|
* ```
|
|
239
569
|
*
|
|
240
570
|
* @accessibility
|
|
241
|
-
* - Focus trapped within dropdown when open
|
|
242
|
-
* -
|
|
243
|
-
* -
|
|
571
|
+
* - **Focus Management**: Focus trapped within dropdown when open, managed viewport scrolling
|
|
572
|
+
* - **Keyboard Navigation**: Arrow keys navigate items, Page Up/Down for quick navigation
|
|
573
|
+
* - **Portal Rendering**: Renders in document body for proper layering and screen reader access
|
|
574
|
+
* - **Collision Detection**: Automatically repositions to stay within viewport boundaries
|
|
575
|
+
* - **Scroll Indicators**: Shows scroll buttons when content exceeds available height
|
|
576
|
+
* - **Animation**: Smooth enter/exit animations that respect user's motion preferences
|
|
577
|
+
* - **Escape Handling**: Escape key closes dropdown and returns focus to trigger
|
|
244
578
|
*
|
|
245
|
-
* @see {@link SelectItem} - Individual options
|
|
246
|
-
* @see {@link SelectGroup} -
|
|
579
|
+
* @see {@link SelectItem} - Individual selectable options
|
|
580
|
+
* @see {@link SelectGroup} - Container for grouping related items
|
|
581
|
+
* @see {@link SelectScrollUpButton} - Scroll up indicator for long lists
|
|
582
|
+
* @see {@link SelectScrollDownButton} - Scroll down indicator for long lists
|
|
247
583
|
* @since 1.0.0
|
|
248
584
|
*/
|
|
249
585
|
function SelectContent({
|
|
@@ -285,23 +621,59 @@ function SelectContent({
|
|
|
285
621
|
* SelectLabel - Label for a group of select items
|
|
286
622
|
*
|
|
287
623
|
* Provides a non-selectable label for categorizing groups of options.
|
|
288
|
-
*
|
|
624
|
+
* Built on Radix UI Select.Label with muted styling and proper typography.
|
|
625
|
+
* Helps users understand the context of the options below and improves
|
|
626
|
+
* navigation for screen reader users.
|
|
289
627
|
*
|
|
290
628
|
* @component
|
|
291
629
|
* @example
|
|
292
630
|
* ```tsx
|
|
631
|
+
* // Basic group label
|
|
293
632
|
* <SelectGroup>
|
|
294
633
|
* <SelectLabel>Countries</SelectLabel>
|
|
295
634
|
* <SelectItem value="us">United States</SelectItem>
|
|
296
635
|
* <SelectItem value="uk">United Kingdom</SelectItem>
|
|
636
|
+
* <SelectItem value="ca">Canada</SelectItem>
|
|
297
637
|
* </SelectGroup>
|
|
298
638
|
* ```
|
|
299
639
|
*
|
|
640
|
+
* @example
|
|
641
|
+
* ```tsx
|
|
642
|
+
* // Multiple labeled groups
|
|
643
|
+
* <SelectContent>
|
|
644
|
+
* <SelectGroup>
|
|
645
|
+
* <SelectLabel>Primary Options</SelectLabel>
|
|
646
|
+
* <SelectItem value="primary1">Primary Choice 1</SelectItem>
|
|
647
|
+
* <SelectItem value="primary2">Primary Choice 2</SelectItem>
|
|
648
|
+
* </SelectGroup>
|
|
649
|
+
* <SelectSeparator />
|
|
650
|
+
* <SelectGroup>
|
|
651
|
+
* <SelectLabel>Advanced Options</SelectLabel>
|
|
652
|
+
* <SelectItem value="advanced1">Advanced Choice 1</SelectItem>
|
|
653
|
+
* <SelectItem value="advanced2">Advanced Choice 2</SelectItem>
|
|
654
|
+
* </SelectGroup>
|
|
655
|
+
* </SelectContent>
|
|
656
|
+
* ```
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```tsx
|
|
660
|
+
* // Custom styling with asChild
|
|
661
|
+
* <SelectLabel asChild>
|
|
662
|
+
* <div className="flex items-center gap-1 px-2 py-1 font-semibold">
|
|
663
|
+
* <Icon className="size-3" />
|
|
664
|
+
* <span>Categories</span>
|
|
665
|
+
* </div>
|
|
666
|
+
* </SelectLabel>
|
|
667
|
+
* ```
|
|
668
|
+
*
|
|
300
669
|
* @accessibility
|
|
301
|
-
* - Properly associated with group for screen readers
|
|
302
|
-
* - Non-
|
|
670
|
+
* - **Semantic Association**: Properly associated with group items for screen readers
|
|
671
|
+
* - **Non-Interactive**: Cannot receive focus or be selected
|
|
672
|
+
* - **Group Navigation**: Helps screen reader users understand item organization
|
|
673
|
+
* - **Descriptive Text**: Provides context for the items that follow
|
|
303
674
|
*
|
|
304
|
-
* @see {@link SelectGroup} -
|
|
675
|
+
* @see {@link SelectGroup} - Required parent container
|
|
676
|
+
* @see {@link SelectItem} - Items that this label describes
|
|
305
677
|
* @since 1.0.0
|
|
306
678
|
*/
|
|
307
679
|
function SelectLabel({
|
|
@@ -320,30 +692,60 @@ function SelectLabel({
|
|
|
320
692
|
/**
|
|
321
693
|
* SelectItem - Individual selectable option in the dropdown
|
|
322
694
|
*
|
|
323
|
-
* Represents a single option that users can select.
|
|
324
|
-
*
|
|
695
|
+
* Represents a single option that users can select. Built on Radix UI Select.Item
|
|
696
|
+
* with enhanced styling including hover states, selection indicators, and proper
|
|
697
|
+
* spacing. Shows a checkmark when selected and supports keyboard navigation with
|
|
698
|
+
* proper focus management.
|
|
325
699
|
*
|
|
326
700
|
* @component
|
|
327
701
|
* @example
|
|
328
702
|
* ```tsx
|
|
703
|
+
* // Basic item
|
|
329
704
|
* <SelectItem value="apple">Apple</SelectItem>
|
|
330
705
|
* ```
|
|
331
706
|
*
|
|
332
707
|
* @example
|
|
333
708
|
* ```tsx
|
|
334
|
-
* // Disabled item
|
|
709
|
+
* // Disabled item that cannot be selected
|
|
335
710
|
* <SelectItem value="sold-out" disabled>
|
|
336
|
-
* Sold Out
|
|
711
|
+
* Sold Out - Unavailable
|
|
337
712
|
* </SelectItem>
|
|
338
713
|
* ```
|
|
339
714
|
*
|
|
340
|
-
* @
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
* -
|
|
344
|
-
* -
|
|
715
|
+
* @example
|
|
716
|
+
* ```tsx
|
|
717
|
+
* // Complex item content with custom text value for typeahead
|
|
718
|
+
* <SelectItem value="user-123" textValue="John Doe">
|
|
719
|
+
* <div className="flex items-center gap-2">
|
|
720
|
+
* <Avatar size="sm" />
|
|
721
|
+
* <div>
|
|
722
|
+
* <div>John Doe</div>
|
|
723
|
+
* <div className="text-xs text-muted-foreground">john@example.com</div>
|
|
724
|
+
* </div>
|
|
725
|
+
* </div>
|
|
726
|
+
* </SelectItem>
|
|
727
|
+
* ```
|
|
345
728
|
*
|
|
346
|
-
* @
|
|
729
|
+
* @example
|
|
730
|
+
* ```tsx
|
|
731
|
+
* // Using asChild for custom item composition
|
|
732
|
+
* <SelectItem value="custom" asChild>
|
|
733
|
+
* <div className="custom-item-styles">
|
|
734
|
+
* Custom item content
|
|
735
|
+
* </div>
|
|
736
|
+
* </SelectItem>
|
|
737
|
+
* ```
|
|
738
|
+
*
|
|
739
|
+
* @accessibility
|
|
740
|
+
* - **Keyboard Navigation**: Arrow keys navigate between items, Home/End jump to first/last
|
|
741
|
+
* - **Selection**: Enter or Space selects the item and closes dropdown
|
|
742
|
+
* - **Visual Feedback**: Check icon indicates selected state, focus ring for keyboard users
|
|
743
|
+
* - **Disabled State**: Cannot be selected or focused, announced to screen readers
|
|
744
|
+
* - **Typeahead**: Type characters to jump to matching items (uses textValue or content)
|
|
745
|
+
* - **Screen Reader**: Announces item text and selection state changes
|
|
746
|
+
*
|
|
747
|
+
* @see {@link SelectContent} - Parent container that manages items
|
|
748
|
+
* @see {@link SelectGroup} - Optional grouping container
|
|
347
749
|
* @since 1.0.0
|
|
348
750
|
*/
|
|
349
751
|
function SelectItem({
|
|
@@ -373,27 +775,54 @@ function SelectItem({
|
|
|
373
775
|
/**
|
|
374
776
|
* SelectSeparator - Visual divider between select groups
|
|
375
777
|
*
|
|
376
|
-
* A horizontal line that visually separates groups of options
|
|
377
|
-
*
|
|
778
|
+
* A horizontal line that visually separates groups of options for better
|
|
779
|
+
* organization and clarity. Built on Radix UI Select.Separator with subtle
|
|
780
|
+
* border styling that adapts to the current theme.
|
|
378
781
|
*
|
|
379
782
|
* @component
|
|
380
783
|
* @example
|
|
381
784
|
* ```tsx
|
|
785
|
+
* // Basic separation between groups
|
|
382
786
|
* <SelectContent>
|
|
383
787
|
* <SelectGroup>
|
|
788
|
+
* <SelectLabel>Group 1</SelectLabel>
|
|
384
789
|
* <SelectItem value="1">Option 1</SelectItem>
|
|
385
790
|
* </SelectGroup>
|
|
386
791
|
* <SelectSeparator />
|
|
387
792
|
* <SelectGroup>
|
|
793
|
+
* <SelectLabel>Group 2</SelectLabel>
|
|
388
794
|
* <SelectItem value="2">Option 2</SelectItem>
|
|
389
795
|
* </SelectGroup>
|
|
390
796
|
* </SelectContent>
|
|
391
797
|
* ```
|
|
392
798
|
*
|
|
799
|
+
* @example
|
|
800
|
+
* ```tsx
|
|
801
|
+
* // Multiple separators in complex layouts
|
|
802
|
+
* <SelectContent>
|
|
803
|
+
* <SelectGroup>
|
|
804
|
+
* <SelectItem value="recent">Recent Items</SelectItem>
|
|
805
|
+
* </SelectGroup>
|
|
806
|
+
* <SelectSeparator />
|
|
807
|
+
* <SelectGroup>
|
|
808
|
+
* <SelectItem value="favorite">Favorites</SelectItem>
|
|
809
|
+
* </SelectGroup>
|
|
810
|
+
* <SelectSeparator />
|
|
811
|
+
* <SelectGroup>
|
|
812
|
+
* <SelectLabel>All Items</SelectLabel>
|
|
813
|
+
* <SelectItem value="all1">Item 1</SelectItem>
|
|
814
|
+
* <SelectItem value="all2">Item 2</SelectItem>
|
|
815
|
+
* </SelectGroup>
|
|
816
|
+
* </SelectContent>
|
|
817
|
+
* ```
|
|
818
|
+
*
|
|
393
819
|
* @accessibility
|
|
394
|
-
* - Decorative element with no semantic meaning
|
|
395
|
-
* -
|
|
820
|
+
* - **Decorative Role**: Pure visual element with no semantic meaning for screen readers
|
|
821
|
+
* - **Non-Interactive**: Cannot receive focus or be activated
|
|
822
|
+
* - **Visual Organization**: Helps sighted users understand content structure
|
|
823
|
+
* - **Theme Adaptive**: Border color adapts to light/dark themes automatically
|
|
396
824
|
*
|
|
825
|
+
* @see {@link SelectGroup} - Typically used to separate different groups
|
|
397
826
|
* @since 1.0.0
|
|
398
827
|
*/
|
|
399
828
|
function SelectSeparator({
|
|
@@ -413,13 +842,41 @@ function SelectSeparator({
|
|
|
413
842
|
* SelectScrollUpButton - Scroll button for navigating up in long lists
|
|
414
843
|
*
|
|
415
844
|
* Appears at the top of the dropdown when there are more items above
|
|
416
|
-
* the visible area.
|
|
845
|
+
* the visible area. Built on Radix UI Select.ScrollUpButton with chevron
|
|
846
|
+
* icon and hover states. Automatically shows/hides based on scroll position.
|
|
417
847
|
*
|
|
418
848
|
* @component
|
|
419
|
-
* @
|
|
420
|
-
*
|
|
421
|
-
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```tsx
|
|
851
|
+
* // Automatically included in SelectContent
|
|
852
|
+
* <SelectContent>
|
|
853
|
+
* // ScrollUpButton appears here when needed
|
|
854
|
+
* <SelectItem value="1">Item 1</SelectItem>
|
|
855
|
+
* // ... many items ...
|
|
856
|
+
* <SelectItem value="100">Item 100</SelectItem>
|
|
857
|
+
* // ScrollDownButton appears here when needed
|
|
858
|
+
* </SelectContent>
|
|
859
|
+
* ```
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* ```tsx
|
|
863
|
+
* // Custom scroll button using asChild
|
|
864
|
+
* <SelectScrollUpButton asChild>
|
|
865
|
+
* <button className="custom-scroll-styles">
|
|
866
|
+
* <CustomUpIcon />
|
|
867
|
+
* </button>
|
|
868
|
+
* </SelectScrollUpButton>
|
|
869
|
+
* ```
|
|
422
870
|
*
|
|
871
|
+
* @accessibility
|
|
872
|
+
* - **Auto-Visibility**: Only appears when upward scrolling is possible
|
|
873
|
+
* - **Keyboard Accessible**: Can be activated with Enter/Space
|
|
874
|
+
* - **Focus Management**: Receives focus during keyboard navigation
|
|
875
|
+
* - **Screen Reader**: Announced as scroll control with directional context
|
|
876
|
+
* - **Mouse/Touch**: Responds to click/touch interactions for scrolling
|
|
877
|
+
*
|
|
878
|
+
* @see {@link SelectContent} - Container that manages scroll button visibility
|
|
879
|
+
* @see {@link SelectScrollDownButton} - Counterpart for downward scrolling
|
|
423
880
|
* @since 1.0.0
|
|
424
881
|
*/
|
|
425
882
|
function SelectScrollUpButton({
|
|
@@ -444,13 +901,41 @@ function SelectScrollUpButton({
|
|
|
444
901
|
* SelectScrollDownButton - Scroll button for navigating down in long lists
|
|
445
902
|
*
|
|
446
903
|
* Appears at the bottom of the dropdown when there are more items below
|
|
447
|
-
* the visible area.
|
|
904
|
+
* the visible area. Built on Radix UI Select.ScrollDownButton with chevron
|
|
905
|
+
* icon and hover states. Automatically shows/hides based on scroll position.
|
|
448
906
|
*
|
|
449
907
|
* @component
|
|
450
|
-
* @
|
|
451
|
-
*
|
|
452
|
-
*
|
|
908
|
+
* @example
|
|
909
|
+
* ```tsx
|
|
910
|
+
* // Automatically included in SelectContent
|
|
911
|
+
* <SelectContent>
|
|
912
|
+
* // ScrollUpButton appears here when needed
|
|
913
|
+
* <SelectItem value="1">Item 1</SelectItem>
|
|
914
|
+
* // ... many items ...
|
|
915
|
+
* <SelectItem value="100">Item 100</SelectItem>
|
|
916
|
+
* // ScrollDownButton appears here when needed
|
|
917
|
+
* </SelectContent>
|
|
918
|
+
* ```
|
|
453
919
|
*
|
|
920
|
+
* @example
|
|
921
|
+
* ```tsx
|
|
922
|
+
* // Custom scroll button using asChild
|
|
923
|
+
* <SelectScrollDownButton asChild>
|
|
924
|
+
* <button className="custom-scroll-styles">
|
|
925
|
+
* <CustomDownIcon />
|
|
926
|
+
* </button>
|
|
927
|
+
* </SelectScrollDownButton>
|
|
928
|
+
* ```
|
|
929
|
+
*
|
|
930
|
+
* @accessibility
|
|
931
|
+
* - **Auto-Visibility**: Only appears when downward scrolling is possible
|
|
932
|
+
* - **Keyboard Accessible**: Can be activated with Enter/Space
|
|
933
|
+
* - **Focus Management**: Receives focus during keyboard navigation
|
|
934
|
+
* - **Screen Reader**: Announced as scroll control with directional context
|
|
935
|
+
* - **Mouse/Touch**: Responds to click/touch interactions for scrolling
|
|
936
|
+
*
|
|
937
|
+
* @see {@link SelectContent} - Container that manages scroll button visibility
|
|
938
|
+
* @see {@link SelectScrollUpButton} - Counterpart for upward scrolling
|
|
454
939
|
* @since 1.0.0
|
|
455
940
|
*/
|
|
456
941
|
function SelectScrollDownButton({
|