@mediaradar/design-components 0.8.1 → 0.10.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 +108 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +135 -20
- package/dist/index.d.ts +135 -20
- package/dist/index.js +107 -42
- package/dist/index.js.map +1 -1
- package/package.json +63 -63
package/dist/index.d.cts
CHANGED
|
@@ -145,7 +145,8 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
145
145
|
* `<input type="checkbox">`), so it can carry an indeterminate "some but not
|
|
146
146
|
* all" state without the native element's limited styling hooks. Designed to
|
|
147
147
|
* be dropped into a row that already has its own click-to-toggle handler
|
|
148
|
-
* (a common list/table pattern) without double-firing.
|
|
148
|
+
* (a common list/table pattern) without double-firing. Where the row itself
|
|
149
|
+
* is the control, use `CheckBoxBox` instead.
|
|
149
150
|
* @tokens bg-brand-primaryAction, border-border-interactive, bg-input,
|
|
150
151
|
* hover:border-brand-primaryAction, focus-visible:outline-border-focus
|
|
151
152
|
* @dependencies lucide-react
|
|
@@ -155,8 +156,9 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
155
156
|
* unchecked state previews the brand action color on hover, matching the
|
|
156
157
|
* color the box fills with once checked -- the hover state is a preview of
|
|
157
158
|
* the click's effect, not an unrelated highlight. `onClick` calls
|
|
158
|
-
* `stopPropagation` before firing `onChange
|
|
159
|
-
* that toggles on its own click can't fire the toggle twice
|
|
159
|
+
* `stopPropagation` before firing `onChange` by default, so nesting this
|
|
160
|
+
* inside a row that toggles on its own click can't fire the toggle twice;
|
|
161
|
+
* pass `stopPropagation={false}` where the row should also see the click.
|
|
160
162
|
* @usage
|
|
161
163
|
* ```tsx
|
|
162
164
|
* <CheckBox checked={selected} ariaLabel="Select row" onChange={toggle} />
|
|
@@ -174,14 +176,22 @@ interface CheckBoxProps {
|
|
|
174
176
|
*/
|
|
175
177
|
indeterminate?: boolean;
|
|
176
178
|
/**
|
|
177
|
-
* Called on click with no argument -- flip `checked` yourself.
|
|
178
|
-
* doesn't bubble, so a row that toggles on its own click won't
|
|
179
|
+
* Called on click with no argument -- flip `checked` yourself. By default
|
|
180
|
+
* the click doesn't bubble, so a row that toggles on its own click won't
|
|
181
|
+
* fire twice.
|
|
179
182
|
*/
|
|
180
183
|
onChange: () => void;
|
|
181
184
|
/** Accessible label -- required since the control carries no visible text of its own. */
|
|
182
185
|
ariaLabel: string;
|
|
183
186
|
/** Blocks clicks, dims the box to 50% opacity, and cancels its hover preview. */
|
|
184
187
|
disabled?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Whether the click stops bubbling to an ancestor. Defaults to `true`,
|
|
190
|
+
* which is what a row that toggles on its own click needs. Set `false`
|
|
191
|
+
* when the ancestor should also see the click -- e.g. a row that both
|
|
192
|
+
* selects and opens a detail panel.
|
|
193
|
+
*/
|
|
194
|
+
stopPropagation?: boolean;
|
|
185
195
|
/** Forwarded as `data-testid`, for Playwright/test selectors. */
|
|
186
196
|
testId?: string;
|
|
187
197
|
/**
|
|
@@ -190,8 +200,46 @@ interface CheckBoxProps {
|
|
|
190
200
|
* be on any other disabled control.
|
|
191
201
|
*/
|
|
192
202
|
title?: string;
|
|
203
|
+
/** Extra classes merged onto the box -- e.g. a cursor or margin override. */
|
|
204
|
+
className?: string;
|
|
205
|
+
}
|
|
206
|
+
declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation, testId, title, className, }: CheckBoxProps): react.JSX.Element;
|
|
207
|
+
/**
|
|
208
|
+
* @pattern CheckBoxBox
|
|
209
|
+
* @description Presentational checkbox -- draws the same box as `CheckBox`
|
|
210
|
+
* and nothing else. Use it when an ancestor already carries the interaction
|
|
211
|
+
* and the checkbox semantics (a clickable option row, a `<label>`), since a
|
|
212
|
+
* `<button>` inside a `<button>` is invalid markup and a second focus stop on
|
|
213
|
+
* the same control is worse for keyboard users, not better. The owning
|
|
214
|
+
* element supplies `role="checkbox"` and `aria-checked`; this is
|
|
215
|
+
* `aria-hidden` so the state isn't announced twice.
|
|
216
|
+
* @tokens bg-brand-primaryAction, border-border-interactive, bg-input
|
|
217
|
+
* @dependencies lucide-react
|
|
218
|
+
* @behavior Renders through the same `boxClass` as `CheckBox`, so geometry
|
|
219
|
+
* and fill can't drift. Takes neither the focus ring nor the hover border,
|
|
220
|
+
* because the row around it owns both. Without this, a row that is itself
|
|
221
|
+
* the control has no correct option: nesting the interactive `CheckBox`
|
|
222
|
+
* produces a button inside a button, and dropping to a `<div>` with a click
|
|
223
|
+
* handler loses keyboard access entirely.
|
|
224
|
+
* @usage
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <button type="button" role="checkbox" aria-checked={on} onClick={toggle}>
|
|
227
|
+
* <CheckBoxBox checked={on} />
|
|
228
|
+
* <span>Cable TV</span>
|
|
229
|
+
* </button>
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
interface CheckBoxBoxProps {
|
|
233
|
+
/** Whether the box is checked. The owning element reports this to AT. */
|
|
234
|
+
checked: boolean;
|
|
235
|
+
/** Some-but-not-all state -- shows a dash instead of a check. */
|
|
236
|
+
indeterminate?: boolean;
|
|
237
|
+
/** Dims the box to 50% opacity, matching `CheckBox`'s disabled treatment. */
|
|
238
|
+
disabled?: boolean;
|
|
239
|
+
/** Extra classes merged onto the box. */
|
|
240
|
+
className?: string;
|
|
193
241
|
}
|
|
194
|
-
declare function
|
|
242
|
+
declare function CheckBoxBox({ checked, indeterminate, disabled, className }: CheckBoxBoxProps): react.JSX.Element;
|
|
195
243
|
|
|
196
244
|
/**
|
|
197
245
|
* @pattern DateRangeFilter
|
|
@@ -1264,25 +1312,60 @@ interface NameListModalProps {
|
|
|
1264
1312
|
initialName: string;
|
|
1265
1313
|
submitLabel: string;
|
|
1266
1314
|
onCancel: () => void;
|
|
1267
|
-
|
|
1315
|
+
/**
|
|
1316
|
+
* Called with the trimmed name, and the state of `options` when any were
|
|
1317
|
+
* given. A handler that only takes the name stays valid -- TypeScript lets
|
|
1318
|
+
* a function ignore trailing parameters -- so existing callers are
|
|
1319
|
+
* unaffected.
|
|
1320
|
+
*/
|
|
1321
|
+
onSubmit: (name: string, checked: Record<string, boolean>) => void;
|
|
1322
|
+
/**
|
|
1323
|
+
* Relabels the name field, for dialogs that name something other than a
|
|
1324
|
+
* list (e.g. "View name").
|
|
1325
|
+
*/
|
|
1326
|
+
fieldLabel?: string;
|
|
1327
|
+
/** Placeholder for the name field, paired with `fieldLabel`. */
|
|
1328
|
+
placeholder?: string;
|
|
1329
|
+
/**
|
|
1330
|
+
* Optional checkboxes below the name field -- e.g. "Set as default" or
|
|
1331
|
+
* "Enable email alerts". Their state is handed to `onSubmit` as the second
|
|
1332
|
+
* argument, keyed by `key`. `initial` sets the starting state.
|
|
1333
|
+
*/
|
|
1334
|
+
options?: {
|
|
1335
|
+
key: string;
|
|
1336
|
+
label: string;
|
|
1337
|
+
initial?: boolean;
|
|
1338
|
+
}[];
|
|
1268
1339
|
}
|
|
1269
1340
|
/**
|
|
1270
1341
|
* @pattern NameListModal
|
|
1271
|
-
* @description
|
|
1272
|
-
* the Account Lists table and the list detail
|
|
1273
|
-
* identical
|
|
1342
|
+
* @description Create/rename dialog — a name field, and optionally a few
|
|
1343
|
+
* checkboxes under it. Shared by the Account Lists table and the list detail
|
|
1344
|
+
* page so create/rename look identical; `fieldLabel`/`placeholder` relabel it
|
|
1345
|
+
* for dialogs that name something other than a list.
|
|
1274
1346
|
* @tokens rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, rounded-control, bg-input, focus:border-brand-primaryAction
|
|
1275
1347
|
* @behavior Escape closes the dialog via `onCancel`, same as clicking the
|
|
1276
1348
|
* scrim backdrop. Submit is disabled until the name is non-empty (trimmed).
|
|
1349
|
+
* When `options` are given they render as CheckBox rows below the field, and
|
|
1350
|
+
* their state comes back as `onSubmit`'s second argument -- a handler that
|
|
1351
|
+
* only takes the name stays valid.
|
|
1277
1352
|
* @usage
|
|
1278
1353
|
* ```tsx
|
|
1279
1354
|
* <NameListModal title="Rename list" initialName={list.name} submitLabel="Save" onCancel={close} onSubmit={rename} />
|
|
1280
1355
|
* ```
|
|
1281
1356
|
*/
|
|
1282
|
-
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit }: NameListModalProps): react.ReactPortal;
|
|
1357
|
+
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit, fieldLabel, placeholder, options, }: NameListModalProps): react.ReactPortal;
|
|
1283
1358
|
|
|
1359
|
+
/**
|
|
1360
|
+
* Which stroke a chip trigger carries.
|
|
1361
|
+
* - `box` : the boxed two-line chip (caption over value), on the default
|
|
1362
|
+
* border. The common filter-bar chip.
|
|
1363
|
+
* - `inline` : the same white fill with a darker stroke, for chips sitting
|
|
1364
|
+
* directly on the warm canvas with no boxed shell around them.
|
|
1365
|
+
*/
|
|
1366
|
+
type ChipVariant = "box" | "inline";
|
|
1284
1367
|
/** Shared styling for filter-bar chip triggers, so every dropdown chip matches. */
|
|
1285
|
-
declare function chipTriggerClass(): string;
|
|
1368
|
+
declare function chipTriggerClass(variant?: ChipVariant): string;
|
|
1286
1369
|
interface ChipContentProps {
|
|
1287
1370
|
/** Small uppercase label above the value. */
|
|
1288
1371
|
caption: string;
|
|
@@ -1296,14 +1379,22 @@ interface ChipContentProps {
|
|
|
1296
1379
|
* @description Shared foundation for filter-bar chip triggers — pairs
|
|
1297
1380
|
* `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
|
|
1298
1381
|
* every dropdown chip across the app matches.
|
|
1299
|
-
* @
|
|
1300
|
-
*
|
|
1382
|
+
* @props
|
|
1383
|
+
* caption: string -- small uppercase label above the value
|
|
1384
|
+
* value: ReactNode -- the current selection, shown below the caption
|
|
1385
|
+
* icon?: ReactNode -- optional leading icon rendered before the caption/value stack
|
|
1386
|
+
* @tokens rounded-control, bg-input, border-border-default, border-border-strong, text-text-secondary, text-text-tertiary, text-text-primary, hover:bg-subtle, focus-visible:outline-border-focus, hover:text-text-primary
|
|
1387
|
+
* @behavior `chipTriggerClass` takes a `ChipVariant`: `box` (default, the
|
|
1388
|
+
* boxed two-line chip on the default border) or `inline` (same fill, darker
|
|
1389
|
+
* stroke, for chips sitting directly on the canvas). It is an argument to
|
|
1390
|
+
* that function, not a prop on `ChipContent`.
|
|
1391
|
+
* Provides only the shared `focus-visible:outline-2` keyboard-focus
|
|
1301
1392
|
* treatment every dropdown trigger depends on — open/close, Escape, and
|
|
1302
1393
|
* outside-click dismissal all live in each consumer, not here. A new dropdown
|
|
1303
1394
|
* built on `chipTriggerClass` has to implement its own dismissal handling.
|
|
1304
1395
|
* @usage
|
|
1305
1396
|
* ```tsx
|
|
1306
|
-
* <button className={chipTriggerClass()}>
|
|
1397
|
+
* <button className={chipTriggerClass("box")}>
|
|
1307
1398
|
* <ChipContent caption="Media Type" value="All" />
|
|
1308
1399
|
* </button>
|
|
1309
1400
|
* ```
|
|
@@ -1504,11 +1595,19 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
|
|
|
1504
1595
|
}): react.JSX.Element;
|
|
1505
1596
|
type TablePaginationProps = Parameters<typeof TablePagination>[0];
|
|
1506
1597
|
|
|
1598
|
+
/** What the Custom Range From/To selects pick. */
|
|
1599
|
+
type DateGranularity = 'month' | 'quarter' | 'year';
|
|
1507
1600
|
/** Resolve a label to its actual [start, end] span, ending at `today`. */
|
|
1508
1601
|
declare function resolveRange(label: string, today?: Date): [Date, Date];
|
|
1509
|
-
declare function DateRangePicker({ defaultValue, align, presets, onChange, onRangeChange, showFooter, today, years, }: {
|
|
1602
|
+
declare function DateRangePicker({ defaultValue, granularity, align, presets, onChange, onRangeChange, showFooter, today, years, }: {
|
|
1510
1603
|
defaultValue?: string;
|
|
1511
1604
|
align?: 'left' | 'right';
|
|
1605
|
+
/**
|
|
1606
|
+
* What the Custom Range From/To selects pick. `month` shows month + year
|
|
1607
|
+
* selects, `quarter` shows quarter + year, `year` shows year alone -- and
|
|
1608
|
+
* the applied label follows suit. Pair it with matching `presets`.
|
|
1609
|
+
*/
|
|
1610
|
+
granularity?: DateGranularity;
|
|
1512
1611
|
/** Rolling presets shown above Custom Range. Defaults to 3/6/12 months. */
|
|
1513
1612
|
presets?: string[];
|
|
1514
1613
|
onChange?: (label: string) => void;
|
|
@@ -1540,9 +1639,16 @@ interface MultiSelectGroup {
|
|
|
1540
1639
|
* button shape (two-line caption + value with a chevron) and opens a
|
|
1541
1640
|
* searchable checkbox popover. Used for the page-level Media Type /
|
|
1542
1641
|
* Advertiser filters that share state with the filter tray.
|
|
1543
|
-
* @tokens 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
|
|
1642
|
+
* @tokens 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
|
|
1544
1643
|
* @dependencies lucide-react
|
|
1545
|
-
* @behavior
|
|
1644
|
+
* @behavior `variant` picks the trigger's chip stroke: `box` (default, the
|
|
1645
|
+
* boxed two-line chip on the default border) or `inline` (same fill,
|
|
1646
|
+
* darker stroke, for chips sitting directly on the canvas). Left out of
|
|
1647
|
+
* the catalog's variant list deliberately: check-prop-drift can't resolve
|
|
1648
|
+
* the imported ChipVariant alias through this component's inline prop
|
|
1649
|
+
* type, so such a tag would be unvalidated -- and this exact component
|
|
1650
|
+
* has had stale ones stripped before.
|
|
1651
|
+
* Same draft/commit-on-close pattern as AdvertiserQuickFilter — the
|
|
1546
1652
|
* draft resyncs from `selected` every time the tray opens, and (without
|
|
1547
1653
|
* showFooter) any close path commits it, while showFooter mode requires the
|
|
1548
1654
|
* Apply button and discards the draft on every other close. `min` enforces a
|
|
@@ -1554,8 +1660,17 @@ interface MultiSelectGroup {
|
|
|
1554
1660
|
* <MultiSelectFilter caption="Media" options={mediaOptions} selected={selected} onChange={setSelected} />
|
|
1555
1661
|
* ```
|
|
1556
1662
|
*/
|
|
1557
|
-
declare function MultiSelectFilter({ caption, options, groups, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, }: {
|
|
1663
|
+
declare function MultiSelectFilter({ caption, options, groups, counts, variant, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, }: {
|
|
1558
1664
|
caption: string;
|
|
1665
|
+
/**
|
|
1666
|
+
* Live option-id -> result count. Supplying it makes the menu faceted:
|
|
1667
|
+
* every label gets a "(n)" suffix and options with nothing behind them
|
|
1668
|
+
* drop out. A selected option is always kept, or there would be no way to
|
|
1669
|
+
* undo it.
|
|
1670
|
+
*/
|
|
1671
|
+
counts?: Record<string, number>;
|
|
1672
|
+
/** Chip stroke for the trigger. See ChipVariant. */
|
|
1673
|
+
variant?: ChipVariant;
|
|
1559
1674
|
options?: {
|
|
1560
1675
|
id: string;
|
|
1561
1676
|
label: string;
|
|
@@ -1682,4 +1797,4 @@ interface FreshnessProps {
|
|
|
1682
1797
|
*/
|
|
1683
1798
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
1684
1799
|
|
|
1685
|
-
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, type CheckBoxProps, ChipContent, type ChipContentProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
|
1800
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -145,7 +145,8 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
145
145
|
* `<input type="checkbox">`), so it can carry an indeterminate "some but not
|
|
146
146
|
* all" state without the native element's limited styling hooks. Designed to
|
|
147
147
|
* be dropped into a row that already has its own click-to-toggle handler
|
|
148
|
-
* (a common list/table pattern) without double-firing.
|
|
148
|
+
* (a common list/table pattern) without double-firing. Where the row itself
|
|
149
|
+
* is the control, use `CheckBoxBox` instead.
|
|
149
150
|
* @tokens bg-brand-primaryAction, border-border-interactive, bg-input,
|
|
150
151
|
* hover:border-brand-primaryAction, focus-visible:outline-border-focus
|
|
151
152
|
* @dependencies lucide-react
|
|
@@ -155,8 +156,9 @@ declare function AdvertiserSearchPrompt({ label }: AdvertiserSearchPromptProps):
|
|
|
155
156
|
* unchecked state previews the brand action color on hover, matching the
|
|
156
157
|
* color the box fills with once checked -- the hover state is a preview of
|
|
157
158
|
* the click's effect, not an unrelated highlight. `onClick` calls
|
|
158
|
-
* `stopPropagation` before firing `onChange
|
|
159
|
-
* that toggles on its own click can't fire the toggle twice
|
|
159
|
+
* `stopPropagation` before firing `onChange` by default, so nesting this
|
|
160
|
+
* inside a row that toggles on its own click can't fire the toggle twice;
|
|
161
|
+
* pass `stopPropagation={false}` where the row should also see the click.
|
|
160
162
|
* @usage
|
|
161
163
|
* ```tsx
|
|
162
164
|
* <CheckBox checked={selected} ariaLabel="Select row" onChange={toggle} />
|
|
@@ -174,14 +176,22 @@ interface CheckBoxProps {
|
|
|
174
176
|
*/
|
|
175
177
|
indeterminate?: boolean;
|
|
176
178
|
/**
|
|
177
|
-
* Called on click with no argument -- flip `checked` yourself.
|
|
178
|
-
* doesn't bubble, so a row that toggles on its own click won't
|
|
179
|
+
* Called on click with no argument -- flip `checked` yourself. By default
|
|
180
|
+
* the click doesn't bubble, so a row that toggles on its own click won't
|
|
181
|
+
* fire twice.
|
|
179
182
|
*/
|
|
180
183
|
onChange: () => void;
|
|
181
184
|
/** Accessible label -- required since the control carries no visible text of its own. */
|
|
182
185
|
ariaLabel: string;
|
|
183
186
|
/** Blocks clicks, dims the box to 50% opacity, and cancels its hover preview. */
|
|
184
187
|
disabled?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Whether the click stops bubbling to an ancestor. Defaults to `true`,
|
|
190
|
+
* which is what a row that toggles on its own click needs. Set `false`
|
|
191
|
+
* when the ancestor should also see the click -- e.g. a row that both
|
|
192
|
+
* selects and opens a detail panel.
|
|
193
|
+
*/
|
|
194
|
+
stopPropagation?: boolean;
|
|
185
195
|
/** Forwarded as `data-testid`, for Playwright/test selectors. */
|
|
186
196
|
testId?: string;
|
|
187
197
|
/**
|
|
@@ -190,8 +200,46 @@ interface CheckBoxProps {
|
|
|
190
200
|
* be on any other disabled control.
|
|
191
201
|
*/
|
|
192
202
|
title?: string;
|
|
203
|
+
/** Extra classes merged onto the box -- e.g. a cursor or margin override. */
|
|
204
|
+
className?: string;
|
|
205
|
+
}
|
|
206
|
+
declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation, testId, title, className, }: CheckBoxProps): react.JSX.Element;
|
|
207
|
+
/**
|
|
208
|
+
* @pattern CheckBoxBox
|
|
209
|
+
* @description Presentational checkbox -- draws the same box as `CheckBox`
|
|
210
|
+
* and nothing else. Use it when an ancestor already carries the interaction
|
|
211
|
+
* and the checkbox semantics (a clickable option row, a `<label>`), since a
|
|
212
|
+
* `<button>` inside a `<button>` is invalid markup and a second focus stop on
|
|
213
|
+
* the same control is worse for keyboard users, not better. The owning
|
|
214
|
+
* element supplies `role="checkbox"` and `aria-checked`; this is
|
|
215
|
+
* `aria-hidden` so the state isn't announced twice.
|
|
216
|
+
* @tokens bg-brand-primaryAction, border-border-interactive, bg-input
|
|
217
|
+
* @dependencies lucide-react
|
|
218
|
+
* @behavior Renders through the same `boxClass` as `CheckBox`, so geometry
|
|
219
|
+
* and fill can't drift. Takes neither the focus ring nor the hover border,
|
|
220
|
+
* because the row around it owns both. Without this, a row that is itself
|
|
221
|
+
* the control has no correct option: nesting the interactive `CheckBox`
|
|
222
|
+
* produces a button inside a button, and dropping to a `<div>` with a click
|
|
223
|
+
* handler loses keyboard access entirely.
|
|
224
|
+
* @usage
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <button type="button" role="checkbox" aria-checked={on} onClick={toggle}>
|
|
227
|
+
* <CheckBoxBox checked={on} />
|
|
228
|
+
* <span>Cable TV</span>
|
|
229
|
+
* </button>
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
interface CheckBoxBoxProps {
|
|
233
|
+
/** Whether the box is checked. The owning element reports this to AT. */
|
|
234
|
+
checked: boolean;
|
|
235
|
+
/** Some-but-not-all state -- shows a dash instead of a check. */
|
|
236
|
+
indeterminate?: boolean;
|
|
237
|
+
/** Dims the box to 50% opacity, matching `CheckBox`'s disabled treatment. */
|
|
238
|
+
disabled?: boolean;
|
|
239
|
+
/** Extra classes merged onto the box. */
|
|
240
|
+
className?: string;
|
|
193
241
|
}
|
|
194
|
-
declare function
|
|
242
|
+
declare function CheckBoxBox({ checked, indeterminate, disabled, className }: CheckBoxBoxProps): react.JSX.Element;
|
|
195
243
|
|
|
196
244
|
/**
|
|
197
245
|
* @pattern DateRangeFilter
|
|
@@ -1264,25 +1312,60 @@ interface NameListModalProps {
|
|
|
1264
1312
|
initialName: string;
|
|
1265
1313
|
submitLabel: string;
|
|
1266
1314
|
onCancel: () => void;
|
|
1267
|
-
|
|
1315
|
+
/**
|
|
1316
|
+
* Called with the trimmed name, and the state of `options` when any were
|
|
1317
|
+
* given. A handler that only takes the name stays valid -- TypeScript lets
|
|
1318
|
+
* a function ignore trailing parameters -- so existing callers are
|
|
1319
|
+
* unaffected.
|
|
1320
|
+
*/
|
|
1321
|
+
onSubmit: (name: string, checked: Record<string, boolean>) => void;
|
|
1322
|
+
/**
|
|
1323
|
+
* Relabels the name field, for dialogs that name something other than a
|
|
1324
|
+
* list (e.g. "View name").
|
|
1325
|
+
*/
|
|
1326
|
+
fieldLabel?: string;
|
|
1327
|
+
/** Placeholder for the name field, paired with `fieldLabel`. */
|
|
1328
|
+
placeholder?: string;
|
|
1329
|
+
/**
|
|
1330
|
+
* Optional checkboxes below the name field -- e.g. "Set as default" or
|
|
1331
|
+
* "Enable email alerts". Their state is handed to `onSubmit` as the second
|
|
1332
|
+
* argument, keyed by `key`. `initial` sets the starting state.
|
|
1333
|
+
*/
|
|
1334
|
+
options?: {
|
|
1335
|
+
key: string;
|
|
1336
|
+
label: string;
|
|
1337
|
+
initial?: boolean;
|
|
1338
|
+
}[];
|
|
1268
1339
|
}
|
|
1269
1340
|
/**
|
|
1270
1341
|
* @pattern NameListModal
|
|
1271
|
-
* @description
|
|
1272
|
-
* the Account Lists table and the list detail
|
|
1273
|
-
* identical
|
|
1342
|
+
* @description Create/rename dialog — a name field, and optionally a few
|
|
1343
|
+
* checkboxes under it. Shared by the Account Lists table and the list detail
|
|
1344
|
+
* page so create/rename look identical; `fieldLabel`/`placeholder` relabel it
|
|
1345
|
+
* for dialogs that name something other than a list.
|
|
1274
1346
|
* @tokens rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, rounded-control, bg-input, focus:border-brand-primaryAction
|
|
1275
1347
|
* @behavior Escape closes the dialog via `onCancel`, same as clicking the
|
|
1276
1348
|
* scrim backdrop. Submit is disabled until the name is non-empty (trimmed).
|
|
1349
|
+
* When `options` are given they render as CheckBox rows below the field, and
|
|
1350
|
+
* their state comes back as `onSubmit`'s second argument -- a handler that
|
|
1351
|
+
* only takes the name stays valid.
|
|
1277
1352
|
* @usage
|
|
1278
1353
|
* ```tsx
|
|
1279
1354
|
* <NameListModal title="Rename list" initialName={list.name} submitLabel="Save" onCancel={close} onSubmit={rename} />
|
|
1280
1355
|
* ```
|
|
1281
1356
|
*/
|
|
1282
|
-
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit }: NameListModalProps): react.ReactPortal;
|
|
1357
|
+
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit, fieldLabel, placeholder, options, }: NameListModalProps): react.ReactPortal;
|
|
1283
1358
|
|
|
1359
|
+
/**
|
|
1360
|
+
* Which stroke a chip trigger carries.
|
|
1361
|
+
* - `box` : the boxed two-line chip (caption over value), on the default
|
|
1362
|
+
* border. The common filter-bar chip.
|
|
1363
|
+
* - `inline` : the same white fill with a darker stroke, for chips sitting
|
|
1364
|
+
* directly on the warm canvas with no boxed shell around them.
|
|
1365
|
+
*/
|
|
1366
|
+
type ChipVariant = "box" | "inline";
|
|
1284
1367
|
/** Shared styling for filter-bar chip triggers, so every dropdown chip matches. */
|
|
1285
|
-
declare function chipTriggerClass(): string;
|
|
1368
|
+
declare function chipTriggerClass(variant?: ChipVariant): string;
|
|
1286
1369
|
interface ChipContentProps {
|
|
1287
1370
|
/** Small uppercase label above the value. */
|
|
1288
1371
|
caption: string;
|
|
@@ -1296,14 +1379,22 @@ interface ChipContentProps {
|
|
|
1296
1379
|
* @description Shared foundation for filter-bar chip triggers — pairs
|
|
1297
1380
|
* `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
|
|
1298
1381
|
* every dropdown chip across the app matches.
|
|
1299
|
-
* @
|
|
1300
|
-
*
|
|
1382
|
+
* @props
|
|
1383
|
+
* caption: string -- small uppercase label above the value
|
|
1384
|
+
* value: ReactNode -- the current selection, shown below the caption
|
|
1385
|
+
* icon?: ReactNode -- optional leading icon rendered before the caption/value stack
|
|
1386
|
+
* @tokens rounded-control, bg-input, border-border-default, border-border-strong, text-text-secondary, text-text-tertiary, text-text-primary, hover:bg-subtle, focus-visible:outline-border-focus, hover:text-text-primary
|
|
1387
|
+
* @behavior `chipTriggerClass` takes a `ChipVariant`: `box` (default, the
|
|
1388
|
+
* boxed two-line chip on the default border) or `inline` (same fill, darker
|
|
1389
|
+
* stroke, for chips sitting directly on the canvas). It is an argument to
|
|
1390
|
+
* that function, not a prop on `ChipContent`.
|
|
1391
|
+
* Provides only the shared `focus-visible:outline-2` keyboard-focus
|
|
1301
1392
|
* treatment every dropdown trigger depends on — open/close, Escape, and
|
|
1302
1393
|
* outside-click dismissal all live in each consumer, not here. A new dropdown
|
|
1303
1394
|
* built on `chipTriggerClass` has to implement its own dismissal handling.
|
|
1304
1395
|
* @usage
|
|
1305
1396
|
* ```tsx
|
|
1306
|
-
* <button className={chipTriggerClass()}>
|
|
1397
|
+
* <button className={chipTriggerClass("box")}>
|
|
1307
1398
|
* <ChipContent caption="Media Type" value="All" />
|
|
1308
1399
|
* </button>
|
|
1309
1400
|
* ```
|
|
@@ -1504,11 +1595,19 @@ declare function TablePagination({ page, perPage, totalItems, onPageChange, onPe
|
|
|
1504
1595
|
}): react.JSX.Element;
|
|
1505
1596
|
type TablePaginationProps = Parameters<typeof TablePagination>[0];
|
|
1506
1597
|
|
|
1598
|
+
/** What the Custom Range From/To selects pick. */
|
|
1599
|
+
type DateGranularity = 'month' | 'quarter' | 'year';
|
|
1507
1600
|
/** Resolve a label to its actual [start, end] span, ending at `today`. */
|
|
1508
1601
|
declare function resolveRange(label: string, today?: Date): [Date, Date];
|
|
1509
|
-
declare function DateRangePicker({ defaultValue, align, presets, onChange, onRangeChange, showFooter, today, years, }: {
|
|
1602
|
+
declare function DateRangePicker({ defaultValue, granularity, align, presets, onChange, onRangeChange, showFooter, today, years, }: {
|
|
1510
1603
|
defaultValue?: string;
|
|
1511
1604
|
align?: 'left' | 'right';
|
|
1605
|
+
/**
|
|
1606
|
+
* What the Custom Range From/To selects pick. `month` shows month + year
|
|
1607
|
+
* selects, `quarter` shows quarter + year, `year` shows year alone -- and
|
|
1608
|
+
* the applied label follows suit. Pair it with matching `presets`.
|
|
1609
|
+
*/
|
|
1610
|
+
granularity?: DateGranularity;
|
|
1512
1611
|
/** Rolling presets shown above Custom Range. Defaults to 3/6/12 months. */
|
|
1513
1612
|
presets?: string[];
|
|
1514
1613
|
onChange?: (label: string) => void;
|
|
@@ -1540,9 +1639,16 @@ interface MultiSelectGroup {
|
|
|
1540
1639
|
* button shape (two-line caption + value with a chevron) and opens a
|
|
1541
1640
|
* searchable checkbox popover. Used for the page-level Media Type /
|
|
1542
1641
|
* Advertiser filters that share state with the filter tray.
|
|
1543
|
-
* @tokens 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
|
|
1642
|
+
* @tokens 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
|
|
1544
1643
|
* @dependencies lucide-react
|
|
1545
|
-
* @behavior
|
|
1644
|
+
* @behavior `variant` picks the trigger's chip stroke: `box` (default, the
|
|
1645
|
+
* boxed two-line chip on the default border) or `inline` (same fill,
|
|
1646
|
+
* darker stroke, for chips sitting directly on the canvas). Left out of
|
|
1647
|
+
* the catalog's variant list deliberately: check-prop-drift can't resolve
|
|
1648
|
+
* the imported ChipVariant alias through this component's inline prop
|
|
1649
|
+
* type, so such a tag would be unvalidated -- and this exact component
|
|
1650
|
+
* has had stale ones stripped before.
|
|
1651
|
+
* Same draft/commit-on-close pattern as AdvertiserQuickFilter — the
|
|
1546
1652
|
* draft resyncs from `selected` every time the tray opens, and (without
|
|
1547
1653
|
* showFooter) any close path commits it, while showFooter mode requires the
|
|
1548
1654
|
* Apply button and discards the draft on every other close. `min` enforces a
|
|
@@ -1554,8 +1660,17 @@ interface MultiSelectGroup {
|
|
|
1554
1660
|
* <MultiSelectFilter caption="Media" options={mediaOptions} selected={selected} onChange={setSelected} />
|
|
1555
1661
|
* ```
|
|
1556
1662
|
*/
|
|
1557
|
-
declare function MultiSelectFilter({ caption, options, groups, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, }: {
|
|
1663
|
+
declare function MultiSelectFilter({ caption, options, groups, counts, variant, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, }: {
|
|
1558
1664
|
caption: string;
|
|
1665
|
+
/**
|
|
1666
|
+
* Live option-id -> result count. Supplying it makes the menu faceted:
|
|
1667
|
+
* every label gets a "(n)" suffix and options with nothing behind them
|
|
1668
|
+
* drop out. A selected option is always kept, or there would be no way to
|
|
1669
|
+
* undo it.
|
|
1670
|
+
*/
|
|
1671
|
+
counts?: Record<string, number>;
|
|
1672
|
+
/** Chip stroke for the trigger. See ChipVariant. */
|
|
1673
|
+
variant?: ChipVariant;
|
|
1559
1674
|
options?: {
|
|
1560
1675
|
id: string;
|
|
1561
1676
|
label: string;
|
|
@@ -1682,4 +1797,4 @@ interface FreshnessProps {
|
|
|
1682
1797
|
*/
|
|
1683
1798
|
declare function Freshness({ level }: FreshnessProps): react.JSX.Element;
|
|
1684
1799
|
|
|
1685
|
-
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, type CheckBoxProps, ChipContent, type ChipContentProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|
|
1800
|
+
export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, SectionRail, type SectionRailProps, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, type SummaryGroup, type SummaryGroupItemValue, TablePagination, type TablePaginationProps, Tag, type TagProps, Toggle, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
|