@brightlocal/ui-components 2.17.1 → 2.19.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/README.md +83 -1
- package/component-meta.json +23 -7
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +23 -2
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +21 -19
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +64 -63
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +2 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +426 -403
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +22 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +93 -72
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +1 -7
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +23 -3
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +44 -42
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +10 -0
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +30 -29
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +5 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +9 -7
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +44 -42
- package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
- package/dist/hooks/use-prefers-reduced-motion.d.ts +25 -2
- package/dist/hooks/use-prefers-reduced-motion.d.ts.map +1 -1
- package/dist/hooks/use-prefers-reduced-motion.js +17 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +38 -37
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +13 -2
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +110 -53
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +44 -37
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +26 -25
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +17 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +29 -27
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.d.ts +15 -13
- package/dist/stepper.d.ts.map +1 -1
- package/dist/stepper.js +84 -85
- package/package.json +3 -3
- package/src/blocks/input-list.tsx +8 -1
- package/src/blocks/sidebar.tsx +47 -7
- package/src/components/alert-dialog.tsx +38 -4
- package/src/components/card.tsx +56 -9
- package/src/components/chip.tsx +1 -4
- package/src/components/dialog.tsx +39 -6
- package/src/components/dropdown-menu.tsx +7 -1
- package/src/components/field.tsx +6 -0
- package/src/components/global-layout.tsx +3 -1
- package/src/components/link.tsx +103 -27
- package/src/components/logo.tsx +19 -25
- package/src/components/map.tsx +1 -2
- package/src/components/progress.tsx +12 -6
- package/src/components/sheet.tsx +30 -5
- package/src/components/stepper.tsx +93 -80
- package/src/hooks/use-prefers-reduced-motion.ts +35 -5
package/src/components/link.tsx
CHANGED
|
@@ -5,38 +5,108 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
5
5
|
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
8
|
+
// Shared base for the button-styled variants (filled, outline, ghost).
|
|
9
|
+
// Mirrors the Button component's `size="default"` look so the treatments stay
|
|
10
|
+
// visually identical across both components.
|
|
11
|
+
const buttonStyledBase = [
|
|
12
|
+
"justify-center",
|
|
13
|
+
"h-9",
|
|
14
|
+
"px-4",
|
|
15
|
+
"py-2",
|
|
16
|
+
"rounded-full",
|
|
17
|
+
"text-sm",
|
|
18
|
+
"font-semibold",
|
|
16
19
|
"no-underline",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"duration-300",
|
|
25
|
-
"cursor-pointer",
|
|
26
|
-
// Focus state
|
|
27
|
-
"rounded-sm",
|
|
28
|
-
"outline-none",
|
|
20
|
+
"whitespace-nowrap",
|
|
21
|
+
"shrink-0",
|
|
22
|
+
"[&_svg]:pointer-events-none",
|
|
23
|
+
"[&_svg]:shrink-0",
|
|
24
|
+
"transition-[color,background-color,border-color,box-shadow]",
|
|
25
|
+
"duration-150",
|
|
26
|
+
"ease-in-out",
|
|
29
27
|
"focus-visible:shadow-default",
|
|
30
|
-
]
|
|
28
|
+
];
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const linkVariants = cva(
|
|
31
|
+
// `gap-2` (spacing/2) keeps the icon–text gap consistent across all variants.
|
|
32
|
+
["inline-flex", "items-center", "gap-2", "cursor-pointer", "outline-none"],
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
variant: {
|
|
36
|
+
// Inline text link (default) — the original Link styling.
|
|
37
|
+
inline: [
|
|
38
|
+
"rounded-sm",
|
|
39
|
+
// Color tokens (light mode: #2563EB, dark mode: #3B82F6)
|
|
40
|
+
"text-link",
|
|
41
|
+
"dark:text-link-dark",
|
|
42
|
+
// States
|
|
43
|
+
"no-underline",
|
|
44
|
+
"hover:underline",
|
|
45
|
+
"hover:underline-offset-4",
|
|
46
|
+
"active:text-link/80",
|
|
47
|
+
"visited:text-link-visited",
|
|
48
|
+
"visited:dark:text-link-visited-dark",
|
|
49
|
+
// Transitions
|
|
50
|
+
"transition-[text-decoration,text-decoration-color,text-underline-offset,color]",
|
|
51
|
+
"duration-300",
|
|
52
|
+
// Focus state
|
|
53
|
+
"focus-visible:shadow-default",
|
|
54
|
+
],
|
|
55
|
+
// Button-styled, filled (maps to Button `secondary`).
|
|
56
|
+
filled: [
|
|
57
|
+
...buttonStyledBase,
|
|
58
|
+
"bg-secondary",
|
|
59
|
+
"text-secondary-foreground",
|
|
60
|
+
"hover:bg-secondary/80",
|
|
61
|
+
],
|
|
62
|
+
// Button-styled, bordered. Uses the `input` border token in both modes
|
|
63
|
+
// and keeps that border on focus (focus is the shared shadow ring only).
|
|
64
|
+
outline: [
|
|
65
|
+
...buttonStyledBase,
|
|
66
|
+
"border",
|
|
67
|
+
"border-input",
|
|
68
|
+
"border-solid",
|
|
69
|
+
"bg-background",
|
|
70
|
+
"text-foreground",
|
|
71
|
+
"hover:bg-accent",
|
|
72
|
+
"hover:text-accent-foreground",
|
|
73
|
+
"dark:bg-input/30",
|
|
74
|
+
"dark:border-input",
|
|
75
|
+
"dark:hover:bg-input/50",
|
|
76
|
+
"dark:hover:border-input",
|
|
77
|
+
],
|
|
78
|
+
// Button-styled, transparent (maps to Button `ghost`).
|
|
79
|
+
ghost: [
|
|
80
|
+
...buttonStyledBase,
|
|
81
|
+
"bg-transparent",
|
|
82
|
+
"text-foreground",
|
|
83
|
+
"hover:bg-accent",
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
variant: "inline",
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
/** Supported visual style variants for the Link component. */
|
|
94
|
+
export type LinkVariant = NonNullable<
|
|
95
|
+
VariantProps<typeof linkVariants>["variant"]
|
|
96
|
+
>;
|
|
97
|
+
|
|
98
|
+
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
36
99
|
/**
|
|
37
100
|
* Data hook for automated testing (REQUIRED)
|
|
38
101
|
*/
|
|
39
102
|
dataHook: string;
|
|
103
|
+
/**
|
|
104
|
+
* Visual style variant. `inline` renders a standard text link; `filled`,
|
|
105
|
+
* `outline` and `ghost` render button-styled treatments for inline actions
|
|
106
|
+
* and high-priority navigation.
|
|
107
|
+
* @default "inline"
|
|
108
|
+
*/
|
|
109
|
+
variant?: LinkVariant;
|
|
40
110
|
/**
|
|
41
111
|
* Tracking element identifier for analytics
|
|
42
112
|
*/
|
|
@@ -65,6 +135,7 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
65
135
|
(
|
|
66
136
|
{
|
|
67
137
|
className,
|
|
138
|
+
variant = "inline",
|
|
68
139
|
dataHook,
|
|
69
140
|
trackingEl,
|
|
70
141
|
trackingLabel,
|
|
@@ -80,12 +151,17 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
80
151
|
? { target: "_blank", rel: "noopener noreferrer" }
|
|
81
152
|
: {};
|
|
82
153
|
|
|
154
|
+
// Preserve the historical "link-default" tracking id for the inline
|
|
155
|
+
// variant (backwards compatible); button-styled variants get a distinct id.
|
|
156
|
+
const defaultTrackingEl =
|
|
157
|
+
variant === "inline" ? "link-default" : `link-${variant}`;
|
|
158
|
+
|
|
83
159
|
const sharedProps = {
|
|
84
160
|
ref,
|
|
85
|
-
className: cn(linkVariants(), className),
|
|
161
|
+
className: cn(linkVariants({ variant }), className),
|
|
86
162
|
"data-hook": dataHook,
|
|
87
163
|
"data-slot": "link" as const,
|
|
88
|
-
"data-tracking-el": trackingEl ||
|
|
164
|
+
"data-tracking-el": trackingEl || defaultTrackingEl,
|
|
89
165
|
"data-tracking-label": trackingLabel,
|
|
90
166
|
...externalProps,
|
|
91
167
|
...props,
|
package/src/components/logo.tsx
CHANGED
|
@@ -68,21 +68,16 @@ function Logo({
|
|
|
68
68
|
fill="none"
|
|
69
69
|
height="24"
|
|
70
70
|
role="img"
|
|
71
|
-
viewBox="0 0 128 24
|
|
71
|
+
viewBox="0 0 128 24"
|
|
72
72
|
width="128"
|
|
73
73
|
xmlns="http://www.w3.org/2000/svg"
|
|
74
74
|
>
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<defs>
|
|
82
|
-
<clipPath id="clip0_18315_468855">
|
|
83
|
-
<rect fill="white" height="24.1509" width="128" />
|
|
84
|
-
</clipPath>
|
|
85
|
-
</defs>
|
|
75
|
+
<path
|
|
76
|
+
clipRule="evenodd"
|
|
77
|
+
d="M45.283 4.22403C46.4897 4.22403 47.4227 3.29104 47.4227 2.1397C47.4227 0.988358 46.4907 0 45.283 0C44.186 0 43.1986 0.987313 43.1986 2.1397C43.1986 3.29209 44.1316 4.22403 45.283 4.22403ZM43.5821 6.19866V17.8824H47.0382V6.19866H43.5821ZM25.3163 7.62478C26.1939 6.52776 27.4006 5.97925 28.8821 5.97925C30.5276 5.97925 31.844 6.58209 32.8867 7.84418C33.9294 9.0509 34.4225 10.477 34.4225 12.0682C34.4225 13.6594 33.874 15.0855 32.8313 16.2922C31.7343 17.499 30.4179 18.1572 28.7724 18.1572C27.2366 18.1572 26.0298 17.6087 25.2066 16.5116H25.1512V17.9378H21.8048V0.357313H25.2055V7.62478H25.3163ZM26.0842 14.2069C26.6327 14.7554 27.3463 15.0302 28.1685 15.0302C28.9907 15.0302 29.7043 14.7554 30.2528 14.2069C30.8013 13.6584 31.0761 12.8904 31.0761 12.0128C31.0761 11.1352 30.8013 10.4216 30.1985 9.87314C29.65 9.32463 28.9364 9.04985 28.1142 9.04985C27.2919 9.04985 26.6327 9.32463 26.0842 9.87314C25.5357 10.4216 25.2619 11.1352 25.2619 12.0128C25.2066 12.8904 25.5357 13.604 26.0842 14.2069ZM42.6501 9.54508C42.6313 9.5409 42.6136 9.53776 42.5958 9.53463V6.19866C42.4307 6.08896 42.2113 6.08896 41.9376 6.08896C40.4018 6.08896 39.1397 6.91224 38.6466 8.00926V6.19866H35.2458V17.8824H38.6466V12.9458C38.6466 10.8615 39.6339 9.4897 41.8279 9.4897C42.0839 9.4897 42.3398 9.4897 42.5958 9.53463V9.54508H42.6501ZM51.0418 18.8143C51.7 20.1307 52.7427 20.789 54.1688 20.789C55.924 20.789 57.1307 19.856 57.1307 18.0464V16.2912H57.0754C56.2521 17.3328 55.1551 17.827 53.7289 17.827C52.0834 17.827 50.7116 17.2785 49.67 16.1261C48.6273 15.0291 48.0788 13.603 48.0788 11.9575C48.0788 10.4216 48.573 8.99552 49.6146 7.84313C50.6573 6.63642 51.9737 6.03254 53.6192 6.03254C55.1007 6.03254 56.2521 6.58105 57.1851 7.62373H57.2404V6.19761H60.5869V17.9357C60.5869 19.7463 59.984 21.1724 58.8316 22.214C57.6803 23.2567 56.1434 23.7499 54.2785 23.7499C51.3709 23.7499 49.3963 22.6528 48.3546 20.4034L51.0428 18.8122V18.8143H51.0418ZM54.3328 9.0509C52.7416 9.0509 51.4806 10.2576 51.4806 11.9031C51.4806 13.6584 52.6873 14.8107 54.3328 14.8107C55.9784 14.8107 57.1851 13.6594 57.1851 11.9031C57.1851 10.2576 55.9784 9.0509 54.3328 9.0509ZM69.3076 11.41V17.9378H72.654V10.6421C72.654 9.32567 72.2706 8.22866 71.557 7.35105C70.8434 6.41806 69.8018 5.97925 68.3757 5.97925C67.9369 5.97925 67.3884 6.08896 66.7301 6.30836C66.1273 6.52776 65.6331 6.96657 65.1943 7.57045V0.357313H61.7936V17.8824H65.1943V11.3546C65.1943 10.0925 65.9079 9.10522 67.2786 9.10522C68.6494 9.10522 69.3086 10.0925 69.3086 11.409L69.3076 11.41ZM81.5952 17.827C81.1021 17.991 80.5536 18.0464 80.004 18.0464C76.9324 18.0464 75.3422 16.4009 75.3422 13.6584V9.1606H73.2579V6.19866H75.3976V2.52313H78.7983V6.19866H81.706V9.1606H78.7983V13.2196C78.7983 14.536 79.5119 15.0845 80.8284 15.0845C81.1031 15.0845 81.3769 15.0845 81.5963 14.9748V17.827H81.5952ZM82.8009 17.8824H86.257V0.357313H82.8009V17.8824ZM89.1092 7.73448C90.3713 6.52776 91.9061 5.97925 93.6613 5.97925C95.4166 5.97925 96.9524 6.58314 98.1591 7.73448C99.3658 8.88582 100.024 10.313 100.024 12.0682C100.024 13.8234 99.4212 15.3049 98.1591 16.4563C96.8981 17.6076 95.4166 18.2115 93.607 18.2115C91.7975 18.2115 90.316 17.663 89.0539 16.4563C87.8472 15.3039 87.1889 13.8778 87.1889 12.1225C87.2433 10.3673 87.8472 8.88582 89.1082 7.73448H89.1092ZM91.5781 14.2069C92.1266 14.7554 92.8401 15.0302 93.6624 15.0302C95.3079 15.0302 96.5146 13.7681 96.5146 12.0128C96.5146 11.1352 96.2399 10.4216 95.6913 9.87314C95.1428 9.32463 94.4303 8.99552 93.607 8.99552C92.7837 8.99552 92.1266 9.2703 91.577 9.87314C91.0285 10.4216 90.7537 11.1352 90.7537 12.0128C90.6994 12.8904 91.0285 13.604 91.577 14.2069H91.5781ZM100.519 12.1225C100.519 13.8778 101.068 15.3039 102.274 16.4563C103.481 17.6076 104.962 18.1572 106.772 18.2115C109.405 18.2115 111.545 16.9494 112.422 14.5913L109.405 13.3293C108.912 14.536 108.033 15.0845 106.827 15.0845C105.181 15.0845 104.03 13.8778 104.03 12.1225C104.03 10.3673 105.236 9.1606 106.827 9.1606C107.979 9.1606 108.857 9.76448 109.35 10.9158L112.366 9.65373C111.598 7.35 109.458 6.03358 106.827 6.03358C105.126 6.03358 103.591 6.58209 102.383 7.78881C101.122 8.9412 100.518 10.3673 100.518 12.1225H100.519ZM113.957 17.1688C113.189 16.5106 112.805 15.6873 112.805 14.6457V14.5903C112.805 13.2185 113.463 12.1769 114.561 11.6827C115.658 11.1885 116.755 10.9691 118.016 10.9691H119.169C119.772 10.9691 120.101 10.6943 120.101 10.0915C120.101 9.26821 119.443 8.66537 118.237 8.66537C117.03 8.66537 116.207 9.21388 115.658 10.2566L113.025 8.72075C114.013 6.85582 115.822 5.92284 118.401 5.92284C121.472 5.92284 123.501 7.56836 123.501 10.64V17.8803H120.32V16.4542H120.266C119.498 17.5512 118.291 18.1551 116.755 18.1551C115.658 18.0997 114.725 17.826 113.957 17.1678V17.1688ZM120.101 13.3846V13.1099H118.017C117.03 13.1099 116.262 13.5487 116.262 14.4263C116.262 15.1942 116.865 15.633 117.743 15.633C119.224 15.633 120.101 14.6457 120.101 13.3836V13.3846ZM124.544 17.8824H128V0.357313H124.544V17.8824ZM4.85535 6.85582C5.51356 6.85582 6.04953 7.39179 6.04953 8.05C6.04953 8.70821 5.51356 9.24418 4.85535 9.24418C4.19714 9.24418 3.66118 8.70821 3.66118 8.05C3.66118 7.39179 4.19714 6.85582 4.85535 6.85582ZM4.85535 5.80269C3.61311 5.80269 2.60699 6.80881 2.60699 8.05105C2.60699 9.29328 3.61311 10.2994 4.85535 10.2994C6.09759 10.2994 7.10371 9.29328 7.10371 8.05105C7.10371 6.80881 6.09759 5.80269 4.85535 5.80269ZM14.7943 3.65358C12.5982 2.62761 10.1064 3.37776 8.78685 5.21134C7.87267 3.94403 6.40476 3.1897 4.85431 3.1897C4.18565 3.1897 3.50446 3.32866 2.84729 3.62433C0.781771 4.55627 -0.378975 6.88299 0.112069 9.09582C0.324159 10.0528 0.798487 10.8563 1.4264 11.4831L8.20804 18.2763C8.52983 18.5981 9.05222 18.5981 9.37506 18.2763L16.1567 11.4831C16.8609 10.781 17.3707 9.85537 17.5368 8.74164C17.8471 6.65 16.7115 4.54687 14.7964 3.65254L14.7943 3.65358ZM2.17237 10.734C1.77326 10.336 1.47446 9.87 1.28431 9.34866C0.937444 8.39582 0.982368 7.36358 1.41073 6.44314C1.83908 5.52373 2.60073 4.82687 3.55461 4.47896C3.97461 4.32642 4.41237 4.2491 4.85431 4.2491C6.27521 4.2491 7.60729 5.07761 8.24774 6.35955L8.26759 6.39925L8.25192 6.44105C8.01894 7.08881 7.93222 7.77 7.99282 8.46582L8.76177 17.3349L2.17132 10.734H2.17237ZM14.4454 8.05C14.4454 9.00075 13.6754 9.77075 12.7246 9.77075C11.7739 9.77075 11.0039 9.00075 11.0039 8.05C11.0039 7.09926 11.7739 6.32926 12.7246 6.32926C13.6754 6.32926 14.4454 7.09926 14.4454 8.05Z"
|
|
78
|
+
fill="currentColor"
|
|
79
|
+
fillRule="evenodd"
|
|
80
|
+
/>
|
|
86
81
|
</svg>
|
|
87
82
|
)}
|
|
88
83
|
{variant === "mark" && (
|
|
@@ -91,21 +86,20 @@ function Logo({
|
|
|
91
86
|
fill="none"
|
|
92
87
|
height="21"
|
|
93
88
|
role="img"
|
|
94
|
-
viewBox="0 0
|
|
95
|
-
width="
|
|
89
|
+
viewBox="0 0 24 21"
|
|
90
|
+
width="24"
|
|
96
91
|
xmlns="http://www.w3.org/2000/svg"
|
|
97
92
|
>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</defs>
|
|
93
|
+
<path
|
|
94
|
+
d="M6.62559 5.00277C7.52378 5.00277 8.25516 5.73415 8.25516 6.63234C8.25516 7.53053 7.52378 8.26191 6.62559 8.26191C5.7274 8.26191 4.99602 7.53053 4.99602 6.63234C4.99602 5.73415 5.7274 5.00277 6.62559 5.00277ZM6.62559 3.56424C4.93044 3.56424 3.5575 4.93719 3.5575 6.63234C3.5575 8.32749 4.93044 9.70043 6.62559 9.70043C8.32074 9.70043 9.69369 8.32749 9.69369 6.63234C9.69369 4.93719 8.32074 3.56424 6.62559 3.56424Z"
|
|
95
|
+
fill="currentColor"
|
|
96
|
+
/>
|
|
97
|
+
<path
|
|
98
|
+
clipRule="evenodd"
|
|
99
|
+
d="M20.1882 0.633009C17.1914 -0.767024 13.7911 0.256626 11.9905 2.75872C10.743 1.02935 8.73989 0 6.62416 0C5.71172 0 4.78216 0.189618 3.8854 0.593089C1.0668 1.86481 -0.517148 5.03983 0.152929 8.05946C0.442345 9.36539 1.08961 10.4618 1.94645 11.3172L11.2006 20.587C11.6398 21.0262 12.3526 21.0262 12.7931 20.587L22.0473 11.3172C23.0083 10.3591 23.704 9.09594 23.9307 7.57615C24.3541 4.7219 22.8044 1.85198 20.1911 0.631583L20.1882 0.633009ZM2.96583 10.2949C2.42121 9.75176 2.01346 9.1159 1.75399 8.40448C1.28065 7.10424 1.34196 5.69565 1.92649 4.43962C2.51103 3.185 3.55036 2.23407 4.85202 1.75931C5.42515 1.55116 6.02252 1.44566 6.62559 1.44566C8.56453 1.44566 10.3823 2.57623 11.2562 4.32556L11.2833 4.37974L11.262 4.43677C10.944 5.3207 10.8257 6.25025 10.9084 7.19976L11.9577 19.3025L2.9644 10.2949H2.96583ZM19.712 6.63091C19.712 7.92829 18.6613 8.97903 17.3639 8.97903C16.0665 8.97903 15.0158 7.92829 15.0158 6.63091C15.0158 5.33353 16.0665 4.28279 17.3639 4.28279C18.6613 4.28279 19.712 5.33353 19.712 6.63091Z"
|
|
100
|
+
fill="currentColor"
|
|
101
|
+
fillRule="evenodd"
|
|
102
|
+
/>
|
|
109
103
|
</svg>
|
|
110
104
|
)}
|
|
111
105
|
</div>
|
package/src/components/map.tsx
CHANGED
|
@@ -825,8 +825,7 @@ const MapLocationPin = React.forwardRef<HTMLDivElement, MapLocationPinProps>(
|
|
|
825
825
|
aria-hidden="true"
|
|
826
826
|
className={cn(
|
|
827
827
|
"relative flex size-full",
|
|
828
|
-
animateIn &&
|
|
829
|
-
"animate-pop-in origin-bottom will-change-transform motion-reduce:animate-none"
|
|
828
|
+
animateIn && "animate-pop-in origin-bottom will-change-transform"
|
|
830
829
|
)}
|
|
831
830
|
>
|
|
832
831
|
<svg
|
|
@@ -5,6 +5,7 @@ import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
|
5
5
|
import { motion } from "framer-motion";
|
|
6
6
|
|
|
7
7
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
8
|
+
import { usePrefersReducedMotion } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Props for the Progress component.
|
|
@@ -70,6 +71,7 @@ const Progress = React.forwardRef<
|
|
|
70
71
|
) => {
|
|
71
72
|
const labelId = React.useId();
|
|
72
73
|
const hasVisibleLabel = !!label;
|
|
74
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
73
75
|
|
|
74
76
|
const progressBar = (
|
|
75
77
|
<ProgressPrimitive.Root
|
|
@@ -99,12 +101,16 @@ const Progress = React.forwardRef<
|
|
|
99
101
|
)}
|
|
100
102
|
data-slot="progress-indicator"
|
|
101
103
|
initial={false}
|
|
102
|
-
transition={
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
transition={
|
|
105
|
+
prefersReducedMotion
|
|
106
|
+
? { duration: 0 }
|
|
107
|
+
: {
|
|
108
|
+
type: "spring",
|
|
109
|
+
stiffness: 80,
|
|
110
|
+
damping: 20,
|
|
111
|
+
mass: 1,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
108
114
|
/>
|
|
109
115
|
</ProgressPrimitive.Indicator>
|
|
110
116
|
</ProgressPrimitive.Root>
|
package/src/components/sheet.tsx
CHANGED
|
@@ -111,8 +111,8 @@ const SheetTrigger = React.forwardRef<
|
|
|
111
111
|
>(({ dataHook, ...props }, ref) => (
|
|
112
112
|
<SheetPrimitive.Trigger
|
|
113
113
|
ref={ref}
|
|
114
|
-
data-hook={dataHook}
|
|
115
114
|
data-slot="sheet-trigger"
|
|
115
|
+
{...(dataHook != null && { "data-hook": dataHook })}
|
|
116
116
|
{...props}
|
|
117
117
|
/>
|
|
118
118
|
));
|
|
@@ -280,6 +280,11 @@ SheetFooter.displayName = "SheetFooter";
|
|
|
280
280
|
interface SheetTitleProps extends React.ComponentProps<
|
|
281
281
|
typeof SheetPrimitive.Title
|
|
282
282
|
> {
|
|
283
|
+
/**
|
|
284
|
+
* Data hook for automated testing
|
|
285
|
+
* @example "sheet-title"
|
|
286
|
+
*/
|
|
287
|
+
dataHook?: string;
|
|
283
288
|
/**
|
|
284
289
|
* Optional icon rendered before the title text.
|
|
285
290
|
* Pass any React node (typically a DS icon component).
|
|
@@ -295,7 +300,7 @@ interface SheetTitleProps extends React.ComponentProps<
|
|
|
295
300
|
const SheetTitle = React.forwardRef<
|
|
296
301
|
React.ComponentRef<typeof SheetPrimitive.Title>,
|
|
297
302
|
SheetTitleProps
|
|
298
|
-
>(({ className, icon, children, ...props }, ref) => (
|
|
303
|
+
>(({ className, icon, children, dataHook, ...props }, ref) => (
|
|
299
304
|
<SheetPrimitive.Title
|
|
300
305
|
ref={ref}
|
|
301
306
|
className={cn(
|
|
@@ -303,6 +308,7 @@ const SheetTitle = React.forwardRef<
|
|
|
303
308
|
icon && "flex items-center gap-2",
|
|
304
309
|
className
|
|
305
310
|
)}
|
|
311
|
+
data-hook={dataHook}
|
|
306
312
|
data-slot="sheet-title"
|
|
307
313
|
{...props}
|
|
308
314
|
>
|
|
@@ -316,17 +322,31 @@ const SheetTitle = React.forwardRef<
|
|
|
316
322
|
));
|
|
317
323
|
SheetTitle.displayName = "SheetTitle";
|
|
318
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Props for the SheetDescription component
|
|
327
|
+
*/
|
|
328
|
+
interface SheetDescriptionProps extends React.ComponentProps<
|
|
329
|
+
typeof SheetPrimitive.Description
|
|
330
|
+
> {
|
|
331
|
+
/**
|
|
332
|
+
* Data hook for automated testing
|
|
333
|
+
* @example "sheet-description"
|
|
334
|
+
*/
|
|
335
|
+
dataHook?: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
319
338
|
/**
|
|
320
339
|
* Sheet description component for additional context.
|
|
321
340
|
* Should be used within SheetHeader below SheetTitle.
|
|
322
341
|
*/
|
|
323
342
|
const SheetDescription = React.forwardRef<
|
|
324
343
|
React.ComponentRef<typeof SheetPrimitive.Description>,
|
|
325
|
-
|
|
326
|
-
>(({ className, ...props }, ref) => (
|
|
344
|
+
SheetDescriptionProps
|
|
345
|
+
>(({ className, dataHook, ...props }, ref) => (
|
|
327
346
|
<SheetPrimitive.Description
|
|
328
347
|
ref={ref}
|
|
329
348
|
className={cn("text-muted-foreground text-sm", className)}
|
|
349
|
+
data-hook={dataHook}
|
|
330
350
|
data-slot="sheet-description"
|
|
331
351
|
{...props}
|
|
332
352
|
/>
|
|
@@ -346,4 +366,9 @@ export {
|
|
|
346
366
|
SheetTrigger,
|
|
347
367
|
};
|
|
348
368
|
|
|
349
|
-
export type {
|
|
369
|
+
export type {
|
|
370
|
+
SheetContentProps,
|
|
371
|
+
SheetDescriptionProps,
|
|
372
|
+
SheetTitleProps,
|
|
373
|
+
SheetTriggerProps,
|
|
374
|
+
};
|
|
@@ -28,10 +28,12 @@ type StepperItemState = "active" | "completed" | "inactive" | "error";
|
|
|
28
28
|
/**
|
|
29
29
|
* A single step descriptor. Consumers may attach any extra fields they need
|
|
30
30
|
* (e.g. `title`, `href`); only `id` is required for ordering and state.
|
|
31
|
+
* Generic over the step-id type for type-safe `id` values.
|
|
32
|
+
* @typeParam TStepId - The type of step ids, defaults to `string`
|
|
31
33
|
*/
|
|
32
|
-
interface StepperStep {
|
|
34
|
+
interface StepperStep<TStepId extends string = string> {
|
|
33
35
|
/** Stable, unique identifier for the step. */
|
|
34
|
-
id:
|
|
36
|
+
id: TStepId;
|
|
35
37
|
[key: string]: unknown;
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -97,21 +99,24 @@ function useStepperItem(): StepperItemContextValue {
|
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
101
|
* Props for the Stepper root component.
|
|
102
|
+
* Generic over the step-id type for type-safe `value`, `steps[].id` and
|
|
103
|
+
* `onValueChange`.
|
|
104
|
+
* @typeParam TStepId - The type of step ids, defaults to `string`
|
|
100
105
|
*/
|
|
101
|
-
interface StepperProps extends Omit<
|
|
106
|
+
interface StepperProps<TStepId extends string = string> extends Omit<
|
|
102
107
|
React.ComponentPropsWithoutRef<"div">,
|
|
103
108
|
"onChange"
|
|
104
109
|
> {
|
|
105
110
|
/** Data hook for automated testing (required). */
|
|
106
111
|
dataHook: string;
|
|
107
112
|
/** Ordered list of steps. Defines step order, total count and id → index resolution. */
|
|
108
|
-
steps: StepperStep[];
|
|
113
|
+
steps: StepperStep<TStepId>[];
|
|
109
114
|
/** Controlled active step id. */
|
|
110
|
-
value?:
|
|
115
|
+
value?: TStepId;
|
|
111
116
|
/** Active step id for uncontrolled usage. Defaults to the first step. */
|
|
112
|
-
defaultValue?:
|
|
117
|
+
defaultValue?: TStepId;
|
|
113
118
|
/** Called with the new active step id when the active step changes. */
|
|
114
|
-
onValueChange?: (id:
|
|
119
|
+
onValueChange?: (id: TStepId) => void;
|
|
115
120
|
/**
|
|
116
121
|
* Layout orientation.
|
|
117
122
|
* @default "horizontal"
|
|
@@ -138,82 +143,90 @@ interface StepperProps extends Omit<
|
|
|
138
143
|
* Tracks the active step (controlled or uncontrolled) and shares it with its
|
|
139
144
|
* sub-components via context.
|
|
140
145
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
function StepperInner<TStepId extends string = string>(
|
|
147
|
+
{
|
|
148
|
+
className,
|
|
149
|
+
dataHook,
|
|
150
|
+
steps,
|
|
151
|
+
value,
|
|
152
|
+
defaultValue,
|
|
153
|
+
onValueChange,
|
|
154
|
+
orientation = "horizontal",
|
|
155
|
+
labelPlacement = "below",
|
|
156
|
+
ariaLabel,
|
|
157
|
+
trackingEl,
|
|
158
|
+
trackingLabel,
|
|
159
|
+
...props
|
|
160
|
+
}: StepperProps<TStepId>,
|
|
161
|
+
ref: React.ForwardedRef<HTMLDivElement>
|
|
162
|
+
) {
|
|
163
|
+
// Single layout token drives the orientation/placement-specific styles in
|
|
164
|
+
// the sub-components (CSS group-data selectors can't AND two attributes).
|
|
165
|
+
const layout =
|
|
166
|
+
orientation === "vertical"
|
|
167
|
+
? "vertical"
|
|
168
|
+
: labelPlacement === "inline"
|
|
169
|
+
? "horizontal-inline"
|
|
170
|
+
: "horizontal-below";
|
|
171
|
+
const isControlled = value !== undefined;
|
|
172
|
+
const [internalId, setInternalId] = React.useState<string>(
|
|
173
|
+
defaultValue ?? steps[0]?.id ?? ""
|
|
174
|
+
);
|
|
175
|
+
const activeId = isControlled ? value : internalId;
|
|
176
|
+
const activeIndex = steps.findIndex((step) => step.id === activeId);
|
|
177
|
+
|
|
178
|
+
const setActiveStep = React.useCallback(
|
|
179
|
+
(id: string) => {
|
|
180
|
+
if (!isControlled) {
|
|
181
|
+
setInternalId(id);
|
|
182
|
+
}
|
|
183
|
+
onValueChange?.(id as TStepId);
|
|
156
184
|
},
|
|
157
|
-
|
|
158
|
-
)
|
|
159
|
-
// Single layout token drives the orientation/placement-specific styles in
|
|
160
|
-
// the sub-components (CSS group-data selectors can't AND two attributes).
|
|
161
|
-
const layout =
|
|
162
|
-
orientation === "vertical"
|
|
163
|
-
? "vertical"
|
|
164
|
-
: labelPlacement === "inline"
|
|
165
|
-
? "horizontal-inline"
|
|
166
|
-
: "horizontal-below";
|
|
167
|
-
const isControlled = value !== undefined;
|
|
168
|
-
const [internalId, setInternalId] = React.useState(
|
|
169
|
-
defaultValue ?? steps[0]?.id ?? ""
|
|
170
|
-
);
|
|
171
|
-
const activeId = isControlled ? value : internalId;
|
|
172
|
-
const activeIndex = steps.findIndex((step) => step.id === activeId);
|
|
173
|
-
|
|
174
|
-
const setActiveStep = React.useCallback(
|
|
175
|
-
(id: string) => {
|
|
176
|
-
if (!isControlled) {
|
|
177
|
-
setInternalId(id);
|
|
178
|
-
}
|
|
179
|
-
onValueChange?.(id);
|
|
180
|
-
},
|
|
181
|
-
[isControlled, onValueChange]
|
|
182
|
-
);
|
|
185
|
+
[isControlled, onValueChange]
|
|
186
|
+
);
|
|
183
187
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
const contextValue = React.useMemo<StepperContextValue>(
|
|
189
|
+
() => ({
|
|
190
|
+
activeId,
|
|
191
|
+
activeIndex,
|
|
192
|
+
setActiveStep,
|
|
193
|
+
steps,
|
|
194
|
+
orientation,
|
|
195
|
+
}),
|
|
196
|
+
[activeId, activeIndex, setActiveStep, steps, orientation]
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<StepperContext.Provider value={contextValue}>
|
|
201
|
+
<div
|
|
202
|
+
ref={ref}
|
|
203
|
+
aria-label={ariaLabel ?? "Progress"}
|
|
204
|
+
className={cn(
|
|
205
|
+
"group/stepper flex data-[orientation=vertical]:flex-col",
|
|
206
|
+
className
|
|
207
|
+
)}
|
|
208
|
+
data-hook={dataHook}
|
|
209
|
+
data-layout={layout}
|
|
210
|
+
data-orientation={orientation}
|
|
211
|
+
data-slot="stepper"
|
|
212
|
+
data-tracking-el={trackingEl}
|
|
213
|
+
data-tracking-label={trackingLabel}
|
|
214
|
+
role="group"
|
|
215
|
+
{...props}
|
|
216
|
+
/>
|
|
217
|
+
</StepperContext.Provider>
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// forwardRef erases the generic type parameter, so cast the wrapped component
|
|
222
|
+
// back to a generic call signature — this keeps `TStepId` inference at the call
|
|
223
|
+
// site while still forwarding the ref. Mirrors the Tabs component.
|
|
224
|
+
const Stepper = React.forwardRef(StepperInner) as (<
|
|
225
|
+
TStepId extends string = string,
|
|
226
|
+
>(
|
|
227
|
+
props: StepperProps<TStepId> & React.RefAttributes<HTMLDivElement>
|
|
228
|
+
) => React.ReactElement | null) & { displayName?: string };
|
|
194
229
|
|
|
195
|
-
return (
|
|
196
|
-
<StepperContext.Provider value={contextValue}>
|
|
197
|
-
<div
|
|
198
|
-
ref={ref}
|
|
199
|
-
aria-label={ariaLabel ?? "Progress"}
|
|
200
|
-
className={cn(
|
|
201
|
-
"group/stepper flex data-[orientation=vertical]:flex-col",
|
|
202
|
-
className
|
|
203
|
-
)}
|
|
204
|
-
data-hook={dataHook}
|
|
205
|
-
data-layout={layout}
|
|
206
|
-
data-orientation={orientation}
|
|
207
|
-
data-slot="stepper"
|
|
208
|
-
data-tracking-el={trackingEl}
|
|
209
|
-
data-tracking-label={trackingLabel}
|
|
210
|
-
role="group"
|
|
211
|
-
{...props}
|
|
212
|
-
/>
|
|
213
|
-
</StepperContext.Provider>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
230
|
Stepper.displayName = "Stepper";
|
|
218
231
|
|
|
219
232
|
/* -------------------------------------------------------------------------- */
|