@brightlocal/ui-components 2.26.0 → 3.0.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 +9 -2
- package/component-meta.json +4010 -255
- package/deprecations.json +189 -2
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +18 -18
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +11 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -28
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +4 -4
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +15 -11
- package/dist/blocks/empty-state.cjs +1 -0
- package/dist/blocks/empty-state.d.ts +172 -0
- package/dist/blocks/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state.js +155 -0
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +124 -108
- package/dist/blocks/progress-state.cjs +1 -0
- package/dist/blocks/progress-state.d.ts +121 -0
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/progress-state.js +368 -0
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +297 -296
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +44 -40
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +23 -23
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +37 -38
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +24 -2
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +57 -55
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +23 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +94 -91
- package/dist/chart-empty.cjs +1 -0
- package/dist/chart-empty.d.ts +59 -0
- package/dist/chart-empty.d.ts.map +1 -0
- package/dist/chart-empty.js +29 -0
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -1
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +183 -183
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +47 -44
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +4 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +143 -141
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +74 -77
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +26 -29
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +182 -13
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +462 -314
- package/dist/description.cjs +1 -1
- package/dist/description.js +5 -5
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +20 -20
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +8 -11
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +17 -20
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +29 -25
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +58 -6
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +278 -194
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +56 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +32 -0
- package/dist/header.d.ts +13 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/hooks/use-delayed-pending.cjs +1 -0
- package/dist/hooks/use-delayed-pending.d.ts +34 -0
- package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
- package/dist/hooks/use-delayed-pending.js +17 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +523 -494
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +25 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +9 -9
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +51 -51
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +25 -28
- package/dist/lib/block-illustration.cjs +1 -0
- package/dist/lib/block-illustration.d.ts +28 -0
- package/dist/lib/block-illustration.d.ts.map +1 -0
- package/dist/lib/block-illustration.js +21 -0
- package/dist/lib/empty-canvas.cjs +1 -0
- package/dist/lib/empty-canvas.d.ts +27 -0
- package/dist/lib/empty-canvas.d.ts.map +1 -0
- package/dist/lib/empty-canvas.js +62 -0
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.js +10 -8
- package/dist/lib/optical-center.cjs +1 -0
- package/dist/lib/optical-center.d.ts +12 -0
- package/dist/lib/optical-center.d.ts.map +1 -0
- package/dist/lib/optical-center.js +11 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +28 -5
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +8 -6
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +52 -20
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +87 -81
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +60 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +187 -164
- package/dist/media-empty.cjs +1 -0
- package/dist/media-empty.d.ts +72 -0
- package/dist/media-empty.d.ts.map +1 -0
- package/dist/media-empty.js +45 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +17 -20
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +7 -7
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +127 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +189 -98
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +37 -3
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +102 -64
- package/dist/route-progress.cjs +1 -0
- package/dist/route-progress.d.ts +103 -0
- package/dist/route-progress.d.ts.map +1 -0
- package/dist/route-progress.js +106 -0
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +19 -18
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +35 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +103 -66
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +38 -3
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +43 -20
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +32 -36
- package/dist/spinner.cjs +1 -0
- package/dist/spinner.d.ts +57 -0
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +35 -0
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.d.ts.map +1 -1
- package/dist/stepper.js +23 -22
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +36 -29
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.d.ts +10 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +8 -8
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +8 -8
- package/dist/typography-heading.cjs +1 -0
- package/dist/typography-heading.d.ts +116 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +84 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +113 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +81 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +42 -2
- package/src/blocks/empty-state.tsx +424 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/progress-state.tsx +542 -0
- package/src/blocks/sidebar.tsx +46 -40
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +27 -13
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +8 -4
- package/src/components/breadcrumb.tsx +9 -4
- package/src/components/button.tsx +5 -8
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +52 -17
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +43 -17
- package/src/components/chip.tsx +9 -6
- package/src/components/combobox.tsx +21 -12
- package/src/components/command.tsx +9 -10
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +405 -31
- package/src/components/description.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/drawer.tsx +2 -5
- package/src/components/dropdown-menu.tsx +8 -11
- package/src/components/field.tsx +8 -4
- package/src/components/global-layout.tsx +264 -65
- package/src/components/grid.tsx +130 -0
- package/src/components/header.tsx +13 -0
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/link.tsx +39 -5
- package/src/components/list.tsx +18 -14
- package/src/components/map.tsx +101 -5
- package/src/components/media-empty.tsx +156 -0
- package/src/components/menubar.tsx +7 -10
- package/src/components/navigation-menu.tsx +1 -1
- package/src/components/pagination.tsx +279 -1
- package/src/components/progress.tsx +120 -11
- package/src/components/route-progress.tsx +354 -0
- package/src/components/select.tsx +5 -4
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +89 -7
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +5 -14
- package/src/components/spinner.tsx +94 -0
- package/src/components/stepper.tsx +6 -7
- package/src/components/table.tsx +11 -4
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +10 -0
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/components/tooltip.tsx +1 -1
- package/src/components/typography-heading.tsx +229 -0
- package/src/components/typography-text.tsx +225 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +12 -0
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
+
import { OpticalCenter } from "../lib/optical-center";
|
|
5
|
+
|
|
6
|
+
/* -------------------------------------------------------------------------------------------------
|
|
7
|
+
* Grid
|
|
8
|
+
*
|
|
9
|
+
* The layout primitive (DS-970): one component, one closed `variant` axis, and
|
|
10
|
+
* the modifiers each layout actually has — a discriminated union, so a prop
|
|
11
|
+
* that does not belong to a variant does not compile. The point is a learnable
|
|
12
|
+
* vocabulary: squads compose named layouts instead of hand-rolling flex/grid
|
|
13
|
+
* classNames, and the numbers those layouts agree on live here once.
|
|
14
|
+
*
|
|
15
|
+
* Variants ship as the family lands (see DS-970 for the inventory that sizes
|
|
16
|
+
* them):
|
|
17
|
+
*
|
|
18
|
+
* centered — one message held at the page body's OPTICAL centre.
|
|
19
|
+
* Shipped first because the single-message screens
|
|
20
|
+
* (`EmptyState size="lg"`, `ProgressState`) already share
|
|
21
|
+
* this agreement.
|
|
22
|
+
* stack / row / cards
|
|
23
|
+
* — vertical rhythm, inline cluster, responsive collections.
|
|
24
|
+
* Reserved: their closed props (gap scale, align, justify,
|
|
25
|
+
* cols) arrive with DS-970.
|
|
26
|
+
*
|
|
27
|
+
* `variant="centered"` is optical, not geometric: the content sits 38% down, not
|
|
28
|
+
* 50% (the derivation lives with the ratio in `lib/optical-center`). The ratio
|
|
29
|
+
* is the variant's only opinion and is deliberately not a prop. Not
|
|
30
|
+
* `CentredLayout`: that one owns the whole VIEWPORT (min-h-screen, background,
|
|
31
|
+
* padding) for pages outside the app shell — auth, invites. Grid owns nothing
|
|
32
|
+
* but the position inside whatever box it is given.
|
|
33
|
+
*
|
|
34
|
+
* The single-message blocks are deliberately NOT wired to this internally:
|
|
35
|
+
* `EmptyState size="lg"` is a pure visual block, and the page recipe is the
|
|
36
|
+
* composition `<Grid variant="centered"><EmptyState size="lg" /></Grid>` — so
|
|
37
|
+
* the same block can also sit in a custom position when a product needs one,
|
|
38
|
+
* without a prop to switch the layout off.
|
|
39
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The named layouts. Closed on purpose — a layout the vocabulary lacks is a
|
|
43
|
+
* signal to add a value here, not a className at the call site.
|
|
44
|
+
* (`stack`, `row`, `cards` are reserved for DS-970.)
|
|
45
|
+
*/
|
|
46
|
+
type GridVariant = "centered";
|
|
47
|
+
|
|
48
|
+
interface GridBaseProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
49
|
+
/**
|
|
50
|
+
* Required data-hook attribute for automated testing.
|
|
51
|
+
* @example "locations-empty-center"
|
|
52
|
+
*/
|
|
53
|
+
dataHook: string;
|
|
54
|
+
/**
|
|
55
|
+
* Tracking element identifier for analytics.
|
|
56
|
+
*/
|
|
57
|
+
trackingEl?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Tracking label for analytics context.
|
|
60
|
+
*/
|
|
61
|
+
trackingLabel?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* One message at the page body's optical centre (38/62). Give it a page body
|
|
66
|
+
* to fill — it stretches with `flex-1` — and one message to hold.
|
|
67
|
+
*/
|
|
68
|
+
interface GridCenteredProps extends GridBaseProps {
|
|
69
|
+
variant: "centered";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Props for the Grid primitive. `variant` discriminates the shapes; each
|
|
74
|
+
* variant carries only the modifiers it actually has.
|
|
75
|
+
*/
|
|
76
|
+
export type GridProps = GridCenteredProps;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The layout primitive: a closed vocabulary of named layouts instead of
|
|
80
|
+
* hand-rolled flex/grid classNames.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* <GlobalLayoutContentBody dataHook="locations-body">
|
|
85
|
+
* <Grid dataHook="locations-empty-center" variant="centered">
|
|
86
|
+
* <EmptyState
|
|
87
|
+
* dataHook="locations-empty"
|
|
88
|
+
* illustration={<BusinessLocation aria-hidden />}
|
|
89
|
+
* size="lg"
|
|
90
|
+
* title={t("locations.empty.title")}
|
|
91
|
+
* />
|
|
92
|
+
* </Grid>
|
|
93
|
+
* </GlobalLayoutContentBody>
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
const Grid = React.forwardRef<HTMLDivElement, GridProps>(
|
|
97
|
+
(
|
|
98
|
+
{
|
|
99
|
+
className,
|
|
100
|
+
children,
|
|
101
|
+
dataHook,
|
|
102
|
+
variant,
|
|
103
|
+
trackingEl,
|
|
104
|
+
trackingLabel,
|
|
105
|
+
...props
|
|
106
|
+
},
|
|
107
|
+
ref
|
|
108
|
+
) => {
|
|
109
|
+
return (
|
|
110
|
+
<div
|
|
111
|
+
ref={ref}
|
|
112
|
+
className={cn("flex w-full flex-1 flex-col items-center", className)}
|
|
113
|
+
data-hook={dataHook}
|
|
114
|
+
data-slot="grid"
|
|
115
|
+
data-tracking-el={trackingEl ?? "grid"}
|
|
116
|
+
data-tracking-label={trackingLabel}
|
|
117
|
+
data-variant={variant}
|
|
118
|
+
{...props}
|
|
119
|
+
>
|
|
120
|
+
<OpticalCenter>{children}</OpticalCenter>
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
Grid.displayName = "Grid";
|
|
127
|
+
|
|
128
|
+
export { Grid };
|
|
129
|
+
|
|
130
|
+
export type { GridVariant };
|
|
@@ -35,6 +35,19 @@ const headerVariants = cva("flex w-full items-center", {
|
|
|
35
35
|
* <Logo dataHook="header-logo" />
|
|
36
36
|
* <NavigationMenu dataHook="header-nav" />
|
|
37
37
|
* </Header>
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // With the page title. The title is a TypographyHeading on the semantic
|
|
41
|
+
* // type scale (DS-714): text-heading-page — Poppins · Figma 600 · 24/32,
|
|
42
|
+
* // rendering one CSS weight lighter per the DS-305 offset. Never
|
|
43
|
+
* // hand-style it. `variant="page"` is level 1's default, written out so
|
|
44
|
+
* // the scale role is explicit. Exactly one page title per screen — a
|
|
45
|
+
* // second title is a section (`variant="section"`).
|
|
46
|
+
* <Header dataHook="page-header">
|
|
47
|
+
* <TypographyHeading level={1} variant="page" dataHook="page-title">
|
|
48
|
+
* All Locations
|
|
49
|
+
* </TypographyHeading>
|
|
50
|
+
* </Header>
|
|
38
51
|
*/
|
|
39
52
|
|
|
40
53
|
interface HeaderProps extends React.ComponentProps<"header"> {
|
|
@@ -89,7 +89,7 @@ const HoverCardTrigger = React.forwardRef<
|
|
|
89
89
|
ref={ref}
|
|
90
90
|
aria-disabled={disabled}
|
|
91
91
|
className={cn(
|
|
92
|
-
"text-link
|
|
92
|
+
"text-link text-label cursor-pointer underline",
|
|
93
93
|
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
94
94
|
className
|
|
95
95
|
)}
|
|
@@ -137,7 +137,7 @@ InputGroupAddon.displayName = "InputGroupAddon";
|
|
|
137
137
|
const inputGroupButtonVariants = cva(
|
|
138
138
|
[
|
|
139
139
|
"inline-flex items-center justify-center gap-2",
|
|
140
|
-
"text-
|
|
140
|
+
"text-label transition-colors duration-fast ease-out",
|
|
141
141
|
"outline-none focus-visible:shadow-default rounded-sm",
|
|
142
142
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
143
143
|
"text-muted-foreground hover:text-foreground",
|
|
@@ -137,7 +137,7 @@ function InputOTPSlot({ index, className, ...props }: InputOTPSlotProps) {
|
|
|
137
137
|
// Base styles
|
|
138
138
|
"relative flex h-9 w-9 items-center justify-center",
|
|
139
139
|
"border-input bg-background border-y border-r",
|
|
140
|
-
"text-foreground duration-fast text-
|
|
140
|
+
"text-foreground duration-fast text-body transition-[border-color,box-shadow] ease-out outline-none",
|
|
141
141
|
"first:rounded-l-md first:border-l last:rounded-r-md",
|
|
142
142
|
// Focus state
|
|
143
143
|
"data-[active=true]:border-ring data-[active=true]:z-10",
|
|
@@ -528,7 +528,7 @@ function InputPasswordStrength({
|
|
|
528
528
|
/>
|
|
529
529
|
{showLabel && (
|
|
530
530
|
<span
|
|
531
|
-
className="text-foreground w-10 shrink-0 text-right
|
|
531
|
+
className="text-foreground text-label w-10 shrink-0 text-right whitespace-nowrap"
|
|
532
532
|
data-hook={`${dataHook}-strength-label`}
|
|
533
533
|
>
|
|
534
534
|
{config.label}
|
package/src/components/input.tsx
CHANGED
|
@@ -16,7 +16,7 @@ export const inputVariants = cva(
|
|
|
16
16
|
"border border-input bg-background rounded-sm",
|
|
17
17
|
"outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
|
|
18
18
|
// Typography
|
|
19
|
-
"text-
|
|
19
|
+
"text-body",
|
|
20
20
|
"text-foreground",
|
|
21
21
|
"overflow-hidden text-ellipsis",
|
|
22
22
|
// States - Focus
|
package/src/components/label.tsx
CHANGED
|
@@ -5,20 +5,17 @@ import * as LabelPrimitive from "@radix-ui/react-label";
|
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
|
|
8
|
-
const labelVariants = cva(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
optional: {
|
|
13
|
-
true: "after:ml-1 after:content-['(optional)']",
|
|
14
|
-
},
|
|
15
|
-
srOnly: {
|
|
16
|
-
true: "sr-only",
|
|
17
|
-
},
|
|
8
|
+
const labelVariants = cva(["text-label", "text-foreground"], {
|
|
9
|
+
variants: {
|
|
10
|
+
optional: {
|
|
11
|
+
true: "after:ml-1 after:content-['(optional)']",
|
|
18
12
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
srOnly: {
|
|
14
|
+
true: "sr-only",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {},
|
|
18
|
+
});
|
|
22
19
|
|
|
23
20
|
interface LabelProps extends React.ComponentPropsWithoutRef<"label"> {
|
|
24
21
|
/**
|
package/src/components/link.tsx
CHANGED
|
@@ -70,6 +70,38 @@ const linkVariants = cva(
|
|
|
70
70
|
// Focus state
|
|
71
71
|
"focus-visible:shadow-default",
|
|
72
72
|
],
|
|
73
|
+
// Inline link that reads as part of the surrounding sentence: no
|
|
74
|
+
// link colour of its own — `color: inherit` picks up whatever the
|
|
75
|
+
// parent text sets (muted body copy, alert foregrounds, ...).
|
|
76
|
+
// Because colour no longer distinguishes the link from the text
|
|
77
|
+
// around it, the underline is the only affordance and is therefore
|
|
78
|
+
// persistent (WCAG 1.4.1) — hover feedback comes from the underline
|
|
79
|
+
// strengthening, not from a colour change. Deliberately no `visited:`
|
|
80
|
+
// styling: a purple visited colour would break the "part of the
|
|
81
|
+
// sentence" goal. Plain `inline` display (not `inline-flex`) so the
|
|
82
|
+
// link wraps naturally across lines inside a paragraph.
|
|
83
|
+
inherit: [
|
|
84
|
+
"inline",
|
|
85
|
+
"cursor-pointer",
|
|
86
|
+
"outline-none",
|
|
87
|
+
"rounded-sm",
|
|
88
|
+
"text-inherit",
|
|
89
|
+
// Persistent underline; softened until hovered
|
|
90
|
+
"underline",
|
|
91
|
+
"underline-offset-4",
|
|
92
|
+
"decoration-current/60",
|
|
93
|
+
"hover:decoration-current",
|
|
94
|
+
// External icon sits in the text flow with the label
|
|
95
|
+
"[&_svg]:ml-1",
|
|
96
|
+
"[&_svg]:inline",
|
|
97
|
+
"[&_svg]:align-text-bottom",
|
|
98
|
+
// Transitions
|
|
99
|
+
"transition-[text-decoration-color]",
|
|
100
|
+
"duration-fast",
|
|
101
|
+
"ease-out",
|
|
102
|
+
// Focus state
|
|
103
|
+
"focus-visible:shadow-default",
|
|
104
|
+
],
|
|
73
105
|
// Button-styled, brand CTA (matches Button `primary`).
|
|
74
106
|
primary: buttonStyledLink("primary"),
|
|
75
107
|
// Button-styled, filled (maps to Button `secondary`).
|
|
@@ -103,11 +135,13 @@ export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
|
103
135
|
*/
|
|
104
136
|
dataHook: string;
|
|
105
137
|
/**
|
|
106
|
-
* Visual style variant. `inline` renders a standard text link; `
|
|
107
|
-
* renders
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
138
|
+
* Visual style variant. `inline` renders a standard text link; `inherit`
|
|
139
|
+
* renders an always-underlined link that takes the surrounding text colour
|
|
140
|
+
* (for links inside body copy, alerts and muted text); `primary` renders
|
|
141
|
+
* the brand CTA treatment (matches `Button variant="primary"`); `filled`,
|
|
142
|
+
* `outline` and `ghost` render button-styled treatments for inline actions
|
|
143
|
+
* and high-priority navigation; `icon` renders a circular icon-only link
|
|
144
|
+
* (provide an `aria-label` since there is no text content).
|
|
111
145
|
* @default "inline"
|
|
112
146
|
*/
|
|
113
147
|
variant?: LinkVariant;
|
package/src/components/list.tsx
CHANGED
|
@@ -28,7 +28,7 @@ const itemVariants = cva(
|
|
|
28
28
|
default: [],
|
|
29
29
|
filled: ["bg-card"],
|
|
30
30
|
outline: ["bg-background", "border", "border-border"],
|
|
31
|
-
loading: ["
|
|
31
|
+
loading: ["p-0"],
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
defaultVariants: {
|
|
@@ -160,10 +160,10 @@ const Item = React.forwardRef<HTMLLIElement, ItemProps>(
|
|
|
160
160
|
{...props}
|
|
161
161
|
>
|
|
162
162
|
{variant === "loading" ? (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
/* One skeleton per data row, mirroring the filled row's footprint:
|
|
164
|
+
h-13 = py-2 × 2 + the size-9 actions slot that drives the row's
|
|
165
|
+
height, so nothing shifts when the content arrives. */
|
|
166
|
+
<Skeleton className="h-13 w-full rounded-lg" />
|
|
167
167
|
) : (
|
|
168
168
|
children
|
|
169
169
|
)}
|
|
@@ -232,10 +232,7 @@ const ItemTitle = React.forwardRef<HTMLDivElement, ItemTitleProps>(
|
|
|
232
232
|
({ className, ...props }, ref) => (
|
|
233
233
|
<div
|
|
234
234
|
ref={ref}
|
|
235
|
-
className={cn(
|
|
236
|
-
"text-foreground text-base leading-normal font-medium",
|
|
237
|
-
className
|
|
238
|
-
)}
|
|
235
|
+
className={cn("text-foreground text-body", className)}
|
|
239
236
|
data-slot="item-title"
|
|
240
237
|
{...props}
|
|
241
238
|
/>
|
|
@@ -257,10 +254,7 @@ const ItemDescription = React.forwardRef<HTMLDivElement, ItemDescriptionProps>(
|
|
|
257
254
|
({ className, ...props }, ref) => (
|
|
258
255
|
<div
|
|
259
256
|
ref={ref}
|
|
260
|
-
className={cn(
|
|
261
|
-
"text-muted-foreground text-sm leading-normal font-normal",
|
|
262
|
-
className
|
|
263
|
-
)}
|
|
257
|
+
className={cn("text-body-sm text-muted-foreground", className)}
|
|
264
258
|
data-slot="item-description"
|
|
265
259
|
{...props}
|
|
266
260
|
/>
|
|
@@ -322,7 +316,17 @@ const ItemSubheader = React.forwardRef<HTMLLIElement, ItemSubheaderProps>(
|
|
|
322
316
|
<li
|
|
323
317
|
ref={ref}
|
|
324
318
|
className={cn(
|
|
325
|
-
|
|
319
|
+
// A subheader is a caption over its group of items — the same role as a
|
|
320
|
+
// menu or sidebar group label, so text-label-sm (DS-925).
|
|
321
|
+
// Padding is deliberately asymmetric: with the old symmetric py-2 the
|
|
322
|
+
// caption sat equidistant between the previous group and its own
|
|
323
|
+
// (17px each side over the list's 8px gap), so it read as a second
|
|
324
|
+
// title rather than a label for the group below. 16px above / 4px
|
|
325
|
+
// below binds it downwards. The space above only has a job when a
|
|
326
|
+
// group precedes it, so a subheader that opens the list stays tight —
|
|
327
|
+
// that keeps compact surfaces (the Map popover, which sets gap-0
|
|
328
|
+
// inside p-3) from opening up.
|
|
329
|
+
"text-muted-foreground text-label-sm flex items-center pt-4 pr-2 pb-1 pl-4 first:pt-2",
|
|
326
330
|
className
|
|
327
331
|
)}
|
|
328
332
|
data-hook={dataHook}
|
package/src/components/map.tsx
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
Map as MapIcon,
|
|
7
|
+
RefreshCw,
|
|
8
|
+
Store,
|
|
9
|
+
TriangleAlert,
|
|
10
|
+
} from "@brightlocal/icons";
|
|
6
11
|
import {
|
|
7
12
|
GlobeyFixingFault,
|
|
8
13
|
MapBackground as MapBackgroundImage,
|
|
@@ -18,6 +23,7 @@ import {
|
|
|
18
23
|
type PopoverAnchorProps,
|
|
19
24
|
type PopoverContentProps,
|
|
20
25
|
} from "@brightlocal/ui-components/popover";
|
|
26
|
+
import { EmptyCanvas } from "../lib/empty-canvas";
|
|
21
27
|
|
|
22
28
|
// ──────────────────────────────────────
|
|
23
29
|
// MapTypeId
|
|
@@ -289,7 +295,7 @@ const mapGridPinColorMap: Record<ResolvedVariant, string> = Object.fromEntries(
|
|
|
289
295
|
) as Record<ResolvedVariant, string>;
|
|
290
296
|
|
|
291
297
|
const mapGridPinVariants = cva(
|
|
292
|
-
"inline-flex items-center justify-center rounded-full
|
|
298
|
+
"inline-flex items-center justify-center rounded-full text-label font-semibold text-foreground dark:text-neutral-900 border-2 border-white shadow-sm transition-shadow duration-fast ease-out hover:shadow-md",
|
|
293
299
|
{
|
|
294
300
|
variants: {
|
|
295
301
|
variant: {
|
|
@@ -1096,14 +1102,14 @@ const MapErrorState = React.forwardRef<HTMLDivElement, MapErrorStateProps>(
|
|
|
1096
1102
|
</div>
|
|
1097
1103
|
<div className="flex flex-col gap-2">
|
|
1098
1104
|
<h3
|
|
1099
|
-
className="text-foreground text-
|
|
1105
|
+
className="text-foreground text-heading-subsection"
|
|
1100
1106
|
data-slot="map-error-title"
|
|
1101
1107
|
>
|
|
1102
1108
|
{title}
|
|
1103
1109
|
</h3>
|
|
1104
1110
|
{message && (
|
|
1105
1111
|
<p
|
|
1106
|
-
className="text-muted-foreground text-sm"
|
|
1112
|
+
className="text-muted-foreground text-body-sm"
|
|
1107
1113
|
data-slot="map-error-message"
|
|
1108
1114
|
>
|
|
1109
1115
|
{message}
|
|
@@ -1131,6 +1137,94 @@ const MapErrorState = React.forwardRef<HTMLDivElement, MapErrorStateProps>(
|
|
|
1131
1137
|
|
|
1132
1138
|
MapErrorState.displayName = "MapErrorState";
|
|
1133
1139
|
|
|
1140
|
+
// ──────────────────────────────────────
|
|
1141
|
+
// MapEmpty
|
|
1142
|
+
// ──────────────────────────────────────
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Props for the MapEmpty component.
|
|
1146
|
+
*/
|
|
1147
|
+
interface MapEmptyProps extends Omit<
|
|
1148
|
+
React.ComponentProps<"div">,
|
|
1149
|
+
"children" | "title"
|
|
1150
|
+
> {
|
|
1151
|
+
/**
|
|
1152
|
+
* Required data-hook attribute for automated testing. The parts derive
|
|
1153
|
+
* theirs from it: `-icon`, `-message`.
|
|
1154
|
+
* @example "rankings-grid-map-empty"
|
|
1155
|
+
*/
|
|
1156
|
+
dataHook: string;
|
|
1157
|
+
/**
|
|
1158
|
+
* The glyph on the surface. The component sizes it.
|
|
1159
|
+
* @default <Map strokeWidth={2} />
|
|
1160
|
+
*/
|
|
1161
|
+
icon?: React.ReactNode;
|
|
1162
|
+
/**
|
|
1163
|
+
* The one line on the surface. Domain copy — "No ranking data yet" rather
|
|
1164
|
+
* than a bare "No data" — with no trailing period.
|
|
1165
|
+
* @default "No data yet"
|
|
1166
|
+
*/
|
|
1167
|
+
message?: string;
|
|
1168
|
+
/** Analytics element identifier */
|
|
1169
|
+
trackingEl?: string;
|
|
1170
|
+
/** Analytics label */
|
|
1171
|
+
trackingLabel?: string;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* A map surface with nothing to plot — the map's reserved box filled with a
|
|
1176
|
+
* muted surface, a bare icon, and one quiet line.
|
|
1177
|
+
*
|
|
1178
|
+
* The rule this exists to enforce: **a map never renders pinless with no
|
|
1179
|
+
* message.** An empty map and a broken map look identical, so silence here
|
|
1180
|
+
* reads as a fault every time.
|
|
1181
|
+
*
|
|
1182
|
+
* Unlike its `MapLoadingState` and `MapErrorState` siblings it does not draw
|
|
1183
|
+
* the decorative map background. Those two are telling the reader that a real
|
|
1184
|
+
* map is coming or has failed, so a map-shaped backdrop is honest; here there
|
|
1185
|
+
* is nothing to show, and a pinless map behind the message would recreate the
|
|
1186
|
+
* exact confusion the message is there to clear up.
|
|
1187
|
+
*
|
|
1188
|
+
* The surroundings must agree: KPI tiles beside an empty map show em-dashes and
|
|
1189
|
+
* drop their trend badges.
|
|
1190
|
+
*
|
|
1191
|
+
* @example
|
|
1192
|
+
* ```tsx
|
|
1193
|
+
* <div className="h-[500px]">
|
|
1194
|
+
* {hasRuns ? (
|
|
1195
|
+
* <GridMap dataHook="rankings-grid-map" {...gridMap} />
|
|
1196
|
+
* ) : (
|
|
1197
|
+
* <MapEmpty
|
|
1198
|
+
* dataHook="rankings-grid-map-empty"
|
|
1199
|
+
* message={t("rankings.map.empty")}
|
|
1200
|
+
* />
|
|
1201
|
+
* )}
|
|
1202
|
+
* </div>
|
|
1203
|
+
* ```
|
|
1204
|
+
*/
|
|
1205
|
+
const MapEmpty = React.forwardRef<HTMLDivElement, MapEmptyProps>(
|
|
1206
|
+
(
|
|
1207
|
+
{ className, dataHook, icon, message, trackingEl, trackingLabel, ...props },
|
|
1208
|
+
ref
|
|
1209
|
+
) => (
|
|
1210
|
+
/* `h-full w-full`, matching MapLoadingState: a map is always given its box
|
|
1211
|
+
by the consumer, and this fills it so nothing reflows when runs arrive. */
|
|
1212
|
+
<EmptyCanvas
|
|
1213
|
+
ref={ref}
|
|
1214
|
+
className={cn("h-full w-full rounded-lg", className)}
|
|
1215
|
+
dataHook={dataHook}
|
|
1216
|
+
icon={icon ?? <MapIcon strokeWidth={2} />}
|
|
1217
|
+
message={message ?? "No data yet"}
|
|
1218
|
+
slot="map-empty"
|
|
1219
|
+
trackingEl={trackingEl}
|
|
1220
|
+
trackingLabel={trackingLabel}
|
|
1221
|
+
{...props}
|
|
1222
|
+
/>
|
|
1223
|
+
)
|
|
1224
|
+
);
|
|
1225
|
+
|
|
1226
|
+
MapEmpty.displayName = "MapEmpty";
|
|
1227
|
+
|
|
1134
1228
|
// ──────────────────────────────────────
|
|
1135
1229
|
// MapLegendItem
|
|
1136
1230
|
// ──────────────────────────────────────
|
|
@@ -1166,7 +1260,7 @@ const MapLegendItem = React.forwardRef<HTMLSpanElement, MapLegendItemProps>(
|
|
|
1166
1260
|
<span
|
|
1167
1261
|
ref={ref}
|
|
1168
1262
|
className={cn(
|
|
1169
|
-
"text-foreground flex items-center gap-1
|
|
1263
|
+
"text-foreground text-body-xs flex items-center gap-1",
|
|
1170
1264
|
className
|
|
1171
1265
|
)}
|
|
1172
1266
|
data-hook={dataHook}
|
|
@@ -1498,6 +1592,7 @@ export {
|
|
|
1498
1592
|
MapControlButton,
|
|
1499
1593
|
MapLoadingState,
|
|
1500
1594
|
MapErrorState,
|
|
1595
|
+
MapEmpty,
|
|
1501
1596
|
MapLegend,
|
|
1502
1597
|
MapLegendItem,
|
|
1503
1598
|
MapPopover,
|
|
@@ -1521,6 +1616,7 @@ export type {
|
|
|
1521
1616
|
MapControlButtonProps,
|
|
1522
1617
|
MapLoadingStateProps,
|
|
1523
1618
|
MapErrorStateProps,
|
|
1619
|
+
MapEmptyProps,
|
|
1524
1620
|
MapLegendProps,
|
|
1525
1621
|
MapLegendItemProps,
|
|
1526
1622
|
MapPopoverProps,
|