@mediaradar/design-components 0.30.0 → 0.32.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 +842 -660
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +285 -43
- package/dist/index.d.ts +285 -43
- package/dist/index.js +841 -664
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -167,11 +167,15 @@ type BadgeTone = "neutral" | "brand" | "brandSolid" | "success" | "warning" | "d
|
|
|
167
167
|
* keeps this two small props instead of one list of every combination the
|
|
168
168
|
* product happens to use today.
|
|
169
169
|
*/
|
|
170
|
-
type BadgeKind = "label" | "count" | "eyebrow";
|
|
170
|
+
type BadgeKind = "label" | "count" | "eyebrow" | "category";
|
|
171
171
|
interface BadgeProps {
|
|
172
172
|
/** What kind of thing this marks. Not a colour choice. */
|
|
173
173
|
tone?: BadgeTone;
|
|
174
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* Shape and case. `count` for a number, `eyebrow` for a small-caps label,
|
|
176
|
+
* `category` for what a thing is (a topic, a category): always quiet grey,
|
|
177
|
+
* `tone` is ignored.
|
|
178
|
+
*/
|
|
175
179
|
kind?: BadgeKind;
|
|
176
180
|
/**
|
|
177
181
|
* Draws a small filled dot before the label, in the tone's own ink. For a
|
|
@@ -193,14 +197,14 @@ interface BadgeProps {
|
|
|
193
197
|
* between them cover every badge treatment in the product.
|
|
194
198
|
* @props
|
|
195
199
|
* tone?: 'neutral' | 'brand' | 'brandSolid' | 'success' | 'warning' | 'danger' | 'ai' | 'overlay' (default 'neutral')
|
|
196
|
-
* kind?: 'label' | 'count' | 'eyebrow' (default 'label')
|
|
200
|
+
* kind?: 'label' | 'count' | 'eyebrow' | 'category' (default 'label') -- category is always grey, tone ignored
|
|
197
201
|
* dot?: boolean (default false) -- a filled dot before the label, in the tone's ink
|
|
198
202
|
* children: ReactNode
|
|
199
203
|
* @tokens text-micro, rounded-full, bg-current, bg-subtle, bg-brand-primarySoft, bg-brand-primaryAction,
|
|
200
204
|
* bg-status-success/15, bg-status-warning/30, bg-status-danger/15, bg-scrim,
|
|
201
205
|
* text-text-secondary, text-brand-primaryAction, text-text-success,
|
|
202
206
|
* text-text-warning, text-text-danger, text-ai-ontint, text-brand-onprimary,
|
|
203
|
-
* border-transparent
|
|
207
|
+
* border-transparent, text-text-tertiary
|
|
204
208
|
* @behavior Not interactive and carries no role: a badge is a label on
|
|
205
209
|
* something else, so it is read as part of that thing rather than announced
|
|
206
210
|
* separately. Anything clickable is a Button or a filter chip, not a Badge.
|
|
@@ -434,9 +438,14 @@ declare function CheckBoxBox({ checked, indeterminate, disabled, className }: Ch
|
|
|
434
438
|
* values, so a previous unsaved edit never lingers into the next open. Only
|
|
435
439
|
* the Apply button commits -- Cancel, Escape, and outside-click all discard
|
|
436
440
|
* the draft silently.
|
|
441
|
+
* `granularity="month"` rounds every range out to whole months (presets,
|
|
442
|
+
* clicked days and Apply alike), shows months on the trigger, and adds a
|
|
443
|
+
* "Data is monthly" note beside Cancel/Apply.
|
|
437
444
|
* @a11y Trigger is a <button> with aria-expanded and an aria-label from the
|
|
438
445
|
* caption; the panel is role="dialog" and Escape closes it. Focus is not
|
|
439
446
|
* moved into the panel, so it is reached by tabbing.
|
|
447
|
+
* @use for every date range in the product; `granularity="month"` for monthly data.
|
|
448
|
+
* @avoid DateRangePicker, which is being retired.
|
|
440
449
|
* @usage
|
|
441
450
|
* ```tsx
|
|
442
451
|
* <DateRangeFilter caption="Date range" defaultValue="Rolling 6 months" onChange={setRange} />
|
|
@@ -487,8 +496,14 @@ interface DateRangeFilterProps {
|
|
|
487
496
|
presetSet?: "default" | "creativeIntel";
|
|
488
497
|
/** Prefix for data-testid attributes on the trigger, popover, each preset option, and Cancel/Apply. Omit for no test-id wiring. */
|
|
489
498
|
testIdPrefix?: string;
|
|
499
|
+
/**
|
|
500
|
+
* 'month' for screens whose data comes by month: every range rounds out to
|
|
501
|
+
* whole months (start on the 1st, end on the last day) and the panel says
|
|
502
|
+
* "Data is monthly". Defaults to 'day'.
|
|
503
|
+
*/
|
|
504
|
+
granularity?: "day" | "month";
|
|
490
505
|
}
|
|
491
|
-
declare function DateRangeFilter({ caption, defaultValue, value: controlledValue, range: controlledRange, align, placement, onChange, onRangeChange, showDates, shortDates, icon, presetSet, testIdPrefix, }: DateRangeFilterProps): react.JSX.Element;
|
|
506
|
+
declare function DateRangeFilter({ caption, defaultValue, value: controlledValue, range: controlledRange, align, placement, onChange, onRangeChange, showDates, shortDates, icon, presetSet, testIdPrefix, granularity, }: DateRangeFilterProps): react.JSX.Element;
|
|
492
507
|
|
|
493
508
|
/**
|
|
494
509
|
* @pattern SearchBar
|
|
@@ -642,10 +657,11 @@ declare function SectionRail({ title, titleSerif, subtitle, viewAllLabel, viewAl
|
|
|
642
657
|
* invalid HTML that breaks click targeting (confirmed against how
|
|
643
658
|
* mr-clientapps-insights-studio's own equivalent, `ChipOption`, already
|
|
644
659
|
* 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
|
-
*
|
|
660
|
+
* @a11y Trigger is a <button> with aria-expanded; the menu is a labelled
|
|
661
|
+
* group of two buttons carrying aria-pressed, not a listbox, because the
|
|
662
|
+
* "Final only" row also holds an InfoTip button and a listbox may only
|
|
663
|
+
* contain options. The InfoTip sits 8px from its row so both meet the
|
|
664
|
+
* 24px target-size rule. Escape closes it.
|
|
649
665
|
* @usage
|
|
650
666
|
* ```tsx
|
|
651
667
|
* <DataScopeFilter value={finalOnly} onChange={setFinalOnly} />
|
|
@@ -672,13 +688,15 @@ declare function DataScopeFilter({ value, onChange, align }: DataScopeFilterProp
|
|
|
672
688
|
* border-border-strong, bg-input, bg-surface, shadow-overlay,
|
|
673
689
|
* text-text-primary, text-text-secondary,
|
|
674
690
|
* text-text-tertiary, hover:bg-subtle, hover:text-text-primary,
|
|
675
|
-
* text-brand-primaryAction, focus-visible:outline-border-focus
|
|
691
|
+
* text-brand-primaryAction, focus-visible:outline-border-focus, text-dense
|
|
676
692
|
* @dependencies lucide-react
|
|
677
693
|
* @behavior The popover is portal-rendered to document.body, so its own DOM
|
|
678
694
|
* node isn't inside the trigger. The outside-click check tests both the
|
|
679
695
|
* trigger and the popover explicitly for that reason -- treating the
|
|
680
696
|
* popover as "outside" would close it on every option click before
|
|
681
|
-
* `onChange` ever fires, so nothing would ever get selected.
|
|
697
|
+
* `onChange` ever fires, so nothing would ever get selected. `loading` swaps
|
|
698
|
+
* the list for grey placeholder rows and `error` for a plain "Couldn't load
|
|
699
|
+
* options." line with a Try again link (`onRetry`); the trigger never changes. Selecting an
|
|
682
700
|
* option commits immediately and closes -- there's no separate draft/Apply
|
|
683
701
|
* step; Escape and outside-click just close without side effects.
|
|
684
702
|
* `renderIcon`, when given, puts a small image before each option's label and
|
|
@@ -691,6 +709,7 @@ declare function DataScopeFilter({ value, onChange, align }: DataScopeFilterProp
|
|
|
691
709
|
* the caption. The popover is not a focus trap and does not move focus on
|
|
692
710
|
* open, so keyboard users tab into it; a consumer rendering it inside
|
|
693
711
|
* another dismissible layer has to sequence the two dismissals itself.
|
|
712
|
+
* The loading rows carry role="status" and the error line role="alert".
|
|
694
713
|
* Icons from `renderIcon` are wrapped aria-hidden, so each option's accessible
|
|
695
714
|
* name stays its label text -- don't put meaning in the icon that the label
|
|
696
715
|
* doesn't also say.
|
|
@@ -728,6 +747,20 @@ interface SelectFilterProps {
|
|
|
728
747
|
* to this shared component's ids rather than losing its locators outright.
|
|
729
748
|
*/
|
|
730
749
|
testIdPrefix?: string;
|
|
750
|
+
/** Options are still loading: the menu shows grey placeholder rows. */
|
|
751
|
+
loading?: boolean;
|
|
752
|
+
/** Options failed to load: the menu shows a plain message and Try again. */
|
|
753
|
+
error?: boolean;
|
|
754
|
+
/** Called by the Try again link in the error state. */
|
|
755
|
+
onRetry?: () => void;
|
|
756
|
+
/**
|
|
757
|
+
* 'sm' is the compact 32px trigger with no visible caption (the caption
|
|
758
|
+
* becomes its accessible name) -- for tight spots such as the rows-per-page
|
|
759
|
+
* control in TablePagination. Defaults to 'md', the 44px caption chip.
|
|
760
|
+
*/
|
|
761
|
+
size?: "md" | "sm";
|
|
762
|
+
/** Fades the trigger to 40% and blocks it, e.g. while a table loads. */
|
|
763
|
+
disabled?: boolean;
|
|
731
764
|
/**
|
|
732
765
|
* Optional leading icon for each option, called with the option's string.
|
|
733
766
|
* Shown before the label in the list and before the value in the trigger,
|
|
@@ -737,7 +770,7 @@ interface SelectFilterProps {
|
|
|
737
770
|
*/
|
|
738
771
|
renderIcon?: (option: string) => ReactNode;
|
|
739
772
|
}
|
|
740
|
-
declare function SelectFilter({ caption, value, options, onChange, align, fullWidth, className, testIdPrefix, renderIcon, }: SelectFilterProps): react.JSX.Element;
|
|
773
|
+
declare function SelectFilter({ caption, value, options, onChange, align, fullWidth, className, testIdPrefix, loading, error, onRetry, size, disabled, renderIcon, }: SelectFilterProps): react.JSX.Element;
|
|
741
774
|
|
|
742
775
|
/**
|
|
743
776
|
* @pattern Card
|
|
@@ -1919,7 +1952,7 @@ interface PagerProps {
|
|
|
1919
1952
|
* the left if the reader needs it.
|
|
1920
1953
|
* @avoid under a full-page table -- use TablePagination, which adds the
|
|
1921
1954
|
* first/last steps, the range readout and the rows-per-page select.
|
|
1922
|
-
* @tokens rounded-control, text-text-secondary, bg-
|
|
1955
|
+
* @tokens rounded-control, text-text-secondary, bg-subtle, text-text-primary, hover:bg-subtle, hover:text-text-primary, text-text-tertiary
|
|
1923
1956
|
* @dependencies lucide-react
|
|
1924
1957
|
* @a11y Renders its own <nav aria-label="Pagination"> landmark, like
|
|
1925
1958
|
* TablePagination, so don't wrap it in another <nav>. Pass `label` to name it
|
|
@@ -2062,29 +2095,18 @@ interface TagProps {
|
|
|
2062
2095
|
}
|
|
2063
2096
|
/**
|
|
2064
2097
|
* @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
|
|
2098
|
+
* @description Being retired into Badge: a Tag is now `<Badge kind="category">`,
|
|
2099
|
+
* the quiet grey pill naming what a thing is (a topic, a category). Kept
|
|
2100
|
+
* exported so existing screens don't break; it renders exactly that Badge.
|
|
2101
|
+
* @use nowhere new -- use `<Badge kind="category">`.
|
|
2102
|
+
* @avoid it in new work.
|
|
2103
|
+
* @tokens
|
|
2083
2104
|
* @usage
|
|
2084
2105
|
* ```tsx
|
|
2085
|
-
* <
|
|
2106
|
+
* <Badge kind="category">Automotive</Badge>
|
|
2086
2107
|
* ```
|
|
2087
2108
|
*/
|
|
2109
|
+
/** @deprecated Use `<Badge kind="category">`. */
|
|
2088
2110
|
declare function Tag({ children, className }: TagProps): react.JSX.Element;
|
|
2089
2111
|
|
|
2090
2112
|
/**
|
|
@@ -2092,15 +2114,18 @@ declare function Tag({ children, className }: TagProps): react.JSX.Element;
|
|
|
2092
2114
|
* @description Full table-footer pagination bar: a rows-per-page select, a
|
|
2093
2115
|
* first/prev/pages/next/last pager, and the resolved "1 – 25 of N results"
|
|
2094
2116
|
* range. Owns no state — the host page holds `page` and `perPage` so the
|
|
2095
|
-
* paged slice and the bar can't disagree.
|
|
2096
|
-
*
|
|
2117
|
+
* paged slice and the bar can't disagree. One layout on every table: rows
|
|
2118
|
+
* per page on the left, pages in the middle, the range on the right. Without
|
|
2119
|
+
* `onPerPageChange` the rows-per-page control is hidden but holds its space,
|
|
2120
|
+
* so nothing moves.
|
|
2097
2121
|
* @use under a full-page table: the results of a search or a list the user
|
|
2098
2122
|
* works through, where the total and the page size matter.
|
|
2099
2123
|
* @avoid in a card or a compact list -- use Pager, which is only the page
|
|
2100
2124
|
* controls and fits the narrower space.
|
|
2101
|
-
* @tokens
|
|
2102
|
-
* @behavior The current page is
|
|
2103
|
-
*
|
|
2125
|
+
* @tokens rounded-control, text-text-primary, text-text-secondary, text-text-tertiary, bg-subtle, hover:bg-subtle, hover:text-text-primary
|
|
2126
|
+
* @behavior The current page is a quiet grey fill with a dark bold number,
|
|
2127
|
+
* keeping blue for actions. The rows-per-page control is the compact
|
|
2128
|
+
* SelectFilter (`size="sm"`), our own menu, not the browser's. First/prev disable on page 1, next/last on the last
|
|
2104
2129
|
* page — disabled controls stay in the layout so the row never reflows.
|
|
2105
2130
|
* Changing the per-page count reports it and leaves the host to reset to page
|
|
2106
2131
|
* 1. With one page of results the pager still renders, so the bar's height
|
|
@@ -2130,7 +2155,10 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
|
|
|
2130
2155
|
perPage: number;
|
|
2131
2156
|
totalItems: number;
|
|
2132
2157
|
onPageChange: (page: number) => void;
|
|
2133
|
-
/**
|
|
2158
|
+
/**
|
|
2159
|
+
* Omit for a table with a fixed page size. The rows-per-page control is
|
|
2160
|
+
* then hidden but keeps its space, so the pages and the range don't move.
|
|
2161
|
+
*/
|
|
2134
2162
|
onPerPageChange?: (perPage: number) => void;
|
|
2135
2163
|
perPageOptions?: number[];
|
|
2136
2164
|
itemLabel?: string;
|
|
@@ -2151,6 +2179,7 @@ type TablePaginationProps = Parameters<typeof TablePagination>[0];
|
|
|
2151
2179
|
type DateGranularity = 'month' | 'quarter' | 'year';
|
|
2152
2180
|
/** Resolve a label to its actual [start, end] span, ending at `today`. */
|
|
2153
2181
|
declare function resolveRange(label: string, today?: Date): [Date, Date];
|
|
2182
|
+
/** @deprecated Use DateRangeFilter, with `granularity="month"` for monthly data. */
|
|
2154
2183
|
declare function DateRangePicker({ defaultValue, granularity, align, presets, onChange, onRangeChange, showFooter, today, years, }: {
|
|
2155
2184
|
defaultValue?: string;
|
|
2156
2185
|
align?: 'left' | 'right';
|
|
@@ -2210,13 +2239,16 @@ interface MultiSelectGroup {
|
|
|
2210
2239
|
* @a11y Trigger is a <button> with aria-expanded; the menu is role="dialog" and
|
|
2211
2240
|
* Escape closes it. Option rows carry their own checkbox semantics. Focus
|
|
2212
2241
|
* is not moved into the menu on open, so keyboard users tab into it in DOM
|
|
2213
|
-
* order.
|
|
2242
|
+
* order. The loading rows carry role="status" and the error line role="alert".
|
|
2243
|
+
* @behavior `loading` swaps the list for grey placeholder rows and `error`
|
|
2244
|
+
* for a plain "Couldn't load options." line with a Try again link
|
|
2245
|
+
* (`onRetry`). The trigger never changes in either state.
|
|
2214
2246
|
* @usage
|
|
2215
2247
|
* ```tsx
|
|
2216
2248
|
* <MultiSelectFilter caption="Media" options={mediaOptions} selected={selected} onChange={setSelected} />
|
|
2217
2249
|
* ```
|
|
2218
2250
|
*/
|
|
2219
|
-
declare function MultiSelectFilter({ caption, options, groups, counts, variant, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, }: {
|
|
2251
|
+
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
2252
|
caption: string;
|
|
2221
2253
|
/**
|
|
2222
2254
|
* Live option-id -> result count. Supplying it makes the menu faceted:
|
|
@@ -2260,6 +2292,12 @@ declare function MultiSelectFilter({ caption, options, groups, counts, variant,
|
|
|
2260
2292
|
/** Stretch the trigger (and, with `menuWidthClass="w-full"`, the panel) to fill
|
|
2261
2293
|
* its container — for stacked/full-width form layouts instead of the chip bar. */
|
|
2262
2294
|
fullWidth?: boolean;
|
|
2295
|
+
/** Options are still loading: the menu shows grey placeholder rows. */
|
|
2296
|
+
loading?: boolean;
|
|
2297
|
+
/** Options failed to load: the menu shows a plain message and Try again. */
|
|
2298
|
+
error?: boolean;
|
|
2299
|
+
/** Called by the Try again link in the error state. */
|
|
2300
|
+
onRetry?: () => void;
|
|
2263
2301
|
}): react.JSX.Element;
|
|
2264
2302
|
type MultiSelectFilterProps = Parameters<typeof MultiSelectFilter>[0];
|
|
2265
2303
|
|
|
@@ -2608,7 +2646,7 @@ interface TabsProps<T extends string = string> {
|
|
|
2608
2646
|
* @tokens border-b, border-border-default, text-sm, text-text-secondary,
|
|
2609
2647
|
* hover:text-text-primary, font-semibold, text-text-primary,
|
|
2610
2648
|
* border-brand-primaryAction, text-text-tertiary, text-xs,
|
|
2611
|
-
* focus-visible:outline-border-focus
|
|
2649
|
+
* focus-visible:outline-border-focus
|
|
2612
2650
|
* @behavior Controlled: `value` and `onChange`. The arrow keys, Home and End
|
|
2613
2651
|
* move between tabs and select as they go; only the selected tab is in the
|
|
2614
2652
|
* Tab order.
|
|
@@ -2792,7 +2830,8 @@ interface DataTableProps<T, K extends string = string> {
|
|
|
2792
2830
|
* (`cycleSort`), and call `onSortChange`. The table doesn't sort the rows
|
|
2793
2831
|
* itself: sort them before passing `rows`. `loading` keeps the header and
|
|
2794
2832
|
* draws `loadingRows` skeleton rows. An empty `rows` keeps the header and
|
|
2795
|
-
* shows `empty` in one cell across every column
|
|
2833
|
+
* shows `empty` in one cell across every column, padded 48px top and bottom
|
|
2834
|
+
* and 24px at the sides (pass a bare stack such as NoResultsEmptyState). `maxHeight` makes the body
|
|
2796
2835
|
* scroll under a pinned header; wide tables always scroll sideways rather than
|
|
2797
2836
|
* squeeze.
|
|
2798
2837
|
* @a11y A real <table>. Named by `title` (aria-labelledby) or `aria-label`.
|
|
@@ -2828,4 +2867,207 @@ interface DataTableProps<T, K extends string = string> {
|
|
|
2828
2867
|
*/
|
|
2829
2868
|
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
2869
|
|
|
2831
|
-
|
|
2870
|
+
type MediaType = "TV" | "CTV" | "Digital" | "Social" | "Radio" | "Newspaper" | "Magazine";
|
|
2871
|
+
interface MediaLabelProps {
|
|
2872
|
+
/** The media type. Any other string gets the grey "other" fill, so a new type still renders. */
|
|
2873
|
+
type: MediaType | (string & {});
|
|
2874
|
+
/** Extra classes for placement, e.g. `absolute bottom-2 left-2` on a thumbnail. */
|
|
2875
|
+
className?: string;
|
|
2876
|
+
}
|
|
2877
|
+
/**
|
|
2878
|
+
* @pattern MediaLabel
|
|
2879
|
+
* @description The small solid label naming a creative's media type -- TV,
|
|
2880
|
+
* CTV, Digital, Social, Radio, Newspaper, Magazine -- usually laid over the
|
|
2881
|
+
* corner of a thumbnail. One colour per type, from the `color.media.*`
|
|
2882
|
+
* tokens, so a grid can be scanned by type. White text, small rounded
|
|
2883
|
+
* corners, normal case (acronyms stay capitals). The same in both themes,
|
|
2884
|
+
* since it sits on a photo.
|
|
2885
|
+
* @variant TV - Green.
|
|
2886
|
+
* @variant CTV - Indigo.
|
|
2887
|
+
* @variant Digital - Blue.
|
|
2888
|
+
* @variant Social - Orange.
|
|
2889
|
+
* @variant Radio - Teal.
|
|
2890
|
+
* @variant Newspaper - Amber.
|
|
2891
|
+
* @variant Magazine - Berry.
|
|
2892
|
+
* @variant other - Grey, for any type not in the list.
|
|
2893
|
+
* @tokens bg-media-tv, bg-media-ctv, bg-media-digital, bg-media-social,
|
|
2894
|
+
* bg-media-radio, bg-media-newspaper, bg-media-magazine, bg-media-other,
|
|
2895
|
+
* text-status-onstatus, text-micro, font-semibold, rounded-sm
|
|
2896
|
+
* @use on a creative thumbnail or card to say which media it ran in.
|
|
2897
|
+
* @avoid for anything that isn't a media type -- a category or focus area is
|
|
2898
|
+
* a Tag, a status is a Badge.
|
|
2899
|
+
* @avoid a custom colour per page. Add a token for a new type instead.
|
|
2900
|
+
* @a11y The text is the type's name, so colour is never the only signal.
|
|
2901
|
+
* Every fill passes AA (5.7:1 or more) for white 11px text.
|
|
2902
|
+
* @usage
|
|
2903
|
+
* ```tsx
|
|
2904
|
+
* <div className="relative">
|
|
2905
|
+
* <img src={thumb} alt="" />
|
|
2906
|
+
* <MediaLabel type="CTV" className="absolute bottom-2 left-2" />
|
|
2907
|
+
* </div>
|
|
2908
|
+
* ```
|
|
2909
|
+
*/
|
|
2910
|
+
declare function MediaLabel({ type, className }: MediaLabelProps): react.JSX.Element;
|
|
2911
|
+
|
|
2912
|
+
interface SuggestionChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
2913
|
+
/** The suggestion itself, in normal case: "Luxury SUV brands", "Where are we wasting seats?". */
|
|
2914
|
+
children: ReactNode;
|
|
2915
|
+
}
|
|
2916
|
+
/**
|
|
2917
|
+
* @pattern SuggestionChip
|
|
2918
|
+
* @description An outlined grey pill offering a ready-made search or
|
|
2919
|
+
* question: "Or try: Luxury SUV brands", an AI follow-up, a "Did you mean".
|
|
2920
|
+
* Clicking it runs that suggestion. Text only, normal case.
|
|
2921
|
+
* @tokens rounded-full, border, border-border-default, bg-surface, text-sm,
|
|
2922
|
+
* text-text-primary, hover:bg-subtle, hover:border-border-strong,
|
|
2923
|
+
* transition-colors, duration-(--mr-motion-duration-interactive),
|
|
2924
|
+
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-2,
|
|
2925
|
+
* focus-visible:outline-border-focus
|
|
2926
|
+
* @use for shortcuts the user may take instead of typing: example searches,
|
|
2927
|
+
* follow-up questions, spelling suggestions. Put a short lead-in before the
|
|
2928
|
+
* row ("Or try", "Did you mean").
|
|
2929
|
+
* @avoid for the screen's own actions -- "Add", "Save", "Export" are Buttons.
|
|
2930
|
+
* @avoid for something that stays switched on. Pick-many on/off pills are
|
|
2931
|
+
* ToggleChip; pick-one is SegmentedControl.
|
|
2932
|
+
* @avoid an icon. The lead-in explains what the row is.
|
|
2933
|
+
* @a11y A plain <button>; its text is its name, so the suggestion must read
|
|
2934
|
+
* on its own. Tab reaches each chip; Enter or Space runs it. Keep the lead-in
|
|
2935
|
+
* as visible text before the row, not inside the chips.
|
|
2936
|
+
* @usage
|
|
2937
|
+
* ```tsx
|
|
2938
|
+
* <div className="flex flex-wrap items-center gap-2">
|
|
2939
|
+
* <span className="text-sm text-text-secondary">Or try</span>
|
|
2940
|
+
* <SuggestionChip onClick={() => search("Luxury SUV brands")}>Luxury SUV brands</SuggestionChip>
|
|
2941
|
+
* </div>
|
|
2942
|
+
* ```
|
|
2943
|
+
*/
|
|
2944
|
+
declare function SuggestionChip({ children, className, type, ...props }: SuggestionChipProps): react.JSX.Element;
|
|
2945
|
+
|
|
2946
|
+
interface ToggleChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "onChange"> {
|
|
2947
|
+
/** Whether this chip is switched on. */
|
|
2948
|
+
selected: boolean;
|
|
2949
|
+
/** Called with the new value when the chip is clicked. */
|
|
2950
|
+
onChange: (selected: boolean) => void;
|
|
2951
|
+
/** The option's name: "US", "Germany". */
|
|
2952
|
+
children: ReactNode;
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* @pattern ToggleChip
|
|
2956
|
+
* @description A pill you switch on and off, in a row where several can be
|
|
2957
|
+
* on at once: countries, media types, quick filters. On, it takes a pale
|
|
2958
|
+
* tint of the brand blue, a brand border and a tick before the label, so the state
|
|
2959
|
+
* doesn't rest on colour alone.
|
|
2960
|
+
* @variant off - Grey outline, as SuggestionChip.
|
|
2961
|
+
* @variant on - Pale brand-blue tint, brand border and text, leading tick.
|
|
2962
|
+
* @tokens rounded-full, border, border-border-default, bg-surface, text-sm,
|
|
2963
|
+
* text-text-primary, hover:bg-subtle, hover:border-border-strong,
|
|
2964
|
+
* bg-brand-primaryAction/15, border-brand-primaryAction, text-brand-primaryAction,
|
|
2965
|
+
* transition-colors, duration-(--mr-motion-duration-interactive),
|
|
2966
|
+
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-2,
|
|
2967
|
+
* focus-visible:outline-border-focus
|
|
2968
|
+
* @use for pick-many options short enough to show all at once.
|
|
2969
|
+
* @avoid when only one can be on -- that's SegmentedControl.
|
|
2970
|
+
* @avoid for a long list. More than about eight options is a MultiSelectFilter.
|
|
2971
|
+
* @avoid for a setting that takes effect on its own -- that's Toggle.
|
|
2972
|
+
* @a11y A button with aria-pressed. The tick is decorative; the pressed
|
|
2973
|
+
* state is what a screen reader announces.
|
|
2974
|
+
* @usage
|
|
2975
|
+
* ```tsx
|
|
2976
|
+
* {COUNTRIES.map((c) => (
|
|
2977
|
+
* <ToggleChip key={c} selected={on.has(c)} onChange={(v) => set(c, v)}>{c}</ToggleChip>
|
|
2978
|
+
* ))}
|
|
2979
|
+
* ```
|
|
2980
|
+
*/
|
|
2981
|
+
declare function ToggleChip({ selected, onChange, children, className, type, onClick, ...props }: ToggleChipProps): react.JSX.Element;
|
|
2982
|
+
|
|
2983
|
+
interface CopyButtonProps {
|
|
2984
|
+
/** What to copy, or a function that builds it at click time. */
|
|
2985
|
+
value: string | (() => string);
|
|
2986
|
+
/** A visible label ("Copy summary"). Leave it out for the icon-only button. */
|
|
2987
|
+
label?: ReactNode;
|
|
2988
|
+
/** Names the icon-only button for screen readers: "Copy email". Required when there's no `label`. */
|
|
2989
|
+
"aria-label"?: string;
|
|
2990
|
+
/** xs 24 for inside a row (email, phone), sm 32 beside other buttons. */
|
|
2991
|
+
size?: "xs" | "sm";
|
|
2992
|
+
className?: string;
|
|
2993
|
+
}
|
|
2994
|
+
/**
|
|
2995
|
+
* @pattern CopyButton
|
|
2996
|
+
* @description Copies a value to the clipboard and confirms on the button
|
|
2997
|
+
* itself: the copy icon becomes a green tick for two seconds (a labelled
|
|
2998
|
+
* button also reads "Copied"), then it's ready again. Two looks -- icon only,
|
|
2999
|
+
* for an email or phone in a row, and with a label, for "Copy summary" in a
|
|
3000
|
+
* header.
|
|
3001
|
+
* @variant icon - Icon only. Needs an aria-label.
|
|
3002
|
+
* @variant labelled - Icon and text; the text becomes "Copied".
|
|
3003
|
+
* @tokens text-text-success, text-text-secondary, sr-only
|
|
3004
|
+
* @dependencies lucide-react
|
|
3005
|
+
* @behavior Writes to the clipboard on click. On success it shows the tick
|
|
3006
|
+
* for 2 seconds and announces "Copied" politely. If the browser blocks the
|
|
3007
|
+
* clipboard, nothing changes -- it never shows a tick it didn't earn.
|
|
3008
|
+
* @use when the copy is quick and the confirmation belongs on the control.
|
|
3009
|
+
* @avoid a toast for a copy. The tick is the confirmation; a toast would be
|
|
3010
|
+
* a second one.
|
|
3011
|
+
* @a11y Icon-only needs `aria-label`. "Copied" is announced through a
|
|
3012
|
+
* polite live region.
|
|
3013
|
+
* @usage
|
|
3014
|
+
* ```tsx
|
|
3015
|
+
* <CopyButton value={contact.email} aria-label="Copy email" />
|
|
3016
|
+
* <CopyButton value={buildSummary} label="Copy summary" size="sm" />
|
|
3017
|
+
* ```
|
|
3018
|
+
*/
|
|
3019
|
+
declare function CopyButton({ value, label, "aria-label": ariaLabel, size, className }: CopyButtonProps): react.JSX.Element;
|
|
3020
|
+
|
|
3021
|
+
type InlineMessageTone = "info" | "success" | "warning" | "danger";
|
|
3022
|
+
interface InlineMessageProps {
|
|
3023
|
+
/** info (default), success, warning or danger. */
|
|
3024
|
+
tone?: InlineMessageTone;
|
|
3025
|
+
/** One short line: "A similar organization already exists". */
|
|
3026
|
+
title: ReactNode;
|
|
3027
|
+
/** Optional detail under the title. */
|
|
3028
|
+
children?: ReactNode;
|
|
3029
|
+
/** Optional actions under the text -- small Buttons or SuggestionChips. */
|
|
3030
|
+
actions?: ReactNode;
|
|
3031
|
+
/** Shows a close × that calls this. Leave it out for a message that must stay until the problem is fixed. */
|
|
3032
|
+
onDismiss?: () => void;
|
|
3033
|
+
className?: string;
|
|
3034
|
+
}
|
|
3035
|
+
/**
|
|
3036
|
+
* @pattern InlineMessage
|
|
3037
|
+
* @description A message that sits in the page, next to what it's about, and
|
|
3038
|
+
* stays until it's dealt with: "A similar organization already exists",
|
|
3039
|
+
* "3 rows couldn't be matched". Icon, a short title, an optional line, and
|
|
3040
|
+
* optional actions. Four tones.
|
|
3041
|
+
* @variant info - Pale brand blue. Something worth knowing.
|
|
3042
|
+
* @variant success - Green. A check passed, in place.
|
|
3043
|
+
* @variant warning - Amber. Something may be wrong; the user can still go on.
|
|
3044
|
+
* @variant danger - Red. Something is wrong and needs fixing first.
|
|
3045
|
+
* @tokens rounded-control, border, bg-brand-primaryAction/10,
|
|
3046
|
+
* border-brand-primaryAction/30, text-brand-primaryAction,
|
|
3047
|
+
* bg-status-success/10, border-status-success/40, text-text-success,
|
|
3048
|
+
* bg-status-warning/15, border-status-warning/50, text-text-warning,
|
|
3049
|
+
* bg-status-danger/10, border-status-danger/40, text-text-danger, text-sm,
|
|
3050
|
+
* font-semibold, text-text-primary, text-text-secondary,
|
|
3051
|
+
* text-text-tertiary, hover:bg-subtle, hover:text-text-primary,
|
|
3052
|
+
* focus-visible:outline-2, focus-visible:outline-border-focus
|
|
3053
|
+
* @dependencies lucide-react
|
|
3054
|
+
* @behavior Stays by default. Pass `onDismiss` to add a ×, only for a tip
|
|
3055
|
+
* that's safe to hide; a message about a problem goes away when the problem
|
|
3056
|
+
* is fixed.
|
|
3057
|
+
* @use for feedback about one part of the page that must stay visible while
|
|
3058
|
+
* the user acts on it.
|
|
3059
|
+
* @avoid for confirming something that just happened -- that's a Toast, or
|
|
3060
|
+
* the tick on a CopyButton.
|
|
3061
|
+
* @avoid for an error on a single field -- that's TextField's error text.
|
|
3062
|
+
* @a11y warning and danger use role="alert" so they're announced when they
|
|
3063
|
+
* appear; info and success use role="status". The tone is also in the icon
|
|
3064
|
+
* and the words, never colour alone.
|
|
3065
|
+
* @usage
|
|
3066
|
+
* ```tsx
|
|
3067
|
+
* <InlineMessage tone="warning" title="A similar organization already exists"
|
|
3068
|
+
* actions={<SuggestionChip onClick={useExisting}>Use Acme Corp</SuggestionChip>} />
|
|
3069
|
+
* ```
|
|
3070
|
+
*/
|
|
3071
|
+
declare function InlineMessage({ tone, title, children, actions, onDismiss, className }: InlineMessageProps): react.JSX.Element;
|
|
3072
|
+
|
|
3073
|
+
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 };
|