@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
|
@@ -4,6 +4,109 @@ import { ChevronRight, MoreHorizontal } from "lucide-react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Props for Breadcrumb component (Documentation only - NOT used in component implementation)
|
|
9
|
+
* These types are for documentation generation and should not replace inferred types
|
|
10
|
+
*/
|
|
11
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
12
|
+
type BreadcrumbDocsProps = {
|
|
13
|
+
/** Additional CSS classes to apply to the navigation element */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Child breadcrumb elements (typically BreadcrumbList) */
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
} & Omit<React.ComponentProps<"nav">, "aria-label">;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Props for BreadcrumbList component (Documentation only - NOT used in component implementation)
|
|
21
|
+
* These types are for documentation generation and should not replace inferred types
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
24
|
+
type BreadcrumbListDocsProps = {
|
|
25
|
+
/** Additional CSS classes to apply to the ordered list element */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Child breadcrumb items (BreadcrumbItem elements) */
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
} & React.ComponentProps<"ol">;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Props for BreadcrumbItem component (Documentation only - NOT used in component implementation)
|
|
33
|
+
* These types are for documentation generation and should not replace inferred types
|
|
34
|
+
*/
|
|
35
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
36
|
+
type BreadcrumbItemDocsProps = {
|
|
37
|
+
/** Additional CSS classes to apply to the list item element */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** Content to display within the item (links, pages, separators, etc.) */
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
} & React.ComponentProps<"li">;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Props for BreadcrumbLink component (Documentation only - NOT used in component implementation)
|
|
45
|
+
* These types are for documentation generation and should not replace inferred types
|
|
46
|
+
*/
|
|
47
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
48
|
+
type BreadcrumbLinkDocsProps = {
|
|
49
|
+
/**
|
|
50
|
+
* When true, renders the child element directly instead of an anchor tag.
|
|
51
|
+
* Enables composition with routing library components like Next.js Link.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
asChild?: boolean;
|
|
55
|
+
/** Additional CSS classes to apply to the link element */
|
|
56
|
+
className?: string;
|
|
57
|
+
/** Link destination URL (when asChild is false) */
|
|
58
|
+
href?: string;
|
|
59
|
+
/** Link content to display */
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Click handler for the link
|
|
63
|
+
* @param event - Click event object
|
|
64
|
+
*/
|
|
65
|
+
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
66
|
+
} & React.ComponentProps<"a">;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Props for BreadcrumbPage component (Documentation only - NOT used in component implementation)
|
|
70
|
+
* These types are for documentation generation and should not replace inferred types
|
|
71
|
+
*/
|
|
72
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
73
|
+
type BreadcrumbPageDocsProps = {
|
|
74
|
+
/** Additional CSS classes to apply to the span element */
|
|
75
|
+
className?: string;
|
|
76
|
+
/** Current page name to display */
|
|
77
|
+
children?: React.ReactNode;
|
|
78
|
+
} & React.ComponentProps<"span">;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Props for BreadcrumbSeparator component (Documentation only - NOT used in component implementation)
|
|
82
|
+
* These types are for documentation generation and should not replace inferred types
|
|
83
|
+
*/
|
|
84
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
85
|
+
type BreadcrumbSeparatorDocsProps = {
|
|
86
|
+
/**
|
|
87
|
+
* Custom separator icon to display instead of the default ChevronRight.
|
|
88
|
+
* Typically a Lucide icon or similar SVG element.
|
|
89
|
+
*/
|
|
90
|
+
children?: React.ReactNode;
|
|
91
|
+
/** Additional CSS classes to apply to the separator element */
|
|
92
|
+
className?: string;
|
|
93
|
+
} & React.ComponentProps<"li">;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Props for BreadcrumbEllipsis component (Documentation only - NOT used in component implementation)
|
|
97
|
+
* These types are for documentation generation and should not replace inferred types
|
|
98
|
+
*/
|
|
99
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
100
|
+
type BreadcrumbEllipsisDocsProps = {
|
|
101
|
+
/** Additional CSS classes to apply to the ellipsis container */
|
|
102
|
+
className?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Custom content to display instead of the default MoreHorizontal icon.
|
|
105
|
+
* Rarely needed as the ellipsis has a standard appearance.
|
|
106
|
+
*/
|
|
107
|
+
children?: React.ReactNode;
|
|
108
|
+
} & React.ComponentProps<"span">;
|
|
109
|
+
|
|
7
110
|
/**
|
|
8
111
|
* Breadcrumb navigation component that displays hierarchical page location
|
|
9
112
|
*
|
|
@@ -15,6 +118,10 @@ import { cn } from "@/lib/utils";
|
|
|
15
118
|
* support for composition patterns including custom separators, ellipsis for long
|
|
16
119
|
* paths, dropdown menus, and custom link components via the asChild prop.
|
|
17
120
|
*
|
|
121
|
+
* @param className - Additional CSS classes to apply to the navigation element
|
|
122
|
+
* @param children - Child breadcrumb elements (typically BreadcrumbList)
|
|
123
|
+
* @param props - All standard HTML nav element props except aria-label (automatically set to "breadcrumb")
|
|
124
|
+
*
|
|
18
125
|
* @example
|
|
19
126
|
* ```tsx
|
|
20
127
|
* // Basic breadcrumb navigation
|
|
@@ -61,7 +168,7 @@ import { cn } from "@/lib/utils";
|
|
|
61
168
|
*
|
|
62
169
|
* @example
|
|
63
170
|
* ```tsx
|
|
64
|
-
* // With Next.js Link integration
|
|
171
|
+
* // With Next.js Link integration using asChild
|
|
65
172
|
* import { Link } from "next/link"
|
|
66
173
|
*
|
|
67
174
|
* <Breadcrumb>
|
|
@@ -100,13 +207,15 @@ import { cn } from "@/lib/utils";
|
|
|
100
207
|
* ```
|
|
101
208
|
*
|
|
102
209
|
* @accessibility
|
|
103
|
-
* - Uses semantic `nav` element with `aria-label="breadcrumb"`
|
|
104
|
-
* - Current page marked with `aria-current="page"`
|
|
210
|
+
* - Uses semantic `nav` element with `aria-label="breadcrumb"` (automatically applied)
|
|
211
|
+
* - Current page marked with `aria-current="page"` (via BreadcrumbPage)
|
|
105
212
|
* - Separators marked with `role="presentation"` and `aria-hidden="true"`
|
|
106
|
-
* - Screen reader friendly navigation structure
|
|
107
|
-
* - Supports keyboard navigation through links
|
|
213
|
+
* - Screen reader friendly navigation structure with proper list semantics
|
|
214
|
+
* - Supports keyboard navigation through links (Tab navigation)
|
|
215
|
+
* - Compatible with screen readers and assistive technologies
|
|
108
216
|
*
|
|
109
217
|
* @see {@link https://ui.shadcn.com/docs/components/breadcrumb} for design patterns
|
|
218
|
+
* @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/} for ARIA breadcrumb pattern
|
|
110
219
|
* @see {@link BreadcrumbList} - Ordered list container for breadcrumb items
|
|
111
220
|
* @see {@link BreadcrumbItem} - Individual breadcrumb list item
|
|
112
221
|
* @see {@link BreadcrumbLink} - Navigable breadcrumb link with asChild support
|
|
@@ -115,7 +224,9 @@ import { cn } from "@/lib/utils";
|
|
|
115
224
|
* @see {@link BreadcrumbEllipsis} - Ellipsis indicator for collapsed items
|
|
116
225
|
* @since 1.0.0
|
|
117
226
|
*/
|
|
118
|
-
function Breadcrumb({
|
|
227
|
+
function Breadcrumb({
|
|
228
|
+
...props
|
|
229
|
+
}: Omit<React.ComponentProps<"nav">, "aria-label">) {
|
|
119
230
|
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />;
|
|
120
231
|
}
|
|
121
232
|
|
|
@@ -124,20 +235,43 @@ function Breadcrumb({ ...props }: React.ComponentProps<"nav">) {
|
|
|
124
235
|
*
|
|
125
236
|
* Provides the structured list layout for breadcrumb navigation items with
|
|
126
237
|
* responsive spacing and text overflow handling. Uses semantic `ol` element
|
|
127
|
-
* for proper accessibility and screen reader navigation.
|
|
238
|
+
* for proper accessibility and screen reader navigation. Contains flexible
|
|
239
|
+
* layout with word breaking and responsive gap adjustments.
|
|
128
240
|
*
|
|
129
|
-
* @param className - Additional CSS classes to apply
|
|
130
|
-
* @param
|
|
241
|
+
* @param className - Additional CSS classes to apply to the ordered list element
|
|
242
|
+
* @param children - Child breadcrumb items (BreadcrumbItem elements)
|
|
243
|
+
* @param props - All standard HTML ordered list element props (id, role, data-*, etc.)
|
|
131
244
|
*
|
|
132
245
|
* @example
|
|
133
246
|
* ```tsx
|
|
247
|
+
* // Basic list with multiple items
|
|
134
248
|
* <BreadcrumbList>
|
|
135
249
|
* <BreadcrumbItem>
|
|
136
250
|
* <BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
137
251
|
* </BreadcrumbItem>
|
|
252
|
+
* <BreadcrumbSeparator />
|
|
253
|
+
* <BreadcrumbItem>
|
|
254
|
+
* <BreadcrumbPage>Current</BreadcrumbPage>
|
|
255
|
+
* </BreadcrumbItem>
|
|
256
|
+
* </BreadcrumbList>
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```tsx
|
|
261
|
+
* // With custom styling
|
|
262
|
+
* <BreadcrumbList className="gap-4 text-base">
|
|
263
|
+
* <BreadcrumbItem>
|
|
264
|
+
* <BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
265
|
+
* </BreadcrumbItem>
|
|
138
266
|
* </BreadcrumbList>
|
|
139
267
|
* ```
|
|
140
268
|
*
|
|
269
|
+
* @accessibility
|
|
270
|
+
* - Uses semantic `ol` element for proper list structure
|
|
271
|
+
* - Maintains reading order for screen readers
|
|
272
|
+
* - Supports list navigation shortcuts in screen readers
|
|
273
|
+
* - Flexible text wrapping for long breadcrumb trails
|
|
274
|
+
*
|
|
141
275
|
* @since 1.0.0
|
|
142
276
|
*/
|
|
143
277
|
function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
|
|
@@ -157,18 +291,43 @@ function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
|
|
|
157
291
|
* Individual breadcrumb list item container
|
|
158
292
|
*
|
|
159
293
|
* Wraps breadcrumb content (links, pages, separators) in a semantic list item.
|
|
160
|
-
* Provides consistent alignment and spacing for breadcrumb elements
|
|
294
|
+
* Provides consistent alignment and spacing for breadcrumb elements with inline
|
|
295
|
+
* flex layout for proper icon and text alignment.
|
|
161
296
|
*
|
|
162
|
-
* @param className - Additional CSS classes to apply
|
|
163
|
-
* @param
|
|
297
|
+
* @param className - Additional CSS classes to apply to the list item element
|
|
298
|
+
* @param children - Content to display within the item (links, pages, separators, ellipsis)
|
|
299
|
+
* @param props - All standard HTML list item element props (id, role, data-*, etc.)
|
|
164
300
|
*
|
|
165
301
|
* @example
|
|
166
302
|
* ```tsx
|
|
303
|
+
* // With link
|
|
167
304
|
* <BreadcrumbItem>
|
|
168
305
|
* <BreadcrumbLink href="/products">Products</BreadcrumbLink>
|
|
169
306
|
* </BreadcrumbItem>
|
|
170
307
|
* ```
|
|
171
308
|
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```tsx
|
|
311
|
+
* // With current page
|
|
312
|
+
* <BreadcrumbItem>
|
|
313
|
+
* <BreadcrumbPage>Current Page</BreadcrumbPage>
|
|
314
|
+
* </BreadcrumbItem>
|
|
315
|
+
* ```
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```tsx
|
|
319
|
+
* // With separator
|
|
320
|
+
* <BreadcrumbItem>
|
|
321
|
+
* <BreadcrumbSeparator />
|
|
322
|
+
* </BreadcrumbItem>
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* @accessibility
|
|
326
|
+
* - Uses semantic `li` element for proper list structure
|
|
327
|
+
* - Maintains proper DOM hierarchy within breadcrumb list
|
|
328
|
+
* - Supports assistive technology list navigation
|
|
329
|
+
* - Inline flex layout ensures proper alignment of icons and text
|
|
330
|
+
*
|
|
172
331
|
* @since 1.0.0
|
|
173
332
|
*/
|
|
174
333
|
function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
@@ -184,37 +343,78 @@ function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
|
184
343
|
/**
|
|
185
344
|
* Navigable link within breadcrumb trail
|
|
186
345
|
*
|
|
187
|
-
* Represents a clickable parent page in the breadcrumb hierarchy with hover
|
|
346
|
+
* Represents a clickable parent page in the breadcrumb hierarchy with smooth hover
|
|
188
347
|
* effects and transition animations. Supports composition via the `asChild` prop
|
|
189
|
-
* for integration with routing libraries like Next.js Link
|
|
348
|
+
* for seamless integration with routing libraries like Next.js Link, React Router,
|
|
349
|
+
* or Reach Router using the Radix UI Slot primitive for prop merging.
|
|
350
|
+
*
|
|
351
|
+
* Built on Radix UI Slot primitive which enables the asChild pattern - when asChild
|
|
352
|
+
* is true, the component merges its props with the immediate child element instead
|
|
353
|
+
* of rendering its own anchor tag. This allows for flexible composition while
|
|
354
|
+
* maintaining consistent styling and behavior.
|
|
190
355
|
*
|
|
191
|
-
* @param asChild - When true,
|
|
192
|
-
* @param className - Additional CSS classes to apply
|
|
193
|
-
* @param
|
|
356
|
+
* @param asChild - When true, merges props with child element instead of rendering anchor. Enables composition with routing components @default false
|
|
357
|
+
* @param className - Additional CSS classes to apply to the link element
|
|
358
|
+
* @param href - Link destination URL (when asChild is false)
|
|
359
|
+
* @param children - Link content to display (text, icons, etc.)
|
|
360
|
+
* @param onClick - Click handler for the link interaction
|
|
361
|
+
* @param props - All standard HTML anchor element props (target, rel, download, etc.)
|
|
194
362
|
*
|
|
195
363
|
* @example
|
|
196
364
|
* ```tsx
|
|
197
|
-
* // Standard link
|
|
365
|
+
* // Standard anchor link
|
|
198
366
|
* <BreadcrumbLink href="/products">Products</BreadcrumbLink>
|
|
199
367
|
* ```
|
|
200
368
|
*
|
|
201
369
|
* @example
|
|
202
370
|
* ```tsx
|
|
203
|
-
* // With Next.js Link
|
|
371
|
+
* // With Next.js Link using asChild
|
|
372
|
+
* import { Link } from "next/link"
|
|
373
|
+
*
|
|
204
374
|
* <BreadcrumbLink asChild>
|
|
205
375
|
* <Link href="/products">Products</Link>
|
|
206
376
|
* </BreadcrumbLink>
|
|
207
377
|
* ```
|
|
208
378
|
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```tsx
|
|
381
|
+
* // With React Router Link
|
|
382
|
+
* import { Link } from "react-router-dom"
|
|
383
|
+
*
|
|
384
|
+
* <BreadcrumbLink asChild>
|
|
385
|
+
* <Link to="/products">Products</Link>
|
|
386
|
+
* </BreadcrumbLink>
|
|
387
|
+
* ```
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```tsx
|
|
391
|
+
* // With click handler
|
|
392
|
+
* <BreadcrumbLink
|
|
393
|
+
* href="/products"
|
|
394
|
+
* onClick={(e) => {
|
|
395
|
+
* e.preventDefault();
|
|
396
|
+
* navigate('/products');
|
|
397
|
+
* }}
|
|
398
|
+
* >
|
|
399
|
+
* Products
|
|
400
|
+
* </BreadcrumbLink>
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* @accessibility
|
|
404
|
+
* - Uses semantic anchor element with proper link role
|
|
405
|
+
* - Supports keyboard navigation (Enter key activation)
|
|
406
|
+
* - Compatible with screen reader link navigation
|
|
407
|
+
* - Maintains focus management when used with asChild
|
|
408
|
+
* - Preserves all accessibility attributes when composed
|
|
409
|
+
*
|
|
410
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/utilities/slot} for asChild pattern details
|
|
209
411
|
* @since 1.0.0
|
|
210
412
|
*/
|
|
211
413
|
function BreadcrumbLink({
|
|
212
414
|
asChild,
|
|
213
415
|
className,
|
|
214
416
|
...props
|
|
215
|
-
}: React.ComponentProps<"a">
|
|
216
|
-
asChild?: boolean;
|
|
217
|
-
}) {
|
|
417
|
+
}: { asChild?: boolean } & React.ComponentProps<"a">) {
|
|
218
418
|
const Comp = asChild ? Slot : "a";
|
|
219
419
|
|
|
220
420
|
return (
|
|
@@ -230,21 +430,50 @@ function BreadcrumbLink({
|
|
|
230
430
|
* Current page indicator in breadcrumb trail
|
|
231
431
|
*
|
|
232
432
|
* Represents the current page (non-clickable) at the end of the breadcrumb trail.
|
|
233
|
-
* Styled with prominent text color and marked with accessibility
|
|
234
|
-
* including `aria-current="page"` for screen reader identification
|
|
433
|
+
* Styled with prominent text color and marked with comprehensive accessibility
|
|
434
|
+
* attributes including `aria-current="page"` for precise screen reader identification
|
|
435
|
+
* of the user's current location within the site hierarchy.
|
|
235
436
|
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
437
|
+
* This component uses specific ARIA attributes to indicate it represents a link-like
|
|
438
|
+
* element that is disabled, providing semantic meaning while maintaining the visual
|
|
439
|
+
* breadcrumb structure. The `aria-current="page"` attribute is the standard way to
|
|
440
|
+
* identify the current page in navigation components.
|
|
441
|
+
*
|
|
442
|
+
* @param className - Additional CSS classes to apply to the span element
|
|
443
|
+
* @param children - Current page name or content to display
|
|
444
|
+
* @param props - All standard HTML span element props (id, data-*, style, etc.)
|
|
238
445
|
*
|
|
239
446
|
* @example
|
|
240
447
|
* ```tsx
|
|
448
|
+
* // Simple page name
|
|
241
449
|
* <BreadcrumbPage>Current Page Name</BreadcrumbPage>
|
|
242
450
|
* ```
|
|
243
451
|
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```tsx
|
|
454
|
+
* // With icon and text
|
|
455
|
+
* <BreadcrumbPage>
|
|
456
|
+
* <FileIcon className="mr-1" />
|
|
457
|
+
* Document.pdf
|
|
458
|
+
* </BreadcrumbPage>
|
|
459
|
+
* ```
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
* ```tsx
|
|
463
|
+
* // With custom styling
|
|
464
|
+
* <BreadcrumbPage className="font-semibold text-primary">
|
|
465
|
+
* Important Page
|
|
466
|
+
* </BreadcrumbPage>
|
|
467
|
+
* ```
|
|
468
|
+
*
|
|
244
469
|
* @accessibility
|
|
245
|
-
* - Uses `role="link"` with `aria-disabled="true"`
|
|
246
|
-
* - Marked with `aria-current="page"` to indicate current location
|
|
470
|
+
* - Uses `role="link"` with `aria-disabled="true"` to indicate link-like but non-interactive element
|
|
471
|
+
* - Marked with `aria-current="page"` to indicate current location (WCAG 2.1 standard)
|
|
472
|
+
* - Provides semantic meaning for assistive technologies
|
|
473
|
+
* - Screen readers will announce this as the current page in the breadcrumb trail
|
|
474
|
+
* - Non-focusable as it represents the current location, not a navigation target
|
|
247
475
|
*
|
|
476
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA02} for aria-current usage
|
|
248
477
|
* @since 1.0.0
|
|
249
478
|
*/
|
|
250
479
|
function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
@@ -263,32 +492,56 @@ function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
|
|
|
263
492
|
/**
|
|
264
493
|
* Visual separator between breadcrumb items
|
|
265
494
|
*
|
|
266
|
-
* Displays a separator icon (default: ChevronRight) between breadcrumb items
|
|
267
|
-
*
|
|
268
|
-
*
|
|
495
|
+
* Displays a separator icon (default: ChevronRight) between breadcrumb items to
|
|
496
|
+
* provide visual hierarchy and direction in the breadcrumb trail. Supports complete
|
|
497
|
+
* customization with any icon or content. Properly hidden from assistive technologies
|
|
498
|
+
* with accessibility attributes for clean screen reader navigation experience.
|
|
269
499
|
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
500
|
+
* The component uses CSS sizing constraints to ensure consistent icon sizing across
|
|
501
|
+
* different separator types and maintains visual alignment within the breadcrumb flow.
|
|
502
|
+
*
|
|
503
|
+
* @param children - Custom separator icon or content to display instead of default ChevronRight. Typically Lucide icons like Slash, ArrowRight, etc.
|
|
504
|
+
* @param className - Additional CSS classes to apply to the list item container
|
|
505
|
+
* @param props - All standard HTML list item element props (id, data-*, style, etc.)
|
|
273
506
|
*
|
|
274
507
|
* @example
|
|
275
508
|
* ```tsx
|
|
276
|
-
* // Default separator
|
|
509
|
+
* // Default ChevronRight separator
|
|
277
510
|
* <BreadcrumbSeparator />
|
|
278
511
|
* ```
|
|
279
512
|
*
|
|
280
513
|
* @example
|
|
281
514
|
* ```tsx
|
|
282
|
-
* // Custom separator
|
|
515
|
+
* // Custom Slash separator
|
|
283
516
|
* import { Slash } from "lucide-react"
|
|
284
517
|
* <BreadcrumbSeparator>
|
|
285
518
|
* <Slash />
|
|
286
519
|
* </BreadcrumbSeparator>
|
|
287
520
|
* ```
|
|
288
521
|
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```tsx
|
|
524
|
+
* // Arrow right separator
|
|
525
|
+
* import { ArrowRight } from "lucide-react"
|
|
526
|
+
* <BreadcrumbSeparator>
|
|
527
|
+
* <ArrowRight />
|
|
528
|
+
* </BreadcrumbSeparator>
|
|
529
|
+
* ```
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```tsx
|
|
533
|
+
* // Text separator
|
|
534
|
+
* <BreadcrumbSeparator>
|
|
535
|
+
* <span className="text-muted-foreground">/</span>
|
|
536
|
+
* </BreadcrumbSeparator>
|
|
537
|
+
* ```
|
|
538
|
+
*
|
|
289
539
|
* @accessibility
|
|
290
|
-
* - Uses `role="presentation"` to indicate decorative content
|
|
540
|
+
* - Uses `role="presentation"` to indicate purely decorative content
|
|
291
541
|
* - Hidden from screen readers with `aria-hidden="true"`
|
|
542
|
+
* - Does not interfere with keyboard navigation flow
|
|
543
|
+
* - Screen readers skip over separator and focus on actual navigation links
|
|
544
|
+
* - Maintains visual structure without adding semantic noise
|
|
292
545
|
*
|
|
293
546
|
* @since 1.0.0
|
|
294
547
|
*/
|
|
@@ -314,39 +567,71 @@ function BreadcrumbSeparator({
|
|
|
314
567
|
* Ellipsis indicator for collapsed breadcrumb items
|
|
315
568
|
*
|
|
316
569
|
* Shows a horizontal ellipsis icon (MoreHorizontal) to indicate hidden or
|
|
317
|
-
* collapsed middle items in a long breadcrumb trail.
|
|
318
|
-
* hierarchies where space is limited
|
|
319
|
-
* menus
|
|
570
|
+
* collapsed middle items in a long breadcrumb trail. Essential for deep navigation
|
|
571
|
+
* hierarchies where space is limited or mobile responsive design. Commonly used
|
|
572
|
+
* in combination with dropdown menus, popovers, or expandable sections to reveal
|
|
573
|
+
* the collapsed breadcrumb items on user interaction.
|
|
574
|
+
*
|
|
575
|
+
* The component provides a consistent 36px (9 × 4px) clickable area for better
|
|
576
|
+
* touch interaction when used as a trigger for dropdown menus. Includes hidden
|
|
577
|
+
* screen reader text to provide context about the collapsed content.
|
|
320
578
|
*
|
|
321
|
-
* @param className - Additional CSS classes to apply
|
|
322
|
-
* @param
|
|
579
|
+
* @param className - Additional CSS classes to apply to the ellipsis container
|
|
580
|
+
* @param children - Custom content to display instead of the default MoreHorizontal icon (rarely needed)
|
|
581
|
+
* @param props - All standard HTML span element props (id, data-*, style, onClick for dropdown triggers, etc.)
|
|
323
582
|
*
|
|
324
583
|
* @example
|
|
325
584
|
* ```tsx
|
|
326
|
-
* // Simple ellipsis
|
|
585
|
+
* // Simple static ellipsis
|
|
327
586
|
* <BreadcrumbEllipsis />
|
|
328
587
|
* ```
|
|
329
588
|
*
|
|
330
589
|
* @example
|
|
331
590
|
* ```tsx
|
|
332
|
-
* //
|
|
591
|
+
* // Interactive ellipsis with dropdown menu
|
|
333
592
|
* <BreadcrumbItem>
|
|
334
593
|
* <DropdownMenu>
|
|
335
|
-
* <DropdownMenuTrigger>
|
|
336
|
-
* <BreadcrumbEllipsis />
|
|
594
|
+
* <DropdownMenuTrigger asChild>
|
|
595
|
+
* <BreadcrumbEllipsis className="hover:bg-muted cursor-pointer" />
|
|
337
596
|
* </DropdownMenuTrigger>
|
|
338
597
|
* <DropdownMenuContent>
|
|
339
|
-
* <DropdownMenuItem>
|
|
340
|
-
*
|
|
598
|
+
* <DropdownMenuItem>
|
|
599
|
+
* <BreadcrumbLink href="/level1">Level 1</BreadcrumbLink>
|
|
600
|
+
* </DropdownMenuItem>
|
|
601
|
+
* <DropdownMenuItem>
|
|
602
|
+
* <BreadcrumbLink href="/level1/level2">Level 2</BreadcrumbLink>
|
|
603
|
+
* </DropdownMenuItem>
|
|
341
604
|
* </DropdownMenuContent>
|
|
342
605
|
* </DropdownMenu>
|
|
343
606
|
* </BreadcrumbItem>
|
|
344
607
|
* ```
|
|
345
608
|
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```tsx
|
|
611
|
+
* // With popover for collapsed items
|
|
612
|
+
* <BreadcrumbItem>
|
|
613
|
+
* <Popover>
|
|
614
|
+
* <PopoverTrigger asChild>
|
|
615
|
+
* <BreadcrumbEllipsis className="hover:bg-accent" />
|
|
616
|
+
* </PopoverTrigger>
|
|
617
|
+
* <PopoverContent>
|
|
618
|
+
* <div className="space-y-2">
|
|
619
|
+
* <BreadcrumbLink href="/hidden1">Hidden Item 1</BreadcrumbLink>
|
|
620
|
+
* <BreadcrumbLink href="/hidden2">Hidden Item 2</BreadcrumbLink>
|
|
621
|
+
* </div>
|
|
622
|
+
* </PopoverContent>
|
|
623
|
+
* </Popover>
|
|
624
|
+
* </BreadcrumbItem>
|
|
625
|
+
* ```
|
|
626
|
+
*
|
|
346
627
|
* @accessibility
|
|
347
|
-
* - Uses `role="presentation"` and `aria-hidden="true"` for
|
|
348
|
-
* - Includes screen reader text "More"
|
|
628
|
+
* - Uses `role="presentation"` and `aria-hidden="true"` for the visual ellipsis
|
|
629
|
+
* - Includes hidden screen reader text "More" to provide context
|
|
630
|
+
* - When used as dropdown trigger, ensure proper ARIA attributes on parent trigger
|
|
631
|
+
* - Maintains 36px minimum touch target size for mobile accessibility
|
|
632
|
+
* - Screen readers will announce "More" when focused (if used as interactive element)
|
|
349
633
|
*
|
|
634
|
+
* @see {@link https://www.w3.org/WAI/WCAG21/Understanding/target-size.html} for touch target guidelines
|
|
350
635
|
* @since 1.0.0
|
|
351
636
|
*/
|
|
352
637
|
function BreadcrumbEllipsis({
|