@brightlocal/ui-components 2.11.0 → 2.13.0
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/component-meta.json +474 -27
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +16 -4
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +57 -53
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts +7 -1
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +82 -81
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +221 -11
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +687 -406
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +14 -2
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +37 -37
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +3 -3
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +2 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +24 -3
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +121 -117
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +11 -0
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +43 -38
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +20 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +244 -238
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +5 -0
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +207 -206
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +10 -0
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +96 -96
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +7 -2
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +38 -30
- package/dist/drawer.d.ts +2 -2
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +5 -0
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +15 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +313 -305
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +7 -1
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +131 -130
- package/dist/input-group.d.ts +1 -1
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +10 -0
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +108 -106
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +36 -37
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +25 -4
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +71 -53
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +6 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +25 -22
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +17 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +32 -26
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +29 -3
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +26 -25
- package/dist/popover.cjs +1 -1
- package/dist/popover.js +7 -7
- package/dist/rating.cjs +1 -1
- package/dist/rating.d.ts +6 -0
- package/dist/rating.d.ts.map +1 -1
- package/dist/rating.js +28 -20
- package/dist/resizable.d.ts +1 -1
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +17 -3
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +65 -58
- package/dist/separator.cjs +1 -1
- package/dist/separator.d.ts +16 -4
- package/dist/separator.d.ts.map +1 -1
- package/dist/separator.js +38 -35
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +6 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +42 -41
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +5 -0
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +13 -11
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +14 -0
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +57 -39
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +25 -9
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +128 -113
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.d.ts +5 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/text-reveal-motion.js +111 -110
- package/dist/typography.cjs +1 -1
- package/dist/typography.d.ts +1 -2
- package/dist/typography.d.ts.map +1 -1
- package/dist/typography.js +49 -50
- package/package.json +2 -3
- package/src/blocks/data-table.tsx +26 -9
- package/src/blocks/input-list.tsx +12 -1
- package/src/blocks/sidebar.tsx +638 -29
- package/src/components/breadcrumb.tsx +43 -26
- package/src/components/callout.tsx +5 -4
- package/src/components/carousel.tsx +33 -4
- package/src/components/chip.tsx +22 -2
- package/src/components/combobox.tsx +28 -3
- package/src/components/command.tsx +7 -1
- package/src/components/date-picker.tsx +17 -3
- package/src/components/dialog.tsx +17 -4
- package/src/components/drawer.tsx +2 -2
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/global-layout.tsx +15 -2
- package/src/components/input-chip.tsx +12 -1
- package/src/components/input-password.tsx +73 -49
- package/src/components/link.tsx +29 -17
- package/src/components/list.tsx +45 -2
- package/src/components/logo.tsx +10 -2
- package/src/components/map.tsx +23 -0
- package/src/components/pagination.tsx +44 -11
- package/src/components/popover.tsx +1 -1
- package/src/components/rating.tsx +21 -3
- package/src/components/select.tsx +33 -3
- package/src/components/separator.tsx +40 -25
- package/src/components/sheet.tsx +28 -20
- package/src/components/skeleton.tsx +13 -2
- package/src/components/table.tsx +39 -2
- package/src/components/tabs.tsx +195 -146
- package/src/components/text-reveal-motion.tsx +7 -1
- package/src/components/typography.tsx +6 -7
|
@@ -20,6 +20,11 @@ interface BreadcrumbProps extends React.ComponentProps<"nav"> {
|
|
|
20
20
|
* Tracking label for analytics context
|
|
21
21
|
*/
|
|
22
22
|
trackingLabel?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Accessible label for the breadcrumb navigation.
|
|
25
|
+
* @default "breadcrumb"
|
|
26
|
+
*/
|
|
27
|
+
ariaLabel?: string;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
/**
|
|
@@ -27,17 +32,19 @@ interface BreadcrumbProps extends React.ComponentProps<"nav"> {
|
|
|
27
32
|
* Provides navigation context and allows users to navigate back through the hierarchy.
|
|
28
33
|
*/
|
|
29
34
|
const Breadcrumb = React.forwardRef<HTMLElement, BreadcrumbProps>(
|
|
30
|
-
({ dataHook, trackingEl, trackingLabel, ...props }, ref) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
({ dataHook, trackingEl, trackingLabel, ariaLabel, ...props }, ref) => {
|
|
36
|
+
return (
|
|
37
|
+
<nav
|
|
38
|
+
ref={ref}
|
|
39
|
+
aria-label={ariaLabel ?? "breadcrumb"}
|
|
40
|
+
data-hook={dataHook}
|
|
41
|
+
data-slot="breadcrumb"
|
|
42
|
+
data-tracking-el={trackingEl}
|
|
43
|
+
data-tracking-label={trackingLabel}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
41
48
|
);
|
|
42
49
|
Breadcrumb.displayName = "Breadcrumb";
|
|
43
50
|
|
|
@@ -158,22 +165,32 @@ BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
|
158
165
|
* Ellipsis indicator for collapsed breadcrumb sections.
|
|
159
166
|
* Used when the breadcrumb trail is too long to display fully.
|
|
160
167
|
*/
|
|
168
|
+
interface BreadcrumbEllipsisProps extends React.ComponentProps<"span"> {
|
|
169
|
+
/**
|
|
170
|
+
* Screen-reader-only label for the ellipsis.
|
|
171
|
+
* @default "More"
|
|
172
|
+
*/
|
|
173
|
+
srLabel?: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
161
176
|
const BreadcrumbEllipsis = React.forwardRef<
|
|
162
177
|
HTMLSpanElement,
|
|
163
|
-
|
|
164
|
-
>(({ className, ...props }, ref) =>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
BreadcrumbEllipsisProps
|
|
179
|
+
>(({ className, srLabel = "More", ...props }, ref) => {
|
|
180
|
+
return (
|
|
181
|
+
<span
|
|
182
|
+
ref={ref}
|
|
183
|
+
aria-hidden="true"
|
|
184
|
+
className={cn("flex size-9 items-center justify-center", className)}
|
|
185
|
+
data-slot="breadcrumb-ellipsis"
|
|
186
|
+
role="presentation"
|
|
187
|
+
{...props}
|
|
188
|
+
>
|
|
189
|
+
<MoreHorizontal />
|
|
190
|
+
<span className="sr-only">{srLabel}</span>
|
|
191
|
+
</span>
|
|
192
|
+
);
|
|
193
|
+
});
|
|
177
194
|
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
178
195
|
|
|
179
196
|
export {
|
|
@@ -185,4 +202,4 @@ export {
|
|
|
185
202
|
BreadcrumbSeparator,
|
|
186
203
|
BreadcrumbEllipsis,
|
|
187
204
|
};
|
|
188
|
-
export type { BreadcrumbProps, BreadcrumbLinkProps };
|
|
205
|
+
export type { BreadcrumbProps, BreadcrumbLinkProps, BreadcrumbEllipsisProps };
|
|
@@ -50,7 +50,7 @@ const CalloutContext = React.createContext<{ variant: CalloutVariant }>({
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
/** Props for the Callout component */
|
|
53
|
-
interface CalloutProps extends React.ComponentPropsWithoutRef<"
|
|
53
|
+
interface CalloutProps extends React.ComponentPropsWithoutRef<"aside"> {
|
|
54
54
|
/** Required test hook identifier */
|
|
55
55
|
dataHook: string;
|
|
56
56
|
/**
|
|
@@ -75,7 +75,7 @@ interface CalloutProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
|
75
75
|
*
|
|
76
76
|
* Use with `CalloutHeading` and optionally `CalloutCitation` as children.
|
|
77
77
|
*/
|
|
78
|
-
const Callout = React.forwardRef<
|
|
78
|
+
const Callout = React.forwardRef<HTMLElement, CalloutProps>(
|
|
79
79
|
(
|
|
80
80
|
{
|
|
81
81
|
className,
|
|
@@ -93,13 +93,14 @@ const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(
|
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
95
|
<CalloutContext.Provider value={contextValue}>
|
|
96
|
-
<
|
|
96
|
+
<aside
|
|
97
97
|
ref={ref}
|
|
98
98
|
className={cn(calloutVariants({ variant }), className)}
|
|
99
99
|
data-hook={dataHook}
|
|
100
100
|
data-slot="callout"
|
|
101
101
|
data-tracking-el={trackingEl || `callout-${variant}`}
|
|
102
102
|
data-tracking-label={trackingLabel}
|
|
103
|
+
role="note"
|
|
103
104
|
{...props}
|
|
104
105
|
>
|
|
105
106
|
<div className="flex flex-col gap-8">{children}</div>
|
|
@@ -114,7 +115,7 @@ const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(
|
|
|
114
115
|
data-slot="callout-pointer"
|
|
115
116
|
/>
|
|
116
117
|
)}
|
|
117
|
-
</
|
|
118
|
+
</aside>
|
|
118
119
|
</CalloutContext.Provider>
|
|
119
120
|
);
|
|
120
121
|
}
|
|
@@ -364,6 +364,11 @@ interface CarouselPreviousProps extends Omit<
|
|
|
364
364
|
* @default false
|
|
365
365
|
*/
|
|
366
366
|
hideWhenDisabled?: boolean;
|
|
367
|
+
/**
|
|
368
|
+
* Accessible label for the previous slide button.
|
|
369
|
+
* @default "Previous slide"
|
|
370
|
+
*/
|
|
371
|
+
ariaLabel?: string;
|
|
367
372
|
}
|
|
368
373
|
|
|
369
374
|
/**
|
|
@@ -375,6 +380,7 @@ function CarouselPrevious({
|
|
|
375
380
|
size = "default",
|
|
376
381
|
dataHook = "carousel-previous",
|
|
377
382
|
hideWhenDisabled = false,
|
|
383
|
+
ariaLabel = "Previous slide",
|
|
378
384
|
...props
|
|
379
385
|
}: CarouselPreviousProps) {
|
|
380
386
|
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
@@ -400,7 +406,7 @@ function CarouselPrevious({
|
|
|
400
406
|
{...props}
|
|
401
407
|
>
|
|
402
408
|
<ArrowLeft />
|
|
403
|
-
<span className="sr-only">
|
|
409
|
+
<span className="sr-only">{ariaLabel}</span>
|
|
404
410
|
</Button>
|
|
405
411
|
);
|
|
406
412
|
}
|
|
@@ -434,6 +440,11 @@ interface CarouselNextProps extends Omit<
|
|
|
434
440
|
* @default false
|
|
435
441
|
*/
|
|
436
442
|
hideWhenDisabled?: boolean;
|
|
443
|
+
/**
|
|
444
|
+
* Accessible label for the next slide button.
|
|
445
|
+
* @default "Next slide"
|
|
446
|
+
*/
|
|
447
|
+
ariaLabel?: string;
|
|
437
448
|
}
|
|
438
449
|
|
|
439
450
|
/**
|
|
@@ -445,6 +456,7 @@ function CarouselNext({
|
|
|
445
456
|
size = "default",
|
|
446
457
|
dataHook = "carousel-next",
|
|
447
458
|
hideWhenDisabled = false,
|
|
459
|
+
ariaLabel = "Next slide",
|
|
448
460
|
...props
|
|
449
461
|
}: CarouselNextProps) {
|
|
450
462
|
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
@@ -470,7 +482,7 @@ function CarouselNext({
|
|
|
470
482
|
{...props}
|
|
471
483
|
>
|
|
472
484
|
<ArrowRight />
|
|
473
|
-
<span className="sr-only">
|
|
485
|
+
<span className="sr-only">{ariaLabel}</span>
|
|
474
486
|
</Button>
|
|
475
487
|
);
|
|
476
488
|
}
|
|
@@ -494,6 +506,17 @@ interface CarouselDotsProps extends React.ComponentProps<"div"> {
|
|
|
494
506
|
* Tracking label for analytics context
|
|
495
507
|
*/
|
|
496
508
|
trackingLabel?: string;
|
|
509
|
+
/**
|
|
510
|
+
* Accessible label for the slide navigation group.
|
|
511
|
+
* @default "Slide navigation"
|
|
512
|
+
*/
|
|
513
|
+
ariaLabel?: string;
|
|
514
|
+
/**
|
|
515
|
+
* Accessible label for each slide dot button.
|
|
516
|
+
* Supports `{slide}` placeholder for interpolation (1-based).
|
|
517
|
+
* @default "Go to slide {slide}"
|
|
518
|
+
*/
|
|
519
|
+
slideAriaLabel?: string;
|
|
497
520
|
}
|
|
498
521
|
|
|
499
522
|
/**
|
|
@@ -505,6 +528,8 @@ function CarouselDots({
|
|
|
505
528
|
dataHook = "carousel-dots",
|
|
506
529
|
trackingEl,
|
|
507
530
|
trackingLabel,
|
|
531
|
+
ariaLabel = "Slide navigation",
|
|
532
|
+
slideAriaLabel,
|
|
508
533
|
...props
|
|
509
534
|
}: CarouselDotsProps) {
|
|
510
535
|
const { api } = useCarousel();
|
|
@@ -539,7 +564,7 @@ function CarouselDots({
|
|
|
539
564
|
|
|
540
565
|
return (
|
|
541
566
|
<div
|
|
542
|
-
aria-label=
|
|
567
|
+
aria-label={ariaLabel}
|
|
543
568
|
className={cn(
|
|
544
569
|
"border-border dark:border-input dark:bg-input/30 inline-flex items-center justify-center gap-2 rounded-full border bg-white px-2.5 py-2",
|
|
545
570
|
className
|
|
@@ -555,7 +580,11 @@ function CarouselDots({
|
|
|
555
580
|
<button
|
|
556
581
|
key={index}
|
|
557
582
|
aria-current={index === selectedIndex ? "step" : undefined}
|
|
558
|
-
aria-label={
|
|
583
|
+
aria-label={
|
|
584
|
+
slideAriaLabel
|
|
585
|
+
? slideAriaLabel.replace("{slide}", String(index + 1))
|
|
586
|
+
: `Go to slide ${index + 1}`
|
|
587
|
+
}
|
|
559
588
|
className={cn(
|
|
560
589
|
"focus-visible:shadow-default size-3 rounded-full transition-[width,background-color] duration-200 ease-out outline-none",
|
|
561
590
|
index === selectedIndex
|
package/src/components/chip.tsx
CHANGED
|
@@ -136,6 +136,17 @@ interface ChipProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
|
136
136
|
* @default 200
|
|
137
137
|
*/
|
|
138
138
|
maxWidth?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Accessible label for the loading spinner.
|
|
141
|
+
* @default "Loading"
|
|
142
|
+
*/
|
|
143
|
+
loadingLabel?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Accessible label for the remove button.
|
|
146
|
+
* Supports `{name}` placeholder for interpolation.
|
|
147
|
+
* @default "Remove {name}"
|
|
148
|
+
*/
|
|
149
|
+
removeAriaLabel?: string;
|
|
139
150
|
}
|
|
140
151
|
|
|
141
152
|
/**
|
|
@@ -155,6 +166,8 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
|
155
166
|
trackingEl,
|
|
156
167
|
trackingLabel,
|
|
157
168
|
maxWidth = 200,
|
|
169
|
+
loadingLabel,
|
|
170
|
+
removeAriaLabel,
|
|
158
171
|
...props
|
|
159
172
|
},
|
|
160
173
|
ref
|
|
@@ -214,7 +227,7 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
|
214
227
|
)}
|
|
215
228
|
{loading ? (
|
|
216
229
|
<span
|
|
217
|
-
aria-label="Loading"
|
|
230
|
+
aria-label={loadingLabel ?? "Loading"}
|
|
218
231
|
className={cn(chipDeleteButtonVariants({ size }))}
|
|
219
232
|
data-slot="chip-loading"
|
|
220
233
|
role="status"
|
|
@@ -226,7 +239,14 @@ const Chip = React.forwardRef<HTMLDivElement, ChipProps>(
|
|
|
226
239
|
</span>
|
|
227
240
|
) : (
|
|
228
241
|
<button
|
|
229
|
-
aria-label={
|
|
242
|
+
aria-label={
|
|
243
|
+
removeAriaLabel
|
|
244
|
+
? removeAriaLabel.replace(
|
|
245
|
+
"{name}",
|
|
246
|
+
typeof children === "string" ? children : "chip"
|
|
247
|
+
)
|
|
248
|
+
: `Remove ${typeof children === "string" ? children : "chip"}`
|
|
249
|
+
}
|
|
230
250
|
className={cn(chipDeleteButtonVariants({ size }))}
|
|
231
251
|
data-slot="chip-delete"
|
|
232
252
|
data-tracking-el={trackingEl ? `${trackingEl}-delete` : undefined}
|
|
@@ -611,6 +611,11 @@ export interface ComboboxContentProps {
|
|
|
611
611
|
* where you want to hide results until a minimum character count.
|
|
612
612
|
*/
|
|
613
613
|
hideList?: boolean;
|
|
614
|
+
/**
|
|
615
|
+
* Accessible label for the options popover.
|
|
616
|
+
* @default "Options"
|
|
617
|
+
*/
|
|
618
|
+
ariaLabel?: string;
|
|
614
619
|
}
|
|
615
620
|
|
|
616
621
|
function ComboboxContent({
|
|
@@ -622,6 +627,7 @@ function ComboboxContent({
|
|
|
622
627
|
sideOffset,
|
|
623
628
|
avoidCollisions,
|
|
624
629
|
hideList = false,
|
|
630
|
+
ariaLabel,
|
|
625
631
|
}: ComboboxContentProps) {
|
|
626
632
|
const { open, shouldFilter, filterFn, itemToStringValue } =
|
|
627
633
|
useComboboxContext();
|
|
@@ -731,7 +737,7 @@ function ComboboxContent({
|
|
|
731
737
|
<PopoverContent
|
|
732
738
|
ref={handleContentRef}
|
|
733
739
|
align={align}
|
|
734
|
-
aria-label="Options"
|
|
740
|
+
aria-label={ariaLabel ?? "Options"}
|
|
735
741
|
avoidCollisions={avoidCollisions}
|
|
736
742
|
className={cn(
|
|
737
743
|
"flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",
|
|
@@ -1346,6 +1352,14 @@ export interface ComboboxItemProps extends Omit<
|
|
|
1346
1352
|
highlightClassName?: string;
|
|
1347
1353
|
/** Additional keywords to match against when filtering. The item label is always included automatically. */
|
|
1348
1354
|
keywords?: string[];
|
|
1355
|
+
/**
|
|
1356
|
+
* Callback fired when the item is activated (clicked or chosen via keyboard).
|
|
1357
|
+
* Fires on every activation, including when the item is being deselected
|
|
1358
|
+
* (toggled off). Always receives the item's own value, not the resulting
|
|
1359
|
+
* combobox value — use `Combobox`'s `onValueChange` for selection state.
|
|
1360
|
+
* @param value - The value of the activated item
|
|
1361
|
+
*/
|
|
1362
|
+
onSelect?: (value: string) => void;
|
|
1349
1363
|
}
|
|
1350
1364
|
|
|
1351
1365
|
const ComboboxItem = React.forwardRef<
|
|
@@ -1362,6 +1376,7 @@ const ComboboxItem = React.forwardRef<
|
|
|
1362
1376
|
highlight,
|
|
1363
1377
|
highlightClassName,
|
|
1364
1378
|
keywords,
|
|
1379
|
+
onSelect,
|
|
1365
1380
|
...props
|
|
1366
1381
|
},
|
|
1367
1382
|
ref
|
|
@@ -1401,6 +1416,7 @@ const ComboboxItem = React.forwardRef<
|
|
|
1401
1416
|
const newValue = itemValue === value ? "" : itemValue;
|
|
1402
1417
|
onValueChange(newValue);
|
|
1403
1418
|
setOpen(false);
|
|
1419
|
+
onSelect?.(itemValue);
|
|
1404
1420
|
};
|
|
1405
1421
|
|
|
1406
1422
|
// Render children with optional highlighting
|
|
@@ -1515,9 +1531,18 @@ export interface ComboboxLoadingProps {
|
|
|
1515
1531
|
className?: string;
|
|
1516
1532
|
/** Children - custom loading content */
|
|
1517
1533
|
children?: React.ReactNode;
|
|
1534
|
+
/**
|
|
1535
|
+
* Loading text displayed next to the spinner.
|
|
1536
|
+
* @default "Loading..."
|
|
1537
|
+
*/
|
|
1538
|
+
loadingText?: string;
|
|
1518
1539
|
}
|
|
1519
1540
|
|
|
1520
|
-
function ComboboxLoading({
|
|
1541
|
+
function ComboboxLoading({
|
|
1542
|
+
className,
|
|
1543
|
+
children,
|
|
1544
|
+
loadingText,
|
|
1545
|
+
}: ComboboxLoadingProps) {
|
|
1521
1546
|
return (
|
|
1522
1547
|
<div
|
|
1523
1548
|
aria-live="polite"
|
|
@@ -1534,7 +1559,7 @@ function ComboboxLoading({ className, children }: ComboboxLoadingProps) {
|
|
|
1534
1559
|
aria-hidden="true"
|
|
1535
1560
|
className="size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"
|
|
1536
1561
|
/>
|
|
1537
|
-
Loading...
|
|
1562
|
+
{loadingText ?? "Loading..."}
|
|
1538
1563
|
</>
|
|
1539
1564
|
)}
|
|
1540
1565
|
</div>
|
|
@@ -137,6 +137,11 @@ export interface CommandInputProps extends React.ComponentProps<
|
|
|
137
137
|
* @example 300
|
|
138
138
|
*/
|
|
139
139
|
debounceMs?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Accessible label for the clear button.
|
|
142
|
+
* @default "Clear search"
|
|
143
|
+
*/
|
|
144
|
+
clearSearchAriaLabel?: string;
|
|
140
145
|
}
|
|
141
146
|
|
|
142
147
|
/**
|
|
@@ -157,6 +162,7 @@ const CommandInput = React.forwardRef<
|
|
|
157
162
|
onValueChange,
|
|
158
163
|
onClear,
|
|
159
164
|
debounceMs,
|
|
165
|
+
clearSearchAriaLabel,
|
|
160
166
|
...props
|
|
161
167
|
},
|
|
162
168
|
ref
|
|
@@ -255,7 +261,7 @@ const CommandInput = React.forwardRef<
|
|
|
255
261
|
/>
|
|
256
262
|
{showClearButton && (
|
|
257
263
|
<Button
|
|
258
|
-
aria-label="Clear search"
|
|
264
|
+
aria-label={clearSearchAriaLabel ?? "Clear search"}
|
|
259
265
|
className="text-muted-foreground hover:text-foreground"
|
|
260
266
|
dataHook="command-input-clear"
|
|
261
267
|
variant="ghost"
|
|
@@ -254,6 +254,11 @@ export interface DatePickerTriggerProps extends Omit<
|
|
|
254
254
|
* Whether the trigger has an error state
|
|
255
255
|
*/
|
|
256
256
|
error?: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Accessible label for the trigger button.
|
|
259
|
+
* @default "Select date" (single) or "Select date range" (range)
|
|
260
|
+
*/
|
|
261
|
+
triggerLabel?: string;
|
|
257
262
|
}
|
|
258
263
|
|
|
259
264
|
/**
|
|
@@ -262,7 +267,7 @@ export interface DatePickerTriggerProps extends Omit<
|
|
|
262
267
|
const DatePickerTrigger = React.forwardRef<
|
|
263
268
|
HTMLButtonElement,
|
|
264
269
|
DatePickerTriggerProps
|
|
265
|
-
>(({ className, children, id, error, ...props }, ref) => {
|
|
270
|
+
>(({ className, children, id, error, triggerLabel, ...props }, ref) => {
|
|
266
271
|
const {
|
|
267
272
|
mode,
|
|
268
273
|
date,
|
|
@@ -315,6 +320,7 @@ const DatePickerTrigger = React.forwardRef<
|
|
|
315
320
|
ref={combinedRef}
|
|
316
321
|
aria-label={
|
|
317
322
|
props["aria-label"] ??
|
|
323
|
+
triggerLabel ??
|
|
318
324
|
(mode === "single" ? "Select date" : "Select date range")
|
|
319
325
|
}
|
|
320
326
|
className={cn(
|
|
@@ -360,6 +366,11 @@ export interface DatePickerContentProps extends Omit<
|
|
|
360
366
|
* Children to render inside the popover
|
|
361
367
|
*/
|
|
362
368
|
children: React.ReactNode;
|
|
369
|
+
/**
|
|
370
|
+
* Accessible label for the date picker popover.
|
|
371
|
+
* @default "Date picker" (single) or "Date range picker" (range)
|
|
372
|
+
*/
|
|
373
|
+
contentLabel?: string;
|
|
363
374
|
}
|
|
364
375
|
|
|
365
376
|
/**
|
|
@@ -368,14 +379,17 @@ export interface DatePickerContentProps extends Omit<
|
|
|
368
379
|
const DatePickerContent = React.forwardRef<
|
|
369
380
|
HTMLDivElement,
|
|
370
381
|
DatePickerContentProps
|
|
371
|
-
>(({ className, children, ...props }, ref) => {
|
|
382
|
+
>(({ className, children, contentLabel, ...props }, ref) => {
|
|
372
383
|
const { dataHook, mode } = useDatePickerContext();
|
|
373
384
|
|
|
374
385
|
return (
|
|
375
386
|
<PopoverContent
|
|
376
387
|
ref={ref}
|
|
377
388
|
align="start"
|
|
378
|
-
aria-label={
|
|
389
|
+
aria-label={
|
|
390
|
+
contentLabel ??
|
|
391
|
+
(mode === "single" ? "Date picker" : "Date range picker")
|
|
392
|
+
}
|
|
379
393
|
className={cn("w-auto rounded-lg p-0", className)}
|
|
380
394
|
dataHook={`${dataHook}-content`}
|
|
381
395
|
{...props}
|
|
@@ -103,6 +103,11 @@ interface DialogContentProps extends React.ComponentProps<
|
|
|
103
103
|
* Tracking label for analytics context
|
|
104
104
|
*/
|
|
105
105
|
trackingLabel?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Accessible label for the close button.
|
|
108
|
+
* @default "Close"
|
|
109
|
+
*/
|
|
110
|
+
closeLabel?: string;
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
/**
|
|
@@ -111,7 +116,15 @@ interface DialogContentProps extends React.ComponentProps<
|
|
|
111
116
|
*/
|
|
112
117
|
const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
113
118
|
(
|
|
114
|
-
{
|
|
119
|
+
{
|
|
120
|
+
className,
|
|
121
|
+
children,
|
|
122
|
+
dataHook,
|
|
123
|
+
trackingEl,
|
|
124
|
+
trackingLabel,
|
|
125
|
+
closeLabel,
|
|
126
|
+
...props
|
|
127
|
+
},
|
|
115
128
|
ref
|
|
116
129
|
) => {
|
|
117
130
|
return (
|
|
@@ -132,7 +145,7 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
|
132
145
|
{children}
|
|
133
146
|
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-8 right-8 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0">
|
|
134
147
|
<X />
|
|
135
|
-
<span className="sr-only">Close</span>
|
|
148
|
+
<span className="sr-only">{closeLabel ?? "Close"}</span>
|
|
136
149
|
</DialogPrimitive.Close>
|
|
137
150
|
</DialogPrimitive.Content>
|
|
138
151
|
</DialogPortal>
|
|
@@ -142,7 +155,7 @@ const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
|
142
155
|
DialogContent.displayName = "DialogContent";
|
|
143
156
|
|
|
144
157
|
/**
|
|
145
|
-
* DialogHeader - Container for dialog title and description
|
|
158
|
+
* DialogHeader - Container for dialog title and description.
|
|
146
159
|
* @description Groups the title and description at the top of the dialog
|
|
147
160
|
*/
|
|
148
161
|
const DialogHeader = React.forwardRef<
|
|
@@ -159,7 +172,7 @@ const DialogHeader = React.forwardRef<
|
|
|
159
172
|
DialogHeader.displayName = "DialogHeader";
|
|
160
173
|
|
|
161
174
|
/**
|
|
162
|
-
* DialogFooter - Container for dialog action buttons
|
|
175
|
+
* DialogFooter - Container for dialog action buttons.
|
|
163
176
|
* @description Groups action buttons at the bottom of the dialog
|
|
164
177
|
*/
|
|
165
178
|
const DialogFooter = React.forwardRef<
|
|
@@ -132,7 +132,7 @@ function DrawerContent({
|
|
|
132
132
|
DrawerContent.displayName = "DrawerContent";
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
* DrawerHeader - Container for drawer title and description
|
|
135
|
+
* DrawerHeader - Container for drawer title and description.
|
|
136
136
|
* @description Groups the title and description at the top of the drawer
|
|
137
137
|
*/
|
|
138
138
|
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -169,7 +169,7 @@ function DrawerBody({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
169
169
|
DrawerBody.displayName = "DrawerBody";
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
|
-
* DrawerFooter - Container for drawer action buttons
|
|
172
|
+
* DrawerFooter - Container for drawer action buttons.
|
|
173
173
|
* @description Groups action buttons at the bottom of the drawer
|
|
174
174
|
*/
|
|
175
175
|
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
@@ -61,10 +61,10 @@ const DropdownMenuTrigger = React.forwardRef<
|
|
|
61
61
|
<DropdownMenuPrimitive.Trigger
|
|
62
62
|
ref={ref}
|
|
63
63
|
className={className}
|
|
64
|
-
data-hook={dataHook}
|
|
65
64
|
data-slot="dropdown-menu-trigger"
|
|
66
65
|
data-tracking-el={trackingEl}
|
|
67
66
|
data-tracking-label={trackingLabel}
|
|
67
|
+
{...(dataHook != null && { "data-hook": dataHook })}
|
|
68
68
|
{...props}
|
|
69
69
|
/>
|
|
70
70
|
);
|
|
@@ -251,6 +251,11 @@ interface GlobalLayoutMobileHeaderProps extends React.ComponentProps<"div"> {
|
|
|
251
251
|
* Data hook for automated testing (required)
|
|
252
252
|
*/
|
|
253
253
|
dataHook: string;
|
|
254
|
+
/**
|
|
255
|
+
* Accessible label for the mobile navigation toolbar.
|
|
256
|
+
* @default "Mobile navigation"
|
|
257
|
+
*/
|
|
258
|
+
ariaLabel?: string;
|
|
254
259
|
/**
|
|
255
260
|
* Tracking element identifier for analytics
|
|
256
261
|
*/
|
|
@@ -266,13 +271,21 @@ const GlobalLayoutMobileHeader = React.forwardRef<
|
|
|
266
271
|
GlobalLayoutMobileHeaderProps
|
|
267
272
|
>(
|
|
268
273
|
(
|
|
269
|
-
{
|
|
274
|
+
{
|
|
275
|
+
className,
|
|
276
|
+
dataHook,
|
|
277
|
+
ariaLabel,
|
|
278
|
+
trackingEl,
|
|
279
|
+
trackingLabel,
|
|
280
|
+
children,
|
|
281
|
+
...props
|
|
282
|
+
},
|
|
270
283
|
ref
|
|
271
284
|
) => {
|
|
272
285
|
return (
|
|
273
286
|
<div
|
|
274
287
|
ref={ref}
|
|
275
|
-
aria-label="Mobile navigation"
|
|
288
|
+
aria-label={ariaLabel ?? "Mobile navigation"}
|
|
276
289
|
className={cn(
|
|
277
290
|
"flex w-full items-center justify-start gap-2.5 py-2 lg:hidden",
|
|
278
291
|
className
|
|
@@ -420,6 +420,12 @@ export interface InputChipItemsProps {
|
|
|
420
420
|
className?: string;
|
|
421
421
|
/** Data hook prefix for chips */
|
|
422
422
|
dataHookPrefix?: string;
|
|
423
|
+
/**
|
|
424
|
+
* Accessible label for each chip item.
|
|
425
|
+
* Supports `{item}` placeholder for interpolation.
|
|
426
|
+
* @default "{item}, press Delete to remove"
|
|
427
|
+
*/
|
|
428
|
+
itemAriaLabel?: string;
|
|
423
429
|
}
|
|
424
430
|
|
|
425
431
|
/**
|
|
@@ -429,6 +435,7 @@ export interface InputChipItemsProps {
|
|
|
429
435
|
function InputChipItems({
|
|
430
436
|
className,
|
|
431
437
|
dataHookPrefix = "chip",
|
|
438
|
+
itemAriaLabel,
|
|
432
439
|
}: InputChipItemsProps) {
|
|
433
440
|
const { removeItem, inputRef, setFocusedChipIndex, chipRefs } =
|
|
434
441
|
useInputChipDispatch();
|
|
@@ -558,7 +565,11 @@ function InputChipItems({
|
|
|
558
565
|
ref={(el) => {
|
|
559
566
|
chipRefs.current[index] = el;
|
|
560
567
|
}}
|
|
561
|
-
aria-label={
|
|
568
|
+
aria-label={
|
|
569
|
+
itemAriaLabel
|
|
570
|
+
? itemAriaLabel.replace("{item}", item)
|
|
571
|
+
: `${item}, press Delete to remove`
|
|
572
|
+
}
|
|
562
573
|
dataHook={`${dataHookPrefix}-${index}`}
|
|
563
574
|
disabled={disabled}
|
|
564
575
|
role="group"
|