@mediaradar/design-components 0.5.1 → 0.7.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/README.md +44 -3
- package/dist/index.cjs +397 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +260 -6
- package/dist/index.d.ts +260 -6
- package/dist/index.js +384 -13
- package/dist/index.js.map +1 -1
- package/package.json +18 -6
- package/scripts/check-tailwind-coverage.mjs +51 -0
- package/scripts/tailwind-coverage.mjs +96 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { ReactNode, RefObject, ButtonHTMLAttributes } from 'react';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @pattern InfoTip
|
|
6
8
|
* @description Info tooltip — a small info glyph that opens a portalled,
|
|
7
9
|
* viewport-clamped bubble. Mirrors the Publisher Intel header affordance so
|
|
8
10
|
* page subtitles can collapse into the eyebrow.
|
|
9
|
-
* @tokens text-text-tertiary, rounded-control, border-border, bg-surface,
|
|
11
|
+
* @tokens text-text-tertiary, rounded-control, border-border-default, bg-surface,
|
|
10
12
|
* shadow-overlay, text-text-secondary, focus-visible:outline-border-focus,
|
|
11
13
|
* hover:text-text-primary, tracking-normal
|
|
12
14
|
* @dependencies lucide-react
|
|
@@ -320,7 +322,7 @@ declare function SearchBar({ placeholder, value, onChange, variant, matchValue,
|
|
|
320
322
|
* desktop grid exactly, or a variable-length list with no "view all" link
|
|
321
323
|
* at all — both need to keep working without the row assuming a count.
|
|
322
324
|
* @tokens text-text-primary, text-text-secondary, text-text-link,
|
|
323
|
-
* rounded-control, rounded-sm, border-border, focus-visible:outline-solid,
|
|
325
|
+
* rounded-control, rounded-sm, border-border-default, focus-visible:outline-solid,
|
|
324
326
|
* focus-visible:outline-border-focus, hover:bg-subtle, hover:text-text-primary,
|
|
325
327
|
* tracking-tight, font-serif
|
|
326
328
|
* @dependencies lucide-react
|
|
@@ -617,10 +619,10 @@ interface SummaryGroup {
|
|
|
617
619
|
* naming maps to this package's `shadow-raised`/`shadow-overlay` respectively
|
|
618
620
|
* (raised: a static card like this one; overlay: a floating popover/menu),
|
|
619
621
|
* not a 1:1 name swap.
|
|
620
|
-
* @tokens rounded-card, border-border, bg-surface, shadow-raised,
|
|
622
|
+
* @tokens rounded-card, border-border-default, bg-surface, shadow-raised,
|
|
621
623
|
* text-text-secondary, text-text-primary, rounded-full, bg-subtle,
|
|
622
624
|
* rounded-control, bg-canvas, hover:bg-subtle, hover:text-text-danger,
|
|
623
|
-
* text-text-link, divide-border
|
|
625
|
+
* text-text-link, divide-border-default
|
|
624
626
|
* @dependencies lucide-react
|
|
625
627
|
* @behavior A group auto-expands only on the empty-to-nonempty transition
|
|
626
628
|
* (including via a nested sub-group's items) and auto-collapses when
|
|
@@ -1183,4 +1185,256 @@ interface PublisherBreakdownListProps {
|
|
|
1183
1185
|
*/
|
|
1184
1186
|
declare function PublisherBreakdownList({ rows, defaultVisibleCount, padded, viewAllHref, renderLogo }: PublisherBreakdownListProps): react.JSX.Element;
|
|
1185
1187
|
|
|
1186
|
-
|
|
1188
|
+
declare const buttonVariants: (props?: ({
|
|
1189
|
+
variant?: "link" | "primary" | "secondary" | "ghost" | "danger" | null | undefined;
|
|
1190
|
+
size?: "icon" | "sm" | "md" | "lg" | null | undefined;
|
|
1191
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1192
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
1193
|
+
/** Render the button styling onto the single child element instead of a `<button>` (e.g. a router `<Link>`). */
|
|
1194
|
+
asChild?: boolean;
|
|
1195
|
+
/** Shows a spinner in place of the leading edge and disables the button. */
|
|
1196
|
+
loading?: boolean;
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* @pattern Button
|
|
1200
|
+
* @description Primary interactive control for actions. Five visual variants
|
|
1201
|
+
* (primary, secondary, ghost, danger, link) and four sizes (sm, md, lg, icon).
|
|
1202
|
+
* Supports polymorphic rendering via `asChild` (Radix Slot) to apply button
|
|
1203
|
+
* styling to a different element, e.g. a router `<Link>`. Also exports the
|
|
1204
|
+
* raw `buttonVariants` cva function for consumers composing button styling
|
|
1205
|
+
* onto something other than this component.
|
|
1206
|
+
* @tokens bg-brand-primaryAction, text-brand-onprimary, bg-surface, text-text-primary, border-border-interactive, hover:bg-subtle, bg-status-danger, text-status-onstatus, text-text-link, rounded-control, duration-(--mr-motion-duration-interactive), ease-interactive
|
|
1207
|
+
* @dependencies class-variance-authority, @radix-ui/react-slot, lucide-react
|
|
1208
|
+
* @variant primary - The one primary action on a screen. Solid brand fill.
|
|
1209
|
+
* @variant secondary - Any other real action competing for attention (Cancel, Export). Bordered, neutral fill.
|
|
1210
|
+
* @variant ghost - Low-emphasis action inside a dense toolbar or row where a border would add visual noise.
|
|
1211
|
+
* @variant danger - Destructive/irreversible actions (Delete, Remove). Never pair with `primary` in the same control group.
|
|
1212
|
+
* @variant link - Reads as inline text, not a control. Use inside body copy or where a full button would overpower the surrounding content.
|
|
1213
|
+
* @behavior `disabled` removes pointer events entirely (not just a style
|
|
1214
|
+
* change) and dims to 40% opacity. Focus handling is a deliberate exception:
|
|
1215
|
+
* most interactive components use a visible `focus-visible:outline-2` ring,
|
|
1216
|
+
* but Button suppresses it (`focus-visible:outline-hidden focus-visible:ring-0`)
|
|
1217
|
+
* and relies on its per-variant hover/brightness treatment instead. `loading`
|
|
1218
|
+
* implies `disabled` (and sets `aria-busy`), since a control mid-submit
|
|
1219
|
+
* shouldn't accept another click.
|
|
1220
|
+
* @usage
|
|
1221
|
+
* ```tsx
|
|
1222
|
+
* <Button variant="primary" size="md">Save changes</Button>
|
|
1223
|
+
* <Button variant="secondary" size="sm">Cancel</Button>
|
|
1224
|
+
* <Button variant="danger">Delete</Button>
|
|
1225
|
+
* <Button variant="primary" loading>Saving…</Button>
|
|
1226
|
+
* ```
|
|
1227
|
+
*/
|
|
1228
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1229
|
+
|
|
1230
|
+
interface FilterDropdownFooterProps {
|
|
1231
|
+
/** Omit to hide the Clear All action for dropdowns that don't need it. */
|
|
1232
|
+
onClear?: () => void;
|
|
1233
|
+
/** Fires when the primary action is pressed. */
|
|
1234
|
+
onApply: () => void;
|
|
1235
|
+
clearLabel?: string;
|
|
1236
|
+
applyLabel?: string;
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* @pattern FilterDropdownFooter
|
|
1240
|
+
* @description Fixed Apply/Clear All footer for quick-filter dropdowns —
|
|
1241
|
+
* pinned below the (independently scrollable) option list so it's always
|
|
1242
|
+
* visible. Shared by the Media/Advertiser/Date/Group By/Time Increment quick
|
|
1243
|
+
* filters on Sports Dashboard, Publisher Intel, and Opportunities.
|
|
1244
|
+
* @tokens border-border-default
|
|
1245
|
+
* @usage
|
|
1246
|
+
* ```tsx
|
|
1247
|
+
* <FilterDropdownFooter onApply={handleApply} onClear={handleClear} />
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
declare function FilterDropdownFooter({ onClear, onApply, clearLabel, applyLabel, }: FilterDropdownFooterProps): react.JSX.Element;
|
|
1251
|
+
|
|
1252
|
+
interface NameListModalProps {
|
|
1253
|
+
title: string;
|
|
1254
|
+
initialName: string;
|
|
1255
|
+
submitLabel: string;
|
|
1256
|
+
onCancel: () => void;
|
|
1257
|
+
onSubmit: (name: string) => void;
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* @pattern NameListModal
|
|
1261
|
+
* @description Minimal create/rename dialog — just the list name. Shared by
|
|
1262
|
+
* the Account Lists table and the list detail page so create/rename look
|
|
1263
|
+
* identical.
|
|
1264
|
+
* @tokens rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, rounded-control, bg-input, focus:border-brand-primaryAction
|
|
1265
|
+
* @behavior Escape closes the dialog via `onCancel`, same as clicking the
|
|
1266
|
+
* scrim backdrop. Submit is disabled until the name is non-empty (trimmed).
|
|
1267
|
+
* @usage
|
|
1268
|
+
* ```tsx
|
|
1269
|
+
* <NameListModal title="Rename list" initialName={list.name} submitLabel="Save" onCancel={close} onSubmit={rename} />
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit }: NameListModalProps): react.ReactPortal;
|
|
1273
|
+
|
|
1274
|
+
/** Shared styling for filter-bar chip triggers, so every dropdown chip matches. */
|
|
1275
|
+
declare function chipTriggerClass(): string;
|
|
1276
|
+
interface ChipContentProps {
|
|
1277
|
+
/** Small uppercase label above the value. */
|
|
1278
|
+
caption: string;
|
|
1279
|
+
/** The current selection, shown below the caption. */
|
|
1280
|
+
value: ReactNode;
|
|
1281
|
+
/** Optional leading icon rendered before the caption/value stack. */
|
|
1282
|
+
icon?: ReactNode;
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* @pattern ChipTrigger
|
|
1286
|
+
* @description Shared foundation for filter-bar chip triggers — pairs
|
|
1287
|
+
* `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
|
|
1288
|
+
* every dropdown chip across the app matches.
|
|
1289
|
+
* @tokens rounded-control, bg-input, border-border-strong, text-text-secondary, text-text-tertiary, text-text-primary, hover:bg-subtle, focus-visible:outline-border-focus, hover:text-text-primary
|
|
1290
|
+
* @behavior Provides only the shared `focus-visible:outline-2` keyboard-focus
|
|
1291
|
+
* treatment every dropdown trigger depends on — open/close, Escape, and
|
|
1292
|
+
* outside-click dismissal all live in each consumer, not here. A new dropdown
|
|
1293
|
+
* built on `chipTriggerClass` has to implement its own dismissal handling.
|
|
1294
|
+
* @usage
|
|
1295
|
+
* ```tsx
|
|
1296
|
+
* <button className={chipTriggerClass()}>
|
|
1297
|
+
* <ChipContent caption="Media Type" value="All" />
|
|
1298
|
+
* </button>
|
|
1299
|
+
* ```
|
|
1300
|
+
*/
|
|
1301
|
+
declare function ChipContent({ caption, value, icon }: ChipContentProps): react.JSX.Element;
|
|
1302
|
+
|
|
1303
|
+
interface ChipLike {
|
|
1304
|
+
key: string;
|
|
1305
|
+
label: string;
|
|
1306
|
+
groupLabel: string;
|
|
1307
|
+
}
|
|
1308
|
+
interface FilterChipBarProps<T extends ChipLike> {
|
|
1309
|
+
/** Any `{ key, label, groupLabel }` shape — only those fields are read. */
|
|
1310
|
+
chips: T[];
|
|
1311
|
+
onRemove: (chip: T) => void;
|
|
1312
|
+
onClearAll: () => void;
|
|
1313
|
+
/**
|
|
1314
|
+
* Chip keys that are kept but not applied (e.g. a filter the active
|
|
1315
|
+
* workspace can't resolve). Rendered inactive, still removable.
|
|
1316
|
+
*/
|
|
1317
|
+
parkedKeys?: Set<string>;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* @pattern FilterChipBar
|
|
1321
|
+
* @description Applied-filter chips — wrap freely across as many rows as
|
|
1322
|
+
* needed, every chip shown. Each chip reveals its filter category on hover
|
|
1323
|
+
* (tooltip + outline). "Clear all" trails the chips. Generic over the
|
|
1324
|
+
* page's own chip type — only the shared key/label/groupLabel fields are
|
|
1325
|
+
* used.
|
|
1326
|
+
* @tokens rounded-full, bg-subtle, text-text-secondary, text-text-link, text-text-tertiary, bg-text-primary, border-border-default, group-hover:bg-border-default, group-hover:ring-border-interactive, group-hover:text-text-primary, group-hover:text-text-secondary, hover:text-text-primary, shadow-raised, text-surface
|
|
1327
|
+
* @dependencies lucide-react
|
|
1328
|
+
* @behavior A parked chip (key in `parkedKeys`) renders with no fill and a
|
|
1329
|
+
* dashed edge instead of the solid applied style, and its hover tooltip
|
|
1330
|
+
* reads "Not in this workspace" instead of the filter's group label.
|
|
1331
|
+
* @usage
|
|
1332
|
+
* ```tsx
|
|
1333
|
+
* <FilterChipBar chips={activeChips} onRemove={removeChip} onClearAll={clearAll} />
|
|
1334
|
+
* ```
|
|
1335
|
+
*/
|
|
1336
|
+
declare function FilterChipBar<T extends ChipLike>({ chips, onRemove, onClearAll, parkedKeys }: FilterChipBarProps<T>): react.JSX.Element | null;
|
|
1337
|
+
|
|
1338
|
+
type SortDir = "asc" | "desc";
|
|
1339
|
+
/** An active column and direction, or `null` for the unsorted state. */
|
|
1340
|
+
type SortState<K extends string> = {
|
|
1341
|
+
key: K;
|
|
1342
|
+
dir: SortDir;
|
|
1343
|
+
} | null;
|
|
1344
|
+
/**
|
|
1345
|
+
* The state after clicking `key`. `firstDir` is what the column opens on,
|
|
1346
|
+
* since the useful first look differs by column: counts and dates want the
|
|
1347
|
+
* largest or newest first, names want A→Z.
|
|
1348
|
+
*/
|
|
1349
|
+
declare function cycleSort<K extends string>(current: SortState<K>, key: K, firstDir?: SortDir): SortState<K>;
|
|
1350
|
+
/**
|
|
1351
|
+
* `SortState` in the shape SortButton takes. SortButton wants a non-null
|
|
1352
|
+
* object and reads `key: null` as "no column active".
|
|
1353
|
+
*/
|
|
1354
|
+
declare function sortProp<K extends string>(sort: SortState<K>): {
|
|
1355
|
+
key: K | null;
|
|
1356
|
+
dir: SortDir;
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
interface SortButtonProps<K extends string> {
|
|
1360
|
+
label: string;
|
|
1361
|
+
sortKey: K;
|
|
1362
|
+
/** Current sort; a null `key` renders every SortButton inactive. See `sortProp`. */
|
|
1363
|
+
sort: {
|
|
1364
|
+
key: K | null;
|
|
1365
|
+
dir: SortDir;
|
|
1366
|
+
};
|
|
1367
|
+
onSort: (key: K) => void;
|
|
1368
|
+
/** True when there are no rows to order — hides the arrow, drops the click. */
|
|
1369
|
+
disabled?: boolean;
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* @pattern SortButton
|
|
1373
|
+
* @description Design-system rule: every sortable table column header uses
|
|
1374
|
+
* this exact icon/color treatment. Sortable-but-inactive columns show a
|
|
1375
|
+
* neutral ArrowUpDown in text-tertiary at half opacity, coming up to full on
|
|
1376
|
+
* hover so the column reads as clickable; the active column swaps to a
|
|
1377
|
+
* direction arrow (ArrowUp/ArrowDown) colored with the brand action blue.
|
|
1378
|
+
* @tokens text-text-tertiary, text-brand-primaryAction, hover:text-text-primary
|
|
1379
|
+
* @dependencies lucide-react
|
|
1380
|
+
* @behavior Pair with `cycleSort`/`sortProp` (exported alongside) for the
|
|
1381
|
+
* standard three-state cycle — sort, reverse, then unsorted. `disabled` keeps
|
|
1382
|
+
* the column's inherited header color rather than dimming it — the column
|
|
1383
|
+
* isn't unavailable, there's just no data under it.
|
|
1384
|
+
* @usage
|
|
1385
|
+
* ```tsx
|
|
1386
|
+
* const [sort, setSort] = useState<SortState<'spend'>>(null)
|
|
1387
|
+
* <SortButton label="Spend" sortKey="spend" sort={sortProp(sort)} onSort={(k) => setSort(cycleSort(sort, k))} />
|
|
1388
|
+
* ```
|
|
1389
|
+
*/
|
|
1390
|
+
declare function SortButton<K extends string>({ label, sortKey, sort, onSort, disabled }: SortButtonProps<K>): react.JSX.Element;
|
|
1391
|
+
|
|
1392
|
+
interface PagerProps {
|
|
1393
|
+
/** The current page, 1-indexed. */
|
|
1394
|
+
page: number;
|
|
1395
|
+
totalPages: number;
|
|
1396
|
+
onPage: (p: number) => void;
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* @pattern Pager
|
|
1400
|
+
* @description Compact prev/next pager with a windowed page-number list —
|
|
1401
|
+
* shows every page up to 7 total, otherwise 1 … current±1 … last with
|
|
1402
|
+
* ellipsis gaps. Shared by My Exports and Account Matcher.
|
|
1403
|
+
* @tokens rounded-control, text-text-secondary, bg-brand-primaryAction, text-brand-onprimary, hover:bg-subtle, hover:text-text-primary, text-text-tertiary
|
|
1404
|
+
* @dependencies lucide-react
|
|
1405
|
+
* @usage
|
|
1406
|
+
* ```tsx
|
|
1407
|
+
* <Pager page={page} totalPages={totalPages} onPage={setPage} />
|
|
1408
|
+
* ```
|
|
1409
|
+
*/
|
|
1410
|
+
declare function Pager({ page, totalPages, onPage }: PagerProps): react.JSX.Element;
|
|
1411
|
+
|
|
1412
|
+
declare const SIZES: {
|
|
1413
|
+
/** Matches a 15px lucide icon exactly, so a workspace name in a menu row
|
|
1414
|
+
* left-aligns with labels in icon-led rows above and below it. */
|
|
1415
|
+
readonly xs: "h-[15px] w-[15px] rounded-[4px] text-[8px] tracking-tight";
|
|
1416
|
+
readonly sm: "h-6 w-6 text-[10px]";
|
|
1417
|
+
readonly md: "h-7 w-7 text-[11px]";
|
|
1418
|
+
readonly lg: "h-11 w-11 text-[15px]";
|
|
1419
|
+
};
|
|
1420
|
+
interface WorkspaceAvatarProps {
|
|
1421
|
+
/** Omit for the unscoped "All data workspace". */
|
|
1422
|
+
name?: string;
|
|
1423
|
+
size?: keyof typeof SIZES;
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* @pattern WorkspaceAvatar
|
|
1427
|
+
* @description The square tile that identifies a workspace in a switch
|
|
1428
|
+
* list — first 1–2 word initials of the workspace name. Pass no name for
|
|
1429
|
+
* the unscoped "All data workspace", which renders "AD" through the same
|
|
1430
|
+
* rule so the unscoped default reads as a peer of named workspaces rather
|
|
1431
|
+
* than a special case.
|
|
1432
|
+
* @tokens rounded-control, bg-subtle, text-text-secondary
|
|
1433
|
+
* @usage
|
|
1434
|
+
* ```tsx
|
|
1435
|
+
* <WorkspaceAvatar name="Capital One" size="sm" />
|
|
1436
|
+
* ```
|
|
1437
|
+
*/
|
|
1438
|
+
declare function WorkspaceAvatar({ name, size }: WorkspaceAvatarProps): react.JSX.Element;
|
|
1439
|
+
|
|
1440
|
+
export { 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, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, 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, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, sortProp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
import { ReactNode, RefObject, ButtonHTMLAttributes } from 'react';
|
|
3
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* @pattern InfoTip
|
|
6
8
|
* @description Info tooltip — a small info glyph that opens a portalled,
|
|
7
9
|
* viewport-clamped bubble. Mirrors the Publisher Intel header affordance so
|
|
8
10
|
* page subtitles can collapse into the eyebrow.
|
|
9
|
-
* @tokens text-text-tertiary, rounded-control, border-border, bg-surface,
|
|
11
|
+
* @tokens text-text-tertiary, rounded-control, border-border-default, bg-surface,
|
|
10
12
|
* shadow-overlay, text-text-secondary, focus-visible:outline-border-focus,
|
|
11
13
|
* hover:text-text-primary, tracking-normal
|
|
12
14
|
* @dependencies lucide-react
|
|
@@ -320,7 +322,7 @@ declare function SearchBar({ placeholder, value, onChange, variant, matchValue,
|
|
|
320
322
|
* desktop grid exactly, or a variable-length list with no "view all" link
|
|
321
323
|
* at all — both need to keep working without the row assuming a count.
|
|
322
324
|
* @tokens text-text-primary, text-text-secondary, text-text-link,
|
|
323
|
-
* rounded-control, rounded-sm, border-border, focus-visible:outline-solid,
|
|
325
|
+
* rounded-control, rounded-sm, border-border-default, focus-visible:outline-solid,
|
|
324
326
|
* focus-visible:outline-border-focus, hover:bg-subtle, hover:text-text-primary,
|
|
325
327
|
* tracking-tight, font-serif
|
|
326
328
|
* @dependencies lucide-react
|
|
@@ -617,10 +619,10 @@ interface SummaryGroup {
|
|
|
617
619
|
* naming maps to this package's `shadow-raised`/`shadow-overlay` respectively
|
|
618
620
|
* (raised: a static card like this one; overlay: a floating popover/menu),
|
|
619
621
|
* not a 1:1 name swap.
|
|
620
|
-
* @tokens rounded-card, border-border, bg-surface, shadow-raised,
|
|
622
|
+
* @tokens rounded-card, border-border-default, bg-surface, shadow-raised,
|
|
621
623
|
* text-text-secondary, text-text-primary, rounded-full, bg-subtle,
|
|
622
624
|
* rounded-control, bg-canvas, hover:bg-subtle, hover:text-text-danger,
|
|
623
|
-
* text-text-link, divide-border
|
|
625
|
+
* text-text-link, divide-border-default
|
|
624
626
|
* @dependencies lucide-react
|
|
625
627
|
* @behavior A group auto-expands only on the empty-to-nonempty transition
|
|
626
628
|
* (including via a nested sub-group's items) and auto-collapses when
|
|
@@ -1183,4 +1185,256 @@ interface PublisherBreakdownListProps {
|
|
|
1183
1185
|
*/
|
|
1184
1186
|
declare function PublisherBreakdownList({ rows, defaultVisibleCount, padded, viewAllHref, renderLogo }: PublisherBreakdownListProps): react.JSX.Element;
|
|
1185
1187
|
|
|
1186
|
-
|
|
1188
|
+
declare const buttonVariants: (props?: ({
|
|
1189
|
+
variant?: "link" | "primary" | "secondary" | "ghost" | "danger" | null | undefined;
|
|
1190
|
+
size?: "icon" | "sm" | "md" | "lg" | null | undefined;
|
|
1191
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1192
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
1193
|
+
/** Render the button styling onto the single child element instead of a `<button>` (e.g. a router `<Link>`). */
|
|
1194
|
+
asChild?: boolean;
|
|
1195
|
+
/** Shows a spinner in place of the leading edge and disables the button. */
|
|
1196
|
+
loading?: boolean;
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* @pattern Button
|
|
1200
|
+
* @description Primary interactive control for actions. Five visual variants
|
|
1201
|
+
* (primary, secondary, ghost, danger, link) and four sizes (sm, md, lg, icon).
|
|
1202
|
+
* Supports polymorphic rendering via `asChild` (Radix Slot) to apply button
|
|
1203
|
+
* styling to a different element, e.g. a router `<Link>`. Also exports the
|
|
1204
|
+
* raw `buttonVariants` cva function for consumers composing button styling
|
|
1205
|
+
* onto something other than this component.
|
|
1206
|
+
* @tokens bg-brand-primaryAction, text-brand-onprimary, bg-surface, text-text-primary, border-border-interactive, hover:bg-subtle, bg-status-danger, text-status-onstatus, text-text-link, rounded-control, duration-(--mr-motion-duration-interactive), ease-interactive
|
|
1207
|
+
* @dependencies class-variance-authority, @radix-ui/react-slot, lucide-react
|
|
1208
|
+
* @variant primary - The one primary action on a screen. Solid brand fill.
|
|
1209
|
+
* @variant secondary - Any other real action competing for attention (Cancel, Export). Bordered, neutral fill.
|
|
1210
|
+
* @variant ghost - Low-emphasis action inside a dense toolbar or row where a border would add visual noise.
|
|
1211
|
+
* @variant danger - Destructive/irreversible actions (Delete, Remove). Never pair with `primary` in the same control group.
|
|
1212
|
+
* @variant link - Reads as inline text, not a control. Use inside body copy or where a full button would overpower the surrounding content.
|
|
1213
|
+
* @behavior `disabled` removes pointer events entirely (not just a style
|
|
1214
|
+
* change) and dims to 40% opacity. Focus handling is a deliberate exception:
|
|
1215
|
+
* most interactive components use a visible `focus-visible:outline-2` ring,
|
|
1216
|
+
* but Button suppresses it (`focus-visible:outline-hidden focus-visible:ring-0`)
|
|
1217
|
+
* and relies on its per-variant hover/brightness treatment instead. `loading`
|
|
1218
|
+
* implies `disabled` (and sets `aria-busy`), since a control mid-submit
|
|
1219
|
+
* shouldn't accept another click.
|
|
1220
|
+
* @usage
|
|
1221
|
+
* ```tsx
|
|
1222
|
+
* <Button variant="primary" size="md">Save changes</Button>
|
|
1223
|
+
* <Button variant="secondary" size="sm">Cancel</Button>
|
|
1224
|
+
* <Button variant="danger">Delete</Button>
|
|
1225
|
+
* <Button variant="primary" loading>Saving…</Button>
|
|
1226
|
+
* ```
|
|
1227
|
+
*/
|
|
1228
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1229
|
+
|
|
1230
|
+
interface FilterDropdownFooterProps {
|
|
1231
|
+
/** Omit to hide the Clear All action for dropdowns that don't need it. */
|
|
1232
|
+
onClear?: () => void;
|
|
1233
|
+
/** Fires when the primary action is pressed. */
|
|
1234
|
+
onApply: () => void;
|
|
1235
|
+
clearLabel?: string;
|
|
1236
|
+
applyLabel?: string;
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* @pattern FilterDropdownFooter
|
|
1240
|
+
* @description Fixed Apply/Clear All footer for quick-filter dropdowns —
|
|
1241
|
+
* pinned below the (independently scrollable) option list so it's always
|
|
1242
|
+
* visible. Shared by the Media/Advertiser/Date/Group By/Time Increment quick
|
|
1243
|
+
* filters on Sports Dashboard, Publisher Intel, and Opportunities.
|
|
1244
|
+
* @tokens border-border-default
|
|
1245
|
+
* @usage
|
|
1246
|
+
* ```tsx
|
|
1247
|
+
* <FilterDropdownFooter onApply={handleApply} onClear={handleClear} />
|
|
1248
|
+
* ```
|
|
1249
|
+
*/
|
|
1250
|
+
declare function FilterDropdownFooter({ onClear, onApply, clearLabel, applyLabel, }: FilterDropdownFooterProps): react.JSX.Element;
|
|
1251
|
+
|
|
1252
|
+
interface NameListModalProps {
|
|
1253
|
+
title: string;
|
|
1254
|
+
initialName: string;
|
|
1255
|
+
submitLabel: string;
|
|
1256
|
+
onCancel: () => void;
|
|
1257
|
+
onSubmit: (name: string) => void;
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* @pattern NameListModal
|
|
1261
|
+
* @description Minimal create/rename dialog — just the list name. Shared by
|
|
1262
|
+
* the Account Lists table and the list detail page so create/rename look
|
|
1263
|
+
* identical.
|
|
1264
|
+
* @tokens rounded-card, border-border-default, bg-surface, shadow-overlay, text-text-primary, text-text-secondary, rounded-control, bg-input, focus:border-brand-primaryAction
|
|
1265
|
+
* @behavior Escape closes the dialog via `onCancel`, same as clicking the
|
|
1266
|
+
* scrim backdrop. Submit is disabled until the name is non-empty (trimmed).
|
|
1267
|
+
* @usage
|
|
1268
|
+
* ```tsx
|
|
1269
|
+
* <NameListModal title="Rename list" initialName={list.name} submitLabel="Save" onCancel={close} onSubmit={rename} />
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
declare function NameListModal({ title, initialName, submitLabel, onCancel, onSubmit }: NameListModalProps): react.ReactPortal;
|
|
1273
|
+
|
|
1274
|
+
/** Shared styling for filter-bar chip triggers, so every dropdown chip matches. */
|
|
1275
|
+
declare function chipTriggerClass(): string;
|
|
1276
|
+
interface ChipContentProps {
|
|
1277
|
+
/** Small uppercase label above the value. */
|
|
1278
|
+
caption: string;
|
|
1279
|
+
/** The current selection, shown below the caption. */
|
|
1280
|
+
value: ReactNode;
|
|
1281
|
+
/** Optional leading icon rendered before the caption/value stack. */
|
|
1282
|
+
icon?: ReactNode;
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* @pattern ChipTrigger
|
|
1286
|
+
* @description Shared foundation for filter-bar chip triggers — pairs
|
|
1287
|
+
* `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
|
|
1288
|
+
* every dropdown chip across the app matches.
|
|
1289
|
+
* @tokens rounded-control, bg-input, border-border-strong, text-text-secondary, text-text-tertiary, text-text-primary, hover:bg-subtle, focus-visible:outline-border-focus, hover:text-text-primary
|
|
1290
|
+
* @behavior Provides only the shared `focus-visible:outline-2` keyboard-focus
|
|
1291
|
+
* treatment every dropdown trigger depends on — open/close, Escape, and
|
|
1292
|
+
* outside-click dismissal all live in each consumer, not here. A new dropdown
|
|
1293
|
+
* built on `chipTriggerClass` has to implement its own dismissal handling.
|
|
1294
|
+
* @usage
|
|
1295
|
+
* ```tsx
|
|
1296
|
+
* <button className={chipTriggerClass()}>
|
|
1297
|
+
* <ChipContent caption="Media Type" value="All" />
|
|
1298
|
+
* </button>
|
|
1299
|
+
* ```
|
|
1300
|
+
*/
|
|
1301
|
+
declare function ChipContent({ caption, value, icon }: ChipContentProps): react.JSX.Element;
|
|
1302
|
+
|
|
1303
|
+
interface ChipLike {
|
|
1304
|
+
key: string;
|
|
1305
|
+
label: string;
|
|
1306
|
+
groupLabel: string;
|
|
1307
|
+
}
|
|
1308
|
+
interface FilterChipBarProps<T extends ChipLike> {
|
|
1309
|
+
/** Any `{ key, label, groupLabel }` shape — only those fields are read. */
|
|
1310
|
+
chips: T[];
|
|
1311
|
+
onRemove: (chip: T) => void;
|
|
1312
|
+
onClearAll: () => void;
|
|
1313
|
+
/**
|
|
1314
|
+
* Chip keys that are kept but not applied (e.g. a filter the active
|
|
1315
|
+
* workspace can't resolve). Rendered inactive, still removable.
|
|
1316
|
+
*/
|
|
1317
|
+
parkedKeys?: Set<string>;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* @pattern FilterChipBar
|
|
1321
|
+
* @description Applied-filter chips — wrap freely across as many rows as
|
|
1322
|
+
* needed, every chip shown. Each chip reveals its filter category on hover
|
|
1323
|
+
* (tooltip + outline). "Clear all" trails the chips. Generic over the
|
|
1324
|
+
* page's own chip type — only the shared key/label/groupLabel fields are
|
|
1325
|
+
* used.
|
|
1326
|
+
* @tokens rounded-full, bg-subtle, text-text-secondary, text-text-link, text-text-tertiary, bg-text-primary, border-border-default, group-hover:bg-border-default, group-hover:ring-border-interactive, group-hover:text-text-primary, group-hover:text-text-secondary, hover:text-text-primary, shadow-raised, text-surface
|
|
1327
|
+
* @dependencies lucide-react
|
|
1328
|
+
* @behavior A parked chip (key in `parkedKeys`) renders with no fill and a
|
|
1329
|
+
* dashed edge instead of the solid applied style, and its hover tooltip
|
|
1330
|
+
* reads "Not in this workspace" instead of the filter's group label.
|
|
1331
|
+
* @usage
|
|
1332
|
+
* ```tsx
|
|
1333
|
+
* <FilterChipBar chips={activeChips} onRemove={removeChip} onClearAll={clearAll} />
|
|
1334
|
+
* ```
|
|
1335
|
+
*/
|
|
1336
|
+
declare function FilterChipBar<T extends ChipLike>({ chips, onRemove, onClearAll, parkedKeys }: FilterChipBarProps<T>): react.JSX.Element | null;
|
|
1337
|
+
|
|
1338
|
+
type SortDir = "asc" | "desc";
|
|
1339
|
+
/** An active column and direction, or `null` for the unsorted state. */
|
|
1340
|
+
type SortState<K extends string> = {
|
|
1341
|
+
key: K;
|
|
1342
|
+
dir: SortDir;
|
|
1343
|
+
} | null;
|
|
1344
|
+
/**
|
|
1345
|
+
* The state after clicking `key`. `firstDir` is what the column opens on,
|
|
1346
|
+
* since the useful first look differs by column: counts and dates want the
|
|
1347
|
+
* largest or newest first, names want A→Z.
|
|
1348
|
+
*/
|
|
1349
|
+
declare function cycleSort<K extends string>(current: SortState<K>, key: K, firstDir?: SortDir): SortState<K>;
|
|
1350
|
+
/**
|
|
1351
|
+
* `SortState` in the shape SortButton takes. SortButton wants a non-null
|
|
1352
|
+
* object and reads `key: null` as "no column active".
|
|
1353
|
+
*/
|
|
1354
|
+
declare function sortProp<K extends string>(sort: SortState<K>): {
|
|
1355
|
+
key: K | null;
|
|
1356
|
+
dir: SortDir;
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
interface SortButtonProps<K extends string> {
|
|
1360
|
+
label: string;
|
|
1361
|
+
sortKey: K;
|
|
1362
|
+
/** Current sort; a null `key` renders every SortButton inactive. See `sortProp`. */
|
|
1363
|
+
sort: {
|
|
1364
|
+
key: K | null;
|
|
1365
|
+
dir: SortDir;
|
|
1366
|
+
};
|
|
1367
|
+
onSort: (key: K) => void;
|
|
1368
|
+
/** True when there are no rows to order — hides the arrow, drops the click. */
|
|
1369
|
+
disabled?: boolean;
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* @pattern SortButton
|
|
1373
|
+
* @description Design-system rule: every sortable table column header uses
|
|
1374
|
+
* this exact icon/color treatment. Sortable-but-inactive columns show a
|
|
1375
|
+
* neutral ArrowUpDown in text-tertiary at half opacity, coming up to full on
|
|
1376
|
+
* hover so the column reads as clickable; the active column swaps to a
|
|
1377
|
+
* direction arrow (ArrowUp/ArrowDown) colored with the brand action blue.
|
|
1378
|
+
* @tokens text-text-tertiary, text-brand-primaryAction, hover:text-text-primary
|
|
1379
|
+
* @dependencies lucide-react
|
|
1380
|
+
* @behavior Pair with `cycleSort`/`sortProp` (exported alongside) for the
|
|
1381
|
+
* standard three-state cycle — sort, reverse, then unsorted. `disabled` keeps
|
|
1382
|
+
* the column's inherited header color rather than dimming it — the column
|
|
1383
|
+
* isn't unavailable, there's just no data under it.
|
|
1384
|
+
* @usage
|
|
1385
|
+
* ```tsx
|
|
1386
|
+
* const [sort, setSort] = useState<SortState<'spend'>>(null)
|
|
1387
|
+
* <SortButton label="Spend" sortKey="spend" sort={sortProp(sort)} onSort={(k) => setSort(cycleSort(sort, k))} />
|
|
1388
|
+
* ```
|
|
1389
|
+
*/
|
|
1390
|
+
declare function SortButton<K extends string>({ label, sortKey, sort, onSort, disabled }: SortButtonProps<K>): react.JSX.Element;
|
|
1391
|
+
|
|
1392
|
+
interface PagerProps {
|
|
1393
|
+
/** The current page, 1-indexed. */
|
|
1394
|
+
page: number;
|
|
1395
|
+
totalPages: number;
|
|
1396
|
+
onPage: (p: number) => void;
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* @pattern Pager
|
|
1400
|
+
* @description Compact prev/next pager with a windowed page-number list —
|
|
1401
|
+
* shows every page up to 7 total, otherwise 1 … current±1 … last with
|
|
1402
|
+
* ellipsis gaps. Shared by My Exports and Account Matcher.
|
|
1403
|
+
* @tokens rounded-control, text-text-secondary, bg-brand-primaryAction, text-brand-onprimary, hover:bg-subtle, hover:text-text-primary, text-text-tertiary
|
|
1404
|
+
* @dependencies lucide-react
|
|
1405
|
+
* @usage
|
|
1406
|
+
* ```tsx
|
|
1407
|
+
* <Pager page={page} totalPages={totalPages} onPage={setPage} />
|
|
1408
|
+
* ```
|
|
1409
|
+
*/
|
|
1410
|
+
declare function Pager({ page, totalPages, onPage }: PagerProps): react.JSX.Element;
|
|
1411
|
+
|
|
1412
|
+
declare const SIZES: {
|
|
1413
|
+
/** Matches a 15px lucide icon exactly, so a workspace name in a menu row
|
|
1414
|
+
* left-aligns with labels in icon-led rows above and below it. */
|
|
1415
|
+
readonly xs: "h-[15px] w-[15px] rounded-[4px] text-[8px] tracking-tight";
|
|
1416
|
+
readonly sm: "h-6 w-6 text-[10px]";
|
|
1417
|
+
readonly md: "h-7 w-7 text-[11px]";
|
|
1418
|
+
readonly lg: "h-11 w-11 text-[15px]";
|
|
1419
|
+
};
|
|
1420
|
+
interface WorkspaceAvatarProps {
|
|
1421
|
+
/** Omit for the unscoped "All data workspace". */
|
|
1422
|
+
name?: string;
|
|
1423
|
+
size?: keyof typeof SIZES;
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* @pattern WorkspaceAvatar
|
|
1427
|
+
* @description The square tile that identifies a workspace in a switch
|
|
1428
|
+
* list — first 1–2 word initials of the workspace name. Pass no name for
|
|
1429
|
+
* the unscoped "All data workspace", which renders "AD" through the same
|
|
1430
|
+
* rule so the unscoped default reads as a peer of named workspaces rather
|
|
1431
|
+
* than a special case.
|
|
1432
|
+
* @tokens rounded-control, bg-subtle, text-text-secondary
|
|
1433
|
+
* @usage
|
|
1434
|
+
* ```tsx
|
|
1435
|
+
* <WorkspaceAvatar name="Capital One" size="sm" />
|
|
1436
|
+
* ```
|
|
1437
|
+
*/
|
|
1438
|
+
declare function WorkspaceAvatar({ name, size }: WorkspaceAvatarProps): react.JSX.Element;
|
|
1439
|
+
|
|
1440
|
+
export { 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, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, InfoTip, type InfoTipProps, LineChartPlaceholder, type LineChartPlaceholderProps, 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, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, sortProp };
|