@brightlocal/ui-components 2.27.0 → 3.1.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 +7 -1
- package/component-meta.json +568 -143
- package/deprecations.json +298 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +74 -61
- 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 +147 -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-screen.d.ts → progress-state.d.ts} +30 -18
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/{progress-screen.js → progress-state.js} +100 -71
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +160 -161
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-group.cjs +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +47 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +12 -12
- 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 +42 -3
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +102 -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 +46 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +172 -157
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +38 -4
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +100 -84
- package/dist/combobox.cjs +2 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +81 -79
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +248 -225
- 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 +75 -10
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +346 -334
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +13 -5
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +54 -53
- 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 +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +96 -65
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +130 -12
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -127
- 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/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -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 +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +554 -527
- 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.d.ts +17 -9
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +73 -72
- 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/empty-chip.cjs +1 -0
- package/dist/lib/empty-chip.d.ts +4 -0
- package/dist/lib/empty-chip.d.ts.map +1 -0
- package/dist/lib/empty-chip.js +13 -0
- 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/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +62 -58
- 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 +130 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +193 -102
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +2 -26
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +79 -118
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +15 -6
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +38 -36
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +13 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +92 -87
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +2 -2
- 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.js +26 -26
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +40 -40
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +31 -28
- 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 +129 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +95 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +127 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +92 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +35 -7
- package/src/blocks/empty-state.tsx +412 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/{progress-screen.tsx → progress-state.tsx} +154 -93
- package/src/blocks/sidebar.tsx +25 -26
- package/src/components/accordion.tsx +82 -27
- 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 +1 -1
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +4 -4
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +89 -19
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +103 -32
- package/src/components/chip.tsx +88 -13
- package/src/components/combobox.tsx +12 -10
- package/src/components/command.tsx +64 -13
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +135 -20
- package/src/components/date-picker.tsx +18 -7
- 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 +89 -16
- package/src/components/global-layout.tsx +210 -39
- 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 +24 -12
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/list.tsx +13 -9
- 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 +286 -1
- package/src/components/progress.tsx +35 -113
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +35 -10
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +2 -2
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +2 -2
- package/src/components/stepper.tsx +3 -3
- package/src/components/table.tsx +6 -3
- 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 +253 -0
- package/src/components/typography-text.tsx +250 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +11 -1
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/empty-chip.ts +24 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
- package/dist/blocks/progress-screen.cjs +0 -1
- package/dist/blocks/progress-screen.d.ts.map +0 -1
|
@@ -4,10 +4,15 @@ import * as React from "react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
import { Progress } from "../components/progress";
|
|
7
|
-
import {
|
|
7
|
+
import { TypographyHeading } from "../components/typography-heading";
|
|
8
|
+
import { TypographyText } from "../components/typography-text";
|
|
9
|
+
import {
|
|
10
|
+
BLOCK_ILLUSTRATION_SIZE,
|
|
11
|
+
BlockIllustration,
|
|
12
|
+
} from "../lib/block-illustration";
|
|
8
13
|
|
|
9
14
|
/* -------------------------------------------------------------------------------------------------
|
|
10
|
-
*
|
|
15
|
+
* ProgressState
|
|
11
16
|
*
|
|
12
17
|
* The Progress screen pattern (Patterns/Loading → Progress screen) as a block:
|
|
13
18
|
* the state
|
|
@@ -15,22 +20,28 @@ import { TypographyH2, TypographyMuted } from "../components/typography";
|
|
|
15
20
|
* seconds. It answers what the person is actually asking: is it working, what is
|
|
16
21
|
* it doing, can I leave?
|
|
17
22
|
*
|
|
18
|
-
* The block owns what every tool shares — the
|
|
23
|
+
* The block owns what every tool shares — the column, the heading and
|
|
19
24
|
* description treatment, the busy semantics, the live region, and the spacing.
|
|
20
|
-
* The tool supplies the copy, and the illustration where there is one.
|
|
25
|
+
* The tool supplies the copy, and the illustration where there is one. Pure
|
|
26
|
+
* content: WHERE the screen sits is the consumer's composition — the page
|
|
27
|
+
* recipe is `<Grid variant="centered">` around it, the same optical spot an
|
|
28
|
+
* empty page uses, so the two never shift the furniture between them.
|
|
21
29
|
*
|
|
22
30
|
* There are exactly two states, and `value` picks between them:
|
|
23
31
|
* value set → the tool's illustration over a determinate bar showing real
|
|
24
|
-
* backend progress
|
|
25
|
-
* value not set → the cel loop and nothing else: no bar,
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* and the description says the rest.
|
|
32
|
+
* backend progress.
|
|
33
|
+
* value not set → the cel loop and nothing else: no bar, because there is
|
|
34
|
+
* nothing to measure. The motion says the run is alive and
|
|
35
|
+
* the description says the rest.
|
|
29
36
|
* Never invent a percentage to get the first one.
|
|
37
|
+
*
|
|
38
|
+
* Neither state names the current step. A step line was tried and removed:
|
|
39
|
+
* `description` already carries what the run is doing, and it is the live
|
|
40
|
+
* region, so a second moving line beside it was two voices for one wait.
|
|
30
41
|
* -----------------------------------------------------------------------------------------------*/
|
|
31
42
|
|
|
32
43
|
/* -------------------------------------------------------------------------------------------------
|
|
33
|
-
*
|
|
44
|
+
* ProgressStateCelMotion (private)
|
|
34
45
|
*
|
|
35
46
|
* A hand-drawn cel loop: a sheet leaves the shop, folds into a paper plane,
|
|
36
47
|
* flies across and drops into a folder, and both containers take a small knock
|
|
@@ -240,16 +251,29 @@ function CelFolder() {
|
|
|
240
251
|
}
|
|
241
252
|
|
|
242
253
|
/** The whole cel stage: an inline-size container every layer is measured in. */
|
|
243
|
-
function
|
|
254
|
+
function ProgressStateCelMotion() {
|
|
244
255
|
return (
|
|
245
256
|
<div
|
|
246
257
|
aria-hidden="true"
|
|
247
258
|
className="text-foreground w-full max-w-lg"
|
|
248
|
-
data-slot="progress-
|
|
259
|
+
data-slot="progress-state-motion"
|
|
249
260
|
style={{ containerType: "inline-size" }}
|
|
250
261
|
>
|
|
262
|
+
{/* The drawn composition does not fill its stage evenly — the shop
|
|
263
|
+
starts 6.6% in from the left edge while the folder ends 12.1% in
|
|
264
|
+
from the right — so the artwork's own centre sits 2.734% left of the
|
|
265
|
+
stage's. Left uncorrected it reads as the whole illustration being
|
|
266
|
+
off-axis from the title under it, since the title centres on the
|
|
267
|
+
stage box and the eye centres on the ink. Shifting the composition,
|
|
268
|
+
not the drawing: every layer keeps its coordinates relative to the
|
|
269
|
+
others.
|
|
270
|
+
|
|
271
|
+
A percentage, not the `cqw` the layers inside use: translateX
|
|
272
|
+
resolves a percentage against the element's own width, and this
|
|
273
|
+
element is the full stage width, so the two are the same number here
|
|
274
|
+
— and a percentage needs no container context to resolve. */}
|
|
251
275
|
<div
|
|
252
|
-
className="relative w-full"
|
|
276
|
+
className="relative w-full translate-x-[2.734%]"
|
|
253
277
|
style={{ aspectRatio: CEL_STAGE_ASPECT }}
|
|
254
278
|
>
|
|
255
279
|
<CelStore />
|
|
@@ -262,10 +286,10 @@ function ProgressScreenCelMotion() {
|
|
|
262
286
|
}
|
|
263
287
|
|
|
264
288
|
/**
|
|
265
|
-
* Props for the
|
|
289
|
+
* Props for the ProgressState block.
|
|
266
290
|
* Extends native `section` props; `title` is overridden to accept rich content.
|
|
267
291
|
*/
|
|
268
|
-
export interface
|
|
292
|
+
export interface ProgressStateProps extends Omit<
|
|
269
293
|
React.ComponentPropsWithoutRef<"section">,
|
|
270
294
|
"title" | "children"
|
|
271
295
|
> {
|
|
@@ -282,7 +306,14 @@ export interface ProgressScreenProps extends Omit<
|
|
|
282
306
|
* the thing being generated. The indeterminate state falls back to the cel
|
|
283
307
|
* loop, which is doing the work the missing progress bar cannot — pass an
|
|
284
308
|
* illustration there only if you mean to trade that motion away.
|
|
285
|
-
*
|
|
309
|
+
*
|
|
310
|
+
* Pass the illustration itself — do NOT set a size. The block renders it
|
|
311
|
+
* at the 130 the design specifies, whatever size the element carries, so
|
|
312
|
+
* there is no number to get wrong per call site. The illustration is the
|
|
313
|
+
* title's companion, not the subject of the screen: much larger and it
|
|
314
|
+
* outweighs the 24px heading under it, and the eye lands on the artwork
|
|
315
|
+
* instead of the words that say what is happening.
|
|
316
|
+
* @example <MapMagnifyingGlassSearchLocation aria-hidden />
|
|
286
317
|
*/
|
|
287
318
|
illustration?: React.ReactNode;
|
|
288
319
|
/**
|
|
@@ -317,14 +348,6 @@ export interface ProgressScreenProps extends Omit<
|
|
|
317
348
|
* @default true
|
|
318
349
|
*/
|
|
319
350
|
showProgressValue?: boolean;
|
|
320
|
-
/**
|
|
321
|
-
* The step the run is on right now, shown on its own line above the bar.
|
|
322
|
-
* Determinate state only — it belongs to Progress, so it goes where the bar
|
|
323
|
-
* goes. On the indeterminate state, put anything the run can say about
|
|
324
|
-
* itself in `description`.
|
|
325
|
-
* @example "Scanning search results across your area"
|
|
326
|
-
*/
|
|
327
|
-
progressStatusDescription?: React.ReactNode;
|
|
328
351
|
/**
|
|
329
352
|
* Accessible label for the progress bar. Determinate state only.
|
|
330
353
|
* @default "Generation progress"
|
|
@@ -353,24 +376,23 @@ export interface ProgressScreenProps extends Omit<
|
|
|
353
376
|
* @example
|
|
354
377
|
* ```tsx
|
|
355
378
|
* // The backend reports real progress.
|
|
356
|
-
* <
|
|
379
|
+
* <ProgressState
|
|
357
380
|
* dataHook="lsg-generating"
|
|
358
|
-
* illustration={<MapMagnifyingGlassSearchLocation aria-hidden
|
|
381
|
+
* illustration={<MapMagnifyingGlassSearchLocation aria-hidden />}
|
|
359
382
|
* title={t("reports.building.title")}
|
|
360
383
|
* description={t("reports.building.description")}
|
|
361
|
-
* progressStatusDescription={t(`reports.building.stages.${run.stage}`)}
|
|
362
384
|
* value={run.percent}
|
|
363
385
|
* />
|
|
364
386
|
*
|
|
365
387
|
* // It reports nothing, but the run is underway.
|
|
366
|
-
* <
|
|
388
|
+
* <ProgressState
|
|
367
389
|
* dataHook="lsg-generating"
|
|
368
390
|
* title={t("reports.building.title")}
|
|
369
391
|
* description={t("reports.building.description")}
|
|
370
392
|
* />
|
|
371
393
|
* ```
|
|
372
394
|
*/
|
|
373
|
-
const
|
|
395
|
+
const ProgressState = React.forwardRef<HTMLElement, ProgressStateProps>(
|
|
374
396
|
(
|
|
375
397
|
{
|
|
376
398
|
className,
|
|
@@ -382,7 +404,6 @@ const ProgressScreen = React.forwardRef<HTMLElement, ProgressScreenProps>(
|
|
|
382
404
|
max = 100,
|
|
383
405
|
progressUnit = "%",
|
|
384
406
|
showProgressValue = true,
|
|
385
|
-
progressStatusDescription,
|
|
386
407
|
progressLabel,
|
|
387
408
|
trackingEl,
|
|
388
409
|
trackingLabel,
|
|
@@ -397,85 +418,125 @@ const ProgressScreen = React.forwardRef<HTMLElement, ProgressScreenProps>(
|
|
|
397
418
|
<section
|
|
398
419
|
ref={ref}
|
|
399
420
|
aria-busy="true"
|
|
400
|
-
className={cn("flex
|
|
421
|
+
className={cn("flex w-full flex-col items-center", className)}
|
|
401
422
|
data-hook={dataHook}
|
|
402
|
-
data-slot="progress-
|
|
403
|
-
data-tracking-el={trackingEl ?? "progress-
|
|
423
|
+
data-slot="progress-state"
|
|
424
|
+
data-tracking-el={trackingEl ?? "progress-state"}
|
|
404
425
|
data-tracking-label={trackingLabel}
|
|
405
426
|
{...props}
|
|
406
427
|
>
|
|
407
|
-
{/*
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
than overflowing. */}
|
|
412
|
-
<div aria-hidden="true" className="flex-1" />
|
|
413
|
-
|
|
414
|
-
<div className="flex w-full flex-col items-center gap-8">
|
|
428
|
+
{/* 24px between the illustration and the text block (spacing/6 in
|
|
429
|
+
Figma) — the artwork needs more air than the copy; the title,
|
|
430
|
+
the description and the bar keep their own 16px rhythm below. */}
|
|
431
|
+
<div className="flex w-full flex-col items-center gap-6">
|
|
415
432
|
{illustration ? (
|
|
416
|
-
<
|
|
433
|
+
<BlockIllustration
|
|
434
|
+
size={BLOCK_ILLUSTRATION_SIZE}
|
|
435
|
+
slot="progress-state-illustration"
|
|
436
|
+
>
|
|
437
|
+
{illustration}
|
|
438
|
+
</BlockIllustration>
|
|
417
439
|
) : hasProgress ? null : (
|
|
418
|
-
<
|
|
440
|
+
<ProgressStateCelMotion />
|
|
419
441
|
)}
|
|
420
442
|
|
|
421
|
-
<div
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
443
|
+
<div className="flex w-full flex-col items-center gap-4">
|
|
444
|
+
{/* The title and its description are the one pair that sits
|
|
445
|
+
tighter, at 8px: they are a heading and its own supporting
|
|
446
|
+
line, not two items in the stack. It also corrects for the
|
|
447
|
+
type — the 24/32 title carries 4px of leading below it and
|
|
448
|
+
the 14/20 description 3px above, so a 16px box gap draws 23px
|
|
449
|
+
and reads looser here than anywhere else in the column. 8px
|
|
450
|
+
lands at ~15px optical. */}
|
|
451
|
+
<div
|
|
452
|
+
className="flex w-full flex-col items-center gap-2"
|
|
453
|
+
data-slot="progress-state-text"
|
|
454
|
+
>
|
|
455
|
+
{/* `page` is the scale's 24px Poppins role — the size the design
|
|
456
|
+
specifies. Level 2, not 1: the running state is the page
|
|
457
|
+
body under the layout's own page header. */}
|
|
458
|
+
<TypographyHeading
|
|
459
|
+
align="center"
|
|
460
|
+
dataHook={`${dataHook}-title`}
|
|
461
|
+
level={2}
|
|
462
|
+
variant="page"
|
|
463
|
+
>
|
|
464
|
+
{title}
|
|
465
|
+
</TypographyHeading>
|
|
466
|
+
{description ? (
|
|
467
|
+
/* Polite, not assertive: real stages are minutes apart, so
|
|
468
|
+
this announces a handful of times across a run — never on a
|
|
469
|
+
tick.
|
|
470
|
+
|
|
471
|
+
Capped narrower than the bar (28rem against the bar's
|
|
472
|
+
32rem), so the copy breaks into short centred lines instead
|
|
473
|
+
of running the full width of the indicator under it. */
|
|
474
|
+
<div
|
|
475
|
+
aria-live="polite"
|
|
476
|
+
className="max-w-md"
|
|
477
|
+
data-slot="progress-state-description"
|
|
435
478
|
>
|
|
436
|
-
|
|
437
|
-
|
|
479
|
+
<TypographyText
|
|
480
|
+
align="center"
|
|
481
|
+
color="muted"
|
|
482
|
+
dataHook={`${dataHook}-description`}
|
|
483
|
+
variant="body-sm"
|
|
484
|
+
>
|
|
485
|
+
{description}
|
|
486
|
+
</TypographyText>
|
|
487
|
+
</div>
|
|
488
|
+
) : null}
|
|
489
|
+
</div>
|
|
490
|
+
|
|
491
|
+
{/* The bar is the whole of the determinate state's apparatus, and
|
|
492
|
+
it only exists when there is a number behind it — the
|
|
493
|
+
indeterminate state has none, and the cel loop says the run is
|
|
494
|
+
alive while the description says the rest. */}
|
|
495
|
+
{hasProgress ? (
|
|
496
|
+
/* `justify-center` keeps the bar on the same axis as the title
|
|
497
|
+
and description above it; the value keeps its own
|
|
498
|
+
`text-right` against the bar. */
|
|
499
|
+
<div
|
|
500
|
+
className="flex w-full max-w-xl justify-center"
|
|
501
|
+
data-slot="progress-state-indicator"
|
|
502
|
+
>
|
|
503
|
+
{/* `sm` — the bar sits under a display title and a muted
|
|
504
|
+
description, so the roomier `md` reads as heavy here: it
|
|
505
|
+
outweighs the text it is meant to support. */}
|
|
506
|
+
<Progress
|
|
507
|
+
ariaLabel={progressLabel ?? "Generation progress"}
|
|
508
|
+
dataHook={`${dataHook}-progress`}
|
|
509
|
+
max={max}
|
|
510
|
+
showValue={showProgressValue}
|
|
511
|
+
size="sm"
|
|
512
|
+
unit={progressUnit}
|
|
513
|
+
value={value ?? undefined}
|
|
514
|
+
/>
|
|
438
515
|
</div>
|
|
439
516
|
) : null}
|
|
440
517
|
</div>
|
|
441
|
-
|
|
442
|
-
{/* The indicator is the whole of the determinate state's apparatus:
|
|
443
|
-
the bar and the status line are one thing, and the status line is
|
|
444
|
-
Progress's, not the block's. With no bar there is nothing to hang
|
|
445
|
-
it on, so the indeterminate state has neither — the cel loop says
|
|
446
|
-
the run is alive and the description says the rest. */}
|
|
447
|
-
{hasProgress ? (
|
|
448
|
-
/* `text-center` centres the Progress status line with the title and
|
|
449
|
-
description above it — on this screen everything sits on one axis,
|
|
450
|
-
where a left-aligned status reads as a misalignment. It works by
|
|
451
|
-
inheritance: the status sets no alignment of its own, while the
|
|
452
|
-
value keeps its explicit `text-right` against the bar. */
|
|
453
|
-
<div
|
|
454
|
-
className="flex w-full max-w-xl justify-center text-center"
|
|
455
|
-
data-slot="progress-screen-indicator"
|
|
456
|
-
>
|
|
457
|
-
{/* `md` — this is a full page, not a metric row in a card, so the
|
|
458
|
-
bar and its text take the roomier of the two sizes. */}
|
|
459
|
-
<Progress
|
|
460
|
-
ariaLabel={progressLabel ?? "Generation progress"}
|
|
461
|
-
dataHook={`${dataHook}-progress`}
|
|
462
|
-
max={max}
|
|
463
|
-
showValue={showProgressValue}
|
|
464
|
-
size="md"
|
|
465
|
-
statusDescription={progressStatusDescription}
|
|
466
|
-
unit={progressUnit}
|
|
467
|
-
value={value ?? undefined}
|
|
468
|
-
/>
|
|
469
|
-
</div>
|
|
470
|
-
) : null}
|
|
471
518
|
</div>
|
|
472
|
-
|
|
473
|
-
<div aria-hidden="true" className="flex-[1.3]" />
|
|
474
519
|
</section>
|
|
475
520
|
);
|
|
476
521
|
}
|
|
477
522
|
);
|
|
478
523
|
|
|
479
|
-
|
|
524
|
+
ProgressState.displayName = "ProgressState";
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* The block's previous name.
|
|
528
|
+
*
|
|
529
|
+
* @deprecated Use `ProgressState`. The suffix says what the component owns: a
|
|
530
|
+
* named state of a surface, at every scope it has — and this one already served
|
|
531
|
+
* a section boundary as well as a page. `ProgressScreen` will be removed in the
|
|
532
|
+
* next major; the import path `@brightlocal/ui-components/progress-screen` still
|
|
533
|
+
* resolves to this file in the meantime (DS-931).
|
|
534
|
+
*/
|
|
535
|
+
const ProgressScreen = ProgressState;
|
|
480
536
|
|
|
481
|
-
export { ProgressScreen };
|
|
537
|
+
export { ProgressState, ProgressScreen };
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* @deprecated Use `ProgressStateProps`.
|
|
541
|
+
*/
|
|
542
|
+
export type ProgressScreenProps = ProgressStateProps;
|
package/src/blocks/sidebar.tsx
CHANGED
|
@@ -864,15 +864,15 @@ SidebarGroup.displayName = "SidebarGroup";
|
|
|
864
864
|
|
|
865
865
|
const sidebarGroupLabelVariants = cva(
|
|
866
866
|
[
|
|
867
|
-
"flex h-8 shrink-0 items-center rounded-md px-2
|
|
867
|
+
"flex h-8 shrink-0 items-center rounded-md px-2 text-sidebar-foreground/70 outline-none transition-[margin,opacity] duration-base ease-linear [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
868
868
|
SIDEBAR_FOCUS_RING,
|
|
869
869
|
],
|
|
870
870
|
{
|
|
871
871
|
variants: {
|
|
872
872
|
size: {
|
|
873
|
-
default: "text-
|
|
874
|
-
sm: "text-
|
|
875
|
-
xs: "text-
|
|
873
|
+
default: "text-label",
|
|
874
|
+
sm: "text-label",
|
|
875
|
+
xs: "text-label-sm",
|
|
876
876
|
},
|
|
877
877
|
variant: {
|
|
878
878
|
default: "",
|
|
@@ -1050,7 +1050,7 @@ const SidebarGroupContent = React.forwardRef<
|
|
|
1050
1050
|
>(({ className, dataHook, ...props }, ref) => (
|
|
1051
1051
|
<div
|
|
1052
1052
|
ref={ref}
|
|
1053
|
-
className={cn("w-full
|
|
1053
|
+
className={cn("text-body-sm w-full", className)}
|
|
1054
1054
|
data-hook={dataHook}
|
|
1055
1055
|
data-slot="sidebar-group-content"
|
|
1056
1056
|
{...props}
|
|
@@ -1160,7 +1160,7 @@ SidebarCollapseIcon.displayName = "SidebarCollapseIcon";
|
|
|
1160
1160
|
|
|
1161
1161
|
const sidebarMenuButtonVariants = cva(
|
|
1162
1162
|
[
|
|
1163
|
-
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-4 py-2 text-left text-
|
|
1163
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-4 py-2 text-left text-label outline-none transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-base ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:not([data-slot])]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",
|
|
1164
1164
|
SIDEBAR_FOCUS_RING,
|
|
1165
1165
|
],
|
|
1166
1166
|
{
|
|
@@ -1183,9 +1183,9 @@ const sidebarMenuButtonVariants = cva(
|
|
|
1183
1183
|
"px-3 [&>[data-checkbox]]:size-4 [&>[data-checkbox]]:shrink-0 [&>[data-checkbox]]:rounded [&>[data-checkbox]]:border [&>[data-checkbox]]:border-sidebar-foreground/30 data-[checked=true]:[&>[data-checkbox]]:bg-primary data-[checked=true]:[&>[data-checkbox]]:border-primary data-[checked=true]:[&>[data-checkbox]]:text-primary-foreground",
|
|
1184
1184
|
},
|
|
1185
1185
|
size: {
|
|
1186
|
-
default: "h-12
|
|
1187
|
-
sm: "h-7 text-
|
|
1188
|
-
lg: "h-12
|
|
1186
|
+
default: "h-12",
|
|
1187
|
+
sm: "h-7 text-label-sm",
|
|
1188
|
+
lg: "h-12 group-data-[collapsible=icon]:!p-0",
|
|
1189
1189
|
},
|
|
1190
1190
|
},
|
|
1191
1191
|
defaultVariants: {
|
|
@@ -1349,7 +1349,7 @@ const SidebarMenuBadge = React.forwardRef<
|
|
|
1349
1349
|
<div
|
|
1350
1350
|
ref={ref}
|
|
1351
1351
|
className={cn(
|
|
1352
|
-
"text-sidebar-foreground pointer-events-none absolute inset-y-0 right-4 my-auto flex h-5 min-w-5 items-center justify-center rounded-md px-1
|
|
1352
|
+
"text-sidebar-foreground text-label-sm pointer-events-none absolute inset-y-0 right-4 my-auto flex h-5 min-w-5 items-center justify-center rounded-md px-1 tabular-nums select-none",
|
|
1353
1353
|
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
1354
1354
|
"group-data-[collapsible=icon]:hidden",
|
|
1355
1355
|
className
|
|
@@ -1524,11 +1524,10 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
1524
1524
|
<Comp
|
|
1525
1525
|
ref={ref}
|
|
1526
1526
|
className={cn(
|
|
1527
|
-
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground duration-fast flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] ease-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:not([data-slot])]:truncate [&>svg]:shrink-0",
|
|
1527
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground text-label duration-fast flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] ease-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:not([data-slot])]:truncate [&>svg]:shrink-0",
|
|
1528
1528
|
SIDEBAR_FOCUS_RING,
|
|
1529
1529
|
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
1530
|
-
size === SidebarMenuSubButtonSize.SM && "text-
|
|
1531
|
-
size === SidebarMenuSubButtonSize.MD && "text-sm",
|
|
1530
|
+
size === SidebarMenuSubButtonSize.SM && "text-label-sm",
|
|
1532
1531
|
"group-data-[collapsible=icon]:hidden",
|
|
1533
1532
|
className
|
|
1534
1533
|
)}
|
|
@@ -1816,7 +1815,7 @@ const SidebarPopoverTrigger = React.forwardRef<
|
|
|
1816
1815
|
ref={ref}
|
|
1817
1816
|
aria-label={triggerAriaLabel ?? "Switch workspace"}
|
|
1818
1817
|
className={cn(
|
|
1819
|
-
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground duration-fast flex items-center gap-2 rounded-md px-1.5 py-2
|
|
1818
|
+
"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",
|
|
1820
1819
|
SIDEBAR_FOCUS_RING,
|
|
1821
1820
|
className
|
|
1822
1821
|
)}
|
|
@@ -1868,7 +1867,7 @@ const SidebarPopoverMenuItem = React.forwardRef<
|
|
|
1868
1867
|
<button
|
|
1869
1868
|
ref={ref}
|
|
1870
1869
|
className={cn(
|
|
1871
|
-
"text-popover-foreground hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground duration-fast flex h-10 w-full items-center gap-2 rounded-xs p-2
|
|
1870
|
+
"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",
|
|
1872
1871
|
SIDEBAR_FOCUS_RING,
|
|
1873
1872
|
className
|
|
1874
1873
|
)}
|
|
@@ -1884,7 +1883,7 @@ const SidebarPopoverMenuItem = React.forwardRef<
|
|
|
1884
1883
|
)}
|
|
1885
1884
|
<span className="min-w-px flex-1 truncate text-left">{children}</span>
|
|
1886
1885
|
{shortcut && (
|
|
1887
|
-
<span className="text-popover-foreground/60 shrink-0
|
|
1886
|
+
<span className="text-popover-foreground/60 text-body-xs shrink-0">
|
|
1888
1887
|
{shortcut}
|
|
1889
1888
|
</span>
|
|
1890
1889
|
)}
|
|
@@ -1966,7 +1965,7 @@ const SidebarPopoverMenu = React.forwardRef<
|
|
|
1966
1965
|
<div className="flex flex-col items-start p-1">
|
|
1967
1966
|
{groupTitle && (
|
|
1968
1967
|
<div className="flex w-full items-center px-2 py-1.5">
|
|
1969
|
-
<span className="text-muted-foreground
|
|
1968
|
+
<span className="text-muted-foreground text-label-sm flex-1">
|
|
1970
1969
|
{groupTitle}
|
|
1971
1970
|
</span>
|
|
1972
1971
|
</div>
|
|
@@ -2144,9 +2143,9 @@ function SidebarAccountDropdown({
|
|
|
2144
2143
|
size={SidebarMenuButtonSize.LG}
|
|
2145
2144
|
>
|
|
2146
2145
|
{avatar}
|
|
2147
|
-
<div className="flex min-w-0 flex-1 flex-col gap-0.5
|
|
2148
|
-
<span className="
|
|
2149
|
-
<span className="
|
|
2146
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
2147
|
+
<span className="text-heading-compact truncate">{name}</span>
|
|
2148
|
+
<span className="text-body-xs truncate">{email}</span>
|
|
2150
2149
|
</div>
|
|
2151
2150
|
{/* Dropdown affordance per the DS-860 Figma account row */}
|
|
2152
2151
|
<ChevronsUpDown className="shrink-0" />
|
|
@@ -2163,9 +2162,9 @@ function SidebarAccountDropdown({
|
|
|
2163
2162
|
<>
|
|
2164
2163
|
<DropdownMenuLabel className="flex items-center gap-2 px-1 py-1.5">
|
|
2165
2164
|
{avatar}
|
|
2166
|
-
<div className="flex min-w-0 flex-1 flex-col gap-0.5
|
|
2167
|
-
<span className="
|
|
2168
|
-
<span className="
|
|
2165
|
+
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
2166
|
+
<span className="text-heading-compact truncate">{name}</span>
|
|
2167
|
+
<span className="text-body-xs truncate">{email}</span>
|
|
2169
2168
|
</div>
|
|
2170
2169
|
</DropdownMenuLabel>
|
|
2171
2170
|
{menuGroups?.map((group, groupIndex) => (
|
|
@@ -2246,13 +2245,13 @@ const SidebarInboxItem = React.forwardRef<
|
|
|
2246
2245
|
type="button"
|
|
2247
2246
|
{...props}
|
|
2248
2247
|
>
|
|
2249
|
-
<div className="flex w-full items-center justify-between
|
|
2248
|
+
<div className="text-body-sm flex w-full items-center justify-between">
|
|
2250
2249
|
<span>{senderName}</span>
|
|
2251
2250
|
{timestamp && <span>{timestamp}</span>}
|
|
2252
2251
|
</div>
|
|
2253
|
-
<p className="
|
|
2252
|
+
<p className="text-heading-compact w-full">{title}</p>
|
|
2254
2253
|
{description && (
|
|
2255
|
-
<p className="w-full truncate
|
|
2254
|
+
<p className="text-body-xs w-full truncate">{description}</p>
|
|
2256
2255
|
)}
|
|
2257
2256
|
</button>
|
|
2258
2257
|
);
|
|
@@ -125,6 +125,18 @@ export interface AccordionItemProps extends React.ComponentProps<
|
|
|
125
125
|
* A unique value for the item (REQUIRED)
|
|
126
126
|
*/
|
|
127
127
|
value: string;
|
|
128
|
+
/**
|
|
129
|
+
* Data hook for automated testing
|
|
130
|
+
*/
|
|
131
|
+
dataHook?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Tracking element identifier for analytics
|
|
134
|
+
*/
|
|
135
|
+
trackingEl?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Tracking label for analytics context
|
|
138
|
+
*/
|
|
139
|
+
trackingLabel?: string;
|
|
128
140
|
/**
|
|
129
141
|
* Whether the accordion item is disabled
|
|
130
142
|
*/
|
|
@@ -142,11 +154,14 @@ export interface AccordionItemProps extends React.ComponentProps<
|
|
|
142
154
|
const AccordionItem = React.forwardRef<
|
|
143
155
|
React.ComponentRef<typeof AccordionPrimitive.Item>,
|
|
144
156
|
AccordionItemProps
|
|
145
|
-
>(({ className, ...props }, ref) => (
|
|
157
|
+
>(({ className, dataHook, trackingEl, trackingLabel, ...props }, ref) => (
|
|
146
158
|
<AccordionPrimitive.Item
|
|
147
159
|
ref={ref}
|
|
148
160
|
className={cn("border-b last:border-b-0", className)}
|
|
161
|
+
data-hook={dataHook}
|
|
149
162
|
data-slot="accordion-item"
|
|
163
|
+
data-tracking-el={trackingEl}
|
|
164
|
+
data-tracking-label={trackingLabel}
|
|
150
165
|
{...props}
|
|
151
166
|
/>
|
|
152
167
|
));
|
|
@@ -168,27 +183,47 @@ export interface AccordionTriggerProps extends React.ComponentProps<
|
|
|
168
183
|
* Whether the trigger is disabled
|
|
169
184
|
*/
|
|
170
185
|
disabled?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Data hook for automated testing
|
|
188
|
+
*/
|
|
189
|
+
dataHook?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Tracking element identifier for analytics
|
|
192
|
+
*/
|
|
193
|
+
trackingEl?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Tracking label for analytics context
|
|
196
|
+
*/
|
|
197
|
+
trackingLabel?: string;
|
|
171
198
|
}
|
|
172
199
|
|
|
173
200
|
const AccordionTrigger = React.forwardRef<
|
|
174
201
|
React.ComponentRef<typeof AccordionPrimitive.Trigger>,
|
|
175
202
|
AccordionTriggerProps
|
|
176
|
-
>(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
203
|
+
>(
|
|
204
|
+
(
|
|
205
|
+
{ className, children, dataHook, trackingEl, trackingLabel, ...props },
|
|
206
|
+
ref
|
|
207
|
+
) => (
|
|
208
|
+
<AccordionPrimitive.Header className="flex">
|
|
209
|
+
<AccordionPrimitive.Trigger
|
|
210
|
+
ref={ref}
|
|
211
|
+
className={cn(
|
|
212
|
+
"focus-visible:border-ring focus-visible:shadow-default duration-fast text-label flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left transition-shadow ease-out outline-none hover:underline disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
213
|
+
className
|
|
214
|
+
)}
|
|
215
|
+
data-hook={dataHook}
|
|
216
|
+
data-slot="accordion-trigger"
|
|
217
|
+
data-tracking-el={trackingEl}
|
|
218
|
+
data-tracking-label={trackingLabel}
|
|
219
|
+
{...props}
|
|
220
|
+
>
|
|
221
|
+
{children}
|
|
222
|
+
<ChevronDown className="text-muted-foreground duration-base pointer-events-none shrink-0 translate-y-0.5 transition-transform ease-in-out" />
|
|
223
|
+
</AccordionPrimitive.Trigger>
|
|
224
|
+
</AccordionPrimitive.Header>
|
|
225
|
+
)
|
|
226
|
+
);
|
|
192
227
|
|
|
193
228
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
194
229
|
|
|
@@ -207,21 +242,41 @@ export interface AccordionContentProps extends React.ComponentProps<
|
|
|
207
242
|
* Force mounting of the content when true
|
|
208
243
|
*/
|
|
209
244
|
forceMount?: true;
|
|
245
|
+
/**
|
|
246
|
+
* Data hook for automated testing
|
|
247
|
+
*/
|
|
248
|
+
dataHook?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Tracking element identifier for analytics
|
|
251
|
+
*/
|
|
252
|
+
trackingEl?: string;
|
|
253
|
+
/**
|
|
254
|
+
* Tracking label for analytics context
|
|
255
|
+
*/
|
|
256
|
+
trackingLabel?: string;
|
|
210
257
|
}
|
|
211
258
|
|
|
212
259
|
const AccordionContent = React.forwardRef<
|
|
213
260
|
React.ComponentRef<typeof AccordionPrimitive.Content>,
|
|
214
261
|
AccordionContentProps
|
|
215
|
-
>(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
262
|
+
>(
|
|
263
|
+
(
|
|
264
|
+
{ className, children, dataHook, trackingEl, trackingLabel, ...props },
|
|
265
|
+
ref
|
|
266
|
+
) => (
|
|
267
|
+
<AccordionPrimitive.Content
|
|
268
|
+
ref={ref}
|
|
269
|
+
className="text-body-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden"
|
|
270
|
+
data-hook={dataHook}
|
|
271
|
+
data-slot="accordion-content"
|
|
272
|
+
data-tracking-el={trackingEl}
|
|
273
|
+
data-tracking-label={trackingLabel}
|
|
274
|
+
{...props}
|
|
275
|
+
>
|
|
276
|
+
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
|
277
|
+
</AccordionPrimitive.Content>
|
|
278
|
+
)
|
|
279
|
+
);
|
|
225
280
|
|
|
226
281
|
AccordionContent.displayName = "AccordionContent";
|
|
227
282
|
|