@brightlocal/ui-components 3.4.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 +1061 -102
- 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.d.ts +1 -0
- package/dist/blocks/input-list.d.ts.map +1 -1
- 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/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 +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +676 -640
- 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/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 +13 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +103 -82
- 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/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 +3 -4
- package/src/blocks/empty-state.tsx +108 -48
- package/src/blocks/input-list.tsx +1 -0
- 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/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 +40 -3
- 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 +3 -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
|
@@ -10,8 +10,11 @@ import {
|
|
|
10
10
|
BLOCK_ILLUSTRATION_SIZE,
|
|
11
11
|
BlockIllustration,
|
|
12
12
|
} from "../lib/block-illustration";
|
|
13
|
-
import {
|
|
14
|
-
|
|
13
|
+
import {
|
|
14
|
+
type LogoMarkShape,
|
|
15
|
+
type LogoMarkVariant,
|
|
16
|
+
} from "../components/logo-mark";
|
|
17
|
+
import { EmptyChip, hasEmptyActions } from "../lib/empty-chip";
|
|
15
18
|
|
|
16
19
|
/* -------------------------------------------------------------------------------------------------
|
|
17
20
|
* EmptyState
|
|
@@ -26,6 +29,12 @@ import { EmptyChip } from "../lib/empty-chip";
|
|
|
26
29
|
* composition (`Grid variant="centered"` for a page body, a card or table frame
|
|
27
30
|
* for a section):
|
|
28
31
|
*
|
|
32
|
+
* sm — for a popover, menu or drawer list that found nothing: the
|
|
33
|
+
* compact form. An icon chip, the message as one body-sm
|
|
34
|
+
* line (never a heading: inside a listbox the block is an
|
|
35
|
+
* option or group, whose content is not an outline), one
|
|
36
|
+
* quiet hint, and the actions 16px under it. CommandEmpty /
|
|
37
|
+
* ComboboxEmpty and the filter drawers render this.
|
|
29
38
|
* md (default) — for the box a working page gives it: a card, a panel, a
|
|
30
39
|
* zero-row table. An icon in a LogoMark chip, and a 16/24
|
|
31
40
|
* title.
|
|
@@ -33,11 +42,8 @@ import { EmptyChip } from "../lib/empty-chip";
|
|
|
33
42
|
* illustration at 130 and a 20/28 title. Sits at the page
|
|
34
43
|
* body's optical centre via `<Grid variant="centered">`.
|
|
35
44
|
*
|
|
36
|
-
* (`sm` is reserved: a compact row-level tier is not designed yet, and until
|
|
37
|
-
* it is, the smallest empty vocabulary is the canvas primitives below.)
|
|
38
|
-
*
|
|
39
45
|
* The sizes are not interchangeable and the types say so: `illustration`
|
|
40
|
-
* exists only at lg, `align` only at md. A 130px drawing inside a card
|
|
46
|
+
* exists only at lg, `align` only at md, `titleLevel` not at sm. A 130px drawing inside a card
|
|
41
47
|
* outweighs the page around it, and a left-aligned page message is not a
|
|
42
48
|
* thing — so neither combination compiles.
|
|
43
49
|
*
|
|
@@ -57,7 +63,7 @@ import { EmptyChip } from "../lib/empty-chip";
|
|
|
57
63
|
* Visual prominence of the block. It sets the title's role, the kind of
|
|
58
64
|
* visual, and the rhythm — never the layout, which stays the consumer's.
|
|
59
65
|
*/
|
|
60
|
-
type EmptyStateSize = "md" | "lg";
|
|
66
|
+
type EmptyStateSize = "sm" | "md" | "lg";
|
|
61
67
|
|
|
62
68
|
/**
|
|
63
69
|
* Where an md block's content sits relative to its visual.
|
|
@@ -80,6 +86,13 @@ type EmptyStateAlign = "center" | "left";
|
|
|
80
86
|
*/
|
|
81
87
|
type EmptyStateIconVariant = LogoMarkVariant;
|
|
82
88
|
|
|
89
|
+
/**
|
|
90
|
+
* The chip's shape — LogoMark's shape, controlling the border-radius.
|
|
91
|
+
* - `circle` — fully round (default for empty states)
|
|
92
|
+
* - `square` — rounded square
|
|
93
|
+
*/
|
|
94
|
+
type EmptyStateIconShape = LogoMarkShape;
|
|
95
|
+
|
|
83
96
|
/** The title's type role per size — Inter 16/24, or Inter 20/28. One step
|
|
84
97
|
* under the heading of the page or card the block sits inside, so the empty
|
|
85
98
|
* message never competes with it (DS-997). */
|
|
@@ -89,7 +102,10 @@ const SIZE_HEADING_VARIANT = {
|
|
|
89
102
|
} as const;
|
|
90
103
|
|
|
91
104
|
/** The outline level each size defaults to, if the consumer names none. */
|
|
92
|
-
const SIZE_TITLE_LEVEL: Record<
|
|
105
|
+
const SIZE_TITLE_LEVEL: Record<
|
|
106
|
+
Exclude<EmptyStateSize, "sm">,
|
|
107
|
+
TypographyHeadingLevel
|
|
108
|
+
> = {
|
|
93
109
|
// An lg block is the page's message, under the layout's own page header,
|
|
94
110
|
// which owns h1.
|
|
95
111
|
lg: 2,
|
|
@@ -143,6 +159,12 @@ interface EmptyStateBaseProps extends Omit<
|
|
|
143
159
|
* @default "filled"
|
|
144
160
|
*/
|
|
145
161
|
iconVariant?: EmptyStateIconVariant;
|
|
162
|
+
/**
|
|
163
|
+
* The icon chip's shape. `circle` is the default for empty states;
|
|
164
|
+
* `square` matches the brand-mark shape used elsewhere.
|
|
165
|
+
* @default "circle"
|
|
166
|
+
*/
|
|
167
|
+
iconShape?: EmptyStateIconShape;
|
|
146
168
|
/**
|
|
147
169
|
* Tracking element identifier for analytics.
|
|
148
170
|
*/
|
|
@@ -206,9 +228,34 @@ interface EmptyStateLgProps extends EmptyStateBaseProps {
|
|
|
206
228
|
}
|
|
207
229
|
|
|
208
230
|
/**
|
|
209
|
-
*
|
|
231
|
+
* The block at sm: a popover, menu or drawer list that found nothing.
|
|
232
|
+
*/
|
|
233
|
+
interface EmptyStateSmProps extends Omit<EmptyStateBaseProps, "titleLevel"> {
|
|
234
|
+
size: "sm";
|
|
235
|
+
/**
|
|
236
|
+
* The glyph in the chip, e.g. `<SearchX />` for a search that matched
|
|
237
|
+
* nothing. Decorative: the chip is `aria-hidden`.
|
|
238
|
+
*/
|
|
239
|
+
icon?: React.ReactNode;
|
|
240
|
+
/**
|
|
241
|
+
* Not available at sm: the title is a body-sm line, never a heading.
|
|
242
|
+
*/
|
|
243
|
+
titleLevel?: never;
|
|
244
|
+
/**
|
|
245
|
+
* Not available at sm: a list message is centred.
|
|
246
|
+
*/
|
|
247
|
+
align?: never;
|
|
248
|
+
/**
|
|
249
|
+
* Not available at sm — use `icon`.
|
|
250
|
+
*/
|
|
251
|
+
illustration?: never;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Props for the EmptyState block. `size` discriminates the three shapes.
|
|
210
256
|
*/
|
|
211
|
-
export type EmptyStateProps =
|
|
257
|
+
export type EmptyStateProps =
|
|
258
|
+
EmptyStateSmProps | EmptyStateMdProps | EmptyStateLgProps;
|
|
212
259
|
|
|
213
260
|
/**
|
|
214
261
|
* The empty block: a visual, a title, one supporting line, and up to two
|
|
@@ -272,6 +319,7 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
272
319
|
children,
|
|
273
320
|
titleLevel,
|
|
274
321
|
iconVariant = "filled",
|
|
322
|
+
iconShape = "circle",
|
|
275
323
|
trackingEl,
|
|
276
324
|
trackingLabel,
|
|
277
325
|
size = "md",
|
|
@@ -282,7 +330,7 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
282
330
|
const icon = (props as EmptyStateMdProps).icon;
|
|
283
331
|
const illustration = (props as EmptyStateLgProps).illustration;
|
|
284
332
|
const align: EmptyStateAlign =
|
|
285
|
-
size
|
|
333
|
+
size !== "md"
|
|
286
334
|
? "center"
|
|
287
335
|
: ((props as EmptyStateMdProps).align ?? "center");
|
|
288
336
|
const domProps = rest as React.ComponentPropsWithoutRef<"div">;
|
|
@@ -290,23 +338,9 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
290
338
|
delete (domProps as { illustration?: unknown }).illustration;
|
|
291
339
|
delete (domProps as { align?: unknown }).align;
|
|
292
340
|
|
|
293
|
-
/*
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
empty and leave a stray 8px above nothing. `Children.toArray` drops
|
|
297
|
-
null, undefined and booleans, which is exactly the question being asked.
|
|
298
|
-
|
|
299
|
-
It does NOT look inside a fragment, though, and a call site that wraps
|
|
300
|
-
its conditionals in one (`<>{a}{b}</>`) would count as a single child
|
|
301
|
-
however empty it is. So unwrap one level before counting. */
|
|
302
|
-
const hasActions =
|
|
303
|
-
React.Children.toArray(children).flatMap((child) =>
|
|
304
|
-
React.isValidElement(child) && child.type === React.Fragment
|
|
305
|
-
? React.Children.toArray(
|
|
306
|
-
(child.props as { children?: React.ReactNode }).children
|
|
307
|
-
)
|
|
308
|
-
: [child]
|
|
309
|
-
).length > 0;
|
|
341
|
+
/* Without this check, `{canAdd && <Button/>}` would leave a stray 8px
|
|
342
|
+
above nothing. */
|
|
343
|
+
const hasActions = hasEmptyActions(children);
|
|
310
344
|
|
|
311
345
|
/* lg gets the illustration; md gets the chip. The chip is the fallback on
|
|
312
346
|
a page with no artwork of its own. */
|
|
@@ -322,37 +356,51 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
322
356
|
<EmptyChip
|
|
323
357
|
/* The chip's 4px of extra breathing room belongs to the title
|
|
324
358
|
under it — the lg column sets its own 16px rhythm instead. */
|
|
325
|
-
className={size
|
|
359
|
+
className={size !== "lg" && align === "center" ? "mb-1" : undefined}
|
|
326
360
|
dataHook={`${dataHook}-icon`}
|
|
327
361
|
icon={icon}
|
|
362
|
+
shape={iconShape}
|
|
328
363
|
slot="empty-state-icon"
|
|
329
364
|
variant={iconVariant}
|
|
330
365
|
/>
|
|
331
366
|
) : null;
|
|
332
367
|
|
|
333
368
|
/* One column for every size and alignment, so the parts and their spacing
|
|
334
|
-
are written once. */
|
|
369
|
+
are written once. sm sets a tighter 4px rhythm. */
|
|
335
370
|
const content = (
|
|
336
371
|
<div
|
|
337
372
|
className={cn(
|
|
338
|
-
"flex flex-col
|
|
373
|
+
"flex flex-col",
|
|
374
|
+
size === "sm" ? "gap-1" : "gap-2",
|
|
339
375
|
align === "center" && "w-full items-center"
|
|
340
376
|
)}
|
|
341
377
|
data-slot="empty-state-content"
|
|
342
378
|
>
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
379
|
+
{size === "sm" ? (
|
|
380
|
+
<TypographyText
|
|
381
|
+
align="center"
|
|
382
|
+
data-slot="empty-state-title"
|
|
383
|
+
dataHook={`${dataHook}-title`}
|
|
384
|
+
variant="body-sm"
|
|
385
|
+
>
|
|
386
|
+
{title}
|
|
387
|
+
</TypographyText>
|
|
388
|
+
) : (
|
|
389
|
+
<TypographyHeading
|
|
390
|
+
align={align === "center" ? "center" : "left"}
|
|
391
|
+
/* lg caps the title at 32rem, one step wider than the description
|
|
392
|
+
below it, so a long title wraps into the column instead of
|
|
393
|
+
running the full width of the page body. md is bounded by its
|
|
394
|
+
frame. */
|
|
395
|
+
className={size === "lg" ? "max-w-lg" : undefined}
|
|
396
|
+
data-slot="empty-state-title"
|
|
397
|
+
dataHook={`${dataHook}-title`}
|
|
398
|
+
level={titleLevel ?? SIZE_TITLE_LEVEL[size]}
|
|
399
|
+
variant={SIZE_HEADING_VARIANT[size]}
|
|
400
|
+
>
|
|
401
|
+
{title}
|
|
402
|
+
</TypographyHeading>
|
|
403
|
+
)}
|
|
356
404
|
{description ? (
|
|
357
405
|
/* Capped at 28rem: a single line of support reads as one thought
|
|
358
406
|
only while it stays a couple of lines long. */
|
|
@@ -368,9 +416,13 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
368
416
|
</TypographyText>
|
|
369
417
|
) : null}
|
|
370
418
|
{hasActions ? (
|
|
419
|
+
/* 16px between the text and the actions at every size: mt-2 on
|
|
420
|
+
the 8px gap, mt-3 on sm's 4px gap. sm wraps, for a narrow
|
|
421
|
+
popover. */
|
|
371
422
|
<div
|
|
372
423
|
className={cn(
|
|
373
|
-
"
|
|
424
|
+
"flex items-center gap-4",
|
|
425
|
+
size === "sm" ? "mt-3 flex-wrap" : "mt-2",
|
|
374
426
|
align === "center" && "justify-center"
|
|
375
427
|
)}
|
|
376
428
|
data-slot="empty-state-actions"
|
|
@@ -409,11 +461,14 @@ const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
|
|
|
409
461
|
className={cn(
|
|
410
462
|
align === "left"
|
|
411
463
|
? "flex items-start gap-4 text-left"
|
|
412
|
-
:
|
|
464
|
+
: cn(
|
|
465
|
+
"flex flex-col items-center text-center",
|
|
466
|
+
size === "sm" ? "gap-1" : "gap-2"
|
|
467
|
+
),
|
|
413
468
|
className
|
|
414
469
|
)}
|
|
415
470
|
data-hook={dataHook}
|
|
416
|
-
data-size=
|
|
471
|
+
data-size={size}
|
|
417
472
|
data-slot="empty-state"
|
|
418
473
|
data-tracking-el={trackingEl ?? "empty-state"}
|
|
419
474
|
data-tracking-label={trackingLabel}
|
|
@@ -430,4 +485,9 @@ EmptyState.displayName = "EmptyState";
|
|
|
430
485
|
|
|
431
486
|
export { EmptyState };
|
|
432
487
|
|
|
433
|
-
export type {
|
|
488
|
+
export type {
|
|
489
|
+
EmptyStateAlign,
|
|
490
|
+
EmptyStateIconShape,
|
|
491
|
+
EmptyStateIconVariant,
|
|
492
|
+
EmptyStateSize,
|
|
493
|
+
};
|
|
@@ -34,6 +34,7 @@ const InputListContext = React.createContext<InputListContextValue | null>(
|
|
|
34
34
|
null
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
+
/** Returns the InputList context (value, input state, and item management). */
|
|
37
38
|
function useInputListContext() {
|
|
38
39
|
const context = React.useContext(InputListContext);
|
|
39
40
|
if (!context) {
|
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -201,6 +201,7 @@ type SidebarContext = {
|
|
|
201
201
|
|
|
202
202
|
const SidebarContext = React.createContext<SidebarContext | null>(null);
|
|
203
203
|
|
|
204
|
+
/** Returns the Sidebar context (state, toggle, and mobile controls). */
|
|
204
205
|
function useSidebar() {
|
|
205
206
|
const context = React.useContext(SidebarContext);
|
|
206
207
|
if (!context) {
|
|
@@ -871,7 +872,7 @@ const sidebarGroupLabelVariants = cva(
|
|
|
871
872
|
variants: {
|
|
872
873
|
size: {
|
|
873
874
|
default: "text-label",
|
|
874
|
-
sm: "text-label",
|
|
875
|
+
sm: "text-label-sm",
|
|
875
876
|
xs: "text-label-sm",
|
|
876
877
|
},
|
|
877
878
|
variant: {
|
|
@@ -1863,8 +1864,9 @@ interface SidebarPopoverTriggerProps extends React.ComponentProps<"button"> {
|
|
|
1863
1864
|
*/
|
|
1864
1865
|
icon?: React.ReactNode;
|
|
1865
1866
|
/**
|
|
1866
|
-
* Accessible
|
|
1867
|
-
*
|
|
1867
|
+
* Accessible name for the trigger button. Overrides the visible text, so
|
|
1868
|
+
* when set it must contain that text (WCAG 2.5.3 Label in Name).
|
|
1869
|
+
* @default undefined — the button is named by its visible text
|
|
1868
1870
|
*/
|
|
1869
1871
|
triggerAriaLabel?: string;
|
|
1870
1872
|
}
|
|
@@ -1887,7 +1889,9 @@ const SidebarPopoverTrigger = React.forwardRef<
|
|
|
1887
1889
|
return (
|
|
1888
1890
|
<button
|
|
1889
1891
|
ref={ref}
|
|
1890
|
-
|
|
1892
|
+
// Named by its visible text by default (WCAG 2.5.3 Label in Name);
|
|
1893
|
+
// Radix adds aria-haspopup/aria-expanded, which announce the popover.
|
|
1894
|
+
aria-label={triggerAriaLabel || undefined}
|
|
1891
1895
|
className={cn(
|
|
1892
1896
|
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground duration-fast text-heading-compact flex items-center gap-2 rounded-md px-1.5 py-2 transition-colors ease-out outline-none",
|
|
1893
1897
|
SIDEBAR_FOCUS_RING,
|
|
@@ -1941,7 +1945,7 @@ const SidebarPopoverMenuItem = React.forwardRef<
|
|
|
1941
1945
|
<button
|
|
1942
1946
|
ref={ref}
|
|
1943
1947
|
className={cn(
|
|
1944
|
-
"text-popover-foreground hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground duration-fast text-label flex h-10 w-full items-center gap-2 rounded-xs p-2 transition-colors ease-out outline-none",
|
|
1948
|
+
"text-popover-foreground hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground duration-fast text-label flex min-h-10 w-full items-center gap-2 rounded-xs p-2 transition-colors ease-out outline-none",
|
|
1945
1949
|
SIDEBAR_FOCUS_RING,
|
|
1946
1950
|
className
|
|
1947
1951
|
)}
|
|
@@ -1955,7 +1959,11 @@ const SidebarPopoverMenuItem = React.forwardRef<
|
|
|
1955
1959
|
{icon}
|
|
1956
1960
|
</span>
|
|
1957
1961
|
)}
|
|
1958
|
-
|
|
1962
|
+
{/* Long workspace/location names wrap instead of truncating, so the
|
|
1963
|
+
whole name is readable before switching to it. */}
|
|
1964
|
+
<span className="min-w-px flex-1 text-left wrap-anywhere">
|
|
1965
|
+
{children}
|
|
1966
|
+
</span>
|
|
1959
1967
|
{shortcut && (
|
|
1960
1968
|
<span className="text-popover-foreground/60 text-body-xs shrink-0">
|
|
1961
1969
|
{shortcut}
|
|
@@ -2098,8 +2106,9 @@ interface SidebarSwitcherProps {
|
|
|
2098
2106
|
*/
|
|
2099
2107
|
label: string;
|
|
2100
2108
|
/**
|
|
2101
|
-
* Accessible
|
|
2102
|
-
*
|
|
2109
|
+
* Accessible name for the trigger button. Overrides the visible `label`,
|
|
2110
|
+
* so when set it must contain that text (WCAG 2.5.3 Label in Name).
|
|
2111
|
+
* @default undefined — the button is named by its visible `label`
|
|
2103
2112
|
*/
|
|
2104
2113
|
triggerAriaLabel?: string;
|
|
2105
2114
|
/**
|
|
@@ -2180,8 +2189,11 @@ interface SidebarAccountDropdownProps {
|
|
|
2180
2189
|
}>
|
|
2181
2190
|
>;
|
|
2182
2191
|
/**
|
|
2183
|
-
* Accessible
|
|
2184
|
-
*
|
|
2192
|
+
* Accessible name for the account menu trigger. Overrides the visible
|
|
2193
|
+
* name and email, so when set it must contain them (WCAG 2.5.3 Label in
|
|
2194
|
+
* Name).
|
|
2195
|
+
* @default undefined — the button is named by its visible name and email
|
|
2196
|
+
* (kept as screen-reader-only text while the sidebar is collapsed to icons)
|
|
2185
2197
|
*/
|
|
2186
2198
|
triggerAriaLabel?: string;
|
|
2187
2199
|
/**
|
|
@@ -2219,13 +2231,18 @@ function SidebarAccountDropdown({
|
|
|
2219
2231
|
<DropdownMenu>
|
|
2220
2232
|
<DropdownMenuTrigger asChild>
|
|
2221
2233
|
<SidebarMenuButton
|
|
2222
|
-
|
|
2223
|
-
|
|
2234
|
+
// Named by its visible name and email by default (WCAG 2.5.3 Label
|
|
2235
|
+
// in Name); an empty override falls through to that text too.
|
|
2236
|
+
aria-label={triggerAriaLabel || undefined}
|
|
2237
|
+
className="relative h-auto py-1.5"
|
|
2224
2238
|
dataHook={`${dataHook}-button`}
|
|
2225
2239
|
size={SidebarMenuButtonSize.LG}
|
|
2226
2240
|
>
|
|
2227
2241
|
{avatar}
|
|
2228
|
-
|
|
2242
|
+
{/* Collapsed to icons (collapsible="icon" only) the button hides its
|
|
2243
|
+
text children; this column stays in the accessibility tree as
|
|
2244
|
+
sr-only, so the avatar-only button keeps its name. */}
|
|
2245
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5 group-data-[collapsible=icon]:sr-only group-data-[collapsible=icon]:flex!">
|
|
2229
2246
|
<span className="text-heading-compact truncate">{name}</span>
|
|
2230
2247
|
<span className="text-body-xs truncate">{email}</span>
|
|
2231
2248
|
</div>
|
|
@@ -2240,11 +2257,17 @@ function SidebarAccountDropdown({
|
|
|
2240
2257
|
side={side}
|
|
2241
2258
|
sideOffset={4}
|
|
2242
2259
|
>
|
|
2243
|
-
|
|
2260
|
+
{/* The menu header is where the full name and email live: the
|
|
2261
|
+
trigger row truncates them, so here they wrap (an address with no
|
|
2262
|
+
spaces breaks anywhere) and stay selectable for copying. */}
|
|
2263
|
+
<DropdownMenuLabel
|
|
2264
|
+
className="flex items-center gap-2 px-1 py-1.5"
|
|
2265
|
+
dataHook={`${dataHook}-header`}
|
|
2266
|
+
>
|
|
2244
2267
|
{avatar}
|
|
2245
2268
|
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
2246
|
-
<span className="text-heading-compact
|
|
2247
|
-
<span className="text-body-xs
|
|
2269
|
+
<span className="text-heading-compact wrap-anywhere">{name}</span>
|
|
2270
|
+
<span className="text-body-xs wrap-anywhere">{email}</span>
|
|
2248
2271
|
</div>
|
|
2249
2272
|
</DropdownMenuLabel>
|
|
2250
2273
|
{children ??
|
|
@@ -82,10 +82,24 @@ const AlertDialogOverlay = React.forwardRef<
|
|
|
82
82
|
|
|
83
83
|
AlertDialogOverlay.displayName = "AlertDialogOverlay";
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Props for the AlertDialogContent component
|
|
87
|
+
*/
|
|
88
|
+
interface AlertDialogContentProps extends React.ComponentProps<
|
|
89
|
+
typeof AlertDialogPrimitive.Content
|
|
90
|
+
> {
|
|
91
|
+
/**
|
|
92
|
+
* Data hook for automated testing, rendered as `data-hook` on the dialog
|
|
93
|
+
* panel (the `role="alertdialog"` element)
|
|
94
|
+
* @example "delete-location-dialog-content"
|
|
95
|
+
*/
|
|
96
|
+
dataHook?: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
85
99
|
const AlertDialogContent = React.forwardRef<
|
|
86
100
|
React.ComponentRef<typeof AlertDialogPrimitive.Content>,
|
|
87
|
-
|
|
88
|
-
>(({ className, ...props }, ref) => {
|
|
101
|
+
AlertDialogContentProps
|
|
102
|
+
>(({ className, dataHook, ...props }, ref) => {
|
|
89
103
|
// Safety net for the Radix dismissable-layer body-lock leak (DS-634).
|
|
90
104
|
useOverlayPointerLock();
|
|
91
105
|
|
|
@@ -98,6 +112,7 @@ const AlertDialogContent = React.forwardRef<
|
|
|
98
112
|
"border-border bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=open]:duration-slow fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg ease-out data-[state=closed]:duration-250 data-[state=closed]:ease-in sm:max-w-lg",
|
|
99
113
|
className
|
|
100
114
|
)}
|
|
115
|
+
data-hook={dataHook}
|
|
101
116
|
data-slot="alert-dialog-content"
|
|
102
117
|
{...props}
|
|
103
118
|
/>
|
|
@@ -283,6 +298,7 @@ export type {
|
|
|
283
298
|
AlertDialogActionProps,
|
|
284
299
|
AlertDialogActionVariant,
|
|
285
300
|
AlertDialogCancelProps,
|
|
301
|
+
AlertDialogContentProps,
|
|
286
302
|
AlertDialogDescriptionProps,
|
|
287
303
|
AlertDialogProps,
|
|
288
304
|
AlertDialogTitleProps,
|