@brightlocal/ui-components 3.3.0 → 3.5.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/AI_USAGE.md +22 -3
- package/README.md +177 -109
- package/component-meta.json +1307 -113
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +13 -2
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +4 -3
- package/dist/banner.cjs +1 -1
- package/dist/banner.d.ts +47 -11
- package/dist/banner.d.ts.map +1 -1
- package/dist/banner.js +156 -79
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +40 -5
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +59 -52
- package/dist/blocks/input-list.cjs +1 -1
- package/dist/blocks/input-list.d.ts +1 -0
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +39 -39
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +12 -6
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +64 -63
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +47 -43
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +12 -0
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +115 -97
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -10
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +281 -296
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +430 -343
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -2
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +212 -207
- package/dist/count-indicator.cjs +1 -0
- package/dist/count-indicator.d.ts +85 -0
- package/dist/count-indicator.d.ts.map +1 -0
- package/dist/count-indicator.js +72 -0
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +101 -11
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +593 -523
- package/dist/description-list.cjs +1 -0
- package/dist/description-list.d.ts +142 -0
- package/dist/description-list.d.ts.map +1 -0
- package/dist/description-list.js +173 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +26 -3
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +62 -47
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +8 -4
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +37 -38
- package/dist/file-upload.cjs +1 -0
- package/dist/file-upload.d.ts +546 -0
- package/dist/file-upload.d.ts.map +1 -0
- package/dist/file-upload.js +1103 -0
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +7 -2
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +52 -52
- package/dist/hooks/use-file-dropzone.cjs +1 -0
- package/dist/hooks/use-file-dropzone.d.ts +75 -0
- package/dist/hooks/use-file-dropzone.d.ts.map +1 -0
- package/dist/hooks/use-file-dropzone.js +133 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +29 -16
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +153 -36
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +681 -623
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +30 -1
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +131 -115
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +37 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +131 -114
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +6 -6
- package/dist/lib/empty-canvas.cjs +1 -1
- package/dist/lib/empty-canvas.d.ts +27 -1
- package/dist/lib/empty-canvas.d.ts.map +1 -1
- package/dist/lib/empty-canvas.js +27 -23
- package/dist/lib/empty-chip.cjs +1 -1
- package/dist/lib/empty-chip.d.ts +19 -2
- package/dist/lib/empty-chip.d.ts.map +1 -1
- package/dist/lib/empty-chip.js +14 -9
- package/dist/lib/field-aria.cjs +1 -1
- package/dist/lib/field-aria.d.ts +4 -4
- package/dist/lib/field-aria.d.ts.map +1 -1
- package/dist/lib/field-aria.js +7 -5
- package/dist/lib/media-viewer-content.cjs +1 -1
- package/dist/lib/media-viewer-content.js +1 -1
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.js +15 -10
- package/dist/lib/table-internal.cjs +1 -1
- package/dist/lib/table-internal.d.ts +19 -0
- package/dist/lib/table-internal.d.ts.map +1 -1
- package/dist/lib/table-internal.js +22 -7
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +230 -40
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +301 -66
- package/dist/logo-mark.cjs +1 -1
- package/dist/logo-mark.d.ts +18 -2
- package/dist/logo-mark.d.ts.map +1 -1
- package/dist/logo-mark.js +159 -79
- package/dist/media-empty.cjs +1 -1
- package/dist/media-empty.d.ts +50 -7
- package/dist/media-empty.d.ts.map +1 -1
- package/dist/media-empty.js +14 -13
- package/dist/media-viewer.cjs +1 -1
- package/dist/media-viewer.js +6 -6
- package/dist/multi-select-filter.cjs +1 -1
- package/dist/multi-select-filter.d.ts.map +1 -1
- package/dist/multi-select-filter.js +92 -101
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +11 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +17 -17
- package/dist/relative-date.d.ts +6 -0
- package/dist/relative-date.d.ts.map +1 -1
- package/dist/resizable.d.ts +1 -1
- package/dist/result-count.cjs +1 -1
- package/dist/result-count.d.ts +13 -16
- package/dist/result-count.d.ts.map +1 -1
- package/dist/result-count.js +24 -33
- package/dist/route-progress.cjs +1 -1
- package/dist/route-progress.js +24 -23
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +22 -3
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +152 -125
- package/dist/single-select-filter.cjs +1 -1
- package/dist/single-select-filter.d.ts.map +1 -1
- package/dist/single-select-filter.js +67 -76
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +77 -76
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +39 -3
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +127 -76
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.d.ts +34 -0
- package/dist/textarea.d.ts.map +1 -1
- package/dist/textarea.js +115 -19
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +137 -131
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +6 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +14 -13
- package/package.json +2 -3
- package/src/blocks/empty-state.tsx +108 -48
- package/src/blocks/input-list.tsx +15 -9
- package/src/blocks/sidebar.tsx +39 -16
- package/src/components/alert-dialog.tsx +18 -2
- package/src/components/banner.tsx +247 -68
- package/src/components/button.tsx +27 -10
- package/src/components/card.tsx +89 -7
- package/src/components/chart.tsx +47 -67
- package/src/components/combobox.tsx +221 -12
- package/src/components/command.tsx +83 -37
- package/src/components/count-indicator.tsx +188 -0
- package/src/components/data-table.tsx +506 -159
- package/src/components/description-list.tsx +445 -0
- package/src/components/dialog.tsx +74 -5
- package/src/components/drawer.tsx +52 -32
- package/src/components/file-upload.tsx +2574 -0
- package/src/components/global-layout.tsx +18 -5
- package/src/components/hover-card.tsx +395 -65
- package/src/components/input-chip.tsx +67 -2
- package/src/components/input-group.tsx +89 -6
- package/src/components/list.tsx +720 -72
- package/src/components/logo-mark.tsx +109 -25
- package/src/components/media-empty.tsx +62 -7
- package/src/components/multi-select-filter.tsx +9 -16
- package/src/components/pagination.tsx +15 -2
- package/src/components/relative-date.tsx +6 -0
- package/src/components/result-count.tsx +27 -54
- package/src/components/sheet.tsx +86 -8
- package/src/components/single-select-filter.tsx +9 -16
- package/src/components/table.tsx +16 -1
- package/src/components/tabs.tsx +223 -41
- package/src/components/textarea.tsx +271 -4
- package/src/components/tooltip.tsx +29 -2
- package/src/components/typography-text.tsx +7 -2
- package/src/hooks/use-file-dropzone.ts +325 -0
- package/src/index.ts +4 -0
- package/src/lib/empty-canvas.tsx +47 -20
- package/src/lib/empty-chip.tsx +38 -3
- package/src/lib/field-aria.tsx +11 -6
- package/src/lib/table-internal.ts +38 -0
|
@@ -17,6 +17,15 @@ const SOURCE_ICON_ALIASES: Record<string, string> = {
|
|
|
17
17
|
"google-ai-mode": "gemini",
|
|
18
18
|
googleaio: "gemini",
|
|
19
19
|
"google-ai-overviews": "gemini",
|
|
20
|
+
gbp: "google",
|
|
21
|
+
googlebusinessprofile: "google",
|
|
22
|
+
"google-business-profile": "google",
|
|
23
|
+
gmb: "google",
|
|
24
|
+
googlemybusiness: "google",
|
|
25
|
+
"google-my-business": "google",
|
|
26
|
+
applemaps: "apple-maps",
|
|
27
|
+
ga4: "google-analytics",
|
|
28
|
+
googleanalytics: "google-analytics",
|
|
20
29
|
ypnetwork: "yellowpages",
|
|
21
30
|
superpagesaus: "superpages",
|
|
22
31
|
"192": "oneninetwo",
|
|
@@ -81,25 +90,75 @@ const logoMarkStyles = cva(
|
|
|
81
90
|
transparent: "",
|
|
82
91
|
filled: "overflow-hidden bg-muted",
|
|
83
92
|
border: "border border-border",
|
|
93
|
+
success: "overflow-hidden bg-score-strong/15 text-score-strong-ink",
|
|
94
|
+
destructive: "overflow-hidden bg-score-poor/15 text-score-poor-ink",
|
|
95
|
+
},
|
|
96
|
+
shape: {
|
|
97
|
+
square: "",
|
|
98
|
+
circle: "",
|
|
84
99
|
},
|
|
85
100
|
},
|
|
86
101
|
compoundVariants: [
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
|
|
90
|
-
|
|
102
|
+
// contained (filled / success / destructive / border) — square
|
|
103
|
+
{
|
|
104
|
+
variant: ["filled", "success", "destructive", "border"],
|
|
105
|
+
size: "xs",
|
|
106
|
+
shape: "square",
|
|
107
|
+
className: "size-5 rounded-md",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
variant: ["filled", "success", "destructive", "border"],
|
|
111
|
+
size: "sm",
|
|
112
|
+
shape: "square",
|
|
113
|
+
className: "size-6 rounded-md",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
variant: ["filled", "success", "destructive", "border"],
|
|
117
|
+
size: "md",
|
|
118
|
+
shape: "square",
|
|
119
|
+
className: "size-8 rounded-lg",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
variant: ["filled", "success", "destructive", "border"],
|
|
123
|
+
size: "lg",
|
|
124
|
+
shape: "square",
|
|
125
|
+
className: "size-10 rounded-lg",
|
|
126
|
+
},
|
|
127
|
+
// contained — circle
|
|
128
|
+
{
|
|
129
|
+
variant: ["filled", "success", "destructive", "border"],
|
|
130
|
+
size: "xs",
|
|
131
|
+
shape: "circle",
|
|
132
|
+
className: "size-5 rounded-full",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
variant: ["filled", "success", "destructive", "border"],
|
|
136
|
+
size: "sm",
|
|
137
|
+
shape: "circle",
|
|
138
|
+
className: "size-6 rounded-full",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
variant: ["filled", "success", "destructive", "border"],
|
|
142
|
+
size: "md",
|
|
143
|
+
shape: "circle",
|
|
144
|
+
className: "size-8 rounded-full",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
variant: ["filled", "success", "destructive", "border"],
|
|
148
|
+
size: "lg",
|
|
149
|
+
shape: "circle",
|
|
150
|
+
className: "size-10 rounded-full",
|
|
151
|
+
},
|
|
152
|
+
// transparent (shape has no effect — no container to round)
|
|
91
153
|
{ variant: "transparent", size: "xs", className: "size-4" },
|
|
92
154
|
{ variant: "transparent", size: "sm", className: "size-5" },
|
|
93
155
|
{ variant: "transparent", size: "md", className: "size-6" },
|
|
94
156
|
{ variant: "transparent", size: "lg", className: "size-8" },
|
|
95
|
-
{ variant: "border", size: "xs", className: "size-5 rounded-md" },
|
|
96
|
-
{ variant: "border", size: "sm", className: "size-6 rounded-md" },
|
|
97
|
-
{ variant: "border", size: "md", className: "size-8 rounded-lg" },
|
|
98
|
-
{ variant: "border", size: "lg", className: "size-10 rounded-lg" },
|
|
99
157
|
],
|
|
100
158
|
defaultVariants: {
|
|
101
159
|
size: "md",
|
|
102
160
|
variant: "filled",
|
|
161
|
+
shape: "square",
|
|
103
162
|
},
|
|
104
163
|
}
|
|
105
164
|
);
|
|
@@ -111,26 +170,33 @@ const iconSizeMap = {
|
|
|
111
170
|
lg: { contained: 22, bare: 32 },
|
|
112
171
|
} as const;
|
|
113
172
|
|
|
114
|
-
const fallbackTextStyles = cva(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
md: "text-label-sm leading-none",
|
|
122
|
-
lg: "text-body-sm",
|
|
123
|
-
},
|
|
173
|
+
const fallbackTextStyles = cva("select-none font-semibold", {
|
|
174
|
+
variants: {
|
|
175
|
+
size: {
|
|
176
|
+
xs: "text-label-sm leading-none",
|
|
177
|
+
sm: "text-label-sm leading-none",
|
|
178
|
+
md: "text-label-sm leading-none",
|
|
179
|
+
lg: "text-body-sm",
|
|
124
180
|
},
|
|
125
|
-
|
|
126
|
-
|
|
181
|
+
variant: {
|
|
182
|
+
transparent: "text-muted-foreground",
|
|
183
|
+
filled: "text-muted-foreground",
|
|
184
|
+
border: "text-muted-foreground",
|
|
185
|
+
success: "",
|
|
186
|
+
destructive: "",
|
|
127
187
|
},
|
|
128
|
-
}
|
|
129
|
-
|
|
188
|
+
},
|
|
189
|
+
defaultVariants: {
|
|
190
|
+
size: "md",
|
|
191
|
+
variant: "filled",
|
|
192
|
+
},
|
|
193
|
+
});
|
|
130
194
|
|
|
131
195
|
export type LogoMarkSize = "xs" | "sm" | "md" | "lg";
|
|
132
|
-
export type LogoMarkVariant =
|
|
196
|
+
export type LogoMarkVariant =
|
|
197
|
+
"transparent" | "filled" | "border" | "success" | "destructive";
|
|
133
198
|
export type LogoMarkColorScheme = "original" | "neutral";
|
|
199
|
+
export type LogoMarkShape = "square" | "circle";
|
|
134
200
|
|
|
135
201
|
export interface LogoMarkProps
|
|
136
202
|
extends
|
|
@@ -166,6 +232,10 @@ export interface LogoMarkProps
|
|
|
166
232
|
* - `filled` — bg-muted rounded surface (default, safe for brand-colour icons)
|
|
167
233
|
* - `border` — border ring with transparent background
|
|
168
234
|
* - `transparent` — bare icon with no container
|
|
235
|
+
* - `success` — `bg-score-strong/15` with `text-score-strong-ink`, the Delta
|
|
236
|
+
* pill's tint and ink for a good outcome
|
|
237
|
+
* - `destructive` — `bg-score-poor/15` with `text-score-poor-ink`, the Delta
|
|
238
|
+
* pill's tint and ink for a bad outcome
|
|
169
239
|
* @default "filled"
|
|
170
240
|
*/
|
|
171
241
|
variant?: LogoMarkVariant;
|
|
@@ -176,6 +246,16 @@ export interface LogoMarkProps
|
|
|
176
246
|
* @default "original"
|
|
177
247
|
*/
|
|
178
248
|
colorScheme?: LogoMarkColorScheme;
|
|
249
|
+
/**
|
|
250
|
+
* Container shape.
|
|
251
|
+
* - `square` — rounded square (default); radius steps with size
|
|
252
|
+
* - `circle` — fully round (`rounded-full`); used for empty-state chips
|
|
253
|
+
* and file-upload dropzone feedback
|
|
254
|
+
*
|
|
255
|
+
* Ignored on `transparent`, which has no container to round.
|
|
256
|
+
* @default "square"
|
|
257
|
+
*/
|
|
258
|
+
shape?: LogoMarkShape;
|
|
179
259
|
/**
|
|
180
260
|
* Override the fallback initial letter shown when no icon resolves.
|
|
181
261
|
* Defaults to the first character of `name`.
|
|
@@ -211,6 +291,7 @@ const LogoMark = React.forwardRef<HTMLSpanElement, LogoMarkProps>(
|
|
|
211
291
|
size = "md",
|
|
212
292
|
variant = "filled",
|
|
213
293
|
colorScheme = "original",
|
|
294
|
+
shape = "square",
|
|
214
295
|
fallback,
|
|
215
296
|
trackingEl,
|
|
216
297
|
trackingLabel,
|
|
@@ -307,7 +388,7 @@ const LogoMark = React.forwardRef<HTMLSpanElement, LogoMarkProps>(
|
|
|
307
388
|
ref={ref}
|
|
308
389
|
aria-hidden={isDecorative ? "true" : undefined}
|
|
309
390
|
aria-label={ariaLabel}
|
|
310
|
-
className={cn(logoMarkStyles({ size, variant }), className)}
|
|
391
|
+
className={cn(logoMarkStyles({ size, variant, shape }), className)}
|
|
311
392
|
data-hook={dataHook}
|
|
312
393
|
data-slot="logo-mark"
|
|
313
394
|
data-tracking-el={trackingEl ?? "logo-mark"}
|
|
@@ -329,7 +410,10 @@ const LogoMark = React.forwardRef<HTMLSpanElement, LogoMarkProps>(
|
|
|
329
410
|
) : (
|
|
330
411
|
<span
|
|
331
412
|
aria-hidden="true"
|
|
332
|
-
className={fallbackTextStyles({
|
|
413
|
+
className={fallbackTextStyles({
|
|
414
|
+
size,
|
|
415
|
+
variant,
|
|
416
|
+
})}
|
|
333
417
|
data-slot="logo-mark-fallback"
|
|
334
418
|
>
|
|
335
419
|
{initial}
|
|
@@ -32,6 +32,12 @@ import { EmptyCanvas } from "../lib/empty-canvas";
|
|
|
32
32
|
* The frame is the consumer's and it stays put, so the layout never shifts when
|
|
33
33
|
* the media arrives — and anything overlaid on the frame (a status Badge in a
|
|
34
34
|
* corner) keeps working, because this fills the frame rather than replacing it.
|
|
35
|
+
*
|
|
36
|
+
* `size="sm"` is for slots under 48px — table thumbnails, list avatars
|
|
37
|
+
* (DS-1257). A 32px glyph and a line cannot centre in a 40px tile, so the
|
|
38
|
+
* compact canvas drops the line and draws a 20px glyph, keeping the surface and
|
|
39
|
+
* the glyph colour. `message` does not exist at sm: a thumbnail sits next to
|
|
40
|
+
* the row that names it, so it is decorative.
|
|
35
41
|
* -----------------------------------------------------------------------------------------------*/
|
|
36
42
|
|
|
37
43
|
/**
|
|
@@ -50,9 +56,16 @@ const VARIANT_DEFAULTS: Record<
|
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
/**
|
|
53
|
-
*
|
|
59
|
+
* How big the slot is. `md` is a real content box — a card's media, a photo
|
|
60
|
+
* well — and draws the 32px glyph with its line. `sm` is a slot under 48px — a
|
|
61
|
+
* table thumbnail, a list avatar — and draws a 20px glyph alone, centred.
|
|
54
62
|
*/
|
|
55
|
-
|
|
63
|
+
type MediaEmptySize = "md" | "sm";
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Props shared by both sizes.
|
|
67
|
+
*/
|
|
68
|
+
interface MediaEmptyBaseProps extends Omit<
|
|
56
69
|
React.ComponentPropsWithoutRef<"div">,
|
|
57
70
|
"children" | "title"
|
|
58
71
|
> {
|
|
@@ -72,21 +85,52 @@ export interface MediaEmptyProps extends Omit<
|
|
|
72
85
|
* @default the variant's glyph
|
|
73
86
|
*/
|
|
74
87
|
icon?: React.ReactNode;
|
|
88
|
+
/**
|
|
89
|
+
* Tracking element identifier for analytics.
|
|
90
|
+
*/
|
|
91
|
+
trackingEl?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Tracking label for analytics context.
|
|
94
|
+
*/
|
|
95
|
+
trackingLabel?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* MediaEmpty at md: a content-sized slot, glyph and line.
|
|
100
|
+
*/
|
|
101
|
+
interface MediaEmptyMdProps extends MediaEmptyBaseProps {
|
|
102
|
+
/**
|
|
103
|
+
* The slot size — `md` for a content box, `sm` for a slot under 48px.
|
|
104
|
+
* @default "md"
|
|
105
|
+
*/
|
|
106
|
+
size?: "md";
|
|
75
107
|
/**
|
|
76
108
|
* The one line under the glyph. No trailing period.
|
|
77
109
|
* @default "No photo available" at variant image, "No video available" at variant video
|
|
78
110
|
*/
|
|
79
111
|
message?: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* MediaEmpty at sm: a slot under 48px, glyph only.
|
|
116
|
+
*/
|
|
117
|
+
interface MediaEmptySmProps extends MediaEmptyBaseProps {
|
|
80
118
|
/**
|
|
81
|
-
*
|
|
119
|
+
* The slot size — `md` for a content box, `sm` for a slot under 48px.
|
|
82
120
|
*/
|
|
83
|
-
|
|
121
|
+
size: "sm";
|
|
84
122
|
/**
|
|
85
|
-
*
|
|
123
|
+
* Not available at sm: a sub-48px slot has no room for a line, and a
|
|
124
|
+
* thumbnail is decorative next to the row that names it.
|
|
86
125
|
*/
|
|
87
|
-
|
|
126
|
+
message?: never;
|
|
88
127
|
}
|
|
89
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Props for the MediaEmpty component. `size` discriminates the two shapes.
|
|
131
|
+
*/
|
|
132
|
+
export type MediaEmptyProps = MediaEmptyMdProps | MediaEmptySmProps;
|
|
133
|
+
|
|
90
134
|
/**
|
|
91
135
|
* A media slot with nothing in it — the reserved frame, filled with a muted
|
|
92
136
|
* surface, a bare icon, and one quiet line.
|
|
@@ -113,6 +157,15 @@ export interface MediaEmptyProps extends Omit<
|
|
|
113
157
|
* <AspectRatio dataHook="tour-video" ratio={16 / 9}>
|
|
114
158
|
* <MediaEmpty dataHook="tour-video-empty" variant="video" />
|
|
115
159
|
* </AspectRatio>
|
|
160
|
+
*
|
|
161
|
+
* // A 40px table thumbnail: the glyph alone, centred.
|
|
162
|
+
* <div className="size-10 shrink-0 overflow-hidden rounded-sm">
|
|
163
|
+
* {photoUrl ? (
|
|
164
|
+
* <img alt="" className="size-full object-cover" src={photoUrl} />
|
|
165
|
+
* ) : (
|
|
166
|
+
* <MediaEmpty dataHook="post-thumbnail-empty" size="sm" />
|
|
167
|
+
* )}
|
|
168
|
+
* </div>
|
|
116
169
|
* ```
|
|
117
170
|
*/
|
|
118
171
|
const MediaEmpty = React.forwardRef<HTMLDivElement, MediaEmptyProps>(
|
|
@@ -123,6 +176,7 @@ const MediaEmpty = React.forwardRef<HTMLDivElement, MediaEmptyProps>(
|
|
|
123
176
|
variant = "image",
|
|
124
177
|
icon,
|
|
125
178
|
message,
|
|
179
|
+
size = "md",
|
|
126
180
|
trackingEl,
|
|
127
181
|
trackingLabel,
|
|
128
182
|
...props
|
|
@@ -141,6 +195,7 @@ const MediaEmpty = React.forwardRef<HTMLDivElement, MediaEmptyProps>(
|
|
|
141
195
|
dataHook={dataHook}
|
|
142
196
|
icon={icon ?? VARIANT_DEFAULTS[variant].icon}
|
|
143
197
|
message={message ?? VARIANT_DEFAULTS[variant].message}
|
|
198
|
+
size={size}
|
|
144
199
|
slot="media-empty"
|
|
145
200
|
trackingEl={trackingEl}
|
|
146
201
|
trackingLabel={trackingLabel}
|
|
@@ -153,4 +208,4 @@ MediaEmpty.displayName = "MediaEmpty";
|
|
|
153
208
|
|
|
154
209
|
export { MediaEmpty };
|
|
155
210
|
|
|
156
|
-
export type { MediaEmptyVariant };
|
|
211
|
+
export type { MediaEmptySize, MediaEmptyVariant };
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
PopoverContent,
|
|
42
42
|
PopoverTrigger,
|
|
43
43
|
} from "@brightlocal/ui-components/popover";
|
|
44
|
-
import {
|
|
44
|
+
import { EmptyState } from "../blocks/empty-state";
|
|
45
45
|
|
|
46
46
|
/* MultiSelectFilter — the Filtering pattern's several-at-once filter
|
|
47
47
|
(Patterns/Filtering → Which filter → Several at once): several values
|
|
@@ -752,21 +752,14 @@ const MultiSelectFilter = React.forwardRef<
|
|
|
752
752
|
/* The compact no-match form of Patterns → Empty States: the
|
|
753
753
|
muted chip, the message line, one quiet hint — the same
|
|
754
754
|
form CommandEmpty draws in the menu. */
|
|
755
|
-
<
|
|
756
|
-
className="
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
<
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
slot="multi-select-filter-empty-icon"
|
|
764
|
-
/>
|
|
765
|
-
<p>{emptyLabel ?? "No options found."}</p>
|
|
766
|
-
<p className="text-muted-foreground">
|
|
767
|
-
{emptyDescription ?? "Try another search."}
|
|
768
|
-
</p>
|
|
769
|
-
</div>
|
|
755
|
+
<EmptyState
|
|
756
|
+
className="py-6"
|
|
757
|
+
dataHook={`${dataHook}-empty`}
|
|
758
|
+
description={emptyDescription ?? "Try another search."}
|
|
759
|
+
icon={<SearchX />}
|
|
760
|
+
size="sm"
|
|
761
|
+
title={emptyLabel ?? "No options found."}
|
|
762
|
+
/>
|
|
770
763
|
) : (
|
|
771
764
|
<>
|
|
772
765
|
{allLabel !== undefined && !searching ? (
|
|
@@ -468,6 +468,17 @@ interface PaginationControlsProps extends Omit<
|
|
|
468
468
|
* @default "More pages"
|
|
469
469
|
*/
|
|
470
470
|
ellipsisSrLabel?: string;
|
|
471
|
+
/**
|
|
472
|
+
* @deprecated No-op since 3.5.0 — the count holds its previous value
|
|
473
|
+
* during a refetch; the DataTable's `refetchingLabel` live region covers
|
|
474
|
+
* SR announcements. Will be removed in the next major version.
|
|
475
|
+
*/
|
|
476
|
+
updating?: boolean;
|
|
477
|
+
/**
|
|
478
|
+
* @deprecated No-op since 3.5.0 — removed together with `updating`.
|
|
479
|
+
* Will be removed in the next major version.
|
|
480
|
+
*/
|
|
481
|
+
updatingLabel?: string;
|
|
471
482
|
/** Tracking element identifier for analytics. */
|
|
472
483
|
trackingEl?: string;
|
|
473
484
|
/** Tracking label for analytics context. */
|
|
@@ -545,6 +556,10 @@ const PaginationControls = React.forwardRef<
|
|
|
545
556
|
nextAriaLabel,
|
|
546
557
|
pageAriaLabel,
|
|
547
558
|
ellipsisSrLabel,
|
|
559
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- deprecated no-ops
|
|
560
|
+
updating,
|
|
561
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
562
|
+
updatingLabel,
|
|
548
563
|
trackingEl,
|
|
549
564
|
trackingLabel,
|
|
550
565
|
...props
|
|
@@ -610,8 +625,6 @@ const PaginationControls = React.forwardRef<
|
|
|
610
625
|
})();
|
|
611
626
|
|
|
612
627
|
const showNav = totalPages > 1;
|
|
613
|
-
// At zero items the default caption is only its screen-reader empty
|
|
614
|
-
// label, so the bar keeps no height for it and the nav centres.
|
|
615
628
|
const captionVisible =
|
|
616
629
|
caption != null && (Boolean(renderCaption) || totalItems !== 0);
|
|
617
630
|
|
|
@@ -156,6 +156,12 @@ export function relativeWords(
|
|
|
156
156
|
return dateLabel(date, now);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Returns the current `Date`, re-rendering the consumer on a configurable interval.
|
|
161
|
+
*
|
|
162
|
+
* @param every - Refresh interval in milliseconds
|
|
163
|
+
* @default 30_000
|
|
164
|
+
*/
|
|
159
165
|
export function useNow(every = 30 * SECOND): Date {
|
|
160
166
|
const [now, setNow] = useState(() => new Date());
|
|
161
167
|
useEffect(() => {
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
|
-
import { Spinner } from "@brightlocal/ui-components/spinner";
|
|
6
5
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
7
6
|
|
|
8
7
|
/* ResultCount — the one count text the DS renders for a collection
|
|
9
8
|
(Patterns/Filtering → Where controls live, part 4). It is the screen's
|
|
10
9
|
ONE live region: role="status", announced once per change — the rows
|
|
11
|
-
themselves announce nothing. During a refetch
|
|
12
|
-
|
|
13
|
-
announces "Updating results"
|
|
10
|
+
themselves announce nothing. During a scope-change refetch the count
|
|
11
|
+
holds its previous value (no dimming, no spinner) and the live region
|
|
12
|
+
announces "Updating results" once; the new count replaces the old one
|
|
13
|
+
atomically when data arrives.
|
|
14
14
|
|
|
15
15
|
Two forms, one component: the plain form ("4 of 24 locations")
|
|
16
16
|
says what the filters left; the range form ("1 to 20 of 45
|
|
@@ -27,20 +27,6 @@ interface ResultCountBaseProps extends Omit<
|
|
|
27
27
|
* @example "locations-result-count"
|
|
28
28
|
*/
|
|
29
29
|
dataHook: string;
|
|
30
|
-
/**
|
|
31
|
-
* Refetch in flight — the live region announces the updating message
|
|
32
|
-
* alone, while the previous count stays on screen (aria-hidden) beside
|
|
33
|
-
* the spinner. Dimming the rows is the consumer's job; this indicator is
|
|
34
|
-
* what makes dimming never the only signal.
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
|
-
updating?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Text shown beside the spinner during a refetch — and, on its own, the
|
|
40
|
-
* whole of what the live region announces while it is in flight.
|
|
41
|
-
* @default "Updating results"
|
|
42
|
-
*/
|
|
43
|
-
updatingLabel?: string;
|
|
44
30
|
/**
|
|
45
31
|
* Screen-reader-only text while the collection is empty. The visible
|
|
46
32
|
* count hides at zero — the empty state already says it — but the live
|
|
@@ -52,6 +38,17 @@ interface ResultCountBaseProps extends Omit<
|
|
|
52
38
|
trackingEl?: string;
|
|
53
39
|
/** Analytics label */
|
|
54
40
|
trackingLabel?: string;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated No-op since 3.5.0 — the count holds its previous value
|
|
43
|
+
* during a refetch; the DataTable's `refetchingLabel` live region covers
|
|
44
|
+
* SR announcements. Will be removed in the next major version.
|
|
45
|
+
*/
|
|
46
|
+
updating?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated No-op since 3.5.0 — removed together with `updating`.
|
|
49
|
+
* Will be removed in the next major version.
|
|
50
|
+
*/
|
|
51
|
+
updatingLabel?: string;
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
/** Plain form: how many records the filters left, out of an optional total. */
|
|
@@ -141,8 +138,8 @@ function format(template: string, values: Record<string, number>): string {
|
|
|
141
138
|
|
|
142
139
|
/**
|
|
143
140
|
* The collection's count as a `role="status"` live region — one per
|
|
144
|
-
* screen. Announces the new count once per change,
|
|
145
|
-
*
|
|
141
|
+
* screen. Announces the new count once per change, and the empty label
|
|
142
|
+
* (screen-reader only) at zero.
|
|
146
143
|
*/
|
|
147
144
|
const ResultCount = React.forwardRef<HTMLParagraphElement, ResultCountProps>(
|
|
148
145
|
(
|
|
@@ -153,17 +150,19 @@ const ResultCount = React.forwardRef<HTMLParagraphElement, ResultCountProps>(
|
|
|
153
150
|
from,
|
|
154
151
|
to,
|
|
155
152
|
total,
|
|
156
|
-
updating = false,
|
|
157
153
|
label,
|
|
158
154
|
labelOne,
|
|
159
155
|
noTotalLabel,
|
|
160
156
|
noTotalLabelOne,
|
|
161
157
|
rangeLabel,
|
|
162
158
|
rangeLabelOne,
|
|
163
|
-
updatingLabel,
|
|
164
159
|
emptyLabel,
|
|
165
160
|
trackingEl,
|
|
166
161
|
trackingLabel,
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- deprecated no-ops, absorbed to keep them off the DOM
|
|
163
|
+
updating,
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
165
|
+
updatingLabel,
|
|
167
166
|
...props
|
|
168
167
|
},
|
|
169
168
|
ref
|
|
@@ -199,10 +198,7 @@ const ResultCount = React.forwardRef<HTMLParagraphElement, ResultCountProps>(
|
|
|
199
198
|
return (
|
|
200
199
|
<p
|
|
201
200
|
ref={ref}
|
|
202
|
-
className={cn(
|
|
203
|
-
"text-muted-foreground text-body-sm relative flex items-center gap-2",
|
|
204
|
-
className
|
|
205
|
-
)}
|
|
201
|
+
className={cn("text-muted-foreground text-body-sm relative", className)}
|
|
206
202
|
data-hook={dataHook}
|
|
207
203
|
data-slot="result-count"
|
|
208
204
|
data-tracking-el={trackingEl ?? "result-count"}
|
|
@@ -210,37 +206,14 @@ const ResultCount = React.forwardRef<HTMLParagraphElement, ResultCountProps>(
|
|
|
210
206
|
role="status"
|
|
211
207
|
{...props}
|
|
212
208
|
>
|
|
213
|
-
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
stale count with a suffix ("40 of 128 results Updating…")
|
|
219
|
-
instead of the documented message. */}
|
|
220
|
-
{updating ? (
|
|
221
|
-
<>
|
|
222
|
-
{!isEmpty && (
|
|
223
|
-
<span aria-hidden="true" data-slot="result-count-text">
|
|
224
|
-
{text}
|
|
225
|
-
</span>
|
|
226
|
-
)}
|
|
227
|
-
<span
|
|
228
|
-
className="inline-flex items-center gap-1.5"
|
|
229
|
-
data-slot="result-count-updating"
|
|
230
|
-
>
|
|
231
|
-
{/* No loadingLabel: the spinner stays decorative
|
|
232
|
-
(aria-hidden) — the region's text change is the one
|
|
233
|
-
announcement. */}
|
|
234
|
-
<Spinner size="sm" />
|
|
235
|
-
{updatingLabel ?? "Updating results"}
|
|
236
|
-
</span>
|
|
237
|
-
</>
|
|
238
|
-
) : isEmpty ? (
|
|
209
|
+
{!isEmpty && <span data-slot="result-count-text">{text}</span>}
|
|
210
|
+
|
|
211
|
+
{/* Empty — sr-only label so the region still announces "No results"
|
|
212
|
+
while the visible empty state already says it. */}
|
|
213
|
+
{isEmpty && (
|
|
239
214
|
<span className="sr-only" data-slot="result-count-empty">
|
|
240
215
|
{emptyLabel ?? "No results"}
|
|
241
216
|
</span>
|
|
242
|
-
) : (
|
|
243
|
-
<span data-slot="result-count-text">{text}</span>
|
|
244
217
|
)}
|
|
245
218
|
</p>
|
|
246
219
|
);
|