@mediaradar/design-components 0.20.0 → 0.22.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 +356 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +340 -20
- package/dist/index.d.ts +340 -20
- package/dist/index.js +358 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, RefObject, ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { ReactNode, RefObject, ButtonHTMLAttributes, MouseEventHandler, InputHTMLAttributes } from 'react';
|
|
3
3
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
@@ -25,6 +25,11 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
25
25
|
* portaled to the end of the page and appears only after a click, so it is
|
|
26
26
|
* aria-hidden rather than described-by.) Escape dismisses it. `label` names
|
|
27
27
|
* the button; the text describes it.
|
|
28
|
+
* @use to explain a metric, a column or a page in a sentence or two, behind
|
|
29
|
+
* the small info glyph.
|
|
30
|
+
* @use `trigger="hover"` when the explanation should also open on keyboard focus.
|
|
31
|
+
* @avoid putting anything needed to finish a task in it -- people miss it.
|
|
32
|
+
* @avoid more than two sentences; longer help belongs on the page.
|
|
28
33
|
* @usage
|
|
29
34
|
* ```tsx
|
|
30
35
|
* <InfoTip text="Trims time periods to data that has finalized across the selected media formats." />
|
|
@@ -315,6 +320,15 @@ declare function Delta({ value, suffix, arrow, period, className }: DeltaProps):
|
|
|
315
320
|
* the control, use CheckBoxBox inside your own <button role="checkbox">
|
|
316
321
|
* instead: a <button> inside a <button> is invalid markup, and a <div
|
|
317
322
|
* onClick> wrapper is not keyboard-reachable at all.
|
|
323
|
+
* @use for choosing any number of items from a list, and in filter panels
|
|
324
|
+
* where picks take effect on Apply.
|
|
325
|
+
* @use indeterminate only on a parent row whose children are partly selected.
|
|
326
|
+
* @avoid wrapping it in a clickable <div> or another <button> -- it is a
|
|
327
|
+
* button itself. When the whole row must be the control, use CheckBoxBox
|
|
328
|
+
* inside your own <button role="checkbox">.
|
|
329
|
+
* @avoid ticking and disabling a row that is already added; drop the box and
|
|
330
|
+
* say "Already added" instead.
|
|
331
|
+
* @avoid it for an on/off setting that takes effect at once -- that's Toggle.
|
|
318
332
|
* @usage
|
|
319
333
|
* ```tsx
|
|
320
334
|
* <CheckBox checked={selected} ariaLabel="Select row" onChange={toggle} />
|
|
@@ -381,6 +395,8 @@ declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disable
|
|
|
381
395
|
* ancestor owns role="checkbox", aria-checked, the accessible name and the
|
|
382
396
|
* click. Use it exactly when that ancestor is itself the control; use
|
|
383
397
|
* CheckBox when the box is the control.
|
|
398
|
+
* @use only inside a control that is already the button, to draw the box.
|
|
399
|
+
* @avoid it on its own as a checkbox -- it has no behavior; use CheckBox.
|
|
384
400
|
* @usage
|
|
385
401
|
* ```tsx
|
|
386
402
|
* <button type="button" role="checkbox" aria-checked={on} onClick={toggle}>
|
|
@@ -481,7 +497,11 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
481
497
|
* bordered control, mirroring the legacy Creative Intel search + match-type
|
|
482
498
|
* modal (Any Word/Exact Match/Contextual/Ad Code), including the Or/And
|
|
483
499
|
* sub-choice nested under Any Word.
|
|
484
|
-
*
|
|
500
|
+
* Three heights on the one control scale -- sm 32, md 40, lg 44 (default) --
|
|
501
|
+
* so it lines up with the Buttons and dropdowns beside it. A × clears the
|
|
502
|
+
* text once something is typed.
|
|
503
|
+
* @tokens text-dense, text-badge, focus-within:outline-border-focus, focus-within:outline-2,
|
|
504
|
+
* focus-within:outline-offset-1, rounded-control, border-border-strong, bg-input, text-text-primary,
|
|
485
505
|
* text-text-tertiary, hover:bg-subtle, bg-brand-primaryAction, bg-subtle,
|
|
486
506
|
* bg-surface, border-brand-primaryAction, border-border-default,
|
|
487
507
|
* border-border-interactive, focus-visible:outline-border-focus,
|
|
@@ -498,12 +518,18 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
498
518
|
* Or/And sub-choice under Any Word and its own click-to-toggle info tooltip.
|
|
499
519
|
* The text input carries an `aria-label` derived from `placeholder` — the
|
|
500
520
|
* wrapping `<label>` has no visible text content (just an icon and the
|
|
501
|
-
* input), so it grants the input no accessible name on its own.
|
|
521
|
+
* input), so it grants the input no accessible name on its own. The clear
|
|
522
|
+
* × shows only when there's text and `onChange` is given; it empties the
|
|
523
|
+
* field and puts focus back in it.
|
|
502
524
|
* @a11y The <input> takes its accessible name from `ariaLabel`. The match-mode
|
|
503
525
|
* popover is a radio group (role="radio" + aria-checked) and its trigger
|
|
504
526
|
* reports aria-expanded. Escape closes the popover only, leaving focus in
|
|
505
527
|
* the field -- a consumer nesting this inside another dismissible layer
|
|
506
528
|
* must sequence the two dismissals itself.
|
|
529
|
+
* @use for every search field: in a filter row (lg), a form (md), a toolbar or
|
|
530
|
+
* dropdown (sm).
|
|
531
|
+
* @use the size of the controls beside it.
|
|
532
|
+
* @avoid a hand-built search input or a borderless one -- one look everywhere.
|
|
507
533
|
* @usage
|
|
508
534
|
* ```tsx
|
|
509
535
|
* <SearchBar value={query} onChange={setQuery} />
|
|
@@ -511,6 +537,8 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
511
537
|
* ```
|
|
512
538
|
*/
|
|
513
539
|
type SearchBarVariant = "default" | "filterable";
|
|
540
|
+
/** sm 32 in toolbars and dropdowns, md 40 in forms, lg 44 in a filter row. */
|
|
541
|
+
type SearchBarSize = "sm" | "md" | "lg";
|
|
514
542
|
type SearchMatchMode = "anyWord" | "exactMatch" | "contextual" | "adCode";
|
|
515
543
|
interface SearchMatchValue {
|
|
516
544
|
mode: SearchMatchMode;
|
|
@@ -525,6 +553,8 @@ interface SearchBarProps {
|
|
|
525
553
|
onChange?: (v: string) => void;
|
|
526
554
|
/** 'default' is a plain keyword input; 'filterable' adds the match-type dropdown. */
|
|
527
555
|
variant?: SearchBarVariant;
|
|
556
|
+
/** sm 32 in toolbars and dropdowns, md 40 in forms, lg 44 (default) in a filter row -- match the controls beside it. */
|
|
557
|
+
size?: SearchBarSize;
|
|
528
558
|
/** The 'filterable' variant's dropdown state. */
|
|
529
559
|
matchValue?: SearchMatchValue;
|
|
530
560
|
onMatchChange?: (v: SearchMatchValue) => void;
|
|
@@ -541,7 +571,7 @@ interface SearchBarProps {
|
|
|
541
571
|
*/
|
|
542
572
|
testIdPrefix?: string;
|
|
543
573
|
}
|
|
544
|
-
declare function SearchBar({ placeholder, value, onChange, variant, matchValue, onMatchChange, className, testIdPrefix, }: SearchBarProps): react.JSX.Element;
|
|
574
|
+
declare function SearchBar({ placeholder, value, onChange, variant, size, matchValue, onMatchChange, className, testIdPrefix, }: SearchBarProps): react.JSX.Element;
|
|
545
575
|
|
|
546
576
|
/**
|
|
547
577
|
* @pattern SectionRail
|
|
@@ -656,6 +686,11 @@ declare function DataScopeFilter({ value, onChange, align }: DataScopeFilterProp
|
|
|
656
686
|
* the caption. The popover is not a focus trap and does not move focus on
|
|
657
687
|
* open, so keyboard users tab into it; a consumer rendering it inside
|
|
658
688
|
* another dismissible layer has to sequence the two dismissals itself.
|
|
689
|
+
* @use for picking one value from a short list in a filter row or a form --
|
|
690
|
+
* the caption-over-value chip is the one dropdown trigger.
|
|
691
|
+
* @use the caption everywhere except tight spots where the field is obvious.
|
|
692
|
+
* @avoid a native <select> or a hand-built dropdown.
|
|
693
|
+
* @avoid it for several values at once -- that's MultiSelectFilter.
|
|
659
694
|
* @usage
|
|
660
695
|
* ```tsx
|
|
661
696
|
* <SelectFilter caption="Rank" value={rankFilter} onChange={setRankFilter} options={['All', 'VP / Director', 'Manager', 'Coordinator']} />
|
|
@@ -717,6 +752,12 @@ declare function SelectFilter({ caption, value, options, onChange, align, fullWi
|
|
|
717
752
|
* shadow on hover signals it responds to the cursor.
|
|
718
753
|
* @variant static - Set `staticCard`. Non-clickable content -- no hover
|
|
719
754
|
* treatment.
|
|
755
|
+
* @use to group related content on a surface: a stat tile, a chart, a content panel.
|
|
756
|
+
* @use `staticCard` on any card that is only read; the hover lift means the
|
|
757
|
+
* whole card is a link.
|
|
758
|
+
* @avoid setting a width on the card -- the parent grid or row decides it.
|
|
759
|
+
* @avoid a hairline rule between sections of cards; use spacing.
|
|
760
|
+
* @avoid the gradient top edge except on a workflow card that starts a task.
|
|
720
761
|
* @usage
|
|
721
762
|
* ```tsx
|
|
722
763
|
* <Card>
|
|
@@ -1384,7 +1425,7 @@ interface SelectionPickerProps<T extends PickerRow> {
|
|
|
1384
1425
|
* filtered client-side (the default), or externally-computed `results` for a
|
|
1385
1426
|
* caller whose search is server-side/async, with `loading`/`error`/
|
|
1386
1427
|
* `hasMore`/`onLoadMore` covering that mode's states.
|
|
1387
|
-
* @tokens border-border-strong, rounded-control, rounded-card, border-border-default, bg-input,
|
|
1428
|
+
* @tokens border-border-strong, rounded-control, rounded-card, border-border-default, bg-input, focus-within:outline-border-focus,
|
|
1388
1429
|
* bg-canvas, bg-surface, shadow-raised, shadow-overlay, text-text-primary,
|
|
1389
1430
|
* text-text-secondary, text-text-tertiary, text-text-link,
|
|
1390
1431
|
* text-brand-primaryAction, border-brand-primaryAction, bg-brand-primaryAction,
|
|
@@ -1506,7 +1547,7 @@ declare function PublisherBreakdownList({ rows, defaultVisibleCount, padded, vie
|
|
|
1506
1547
|
|
|
1507
1548
|
declare const buttonVariants: (props?: ({
|
|
1508
1549
|
variant?: "link" | "danger" | "primary" | "secondary" | "ghost" | "dangerGhost" | null | undefined;
|
|
1509
|
-
size?: "
|
|
1550
|
+
size?: "sm" | "md" | "lg" | "xs" | null | undefined;
|
|
1510
1551
|
iconOnly?: boolean | null | undefined;
|
|
1511
1552
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1512
1553
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -1532,8 +1573,9 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
|
|
|
1532
1573
|
* @pattern Button
|
|
1533
1574
|
* @description The one control for every clickable action, from the main call
|
|
1534
1575
|
* to action on a screen down to a quiet toolbar utility. Six variants
|
|
1535
|
-
* (primary, secondary, ghost, danger, dangerGhost, link) across
|
|
1536
|
-
* (xs, sm, md), labelled or icon-only.
|
|
1576
|
+
* (primary, secondary, ghost, danger, dangerGhost, link) across four sizes
|
|
1577
|
+
* (xs 24, sm 32, md 40, lg 44), labelled or icon-only. sm, md and lg are the
|
|
1578
|
+
* one control scale TextField, SearchBar and the filter dropdowns share.
|
|
1537
1579
|
* Supports polymorphic rendering via `asChild` (Radix Slot) to apply button
|
|
1538
1580
|
* styling to a different element, e.g. a router `<Link>`. Also exports the
|
|
1539
1581
|
* raw `buttonVariants` cva function for consumers composing button styling
|
|
@@ -1654,7 +1696,7 @@ interface NameListModalProps {
|
|
|
1654
1696
|
* checkboxes under it. Shared by the Account Lists table and the list detail
|
|
1655
1697
|
* page so create/rename look identical; `fieldLabel`/`placeholder` relabel it
|
|
1656
1698
|
* for dialogs that name something other than a list.
|
|
1657
|
-
* @tokens border-border-strong, bg-scrim, rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, rounded-control, bg-input, focus:border-
|
|
1699
|
+
* @tokens border-border-strong, bg-scrim, rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, rounded-control, bg-input, focus-visible:outline-border-focus, text-dense, z-modal
|
|
1658
1700
|
* @behavior Escape closes the dialog via `onCancel`, same as clicking the
|
|
1659
1701
|
* scrim backdrop. Submit is disabled until the name is non-empty (trimmed).
|
|
1660
1702
|
* When `options` are given they render as CheckBox rows below the field, and
|
|
@@ -1840,12 +1882,19 @@ interface PagerProps {
|
|
|
1840
1882
|
page: number;
|
|
1841
1883
|
totalPages: number;
|
|
1842
1884
|
onPage: (p: number) => void;
|
|
1885
|
+
/** Disables every control, e.g. while the list loads the next page. */
|
|
1886
|
+
disabled?: boolean;
|
|
1843
1887
|
}
|
|
1844
1888
|
/**
|
|
1845
1889
|
* @pattern Pager
|
|
1846
1890
|
* @description Compact prev/next pager with a windowed page-number list —
|
|
1847
1891
|
* shows every page up to 7 total, otherwise 1 … current±1 … last with
|
|
1848
|
-
* ellipsis gaps. Shared by My Exports and Account Matcher.
|
|
1892
|
+
* ellipsis gaps. Shared by My Exports and Account Matcher. `disabled`
|
|
1893
|
+
* disables every control while the list loads.
|
|
1894
|
+
* @use in a card or a compact list, with the range ("Showing 1–10 of 48") on
|
|
1895
|
+
* the left if the reader needs it.
|
|
1896
|
+
* @avoid under a full-page table -- use TablePagination, which adds the
|
|
1897
|
+
* first/last steps, the range readout and the rows-per-page select.
|
|
1849
1898
|
* @tokens rounded-control, text-text-secondary, bg-brand-primaryAction, text-brand-onprimary, hover:bg-subtle, hover:text-text-primary, text-text-tertiary
|
|
1850
1899
|
* @dependencies lucide-react
|
|
1851
1900
|
* @a11y Page controls are buttons with their own aria-labels, and the current
|
|
@@ -1856,7 +1905,7 @@ interface PagerProps {
|
|
|
1856
1905
|
* <Pager page={page} totalPages={totalPages} onPage={setPage} />
|
|
1857
1906
|
* ```
|
|
1858
1907
|
*/
|
|
1859
|
-
declare function Pager({ page, totalPages, onPage }: PagerProps): react.JSX.Element;
|
|
1908
|
+
declare function Pager({ page, totalPages, onPage, disabled }: PagerProps): react.JSX.Element;
|
|
1860
1909
|
|
|
1861
1910
|
declare const SIZES$1: {
|
|
1862
1911
|
/** Matches a 15px lucide icon exactly, so a workspace name in a menu row
|
|
@@ -2016,14 +2065,22 @@ declare function Tag({ children, className }: TagProps): react.JSX.Element;
|
|
|
2016
2065
|
* @description Full table-footer pagination bar: a rows-per-page select, a
|
|
2017
2066
|
* first/prev/pages/next/last pager, and the resolved "1 – 25 of N results"
|
|
2018
2067
|
* range. Owns no state — the host page holds `page` and `perPage` so the
|
|
2019
|
-
* paged slice and the bar can't disagree.
|
|
2068
|
+
* paged slice and the bar can't disagree. Without `onPerPageChange` the
|
|
2069
|
+
* select is left out, and the range moves to the left of the pager.
|
|
2070
|
+
* @use under a full-page table: the results of a search or a list the user
|
|
2071
|
+
* works through, where the total and the page size matter.
|
|
2072
|
+
* @avoid in a card or a compact list -- use Pager, which is only the page
|
|
2073
|
+
* controls and fits the narrower space.
|
|
2020
2074
|
* @tokens border-border-strong, rounded-control, bg-input, text-text-primary, text-text-secondary, text-text-tertiary, bg-brand-primaryAction, text-brand-onprimary, hover:bg-subtle, hover:text-text-primary, focus:outline-border-focus
|
|
2021
2075
|
* @behavior The current page is filled with the brand action color (matching
|
|
2022
2076
|
* the Contacts pager). First/prev disable on page 1, next/last on the last
|
|
2023
2077
|
* page — disabled controls stay in the layout so the row never reflows.
|
|
2024
2078
|
* Changing the per-page count reports it and leaves the host to reset to page
|
|
2025
2079
|
* 1. With one page of results the pager still renders, so the bar's height
|
|
2026
|
-
* and the range readout don't come and go as filters narrow.
|
|
2080
|
+
* and the range readout don't come and go as filters narrow. `disabled`
|
|
2081
|
+
* disables every control (select and page buttons) while the table loads,
|
|
2082
|
+
* so a click can't request a second page on top of the first; the range
|
|
2083
|
+
* readout stays.
|
|
2027
2084
|
* @a11y A <nav aria-label="Pagination"> wrapping <button> controls, each with
|
|
2028
2085
|
* its own aria-label (Previous/Next/Last). The chevron icons are aria-
|
|
2029
2086
|
* hidden, so the labels are the only accessible names -- don't override
|
|
@@ -2040,14 +2097,17 @@ declare function Tag({ children, className }: TagProps): react.JSX.Element;
|
|
|
2040
2097
|
* />
|
|
2041
2098
|
* ```
|
|
2042
2099
|
*/
|
|
2043
|
-
declare function TablePagination({ page, perPage, totalItems, onPageChange, onPerPageChange, perPageOptions, itemLabel, className, testIdPrefix, }: {
|
|
2100
|
+
declare function TablePagination({ page, perPage, totalItems, onPageChange, onPerPageChange, perPageOptions, itemLabel, disabled, className, testIdPrefix, }: {
|
|
2044
2101
|
page: number;
|
|
2045
2102
|
perPage: number;
|
|
2046
2103
|
totalItems: number;
|
|
2047
2104
|
onPageChange: (page: number) => void;
|
|
2048
|
-
|
|
2105
|
+
/** Omit to hide the rows-per-page select, for a table with a fixed page size. */
|
|
2106
|
+
onPerPageChange?: (perPage: number) => void;
|
|
2049
2107
|
perPageOptions?: number[];
|
|
2050
2108
|
itemLabel?: string;
|
|
2109
|
+
/** Disables every control, e.g. while the table loads the next page. */
|
|
2110
|
+
disabled?: boolean;
|
|
2051
2111
|
className?: string;
|
|
2052
2112
|
/**
|
|
2053
2113
|
* Optional prefix for `data-testid` attributes on the bar (`testIdPrefix`
|
|
@@ -2103,7 +2163,7 @@ interface MultiSelectGroup {
|
|
|
2103
2163
|
* button shape (two-line caption + value with a chevron) and opens a
|
|
2104
2164
|
* searchable checkbox popover. Used for the page-level Media Type /
|
|
2105
2165
|
* Advertiser filters that share state with the filter tray.
|
|
2106
|
-
* @tokens border-border-strong, rounded-control, rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary, text-text-link, border-border-interactive, bg-brand-primaryAction, bg-input, hover:bg-subtle, hover:text-text-primary, placeholder:text-text-tertiary, text-brand-onprimary
|
|
2166
|
+
* @tokens border-border-strong, rounded-control, rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary, text-text-link, border-border-interactive, bg-brand-primaryAction, bg-input, hover:bg-subtle, hover:text-text-primary, placeholder:text-text-tertiary, text-brand-onprimary, focus-within:outline-border-focus
|
|
2107
2167
|
* @dependencies lucide-react
|
|
2108
2168
|
* @behavior `variant` picks the trigger's chip stroke: `box` (default, the
|
|
2109
2169
|
* boxed two-line chip on the default border) or `inline` (same fill,
|
|
@@ -2334,6 +2394,16 @@ interface PageHeaderProps {
|
|
|
2334
2394
|
description?: ReactNode;
|
|
2335
2395
|
/** The page's main actions, right-aligned -- usually one primary Button. */
|
|
2336
2396
|
actions?: ReactNode;
|
|
2397
|
+
/**
|
|
2398
|
+
* The way back up, above the title: an arrow and the parent section's name,
|
|
2399
|
+
* "Competitive intel". Give `href`; add `onClick` to route client-side
|
|
2400
|
+
* (call `preventDefault()` and navigate).
|
|
2401
|
+
*/
|
|
2402
|
+
back?: {
|
|
2403
|
+
label: ReactNode;
|
|
2404
|
+
href?: string;
|
|
2405
|
+
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
2406
|
+
};
|
|
2337
2407
|
className?: string;
|
|
2338
2408
|
}
|
|
2339
2409
|
/**
|
|
@@ -2347,8 +2417,11 @@ interface PageHeaderProps {
|
|
|
2347
2417
|
* title: ReactNode -- the page's name
|
|
2348
2418
|
* description?: ReactNode -- one line, about 70 characters at most, on what the user can do here
|
|
2349
2419
|
* actions?: ReactNode -- primary actions, right-aligned
|
|
2350
|
-
* @tokens text-
|
|
2420
|
+
* @tokens text-micro, uppercase, tracking-wider, text-text-tertiary,
|
|
2421
|
+
* hover:text-text-primary, focus-visible:outline-border-focus, rounded-control, text-xl, font-semibold, tracking-tight, text-text-primary, text-sm, text-text-secondary, max-w-2xl
|
|
2351
2422
|
* @use at the top of every top-level page.
|
|
2423
|
+
* @use `back` on any page one level below a section, naming the section the
|
|
2424
|
+
* arrow goes back to. This is the breadcrumb: no full path.
|
|
2352
2425
|
* @use `description` to say what the page is for, in one sentence a first-time
|
|
2353
2426
|
* user can act on ("Build your own tables from MediaRadar data...").
|
|
2354
2427
|
* @avoid putting the description to the right of the title. It competes with
|
|
@@ -2357,7 +2430,9 @@ interface PageHeaderProps {
|
|
|
2357
2430
|
* @avoid a description on every page by habit. Use one only where a first-time
|
|
2358
2431
|
* user would not know what the page is for; a pipe-separated subtitle beside
|
|
2359
2432
|
* the title is the pattern this replaces.
|
|
2360
|
-
* @
|
|
2433
|
+
* @dependencies lucide-react
|
|
2434
|
+
* @a11y Renders the page's h1. `back` is a real link, read as its label
|
|
2435
|
+
* ("Competitive intel"); the arrow is hidden from screen readers. Use `SectionHeading` (h2) for the sections below it.
|
|
2361
2436
|
* @usage
|
|
2362
2437
|
* ```tsx
|
|
2363
2438
|
* <PageHeader
|
|
@@ -2367,6 +2442,251 @@ interface PageHeaderProps {
|
|
|
2367
2442
|
* />
|
|
2368
2443
|
* ```
|
|
2369
2444
|
*/
|
|
2370
|
-
declare function PageHeader({ title, description, actions, className }: PageHeaderProps): react.JSX.Element;
|
|
2445
|
+
declare function PageHeader({ title, description, actions, back, className }: PageHeaderProps): react.JSX.Element;
|
|
2446
|
+
|
|
2447
|
+
type ModalSize = "sm" | "md" | "lg";
|
|
2448
|
+
interface ModalProps {
|
|
2449
|
+
/** Whether the dialog is showing. */
|
|
2450
|
+
open: boolean;
|
|
2451
|
+
/** Called on Escape, a click on the dimmed background, or the close button. */
|
|
2452
|
+
onClose: () => void;
|
|
2453
|
+
/** The dialog's title -- a short Title Case name, "Export options". */
|
|
2454
|
+
title: ReactNode;
|
|
2455
|
+
/** One line under the title, when the title alone doesn't say enough. */
|
|
2456
|
+
description?: ReactNode;
|
|
2457
|
+
/** sm 440 for a confirm, md 640 for a form, lg 880 for a table or a list. */
|
|
2458
|
+
size?: ModalSize;
|
|
2459
|
+
/** The buttons along the bottom, right-aligned -- primary last. */
|
|
2460
|
+
footer?: ReactNode;
|
|
2461
|
+
children?: ReactNode;
|
|
2462
|
+
className?: string;
|
|
2463
|
+
}
|
|
2464
|
+
/**
|
|
2465
|
+
* @pattern Modal
|
|
2466
|
+
* @description A dialog over a dimmed page: title, optional one-line
|
|
2467
|
+
* description, content, and a footer of buttons. Three widths -- sm 440 for a
|
|
2468
|
+
* confirm, md 640 for a form, lg 880 for a table or a list -- over the warm
|
|
2469
|
+
* scrim, which flips with dark mode.
|
|
2470
|
+
* @variant sm - 440px. A confirm: one question, two buttons.
|
|
2471
|
+
* @variant md - 640px. Default. A form.
|
|
2472
|
+
* @variant lg - 880px. A table, a long list, a preview.
|
|
2473
|
+
* @tokens bg-scrim, z-modal, rounded-card, border-border-default, bg-surface,
|
|
2474
|
+
* shadow-overlay, text-base, font-semibold, text-text-primary, text-sm,
|
|
2475
|
+
* text-text-secondary, text-text-tertiary, hover:bg-subtle,
|
|
2476
|
+
* hover:text-text-primary, rounded-control, border-t,
|
|
2477
|
+
* focus-visible:outline-border-focus
|
|
2478
|
+
* @dependencies lucide-react, react-dom
|
|
2479
|
+
* @behavior Portals to <body>. Escape, a click on the background and the ×
|
|
2480
|
+
* all call `onClose`. Focus moves to the first field (else the first footer
|
|
2481
|
+
* button) on open, Tab stays inside
|
|
2482
|
+
* it, and focus goes back to whatever opened it on close. The page behind
|
|
2483
|
+
* stops scrolling while it's open.
|
|
2484
|
+
* @a11y role="dialog" with aria-modal, named by its title and described by
|
|
2485
|
+
* `description`. The close button is labelled "Close".
|
|
2486
|
+
* @use for a task the user has to finish or cancel before going back to the
|
|
2487
|
+
* page: confirm a delete, name a list, pick export options.
|
|
2488
|
+
* @use `sm` for confirms, `md` for forms, `lg` for tables -- pick by content,
|
|
2489
|
+
* never a custom width.
|
|
2490
|
+
* @use one primary Button, last in `footer`, with a secondary "Cancel" before it.
|
|
2491
|
+
* @avoid a modal for a message that needs no answer -- use Toast.
|
|
2492
|
+
* @avoid a modal opened from another modal.
|
|
2493
|
+
* @avoid a `className` width override; if none of the three fit, raise it as
|
|
2494
|
+
* a design question.
|
|
2495
|
+
* @usage
|
|
2496
|
+
* ```tsx
|
|
2497
|
+
* <Modal
|
|
2498
|
+
* open={open}
|
|
2499
|
+
* onClose={() => setOpen(false)}
|
|
2500
|
+
* size="sm"
|
|
2501
|
+
* title="Delete this list?"
|
|
2502
|
+
* description="The 12 accounts in it stay in your workspace."
|
|
2503
|
+
* footer={<><Button variant="secondary" onClick={close}>Cancel</Button><Button variant="danger">Delete</Button></>}
|
|
2504
|
+
* />
|
|
2505
|
+
* ```
|
|
2506
|
+
*/
|
|
2507
|
+
declare function Modal({ open, onClose, title, description, size, footer, children, className }: ModalProps): react.ReactPortal | null;
|
|
2508
|
+
|
|
2509
|
+
type EmptyStateSize = "sm" | "md";
|
|
2510
|
+
interface EmptyStateProps {
|
|
2511
|
+
/** A lucide icon, about 20px -- `<SearchX size={20} />`. Optional but expected. */
|
|
2512
|
+
icon?: ReactNode;
|
|
2513
|
+
/** What's empty, in plain words -- "No brands match". */
|
|
2514
|
+
title: ReactNode;
|
|
2515
|
+
/** One line on what to do next -- "Try a shorter search or clear a filter." */
|
|
2516
|
+
description?: ReactNode;
|
|
2517
|
+
/** One way out -- a Button, usually `variant="secondary"` or `"link"`. */
|
|
2518
|
+
action?: ReactNode;
|
|
2519
|
+
/** sm inside a table, a card or a dropdown; md when it fills a page or a panel. */
|
|
2520
|
+
size?: EmptyStateSize;
|
|
2521
|
+
className?: string;
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* @pattern EmptyState
|
|
2525
|
+
* @description What shows where content would be: an icon, a title saying
|
|
2526
|
+
* what's empty, one line on what to do next, and one action. Two sizes -- sm
|
|
2527
|
+
* inside a table, card or dropdown; md when it fills a page or a panel.
|
|
2528
|
+
* @variant sm - Default. Inside a table, a card or a dropdown.
|
|
2529
|
+
* @variant md - Fills a page or a large panel.
|
|
2530
|
+
* @tokens text-text-tertiary, text-text-primary, text-text-secondary,
|
|
2531
|
+
* font-semibold, text-sm, text-base, text-xs, bg-subtle, rounded-full
|
|
2532
|
+
* @use whenever a list, table, search or chart has nothing to show.
|
|
2533
|
+
* @use a title that names what's missing ("No brands match"), and a line that
|
|
2534
|
+
* says how to get some ("Try a shorter search or clear a filter.").
|
|
2535
|
+
* @use one action at most, the one that most likely fixes it.
|
|
2536
|
+
* @avoid "No data" or "Nothing here" -- say what's missing.
|
|
2537
|
+
* @avoid an error message in an empty state; a failed load is an error, not
|
|
2538
|
+
* an empty result.
|
|
2539
|
+
* @usage
|
|
2540
|
+
* ```tsx
|
|
2541
|
+
* <EmptyState
|
|
2542
|
+
* icon={<SearchX size={20} />}
|
|
2543
|
+
* title="No brands match"
|
|
2544
|
+
* description="Try a shorter search or clear a filter."
|
|
2545
|
+
* action={<Button variant="secondary" size="sm" onClick={clear}>Clear filters</Button>}
|
|
2546
|
+
* />
|
|
2547
|
+
* ```
|
|
2548
|
+
*/
|
|
2549
|
+
declare function EmptyState({ icon, title, description, action, size, className }: EmptyStateProps): react.JSX.Element;
|
|
2550
|
+
|
|
2551
|
+
interface TabItem<T extends string = string> {
|
|
2552
|
+
value: T;
|
|
2553
|
+
label: ReactNode;
|
|
2554
|
+
/** A count after the label -- "Contacts 12". */
|
|
2555
|
+
count?: number;
|
|
2556
|
+
disabled?: boolean;
|
|
2557
|
+
}
|
|
2558
|
+
interface TabsProps<T extends string = string> {
|
|
2559
|
+
items: TabItem<T>[];
|
|
2560
|
+
value: T;
|
|
2561
|
+
onChange: (value: T) => void;
|
|
2562
|
+
/** Names the tab list for screen readers -- "Advertiser sections". */
|
|
2563
|
+
"aria-label": string;
|
|
2564
|
+
/**
|
|
2565
|
+
* Prefix for each tab's id and its panel's id. Tab `x` gets
|
|
2566
|
+
* `${idPrefix}-tab-x` and points at `${idPrefix}-panel-x` -- give the panel
|
|
2567
|
+
* that id, role="tabpanel" and aria-labelledby the tab's id.
|
|
2568
|
+
*/
|
|
2569
|
+
idPrefix?: string;
|
|
2570
|
+
className?: string;
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* @pattern Tabs
|
|
2574
|
+
* @description Underline tabs that switch between the sections of one page --
|
|
2575
|
+
* Overview, Creative, Contacts. The selected tab is semibold with a brand
|
|
2576
|
+
* underline; the row sits on a hairline. For switching how the same data is
|
|
2577
|
+
* shown (Spend / Share, Chart / Table), use SegmentedControl instead.
|
|
2578
|
+
* @tokens border-b, border-border-default, text-sm, text-text-secondary,
|
|
2579
|
+
* hover:text-text-primary, font-semibold, text-text-primary,
|
|
2580
|
+
* border-brand-primaryAction, text-text-tertiary, text-xs,
|
|
2581
|
+
* focus-visible:outline-border-focus, rounded-control
|
|
2582
|
+
* @behavior Controlled: `value` and `onChange`. The arrow keys, Home and End
|
|
2583
|
+
* move between tabs and select as they go; only the selected tab is in the
|
|
2584
|
+
* Tab order.
|
|
2585
|
+
* @a11y role="tablist" with an aria-label, each tab role="tab" with
|
|
2586
|
+
* aria-selected and aria-controls. Give each panel role="tabpanel" and the
|
|
2587
|
+
* ids from `idPrefix`.
|
|
2588
|
+
* @use to switch between sections of one page that hold different content.
|
|
2589
|
+
* @use short nouns for labels, 2 to 6 tabs.
|
|
2590
|
+
* @avoid tabs to switch views of the same data -- that's SegmentedControl.
|
|
2591
|
+
* @avoid tabs as page navigation; going to a different page is a link.
|
|
2592
|
+
* @usage
|
|
2593
|
+
* ```tsx
|
|
2594
|
+
* <Tabs
|
|
2595
|
+
* aria-label="Advertiser sections"
|
|
2596
|
+
* items={[{ value: "overview", label: "Overview" }, { value: "contacts", label: "Contacts", count: 12 }]}
|
|
2597
|
+
* value={tab}
|
|
2598
|
+
* onChange={setTab}
|
|
2599
|
+
* />
|
|
2600
|
+
* ```
|
|
2601
|
+
*/
|
|
2602
|
+
declare function Tabs<T extends string>({ items, value, onChange, idPrefix, className, ...rest }: TabsProps<T>): react.JSX.Element;
|
|
2603
|
+
type SegmentedControlSize = "sm" | "md";
|
|
2604
|
+
interface SegmentedOption<T extends string = string> {
|
|
2605
|
+
value: T;
|
|
2606
|
+
label: ReactNode;
|
|
2607
|
+
}
|
|
2608
|
+
interface SegmentedControlProps<T extends string = string> {
|
|
2609
|
+
options: SegmentedOption<T>[];
|
|
2610
|
+
value: T;
|
|
2611
|
+
onChange: (value: T) => void;
|
|
2612
|
+
/** Names the choice for screen readers -- "Show as". */
|
|
2613
|
+
"aria-label": string;
|
|
2614
|
+
/** sm 32 in toolbars and card headers; md 40 beside md controls. */
|
|
2615
|
+
size?: SegmentedControlSize;
|
|
2616
|
+
className?: string;
|
|
2617
|
+
}
|
|
2618
|
+
/**
|
|
2619
|
+
* @pattern SegmentedControl
|
|
2620
|
+
* @description A pill of 2 to 4 options that switches how the same data is
|
|
2621
|
+
* shown -- Spend / Share, Chart / Table, Weekly / Monthly. The selected option
|
|
2622
|
+
* is a raised white pill. Heights match the control scale: sm 32, md 40. For
|
|
2623
|
+
* switching between sections with different content, use Tabs instead.
|
|
2624
|
+
* @variant sm - 32px. Default. Toolbars and card headers.
|
|
2625
|
+
* @variant md - 40px. Next to md controls in a filter row.
|
|
2626
|
+
* @tokens rounded-full, bg-subtle, text-xs, text-sm, text-text-secondary,
|
|
2627
|
+
* hover:text-text-primary, bg-surface, font-semibold, text-text-primary,
|
|
2628
|
+
* shadow-raised, focus-visible:outline-border-focus
|
|
2629
|
+
* @behavior Controlled: `value` and `onChange`. The arrow keys, Home and End
|
|
2630
|
+
* move and select; only the selected option is in the Tab order.
|
|
2631
|
+
* @a11y role="radiogroup" with an aria-label; each option is role="radio"
|
|
2632
|
+
* with aria-checked.
|
|
2633
|
+
* @use to switch views of the same data: a measure, a chart type, a period.
|
|
2634
|
+
* @use 2 to 4 short options.
|
|
2635
|
+
* @avoid it for sections of a page with different content -- that's Tabs.
|
|
2636
|
+
* @avoid it for a filter that narrows the data -- that's a filter dropdown or chip.
|
|
2637
|
+
* @usage
|
|
2638
|
+
* ```tsx
|
|
2639
|
+
* <SegmentedControl
|
|
2640
|
+
* aria-label="Show as"
|
|
2641
|
+
* options={[{ value: "spend", label: "Spend" }, { value: "share", label: "Share" }]}
|
|
2642
|
+
* value={measure}
|
|
2643
|
+
* onChange={setMeasure}
|
|
2644
|
+
* />
|
|
2645
|
+
* ```
|
|
2646
|
+
*/
|
|
2647
|
+
declare function SegmentedControl<T extends string>({ options, value, onChange, size, className, ...rest }: SegmentedControlProps<T>): react.JSX.Element;
|
|
2648
|
+
|
|
2649
|
+
type TextFieldSize = "sm" | "md" | "lg";
|
|
2650
|
+
interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
2651
|
+
/** The visible label above the field. Leave it out only when something else on screen names the field, and pass `aria-label`. */
|
|
2652
|
+
label?: ReactNode;
|
|
2653
|
+
/** One line under the field -- a format, a limit. Replaced by `error` when there is one. */
|
|
2654
|
+
hint?: ReactNode;
|
|
2655
|
+
/** What's wrong, in a sentence. Turns the border red and is announced with the field. */
|
|
2656
|
+
error?: ReactNode;
|
|
2657
|
+
/** sm 32 in toolbars and dropdowns, md 40 in forms, lg 44 in a filter row. */
|
|
2658
|
+
size?: TextFieldSize;
|
|
2659
|
+
/** An icon inside the field on the left, about 15px. */
|
|
2660
|
+
icon?: ReactNode;
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* @pattern TextField
|
|
2664
|
+
* @description A single-line text input with an optional label, hint and
|
|
2665
|
+
* error. Same heights as Button -- sm 32, md 40, lg 44 -- so a field and a
|
|
2666
|
+
* button side by side line up. 13px text, the strong border every control you
|
|
2667
|
+
* type into uses, and the blue focus ring.
|
|
2668
|
+
* @variant sm - 32px. Toolbars, dropdown panels, table cells.
|
|
2669
|
+
* @variant md - 40px. Default. Forms and modals.
|
|
2670
|
+
* @variant lg - 44px. A filter row, next to the filter dropdowns.
|
|
2671
|
+
* @tokens text-xs, font-medium, text-text-secondary, rounded-control, border,
|
|
2672
|
+
* border-border-strong, bg-input, text-dense, text-text-primary,
|
|
2673
|
+
* placeholder:text-text-tertiary, text-text-tertiary, border-status-danger,
|
|
2674
|
+
* text-text-danger, focus-within:outline-2, focus-within:outline-offset-1,
|
|
2675
|
+
* focus-within:outline-border-focus, opacity-50
|
|
2676
|
+
* @behavior Every native input prop passes through to the <input>; the ref
|
|
2677
|
+
* points at it too.
|
|
2678
|
+
* @a11y The label is a real <label> tied to the input. `hint` and `error` are
|
|
2679
|
+
* linked with aria-describedby, and `error` sets aria-invalid.
|
|
2680
|
+
* @use for any free-text entry: a name, an email, a number.
|
|
2681
|
+
* @use the size of the Button next to it.
|
|
2682
|
+
* @avoid it for search -- SearchBar has the icon and the clear ×.
|
|
2683
|
+
* @avoid a placeholder as the only label; it disappears on typing.
|
|
2684
|
+
* @usage
|
|
2685
|
+
* ```tsx
|
|
2686
|
+
* <TextField label="List name" value={name} onChange={(e) => setName(e.target.value)} />
|
|
2687
|
+
* <TextField size="sm" aria-label="Rows per page" />
|
|
2688
|
+
* ```
|
|
2689
|
+
*/
|
|
2690
|
+
declare const TextField: react.ForwardRefExoticComponent<TextFieldProps & react.RefAttributes<HTMLInputElement>>;
|
|
2371
2691
|
|
|
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 };
|
|
2692
|
+
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, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, 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, 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, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|