@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
|
@@ -5,6 +5,7 @@ import { Eye, EyeOff } from "@brightlocal/icons";
|
|
|
5
5
|
|
|
6
6
|
import { Progress } from "@brightlocal/ui-components/progress";
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
|
+
|
|
8
9
|
import {
|
|
9
10
|
InputGroup,
|
|
10
11
|
InputGroupInput,
|
|
@@ -336,6 +337,16 @@ export interface InputPasswordFieldProps extends Omit<
|
|
|
336
337
|
* Additional class name for the InputGroup wrapper
|
|
337
338
|
*/
|
|
338
339
|
groupClassName?: string;
|
|
340
|
+
/**
|
|
341
|
+
* Accessible label for the toggle button when password is hidden.
|
|
342
|
+
* @default "Show password"
|
|
343
|
+
*/
|
|
344
|
+
showLabel?: string;
|
|
345
|
+
/**
|
|
346
|
+
* Accessible label for the toggle button when password is visible.
|
|
347
|
+
* @default "Hide password"
|
|
348
|
+
*/
|
|
349
|
+
hideLabel?: string;
|
|
339
350
|
}
|
|
340
351
|
|
|
341
352
|
/**
|
|
@@ -345,54 +356,63 @@ export interface InputPasswordFieldProps extends Omit<
|
|
|
345
356
|
const InputPasswordField = React.forwardRef<
|
|
346
357
|
HTMLInputElement,
|
|
347
358
|
InputPasswordFieldProps
|
|
348
|
-
>(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
};
|
|
359
|
+
>(
|
|
360
|
+
(
|
|
361
|
+
{ className, groupClassName, onChange, showLabel, hideLabel, ...props },
|
|
362
|
+
ref
|
|
363
|
+
) => {
|
|
364
|
+
const {
|
|
365
|
+
showPassword,
|
|
366
|
+
toggleVisibility,
|
|
367
|
+
password,
|
|
368
|
+
setPassword,
|
|
369
|
+
disabled,
|
|
370
|
+
dataHook,
|
|
371
|
+
trackingEl,
|
|
372
|
+
trackingLabel,
|
|
373
|
+
inputId,
|
|
374
|
+
error,
|
|
375
|
+
} = useInputPasswordContext();
|
|
366
376
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
value={password}
|
|
378
|
-
onChange={handleChange}
|
|
379
|
-
{...props}
|
|
380
|
-
/>
|
|
381
|
-
<InputGroupAddon align="inline-end">
|
|
382
|
-
<InputGroupButton
|
|
383
|
-
aria-label={showPassword ? "Hide password" : "Show password"}
|
|
384
|
-
data-hook={`${dataHook}-toggle`}
|
|
377
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
378
|
+
setPassword(e.target.value);
|
|
379
|
+
onChange?.(e);
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
return (
|
|
383
|
+
<InputGroup className={groupClassName} dataHook={dataHook} error={error}>
|
|
384
|
+
<InputGroupInput
|
|
385
|
+
ref={ref}
|
|
386
|
+
className={className}
|
|
385
387
|
disabled={disabled}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
{
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
388
|
+
id={inputId}
|
|
389
|
+
trackingEl={trackingEl}
|
|
390
|
+
trackingLabel={trackingLabel}
|
|
391
|
+
type={showPassword ? "text" : "password"}
|
|
392
|
+
value={password}
|
|
393
|
+
onChange={handleChange}
|
|
394
|
+
{...props}
|
|
395
|
+
/>
|
|
396
|
+
<InputGroupAddon align="inline-end">
|
|
397
|
+
<InputGroupButton
|
|
398
|
+
aria-label={
|
|
399
|
+
showPassword
|
|
400
|
+
? (hideLabel ?? "Hide password")
|
|
401
|
+
: (showLabel ?? "Show password")
|
|
402
|
+
}
|
|
403
|
+
data-hook={`${dataHook}-toggle`}
|
|
404
|
+
disabled={disabled}
|
|
405
|
+
size="icon-sm"
|
|
406
|
+
variant="ghost"
|
|
407
|
+
onClick={toggleVisibility}
|
|
408
|
+
>
|
|
409
|
+
{showPassword ? <EyeOff /> : <Eye />}
|
|
410
|
+
</InputGroupButton>
|
|
411
|
+
</InputGroupAddon>
|
|
412
|
+
</InputGroup>
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
);
|
|
396
416
|
|
|
397
417
|
InputPasswordField.displayName = "InputPasswordField";
|
|
398
418
|
|
|
@@ -427,8 +447,8 @@ const InputPasswordToggle = React.forwardRef<
|
|
|
427
447
|
(
|
|
428
448
|
{
|
|
429
449
|
className,
|
|
430
|
-
showLabel
|
|
431
|
-
hideLabel
|
|
450
|
+
showLabel,
|
|
451
|
+
hideLabel,
|
|
432
452
|
size = "icon",
|
|
433
453
|
variant = "ghost",
|
|
434
454
|
...props
|
|
@@ -441,7 +461,11 @@ const InputPasswordToggle = React.forwardRef<
|
|
|
441
461
|
return (
|
|
442
462
|
<InputGroupButton
|
|
443
463
|
ref={ref}
|
|
444
|
-
aria-label={
|
|
464
|
+
aria-label={
|
|
465
|
+
showPassword
|
|
466
|
+
? (hideLabel ?? "Hide password")
|
|
467
|
+
: (showLabel ?? "Show password")
|
|
468
|
+
}
|
|
445
469
|
className={className}
|
|
446
470
|
data-hook={`${dataHook}-toggle`}
|
|
447
471
|
disabled={disabled}
|
package/src/components/link.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { ExternalLink } from "@brightlocal/icons";
|
|
3
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
4
4
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
@@ -55,7 +55,7 @@ export interface LinkProps
|
|
|
55
55
|
*/
|
|
56
56
|
external?: boolean;
|
|
57
57
|
/**
|
|
58
|
-
* If true, shows the external link icon when external is true
|
|
58
|
+
* If true, shows the external link icon when external is true.
|
|
59
59
|
* @default true
|
|
60
60
|
*/
|
|
61
61
|
showExternalIcon?: boolean;
|
|
@@ -76,27 +76,39 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
76
76
|
},
|
|
77
77
|
ref
|
|
78
78
|
) => {
|
|
79
|
-
const Comp = asChild ? Slot : "a";
|
|
80
79
|
const externalProps = external
|
|
81
80
|
? { target: "_blank", rel: "noopener noreferrer" }
|
|
82
81
|
: {};
|
|
83
82
|
|
|
83
|
+
const sharedProps = {
|
|
84
|
+
ref,
|
|
85
|
+
className: cn(linkVariants(), className),
|
|
86
|
+
"data-hook": dataHook,
|
|
87
|
+
"data-slot": "link" as const,
|
|
88
|
+
"data-tracking-el": trackingEl || "link-default",
|
|
89
|
+
"data-tracking-label": trackingLabel,
|
|
90
|
+
...externalProps,
|
|
91
|
+
...props,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const externalIcon = external && showExternalIcon && (
|
|
95
|
+
<ExternalLink aria-hidden="true" data-slot="external-icon" />
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
if (asChild) {
|
|
99
|
+
return (
|
|
100
|
+
<Slot {...sharedProps}>
|
|
101
|
+
<Slottable>{children}</Slottable>
|
|
102
|
+
{externalIcon}
|
|
103
|
+
</Slot>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
84
107
|
return (
|
|
85
|
-
<
|
|
86
|
-
ref={ref}
|
|
87
|
-
className={cn(linkVariants(), className)}
|
|
88
|
-
data-hook={dataHook}
|
|
89
|
-
data-slot="link"
|
|
90
|
-
data-tracking-el={trackingEl || "link-default"}
|
|
91
|
-
data-tracking-label={trackingLabel}
|
|
92
|
-
{...externalProps}
|
|
93
|
-
{...props}
|
|
94
|
-
>
|
|
108
|
+
<a {...sharedProps}>
|
|
95
109
|
{children}
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
)}
|
|
99
|
-
</Comp>
|
|
110
|
+
{externalIcon}
|
|
111
|
+
</a>
|
|
100
112
|
);
|
|
101
113
|
}
|
|
102
114
|
);
|
package/src/components/list.tsx
CHANGED
|
@@ -25,6 +25,7 @@ const itemVariants = cva(
|
|
|
25
25
|
{
|
|
26
26
|
variants: {
|
|
27
27
|
variant: {
|
|
28
|
+
default: [],
|
|
28
29
|
filled: ["bg-card"],
|
|
29
30
|
outline: ["bg-background", "border", "border-border"],
|
|
30
31
|
loading: ["flex-col", "gap-2", "px-0", "pt-0", "pb-3"],
|
|
@@ -107,12 +108,13 @@ export type ItemProps = React.ComponentProps<"li"> & {
|
|
|
107
108
|
asChild?: boolean;
|
|
108
109
|
/**
|
|
109
110
|
* Visual style of the item row.
|
|
111
|
+
* - `default` — plain row without background or border
|
|
110
112
|
* - `filled` — card background (default)
|
|
111
113
|
* - `outline` — bordered row on page background
|
|
112
114
|
* - `loading` — skeleton placeholder
|
|
113
115
|
* @default "filled"
|
|
114
116
|
*/
|
|
115
|
-
variant?: "filled" | "outline" | "loading";
|
|
117
|
+
variant?: "default" | "filled" | "outline" | "loading";
|
|
116
118
|
/**
|
|
117
119
|
* Data hook for automated testing.
|
|
118
120
|
*/
|
|
@@ -128,7 +130,7 @@ export type ItemProps = React.ComponentProps<"li"> & {
|
|
|
128
130
|
};
|
|
129
131
|
|
|
130
132
|
/**
|
|
131
|
-
* Row component within a List. Supports `filled`, `outline`, and `loading` variants.
|
|
133
|
+
* Row component within a List. Supports `default`, `filled`, `outline`, and `loading` variants.
|
|
132
134
|
* Compose with ItemMedia, ItemContent, ItemTitle, ItemDescription, and ItemActions.
|
|
133
135
|
*/
|
|
134
136
|
const Item = React.forwardRef<HTMLLIElement, ItemProps>(
|
|
@@ -285,6 +287,46 @@ const ItemActions = React.forwardRef<HTMLDivElement, ItemActionsProps>(
|
|
|
285
287
|
);
|
|
286
288
|
ItemActions.displayName = "ItemActions";
|
|
287
289
|
|
|
290
|
+
/* -------------------------------------------------------------------------------------------------
|
|
291
|
+
* ItemSubheader
|
|
292
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
293
|
+
|
|
294
|
+
/** Props for the ItemSubheader sub-component — section heading within a List. */
|
|
295
|
+
export type ItemSubheaderProps = React.ComponentProps<"li"> & {
|
|
296
|
+
/**
|
|
297
|
+
* Data hook for automated testing.
|
|
298
|
+
*/
|
|
299
|
+
dataHook?: string;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Section heading for grouping related items within a List.
|
|
304
|
+
* Renders as a non-interactive `<li>` with muted label styling.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```tsx
|
|
308
|
+
* <List dataHook="actions-list">
|
|
309
|
+
* <ItemSubheader>Suggestions</ItemSubheader>
|
|
310
|
+
* <Item variant="default" dataHook="item-1">...</Item>
|
|
311
|
+
* </List>
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
const ItemSubheader = React.forwardRef<HTMLLIElement, ItemSubheaderProps>(
|
|
315
|
+
({ className, dataHook, ...props }, ref) => (
|
|
316
|
+
<li
|
|
317
|
+
ref={ref}
|
|
318
|
+
className={cn(
|
|
319
|
+
"text-muted-foreground flex items-center py-2 pr-2 pl-4 text-base leading-none font-medium",
|
|
320
|
+
className
|
|
321
|
+
)}
|
|
322
|
+
data-hook={dataHook}
|
|
323
|
+
data-slot="item-subheader"
|
|
324
|
+
{...props}
|
|
325
|
+
/>
|
|
326
|
+
)
|
|
327
|
+
);
|
|
328
|
+
ItemSubheader.displayName = "ItemSubheader";
|
|
329
|
+
|
|
288
330
|
/* -------------------------------------------------------------------------------------------------
|
|
289
331
|
* Exports
|
|
290
332
|
* -----------------------------------------------------------------------------------------------*/
|
|
@@ -297,5 +339,6 @@ export {
|
|
|
297
339
|
ItemTitle,
|
|
298
340
|
ItemDescription,
|
|
299
341
|
ItemActions,
|
|
342
|
+
ItemSubheader,
|
|
300
343
|
itemVariants,
|
|
301
344
|
};
|
package/src/components/logo.tsx
CHANGED
|
@@ -28,6 +28,11 @@ interface LogoProps
|
|
|
28
28
|
* Required data-hook attribute for testing and component identification
|
|
29
29
|
*/
|
|
30
30
|
dataHook: string;
|
|
31
|
+
/**
|
|
32
|
+
* Accessible label for the logo image.
|
|
33
|
+
* @default "BrightLocal Logo"
|
|
34
|
+
*/
|
|
35
|
+
ariaLabel?: string;
|
|
31
36
|
/**
|
|
32
37
|
* Optional tracking element identifier for analytics
|
|
33
38
|
*/
|
|
@@ -42,26 +47,27 @@ function Logo({
|
|
|
42
47
|
className,
|
|
43
48
|
variant = "logotype",
|
|
44
49
|
dataHook,
|
|
50
|
+
ariaLabel,
|
|
45
51
|
trackingEl,
|
|
46
52
|
trackingLabel,
|
|
47
53
|
...props
|
|
48
54
|
}: LogoProps) {
|
|
49
55
|
return (
|
|
50
56
|
<div
|
|
51
|
-
aria-label="BrightLocal Logo"
|
|
52
57
|
className={cn(logoVariants({ variant }), className)}
|
|
53
58
|
data-hook={dataHook}
|
|
54
59
|
data-slot="logo"
|
|
55
60
|
data-tracking-el={trackingEl}
|
|
56
61
|
data-tracking-label={trackingLabel}
|
|
57
62
|
data-variant={variant}
|
|
58
|
-
role="img"
|
|
59
63
|
{...props}
|
|
60
64
|
>
|
|
61
65
|
{variant === "logotype" && (
|
|
62
66
|
<svg
|
|
67
|
+
aria-label={ariaLabel ?? "BrightLocal Logo"}
|
|
63
68
|
fill="none"
|
|
64
69
|
height="24"
|
|
70
|
+
role="img"
|
|
65
71
|
viewBox="0 0 128 24.1509"
|
|
66
72
|
width="128"
|
|
67
73
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -81,8 +87,10 @@ function Logo({
|
|
|
81
87
|
)}
|
|
82
88
|
{variant === "mark" && (
|
|
83
89
|
<svg
|
|
90
|
+
aria-label={ariaLabel ?? "BrightLocal Logo"}
|
|
84
91
|
fill="none"
|
|
85
92
|
height="21"
|
|
93
|
+
role="img"
|
|
86
94
|
viewBox="0 0 23 21"
|
|
87
95
|
width="23"
|
|
88
96
|
xmlns="http://www.w3.org/2000/svg"
|
package/src/components/map.tsx
CHANGED
|
@@ -12,6 +12,27 @@ import {
|
|
|
12
12
|
type PopoverContentProps,
|
|
13
13
|
} from "@brightlocal/ui-components/popover";
|
|
14
14
|
|
|
15
|
+
// ──────────────────────────────────────
|
|
16
|
+
// MapTypeId
|
|
17
|
+
// ──────────────────────────────────────
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Vendor-agnostic map type identifiers.
|
|
21
|
+
* Values match `google.maps.MapTypeId` so they can be passed directly
|
|
22
|
+
* to Google Maps or any provider that accepts the same string literals.
|
|
23
|
+
*/
|
|
24
|
+
const MapTypeId = {
|
|
25
|
+
/** Default road map view */
|
|
26
|
+
ROADMAP: "roadmap",
|
|
27
|
+
/** Satellite imagery */
|
|
28
|
+
SATELLITE: "satellite",
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Union of all map type identifier values.
|
|
33
|
+
*/
|
|
34
|
+
type MapTypeIdValue = (typeof MapTypeId)[keyof typeof MapTypeId];
|
|
35
|
+
|
|
15
36
|
// ──────────────────────────────────────
|
|
16
37
|
// MapGridPin
|
|
17
38
|
// ──────────────────────────────────────
|
|
@@ -547,6 +568,7 @@ MapPopoverContent.displayName = "MapPopoverContent";
|
|
|
547
568
|
// ──────────────────────────────────────
|
|
548
569
|
|
|
549
570
|
export {
|
|
571
|
+
MapTypeId,
|
|
550
572
|
MapLocationPin,
|
|
551
573
|
MapGridPin,
|
|
552
574
|
MapControlButton,
|
|
@@ -560,6 +582,7 @@ export {
|
|
|
560
582
|
};
|
|
561
583
|
|
|
562
584
|
export type {
|
|
585
|
+
MapTypeIdValue,
|
|
563
586
|
MapLocationPinProps,
|
|
564
587
|
MapGridPinProps,
|
|
565
588
|
MapGridPinVariant,
|
|
@@ -170,7 +170,10 @@ interface PaginationProps extends React.ComponentProps<"nav"> {
|
|
|
170
170
|
trackingEl?: string;
|
|
171
171
|
/** Tracking label for analytics context */
|
|
172
172
|
trackingLabel?: string;
|
|
173
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* Accessible label for the pagination navigation (for unique landmark identification).
|
|
175
|
+
* @default "Pagination"
|
|
176
|
+
*/
|
|
174
177
|
ariaLabel?: string;
|
|
175
178
|
}
|
|
176
179
|
|
|
@@ -179,12 +182,12 @@ function Pagination({
|
|
|
179
182
|
dataHook,
|
|
180
183
|
trackingEl,
|
|
181
184
|
trackingLabel,
|
|
182
|
-
ariaLabel
|
|
185
|
+
ariaLabel,
|
|
183
186
|
...props
|
|
184
187
|
}: PaginationProps) {
|
|
185
188
|
return (
|
|
186
189
|
<nav
|
|
187
|
-
aria-label={ariaLabel}
|
|
190
|
+
aria-label={ariaLabel ?? "Pagination"}
|
|
188
191
|
className={cn("mx-auto flex w-full justify-center", className)}
|
|
189
192
|
data-hook={dataHook}
|
|
190
193
|
data-slot="pagination"
|
|
@@ -250,17 +253,22 @@ interface PaginationPreviousProps extends Omit<
|
|
|
250
253
|
> {
|
|
251
254
|
/** Whether the previous button is disabled (on first page) */
|
|
252
255
|
disabled?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Accessible label for the previous-page button.
|
|
258
|
+
* @default "Go to previous page"
|
|
259
|
+
*/
|
|
260
|
+
ariaLabel?: string;
|
|
253
261
|
}
|
|
254
262
|
|
|
255
263
|
const PaginationPrevious = React.forwardRef<
|
|
256
264
|
HTMLButtonElement,
|
|
257
265
|
PaginationPreviousProps
|
|
258
|
-
>(({ className, disabled, ...props }, ref) => {
|
|
266
|
+
>(({ className, disabled, ariaLabel, ...props }, ref) => {
|
|
259
267
|
return (
|
|
260
268
|
<PaginationButton
|
|
261
269
|
ref={ref}
|
|
262
270
|
aria-disabled={disabled}
|
|
263
|
-
aria-label="Go to previous page"
|
|
271
|
+
aria-label={ariaLabel ?? "Go to previous page"}
|
|
264
272
|
className={className}
|
|
265
273
|
disabled={disabled}
|
|
266
274
|
variant="previous"
|
|
@@ -276,15 +284,20 @@ PaginationPrevious.displayName = "PaginationPrevious";
|
|
|
276
284
|
interface PaginationNextProps extends Omit<PaginationButtonProps, "variant"> {
|
|
277
285
|
/** Whether the next button is disabled (on last page) */
|
|
278
286
|
disabled?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Accessible label for the next-page button.
|
|
289
|
+
* @default "Go to next page"
|
|
290
|
+
*/
|
|
291
|
+
ariaLabel?: string;
|
|
279
292
|
}
|
|
280
293
|
|
|
281
294
|
const PaginationNext = React.forwardRef<HTMLButtonElement, PaginationNextProps>(
|
|
282
|
-
({ className, disabled, ...props }, ref) => {
|
|
295
|
+
({ className, disabled, ariaLabel, ...props }, ref) => {
|
|
283
296
|
return (
|
|
284
297
|
<PaginationButton
|
|
285
298
|
ref={ref}
|
|
286
299
|
aria-disabled={disabled}
|
|
287
|
-
aria-label="Go to next page"
|
|
300
|
+
aria-label={ariaLabel ?? "Go to next page"}
|
|
288
301
|
className={className}
|
|
289
302
|
disabled={disabled}
|
|
290
303
|
variant="next"
|
|
@@ -301,14 +314,24 @@ PaginationNext.displayName = "PaginationNext";
|
|
|
301
314
|
interface PaginationLinkProps extends Omit<PaginationButtonProps, "variant"> {
|
|
302
315
|
/** Page number to display */
|
|
303
316
|
page: number;
|
|
317
|
+
/**
|
|
318
|
+
* Accessible label for the page button.
|
|
319
|
+
* Supports `{page}` placeholder for interpolation.
|
|
320
|
+
* @default "Go to page {page}"
|
|
321
|
+
*/
|
|
322
|
+
ariaLabel?: string;
|
|
304
323
|
}
|
|
305
324
|
|
|
306
325
|
const PaginationLink = React.forwardRef<HTMLButtonElement, PaginationLinkProps>(
|
|
307
|
-
({ className, page, isActive, ...props }, ref) => {
|
|
326
|
+
({ className, page, isActive, ariaLabel, ...props }, ref) => {
|
|
308
327
|
return (
|
|
309
328
|
<PaginationButton
|
|
310
329
|
ref={ref}
|
|
311
|
-
aria-label={
|
|
330
|
+
aria-label={
|
|
331
|
+
ariaLabel
|
|
332
|
+
? ariaLabel.replace("{page}", String(page))
|
|
333
|
+
: `Go to page ${page}`
|
|
334
|
+
}
|
|
312
335
|
className={className}
|
|
313
336
|
isActive={isActive}
|
|
314
337
|
variant="link"
|
|
@@ -322,10 +345,19 @@ const PaginationLink = React.forwardRef<HTMLButtonElement, PaginationLinkProps>(
|
|
|
322
345
|
|
|
323
346
|
PaginationLink.displayName = "PaginationLink";
|
|
324
347
|
|
|
348
|
+
interface PaginationEllipsisProps extends React.ComponentProps<"span"> {
|
|
349
|
+
/**
|
|
350
|
+
* Screen-reader-only label for the ellipsis.
|
|
351
|
+
* @default "More pages"
|
|
352
|
+
*/
|
|
353
|
+
srLabel?: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
325
356
|
function PaginationEllipsis({
|
|
326
357
|
className,
|
|
358
|
+
srLabel = "More pages",
|
|
327
359
|
...props
|
|
328
|
-
}:
|
|
360
|
+
}: PaginationEllipsisProps) {
|
|
329
361
|
return (
|
|
330
362
|
<span
|
|
331
363
|
aria-hidden="true"
|
|
@@ -334,7 +366,7 @@ function PaginationEllipsis({
|
|
|
334
366
|
{...props}
|
|
335
367
|
>
|
|
336
368
|
<MoreHorizontal />
|
|
337
|
-
<span className="sr-only">
|
|
369
|
+
<span className="sr-only">{srLabel}</span>
|
|
338
370
|
</span>
|
|
339
371
|
);
|
|
340
372
|
}
|
|
@@ -355,4 +387,5 @@ export {
|
|
|
355
387
|
type PaginationLinkProps,
|
|
356
388
|
type PaginationPreviousProps,
|
|
357
389
|
type PaginationNextProps,
|
|
390
|
+
type PaginationEllipsisProps,
|
|
358
391
|
};
|
|
@@ -44,8 +44,8 @@ const PopoverTrigger = React.forwardRef<
|
|
|
44
44
|
>(({ dataHook, ...props }, ref) => (
|
|
45
45
|
<PopoverPrimitive.Trigger
|
|
46
46
|
ref={ref}
|
|
47
|
-
data-hook={dataHook}
|
|
48
47
|
data-slot="popover-trigger"
|
|
48
|
+
{...(dataHook != null && { "data-hook": dataHook })}
|
|
49
49
|
{...props}
|
|
50
50
|
/>
|
|
51
51
|
));
|
|
@@ -16,6 +16,12 @@ export interface RatingProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
16
16
|
* Data hook for testing
|
|
17
17
|
*/
|
|
18
18
|
dataHook: string;
|
|
19
|
+
/**
|
|
20
|
+
* Accessible label for the rating.
|
|
21
|
+
* Supports `{value}` placeholder for interpolation.
|
|
22
|
+
* @default "Rating: {value} out of 5 stars"
|
|
23
|
+
*/
|
|
24
|
+
ariaLabel?: string;
|
|
19
25
|
/**
|
|
20
26
|
* Optional tracking element identifier
|
|
21
27
|
*/
|
|
@@ -28,7 +34,15 @@ export interface RatingProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
28
34
|
|
|
29
35
|
const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
|
|
30
36
|
(
|
|
31
|
-
{
|
|
37
|
+
{
|
|
38
|
+
value,
|
|
39
|
+
dataHook,
|
|
40
|
+
ariaLabel,
|
|
41
|
+
trackingEl,
|
|
42
|
+
trackingLabel,
|
|
43
|
+
className,
|
|
44
|
+
...props
|
|
45
|
+
},
|
|
32
46
|
ref
|
|
33
47
|
) => {
|
|
34
48
|
// Clamp value between 0 and 5
|
|
@@ -37,7 +51,11 @@ const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
|
|
|
37
51
|
return (
|
|
38
52
|
<div
|
|
39
53
|
ref={ref}
|
|
40
|
-
aria-label={
|
|
54
|
+
aria-label={
|
|
55
|
+
ariaLabel
|
|
56
|
+
? ariaLabel.replace("{value}", String(clampedValue))
|
|
57
|
+
: `Rating: ${clampedValue} out of 5 stars`
|
|
58
|
+
}
|
|
41
59
|
className={cn("flex items-center gap-0.5", className)}
|
|
42
60
|
data-hook={dataHook}
|
|
43
61
|
data-slot="rating"
|
|
@@ -74,7 +92,7 @@ const Rating = React.forwardRef<HTMLDivElement, RatingProps>(
|
|
|
74
92
|
width: `${fillPercentage}%`,
|
|
75
93
|
}}
|
|
76
94
|
>
|
|
77
|
-
<StarRating
|
|
95
|
+
<StarRating />
|
|
78
96
|
</div>
|
|
79
97
|
)}
|
|
80
98
|
</div>
|
|
@@ -19,6 +19,17 @@ interface SelectProps extends React.ComponentProps<
|
|
|
19
19
|
children?: React.ReactNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
interface SelectContentProps extends React.ComponentProps<
|
|
23
|
+
typeof SelectPrimitive.Content
|
|
24
|
+
> {
|
|
25
|
+
/**
|
|
26
|
+
* Maximum height of the dropdown in pixels.
|
|
27
|
+
* Constrains the dropdown height and shows scroll indicators when content overflows.
|
|
28
|
+
* The dropdown uses the smaller of this value and the available viewport space.
|
|
29
|
+
*/
|
|
30
|
+
maxHeight?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
// ============================================================================
|
|
23
34
|
// Main Select Component
|
|
24
35
|
// ============================================================================
|
|
@@ -121,6 +132,12 @@ interface SelectTriggerProps extends React.ComponentProps<
|
|
|
121
132
|
dataHook?: string;
|
|
122
133
|
/** Whether the select trigger has an error state */
|
|
123
134
|
error?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Accessible label for the select trigger.
|
|
137
|
+
* Priority: aria-label > selectLabel > placeholder > "Select an option"
|
|
138
|
+
* @default "Select an option"
|
|
139
|
+
*/
|
|
140
|
+
selectLabel?: string;
|
|
124
141
|
}
|
|
125
142
|
|
|
126
143
|
// ============================================================================
|
|
@@ -136,6 +153,7 @@ function SelectTrigger({
|
|
|
136
153
|
placeholder,
|
|
137
154
|
dataHook,
|
|
138
155
|
error,
|
|
156
|
+
selectLabel,
|
|
139
157
|
...props
|
|
140
158
|
}: SelectTriggerProps) {
|
|
141
159
|
// Support both error prop and aria-invalid for backwards compatibility
|
|
@@ -145,7 +163,8 @@ function SelectTrigger({
|
|
|
145
163
|
props["aria-required"] === true || props["aria-required"] === "true";
|
|
146
164
|
|
|
147
165
|
// Provide fallback label for accessibility
|
|
148
|
-
const ariaLabel =
|
|
166
|
+
const ariaLabel =
|
|
167
|
+
props["aria-label"] || selectLabel || placeholder || "Select an option";
|
|
149
168
|
|
|
150
169
|
const errorStyles = isError
|
|
151
170
|
? "border-destructive-40 dark:border-destructive-40 " +
|
|
@@ -183,8 +202,10 @@ function SelectContent({
|
|
|
183
202
|
className,
|
|
184
203
|
children,
|
|
185
204
|
position = "popper",
|
|
205
|
+
maxHeight,
|
|
206
|
+
style,
|
|
186
207
|
...props
|
|
187
|
-
}:
|
|
208
|
+
}: SelectContentProps) {
|
|
188
209
|
const viewportRef = React.useRef<HTMLDivElement>(null);
|
|
189
210
|
|
|
190
211
|
useDevWarning(
|
|
@@ -230,12 +251,21 @@ function SelectContent({
|
|
|
230
251
|
"data-[side=top]:-translate-y-1"
|
|
231
252
|
);
|
|
232
253
|
|
|
254
|
+
const contentStyle: React.CSSProperties | undefined =
|
|
255
|
+
maxHeight !== undefined
|
|
256
|
+
? {
|
|
257
|
+
...style,
|
|
258
|
+
maxHeight: `min(${maxHeight}px, var(--radix-select-content-available-height))`,
|
|
259
|
+
}
|
|
260
|
+
: style;
|
|
261
|
+
|
|
233
262
|
return (
|
|
234
263
|
<SelectPrimitive.Portal>
|
|
235
264
|
<SelectPrimitive.Content
|
|
236
265
|
className={cn(baseStyles, popperStyles, className)}
|
|
237
266
|
data-slot="select-content"
|
|
238
267
|
position={position}
|
|
268
|
+
style={contentStyle}
|
|
239
269
|
{...props}
|
|
240
270
|
>
|
|
241
271
|
<SelectScrollUpButton />
|
|
@@ -412,4 +442,4 @@ export {
|
|
|
412
442
|
SelectValue,
|
|
413
443
|
};
|
|
414
444
|
|
|
415
|
-
export type { SelectProps, SelectTriggerProps };
|
|
445
|
+
export type { SelectContentProps, SelectProps, SelectTriggerProps };
|