@mediaradar/design-components 0.30.0 → 0.32.1
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 +844 -661
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +314 -60
- package/dist/index.d.ts +314 -60
- package/dist/index.js +843 -665
- package/dist/index.js.map +1 -1
- package/package.json +8 -4
package/dist/index.d.ts
CHANGED
|
@@ -122,10 +122,12 @@ interface AdvertiserQuickFilterProps {
|
|
|
122
122
|
/** The clear link in footerless mode (unused when `showFooter` is set). */
|
|
123
123
|
clearLabel?: string;
|
|
124
124
|
/**
|
|
125
|
-
* Optional prefix for `data-testid` attributes on the trigger
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
125
|
+
* Optional prefix for `data-testid` attributes on the trigger
|
|
126
|
+
* (`${testIdPrefix}-trigger`), the popover (`-popover`), the search input
|
|
127
|
+
* (`-search`), the selected-section toggle (`-selected-toggle`), the
|
|
128
|
+
* select-all-visible row (`-select-all-visible`), each option row
|
|
129
|
+
* (`-option-<slugified-id>`), and the footer's Clear All (`-clear-all`) and
|
|
130
|
+
* Apply (`-apply`). Omit entirely for no test-id wiring at all --
|
|
129
131
|
* added specifically so an existing Playwright suite keyed off these ids
|
|
130
132
|
* (mr-clientapps' `AdvertisersPicker`) doesn't lose its locators when
|
|
131
133
|
* swapped over to this shared component.
|
|
@@ -167,11 +169,15 @@ type BadgeTone = "neutral" | "brand" | "brandSolid" | "success" | "warning" | "d
|
|
|
167
169
|
* keeps this two small props instead of one list of every combination the
|
|
168
170
|
* product happens to use today.
|
|
169
171
|
*/
|
|
170
|
-
type BadgeKind = "label" | "count" | "eyebrow";
|
|
172
|
+
type BadgeKind = "label" | "count" | "eyebrow" | "category";
|
|
171
173
|
interface BadgeProps {
|
|
172
174
|
/** What kind of thing this marks. Not a colour choice. */
|
|
173
175
|
tone?: BadgeTone;
|
|
174
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Shape and case. `count` for a number, `eyebrow` for a small-caps label,
|
|
178
|
+
* `category` for what a thing is (a topic, a category): always quiet grey,
|
|
179
|
+
* `tone` is ignored.
|
|
180
|
+
*/
|
|
175
181
|
kind?: BadgeKind;
|
|
176
182
|
/**
|
|
177
183
|
* Draws a small filled dot before the label, in the tone's own ink. For a
|
|
@@ -193,14 +199,14 @@ interface BadgeProps {
|
|
|
193
199
|
* between them cover every badge treatment in the product.
|
|
194
200
|
* @props
|
|
195
201
|
* tone?: 'neutral' | 'brand' | 'brandSolid' | 'success' | 'warning' | 'danger' | 'ai' | 'overlay' (default 'neutral')
|
|
196
|
-
* kind?: 'label' | 'count' | 'eyebrow' (default 'label')
|
|
202
|
+
* kind?: 'label' | 'count' | 'eyebrow' | 'category' (default 'label') -- category is always grey, tone ignored
|
|
197
203
|
* dot?: boolean (default false) -- a filled dot before the label, in the tone's ink
|
|
198
204
|
* children: ReactNode
|
|
199
205
|
* @tokens text-micro, rounded-full, bg-current, bg-subtle, bg-brand-primarySoft, bg-brand-primaryAction,
|
|
200
206
|
* bg-status-success/15, bg-status-warning/30, bg-status-danger/15, bg-scrim,
|
|
201
207
|
* text-text-secondary, text-brand-primaryAction, text-text-success,
|
|
202
208
|
* text-text-warning, text-text-danger, text-ai-ontint, text-brand-onprimary,
|
|
203
|
-
* border-transparent
|
|
209
|
+
* border-transparent, text-text-tertiary
|
|
204
210
|
* @behavior Not interactive and carries no role: a badge is a label on
|
|
205
211
|
* something else, so it is read as part of that thing rather than announced
|
|
206
212
|
* separately. Anything clickable is a Button or a filter chip, not a Badge.
|
|
@@ -434,9 +440,14 @@ declare function CheckBoxBox({ checked, indeterminate, disabled, className }: Ch
|
|
|
434
440
|
* values, so a previous unsaved edit never lingers into the next open. Only
|
|
435
441
|
* the Apply button commits -- Cancel, Escape, and outside-click all discard
|
|
436
442
|
* the draft silently.
|
|
443
|
+
* `granularity="month"` rounds every range out to whole months (presets,
|
|
444
|
+
* clicked days and Apply alike), shows months on the trigger, and adds a
|
|
445
|
+
* "Data is monthly" note beside Cancel/Apply.
|
|
437
446
|
* @a11y Trigger is a <button> with aria-expanded and an aria-label from the
|
|
438
447
|
* caption; the panel is role="dialog" and Escape closes it. Focus is not
|
|
439
448
|
* moved into the panel, so it is reached by tabbing.
|
|
449
|
+
* @use for every date range in the product; `granularity="month"` for monthly data.
|
|
450
|
+
* @avoid DateRangePicker, which is being retired.
|
|
440
451
|
* @usage
|
|
441
452
|
* ```tsx
|
|
442
453
|
* <DateRangeFilter caption="Date range" defaultValue="Rolling 6 months" onChange={setRange} />
|
|
@@ -485,10 +496,21 @@ interface DateRangeFilterProps {
|
|
|
485
496
|
icon?: React.ReactNode;
|
|
486
497
|
/** 'creativeIntel' swaps in the day-level shortcut list (Today/Yesterday/Last N days/All available history) used by that dashboard. */
|
|
487
498
|
presetSet?: "default" | "creativeIntel";
|
|
488
|
-
/**
|
|
499
|
+
/**
|
|
500
|
+
* Prefix for `data-testid` attributes on the trigger (`${testIdPrefix}-trigger`),
|
|
501
|
+
* the popover (`-popover`), each preset (`-option-<slugified-label>`, e.g.
|
|
502
|
+
* `-option-last-7-days`), and Cancel (`-cancel`) / Apply (`-apply`). Omit for
|
|
503
|
+
* no test-id wiring.
|
|
504
|
+
*/
|
|
489
505
|
testIdPrefix?: string;
|
|
506
|
+
/**
|
|
507
|
+
* 'month' for screens whose data comes by month: every range rounds out to
|
|
508
|
+
* whole months (start on the 1st, end on the last day) and the panel says
|
|
509
|
+
* "Data is monthly". Defaults to 'day'.
|
|
510
|
+
*/
|
|
511
|
+
granularity?: "day" | "month";
|
|
490
512
|
}
|
|
491
|
-
declare function DateRangeFilter({ caption, defaultValue, value: controlledValue, range: controlledRange, align, placement, onChange, onRangeChange, showDates, shortDates, icon, presetSet, testIdPrefix, }: DateRangeFilterProps): react.JSX.Element;
|
|
513
|
+
declare function DateRangeFilter({ caption, defaultValue, value: controlledValue, range: controlledRange, align, placement, onChange, onRangeChange, showDates, shortDates, icon, presetSet, testIdPrefix, granularity, }: DateRangeFilterProps): react.JSX.Element;
|
|
492
514
|
|
|
493
515
|
/**
|
|
494
516
|
* @pattern SearchBar
|
|
@@ -560,10 +582,11 @@ interface SearchBarProps {
|
|
|
560
582
|
onMatchChange?: (v: SearchMatchValue) => void;
|
|
561
583
|
className?: string;
|
|
562
584
|
/**
|
|
563
|
-
* Optional prefix for `data-testid` attributes on the input
|
|
564
|
-
*
|
|
565
|
-
* (
|
|
566
|
-
*
|
|
585
|
+
* Optional prefix for `data-testid` attributes on the input
|
|
586
|
+
* (`${testIdPrefix}-search`), its clear button (`-clear`), the match-type
|
|
587
|
+
* trigger (`-mode-trigger`) and popover (`-mode-popover`), each mode row
|
|
588
|
+
* (`-mode-anyWord`, `-mode-exactMatch`, `-mode-contextual`, `-mode-adCode`),
|
|
589
|
+
* and the Or/And radio pair (`-word-join-or`, `-word-join-and`). Omit
|
|
567
590
|
* entirely for no test-id wiring at all -- added specifically so an
|
|
568
591
|
* existing Playwright suite keyed off these ids (mr-clientapps'
|
|
569
592
|
* `KeywordSearchBar`) doesn't lose its locators when swapped over to
|
|
@@ -642,10 +665,11 @@ declare function SectionRail({ title, titleSerif, subtitle, viewAllLabel, viewAl
|
|
|
642
665
|
* invalid HTML that breaks click targeting (confirmed against how
|
|
643
666
|
* mr-clientapps-insights-studio's own equivalent, `ChipOption`, already
|
|
644
667
|
* avoids exactly this by rendering its InfoTip as a sibling, not a child).
|
|
645
|
-
* @a11y Trigger is a <button> with aria-expanded
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
668
|
+
* @a11y Trigger is a <button> with aria-expanded; the menu is a labelled
|
|
669
|
+
* group of two buttons carrying aria-pressed, not a listbox, because the
|
|
670
|
+
* "Final only" row also holds an InfoTip button and a listbox may only
|
|
671
|
+
* contain options. The InfoTip sits 8px from its row so both meet the
|
|
672
|
+
* 24px target-size rule. Escape closes it.
|
|
649
673
|
* @usage
|
|
650
674
|
* ```tsx
|
|
651
675
|
* <DataScopeFilter value={finalOnly} onChange={setFinalOnly} />
|
|
@@ -672,13 +696,15 @@ declare function DataScopeFilter({ value, onChange, align }: DataScopeFilterProp
|
|
|
672
696
|
* border-border-strong, bg-input, bg-surface, shadow-overlay,
|
|
673
697
|
* text-text-primary, text-text-secondary,
|
|
674
698
|
* text-text-tertiary, hover:bg-subtle, hover:text-text-primary,
|
|
675
|
-
* text-brand-primaryAction, focus-visible:outline-border-focus
|
|
699
|
+
* text-brand-primaryAction, focus-visible:outline-border-focus, text-dense
|
|
676
700
|
* @dependencies lucide-react
|
|
677
701
|
* @behavior The popover is portal-rendered to document.body, so its own DOM
|
|
678
702
|
* node isn't inside the trigger. The outside-click check tests both the
|
|
679
703
|
* trigger and the popover explicitly for that reason -- treating the
|
|
680
704
|
* popover as "outside" would close it on every option click before
|
|
681
|
-
* `onChange` ever fires, so nothing would ever get selected.
|
|
705
|
+
* `onChange` ever fires, so nothing would ever get selected. `loading` swaps
|
|
706
|
+
* the list for grey placeholder rows and `error` for a plain "Couldn't load
|
|
707
|
+
* options." line with a Try again link (`onRetry`); the trigger never changes. Selecting an
|
|
682
708
|
* option commits immediately and closes -- there's no separate draft/Apply
|
|
683
709
|
* step; Escape and outside-click just close without side effects.
|
|
684
710
|
* `renderIcon`, when given, puts a small image before each option's label and
|
|
@@ -691,6 +717,7 @@ declare function DataScopeFilter({ value, onChange, align }: DataScopeFilterProp
|
|
|
691
717
|
* the caption. The popover is not a focus trap and does not move focus on
|
|
692
718
|
* open, so keyboard users tab into it; a consumer rendering it inside
|
|
693
719
|
* another dismissible layer has to sequence the two dismissals itself.
|
|
720
|
+
* The loading rows carry role="status" and the error line role="alert".
|
|
694
721
|
* Icons from `renderIcon` are wrapped aria-hidden, so each option's accessible
|
|
695
722
|
* name stays its label text -- don't put meaning in the icon that the label
|
|
696
723
|
* doesn't also say.
|
|
@@ -728,6 +755,20 @@ interface SelectFilterProps {
|
|
|
728
755
|
* to this shared component's ids rather than losing its locators outright.
|
|
729
756
|
*/
|
|
730
757
|
testIdPrefix?: string;
|
|
758
|
+
/** Options are still loading: the menu shows grey placeholder rows. */
|
|
759
|
+
loading?: boolean;
|
|
760
|
+
/** Options failed to load: the menu shows a plain message and Try again. */
|
|
761
|
+
error?: boolean;
|
|
762
|
+
/** Called by the Try again link in the error state. */
|
|
763
|
+
onRetry?: () => void;
|
|
764
|
+
/**
|
|
765
|
+
* 'sm' is the compact 32px trigger with no visible caption (the caption
|
|
766
|
+
* becomes its accessible name) -- for tight spots such as the rows-per-page
|
|
767
|
+
* control in TablePagination. Defaults to 'md', the 44px caption chip.
|
|
768
|
+
*/
|
|
769
|
+
size?: "md" | "sm";
|
|
770
|
+
/** Fades the trigger to 40% and blocks it, e.g. while a table loads. */
|
|
771
|
+
disabled?: boolean;
|
|
731
772
|
/**
|
|
732
773
|
* Optional leading icon for each option, called with the option's string.
|
|
733
774
|
* Shown before the label in the list and before the value in the trigger,
|
|
@@ -737,7 +778,7 @@ interface SelectFilterProps {
|
|
|
737
778
|
*/
|
|
738
779
|
renderIcon?: (option: string) => ReactNode;
|
|
739
780
|
}
|
|
740
|
-
declare function SelectFilter({ caption, value, options, onChange, align, fullWidth, className, testIdPrefix, renderIcon, }: SelectFilterProps): react.JSX.Element;
|
|
781
|
+
declare function SelectFilter({ caption, value, options, onChange, align, fullWidth, className, testIdPrefix, loading, error, onRetry, size, disabled, renderIcon, }: SelectFilterProps): react.JSX.Element;
|
|
741
782
|
|
|
742
783
|
/**
|
|
743
784
|
* @pattern Card
|
|
@@ -1219,7 +1260,7 @@ interface TooltipProps {
|
|
|
1219
1260
|
delay?: number;
|
|
1220
1261
|
/** 'surface' (default) or 'inverted' -- see the pattern description. */
|
|
1221
1262
|
variant?: "surface" | "inverted";
|
|
1222
|
-
/** Optional prefix for
|
|
1263
|
+
/** Optional prefix for the floating bubble's `data-testid` (`${testIdPrefix}-tooltip`). */
|
|
1223
1264
|
testIdPrefix?: string;
|
|
1224
1265
|
}
|
|
1225
1266
|
declare function Tooltip({ label, children, anchorRef, className, whenTruncated, interactive, placement, align, delay, variant, testIdPrefix, }: TooltipProps): react.JSX.Element | null;
|
|
@@ -1279,7 +1320,7 @@ interface SelectAllVisibleProps {
|
|
|
1279
1320
|
/** Whether every visible result is already selected. */
|
|
1280
1321
|
allSelected: boolean;
|
|
1281
1322
|
onToggle: () => void;
|
|
1282
|
-
/** Optional prefix for
|
|
1323
|
+
/** Optional prefix for the row's `data-testid` (`${testIdPrefix}-select-all-visible`). */
|
|
1283
1324
|
testIdPrefix?: string;
|
|
1284
1325
|
}
|
|
1285
1326
|
declare function SelectAllVisible({ count, allSelected, onToggle, testIdPrefix }: SelectAllVisibleProps): react.JSX.Element;
|
|
@@ -1316,7 +1357,7 @@ interface SelectedSectionProps {
|
|
|
1316
1357
|
onToggle: () => void;
|
|
1317
1358
|
/** The caller renders each selected row itself. */
|
|
1318
1359
|
children: React.ReactNode;
|
|
1319
|
-
/** Optional prefix for
|
|
1360
|
+
/** Optional prefix for the toggle button's `data-testid` (`${testIdPrefix}-selected-toggle`). */
|
|
1320
1361
|
testIdPrefix?: string;
|
|
1321
1362
|
}
|
|
1322
1363
|
declare function SelectedSection({ count, open, onToggle, children, testIdPrefix }: SelectedSectionProps): react.JSX.Element | null;
|
|
@@ -1419,8 +1460,10 @@ interface SelectionPickerProps<T extends PickerRow> {
|
|
|
1419
1460
|
/**
|
|
1420
1461
|
* Optional prefix for `data-testid` attributes on the search input
|
|
1421
1462
|
* (`${testIdPrefix}-search`), the source toggle buttons
|
|
1422
|
-
* (`${testIdPrefix}-source-search` /
|
|
1423
|
-
* trigger (`${testIdPrefix}-filter-<slug>`) and
|
|
1463
|
+
* (`${testIdPrefix}-source-search` / `${testIdPrefix}-source-lists`),
|
|
1464
|
+
* each filter dropdown trigger (`${testIdPrefix}-filter-<slug>`) and each
|
|
1465
|
+
* of its options
|
|
1466
|
+
* (`${testIdPrefix}-filter-<slug>-<option-slug>`), the
|
|
1424
1467
|
* select-all checkbox (`${testIdPrefix}-select-all`), each row
|
|
1425
1468
|
* (`${testIdPrefix}-row-<slug>`), the Load more button
|
|
1426
1469
|
* (`${testIdPrefix}-load-more`), and each Account lists row/count
|
|
@@ -1919,7 +1962,7 @@ interface PagerProps {
|
|
|
1919
1962
|
* the left if the reader needs it.
|
|
1920
1963
|
* @avoid under a full-page table -- use TablePagination, which adds the
|
|
1921
1964
|
* first/last steps, the range readout and the rows-per-page select.
|
|
1922
|
-
* @tokens rounded-control, text-text-secondary, bg-
|
|
1965
|
+
* @tokens rounded-control, text-text-secondary, bg-subtle, text-text-primary, hover:bg-subtle, hover:text-text-primary, text-text-tertiary
|
|
1923
1966
|
* @dependencies lucide-react
|
|
1924
1967
|
* @a11y Renders its own <nav aria-label="Pagination"> landmark, like
|
|
1925
1968
|
* TablePagination, so don't wrap it in another <nav>. Pass `label` to name it
|
|
@@ -2062,29 +2105,18 @@ interface TagProps {
|
|
|
2062
2105
|
}
|
|
2063
2106
|
/**
|
|
2064
2107
|
* @pattern Tag
|
|
2065
|
-
* @description
|
|
2066
|
-
*
|
|
2067
|
-
*
|
|
2068
|
-
*
|
|
2069
|
-
*
|
|
2070
|
-
*
|
|
2071
|
-
* count, AI-generated) and its colour means something. Tag is the thing
|
|
2072
|
-
* describing itself, and stays neutral. FilterChipBar is the user describing
|
|
2073
|
-
* what they want to see, and is the only one you can remove.
|
|
2074
|
-
* @use when labelling what something is -- a category, a media type, a focus
|
|
2075
|
-
* area, a property of the row rather than a judgement about it.
|
|
2076
|
-
* @avoid when the colour would mean something. A status, a count, an
|
|
2077
|
-
* AI marker or anything the system decided is a Badge.
|
|
2078
|
-
* @avoid when the user should be able to dismiss it. An applied filter is a
|
|
2079
|
-
* FilterChipBar chip, which belongs to the filter bar rather than to the row.
|
|
2080
|
-
* @avoid when there are more than a handful in a row. Tags are scanned, and a
|
|
2081
|
-
* dozen neutral chips read as texture rather than as information.
|
|
2082
|
-
* @tokens text-micro, bg-subtle, text-text-tertiary, rounded-full
|
|
2108
|
+
* @description Being retired into Badge: a Tag is now `<Badge kind="category">`,
|
|
2109
|
+
* the quiet grey pill naming what a thing is (a topic, a category). Kept
|
|
2110
|
+
* exported so existing screens don't break; it renders exactly that Badge.
|
|
2111
|
+
* @use nowhere new -- use `<Badge kind="category">`.
|
|
2112
|
+
* @avoid it in new work.
|
|
2113
|
+
* @tokens
|
|
2083
2114
|
* @usage
|
|
2084
2115
|
* ```tsx
|
|
2085
|
-
* <
|
|
2116
|
+
* <Badge kind="category">Automotive</Badge>
|
|
2086
2117
|
* ```
|
|
2087
2118
|
*/
|
|
2119
|
+
/** @deprecated Use `<Badge kind="category">`. */
|
|
2088
2120
|
declare function Tag({ children, className }: TagProps): react.JSX.Element;
|
|
2089
2121
|
|
|
2090
2122
|
/**
|
|
@@ -2092,15 +2124,18 @@ declare function Tag({ children, className }: TagProps): react.JSX.Element;
|
|
|
2092
2124
|
* @description Full table-footer pagination bar: a rows-per-page select, a
|
|
2093
2125
|
* first/prev/pages/next/last pager, and the resolved "1 – 25 of N results"
|
|
2094
2126
|
* range. Owns no state — the host page holds `page` and `perPage` so the
|
|
2095
|
-
* paged slice and the bar can't disagree.
|
|
2096
|
-
*
|
|
2127
|
+
* paged slice and the bar can't disagree. One layout on every table: rows
|
|
2128
|
+
* per page on the left, pages in the middle, the range on the right. Without
|
|
2129
|
+
* `onPerPageChange` the rows-per-page control is hidden but holds its space,
|
|
2130
|
+
* so nothing moves.
|
|
2097
2131
|
* @use under a full-page table: the results of a search or a list the user
|
|
2098
2132
|
* works through, where the total and the page size matter.
|
|
2099
2133
|
* @avoid in a card or a compact list -- use Pager, which is only the page
|
|
2100
2134
|
* controls and fits the narrower space.
|
|
2101
|
-
* @tokens
|
|
2102
|
-
* @behavior The current page is
|
|
2103
|
-
*
|
|
2135
|
+
* @tokens rounded-control, text-text-primary, text-text-secondary, text-text-tertiary, bg-subtle, hover:bg-subtle, hover:text-text-primary
|
|
2136
|
+
* @behavior The current page is a quiet grey fill with a dark bold number,
|
|
2137
|
+
* keeping blue for actions. The rows-per-page control is the compact
|
|
2138
|
+
* SelectFilter (`size="sm"`), our own menu, not the browser's. First/prev disable on page 1, next/last on the last
|
|
2104
2139
|
* page — disabled controls stay in the layout so the row never reflows.
|
|
2105
2140
|
* Changing the per-page count reports it and leaves the host to reset to page
|
|
2106
2141
|
* 1. With one page of results the pager still renders, so the bar's height
|
|
@@ -2130,7 +2165,10 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
|
|
|
2130
2165
|
perPage: number;
|
|
2131
2166
|
totalItems: number;
|
|
2132
2167
|
onPageChange: (page: number) => void;
|
|
2133
|
-
/**
|
|
2168
|
+
/**
|
|
2169
|
+
* Omit for a table with a fixed page size. The rows-per-page control is
|
|
2170
|
+
* then hidden but keeps its space, so the pages and the range don't move.
|
|
2171
|
+
*/
|
|
2134
2172
|
onPerPageChange?: (perPage: number) => void;
|
|
2135
2173
|
perPageOptions?: number[];
|
|
2136
2174
|
itemLabel?: string;
|
|
@@ -2139,9 +2177,11 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
|
|
|
2139
2177
|
className?: string;
|
|
2140
2178
|
/**
|
|
2141
2179
|
* Optional prefix for `data-testid` attributes on the bar (`testIdPrefix`
|
|
2142
|
-
* itself), the per-page
|
|
2143
|
-
* `-
|
|
2144
|
-
*
|
|
2180
|
+
* itself), the rows-per-page menu (a `SelectFilter`: its button
|
|
2181
|
+
* `-per-page-trigger`, its list `-per-page-popover` and each size
|
|
2182
|
+
* `-per-page-option-<n>`, e.g. `-per-page-option-50`), the step buttons
|
|
2183
|
+
* (`-first`, `-prev`, `-next`, `-last`) and each page button (`-page-<n>`).
|
|
2184
|
+
* Omit for no test-id wiring.
|
|
2145
2185
|
*/
|
|
2146
2186
|
testIdPrefix?: string;
|
|
2147
2187
|
}): react.JSX.Element;
|
|
@@ -2151,6 +2191,7 @@ type TablePaginationProps = Parameters<typeof TablePagination>[0];
|
|
|
2151
2191
|
type DateGranularity = 'month' | 'quarter' | 'year';
|
|
2152
2192
|
/** Resolve a label to its actual [start, end] span, ending at `today`. */
|
|
2153
2193
|
declare function resolveRange(label: string, today?: Date): [Date, Date];
|
|
2194
|
+
/** @deprecated Use DateRangeFilter, with `granularity="month"` for monthly data. */
|
|
2154
2195
|
declare function DateRangePicker({ defaultValue, granularity, align, presets, onChange, onRangeChange, showFooter, today, years, }: {
|
|
2155
2196
|
defaultValue?: string;
|
|
2156
2197
|
align?: 'left' | 'right';
|
|
@@ -2210,13 +2251,16 @@ interface MultiSelectGroup {
|
|
|
2210
2251
|
* @a11y Trigger is a <button> with aria-expanded; the menu is role="dialog" and
|
|
2211
2252
|
* Escape closes it. Option rows carry their own checkbox semantics. Focus
|
|
2212
2253
|
* is not moved into the menu on open, so keyboard users tab into it in DOM
|
|
2213
|
-
* order.
|
|
2254
|
+
* order. The loading rows carry role="status" and the error line role="alert".
|
|
2255
|
+
* @behavior `loading` swaps the list for grey placeholder rows and `error`
|
|
2256
|
+
* for a plain "Couldn't load options." line with a Try again link
|
|
2257
|
+
* (`onRetry`). The trigger never changes in either state.
|
|
2214
2258
|
* @usage
|
|
2215
2259
|
* ```tsx
|
|
2216
2260
|
* <MultiSelectFilter caption="Media" options={mediaOptions} selected={selected} onChange={setSelected} />
|
|
2217
2261
|
* ```
|
|
2218
2262
|
*/
|
|
2219
|
-
declare function MultiSelectFilter({ caption, options, groups, counts, variant, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, }: {
|
|
2263
|
+
declare function MultiSelectFilter({ caption, options, groups, counts, variant, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, loading, error, onRetry, }: {
|
|
2220
2264
|
caption: string;
|
|
2221
2265
|
/**
|
|
2222
2266
|
* Live option-id -> result count. Supplying it makes the menu faceted:
|
|
@@ -2260,6 +2304,12 @@ declare function MultiSelectFilter({ caption, options, groups, counts, variant,
|
|
|
2260
2304
|
/** Stretch the trigger (and, with `menuWidthClass="w-full"`, the panel) to fill
|
|
2261
2305
|
* its container — for stacked/full-width form layouts instead of the chip bar. */
|
|
2262
2306
|
fullWidth?: boolean;
|
|
2307
|
+
/** Options are still loading: the menu shows grey placeholder rows. */
|
|
2308
|
+
loading?: boolean;
|
|
2309
|
+
/** Options failed to load: the menu shows a plain message and Try again. */
|
|
2310
|
+
error?: boolean;
|
|
2311
|
+
/** Called by the Try again link in the error state. */
|
|
2312
|
+
onRetry?: () => void;
|
|
2263
2313
|
}): react.JSX.Element;
|
|
2264
2314
|
type MultiSelectFilterProps = Parameters<typeof MultiSelectFilter>[0];
|
|
2265
2315
|
|
|
@@ -2608,7 +2658,7 @@ interface TabsProps<T extends string = string> {
|
|
|
2608
2658
|
* @tokens border-b, border-border-default, text-sm, text-text-secondary,
|
|
2609
2659
|
* hover:text-text-primary, font-semibold, text-text-primary,
|
|
2610
2660
|
* border-brand-primaryAction, text-text-tertiary, text-xs,
|
|
2611
|
-
* focus-visible:outline-border-focus
|
|
2661
|
+
* focus-visible:outline-border-focus
|
|
2612
2662
|
* @behavior Controlled: `value` and `onChange`. The arrow keys, Home and End
|
|
2613
2663
|
* move between tabs and select as they go; only the selected tab is in the
|
|
2614
2664
|
* Tab order.
|
|
@@ -2792,7 +2842,8 @@ interface DataTableProps<T, K extends string = string> {
|
|
|
2792
2842
|
* (`cycleSort`), and call `onSortChange`. The table doesn't sort the rows
|
|
2793
2843
|
* itself: sort them before passing `rows`. `loading` keeps the header and
|
|
2794
2844
|
* draws `loadingRows` skeleton rows. An empty `rows` keeps the header and
|
|
2795
|
-
* shows `empty` in one cell across every column
|
|
2845
|
+
* shows `empty` in one cell across every column, padded 48px top and bottom
|
|
2846
|
+
* and 24px at the sides (pass a bare stack such as NoResultsEmptyState). `maxHeight` makes the body
|
|
2796
2847
|
* scroll under a pinned header; wide tables always scroll sideways rather than
|
|
2797
2848
|
* squeeze.
|
|
2798
2849
|
* @a11y A real <table>. Named by `title` (aria-labelledby) or `aria-label`.
|
|
@@ -2828,4 +2879,207 @@ interface DataTableProps<T, K extends string = string> {
|
|
|
2828
2879
|
*/
|
|
2829
2880
|
declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, sort, onSortChange, density, loading, loadingRows, empty, maxHeight, footer, className, ...rest }: DataTableProps<T, K>): react.JSX.Element;
|
|
2830
2881
|
|
|
2831
|
-
|
|
2882
|
+
type MediaType = "TV" | "CTV" | "Digital" | "Social" | "Radio" | "Newspaper" | "Magazine";
|
|
2883
|
+
interface MediaLabelProps {
|
|
2884
|
+
/** The media type. Any other string gets the grey "other" fill, so a new type still renders. */
|
|
2885
|
+
type: MediaType | (string & {});
|
|
2886
|
+
/** Extra classes for placement, e.g. `absolute bottom-2 left-2` on a thumbnail. */
|
|
2887
|
+
className?: string;
|
|
2888
|
+
}
|
|
2889
|
+
/**
|
|
2890
|
+
* @pattern MediaLabel
|
|
2891
|
+
* @description The small solid label naming a creative's media type -- TV,
|
|
2892
|
+
* CTV, Digital, Social, Radio, Newspaper, Magazine -- usually laid over the
|
|
2893
|
+
* corner of a thumbnail. One colour per type, from the `color.media.*`
|
|
2894
|
+
* tokens, so a grid can be scanned by type. White text, small rounded
|
|
2895
|
+
* corners, normal case (acronyms stay capitals). The same in both themes,
|
|
2896
|
+
* since it sits on a photo.
|
|
2897
|
+
* @variant TV - Green.
|
|
2898
|
+
* @variant CTV - Indigo.
|
|
2899
|
+
* @variant Digital - Blue.
|
|
2900
|
+
* @variant Social - Orange.
|
|
2901
|
+
* @variant Radio - Teal.
|
|
2902
|
+
* @variant Newspaper - Amber.
|
|
2903
|
+
* @variant Magazine - Berry.
|
|
2904
|
+
* @variant other - Grey, for any type not in the list.
|
|
2905
|
+
* @tokens bg-media-tv, bg-media-ctv, bg-media-digital, bg-media-social,
|
|
2906
|
+
* bg-media-radio, bg-media-newspaper, bg-media-magazine, bg-media-other,
|
|
2907
|
+
* text-status-onstatus, text-micro, font-semibold, rounded-sm
|
|
2908
|
+
* @use on a creative thumbnail or card to say which media it ran in.
|
|
2909
|
+
* @avoid for anything that isn't a media type -- a category or focus area is
|
|
2910
|
+
* a Tag, a status is a Badge.
|
|
2911
|
+
* @avoid a custom colour per page. Add a token for a new type instead.
|
|
2912
|
+
* @a11y The text is the type's name, so colour is never the only signal.
|
|
2913
|
+
* Every fill passes AA (5.7:1 or more) for white 11px text.
|
|
2914
|
+
* @usage
|
|
2915
|
+
* ```tsx
|
|
2916
|
+
* <div className="relative">
|
|
2917
|
+
* <img src={thumb} alt="" />
|
|
2918
|
+
* <MediaLabel type="CTV" className="absolute bottom-2 left-2" />
|
|
2919
|
+
* </div>
|
|
2920
|
+
* ```
|
|
2921
|
+
*/
|
|
2922
|
+
declare function MediaLabel({ type, className }: MediaLabelProps): react.JSX.Element;
|
|
2923
|
+
|
|
2924
|
+
interface SuggestionChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
2925
|
+
/** The suggestion itself, in normal case: "Luxury SUV brands", "Where are we wasting seats?". */
|
|
2926
|
+
children: ReactNode;
|
|
2927
|
+
}
|
|
2928
|
+
/**
|
|
2929
|
+
* @pattern SuggestionChip
|
|
2930
|
+
* @description An outlined grey pill offering a ready-made search or
|
|
2931
|
+
* question: "Or try: Luxury SUV brands", an AI follow-up, a "Did you mean".
|
|
2932
|
+
* Clicking it runs that suggestion. Text only, normal case.
|
|
2933
|
+
* @tokens rounded-full, border, border-border-default, bg-surface, text-sm,
|
|
2934
|
+
* text-text-primary, hover:bg-subtle, hover:border-border-strong,
|
|
2935
|
+
* transition-colors, duration-(--mr-motion-duration-interactive),
|
|
2936
|
+
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-2,
|
|
2937
|
+
* focus-visible:outline-border-focus
|
|
2938
|
+
* @use for shortcuts the user may take instead of typing: example searches,
|
|
2939
|
+
* follow-up questions, spelling suggestions. Put a short lead-in before the
|
|
2940
|
+
* row ("Or try", "Did you mean").
|
|
2941
|
+
* @avoid for the screen's own actions -- "Add", "Save", "Export" are Buttons.
|
|
2942
|
+
* @avoid for something that stays switched on. Pick-many on/off pills are
|
|
2943
|
+
* ToggleChip; pick-one is SegmentedControl.
|
|
2944
|
+
* @avoid an icon. The lead-in explains what the row is.
|
|
2945
|
+
* @a11y A plain <button>; its text is its name, so the suggestion must read
|
|
2946
|
+
* on its own. Tab reaches each chip; Enter or Space runs it. Keep the lead-in
|
|
2947
|
+
* as visible text before the row, not inside the chips.
|
|
2948
|
+
* @usage
|
|
2949
|
+
* ```tsx
|
|
2950
|
+
* <div className="flex flex-wrap items-center gap-2">
|
|
2951
|
+
* <span className="text-sm text-text-secondary">Or try</span>
|
|
2952
|
+
* <SuggestionChip onClick={() => search("Luxury SUV brands")}>Luxury SUV brands</SuggestionChip>
|
|
2953
|
+
* </div>
|
|
2954
|
+
* ```
|
|
2955
|
+
*/
|
|
2956
|
+
declare function SuggestionChip({ children, className, type, ...props }: SuggestionChipProps): react.JSX.Element;
|
|
2957
|
+
|
|
2958
|
+
interface ToggleChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "onChange"> {
|
|
2959
|
+
/** Whether this chip is switched on. */
|
|
2960
|
+
selected: boolean;
|
|
2961
|
+
/** Called with the new value when the chip is clicked. */
|
|
2962
|
+
onChange: (selected: boolean) => void;
|
|
2963
|
+
/** The option's name: "US", "Germany". */
|
|
2964
|
+
children: ReactNode;
|
|
2965
|
+
}
|
|
2966
|
+
/**
|
|
2967
|
+
* @pattern ToggleChip
|
|
2968
|
+
* @description A pill you switch on and off, in a row where several can be
|
|
2969
|
+
* on at once: countries, media types, quick filters. On, it takes a pale
|
|
2970
|
+
* tint of the brand blue, a brand border and a tick before the label, so the state
|
|
2971
|
+
* doesn't rest on colour alone.
|
|
2972
|
+
* @variant off - Grey outline, as SuggestionChip.
|
|
2973
|
+
* @variant on - Pale brand-blue tint, brand border and text, leading tick.
|
|
2974
|
+
* @tokens rounded-full, border, border-border-default, bg-surface, text-sm,
|
|
2975
|
+
* text-text-primary, hover:bg-subtle, hover:border-border-strong,
|
|
2976
|
+
* bg-brand-primaryAction/15, border-brand-primaryAction, text-brand-primaryAction,
|
|
2977
|
+
* transition-colors, duration-(--mr-motion-duration-interactive),
|
|
2978
|
+
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-2,
|
|
2979
|
+
* focus-visible:outline-border-focus
|
|
2980
|
+
* @use for pick-many options short enough to show all at once.
|
|
2981
|
+
* @avoid when only one can be on -- that's SegmentedControl.
|
|
2982
|
+
* @avoid for a long list. More than about eight options is a MultiSelectFilter.
|
|
2983
|
+
* @avoid for a setting that takes effect on its own -- that's Toggle.
|
|
2984
|
+
* @a11y A button with aria-pressed. The tick is decorative; the pressed
|
|
2985
|
+
* state is what a screen reader announces.
|
|
2986
|
+
* @usage
|
|
2987
|
+
* ```tsx
|
|
2988
|
+
* {COUNTRIES.map((c) => (
|
|
2989
|
+
* <ToggleChip key={c} selected={on.has(c)} onChange={(v) => set(c, v)}>{c}</ToggleChip>
|
|
2990
|
+
* ))}
|
|
2991
|
+
* ```
|
|
2992
|
+
*/
|
|
2993
|
+
declare function ToggleChip({ selected, onChange, children, className, type, onClick, ...props }: ToggleChipProps): react.JSX.Element;
|
|
2994
|
+
|
|
2995
|
+
interface CopyButtonProps {
|
|
2996
|
+
/** What to copy, or a function that builds it at click time. */
|
|
2997
|
+
value: string | (() => string);
|
|
2998
|
+
/** A visible label ("Copy summary"). Leave it out for the icon-only button. */
|
|
2999
|
+
label?: ReactNode;
|
|
3000
|
+
/** Names the icon-only button for screen readers: "Copy email". Required when there's no `label`. */
|
|
3001
|
+
"aria-label"?: string;
|
|
3002
|
+
/** xs 24 for inside a row (email, phone), sm 32 beside other buttons. */
|
|
3003
|
+
size?: "xs" | "sm";
|
|
3004
|
+
className?: string;
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* @pattern CopyButton
|
|
3008
|
+
* @description Copies a value to the clipboard and confirms on the button
|
|
3009
|
+
* itself: the copy icon becomes a green tick for two seconds (a labelled
|
|
3010
|
+
* button also reads "Copied"), then it's ready again. Two looks -- icon only,
|
|
3011
|
+
* for an email or phone in a row, and with a label, for "Copy summary" in a
|
|
3012
|
+
* header.
|
|
3013
|
+
* @variant icon - Icon only. Needs an aria-label.
|
|
3014
|
+
* @variant labelled - Icon and text; the text becomes "Copied".
|
|
3015
|
+
* @tokens text-text-success, text-text-secondary, sr-only
|
|
3016
|
+
* @dependencies lucide-react
|
|
3017
|
+
* @behavior Writes to the clipboard on click. On success it shows the tick
|
|
3018
|
+
* for 2 seconds and announces "Copied" politely. If the browser blocks the
|
|
3019
|
+
* clipboard, nothing changes -- it never shows a tick it didn't earn.
|
|
3020
|
+
* @use when the copy is quick and the confirmation belongs on the control.
|
|
3021
|
+
* @avoid a toast for a copy. The tick is the confirmation; a toast would be
|
|
3022
|
+
* a second one.
|
|
3023
|
+
* @a11y Icon-only needs `aria-label`. "Copied" is announced through a
|
|
3024
|
+
* polite live region.
|
|
3025
|
+
* @usage
|
|
3026
|
+
* ```tsx
|
|
3027
|
+
* <CopyButton value={contact.email} aria-label="Copy email" />
|
|
3028
|
+
* <CopyButton value={buildSummary} label="Copy summary" size="sm" />
|
|
3029
|
+
* ```
|
|
3030
|
+
*/
|
|
3031
|
+
declare function CopyButton({ value, label, "aria-label": ariaLabel, size, className }: CopyButtonProps): react.JSX.Element;
|
|
3032
|
+
|
|
3033
|
+
type InlineMessageTone = "info" | "success" | "warning" | "danger";
|
|
3034
|
+
interface InlineMessageProps {
|
|
3035
|
+
/** info (default), success, warning or danger. */
|
|
3036
|
+
tone?: InlineMessageTone;
|
|
3037
|
+
/** One short line: "A similar organization already exists". */
|
|
3038
|
+
title: ReactNode;
|
|
3039
|
+
/** Optional detail under the title. */
|
|
3040
|
+
children?: ReactNode;
|
|
3041
|
+
/** Optional actions under the text -- small Buttons or SuggestionChips. */
|
|
3042
|
+
actions?: ReactNode;
|
|
3043
|
+
/** Shows a close × that calls this. Leave it out for a message that must stay until the problem is fixed. */
|
|
3044
|
+
onDismiss?: () => void;
|
|
3045
|
+
className?: string;
|
|
3046
|
+
}
|
|
3047
|
+
/**
|
|
3048
|
+
* @pattern InlineMessage
|
|
3049
|
+
* @description A message that sits in the page, next to what it's about, and
|
|
3050
|
+
* stays until it's dealt with: "A similar organization already exists",
|
|
3051
|
+
* "3 rows couldn't be matched". Icon, a short title, an optional line, and
|
|
3052
|
+
* optional actions. Four tones.
|
|
3053
|
+
* @variant info - Pale brand blue. Something worth knowing.
|
|
3054
|
+
* @variant success - Green. A check passed, in place.
|
|
3055
|
+
* @variant warning - Amber. Something may be wrong; the user can still go on.
|
|
3056
|
+
* @variant danger - Red. Something is wrong and needs fixing first.
|
|
3057
|
+
* @tokens rounded-control, border, bg-brand-primaryAction/10,
|
|
3058
|
+
* border-brand-primaryAction/30, text-brand-primaryAction,
|
|
3059
|
+
* bg-status-success/10, border-status-success/40, text-text-success,
|
|
3060
|
+
* bg-status-warning/15, border-status-warning/50, text-text-warning,
|
|
3061
|
+
* bg-status-danger/10, border-status-danger/40, text-text-danger, text-sm,
|
|
3062
|
+
* font-semibold, text-text-primary, text-text-secondary,
|
|
3063
|
+
* text-text-tertiary, hover:bg-subtle, hover:text-text-primary,
|
|
3064
|
+
* focus-visible:outline-2, focus-visible:outline-border-focus
|
|
3065
|
+
* @dependencies lucide-react
|
|
3066
|
+
* @behavior Stays by default. Pass `onDismiss` to add a ×, only for a tip
|
|
3067
|
+
* that's safe to hide; a message about a problem goes away when the problem
|
|
3068
|
+
* is fixed.
|
|
3069
|
+
* @use for feedback about one part of the page that must stay visible while
|
|
3070
|
+
* the user acts on it.
|
|
3071
|
+
* @avoid for confirming something that just happened -- that's a Toast, or
|
|
3072
|
+
* the tick on a CopyButton.
|
|
3073
|
+
* @avoid for an error on a single field -- that's TextField's error text.
|
|
3074
|
+
* @a11y warning and danger use role="alert" so they're announced when they
|
|
3075
|
+
* appear; info and success use role="status". The tone is also in the icon
|
|
3076
|
+
* and the words, never colour alone.
|
|
3077
|
+
* @usage
|
|
3078
|
+
* ```tsx
|
|
3079
|
+
* <InlineMessage tone="warning" title="A similar organization already exists"
|
|
3080
|
+
* actions={<SuggestionChip onClick={useExisting}>Use Acme Corp</SuggestionChip>} />
|
|
3081
|
+
* ```
|
|
3082
|
+
*/
|
|
3083
|
+
declare function InlineMessage({ tone, title, children, actions, onDismiss, className }: InlineMessageProps): react.JSX.Element;
|
|
3084
|
+
|
|
3085
|
+
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, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, type SegmentedOption, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|