@mediaradar/design-components 0.18.8 → 0.20.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 +230 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +193 -2
- package/dist/index.d.ts +193 -2
- package/dist/index.js +225 -116
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -424,6 +424,7 @@ declare function CheckBoxBox({ checked, indeterminate, disabled, className }: Ch
|
|
|
424
424
|
* @usage
|
|
425
425
|
* ```tsx
|
|
426
426
|
* <DateRangeFilter caption="Date Range" defaultValue="Rolling 6 months" onChange={setRange} />
|
|
427
|
+
* <DateRangeFilter caption="Dates" showDates shortDates placement="right" />
|
|
427
428
|
* <DateRangeFilter presetSet="creativeIntel" defaultValue="Last 7 days" onChange={setRange} />
|
|
428
429
|
* <DateRangeFilter presetSet="creativeIntel" value={preset} range={[start, end]} onChange={setPreset} onRangeChange={(s, e) => setRange({ start: s, end: e })} />
|
|
429
430
|
* ```
|
|
@@ -449,6 +450,13 @@ interface DateRangeFilterProps {
|
|
|
449
450
|
range?: [Date, Date];
|
|
450
451
|
/** Which edge of the trigger the popup aligns to. */
|
|
451
452
|
align?: "left" | "right";
|
|
453
|
+
/**
|
|
454
|
+
* Where the popup opens. 'below' (default) under the chip; 'above' over it,
|
|
455
|
+
* falling back to below when there is no room at the top of the window;
|
|
456
|
+
* 'right' beside it with bottoms aligned -- for a chip low on the page or
|
|
457
|
+
* in a narrow column, where opening below would push the popup off screen.
|
|
458
|
+
*/
|
|
459
|
+
placement?: "below" | "above" | "right";
|
|
452
460
|
/** Fired on Apply with the chip's new display value. */
|
|
453
461
|
onChange?: (value: string) => void;
|
|
454
462
|
/** Fired on Apply (and once on mount, uncontrolled only) with the resolved start/end dates -- e.g. to drive dependent table columns. */
|
|
@@ -464,7 +472,7 @@ interface DateRangeFilterProps {
|
|
|
464
472
|
/** Prefix for data-testid attributes on the trigger, popover, each preset option, and Cancel/Apply. Omit for no test-id wiring. */
|
|
465
473
|
testIdPrefix?: string;
|
|
466
474
|
}
|
|
467
|
-
declare function DateRangeFilter({ caption, defaultValue, value: controlledValue, range: controlledRange, align, onChange, onRangeChange, showDates, shortDates, icon, presetSet, testIdPrefix, }: DateRangeFilterProps): react.JSX.Element;
|
|
475
|
+
declare function DateRangeFilter({ caption, defaultValue, value: controlledValue, range: controlledRange, align, placement, onChange, onRangeChange, showDates, shortDates, icon, presetSet, testIdPrefix, }: DateRangeFilterProps): react.JSX.Element;
|
|
468
476
|
|
|
469
477
|
/**
|
|
470
478
|
* @pattern SearchBar
|
|
@@ -1880,6 +1888,96 @@ interface WorkspaceAvatarProps {
|
|
|
1880
1888
|
*/
|
|
1881
1889
|
declare function WorkspaceAvatar({ name, size }: WorkspaceAvatarProps): react.JSX.Element;
|
|
1882
1890
|
|
|
1891
|
+
type ToastTone = "neutral" | "success" | "warning";
|
|
1892
|
+
interface ToastProps {
|
|
1893
|
+
/** What happened, in a short sentence. Past tense: "12 accounts removed". */
|
|
1894
|
+
message: ReactNode;
|
|
1895
|
+
/**
|
|
1896
|
+
* One follow-up, usually Undo. Giving a toast an action extends how long it
|
|
1897
|
+
* stays, since the reader now has to notice it, read it, decide and reach.
|
|
1898
|
+
*/
|
|
1899
|
+
action?: {
|
|
1900
|
+
label: string;
|
|
1901
|
+
onClick: () => void;
|
|
1902
|
+
};
|
|
1903
|
+
/** Called when the toast has dismissed itself, or the action closed it. */
|
|
1904
|
+
onClose: () => void;
|
|
1905
|
+
/**
|
|
1906
|
+
* Carried by a leading icon, never by the surface. The surface stays the
|
|
1907
|
+
* same on every toast on purpose -- see @behavior.
|
|
1908
|
+
*/
|
|
1909
|
+
tone?: ToastTone;
|
|
1910
|
+
/**
|
|
1911
|
+
* Override the duration. The defaults are 5s, or 10s when there is an
|
|
1912
|
+
* action; both pause while hovered or focused. Set deliberately or not at
|
|
1913
|
+
* all -- a one-off number here is how the product ended up with six.
|
|
1914
|
+
*/
|
|
1915
|
+
duration?: number;
|
|
1916
|
+
className?: string;
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* @pattern Toast
|
|
1920
|
+
* @description Transient feedback about the page or the task: "12 accounts
|
|
1921
|
+
* removed", "Export started". Floats at the bottom of the window so it never
|
|
1922
|
+
* pushes the page around, dismisses itself, and may carry one action.
|
|
1923
|
+
*
|
|
1924
|
+
* It is one of three shapes of feedback, and the shape is the first decision:
|
|
1925
|
+
* feedback about the control you just used stays ON it (a copy button's icon
|
|
1926
|
+
* becoming a tick); feedback about the page or task floats, which is this;
|
|
1927
|
+
* and feedback you have to act on before continuing stays inline where the
|
|
1928
|
+
* action is, and does not dismiss.
|
|
1929
|
+
* @props
|
|
1930
|
+
* message: ReactNode
|
|
1931
|
+
* action?: { label: string; onClick: () => void }
|
|
1932
|
+
* onClose: () => void
|
|
1933
|
+
* tone?: 'neutral' | 'success' | 'warning' (default 'neutral')
|
|
1934
|
+
* duration?: number -- ms; defaults to 5000, or 10000 with an action
|
|
1935
|
+
* @tokens bg-inverseSurface, text-text-inverse, text-text-inverseSuccess,
|
|
1936
|
+
* text-text-inverseWarning, rounded-control, shadow-overlay,
|
|
1937
|
+
* z-toast, duration-(--mr-motion-duration-interactive), ease-interactive,
|
|
1938
|
+
* focus-visible:outline-border-focus
|
|
1939
|
+
* @dependencies lucide-react
|
|
1940
|
+
* @behavior The surface is the same on every toast. Tone is a leading icon in
|
|
1941
|
+
* green or amber, not a colour wash: a toast already has the reader's attention because it
|
|
1942
|
+
* appeared, so colouring the whole surface adds nothing and makes a failure
|
|
1943
|
+
* read as an alarm. It also keeps one object rather than one per mood -- the
|
|
1944
|
+
* product had a dark pill, a light pill and a green pill doing the same job.
|
|
1945
|
+
*
|
|
1946
|
+
* Timing is tied to whether there is an action, not set per call site. 5s
|
|
1947
|
+
* reads comfortably; 10s is what an Undo needs, because the reader has to
|
|
1948
|
+
* notice the toast, read it, decide and then reach for it. Both pause on
|
|
1949
|
+
* hover and on keyboard focus, which is the real fix for the two toasts that
|
|
1950
|
+
* previously never dismissed at all -- they were held open so an Undo could
|
|
1951
|
+
* be caught, at the cost of a message that never left.
|
|
1952
|
+
* @a11y role="status" with aria-live="polite", so it is announced without
|
|
1953
|
+
* interrupting. The action is a real button inside the live region, reachable
|
|
1954
|
+
* by keyboard; focusing it pauses the timer, so a keyboard user is never
|
|
1955
|
+
* racing the dismissal. The icon is decorative -- the message carries the
|
|
1956
|
+
* meaning, since tone shown only as an icon cannot be the sole signal.
|
|
1957
|
+
* @variant neutral - Something happened. The default, and most toasts.
|
|
1958
|
+
* @variant success - A thing completed that the reader was waiting on.
|
|
1959
|
+
* @variant warning - It completed with something worth knowing. Not for failure -- a failure the reader must act on belongs inline, not in a message that leaves.
|
|
1960
|
+
* @use when reporting something that already happened, that the reader does
|
|
1961
|
+
* not have to act on.
|
|
1962
|
+
* @use with an action when the thing is reversible and reversing it is cheap
|
|
1963
|
+
* -- an Undo on a bulk delete.
|
|
1964
|
+
* @avoid when the reader must act before continuing. A toast leaves; anything
|
|
1965
|
+
* load-bearing belongs inline, next to what it is about.
|
|
1966
|
+
* @avoid when the feedback is about the control just used. A copy button's
|
|
1967
|
+
* tick belongs on the button, where the reader is already looking.
|
|
1968
|
+
* @avoid for errors that lose work. An error that leaves after ten seconds is
|
|
1969
|
+
* an error nobody can act on.
|
|
1970
|
+
* @avoid stacking several at once. Toasts queue; two at the same time means
|
|
1971
|
+
* the second is read and the first is not.
|
|
1972
|
+
* @usage
|
|
1973
|
+
* ```tsx
|
|
1974
|
+
* <Toast message="Export started" onClose={clear} />
|
|
1975
|
+
* <Toast message="12 accounts removed" action={{ label: 'Undo', onClick: undo }} onClose={clear} />
|
|
1976
|
+
* <Toast tone="success" message="Account created" onClose={clear} />
|
|
1977
|
+
* ```
|
|
1978
|
+
*/
|
|
1979
|
+
declare function Toast({ message, action, onClose, tone, duration, className }: ToastProps): react.ReactPortal;
|
|
1980
|
+
|
|
1883
1981
|
interface TagProps {
|
|
1884
1982
|
/** The tag's text, e.g. "Digital". Keep it short: the chip doesn't wrap or truncate. */
|
|
1885
1983
|
children: ReactNode;
|
|
@@ -2178,4 +2276,97 @@ interface FreshnessProps {
|
|
|
2178
2276
|
*/
|
|
2179
2277
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
2180
2278
|
|
|
2181
|
-
|
|
2279
|
+
interface SectionHeadingProps {
|
|
2280
|
+
/** The section's name, in sentence case -- "Saved reports". */
|
|
2281
|
+
title: ReactNode;
|
|
2282
|
+
/** One line under the title saying what the section is or how it works. */
|
|
2283
|
+
description?: ReactNode;
|
|
2284
|
+
/** Controls that act on the whole section -- a search box, a button. Sit right, aligned to the bottom. */
|
|
2285
|
+
actions?: ReactNode;
|
|
2286
|
+
/** Heading level. Defaults to h2, the level under a page's own h1 title. */
|
|
2287
|
+
as?: "h2" | "h3";
|
|
2288
|
+
/** Id for the heading, so the section can be `aria-labelledby` it. */
|
|
2289
|
+
id?: string;
|
|
2290
|
+
className?: string;
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* @pattern SectionHeading
|
|
2294
|
+
* @description The title of a section within a page -- "Start from a template",
|
|
2295
|
+
* "Saved reports". One size everywhere (16px semibold), so every page's sections
|
|
2296
|
+
* read at the same level under the page title. Optional one-line description
|
|
2297
|
+
* under it, optional actions on the right.
|
|
2298
|
+
* @props
|
|
2299
|
+
* title: ReactNode -- the section's name, sentence case
|
|
2300
|
+
* description?: ReactNode -- one line under the title
|
|
2301
|
+
* actions?: ReactNode -- section-wide controls on the right (search, a button)
|
|
2302
|
+
* as?: 'h2' | 'h3' (default 'h2') -- heading level
|
|
2303
|
+
* id?: string -- for the section's aria-labelledby
|
|
2304
|
+
* @tokens text-base, font-semibold, text-text-primary, text-dense, text-text-secondary
|
|
2305
|
+
* @use for every titled section of a page, below the page title.
|
|
2306
|
+
* @use `description` for the one thing a reader must know before using the
|
|
2307
|
+
* section -- it sits above the content, where a long list cannot push it out
|
|
2308
|
+
* of view.
|
|
2309
|
+
* @avoid for a card's own title, or a field label inside a form. Those are
|
|
2310
|
+
* smaller and belong to the card or the field.
|
|
2311
|
+
* @avoid writing a paragraph into `description`. One line; anything longer is
|
|
2312
|
+
* help text and belongs elsewhere.
|
|
2313
|
+
* @a11y Renders a real heading (h2 by default) so screen-reader users can jump
|
|
2314
|
+
* between sections. Pass `id` and point the section's `aria-labelledby` at it.
|
|
2315
|
+
* @usage
|
|
2316
|
+
* ```tsx
|
|
2317
|
+
* <section aria-labelledby="saved-title">
|
|
2318
|
+
* <SectionHeading
|
|
2319
|
+
* id="saved-title"
|
|
2320
|
+
* title="Saved reports"
|
|
2321
|
+
* description="A saved report is its setup, with no data in it."
|
|
2322
|
+
* actions={<SearchBar placeholder="Search saved reports" value={q} onChange={setQ} />}
|
|
2323
|
+
* />
|
|
2324
|
+
* ...
|
|
2325
|
+
* </section>
|
|
2326
|
+
* ```
|
|
2327
|
+
*/
|
|
2328
|
+
declare function SectionHeading({ title, description, actions, as: Tag, id, className }: SectionHeadingProps): react.JSX.Element;
|
|
2329
|
+
|
|
2330
|
+
interface PageHeaderProps {
|
|
2331
|
+
/** The page's name -- "Report Builder". Title Case for a feature name. */
|
|
2332
|
+
title: ReactNode;
|
|
2333
|
+
/** One line under the title saying what the user can do on this page. */
|
|
2334
|
+
description?: ReactNode;
|
|
2335
|
+
/** The page's main actions, right-aligned -- usually one primary Button. */
|
|
2336
|
+
actions?: ReactNode;
|
|
2337
|
+
className?: string;
|
|
2338
|
+
}
|
|
2339
|
+
/**
|
|
2340
|
+
* @pattern PageHeader
|
|
2341
|
+
* @description The top of a page: its title (the page's only h1), an optional
|
|
2342
|
+
* one-line description under it, and the page's main actions on the right.
|
|
2343
|
+
* Title 20px over a 14px description, 2px apart, so the two read as one unit;
|
|
2344
|
+
* the actions centre on the pair. Type steps down evenly from there: page
|
|
2345
|
+
* title 20, SectionHeading 16, body 14.
|
|
2346
|
+
* @props
|
|
2347
|
+
* title: ReactNode -- the page's name
|
|
2348
|
+
* description?: ReactNode -- one line, about 70 characters at most, on what the user can do here
|
|
2349
|
+
* actions?: ReactNode -- primary actions, right-aligned
|
|
2350
|
+
* @tokens text-xl, font-semibold, tracking-tight, text-text-primary, text-sm, text-text-secondary, max-w-2xl
|
|
2351
|
+
* @use at the top of every top-level page.
|
|
2352
|
+
* @use `description` to say what the page is for, in one sentence a first-time
|
|
2353
|
+
* user can act on ("Build your own tables from MediaRadar data...").
|
|
2354
|
+
* @avoid putting the description to the right of the title. It competes with
|
|
2355
|
+
* the actions and wraps unpredictably on narrow screens.
|
|
2356
|
+
* @avoid more than one primary action in `actions`.
|
|
2357
|
+
* @avoid a description on every page by habit. Use one only where a first-time
|
|
2358
|
+
* user would not know what the page is for; a pipe-separated subtitle beside
|
|
2359
|
+
* the title is the pattern this replaces.
|
|
2360
|
+
* @a11y Renders the page's h1. Use `SectionHeading` (h2) for the sections below it.
|
|
2361
|
+
* @usage
|
|
2362
|
+
* ```tsx
|
|
2363
|
+
* <PageHeader
|
|
2364
|
+
* title="Report Builder"
|
|
2365
|
+
* description="Build tables from MediaRadar data and export them whenever you need."
|
|
2366
|
+
* actions={<Button><Plus /> New report</Button>}
|
|
2367
|
+
* />
|
|
2368
|
+
* ```
|
|
2369
|
+
*/
|
|
2370
|
+
declare function PageHeader({ title, description, actions, className }: PageHeaderProps): react.JSX.Element;
|
|
2371
|
+
|
|
2372
|
+
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, 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 SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, 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, Toast, type ToastProps, type ToastTone, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -424,6 +424,7 @@ declare function CheckBoxBox({ checked, indeterminate, disabled, className }: Ch
|
|
|
424
424
|
* @usage
|
|
425
425
|
* ```tsx
|
|
426
426
|
* <DateRangeFilter caption="Date Range" defaultValue="Rolling 6 months" onChange={setRange} />
|
|
427
|
+
* <DateRangeFilter caption="Dates" showDates shortDates placement="right" />
|
|
427
428
|
* <DateRangeFilter presetSet="creativeIntel" defaultValue="Last 7 days" onChange={setRange} />
|
|
428
429
|
* <DateRangeFilter presetSet="creativeIntel" value={preset} range={[start, end]} onChange={setPreset} onRangeChange={(s, e) => setRange({ start: s, end: e })} />
|
|
429
430
|
* ```
|
|
@@ -449,6 +450,13 @@ interface DateRangeFilterProps {
|
|
|
449
450
|
range?: [Date, Date];
|
|
450
451
|
/** Which edge of the trigger the popup aligns to. */
|
|
451
452
|
align?: "left" | "right";
|
|
453
|
+
/**
|
|
454
|
+
* Where the popup opens. 'below' (default) under the chip; 'above' over it,
|
|
455
|
+
* falling back to below when there is no room at the top of the window;
|
|
456
|
+
* 'right' beside it with bottoms aligned -- for a chip low on the page or
|
|
457
|
+
* in a narrow column, where opening below would push the popup off screen.
|
|
458
|
+
*/
|
|
459
|
+
placement?: "below" | "above" | "right";
|
|
452
460
|
/** Fired on Apply with the chip's new display value. */
|
|
453
461
|
onChange?: (value: string) => void;
|
|
454
462
|
/** Fired on Apply (and once on mount, uncontrolled only) with the resolved start/end dates -- e.g. to drive dependent table columns. */
|
|
@@ -464,7 +472,7 @@ interface DateRangeFilterProps {
|
|
|
464
472
|
/** Prefix for data-testid attributes on the trigger, popover, each preset option, and Cancel/Apply. Omit for no test-id wiring. */
|
|
465
473
|
testIdPrefix?: string;
|
|
466
474
|
}
|
|
467
|
-
declare function DateRangeFilter({ caption, defaultValue, value: controlledValue, range: controlledRange, align, onChange, onRangeChange, showDates, shortDates, icon, presetSet, testIdPrefix, }: DateRangeFilterProps): react.JSX.Element;
|
|
475
|
+
declare function DateRangeFilter({ caption, defaultValue, value: controlledValue, range: controlledRange, align, placement, onChange, onRangeChange, showDates, shortDates, icon, presetSet, testIdPrefix, }: DateRangeFilterProps): react.JSX.Element;
|
|
468
476
|
|
|
469
477
|
/**
|
|
470
478
|
* @pattern SearchBar
|
|
@@ -1880,6 +1888,96 @@ interface WorkspaceAvatarProps {
|
|
|
1880
1888
|
*/
|
|
1881
1889
|
declare function WorkspaceAvatar({ name, size }: WorkspaceAvatarProps): react.JSX.Element;
|
|
1882
1890
|
|
|
1891
|
+
type ToastTone = "neutral" | "success" | "warning";
|
|
1892
|
+
interface ToastProps {
|
|
1893
|
+
/** What happened, in a short sentence. Past tense: "12 accounts removed". */
|
|
1894
|
+
message: ReactNode;
|
|
1895
|
+
/**
|
|
1896
|
+
* One follow-up, usually Undo. Giving a toast an action extends how long it
|
|
1897
|
+
* stays, since the reader now has to notice it, read it, decide and reach.
|
|
1898
|
+
*/
|
|
1899
|
+
action?: {
|
|
1900
|
+
label: string;
|
|
1901
|
+
onClick: () => void;
|
|
1902
|
+
};
|
|
1903
|
+
/** Called when the toast has dismissed itself, or the action closed it. */
|
|
1904
|
+
onClose: () => void;
|
|
1905
|
+
/**
|
|
1906
|
+
* Carried by a leading icon, never by the surface. The surface stays the
|
|
1907
|
+
* same on every toast on purpose -- see @behavior.
|
|
1908
|
+
*/
|
|
1909
|
+
tone?: ToastTone;
|
|
1910
|
+
/**
|
|
1911
|
+
* Override the duration. The defaults are 5s, or 10s when there is an
|
|
1912
|
+
* action; both pause while hovered or focused. Set deliberately or not at
|
|
1913
|
+
* all -- a one-off number here is how the product ended up with six.
|
|
1914
|
+
*/
|
|
1915
|
+
duration?: number;
|
|
1916
|
+
className?: string;
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* @pattern Toast
|
|
1920
|
+
* @description Transient feedback about the page or the task: "12 accounts
|
|
1921
|
+
* removed", "Export started". Floats at the bottom of the window so it never
|
|
1922
|
+
* pushes the page around, dismisses itself, and may carry one action.
|
|
1923
|
+
*
|
|
1924
|
+
* It is one of three shapes of feedback, and the shape is the first decision:
|
|
1925
|
+
* feedback about the control you just used stays ON it (a copy button's icon
|
|
1926
|
+
* becoming a tick); feedback about the page or task floats, which is this;
|
|
1927
|
+
* and feedback you have to act on before continuing stays inline where the
|
|
1928
|
+
* action is, and does not dismiss.
|
|
1929
|
+
* @props
|
|
1930
|
+
* message: ReactNode
|
|
1931
|
+
* action?: { label: string; onClick: () => void }
|
|
1932
|
+
* onClose: () => void
|
|
1933
|
+
* tone?: 'neutral' | 'success' | 'warning' (default 'neutral')
|
|
1934
|
+
* duration?: number -- ms; defaults to 5000, or 10000 with an action
|
|
1935
|
+
* @tokens bg-inverseSurface, text-text-inverse, text-text-inverseSuccess,
|
|
1936
|
+
* text-text-inverseWarning, rounded-control, shadow-overlay,
|
|
1937
|
+
* z-toast, duration-(--mr-motion-duration-interactive), ease-interactive,
|
|
1938
|
+
* focus-visible:outline-border-focus
|
|
1939
|
+
* @dependencies lucide-react
|
|
1940
|
+
* @behavior The surface is the same on every toast. Tone is a leading icon in
|
|
1941
|
+
* green or amber, not a colour wash: a toast already has the reader's attention because it
|
|
1942
|
+
* appeared, so colouring the whole surface adds nothing and makes a failure
|
|
1943
|
+
* read as an alarm. It also keeps one object rather than one per mood -- the
|
|
1944
|
+
* product had a dark pill, a light pill and a green pill doing the same job.
|
|
1945
|
+
*
|
|
1946
|
+
* Timing is tied to whether there is an action, not set per call site. 5s
|
|
1947
|
+
* reads comfortably; 10s is what an Undo needs, because the reader has to
|
|
1948
|
+
* notice the toast, read it, decide and then reach for it. Both pause on
|
|
1949
|
+
* hover and on keyboard focus, which is the real fix for the two toasts that
|
|
1950
|
+
* previously never dismissed at all -- they were held open so an Undo could
|
|
1951
|
+
* be caught, at the cost of a message that never left.
|
|
1952
|
+
* @a11y role="status" with aria-live="polite", so it is announced without
|
|
1953
|
+
* interrupting. The action is a real button inside the live region, reachable
|
|
1954
|
+
* by keyboard; focusing it pauses the timer, so a keyboard user is never
|
|
1955
|
+
* racing the dismissal. The icon is decorative -- the message carries the
|
|
1956
|
+
* meaning, since tone shown only as an icon cannot be the sole signal.
|
|
1957
|
+
* @variant neutral - Something happened. The default, and most toasts.
|
|
1958
|
+
* @variant success - A thing completed that the reader was waiting on.
|
|
1959
|
+
* @variant warning - It completed with something worth knowing. Not for failure -- a failure the reader must act on belongs inline, not in a message that leaves.
|
|
1960
|
+
* @use when reporting something that already happened, that the reader does
|
|
1961
|
+
* not have to act on.
|
|
1962
|
+
* @use with an action when the thing is reversible and reversing it is cheap
|
|
1963
|
+
* -- an Undo on a bulk delete.
|
|
1964
|
+
* @avoid when the reader must act before continuing. A toast leaves; anything
|
|
1965
|
+
* load-bearing belongs inline, next to what it is about.
|
|
1966
|
+
* @avoid when the feedback is about the control just used. A copy button's
|
|
1967
|
+
* tick belongs on the button, where the reader is already looking.
|
|
1968
|
+
* @avoid for errors that lose work. An error that leaves after ten seconds is
|
|
1969
|
+
* an error nobody can act on.
|
|
1970
|
+
* @avoid stacking several at once. Toasts queue; two at the same time means
|
|
1971
|
+
* the second is read and the first is not.
|
|
1972
|
+
* @usage
|
|
1973
|
+
* ```tsx
|
|
1974
|
+
* <Toast message="Export started" onClose={clear} />
|
|
1975
|
+
* <Toast message="12 accounts removed" action={{ label: 'Undo', onClick: undo }} onClose={clear} />
|
|
1976
|
+
* <Toast tone="success" message="Account created" onClose={clear} />
|
|
1977
|
+
* ```
|
|
1978
|
+
*/
|
|
1979
|
+
declare function Toast({ message, action, onClose, tone, duration, className }: ToastProps): react.ReactPortal;
|
|
1980
|
+
|
|
1883
1981
|
interface TagProps {
|
|
1884
1982
|
/** The tag's text, e.g. "Digital". Keep it short: the chip doesn't wrap or truncate. */
|
|
1885
1983
|
children: ReactNode;
|
|
@@ -2178,4 +2276,97 @@ interface FreshnessProps {
|
|
|
2178
2276
|
*/
|
|
2179
2277
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
2180
2278
|
|
|
2181
|
-
|
|
2279
|
+
interface SectionHeadingProps {
|
|
2280
|
+
/** The section's name, in sentence case -- "Saved reports". */
|
|
2281
|
+
title: ReactNode;
|
|
2282
|
+
/** One line under the title saying what the section is or how it works. */
|
|
2283
|
+
description?: ReactNode;
|
|
2284
|
+
/** Controls that act on the whole section -- a search box, a button. Sit right, aligned to the bottom. */
|
|
2285
|
+
actions?: ReactNode;
|
|
2286
|
+
/** Heading level. Defaults to h2, the level under a page's own h1 title. */
|
|
2287
|
+
as?: "h2" | "h3";
|
|
2288
|
+
/** Id for the heading, so the section can be `aria-labelledby` it. */
|
|
2289
|
+
id?: string;
|
|
2290
|
+
className?: string;
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* @pattern SectionHeading
|
|
2294
|
+
* @description The title of a section within a page -- "Start from a template",
|
|
2295
|
+
* "Saved reports". One size everywhere (16px semibold), so every page's sections
|
|
2296
|
+
* read at the same level under the page title. Optional one-line description
|
|
2297
|
+
* under it, optional actions on the right.
|
|
2298
|
+
* @props
|
|
2299
|
+
* title: ReactNode -- the section's name, sentence case
|
|
2300
|
+
* description?: ReactNode -- one line under the title
|
|
2301
|
+
* actions?: ReactNode -- section-wide controls on the right (search, a button)
|
|
2302
|
+
* as?: 'h2' | 'h3' (default 'h2') -- heading level
|
|
2303
|
+
* id?: string -- for the section's aria-labelledby
|
|
2304
|
+
* @tokens text-base, font-semibold, text-text-primary, text-dense, text-text-secondary
|
|
2305
|
+
* @use for every titled section of a page, below the page title.
|
|
2306
|
+
* @use `description` for the one thing a reader must know before using the
|
|
2307
|
+
* section -- it sits above the content, where a long list cannot push it out
|
|
2308
|
+
* of view.
|
|
2309
|
+
* @avoid for a card's own title, or a field label inside a form. Those are
|
|
2310
|
+
* smaller and belong to the card or the field.
|
|
2311
|
+
* @avoid writing a paragraph into `description`. One line; anything longer is
|
|
2312
|
+
* help text and belongs elsewhere.
|
|
2313
|
+
* @a11y Renders a real heading (h2 by default) so screen-reader users can jump
|
|
2314
|
+
* between sections. Pass `id` and point the section's `aria-labelledby` at it.
|
|
2315
|
+
* @usage
|
|
2316
|
+
* ```tsx
|
|
2317
|
+
* <section aria-labelledby="saved-title">
|
|
2318
|
+
* <SectionHeading
|
|
2319
|
+
* id="saved-title"
|
|
2320
|
+
* title="Saved reports"
|
|
2321
|
+
* description="A saved report is its setup, with no data in it."
|
|
2322
|
+
* actions={<SearchBar placeholder="Search saved reports" value={q} onChange={setQ} />}
|
|
2323
|
+
* />
|
|
2324
|
+
* ...
|
|
2325
|
+
* </section>
|
|
2326
|
+
* ```
|
|
2327
|
+
*/
|
|
2328
|
+
declare function SectionHeading({ title, description, actions, as: Tag, id, className }: SectionHeadingProps): react.JSX.Element;
|
|
2329
|
+
|
|
2330
|
+
interface PageHeaderProps {
|
|
2331
|
+
/** The page's name -- "Report Builder". Title Case for a feature name. */
|
|
2332
|
+
title: ReactNode;
|
|
2333
|
+
/** One line under the title saying what the user can do on this page. */
|
|
2334
|
+
description?: ReactNode;
|
|
2335
|
+
/** The page's main actions, right-aligned -- usually one primary Button. */
|
|
2336
|
+
actions?: ReactNode;
|
|
2337
|
+
className?: string;
|
|
2338
|
+
}
|
|
2339
|
+
/**
|
|
2340
|
+
* @pattern PageHeader
|
|
2341
|
+
* @description The top of a page: its title (the page's only h1), an optional
|
|
2342
|
+
* one-line description under it, and the page's main actions on the right.
|
|
2343
|
+
* Title 20px over a 14px description, 2px apart, so the two read as one unit;
|
|
2344
|
+
* the actions centre on the pair. Type steps down evenly from there: page
|
|
2345
|
+
* title 20, SectionHeading 16, body 14.
|
|
2346
|
+
* @props
|
|
2347
|
+
* title: ReactNode -- the page's name
|
|
2348
|
+
* description?: ReactNode -- one line, about 70 characters at most, on what the user can do here
|
|
2349
|
+
* actions?: ReactNode -- primary actions, right-aligned
|
|
2350
|
+
* @tokens text-xl, font-semibold, tracking-tight, text-text-primary, text-sm, text-text-secondary, max-w-2xl
|
|
2351
|
+
* @use at the top of every top-level page.
|
|
2352
|
+
* @use `description` to say what the page is for, in one sentence a first-time
|
|
2353
|
+
* user can act on ("Build your own tables from MediaRadar data...").
|
|
2354
|
+
* @avoid putting the description to the right of the title. It competes with
|
|
2355
|
+
* the actions and wraps unpredictably on narrow screens.
|
|
2356
|
+
* @avoid more than one primary action in `actions`.
|
|
2357
|
+
* @avoid a description on every page by habit. Use one only where a first-time
|
|
2358
|
+
* user would not know what the page is for; a pipe-separated subtitle beside
|
|
2359
|
+
* the title is the pattern this replaces.
|
|
2360
|
+
* @a11y Renders the page's h1. Use `SectionHeading` (h2) for the sections below it.
|
|
2361
|
+
* @usage
|
|
2362
|
+
* ```tsx
|
|
2363
|
+
* <PageHeader
|
|
2364
|
+
* title="Report Builder"
|
|
2365
|
+
* description="Build tables from MediaRadar data and export them whenever you need."
|
|
2366
|
+
* actions={<Button><Plus /> New report</Button>}
|
|
2367
|
+
* />
|
|
2368
|
+
* ```
|
|
2369
|
+
*/
|
|
2370
|
+
declare function PageHeader({ title, description, actions, className }: PageHeaderProps): react.JSX.Element;
|
|
2371
|
+
|
|
2372
|
+
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, 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 SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionHeading, type SectionHeadingProps, 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, Toast, type ToastProps, type ToastTone, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|