@mediaradar/design-components 0.62.0 → 0.63.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/dist/index.d.cts CHANGED
@@ -324,6 +324,16 @@ interface DeltaProps extends CommonProps {
324
324
  * beside a figure does not need one -- the sign already says which way.
325
325
  */
326
326
  arrow?: boolean;
327
+ /**
328
+ * A worded unit, after a space: "+4 ranks", "−2 ranks", "+1.2 pts". Pass
329
+ * `{ one: "rank", other: "ranks" }` to get the singular for exactly 1, or a
330
+ * plain string to use the same word for every value. Takes the place of
331
+ * `suffix`. Whole numbers show no decimal ("+4 ranks"); others show one.
332
+ */
333
+ unit?: string | {
334
+ one: string;
335
+ other: string;
336
+ };
327
337
  /** Appended after the suffix, e.g. "YoY". Keep it to one or two words. */
328
338
  period?: string;
329
339
  className?: string;
@@ -338,18 +348,28 @@ interface DeltaProps extends CommonProps {
338
348
  * value: number -- sign picks the direction
339
349
  * suffix?: string -- "%" or "pts"
340
350
  * arrow?: boolean (default false) -- direction arrow, for a column scanned rather than read
351
+ * unit?: string | { one: string; other: string } -- worded unit after a space, "+4 ranks"; replaces suffix
341
352
  * period?: string -- e.g. "YoY"
342
- * @tokens text-text-success, text-text-danger
353
+ * @tokens text-text-success, text-text-danger, text-text-tertiary
343
354
  * @dependencies lucide-react
344
355
  * @behavior Takes the type size of whatever contains it rather than setting
345
356
  * its own, because it is inline text inside a table cell or a card rather
346
357
  * than a box of its own -- a fixed size would fight the density its table
347
- * already chose.
358
+ * already chose. A value that rounds to zero at the precision it's shown at
359
+ * (0, or 0.04 shown to one decimal) reads "No change" in grey: no sign, no
360
+ * arrow, no colour. A tiny non-zero change keeps its exact value ("+0.04%")
361
+ * in a Tooltip on hover and in hidden text for screen readers. Inside
362
+ * DataTable's totals row it is semibold, like the row. `unit` writes the change in words after a
363
+ * space ("+4 ranks", "+1 rank", "−2 ranks", "+1.2 pts"): whole numbers have
364
+ * no decimal, others one. Without `unit`, non-zero values read as before
365
+ * ("+6.2%", "−2.1pts"). The minus is a true minus sign (−), as in `numbers.ts`.
348
366
  * @a11y The sign is the point: colour alone cannot carry direction, for
349
367
  * anyone who cannot distinguish the two and for anyone reading it printed or
350
368
  * in greyscale. `+` and `-` are always rendered, so the colour is
351
369
  * reinforcement rather than the only signal. The arrow is decorative and
352
- * hidden, since the sign beside it already says the same thing.
370
+ * hidden, since the sign beside it already says the same thing. Zero is the
371
+ * words "No change", so it never relies on its grey; a rounded-away change
372
+ * is read as "No change (+0.04%)".
353
373
  * @use when showing a change against a previous period beside the figure it
354
374
  * relates to.
355
375
  * @use with `arrow` when deltas run down a column and the reader is scanning
@@ -365,9 +385,12 @@ interface DeltaProps extends CommonProps {
365
385
  * <Delta value={6.2} suffix="%" />
366
386
  * <Delta value={-2.1} suffix="%" period="YoY" />
367
387
  * <Delta value={1.4} suffix="pts" arrow />
388
+ * <Delta value={4} unit={{ one: "rank", other: "ranks" }} /> // +4 ranks
389
+ * <Delta value={1.2} unit="pts" /> // +1.2 pts
390
+ * <Delta value={0} suffix="%" /> // No change
368
391
  * ```
369
392
  */
370
- declare function Delta({ value, suffix, arrow, period, className, testIdPrefix }: DeltaProps): react.JSX.Element;
393
+ declare function Delta({ value, suffix, unit, arrow, period, className, testIdPrefix }: DeltaProps): react.JSX.Element;
371
394
 
372
395
  interface PrimaryBadgeProps extends CommonProps {
373
396
  /** The word on the badge (default "Primary"). Keep it to one word. */
@@ -3554,6 +3577,12 @@ interface DataTableColumn<T, K extends string = string> {
3554
3577
  sortable?: boolean;
3555
3578
  /** The first click's direction: names A→Z (`asc`), numbers largest first (`desc`, the numeric default). */
3556
3579
  firstDir?: SortDir;
3580
+ /**
3581
+ * Tints the column's body cells with the light brand fill, to mark the
3582
+ * column that matters to the reader (their brand). Pair it with a word
3583
+ * ("You") in the header or cells: the tint isn't the only cue.
3584
+ */
3585
+ highlight?: boolean;
3557
3586
  }
3558
3587
  interface DataTableProps<T, K extends string = string> extends CommonProps {
3559
3588
  columns: DataTableColumn<T, K>[];
@@ -3595,8 +3624,48 @@ interface DataTableProps<T, K extends string = string> extends CommonProps {
3595
3624
  * start of the row opens it, and so does a click anywhere else on the row.
3596
3625
  */
3597
3626
  renderExpanded?: (row: T) => ReactNode;
3598
- /** Which rows can open. Default: every row, when `renderExpanded` is set. */
3627
+ /** Which rows can open. Default: every row with `renderExpanded`, or with sub-rows from `subRows`. */
3599
3628
  canExpand?: (row: T) => boolean;
3629
+ /**
3630
+ * Child rows that open under their parent in the same columns (a brand's
3631
+ * products under the brand). Return nothing or `[]` for a row without any.
3632
+ * They open with the row's chevron, sit indented on a light fill, and can't
3633
+ * be ticked or opened themselves (one level). Return them in the current
3634
+ * sort order, as `rows`, so they sort within their parent. A row with
3635
+ * sub-rows uses them instead of `renderExpanded`.
3636
+ */
3637
+ subRows?: (row: T) => T[] | undefined;
3638
+ /**
3639
+ * What the sub-rows are, for the chevron's screen-reader label: "Show 3
3640
+ * products under Nike". Default `{ one: "row", other: "rows" }`.
3641
+ */
3642
+ subRowNoun?: {
3643
+ one: string;
3644
+ other: string;
3645
+ };
3646
+ /**
3647
+ * A totals row, drawn through the same columns as the first body row. It
3648
+ * stays first whatever the sort, on a light fill with bold figures, and
3649
+ * isn't ticked, opened or counted. The name column shows `totalsLabel`.
3650
+ */
3651
+ totalsRow?: T;
3652
+ /** The name column's text in `totalsRow`. Default "Total". */
3653
+ totalsLabel?: string;
3654
+ /**
3655
+ * A click anywhere on the row calls this: for a table whose rows open a
3656
+ * side panel. Clicks on the row's own controls (the name's link, a
3657
+ * checkbox, a menu) and selecting text don't. A table uses this or rows
3658
+ * that open in place (`renderExpanded`, `subRows`), not both: given both,
3659
+ * this wins.
3660
+ */
3661
+ onRowClick?: (row: T) => void;
3662
+ /**
3663
+ * What a row click opens, as screen readers and keyboard users get it:
3664
+ * "Open battle card for Nike". Default "Open " + `rowLabel` ("Open Nike").
3665
+ */
3666
+ rowClickLabel?: (row: T) => string;
3667
+ /** Rows to mark with the light brand fill (the reader's own brand). Pair with a "You" badge in the row. */
3668
+ highlightRow?: (row: T) => boolean;
3600
3669
  /** Names a row for the chevron's and checkbox's screen-reader labels ("Show details for Nike"). */
3601
3670
  rowLabel?: (row: T) => string;
3602
3671
  /**
@@ -3614,6 +3683,24 @@ interface DataTableProps<T, K extends string = string> extends CommonProps {
3614
3683
  selectedCount?: number;
3615
3684
  /** What can be done with the ticked rows (Export, Add to list): shown with the count, where the title's actions were. */
3616
3685
  selectionActions?: ReactNode;
3686
+ /**
3687
+ * Rows that can't be ticked right now, and why ("Up to 7 rows. Untick one
3688
+ * to add another."). Return `false` for a row that can. The checkbox greys
3689
+ * out, stays focusable, and shows the reason on hover and focus.
3690
+ */
3691
+ selectionDisabled?: (row: T) => string | false;
3692
+ /**
3693
+ * The "3 selected · Select all · actions · Clear" bar shown while rows are
3694
+ * ticked. Default `true`; `false` for a picker table, where ticking chooses
3695
+ * what a chart shows rather than rows to act on.
3696
+ */
3697
+ selectionBar?: boolean;
3698
+ /**
3699
+ * The header's tick-all checkbox. Default `true`; `false` for a table with
3700
+ * a limit on ticks (a picker capped at 7), where ticking every row would
3701
+ * break it. The header cell stays, empty.
3702
+ */
3703
+ selectAll?: boolean;
3617
3704
  /** `default` for tables people read and act on; `compact` for reference data and long lists. */
3618
3705
  density?: DataTableDensity;
3619
3706
  /** Shows skeleton rows in the real columns, at the real row height. */
@@ -3662,16 +3749,21 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3662
3749
  * lining figures, so figures sit together at the right edge. Dates are text
3663
3750
  * and sit left. A cell with nothing to show is a grey dash that says why on
3664
3751
  * hover. The default sort's arrow shows before anyone clicks. Rows can open
3665
- * in place, and the name links to the entity's overview (UXD-196).
3752
+ * in place, as a panel or as sub-rows in the same columns, or open a side
3753
+ * panel on click; the name links to the entity's overview (UXD-196). A
3754
+ * totals row can sit first, and the reader's own brand can be marked with a
3755
+ * light brand fill on its row or column.
3666
3756
  * @variant default - Default. Tables people read and act on.
3667
3757
  * @variant compact - Reference data and long lists.
3668
- * @tokens rounded-card, border, border-border-default, bg-surface,
3758
+ * @tokens rounded-card, rounded-small, border, border-border-default, bg-surface,
3669
3759
  * p-card-padding, text-panel-title, text-xs, text-text-tertiary, gap-3,
3670
3760
  * text-left, border-collapse, bg-subtle, text-micro, font-semibold, uppercase,
3671
3761
  * tracking-wider, text-text-secondary, text-right, text-dense,
3672
3762
  * text-text-primary, hover:bg-subtle, tabular-nums, rounded-full,
3673
3763
  * animate-pulse, border-t, decoration-text-tertiary, rounded-control,
3674
- * focus-visible:outline-border-focus, border-r-border-default
3764
+ * focus-visible:outline-border-focus, border-r-border-default,
3765
+ * bg-brand-primaryTint, pl-10, pl-9, cursor-not-allowed, sr-only,
3766
+ * bg-linear-to-r, from-brand-primaryAction/10, border-border-focus
3675
3767
  * @behavior Sorting: a `sortable` column's header gets a SortButton; clicks
3676
3768
  * cycle the column's `firstDir`, then the reverse, then back to
3677
3769
  * `defaultSort` (`cycleSort`), and call `onSortChange`. The sorted column
@@ -3687,6 +3779,41 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3687
3779
  * anywhere else on it does too, except on its own controls (links, buttons,
3688
3780
  * checkboxes, menus) or while selecting text. Several rows can be open;
3689
3781
  * sorting or paging closes them. Rows that can't open have no pointer.
3782
+ * `subRows` gives a row child rows instead of a panel: they open with the
3783
+ * same chevron, directly under the parent as real rows in the same columns,
3784
+ * on the light fill (`bg-subtle`), the name 24px further in and in secondary
3785
+ * ink, the rank cell blank. They can't be ticked or opened (one level). Pass
3786
+ * them sorted like `rows`, so a sort orders children within their parent;
3787
+ * open sub-rows stay open through a sort and close on a page or filter
3788
+ * change. A row with sub-rows uses them; one without uses `renderExpanded`.
3789
+ * `totalsRow` is drawn through the same columns as the first body row, above
3790
+ * every row whatever the sort, on the light fill, all semibold (label,
3791
+ * figures, and any Delta in it); its name cell reads `totalsLabel` ("Total")
3792
+ * and its rank cell is blank. It has
3793
+ * no checkbox or chevron, and isn't counted in the selection or the pages.
3794
+ * It isn't drawn while loading or when there are no rows.
3795
+ * `onRowClick` (a side panel, e.g. a battle card) makes the whole row the
3796
+ * target: pointer and the hover wash, and a click anywhere calls it except on
3797
+ * the row's own controls or while selecting text in it. A table uses it or
3798
+ * rows that open in place, not both; given both, it wins and a dev build
3799
+ * warns. Keyboard: one hidden button per row, in the name cell; while it has
3800
+ * keyboard focus the whole row takes the focus ring, and Enter or Space opens
3801
+ * the panel.
3802
+ * `highlightRow` and a column's `highlight` fill those cells with the light
3803
+ * brand tint (`bg-brand-primaryTint`), which is opaque, so a pinned cell
3804
+ * stays solid. A highlighted column's header cell takes the tint too, so the
3805
+ * column reads as one strip; the totals row keeps its own fill. A
3806
+ * highlighted row with `onRowClick` deepens on hover (a 10% layer of
3807
+ * `brand-primaryAction` over the tint, still opaque); otherwise it keeps its
3808
+ * tint on hover.
3809
+ * `selectionDisabled` returns why a row can't be ticked ("Up to 7 rows.
3810
+ * Untick one to add another.") or `false`. Its checkbox greys out and does
3811
+ * nothing on click or Space; the reason shows in a Tooltip on hover and
3812
+ * focus. The header checkbox, its dash and a shift-click range all skip
3813
+ * those rows. `selectAll={false}` leaves the header cell empty, for a table
3814
+ * with a limit on ticks, where ticking every row would break it.
3815
+ * `selectionBar={false}` leaves out the "3 selected … Clear" bar, for a
3816
+ * picker table where ticking chooses what a chart shows.
3690
3817
  * `maxHeight` makes the body
3691
3818
  * scroll under a pinned header; wide tables always scroll sideways rather than
3692
3819
  * squeeze.
@@ -3695,7 +3822,22 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3695
3822
  * button inside it. A header's `info` shows on hover and keyboard focus and
3696
3823
  * is announced with it. The row's chevron is a button with aria-expanded and
3697
3824
  * a label naming the row ("Show details for Nike"); the row click is only a
3698
- * shortcut for it. `NoValue` reads its reason, not "dash". `loading` sets aria-busy.
3825
+ * shortcut for it. With sub-rows, the chevron says what opens ("Show 3
3826
+ * products under Nike", the noun from `subRowNoun`, default rows), its
3827
+ * aria-controls names the child rows, and each child's name is followed by a
3828
+ * hidden ", in Nike" (from `rowLabel`) so it is announced with its parent.
3829
+ * With `onRowClick`, the row's name cell holds one visually hidden button
3830
+ * per row, in the tab order, named by `rowClickLabel` ("Open battle card for
3831
+ * Nike"; default "Open Nike"); while it has keyboard focus the whole row
3832
+ * shows the 2px focus ring in border-focus, and Enter or Space calls the
3833
+ * same handler. The ring is drawn by the cells (top and bottom on each, the
3834
+ * sides on the first and last), so pinned cells keep it while scrolled and
3835
+ * it runs over the pinned edge's shadow. The totals row has no button. A checkbox from `selectionDisabled` keeps role="checkbox"
3836
+ * with aria-disabled rather than `disabled`, so it stays in the tab order and
3837
+ * the reason (aria-describedby, through Tooltip) is reachable by keyboard.
3838
+ * The brand fill is never the only cue: the app puts a "You" badge in the
3839
+ * row or column header beside it, and colour alone says nothing to someone
3840
+ * who can't see it. `NoValue` reads its reason, not "dash". `loading` sets aria-busy.
3699
3841
  * @use for every table of rows and columns, in a page or in a card.
3700
3842
  * @use `title` for the table's name: it sits above the frame as a Section
3701
3843
  * heading, with `subtitle` and `action` beside it. On a dashboard, beside
@@ -3713,10 +3855,21 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3713
3855
  * @use `TableLink` for the name, to the entity's overview; end an expanded
3714
3856
  * row with a "View overview" link.
3715
3857
  * @use `footer={<Pager />}` in a card; `TablePagination` after a full-page table.
3858
+ * @use `subRows` for children that share the parent's columns (products
3859
+ * under a brand); `renderExpanded` for anything else (a trend, a list).
3860
+ * @use `totalsRow` for a sum of the rows in a totals row (not a total column).
3861
+ * @use `onRowClick` with `rowClickLabel` for rows that open a side panel; the
3862
+ * name still goes to the overview through TableLink.
3863
+ * @use `highlightRow` or a column's `highlight` for the reader's own brand,
3864
+ * with a "You" badge as the words for it.
3865
+ * @use `selectionDisabled` with the reason when a limit stops more ticks, and
3866
+ * `selectionBar={false}` when ticking picks what a chart shows, and
3867
+ * `selectAll={false}` when there's a limit on ticks.
3716
3868
  * @avoid a hand-built <table> -- the padding and header drift is what this
3717
3869
  * replaces.
3718
- * @avoid zebra stripes, or a row click that navigates: a row click only
3719
- * opens the row, and only the name goes to another page.
3870
+ * @avoid zebra stripes, or a row click that navigates: a row click opens the
3871
+ * row or a side panel, and only the name goes to another page.
3872
+ * @avoid `onRowClick` together with `renderExpanded` or `subRows`.
3720
3873
  * @avoid a layout of label/value pairs -- that's a description list, not a table.
3721
3874
  * @usage
3722
3875
  * ```tsx
@@ -3733,9 +3886,36 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3733
3886
  * ]}
3734
3887
  * footer={<Pager page={page} totalPages={5} onPage={setPage} />}
3735
3888
  * />
3889
+ *
3890
+ * // Sub-rows, a totals row and the reader's brand
3891
+ * <DataTable
3892
+ * rowKey={(r) => r.id}
3893
+ * rowLabel={(r) => r.name}
3894
+ * rows={brands}
3895
+ * subRows={(r) => r.products}
3896
+ * subRowNoun={{ one: "product", other: "products" }}
3897
+ * totalsRow={{ id: "total", name: "", spend: sum }}
3898
+ * highlightRow={(r) => r.isYou}
3899
+ * columns={columns}
3900
+ * />
3901
+ *
3902
+ * // Rows that open a side panel; a picker capped at 7
3903
+ * <DataTable
3904
+ * rowKey={(r) => r.id}
3905
+ * rowLabel={(r) => r.name}
3906
+ * rows={rows}
3907
+ * onRowClick={(r) => openBattleCard(r.id)}
3908
+ * rowClickLabel={(r) => `Open battle card for ${r.name}`}
3909
+ * selected={picked}
3910
+ * onSelectedChange={setPicked}
3911
+ * selectionDisabled={(r) => picked.length >= 7 && !picked.includes(r.id) && "Up to 7 rows. Untick one to add another."}
3912
+ * selectionBar={false}
3913
+ * selectAll={false}
3914
+ * columns={columns}
3915
+ * />
3736
3916
  * ```
3737
3917
  */
3738
- declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded, canExpand, rowLabel, selected, onSelectedChange, totalCount, onSelectAll, selectedCount, selectionActions, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
3918
+ declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded: renderExpandedProp, canExpand, subRows: subRowsProp, subRowNoun, totalsRow, totalsLabel, onRowClick, rowClickLabel, highlightRow, rowLabel, selected, onSelectedChange, totalCount, onSelectAll, selectedCount, selectionActions, selectionDisabled, selectionBar, selectAll, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
3739
3919
 
3740
3920
  type MediaType = "TV" | "CTV" | "Digital" | "Social" | "Radio" | "Newspaper" | "Magazine";
3741
3921
  interface MediaLabelProps extends CommonProps {
package/dist/index.d.ts CHANGED
@@ -324,6 +324,16 @@ interface DeltaProps extends CommonProps {
324
324
  * beside a figure does not need one -- the sign already says which way.
325
325
  */
326
326
  arrow?: boolean;
327
+ /**
328
+ * A worded unit, after a space: "+4 ranks", "−2 ranks", "+1.2 pts". Pass
329
+ * `{ one: "rank", other: "ranks" }` to get the singular for exactly 1, or a
330
+ * plain string to use the same word for every value. Takes the place of
331
+ * `suffix`. Whole numbers show no decimal ("+4 ranks"); others show one.
332
+ */
333
+ unit?: string | {
334
+ one: string;
335
+ other: string;
336
+ };
327
337
  /** Appended after the suffix, e.g. "YoY". Keep it to one or two words. */
328
338
  period?: string;
329
339
  className?: string;
@@ -338,18 +348,28 @@ interface DeltaProps extends CommonProps {
338
348
  * value: number -- sign picks the direction
339
349
  * suffix?: string -- "%" or "pts"
340
350
  * arrow?: boolean (default false) -- direction arrow, for a column scanned rather than read
351
+ * unit?: string | { one: string; other: string } -- worded unit after a space, "+4 ranks"; replaces suffix
341
352
  * period?: string -- e.g. "YoY"
342
- * @tokens text-text-success, text-text-danger
353
+ * @tokens text-text-success, text-text-danger, text-text-tertiary
343
354
  * @dependencies lucide-react
344
355
  * @behavior Takes the type size of whatever contains it rather than setting
345
356
  * its own, because it is inline text inside a table cell or a card rather
346
357
  * than a box of its own -- a fixed size would fight the density its table
347
- * already chose.
358
+ * already chose. A value that rounds to zero at the precision it's shown at
359
+ * (0, or 0.04 shown to one decimal) reads "No change" in grey: no sign, no
360
+ * arrow, no colour. A tiny non-zero change keeps its exact value ("+0.04%")
361
+ * in a Tooltip on hover and in hidden text for screen readers. Inside
362
+ * DataTable's totals row it is semibold, like the row. `unit` writes the change in words after a
363
+ * space ("+4 ranks", "+1 rank", "−2 ranks", "+1.2 pts"): whole numbers have
364
+ * no decimal, others one. Without `unit`, non-zero values read as before
365
+ * ("+6.2%", "−2.1pts"). The minus is a true minus sign (−), as in `numbers.ts`.
348
366
  * @a11y The sign is the point: colour alone cannot carry direction, for
349
367
  * anyone who cannot distinguish the two and for anyone reading it printed or
350
368
  * in greyscale. `+` and `-` are always rendered, so the colour is
351
369
  * reinforcement rather than the only signal. The arrow is decorative and
352
- * hidden, since the sign beside it already says the same thing.
370
+ * hidden, since the sign beside it already says the same thing. Zero is the
371
+ * words "No change", so it never relies on its grey; a rounded-away change
372
+ * is read as "No change (+0.04%)".
353
373
  * @use when showing a change against a previous period beside the figure it
354
374
  * relates to.
355
375
  * @use with `arrow` when deltas run down a column and the reader is scanning
@@ -365,9 +385,12 @@ interface DeltaProps extends CommonProps {
365
385
  * <Delta value={6.2} suffix="%" />
366
386
  * <Delta value={-2.1} suffix="%" period="YoY" />
367
387
  * <Delta value={1.4} suffix="pts" arrow />
388
+ * <Delta value={4} unit={{ one: "rank", other: "ranks" }} /> // +4 ranks
389
+ * <Delta value={1.2} unit="pts" /> // +1.2 pts
390
+ * <Delta value={0} suffix="%" /> // No change
368
391
  * ```
369
392
  */
370
- declare function Delta({ value, suffix, arrow, period, className, testIdPrefix }: DeltaProps): react.JSX.Element;
393
+ declare function Delta({ value, suffix, unit, arrow, period, className, testIdPrefix }: DeltaProps): react.JSX.Element;
371
394
 
372
395
  interface PrimaryBadgeProps extends CommonProps {
373
396
  /** The word on the badge (default "Primary"). Keep it to one word. */
@@ -3554,6 +3577,12 @@ interface DataTableColumn<T, K extends string = string> {
3554
3577
  sortable?: boolean;
3555
3578
  /** The first click's direction: names A→Z (`asc`), numbers largest first (`desc`, the numeric default). */
3556
3579
  firstDir?: SortDir;
3580
+ /**
3581
+ * Tints the column's body cells with the light brand fill, to mark the
3582
+ * column that matters to the reader (their brand). Pair it with a word
3583
+ * ("You") in the header or cells: the tint isn't the only cue.
3584
+ */
3585
+ highlight?: boolean;
3557
3586
  }
3558
3587
  interface DataTableProps<T, K extends string = string> extends CommonProps {
3559
3588
  columns: DataTableColumn<T, K>[];
@@ -3595,8 +3624,48 @@ interface DataTableProps<T, K extends string = string> extends CommonProps {
3595
3624
  * start of the row opens it, and so does a click anywhere else on the row.
3596
3625
  */
3597
3626
  renderExpanded?: (row: T) => ReactNode;
3598
- /** Which rows can open. Default: every row, when `renderExpanded` is set. */
3627
+ /** Which rows can open. Default: every row with `renderExpanded`, or with sub-rows from `subRows`. */
3599
3628
  canExpand?: (row: T) => boolean;
3629
+ /**
3630
+ * Child rows that open under their parent in the same columns (a brand's
3631
+ * products under the brand). Return nothing or `[]` for a row without any.
3632
+ * They open with the row's chevron, sit indented on a light fill, and can't
3633
+ * be ticked or opened themselves (one level). Return them in the current
3634
+ * sort order, as `rows`, so they sort within their parent. A row with
3635
+ * sub-rows uses them instead of `renderExpanded`.
3636
+ */
3637
+ subRows?: (row: T) => T[] | undefined;
3638
+ /**
3639
+ * What the sub-rows are, for the chevron's screen-reader label: "Show 3
3640
+ * products under Nike". Default `{ one: "row", other: "rows" }`.
3641
+ */
3642
+ subRowNoun?: {
3643
+ one: string;
3644
+ other: string;
3645
+ };
3646
+ /**
3647
+ * A totals row, drawn through the same columns as the first body row. It
3648
+ * stays first whatever the sort, on a light fill with bold figures, and
3649
+ * isn't ticked, opened or counted. The name column shows `totalsLabel`.
3650
+ */
3651
+ totalsRow?: T;
3652
+ /** The name column's text in `totalsRow`. Default "Total". */
3653
+ totalsLabel?: string;
3654
+ /**
3655
+ * A click anywhere on the row calls this: for a table whose rows open a
3656
+ * side panel. Clicks on the row's own controls (the name's link, a
3657
+ * checkbox, a menu) and selecting text don't. A table uses this or rows
3658
+ * that open in place (`renderExpanded`, `subRows`), not both: given both,
3659
+ * this wins.
3660
+ */
3661
+ onRowClick?: (row: T) => void;
3662
+ /**
3663
+ * What a row click opens, as screen readers and keyboard users get it:
3664
+ * "Open battle card for Nike". Default "Open " + `rowLabel` ("Open Nike").
3665
+ */
3666
+ rowClickLabel?: (row: T) => string;
3667
+ /** Rows to mark with the light brand fill (the reader's own brand). Pair with a "You" badge in the row. */
3668
+ highlightRow?: (row: T) => boolean;
3600
3669
  /** Names a row for the chevron's and checkbox's screen-reader labels ("Show details for Nike"). */
3601
3670
  rowLabel?: (row: T) => string;
3602
3671
  /**
@@ -3614,6 +3683,24 @@ interface DataTableProps<T, K extends string = string> extends CommonProps {
3614
3683
  selectedCount?: number;
3615
3684
  /** What can be done with the ticked rows (Export, Add to list): shown with the count, where the title's actions were. */
3616
3685
  selectionActions?: ReactNode;
3686
+ /**
3687
+ * Rows that can't be ticked right now, and why ("Up to 7 rows. Untick one
3688
+ * to add another."). Return `false` for a row that can. The checkbox greys
3689
+ * out, stays focusable, and shows the reason on hover and focus.
3690
+ */
3691
+ selectionDisabled?: (row: T) => string | false;
3692
+ /**
3693
+ * The "3 selected · Select all · actions · Clear" bar shown while rows are
3694
+ * ticked. Default `true`; `false` for a picker table, where ticking chooses
3695
+ * what a chart shows rather than rows to act on.
3696
+ */
3697
+ selectionBar?: boolean;
3698
+ /**
3699
+ * The header's tick-all checkbox. Default `true`; `false` for a table with
3700
+ * a limit on ticks (a picker capped at 7), where ticking every row would
3701
+ * break it. The header cell stays, empty.
3702
+ */
3703
+ selectAll?: boolean;
3617
3704
  /** `default` for tables people read and act on; `compact` for reference data and long lists. */
3618
3705
  density?: DataTableDensity;
3619
3706
  /** Shows skeleton rows in the real columns, at the real row height. */
@@ -3662,16 +3749,21 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3662
3749
  * lining figures, so figures sit together at the right edge. Dates are text
3663
3750
  * and sit left. A cell with nothing to show is a grey dash that says why on
3664
3751
  * hover. The default sort's arrow shows before anyone clicks. Rows can open
3665
- * in place, and the name links to the entity's overview (UXD-196).
3752
+ * in place, as a panel or as sub-rows in the same columns, or open a side
3753
+ * panel on click; the name links to the entity's overview (UXD-196). A
3754
+ * totals row can sit first, and the reader's own brand can be marked with a
3755
+ * light brand fill on its row or column.
3666
3756
  * @variant default - Default. Tables people read and act on.
3667
3757
  * @variant compact - Reference data and long lists.
3668
- * @tokens rounded-card, border, border-border-default, bg-surface,
3758
+ * @tokens rounded-card, rounded-small, border, border-border-default, bg-surface,
3669
3759
  * p-card-padding, text-panel-title, text-xs, text-text-tertiary, gap-3,
3670
3760
  * text-left, border-collapse, bg-subtle, text-micro, font-semibold, uppercase,
3671
3761
  * tracking-wider, text-text-secondary, text-right, text-dense,
3672
3762
  * text-text-primary, hover:bg-subtle, tabular-nums, rounded-full,
3673
3763
  * animate-pulse, border-t, decoration-text-tertiary, rounded-control,
3674
- * focus-visible:outline-border-focus, border-r-border-default
3764
+ * focus-visible:outline-border-focus, border-r-border-default,
3765
+ * bg-brand-primaryTint, pl-10, pl-9, cursor-not-allowed, sr-only,
3766
+ * bg-linear-to-r, from-brand-primaryAction/10, border-border-focus
3675
3767
  * @behavior Sorting: a `sortable` column's header gets a SortButton; clicks
3676
3768
  * cycle the column's `firstDir`, then the reverse, then back to
3677
3769
  * `defaultSort` (`cycleSort`), and call `onSortChange`. The sorted column
@@ -3687,6 +3779,41 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3687
3779
  * anywhere else on it does too, except on its own controls (links, buttons,
3688
3780
  * checkboxes, menus) or while selecting text. Several rows can be open;
3689
3781
  * sorting or paging closes them. Rows that can't open have no pointer.
3782
+ * `subRows` gives a row child rows instead of a panel: they open with the
3783
+ * same chevron, directly under the parent as real rows in the same columns,
3784
+ * on the light fill (`bg-subtle`), the name 24px further in and in secondary
3785
+ * ink, the rank cell blank. They can't be ticked or opened (one level). Pass
3786
+ * them sorted like `rows`, so a sort orders children within their parent;
3787
+ * open sub-rows stay open through a sort and close on a page or filter
3788
+ * change. A row with sub-rows uses them; one without uses `renderExpanded`.
3789
+ * `totalsRow` is drawn through the same columns as the first body row, above
3790
+ * every row whatever the sort, on the light fill, all semibold (label,
3791
+ * figures, and any Delta in it); its name cell reads `totalsLabel` ("Total")
3792
+ * and its rank cell is blank. It has
3793
+ * no checkbox or chevron, and isn't counted in the selection or the pages.
3794
+ * It isn't drawn while loading or when there are no rows.
3795
+ * `onRowClick` (a side panel, e.g. a battle card) makes the whole row the
3796
+ * target: pointer and the hover wash, and a click anywhere calls it except on
3797
+ * the row's own controls or while selecting text in it. A table uses it or
3798
+ * rows that open in place, not both; given both, it wins and a dev build
3799
+ * warns. Keyboard: one hidden button per row, in the name cell; while it has
3800
+ * keyboard focus the whole row takes the focus ring, and Enter or Space opens
3801
+ * the panel.
3802
+ * `highlightRow` and a column's `highlight` fill those cells with the light
3803
+ * brand tint (`bg-brand-primaryTint`), which is opaque, so a pinned cell
3804
+ * stays solid. A highlighted column's header cell takes the tint too, so the
3805
+ * column reads as one strip; the totals row keeps its own fill. A
3806
+ * highlighted row with `onRowClick` deepens on hover (a 10% layer of
3807
+ * `brand-primaryAction` over the tint, still opaque); otherwise it keeps its
3808
+ * tint on hover.
3809
+ * `selectionDisabled` returns why a row can't be ticked ("Up to 7 rows.
3810
+ * Untick one to add another.") or `false`. Its checkbox greys out and does
3811
+ * nothing on click or Space; the reason shows in a Tooltip on hover and
3812
+ * focus. The header checkbox, its dash and a shift-click range all skip
3813
+ * those rows. `selectAll={false}` leaves the header cell empty, for a table
3814
+ * with a limit on ticks, where ticking every row would break it.
3815
+ * `selectionBar={false}` leaves out the "3 selected … Clear" bar, for a
3816
+ * picker table where ticking chooses what a chart shows.
3690
3817
  * `maxHeight` makes the body
3691
3818
  * scroll under a pinned header; wide tables always scroll sideways rather than
3692
3819
  * squeeze.
@@ -3695,7 +3822,22 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3695
3822
  * button inside it. A header's `info` shows on hover and keyboard focus and
3696
3823
  * is announced with it. The row's chevron is a button with aria-expanded and
3697
3824
  * a label naming the row ("Show details for Nike"); the row click is only a
3698
- * shortcut for it. `NoValue` reads its reason, not "dash". `loading` sets aria-busy.
3825
+ * shortcut for it. With sub-rows, the chevron says what opens ("Show 3
3826
+ * products under Nike", the noun from `subRowNoun`, default rows), its
3827
+ * aria-controls names the child rows, and each child's name is followed by a
3828
+ * hidden ", in Nike" (from `rowLabel`) so it is announced with its parent.
3829
+ * With `onRowClick`, the row's name cell holds one visually hidden button
3830
+ * per row, in the tab order, named by `rowClickLabel` ("Open battle card for
3831
+ * Nike"; default "Open Nike"); while it has keyboard focus the whole row
3832
+ * shows the 2px focus ring in border-focus, and Enter or Space calls the
3833
+ * same handler. The ring is drawn by the cells (top and bottom on each, the
3834
+ * sides on the first and last), so pinned cells keep it while scrolled and
3835
+ * it runs over the pinned edge's shadow. The totals row has no button. A checkbox from `selectionDisabled` keeps role="checkbox"
3836
+ * with aria-disabled rather than `disabled`, so it stays in the tab order and
3837
+ * the reason (aria-describedby, through Tooltip) is reachable by keyboard.
3838
+ * The brand fill is never the only cue: the app puts a "You" badge in the
3839
+ * row or column header beside it, and colour alone says nothing to someone
3840
+ * who can't see it. `NoValue` reads its reason, not "dash". `loading` sets aria-busy.
3699
3841
  * @use for every table of rows and columns, in a page or in a card.
3700
3842
  * @use `title` for the table's name: it sits above the frame as a Section
3701
3843
  * heading, with `subtitle` and `action` beside it. On a dashboard, beside
@@ -3713,10 +3855,21 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3713
3855
  * @use `TableLink` for the name, to the entity's overview; end an expanded
3714
3856
  * row with a "View overview" link.
3715
3857
  * @use `footer={<Pager />}` in a card; `TablePagination` after a full-page table.
3858
+ * @use `subRows` for children that share the parent's columns (products
3859
+ * under a brand); `renderExpanded` for anything else (a trend, a list).
3860
+ * @use `totalsRow` for a sum of the rows in a totals row (not a total column).
3861
+ * @use `onRowClick` with `rowClickLabel` for rows that open a side panel; the
3862
+ * name still goes to the overview through TableLink.
3863
+ * @use `highlightRow` or a column's `highlight` for the reader's own brand,
3864
+ * with a "You" badge as the words for it.
3865
+ * @use `selectionDisabled` with the reason when a limit stops more ticks, and
3866
+ * `selectionBar={false}` when ticking picks what a chart shows, and
3867
+ * `selectAll={false}` when there's a limit on ticks.
3716
3868
  * @avoid a hand-built <table> -- the padding and header drift is what this
3717
3869
  * replaces.
3718
- * @avoid zebra stripes, or a row click that navigates: a row click only
3719
- * opens the row, and only the name goes to another page.
3870
+ * @avoid zebra stripes, or a row click that navigates: a row click opens the
3871
+ * row or a side panel, and only the name goes to another page.
3872
+ * @avoid `onRowClick` together with `renderExpanded` or `subRows`.
3720
3873
  * @avoid a layout of label/value pairs -- that's a description list, not a table.
3721
3874
  * @usage
3722
3875
  * ```tsx
@@ -3733,9 +3886,36 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3733
3886
  * ]}
3734
3887
  * footer={<Pager page={page} totalPages={5} onPage={setPage} />}
3735
3888
  * />
3889
+ *
3890
+ * // Sub-rows, a totals row and the reader's brand
3891
+ * <DataTable
3892
+ * rowKey={(r) => r.id}
3893
+ * rowLabel={(r) => r.name}
3894
+ * rows={brands}
3895
+ * subRows={(r) => r.products}
3896
+ * subRowNoun={{ one: "product", other: "products" }}
3897
+ * totalsRow={{ id: "total", name: "", spend: sum }}
3898
+ * highlightRow={(r) => r.isYou}
3899
+ * columns={columns}
3900
+ * />
3901
+ *
3902
+ * // Rows that open a side panel; a picker capped at 7
3903
+ * <DataTable
3904
+ * rowKey={(r) => r.id}
3905
+ * rowLabel={(r) => r.name}
3906
+ * rows={rows}
3907
+ * onRowClick={(r) => openBattleCard(r.id)}
3908
+ * rowClickLabel={(r) => `Open battle card for ${r.name}`}
3909
+ * selected={picked}
3910
+ * onSelectedChange={setPicked}
3911
+ * selectionDisabled={(r) => picked.length >= 7 && !picked.includes(r.id) && "Up to 7 rows. Untick one to add another."}
3912
+ * selectionBar={false}
3913
+ * selectAll={false}
3914
+ * columns={columns}
3915
+ * />
3736
3916
  * ```
3737
3917
  */
3738
- declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded, canExpand, rowLabel, selected, onSelectedChange, totalCount, onSelectAll, selectedCount, selectionActions, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
3918
+ declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded: renderExpandedProp, canExpand, subRows: subRowsProp, subRowNoun, totalsRow, totalsLabel, onRowClick, rowClickLabel, highlightRow, rowLabel, selected, onSelectedChange, totalCount, onSelectAll, selectedCount, selectionActions, selectionDisabled, selectionBar, selectAll, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
3739
3919
 
3740
3920
  type MediaType = "TV" | "CTV" | "Digital" | "Social" | "Radio" | "Newspaper" | "Magazine";
3741
3921
  interface MediaLabelProps extends CommonProps {