@mediaradar/design-components 0.18.2 → 0.18.4

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
@@ -14,12 +14,17 @@ import { VariantProps } from 'class-variance-authority';
14
14
  * @dependencies lucide-react
15
15
  * @behavior 'click' mode toggles on click only. 'hover' mode also opens on
16
16
  * keyboard focus and closes on blur, so it stays reachable without a mouse —
17
- * not just a decorative hover effect. Both modes close on Escape and on any
17
+ * not just a decorative hover effect. It closes 120ms after the pointer
18
+ * leaves, and stays open while the pointer is on the bubble, so the text can
19
+ * be hovered (WCAG 1.4.13). Both modes close on Escape and on any
18
20
  * outside click. The bubble is portaled to document.body and repositions
19
21
  * itself to stay clear of the right viewport edge.
20
- * @a11y The trigger is a <button> reporting aria-expanded; the bubble is
21
- * role="tooltip" and Escape dismisses it. It describes its anchor rather
22
- * than naming it, so the anchor still needs its own accessible name.
22
+ * @a11y The trigger is a <button> reporting aria-expanded, and its
23
+ * aria-describedby points at a hidden copy of the text beside it, so a screen
24
+ * reader reads the text on focus, open or not. (The visible bubble is
25
+ * portaled to the end of the page and appears only after a click, so it is
26
+ * aria-hidden rather than described-by.) Escape dismisses it. `label` names
27
+ * the button; the text describes it.
23
28
  * @usage
24
29
  * ```tsx
25
30
  * <InfoTip text="Trims time periods to data that has finalized across the selected media formats." />
@@ -291,7 +296,7 @@ declare function Delta({ value, suffix, arrow, period, className }: DeltaProps):
291
296
  * be dropped into a row that already has its own click-to-toggle handler
292
297
  * (a common list/table pattern) without double-firing. Where the row itself
293
298
  * is the control, use `CheckBoxBox` instead.
294
- * @tokens bg-brand-primaryAction, border-border-interactive, bg-input,
299
+ * @tokens bg-brand-primaryAction, text-brand-onprimary, border-border-interactive, bg-input,
295
300
  * hover:border-brand-primaryAction, focus-visible:outline-border-focus
296
301
  * @dependencies lucide-react
297
302
  * @behavior `aria-checked` is `"mixed"` when indeterminate, otherwise the
@@ -364,7 +369,7 @@ declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disable
364
369
  * the same control is worse for keyboard users, not better. The owning
365
370
  * element supplies `role="checkbox"` and `aria-checked`; this is
366
371
  * `aria-hidden` so the state isn't announced twice.
367
- * @tokens bg-brand-primaryAction, border-border-interactive, bg-input
372
+ * @tokens bg-brand-primaryAction, text-brand-onprimary, border-border-interactive, bg-input
368
373
  * @dependencies lucide-react
369
374
  * @behavior Renders through the same `boxClass` as `CheckBox`, so geometry
370
375
  * and fill can't drift. Takes neither the focus ring nor the hover border,
@@ -404,7 +409,7 @@ declare function CheckBoxBox({ checked, indeterminate, disabled, className }: Ch
404
409
  * dual-month calendar with range highlighting on the right, Start/End fields,
405
410
  * and Cancel/Apply. Shared by Creative Intel and the Account Review.
406
411
  * @tokens rounded-control, rounded-card, border-border-default, border-border-strong,
407
- * bg-surface, bg-input, bg-subtle, bg-ai-tint, bg-brand-primaryAction,
412
+ * bg-surface, bg-input, bg-subtle, bg-ai-tint, bg-brand-primaryAction, text-brand-onprimary,
408
413
  * shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary,
409
414
  * hover:bg-subtle, hover:text-text-primary, focus-visible:outline-border-focus
410
415
  * @dependencies lucide-react
@@ -761,7 +766,7 @@ interface NoResultsAction {
761
766
  /** Rendered as the filled button; every other action renders as the quiet link/button. */
762
767
  primary?: boolean;
763
768
  }
764
- declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-[13px] font-semibold text-white transition-colors hover:opacity-90";
769
+ declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-[13px] font-semibold text-brand-onprimary transition-colors hover:opacity-90";
765
770
  declare const QUIET_ACTION_CLASS = "rounded-control text-[13px] font-medium text-text-link transition-colors hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus";
766
771
  /**
767
772
  * @pattern NoResultsEmptyState
@@ -775,7 +780,7 @@ declare const QUIET_ACTION_CLASS = "rounded-control text-[13px] font-medium text
775
780
  * in a colSpan table cell (or a card, or a chart body) that already owns
776
781
  * that chrome, without imposing its own.
777
782
  * @tokens bg-subtle, text-text-tertiary, text-base, text-text-primary,
778
- * text-text-secondary, rounded-control, bg-brand-primaryAction, text-text-link,
783
+ * text-text-secondary, rounded-control, bg-brand-primaryAction, text-brand-onprimary, text-text-link,
779
784
  * focus-visible:outline-border-focus
780
785
  * @dependencies lucide-react
781
786
  * @behavior The Clear button shows when `onClearFilters` is given AND
@@ -1082,8 +1087,11 @@ declare function StackedColumnPlaceholder({ height, width, legendRows, axis, }:
1082
1087
  * right-aligned to the anchor's right edge -- both meant for `anchorRef`
1083
1088
  * anchors near the viewport's right edge, where a centred box would run
1084
1089
  * off-screen or read awkwardly beside a narrow icon.
1085
- * @a11y Renders role="tooltip" and is wired to its anchor by aria-describedby,
1086
- * so the anchor must exist and keep a stable id. It describes rather than
1090
+ * @a11y Renders role="tooltip" and is wired by aria-describedby to the
1091
+ * element that has focus: the `anchorRef` element, or inline, the child that
1092
+ * took focus (not the wrapper span: a screen reader reads the description of
1093
+ * the focused element only). An aria-describedby the caller set is kept.
1094
+ * Escape hides it without moving focus or the pointer. It describes rather than
1087
1095
  * labels: it is announced in addition to the anchor's own name, not
1088
1096
  * instead of it, so never put the only label for a control in here.
1089
1097
  * @usage
@@ -1458,7 +1466,7 @@ interface PublisherBreakdownListProps {
1458
1466
  * @tokens text-text-primary, text-text-tertiary, text-text-secondary,
1459
1467
  * text-text-link, text-text-warning, text-text-success, text-text-danger,
1460
1468
  * border-border-default, bg-surface, bg-subtle, rounded-control, rounded-full,
1461
- * shadow-overlay
1469
+ * shadow-overlay, text-micro
1462
1470
  * @behavior Truncates to `defaultVisibleCount` rows with a "See all (N more)"
1463
1471
  * / "Show less" toggle, unless `viewAllHref` is given, in which case the
1464
1472
  * footer becomes a plain link out instead (e.g. to a full breakdown page).
@@ -1522,7 +1530,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1522
1530
  * styling to a different element, e.g. a router `<Link>`. Also exports the
1523
1531
  * raw `buttonVariants` cva function for consumers composing button styling
1524
1532
  * onto something other than this component.
1525
- * @tokens bg-brand-primaryAction, text-brand-onprimary, bg-surface, text-text-primary, border-border-strong, hover:border-border-interactive, hover:bg-subtle, bg-status-danger, text-status-onstatus, text-text-secondary, hover:text-text-danger, text-text-link, rounded-control, duration-(--mr-motion-duration-interactive), ease-interactive
1533
+ * @tokens bg-brand-primaryAction, text-brand-onprimary, bg-surface, text-text-primary, border-border-strong, hover:border-border-interactive, hover:bg-subtle, bg-status-danger, text-status-onstatus, text-text-secondary, hover:text-text-danger, text-text-link, rounded-control, duration-(--mr-motion-duration-interactive), ease-interactive, focus-visible:outline-border-focus
1526
1534
  * @dependencies class-variance-authority, @radix-ui/react-slot, lucide-react
1527
1535
  * @variant primary - The one primary action on a screen. Solid brand fill.
1528
1536
  * @variant secondary - Any other real action competing for attention (Cancel, Export). Bordered, neutral fill.
@@ -1531,10 +1539,11 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1531
1539
  * @variant dangerGhost - Neutral at rest, red on hover. For a destructive affordance inline in a row or toolbar -- what the product reaches for far more often than filled danger.
1532
1540
  * @variant link - Reads as inline text, not a control. Use inside body copy or where a full button would overpower the surrounding content.
1533
1541
  * @behavior `disabled` removes pointer events entirely (not just a style
1534
- * change) and dims to 40% opacity. Focus handling is a deliberate exception:
1535
- * most interactive components use a visible `focus-visible:outline-2` ring,
1536
- * but Button suppresses it (`focus-visible:outline-hidden focus-visible:ring-0`)
1537
- * and relies on its per-variant hover/brightness treatment instead. `loading`
1542
+ * change) and dims to 40% opacity. Keyboard focus shows the same 2px
1543
+ * `border-focus` outline as every other control here. It used to be
1544
+ * suppressed in favour of the hover treatment, which a keyboard user never
1545
+ * sees, and the suppression also cancelled the apps' own global focus ring,
1546
+ * so a focused Button had no indicator at all (WCAG 2.4.7). `loading`
1538
1547
  * implies `disabled` (and sets `aria-busy`), since a control mid-submit
1539
1548
  * shouldn't accept another click. `asChild` renders only the child element,
1540
1549
  * through Radix `Slot`, with the button classes, ref and remaining props
@@ -1643,10 +1652,10 @@ interface NameListModalProps {
1643
1652
  * When `options` are given they render as CheckBox rows below the field, and
1644
1653
  * their state comes back as `onSubmit`'s second argument -- a handler that
1645
1654
  * only takes the name stays valid.
1646
- * @a11y role="dialog" with aria-modal, labelled by its title. The name field
1647
- * takes focus on open and Escape closes via onCancel. Focus is NOT trapped
1648
- * and NOT restored to the opener on close -- confirmed in the source -- so
1649
- * a consumer that needs either must supply it around this component.
1655
+ * @a11y role="dialog" with aria-modal, labelled by its title (aria-labelledby
1656
+ * on the heading). The name field takes focus on open and Escape closes via
1657
+ * onCancel. Tab and Shift+Tab stay inside the dialog, and on close focus
1658
+ * returns to the element that had it when the dialog opened.
1650
1659
  * @usage
1651
1660
  * ```tsx
1652
1661
  * <NameListModal title="Rename list" initialName={list.name} submitLabel="Save" onCancel={close} onSubmit={rename} />
@@ -1794,7 +1803,7 @@ interface SortButtonProps<K extends string> {
1794
1803
  * neutral ArrowUpDown in text-tertiary at half opacity, coming up to full on
1795
1804
  * hover so the column reads as clickable; the active column swaps to a
1796
1805
  * direction arrow (ArrowUp/ArrowDown) colored with the brand action blue.
1797
- * @tokens text-text-tertiary, text-brand-primaryAction, hover:text-text-primary
1806
+ * @tokens text-text-tertiary, text-brand-primaryAction, hover:text-text-primary, focus-visible:outline-border-focus
1798
1807
  * @dependencies lucide-react
1799
1808
  * @behavior Pair with `cycleSort`/`sortProp` (exported alongside) for the
1800
1809
  * standard three-state cycle — sort, reverse, then unsorted. `disabled` keeps
package/dist/index.d.ts CHANGED
@@ -14,12 +14,17 @@ import { VariantProps } from 'class-variance-authority';
14
14
  * @dependencies lucide-react
15
15
  * @behavior 'click' mode toggles on click only. 'hover' mode also opens on
16
16
  * keyboard focus and closes on blur, so it stays reachable without a mouse —
17
- * not just a decorative hover effect. Both modes close on Escape and on any
17
+ * not just a decorative hover effect. It closes 120ms after the pointer
18
+ * leaves, and stays open while the pointer is on the bubble, so the text can
19
+ * be hovered (WCAG 1.4.13). Both modes close on Escape and on any
18
20
  * outside click. The bubble is portaled to document.body and repositions
19
21
  * itself to stay clear of the right viewport edge.
20
- * @a11y The trigger is a <button> reporting aria-expanded; the bubble is
21
- * role="tooltip" and Escape dismisses it. It describes its anchor rather
22
- * than naming it, so the anchor still needs its own accessible name.
22
+ * @a11y The trigger is a <button> reporting aria-expanded, and its
23
+ * aria-describedby points at a hidden copy of the text beside it, so a screen
24
+ * reader reads the text on focus, open or not. (The visible bubble is
25
+ * portaled to the end of the page and appears only after a click, so it is
26
+ * aria-hidden rather than described-by.) Escape dismisses it. `label` names
27
+ * the button; the text describes it.
23
28
  * @usage
24
29
  * ```tsx
25
30
  * <InfoTip text="Trims time periods to data that has finalized across the selected media formats." />
@@ -291,7 +296,7 @@ declare function Delta({ value, suffix, arrow, period, className }: DeltaProps):
291
296
  * be dropped into a row that already has its own click-to-toggle handler
292
297
  * (a common list/table pattern) without double-firing. Where the row itself
293
298
  * is the control, use `CheckBoxBox` instead.
294
- * @tokens bg-brand-primaryAction, border-border-interactive, bg-input,
299
+ * @tokens bg-brand-primaryAction, text-brand-onprimary, border-border-interactive, bg-input,
295
300
  * hover:border-brand-primaryAction, focus-visible:outline-border-focus
296
301
  * @dependencies lucide-react
297
302
  * @behavior `aria-checked` is `"mixed"` when indeterminate, otherwise the
@@ -364,7 +369,7 @@ declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disable
364
369
  * the same control is worse for keyboard users, not better. The owning
365
370
  * element supplies `role="checkbox"` and `aria-checked`; this is
366
371
  * `aria-hidden` so the state isn't announced twice.
367
- * @tokens bg-brand-primaryAction, border-border-interactive, bg-input
372
+ * @tokens bg-brand-primaryAction, text-brand-onprimary, border-border-interactive, bg-input
368
373
  * @dependencies lucide-react
369
374
  * @behavior Renders through the same `boxClass` as `CheckBox`, so geometry
370
375
  * and fill can't drift. Takes neither the focus ring nor the hover border,
@@ -404,7 +409,7 @@ declare function CheckBoxBox({ checked, indeterminate, disabled, className }: Ch
404
409
  * dual-month calendar with range highlighting on the right, Start/End fields,
405
410
  * and Cancel/Apply. Shared by Creative Intel and the Account Review.
406
411
  * @tokens rounded-control, rounded-card, border-border-default, border-border-strong,
407
- * bg-surface, bg-input, bg-subtle, bg-ai-tint, bg-brand-primaryAction,
412
+ * bg-surface, bg-input, bg-subtle, bg-ai-tint, bg-brand-primaryAction, text-brand-onprimary,
408
413
  * shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary,
409
414
  * hover:bg-subtle, hover:text-text-primary, focus-visible:outline-border-focus
410
415
  * @dependencies lucide-react
@@ -761,7 +766,7 @@ interface NoResultsAction {
761
766
  /** Rendered as the filled button; every other action renders as the quiet link/button. */
762
767
  primary?: boolean;
763
768
  }
764
- declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-[13px] font-semibold text-white transition-colors hover:opacity-90";
769
+ declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-[13px] font-semibold text-brand-onprimary transition-colors hover:opacity-90";
765
770
  declare const QUIET_ACTION_CLASS = "rounded-control text-[13px] font-medium text-text-link transition-colors hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus";
766
771
  /**
767
772
  * @pattern NoResultsEmptyState
@@ -775,7 +780,7 @@ declare const QUIET_ACTION_CLASS = "rounded-control text-[13px] font-medium text
775
780
  * in a colSpan table cell (or a card, or a chart body) that already owns
776
781
  * that chrome, without imposing its own.
777
782
  * @tokens bg-subtle, text-text-tertiary, text-base, text-text-primary,
778
- * text-text-secondary, rounded-control, bg-brand-primaryAction, text-text-link,
783
+ * text-text-secondary, rounded-control, bg-brand-primaryAction, text-brand-onprimary, text-text-link,
779
784
  * focus-visible:outline-border-focus
780
785
  * @dependencies lucide-react
781
786
  * @behavior The Clear button shows when `onClearFilters` is given AND
@@ -1082,8 +1087,11 @@ declare function StackedColumnPlaceholder({ height, width, legendRows, axis, }:
1082
1087
  * right-aligned to the anchor's right edge -- both meant for `anchorRef`
1083
1088
  * anchors near the viewport's right edge, where a centred box would run
1084
1089
  * off-screen or read awkwardly beside a narrow icon.
1085
- * @a11y Renders role="tooltip" and is wired to its anchor by aria-describedby,
1086
- * so the anchor must exist and keep a stable id. It describes rather than
1090
+ * @a11y Renders role="tooltip" and is wired by aria-describedby to the
1091
+ * element that has focus: the `anchorRef` element, or inline, the child that
1092
+ * took focus (not the wrapper span: a screen reader reads the description of
1093
+ * the focused element only). An aria-describedby the caller set is kept.
1094
+ * Escape hides it without moving focus or the pointer. It describes rather than
1087
1095
  * labels: it is announced in addition to the anchor's own name, not
1088
1096
  * instead of it, so never put the only label for a control in here.
1089
1097
  * @usage
@@ -1458,7 +1466,7 @@ interface PublisherBreakdownListProps {
1458
1466
  * @tokens text-text-primary, text-text-tertiary, text-text-secondary,
1459
1467
  * text-text-link, text-text-warning, text-text-success, text-text-danger,
1460
1468
  * border-border-default, bg-surface, bg-subtle, rounded-control, rounded-full,
1461
- * shadow-overlay
1469
+ * shadow-overlay, text-micro
1462
1470
  * @behavior Truncates to `defaultVisibleCount` rows with a "See all (N more)"
1463
1471
  * / "Show less" toggle, unless `viewAllHref` is given, in which case the
1464
1472
  * footer becomes a plain link out instead (e.g. to a full breakdown page).
@@ -1522,7 +1530,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1522
1530
  * styling to a different element, e.g. a router `<Link>`. Also exports the
1523
1531
  * raw `buttonVariants` cva function for consumers composing button styling
1524
1532
  * onto something other than this component.
1525
- * @tokens bg-brand-primaryAction, text-brand-onprimary, bg-surface, text-text-primary, border-border-strong, hover:border-border-interactive, hover:bg-subtle, bg-status-danger, text-status-onstatus, text-text-secondary, hover:text-text-danger, text-text-link, rounded-control, duration-(--mr-motion-duration-interactive), ease-interactive
1533
+ * @tokens bg-brand-primaryAction, text-brand-onprimary, bg-surface, text-text-primary, border-border-strong, hover:border-border-interactive, hover:bg-subtle, bg-status-danger, text-status-onstatus, text-text-secondary, hover:text-text-danger, text-text-link, rounded-control, duration-(--mr-motion-duration-interactive), ease-interactive, focus-visible:outline-border-focus
1526
1534
  * @dependencies class-variance-authority, @radix-ui/react-slot, lucide-react
1527
1535
  * @variant primary - The one primary action on a screen. Solid brand fill.
1528
1536
  * @variant secondary - Any other real action competing for attention (Cancel, Export). Bordered, neutral fill.
@@ -1531,10 +1539,11 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1531
1539
  * @variant dangerGhost - Neutral at rest, red on hover. For a destructive affordance inline in a row or toolbar -- what the product reaches for far more often than filled danger.
1532
1540
  * @variant link - Reads as inline text, not a control. Use inside body copy or where a full button would overpower the surrounding content.
1533
1541
  * @behavior `disabled` removes pointer events entirely (not just a style
1534
- * change) and dims to 40% opacity. Focus handling is a deliberate exception:
1535
- * most interactive components use a visible `focus-visible:outline-2` ring,
1536
- * but Button suppresses it (`focus-visible:outline-hidden focus-visible:ring-0`)
1537
- * and relies on its per-variant hover/brightness treatment instead. `loading`
1542
+ * change) and dims to 40% opacity. Keyboard focus shows the same 2px
1543
+ * `border-focus` outline as every other control here. It used to be
1544
+ * suppressed in favour of the hover treatment, which a keyboard user never
1545
+ * sees, and the suppression also cancelled the apps' own global focus ring,
1546
+ * so a focused Button had no indicator at all (WCAG 2.4.7). `loading`
1538
1547
  * implies `disabled` (and sets `aria-busy`), since a control mid-submit
1539
1548
  * shouldn't accept another click. `asChild` renders only the child element,
1540
1549
  * through Radix `Slot`, with the button classes, ref and remaining props
@@ -1643,10 +1652,10 @@ interface NameListModalProps {
1643
1652
  * When `options` are given they render as CheckBox rows below the field, and
1644
1653
  * their state comes back as `onSubmit`'s second argument -- a handler that
1645
1654
  * only takes the name stays valid.
1646
- * @a11y role="dialog" with aria-modal, labelled by its title. The name field
1647
- * takes focus on open and Escape closes via onCancel. Focus is NOT trapped
1648
- * and NOT restored to the opener on close -- confirmed in the source -- so
1649
- * a consumer that needs either must supply it around this component.
1655
+ * @a11y role="dialog" with aria-modal, labelled by its title (aria-labelledby
1656
+ * on the heading). The name field takes focus on open and Escape closes via
1657
+ * onCancel. Tab and Shift+Tab stay inside the dialog, and on close focus
1658
+ * returns to the element that had it when the dialog opened.
1650
1659
  * @usage
1651
1660
  * ```tsx
1652
1661
  * <NameListModal title="Rename list" initialName={list.name} submitLabel="Save" onCancel={close} onSubmit={rename} />
@@ -1794,7 +1803,7 @@ interface SortButtonProps<K extends string> {
1794
1803
  * neutral ArrowUpDown in text-tertiary at half opacity, coming up to full on
1795
1804
  * hover so the column reads as clickable; the active column swaps to a
1796
1805
  * direction arrow (ArrowUp/ArrowDown) colored with the brand action blue.
1797
- * @tokens text-text-tertiary, text-brand-primaryAction, hover:text-text-primary
1806
+ * @tokens text-text-tertiary, text-brand-primaryAction, hover:text-text-primary, focus-visible:outline-border-focus
1798
1807
  * @dependencies lucide-react
1799
1808
  * @behavior Pair with `cycleSort`/`sortProp` (exported alongside) for the
1800
1809
  * standard three-state cycle — sort, reverse, then unsorted. `disabled` keeps