@mediaradar/design-components 0.14.0 → 0.16.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.cjs +614 -488
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +141 -22
- package/dist/index.d.ts +141 -22
- package/dist/index.js +586 -461
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -229,6 +229,60 @@ interface BadgeProps {
|
|
|
229
229
|
*/
|
|
230
230
|
declare function Badge({ tone, kind, dot, children, className }: BadgeProps): react.JSX.Element;
|
|
231
231
|
|
|
232
|
+
interface DeltaProps {
|
|
233
|
+
/** The change itself. Its sign picks the direction; render the absolute value. */
|
|
234
|
+
value: number;
|
|
235
|
+
/** What the number is in -- "%" for a percentage, "pts" for share points. */
|
|
236
|
+
suffix?: string;
|
|
237
|
+
/**
|
|
238
|
+
* Adds a direction arrow before the number. For a column of deltas scanned
|
|
239
|
+
* rather than read, where the arrow is what the eye follows. A single delta
|
|
240
|
+
* beside a figure does not need one -- the sign already says which way.
|
|
241
|
+
*/
|
|
242
|
+
arrow?: boolean;
|
|
243
|
+
/** Appended after the suffix, e.g. "YoY". Keep it to one or two words. */
|
|
244
|
+
period?: string;
|
|
245
|
+
className?: string;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* @pattern Delta
|
|
249
|
+
* @description A change over time -- the +6.2% / -2.1% beside a figure. Green
|
|
250
|
+
* up, red down, always with an explicit sign.
|
|
251
|
+
* @props
|
|
252
|
+
* value: number -- sign picks the direction
|
|
253
|
+
* suffix?: string -- "%" or "pts"
|
|
254
|
+
* arrow?: boolean (default false) -- direction arrow, for a column scanned rather than read
|
|
255
|
+
* period?: string -- e.g. "YoY"
|
|
256
|
+
* @tokens text-text-success, text-text-danger
|
|
257
|
+
* @dependencies lucide-react
|
|
258
|
+
* @behavior Takes the type size of whatever contains it rather than setting
|
|
259
|
+
* its own, because it is inline text inside a table cell or a card rather
|
|
260
|
+
* than a box of its own -- a fixed size would fight the density its table
|
|
261
|
+
* already chose.
|
|
262
|
+
* @a11y The sign is the point: colour alone cannot carry direction, for
|
|
263
|
+
* anyone who cannot distinguish the two and for anyone reading it printed or
|
|
264
|
+
* in greyscale. `+` and `-` are always rendered, so the colour is
|
|
265
|
+
* reinforcement rather than the only signal. The arrow is decorative and
|
|
266
|
+
* hidden, since the sign beside it already says the same thing.
|
|
267
|
+
* @use when showing a change against a previous period beside the figure it
|
|
268
|
+
* relates to.
|
|
269
|
+
* @use with `arrow` when deltas run down a column and the reader is scanning
|
|
270
|
+
* for the ones that moved.
|
|
271
|
+
* @avoid when the number is not a change -- a share, a total or a rate is
|
|
272
|
+
* just a number, and colouring it green or red tells the reader something
|
|
273
|
+
* untrue about it.
|
|
274
|
+
* @avoid when up is not good. Green-for-up reads as green-for-better, so a
|
|
275
|
+
* rising cost or a rising error rate needs its own treatment rather than this
|
|
276
|
+
* one inverted, which nobody will notice.
|
|
277
|
+
* @usage
|
|
278
|
+
* ```tsx
|
|
279
|
+
* <Delta value={6.2} suffix="%" />
|
|
280
|
+
* <Delta value={-2.1} suffix="%" period="YoY" />
|
|
281
|
+
* <Delta value={1.4} suffix="pts" arrow />
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
declare function Delta({ value, suffix, arrow, period, className }: DeltaProps): react.JSX.Element;
|
|
285
|
+
|
|
232
286
|
/**
|
|
233
287
|
* @pattern CheckBox
|
|
234
288
|
* @description Tri-state checkbox rendered as a `<button>` (not a native
|
|
@@ -978,18 +1032,29 @@ declare function StackedColumnPlaceholder({ height, width, legendRows, axis, }:
|
|
|
978
1032
|
* escapes both `overflow` clipping inside scrollable panels and the broken
|
|
979
1033
|
* `fixed` containing block a transformed ancestor creates.
|
|
980
1034
|
* @tokens rounded-control, border-border-default, bg-surface, shadow-overlay,
|
|
981
|
-
* text-text-primary, bg-text-primary, text-surface
|
|
1035
|
+
* text-text-primary, bg-text-primary, text-surface,
|
|
1036
|
+
* duration-(--mr-motion-duration-interactive)
|
|
982
1037
|
* @variant surface - Default. Themed surface/border bubble -- matches the
|
|
983
1038
|
* Recharts chart tooltips this was originally built for.
|
|
984
1039
|
* @variant inverted - Solid dark pill (no border) -- for a tooltip sitting
|
|
985
1040
|
* over a nav rail or other icon-only surface, where the themed surface bubble
|
|
986
1041
|
* doesn't read as clearly against a busy background.
|
|
987
1042
|
* @behavior Shows on hover and on keyboard focus (so it stays reachable
|
|
988
|
-
* without a pointer) after `delay` ms (0 = immediate, the default).
|
|
989
|
-
*
|
|
990
|
-
*
|
|
991
|
-
*
|
|
992
|
-
*
|
|
1043
|
+
* without a pointer) after `delay` ms (0 = immediate, the default). Fades in
|
|
1044
|
+
* and out (opacity, `ease-in-out`, over the sys
|
|
1045
|
+
* `--mr-motion-duration-interactive` token -- 200ms today); the bubble stays
|
|
1046
|
+
* mounted through the fade-out and is removed from the DOM once it ends.
|
|
1047
|
+
* Under `prefers-reduced-motion: reduce` there is no fade: it appears and is
|
|
1048
|
+
* removed instantly. The hide starts on mouseleave/blur, cancelling a pending
|
|
1049
|
+
* delayed show if it hasn't fired yet -- except in `interactive` mode, which
|
|
1050
|
+
* delays the hide briefly so the pointer can travel from the trigger into the
|
|
1051
|
+
* tooltip's own content. Re-hovering (or re-focusing) the trigger while the
|
|
1052
|
+
* bubble is still fading out reverses the fade from where it is, without
|
|
1053
|
+
* waiting out `delay` again, since it is already on screen; so does moving
|
|
1054
|
+
* the pointer back into an `interactive` bubble. A non-interactive bubble is
|
|
1055
|
+
* `pointer-events-none` throughout, fade-out included, so it never
|
|
1056
|
+
* intercepts clicks meant for what sits under it. Pass `whenTruncated` to
|
|
1057
|
+
* only surface it once the trigger's content
|
|
993
1058
|
* is actually clipped by ellipsis (`scrollWidth > clientWidth`). `placement`
|
|
994
1059
|
* 'top'/'bottom' centre (or `align="start"` left-align) on the trigger;
|
|
995
1060
|
* 'right' centres vertically beside the anchor and 'bottom-end' hangs below,
|
|
@@ -1398,31 +1463,46 @@ interface PublisherBreakdownListProps {
|
|
|
1398
1463
|
declare function PublisherBreakdownList({ rows, defaultVisibleCount, padded, viewAllHref, renderLogo }: PublisherBreakdownListProps): react.JSX.Element;
|
|
1399
1464
|
|
|
1400
1465
|
declare const buttonVariants: (props?: ({
|
|
1401
|
-
variant?: "link" | "danger" | "primary" | "secondary" | "ghost" | null | undefined;
|
|
1402
|
-
size?: "
|
|
1466
|
+
variant?: "link" | "danger" | "primary" | "secondary" | "ghost" | "dangerGhost" | null | undefined;
|
|
1467
|
+
size?: "xs" | "sm" | "md" | null | undefined;
|
|
1468
|
+
iconOnly?: boolean | null | undefined;
|
|
1403
1469
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1404
1470
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
1405
|
-
/**
|
|
1471
|
+
/**
|
|
1472
|
+
* Render the button styling onto the single child element instead of a
|
|
1473
|
+
* `<button>` (e.g. a router `<Link>` or an `<a>`). The child must be exactly
|
|
1474
|
+
* one React element; it keeps its own tag, content and semantics.
|
|
1475
|
+
*/
|
|
1406
1476
|
asChild?: boolean;
|
|
1407
|
-
/**
|
|
1477
|
+
/**
|
|
1478
|
+
* Shows a spinner in place of the leading edge and disables the button.
|
|
1479
|
+
* With `asChild` there is no spinner (the child owns its content, and a
|
|
1480
|
+
* spinner belongs inside a real `<button>`): `loading` only sets
|
|
1481
|
+
* `aria-busy` and forwards `disabled` to the child, which only has an
|
|
1482
|
+
* effect on elements that support it -- an `<a>` stays clickable, so block
|
|
1483
|
+
* navigation yourself while loading.
|
|
1484
|
+
*/
|
|
1408
1485
|
loading?: boolean;
|
|
1409
1486
|
/** Button label and/or icon. With `asChild`, the single element that receives the button styling. */
|
|
1410
1487
|
children?: ReactNode;
|
|
1411
1488
|
}
|
|
1412
1489
|
/**
|
|
1413
1490
|
* @pattern Button
|
|
1414
|
-
* @description
|
|
1415
|
-
*
|
|
1491
|
+
* @description The one control for every clickable action, from the main call
|
|
1492
|
+
* to action on a screen down to a quiet toolbar utility. Six variants
|
|
1493
|
+
* (primary, secondary, ghost, danger, dangerGhost, link) across three sizes
|
|
1494
|
+
* (xs, sm, md), labelled or icon-only.
|
|
1416
1495
|
* Supports polymorphic rendering via `asChild` (Radix Slot) to apply button
|
|
1417
1496
|
* styling to a different element, e.g. a router `<Link>`. Also exports the
|
|
1418
1497
|
* raw `buttonVariants` cva function for consumers composing button styling
|
|
1419
1498
|
* onto something other than this component.
|
|
1420
|
-
* @tokens bg-brand-primaryAction, text-brand-onprimary, bg-surface, text-text-primary, border-border-interactive, hover:bg-subtle, bg-status-danger, text-status-onstatus, text-text-link, rounded-control, duration-(--mr-motion-duration-interactive), ease-interactive
|
|
1499
|
+
* @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
|
|
1421
1500
|
* @dependencies class-variance-authority, @radix-ui/react-slot, lucide-react
|
|
1422
1501
|
* @variant primary - The one primary action on a screen. Solid brand fill.
|
|
1423
1502
|
* @variant secondary - Any other real action competing for attention (Cancel, Export). Bordered, neutral fill.
|
|
1424
1503
|
* @variant ghost - Low-emphasis action inside a dense toolbar or row where a border would add visual noise.
|
|
1425
|
-
* @variant danger -
|
|
1504
|
+
* @variant danger - Filled red. Only for a confirmed destructive action, typically the confirm button in a dialog. Never pair with `primary` in the same control group.
|
|
1505
|
+
* @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.
|
|
1426
1506
|
* @variant link - Reads as inline text, not a control. Use inside body copy or where a full button would overpower the surrounding content.
|
|
1427
1507
|
* @behavior `disabled` removes pointer events entirely (not just a style
|
|
1428
1508
|
* change) and dims to 40% opacity. Focus handling is a deliberate exception:
|
|
@@ -1430,16 +1510,42 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
|
|
|
1430
1510
|
* but Button suppresses it (`focus-visible:outline-hidden focus-visible:ring-0`)
|
|
1431
1511
|
* and relies on its per-variant hover/brightness treatment instead. `loading`
|
|
1432
1512
|
* implies `disabled` (and sets `aria-busy`), since a control mid-submit
|
|
1433
|
-
* shouldn't accept another click.
|
|
1434
|
-
*
|
|
1513
|
+
* shouldn't accept another click. `asChild` renders only the child element,
|
|
1514
|
+
* through Radix `Slot`, with the button classes, ref and remaining props
|
|
1515
|
+
* merged onto it -- no wrapping `<button>`. With `asChild`, `loading` draws
|
|
1516
|
+
* no spinner; it sets `aria-busy` and forwards `disabled`, which an `<a>`
|
|
1517
|
+
* ignores, so a loading link stays clickable unless the caller blocks it.
|
|
1518
|
+
* @a11y Renders a native <button>, so it keeps native keyboard behaviour
|
|
1519
|
+
* (with `asChild`, the child element's own semantics apply instead).
|
|
1435
1520
|
* `loading` sets aria-busy, and the spinner is aria-hidden. Icon-only
|
|
1436
1521
|
* usage needs an aria-label from the caller -- nothing here supplies one.
|
|
1522
|
+
* @use when the user is triggering an action in place -- saving, applying,
|
|
1523
|
+
* confirming, opening a dialog, running an export.
|
|
1524
|
+
* @use when you need a destructive affordance: dangerGhost inline in a row or
|
|
1525
|
+
* toolbar, danger only as the confirm button in a dialog already opened.
|
|
1526
|
+
* @use when an action sits inside a sentence -- variant="link", which drops
|
|
1527
|
+
* the box and the semibold weight so it does not read as emphasis.
|
|
1528
|
+
* @use when the action is icon-only in a dense toolbar -- iconOnly squares the
|
|
1529
|
+
* box at whichever size you picked, so it lines up with labelled buttons
|
|
1530
|
+
* beside it. Supply an aria-label; nothing here does.
|
|
1531
|
+
* @avoid when the control navigates to a different route -- render a real link
|
|
1532
|
+
* via asChild, so middle-click, right-click and open-in-new-tab keep working.
|
|
1533
|
+
* variant="link" styles a button as text; it does not make a button a link.
|
|
1534
|
+
* @avoid when there is already a primary on the screen -- a second primary
|
|
1535
|
+
* means neither reads as the main action. Use secondary or ghost.
|
|
1536
|
+
* @avoid when the control toggles a persistent on/off state -- use CheckBox or
|
|
1537
|
+
* a switch. A button fires; it does not hold a state.
|
|
1538
|
+
* @avoid when you are about to hand-roll a button with raw classes. There is
|
|
1539
|
+
* no case this does not cover, and every copy is a divergence in hover, focus,
|
|
1540
|
+
* disabled and loading behaviour at once.
|
|
1437
1541
|
* @usage
|
|
1438
1542
|
* ```tsx
|
|
1439
1543
|
* <Button variant="primary" size="md">Save changes</Button>
|
|
1544
|
+
* <Button variant="dangerGhost" size="sm" iconOnly aria-label="Remove row"><X size={15} /></Button>
|
|
1440
1545
|
* <Button variant="secondary" size="sm">Cancel</Button>
|
|
1441
1546
|
* <Button variant="danger">Delete</Button>
|
|
1442
1547
|
* <Button variant="primary" loading>Saving…</Button>
|
|
1548
|
+
* <Button asChild variant="secondary"><a href="/reports">View reports</a></Button>
|
|
1443
1549
|
* ```
|
|
1444
1550
|
*/
|
|
1445
1551
|
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1720,11 +1826,24 @@ interface TagProps {
|
|
|
1720
1826
|
}
|
|
1721
1827
|
/**
|
|
1722
1828
|
* @pattern Tag
|
|
1723
|
-
* @description Canonical descriptive tag
|
|
1724
|
-
*
|
|
1725
|
-
*
|
|
1726
|
-
*
|
|
1727
|
-
*
|
|
1829
|
+
* @description Canonical descriptive tag -- a neutral chip naming what a
|
|
1830
|
+
* thing IS: a category, a media type, a focus area. Always neutral, never
|
|
1831
|
+
* semantic, never removable.
|
|
1832
|
+
*
|
|
1833
|
+
* The product separates three jobs that most systems collapse into one, by
|
|
1834
|
+
* who authored the label. Badge is the system's view of a thing (status,
|
|
1835
|
+
* count, AI-generated) and its colour means something. Tag is the thing
|
|
1836
|
+
* describing itself, and stays neutral. FilterChipBar is the user describing
|
|
1837
|
+
* what they want to see, and is the only one you can remove.
|
|
1838
|
+
* @use when labelling what something is -- a category, a media type, a focus
|
|
1839
|
+
* area, a property of the row rather than a judgement about it.
|
|
1840
|
+
* @avoid when the colour would mean something. A status, a count, an
|
|
1841
|
+
* AI marker or anything the system decided is a Badge.
|
|
1842
|
+
* @avoid when the user should be able to dismiss it. An applied filter is a
|
|
1843
|
+
* FilterChipBar chip, which belongs to the filter bar rather than to the row.
|
|
1844
|
+
* @avoid when there are more than a handful in a row. Tags are scanned, and a
|
|
1845
|
+
* dozen neutral chips read as texture rather than as information.
|
|
1846
|
+
* @tokens text-micro, bg-subtle, text-text-tertiary, rounded-full
|
|
1728
1847
|
* @usage
|
|
1729
1848
|
* ```tsx
|
|
1730
1849
|
* <Tag>Digital</Tag>
|
|
@@ -1986,4 +2105,4 @@ interface FreshnessProps {
|
|
|
1986
2105
|
*/
|
|
1987
2106
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
1988
2107
|
|
|
1989
|
-
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
|
2108
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -229,6 +229,60 @@ interface BadgeProps {
|
|
|
229
229
|
*/
|
|
230
230
|
declare function Badge({ tone, kind, dot, children, className }: BadgeProps): react.JSX.Element;
|
|
231
231
|
|
|
232
|
+
interface DeltaProps {
|
|
233
|
+
/** The change itself. Its sign picks the direction; render the absolute value. */
|
|
234
|
+
value: number;
|
|
235
|
+
/** What the number is in -- "%" for a percentage, "pts" for share points. */
|
|
236
|
+
suffix?: string;
|
|
237
|
+
/**
|
|
238
|
+
* Adds a direction arrow before the number. For a column of deltas scanned
|
|
239
|
+
* rather than read, where the arrow is what the eye follows. A single delta
|
|
240
|
+
* beside a figure does not need one -- the sign already says which way.
|
|
241
|
+
*/
|
|
242
|
+
arrow?: boolean;
|
|
243
|
+
/** Appended after the suffix, e.g. "YoY". Keep it to one or two words. */
|
|
244
|
+
period?: string;
|
|
245
|
+
className?: string;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* @pattern Delta
|
|
249
|
+
* @description A change over time -- the +6.2% / -2.1% beside a figure. Green
|
|
250
|
+
* up, red down, always with an explicit sign.
|
|
251
|
+
* @props
|
|
252
|
+
* value: number -- sign picks the direction
|
|
253
|
+
* suffix?: string -- "%" or "pts"
|
|
254
|
+
* arrow?: boolean (default false) -- direction arrow, for a column scanned rather than read
|
|
255
|
+
* period?: string -- e.g. "YoY"
|
|
256
|
+
* @tokens text-text-success, text-text-danger
|
|
257
|
+
* @dependencies lucide-react
|
|
258
|
+
* @behavior Takes the type size of whatever contains it rather than setting
|
|
259
|
+
* its own, because it is inline text inside a table cell or a card rather
|
|
260
|
+
* than a box of its own -- a fixed size would fight the density its table
|
|
261
|
+
* already chose.
|
|
262
|
+
* @a11y The sign is the point: colour alone cannot carry direction, for
|
|
263
|
+
* anyone who cannot distinguish the two and for anyone reading it printed or
|
|
264
|
+
* in greyscale. `+` and `-` are always rendered, so the colour is
|
|
265
|
+
* reinforcement rather than the only signal. The arrow is decorative and
|
|
266
|
+
* hidden, since the sign beside it already says the same thing.
|
|
267
|
+
* @use when showing a change against a previous period beside the figure it
|
|
268
|
+
* relates to.
|
|
269
|
+
* @use with `arrow` when deltas run down a column and the reader is scanning
|
|
270
|
+
* for the ones that moved.
|
|
271
|
+
* @avoid when the number is not a change -- a share, a total or a rate is
|
|
272
|
+
* just a number, and colouring it green or red tells the reader something
|
|
273
|
+
* untrue about it.
|
|
274
|
+
* @avoid when up is not good. Green-for-up reads as green-for-better, so a
|
|
275
|
+
* rising cost or a rising error rate needs its own treatment rather than this
|
|
276
|
+
* one inverted, which nobody will notice.
|
|
277
|
+
* @usage
|
|
278
|
+
* ```tsx
|
|
279
|
+
* <Delta value={6.2} suffix="%" />
|
|
280
|
+
* <Delta value={-2.1} suffix="%" period="YoY" />
|
|
281
|
+
* <Delta value={1.4} suffix="pts" arrow />
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
declare function Delta({ value, suffix, arrow, period, className }: DeltaProps): react.JSX.Element;
|
|
285
|
+
|
|
232
286
|
/**
|
|
233
287
|
* @pattern CheckBox
|
|
234
288
|
* @description Tri-state checkbox rendered as a `<button>` (not a native
|
|
@@ -978,18 +1032,29 @@ declare function StackedColumnPlaceholder({ height, width, legendRows, axis, }:
|
|
|
978
1032
|
* escapes both `overflow` clipping inside scrollable panels and the broken
|
|
979
1033
|
* `fixed` containing block a transformed ancestor creates.
|
|
980
1034
|
* @tokens rounded-control, border-border-default, bg-surface, shadow-overlay,
|
|
981
|
-
* text-text-primary, bg-text-primary, text-surface
|
|
1035
|
+
* text-text-primary, bg-text-primary, text-surface,
|
|
1036
|
+
* duration-(--mr-motion-duration-interactive)
|
|
982
1037
|
* @variant surface - Default. Themed surface/border bubble -- matches the
|
|
983
1038
|
* Recharts chart tooltips this was originally built for.
|
|
984
1039
|
* @variant inverted - Solid dark pill (no border) -- for a tooltip sitting
|
|
985
1040
|
* over a nav rail or other icon-only surface, where the themed surface bubble
|
|
986
1041
|
* doesn't read as clearly against a busy background.
|
|
987
1042
|
* @behavior Shows on hover and on keyboard focus (so it stays reachable
|
|
988
|
-
* without a pointer) after `delay` ms (0 = immediate, the default).
|
|
989
|
-
*
|
|
990
|
-
*
|
|
991
|
-
*
|
|
992
|
-
*
|
|
1043
|
+
* without a pointer) after `delay` ms (0 = immediate, the default). Fades in
|
|
1044
|
+
* and out (opacity, `ease-in-out`, over the sys
|
|
1045
|
+
* `--mr-motion-duration-interactive` token -- 200ms today); the bubble stays
|
|
1046
|
+
* mounted through the fade-out and is removed from the DOM once it ends.
|
|
1047
|
+
* Under `prefers-reduced-motion: reduce` there is no fade: it appears and is
|
|
1048
|
+
* removed instantly. The hide starts on mouseleave/blur, cancelling a pending
|
|
1049
|
+
* delayed show if it hasn't fired yet -- except in `interactive` mode, which
|
|
1050
|
+
* delays the hide briefly so the pointer can travel from the trigger into the
|
|
1051
|
+
* tooltip's own content. Re-hovering (or re-focusing) the trigger while the
|
|
1052
|
+
* bubble is still fading out reverses the fade from where it is, without
|
|
1053
|
+
* waiting out `delay` again, since it is already on screen; so does moving
|
|
1054
|
+
* the pointer back into an `interactive` bubble. A non-interactive bubble is
|
|
1055
|
+
* `pointer-events-none` throughout, fade-out included, so it never
|
|
1056
|
+
* intercepts clicks meant for what sits under it. Pass `whenTruncated` to
|
|
1057
|
+
* only surface it once the trigger's content
|
|
993
1058
|
* is actually clipped by ellipsis (`scrollWidth > clientWidth`). `placement`
|
|
994
1059
|
* 'top'/'bottom' centre (or `align="start"` left-align) on the trigger;
|
|
995
1060
|
* 'right' centres vertically beside the anchor and 'bottom-end' hangs below,
|
|
@@ -1398,31 +1463,46 @@ interface PublisherBreakdownListProps {
|
|
|
1398
1463
|
declare function PublisherBreakdownList({ rows, defaultVisibleCount, padded, viewAllHref, renderLogo }: PublisherBreakdownListProps): react.JSX.Element;
|
|
1399
1464
|
|
|
1400
1465
|
declare const buttonVariants: (props?: ({
|
|
1401
|
-
variant?: "link" | "danger" | "primary" | "secondary" | "ghost" | null | undefined;
|
|
1402
|
-
size?: "
|
|
1466
|
+
variant?: "link" | "danger" | "primary" | "secondary" | "ghost" | "dangerGhost" | null | undefined;
|
|
1467
|
+
size?: "xs" | "sm" | "md" | null | undefined;
|
|
1468
|
+
iconOnly?: boolean | null | undefined;
|
|
1403
1469
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1404
1470
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
1405
|
-
/**
|
|
1471
|
+
/**
|
|
1472
|
+
* Render the button styling onto the single child element instead of a
|
|
1473
|
+
* `<button>` (e.g. a router `<Link>` or an `<a>`). The child must be exactly
|
|
1474
|
+
* one React element; it keeps its own tag, content and semantics.
|
|
1475
|
+
*/
|
|
1406
1476
|
asChild?: boolean;
|
|
1407
|
-
/**
|
|
1477
|
+
/**
|
|
1478
|
+
* Shows a spinner in place of the leading edge and disables the button.
|
|
1479
|
+
* With `asChild` there is no spinner (the child owns its content, and a
|
|
1480
|
+
* spinner belongs inside a real `<button>`): `loading` only sets
|
|
1481
|
+
* `aria-busy` and forwards `disabled` to the child, which only has an
|
|
1482
|
+
* effect on elements that support it -- an `<a>` stays clickable, so block
|
|
1483
|
+
* navigation yourself while loading.
|
|
1484
|
+
*/
|
|
1408
1485
|
loading?: boolean;
|
|
1409
1486
|
/** Button label and/or icon. With `asChild`, the single element that receives the button styling. */
|
|
1410
1487
|
children?: ReactNode;
|
|
1411
1488
|
}
|
|
1412
1489
|
/**
|
|
1413
1490
|
* @pattern Button
|
|
1414
|
-
* @description
|
|
1415
|
-
*
|
|
1491
|
+
* @description The one control for every clickable action, from the main call
|
|
1492
|
+
* to action on a screen down to a quiet toolbar utility. Six variants
|
|
1493
|
+
* (primary, secondary, ghost, danger, dangerGhost, link) across three sizes
|
|
1494
|
+
* (xs, sm, md), labelled or icon-only.
|
|
1416
1495
|
* Supports polymorphic rendering via `asChild` (Radix Slot) to apply button
|
|
1417
1496
|
* styling to a different element, e.g. a router `<Link>`. Also exports the
|
|
1418
1497
|
* raw `buttonVariants` cva function for consumers composing button styling
|
|
1419
1498
|
* onto something other than this component.
|
|
1420
|
-
* @tokens bg-brand-primaryAction, text-brand-onprimary, bg-surface, text-text-primary, border-border-interactive, hover:bg-subtle, bg-status-danger, text-status-onstatus, text-text-link, rounded-control, duration-(--mr-motion-duration-interactive), ease-interactive
|
|
1499
|
+
* @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
|
|
1421
1500
|
* @dependencies class-variance-authority, @radix-ui/react-slot, lucide-react
|
|
1422
1501
|
* @variant primary - The one primary action on a screen. Solid brand fill.
|
|
1423
1502
|
* @variant secondary - Any other real action competing for attention (Cancel, Export). Bordered, neutral fill.
|
|
1424
1503
|
* @variant ghost - Low-emphasis action inside a dense toolbar or row where a border would add visual noise.
|
|
1425
|
-
* @variant danger -
|
|
1504
|
+
* @variant danger - Filled red. Only for a confirmed destructive action, typically the confirm button in a dialog. Never pair with `primary` in the same control group.
|
|
1505
|
+
* @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.
|
|
1426
1506
|
* @variant link - Reads as inline text, not a control. Use inside body copy or where a full button would overpower the surrounding content.
|
|
1427
1507
|
* @behavior `disabled` removes pointer events entirely (not just a style
|
|
1428
1508
|
* change) and dims to 40% opacity. Focus handling is a deliberate exception:
|
|
@@ -1430,16 +1510,42 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
|
|
|
1430
1510
|
* but Button suppresses it (`focus-visible:outline-hidden focus-visible:ring-0`)
|
|
1431
1511
|
* and relies on its per-variant hover/brightness treatment instead. `loading`
|
|
1432
1512
|
* implies `disabled` (and sets `aria-busy`), since a control mid-submit
|
|
1433
|
-
* shouldn't accept another click.
|
|
1434
|
-
*
|
|
1513
|
+
* shouldn't accept another click. `asChild` renders only the child element,
|
|
1514
|
+
* through Radix `Slot`, with the button classes, ref and remaining props
|
|
1515
|
+
* merged onto it -- no wrapping `<button>`. With `asChild`, `loading` draws
|
|
1516
|
+
* no spinner; it sets `aria-busy` and forwards `disabled`, which an `<a>`
|
|
1517
|
+
* ignores, so a loading link stays clickable unless the caller blocks it.
|
|
1518
|
+
* @a11y Renders a native <button>, so it keeps native keyboard behaviour
|
|
1519
|
+
* (with `asChild`, the child element's own semantics apply instead).
|
|
1435
1520
|
* `loading` sets aria-busy, and the spinner is aria-hidden. Icon-only
|
|
1436
1521
|
* usage needs an aria-label from the caller -- nothing here supplies one.
|
|
1522
|
+
* @use when the user is triggering an action in place -- saving, applying,
|
|
1523
|
+
* confirming, opening a dialog, running an export.
|
|
1524
|
+
* @use when you need a destructive affordance: dangerGhost inline in a row or
|
|
1525
|
+
* toolbar, danger only as the confirm button in a dialog already opened.
|
|
1526
|
+
* @use when an action sits inside a sentence -- variant="link", which drops
|
|
1527
|
+
* the box and the semibold weight so it does not read as emphasis.
|
|
1528
|
+
* @use when the action is icon-only in a dense toolbar -- iconOnly squares the
|
|
1529
|
+
* box at whichever size you picked, so it lines up with labelled buttons
|
|
1530
|
+
* beside it. Supply an aria-label; nothing here does.
|
|
1531
|
+
* @avoid when the control navigates to a different route -- render a real link
|
|
1532
|
+
* via asChild, so middle-click, right-click and open-in-new-tab keep working.
|
|
1533
|
+
* variant="link" styles a button as text; it does not make a button a link.
|
|
1534
|
+
* @avoid when there is already a primary on the screen -- a second primary
|
|
1535
|
+
* means neither reads as the main action. Use secondary or ghost.
|
|
1536
|
+
* @avoid when the control toggles a persistent on/off state -- use CheckBox or
|
|
1537
|
+
* a switch. A button fires; it does not hold a state.
|
|
1538
|
+
* @avoid when you are about to hand-roll a button with raw classes. There is
|
|
1539
|
+
* no case this does not cover, and every copy is a divergence in hover, focus,
|
|
1540
|
+
* disabled and loading behaviour at once.
|
|
1437
1541
|
* @usage
|
|
1438
1542
|
* ```tsx
|
|
1439
1543
|
* <Button variant="primary" size="md">Save changes</Button>
|
|
1544
|
+
* <Button variant="dangerGhost" size="sm" iconOnly aria-label="Remove row"><X size={15} /></Button>
|
|
1440
1545
|
* <Button variant="secondary" size="sm">Cancel</Button>
|
|
1441
1546
|
* <Button variant="danger">Delete</Button>
|
|
1442
1547
|
* <Button variant="primary" loading>Saving…</Button>
|
|
1548
|
+
* <Button asChild variant="secondary"><a href="/reports">View reports</a></Button>
|
|
1443
1549
|
* ```
|
|
1444
1550
|
*/
|
|
1445
1551
|
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1720,11 +1826,24 @@ interface TagProps {
|
|
|
1720
1826
|
}
|
|
1721
1827
|
/**
|
|
1722
1828
|
* @pattern Tag
|
|
1723
|
-
* @description Canonical descriptive tag
|
|
1724
|
-
*
|
|
1725
|
-
*
|
|
1726
|
-
*
|
|
1727
|
-
*
|
|
1829
|
+
* @description Canonical descriptive tag -- a neutral chip naming what a
|
|
1830
|
+
* thing IS: a category, a media type, a focus area. Always neutral, never
|
|
1831
|
+
* semantic, never removable.
|
|
1832
|
+
*
|
|
1833
|
+
* The product separates three jobs that most systems collapse into one, by
|
|
1834
|
+
* who authored the label. Badge is the system's view of a thing (status,
|
|
1835
|
+
* count, AI-generated) and its colour means something. Tag is the thing
|
|
1836
|
+
* describing itself, and stays neutral. FilterChipBar is the user describing
|
|
1837
|
+
* what they want to see, and is the only one you can remove.
|
|
1838
|
+
* @use when labelling what something is -- a category, a media type, a focus
|
|
1839
|
+
* area, a property of the row rather than a judgement about it.
|
|
1840
|
+
* @avoid when the colour would mean something. A status, a count, an
|
|
1841
|
+
* AI marker or anything the system decided is a Badge.
|
|
1842
|
+
* @avoid when the user should be able to dismiss it. An applied filter is a
|
|
1843
|
+
* FilterChipBar chip, which belongs to the filter bar rather than to the row.
|
|
1844
|
+
* @avoid when there are more than a handful in a row. Tags are scanned, and a
|
|
1845
|
+
* dozen neutral chips read as texture rather than as information.
|
|
1846
|
+
* @tokens text-micro, bg-subtle, text-text-tertiary, rounded-full
|
|
1728
1847
|
* @usage
|
|
1729
1848
|
* ```tsx
|
|
1730
1849
|
* <Tag>Digital</Tag>
|
|
@@ -1986,4 +2105,4 @@ interface FreshnessProps {
|
|
|
1986
2105
|
*/
|
|
1987
2106
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
1988
2107
|
|
|
1989
|
-
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
|
2108
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|