@mediaradar/design-components 0.38.0 → 0.40.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.d.ts CHANGED
@@ -5,6 +5,7 @@ import { VariantProps } from 'class-variance-authority';
5
5
 
6
6
  /**
7
7
  * @pattern InfoTip
8
+ * @status stable
8
9
  * @description Info tooltip — a small info glyph that opens a portalled,
9
10
  * viewport-clamped bubble. Mirrors the Publisher Intel header affordance so
10
11
  * page subtitles can collapse into the eyebrow.
@@ -53,17 +54,21 @@ declare function InfoTip({ text, size, label, trigger }: InfoTipProps): react.JS
53
54
 
54
55
  /**
55
56
  * @pattern AdvertiserQuickFilter
57
+ * @status stable
56
58
  * @description Search-first quick filter. Mirrors the standard filter-chip
57
- * shape (two-line caption + value + chevron) but never preloads the option
58
- * list -- users must search first, since the advertiser pool is effectively
59
- * endless. Selections are pinned in a "Selected (n)" section at the top so
60
- * they're never lost when the user runs another search. Named for its
61
- * original (and still primary) use, but the copy props make it reusable for
62
- * any dimension that's also search-first in its own filter tray, so the
63
- * dimension reads the same in the quick bar as it does there.
59
+ * shape (two-line caption + value + chevron) but by default never preloads the
60
+ * option list -- users must search first, since the advertiser pool is
61
+ * effectively endless. With `prepopulate`, a short, known list (leagues,
62
+ * brands on one dashboard) shows in full on open and the search box only
63
+ * narrows it; `pageSize` then lists it a page at a time. Selections are pinned
64
+ * in a "Selected (n)" section at the top so they're never lost when the user
65
+ * runs another search. Named for its original (and still primary) use, but
66
+ * the copy props make it reusable for any dimension that's also search-first
67
+ * in its own filter tray, so the dimension reads the same in the quick bar as
68
+ * it does there.
64
69
  * @tokens text-control-caption, rounded-control, rounded-card, border-border-default, border-border-strong,
65
70
  * border-border-interactive, border-border-focus, bg-surface, bg-input,
66
- * shadow-overlay, text-text-primary, text-text-secondary, text-text-tertiary,
71
+ * shadow-overlay, text-xs, text-text-primary, text-text-secondary, text-text-tertiary,
67
72
  * text-text-link, bg-brand-primaryAction, text-brand-onprimary,
68
73
  * hover:bg-subtle, hover:text-text-primary, placeholder:text-text-tertiary
69
74
  * @dependencies lucide-react
@@ -73,15 +78,21 @@ declare function InfoTip({ text, size, label, trigger }: InfoTipProps): react.JS
73
78
  * to `onChange`. With `showFooter`, only the Apply button commits -- every
74
79
  * other close path discards the draft, so the trigger label never previews
75
80
  * an unapplied change. The pinned "selected" section persists across
76
- * searches and collapses when the search is cleared.
81
+ * searches and collapses when the search is cleared. With `pageSize`, a new
82
+ * query or reopening the tray goes back to the first page.
77
83
  * @a11y Trigger is a <button> with aria-expanded and aria-haspopup; the menu is
78
84
  * role="dialog", closed on Escape. Option rows are role="checkbox" with
79
85
  * aria-checked, so each row is itself the control -- don't wrap them in
80
- * another clickable element.
86
+ * another clickable element. With `prepopulate`, a visually hidden
87
+ * role="status" line announces the result count ("12 results, showing 10")
88
+ * as the list changes. "Show N more" is a real <button>; after it loads a
89
+ * page, focus moves to the first new option, so keyboard users continue
90
+ * where the list grew instead of losing focus when the button goes away.
81
91
  * @usage
82
92
  * ```tsx
83
93
  * <AdvertiserQuickFilter options={advertisers} selected={selected} onChange={setSelected} />
84
94
  * <AdvertiserQuickFilter options={advertisers} selected={selected} onChange={setSelected} showFooter clearValue={defaults} />
95
+ * <AdvertiserQuickFilter caption="League" options={leagues} selected={selected} onChange={setSelected} prepopulate pageSize={10} />
85
96
  * ```
86
97
  */
87
98
  interface AdvertiserQuickFilterProps {
@@ -111,6 +122,19 @@ interface AdvertiserQuickFilterProps {
111
122
  * selection -- still committed back, still removable -- but they narrow
112
123
  * nothing, so the trigger label leaves them out of the count. */
113
124
  parked?: string[];
125
+ /**
126
+ * List every option as soon as the tray opens, instead of the "start
127
+ * typing" prompt; the search box then only narrows the list. For a short,
128
+ * known list. Leave it off for an effectively endless pool (advertisers).
129
+ * Defaults to false: search first, exactly as before.
130
+ */
131
+ prepopulate?: boolean;
132
+ /**
133
+ * With `prepopulate`: list this many rows at a time, with a "Show N more"
134
+ * button for the next page. Omit to list every option. Ignored without
135
+ * `prepopulate`.
136
+ */
137
+ pageSize?: number;
114
138
  /** Search box placeholder. Override alongside the other copy props when
115
139
  * the filter isn't advertisers, so the empty and no-results states name
116
140
  * the right dimension. */
@@ -126,7 +150,8 @@ interface AdvertiserQuickFilterProps {
126
150
  * (`${testIdPrefix}-trigger`), the popover (`-popover`), the search input
127
151
  * (`-search`), the selected-section toggle (`-selected-toggle`), the
128
152
  * select-all-visible row (`-select-all-visible`), each option row
129
- * (`-option-<slugified-id>`), and the footer's Clear All (`-clear-all`) and
153
+ * (`-option-<slugified-id>`), the "Show N more" row (`-show-more`), and
154
+ * the footer's Clear All (`-clear-all`) and
130
155
  * Apply (`-apply`). Omit entirely for no test-id wiring at all --
131
156
  * added specifically so an existing Playwright suite keyed off these ids
132
157
  * (mr-clientapps' `AdvertisersPicker`) doesn't lose its locators when
@@ -134,10 +159,11 @@ interface AdvertiserQuickFilterProps {
134
159
  */
135
160
  testIdPrefix?: string;
136
161
  }
137
- declare function AdvertiserQuickFilter({ caption, options, selected, onChange, align, icon, showFooter, clearValue, parked, searchPlaceholder, promptLabel, noResultsHint, clearLabel, testIdPrefix, }: AdvertiserQuickFilterProps): react.JSX.Element;
162
+ declare function AdvertiserQuickFilter({ caption, options, selected, onChange, align, icon, showFooter, clearValue, parked, prepopulate, pageSize, searchPlaceholder, promptLabel, noResultsHint, clearLabel, testIdPrefix, }: AdvertiserQuickFilterProps): react.JSX.Element;
138
163
 
139
164
  /**
140
165
  * @pattern AdvertiserSearchPrompt
166
+ * @status stable
141
167
  * @description Pre-search empty state for a search-first picker — shown the
142
168
  * moment the tray opens, before anything has been typed. Used for option
143
169
  * pools too large to preload (the advertiser list is effectively endless),
@@ -193,6 +219,7 @@ interface BadgeProps {
193
219
  }
194
220
  /**
195
221
  * @pattern Badge
222
+ * @status stable
196
223
  * @description The one small label that annotates something else: a count on
197
224
  * a filter, a status, a category, an AI marker, a flag over artwork. Two
198
225
  * props -- `tone` (what kind of thing) and `kind` (shape and case) -- which
@@ -262,6 +289,7 @@ interface DeltaProps {
262
289
  }
263
290
  /**
264
291
  * @pattern Delta
292
+ * @status stable
265
293
  * @description A change over time -- the +6.2% / -2.1% beside a figure. Green
266
294
  * up, red down, always with an explicit sign.
267
295
  * @props
@@ -301,6 +329,7 @@ declare function Delta({ value, suffix, arrow, period, className }: DeltaProps):
301
329
 
302
330
  /**
303
331
  * @pattern CheckBox
332
+ * @status stable
304
333
  * @audited 2026-11-12
305
334
  * @description Tri-state checkbox rendered as a `<button>` (not a native
306
335
  * `<input type="checkbox">`), so it can carry an indeterminate "some but not
@@ -383,6 +412,7 @@ interface CheckBoxProps {
383
412
  declare function CheckBox({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation, testId, title, className, }: CheckBoxProps): react.JSX.Element;
384
413
  /**
385
414
  * @pattern CheckBoxBox
415
+ * @status stable
386
416
  * @description Presentational checkbox -- draws the same box as `CheckBox`
387
417
  * and nothing else. Use it when an ancestor already carries the interaction
388
418
  * and the checkbox semantics (a clickable option row, a `<label>`), since a
@@ -561,6 +591,7 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
561
591
 
562
592
  /**
563
593
  * @pattern SearchBar
594
+ * @status stable
564
595
  * @description Filter-bar keyword search. 'default' is a plain keyword
565
596
  * input; 'filterable' adds an attached match-type dropdown sharing one
566
597
  * bordered control, mirroring the legacy Creative Intel search + match-type
@@ -645,6 +676,7 @@ declare function SearchBar({ placeholder, value, onChange, variant, size, matchV
645
676
 
646
677
  /**
647
678
  * @pattern SectionRail
679
+ * @status stable
648
680
  * @audited 2026-11-12
649
681
  * @description Generic titled section wrapper for a row of cards — a
650
682
  * horizontal scroll rail on mobile/tablet (snap, bleeds to edges), a
@@ -696,6 +728,7 @@ declare function SectionRail({ title, titleSerif, subtitle, viewAllLabel, viewAl
696
728
 
697
729
  /**
698
730
  * @pattern DataScopeFilter
731
+ * @status stable
699
732
  * @description "Data" scope chip -- toggles the filter bar between All data
700
733
  * and Final-only data (data that's finalized across the selected media
701
734
  * formats, for stable report-ready numbers). One boolean, one control,
@@ -734,6 +767,7 @@ declare function DataScopeFilter({ value, onChange, align }: DataScopeFilterProp
734
767
 
735
768
  /**
736
769
  * @pattern SelectFilter
770
+ * @status stable
737
771
  * @description Single-select filter chip -- the caption-over-value trigger
738
772
  * shape shared with AdvertiserQuickFilter/DateRangeFilter, opening a
739
773
  * lightweight listbox of plain string options. Portal-rendered to
@@ -925,6 +959,7 @@ declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-
925
959
  declare const QUIET_ACTION_CLASS = "rounded-control text-[13px] font-medium text-text-link transition-colors hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus";
926
960
  /**
927
961
  * @pattern NoResultsEmptyState
962
+ * @status stable
928
963
  * @description Guided empty state for a query that returned nothing.
929
964
  * Deliberately one state for two causes, because the user can't tell them
930
965
  * apart and the fix is the same either way -- loosen the filters or widen the
@@ -1171,6 +1206,7 @@ declare function PieChartPlaceholder({ height, legendRows }: PieChartPlaceholder
1171
1206
 
1172
1207
  /**
1173
1208
  * @pattern StackedColumnPlaceholder
1209
+ * @status stable
1174
1210
  * @audited 2026-11-12
1175
1211
  * @description Neutral, dataless stand-in for a 100% stacked column -- a
1176
1212
  * single banded column beside a blank legend. `axis` follows the live card
@@ -1207,6 +1243,7 @@ declare function StackedColumnPlaceholder({ height, width, legendRows, axis, }:
1207
1243
 
1208
1244
  /**
1209
1245
  * @pattern Tooltip
1246
+ * @status stable
1210
1247
  * @description Portalled hover/focus tooltip. Two ways to attach a trigger:
1211
1248
  * wrap `children` (the default -- an inline trigger, e.g. a truncated table
1212
1249
  * cell or a chart legend entry), or pass `anchorRef` for an element that
@@ -1320,6 +1357,7 @@ declare function Tooltip({ label, children, anchorRef, className, whenTruncated,
1320
1357
 
1321
1358
  /**
1322
1359
  * @pattern AdvertiserNoResults
1360
+ * @status stable
1323
1361
  * @description Shown when a search-first picker's search returns nothing --
1324
1362
  * gives an actionable next step rather than just a bare "no results"
1325
1363
  * message. Named for its original (and still primary) use across
@@ -1684,6 +1722,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1684
1722
  }
1685
1723
  /**
1686
1724
  * @pattern Button
1725
+ * @status stable
1687
1726
  * @description The one control for every clickable action, from the main call
1688
1727
  * to action on a screen down to a quiet toolbar utility. Six variants
1689
1728
  * (primary, secondary, ghost, danger, dangerGhost, link) across four sizes
@@ -1758,6 +1797,7 @@ interface FilterDropdownFooterProps {
1758
1797
  }
1759
1798
  /**
1760
1799
  * @pattern FilterDropdownFooter
1800
+ * @status stable
1761
1801
  * @description Fixed Apply/Clear All footer for quick-filter dropdowns —
1762
1802
  * pinned below the (independently scrollable) option list so it's always
1763
1803
  * visible. Shared by the Media/Advertiser/Date/Group By/Time Increment quick
@@ -1805,6 +1845,7 @@ interface NameListModalProps {
1805
1845
  }
1806
1846
  /**
1807
1847
  * @pattern NameListModal
1848
+ * @status stable
1808
1849
  * @description Create/rename dialog — a name field, and optionally a few
1809
1850
  * checkboxes under it. Shared by the Account Lists table and the list detail
1810
1851
  * page so create/rename look identical; `fieldLabel`/`placeholder` relabel it
@@ -1845,6 +1886,7 @@ interface ChipContentProps {
1845
1886
  }
1846
1887
  /**
1847
1888
  * @pattern ChipTrigger
1889
+ * @status stable
1848
1890
  * @description Shared foundation for filter-bar chip triggers — pairs
1849
1891
  * `chipTriggerClass` with `ChipContent` for the caption/value/icon layout, so
1850
1892
  * every dropdown chip across the app matches.
@@ -1886,6 +1928,7 @@ interface FilterChipBarProps<T extends ChipLike> {
1886
1928
  }
1887
1929
  /**
1888
1930
  * @pattern FilterChipBar
1931
+ * @status stable
1889
1932
  * @description Applied-filter chips — wrap freely across as many rows as
1890
1933
  * needed, every chip shown. Each chip reveals its filter category on hover
1891
1934
  * (tooltip + outline). "Clear all" trails the chips. Generic over the
@@ -1959,6 +2002,7 @@ interface SortButtonProps<K extends string> {
1959
2002
  }
1960
2003
  /**
1961
2004
  * @pattern SortButton
2005
+ * @status stable
1962
2006
  * @audited 2026-11-12
1963
2007
  * @description Design-system rule: every sortable table column header uses
1964
2008
  * this exact icon/color treatment. Sortable-but-inactive columns show a
@@ -2007,6 +2051,7 @@ interface PagerProps {
2007
2051
  }
2008
2052
  /**
2009
2053
  * @pattern Pager
2054
+ * @status stable
2010
2055
  * @description Compact prev/next pager with a windowed page-number list —
2011
2056
  * shows every page up to 7 total, otherwise 1 … current±1 … last with
2012
2057
  * ellipsis gaps, each number formatted for the locale ("14,433"). Shared by
@@ -2049,6 +2094,7 @@ interface WorkspaceAvatarProps {
2049
2094
  }
2050
2095
  /**
2051
2096
  * @pattern WorkspaceAvatar
2097
+ * @status stable
2052
2098
  * @audited 2026-11-12
2053
2099
  * @description The square tile that identifies a workspace in a switch
2054
2100
  * list — first 1–2 word initials of the workspace name. Pass no name for
@@ -2093,6 +2139,7 @@ interface ToastProps {
2093
2139
  }
2094
2140
  /**
2095
2141
  * @pattern Toast
2142
+ * @status stable
2096
2143
  * @description Transient feedback about the page or the task: "12 accounts
2097
2144
  * removed", "Export started". Floats at the bottom of the window so it never
2098
2145
  * pushes the page around, dismisses itself, and may carry one action.
@@ -2178,6 +2225,7 @@ declare function Tag({ children, className }: TagProps): react.JSX.Element;
2178
2225
 
2179
2226
  /**
2180
2227
  * @pattern TablePagination
2228
+ * @status stable
2181
2229
  * @audited 2026-11-12
2182
2230
  * @description Full table-footer pagination bar: a rows-per-page select, a
2183
2231
  * first/prev/pages/next/last pager, and the resolved "1 – 25 of N results"
@@ -2286,6 +2334,7 @@ interface MultiSelectGroup {
2286
2334
  }
2287
2335
  /**
2288
2336
  * @pattern MultiSelectFilter
2337
+ * @status stable
2289
2338
  * @description Quick-access multi-select chip — mirrors the DateRangeFilter
2290
2339
  * button shape (two-line caption + value with a chevron) and opens a
2291
2340
  * searchable checkbox popover. Used for the page-level Media type /
@@ -2406,6 +2455,7 @@ interface ToggleProps {
2406
2455
  }
2407
2456
  /**
2408
2457
  * @pattern Toggle
2458
+ * @status stable
2409
2459
  * @description The app's on/off switch. Use it for a setting that takes effect
2410
2460
  * as a state the user keeps — "only include enriched creatives", "email me a
2411
2461
  * digest" — where a checkbox would read as an item being ticked off a list.
@@ -2441,6 +2491,7 @@ interface AISparkProps {
2441
2491
  }
2442
2492
  /**
2443
2493
  * @pattern AISpark
2494
+ * @status stable
2444
2495
  * @description Assistant glyph — the lucide Sparkles icon stroked with the
2445
2496
  * MR orange→violet assistant gradient. Each instance scopes its own gradient
2446
2497
  * id, and the stops follow light/dark mode.
@@ -2458,6 +2509,7 @@ interface FreshnessProps {
2458
2509
  }
2459
2510
  /**
2460
2511
  * @pattern Freshness
2512
+ * @status stable
2461
2513
  * @audited 2026-11-12
2462
2514
  * @description Freshness dot — prefixed to card meta rows so a row of 4
2463
2515
  * timestamps stops reading as a wall of identical text. Color carries the
@@ -2488,6 +2540,7 @@ interface SectionHeadingProps {
2488
2540
  }
2489
2541
  /**
2490
2542
  * @pattern SectionHeading
2543
+ * @status stable
2491
2544
  * @description The title of a section within a page -- "Start from a template",
2492
2545
  * "Saved reports". One size everywhere (16px semibold), so every page's sections
2493
2546
  * read at the same level under the page title. Optional one-line description
@@ -2545,6 +2598,7 @@ interface PageHeaderProps {
2545
2598
  }
2546
2599
  /**
2547
2600
  * @pattern PageHeader
2601
+ * @status stable
2548
2602
  * @description The top of a page: its title (the page's only h1), an optional
2549
2603
  * one-line description under it, and the page's main actions on the right.
2550
2604
  * Title 20px over a 14px description, 2px apart, so the two read as one unit;
@@ -2600,6 +2654,7 @@ interface ModalProps {
2600
2654
  }
2601
2655
  /**
2602
2656
  * @pattern Modal
2657
+ * @status stable
2603
2658
  * @description A dialog over a dimmed page: title, optional one-line
2604
2659
  * description, content, and a footer of buttons. Four widths -- sm 440 for a
2605
2660
  * confirm, md 640 for a form, lg 880 for a table or a list, xl 1200 for a
@@ -2661,6 +2716,7 @@ interface EmptyStateProps {
2661
2716
  }
2662
2717
  /**
2663
2718
  * @pattern EmptyState
2719
+ * @status stable
2664
2720
  * @description What shows where content would be: an icon, a title saying
2665
2721
  * what's empty, one line on what to do next, and one action. Two sizes -- sm
2666
2722
  * inside a table, card or dropdown; md when it fills a page or a panel.
@@ -2710,6 +2766,7 @@ interface TabsProps<T extends string = string> {
2710
2766
  }
2711
2767
  /**
2712
2768
  * @pattern Tabs
2769
+ * @status stable
2713
2770
  * @description Underline tabs that switch between the sections of one page --
2714
2771
  * Overview, Creative, Contacts. The selected tab is semibold with a brand
2715
2772
  * underline; the row sits on a hairline. For switching how the same data is
@@ -2758,6 +2815,7 @@ interface SegmentedControlProps<T extends string = string> {
2758
2815
  }
2759
2816
  /**
2760
2817
  * @pattern SegmentedControl
2818
+ * @status stable
2761
2819
  * @description A pill of 2 to 4 options that switches how the same data is
2762
2820
  * shown -- Spend / Share, Chart / Table, Weekly / Monthly. The selected option
2763
2821
  * is a raised white pill. Heights match the control scale: sm 32, md 40. For
@@ -2802,6 +2860,7 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "si
2802
2860
  }
2803
2861
  /**
2804
2862
  * @pattern TextField
2863
+ * @status stable
2805
2864
  * @description A single-line text input with an optional label, hint and
2806
2865
  * error. Same heights as Button -- sm 32, md 40, lg 44 -- so a field and a
2807
2866
  * button side by side line up. 13px text, the strong border every control you
@@ -2849,6 +2908,7 @@ interface DrawerProps {
2849
2908
  }
2850
2909
  /**
2851
2910
  * @pattern Drawer
2911
+ * @status stable
2852
2912
  * @description A panel that slides in from the right over the dimmed page:
2853
2913
  * title, optional one-line description, a scrolling body, and an optional
2854
2914
  * footer pinned at the bottom. Three widths -- sm 440 for filters, md 640 for
@@ -2952,6 +3012,7 @@ interface DataTableProps<T, K extends string = string> {
2952
3012
  }
2953
3013
  /**
2954
3014
  * @pattern DataTable
3015
+ * @status stable
2955
3016
  * @description The shared table: a card frame, an optional title row, the
2956
3017
  * header band, rows with hairline dividers and a hover wash, and the empty
2957
3018
  * and loading states. Each screen describes its columns -- label, cell,
@@ -3019,6 +3080,7 @@ interface MediaLabelProps {
3019
3080
  }
3020
3081
  /**
3021
3082
  * @pattern MediaLabel
3083
+ * @status stable
3022
3084
  * @description The small solid label naming a creative's media type -- TV,
3023
3085
  * CTV, Digital, Social, Radio, Newspaper, Magazine -- usually laid over the
3024
3086
  * corner of a thumbnail. One colour per type, from the `color.media.*`
@@ -3058,6 +3120,7 @@ interface SuggestionChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElemen
3058
3120
  }
3059
3121
  /**
3060
3122
  * @pattern SuggestionChip
3123
+ * @status stable
3061
3124
  * @description An outlined grey pill offering a ready-made search or
3062
3125
  * question: "Or try: Luxury SUV brands", an AI follow-up, a "Did you mean".
3063
3126
  * Clicking it runs that suggestion. Text only, normal case.
@@ -3096,6 +3159,7 @@ interface ToggleChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
3096
3159
  }
3097
3160
  /**
3098
3161
  * @pattern ToggleChip
3162
+ * @status stable
3099
3163
  * @description A pill you switch on and off, in a row where several can be
3100
3164
  * on at once: countries, media types, quick filters. On, it takes a pale
3101
3165
  * tint of the brand blue, a brand border and a tick before the label, so the state
@@ -3136,6 +3200,7 @@ interface CopyButtonProps {
3136
3200
  }
3137
3201
  /**
3138
3202
  * @pattern CopyButton
3203
+ * @status stable
3139
3204
  * @description Copies a value to the clipboard and confirms on the button
3140
3205
  * itself: the copy icon becomes a green tick for two seconds (a labelled
3141
3206
  * button also reads "Copied"), then it's ready again. Two looks -- icon only,
@@ -3177,6 +3242,7 @@ interface InlineMessageProps {
3177
3242
  }
3178
3243
  /**
3179
3244
  * @pattern InlineMessage
3245
+ * @status stable
3180
3246
  * @description A message that sits in the page, next to what it's about, and
3181
3247
  * stays until it's dealt with: "A similar organization already exists",
3182
3248
  * "3 rows couldn't be matched". Icon, a short title, an optional line, and
package/dist/index.js CHANGED
@@ -94,7 +94,7 @@ function InfoTip({ text, size = 11, label = "More information", trigger = "click
94
94
 
95
95
  // src/AdvertiserQuickFilter.tsx
96
96
  import { useCallback, useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";
97
- import { Check, ChevronDown, ListChecks, Search as Search2, X } from "lucide-react";
97
+ import { Check, ChevronDown, ListChecks, Plus, Search as Search2, X } from "lucide-react";
98
98
 
99
99
  // src/AdvertiserSearchPrompt.tsx
100
100
  import { Search } from "lucide-react";
@@ -149,11 +149,21 @@ function ChipContent({ caption, value, icon }) {
149
149
  }
150
150
 
151
151
  // src/AdvertiserQuickFilter.tsx
152
- import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
152
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
153
153
  function cx(...parts) {
154
154
  return parts.filter(Boolean).join(" ");
155
155
  }
156
156
  var SELECT_ALL_THRESHOLD = 5;
157
+ function usePaging(total, pageSize, resetKey) {
158
+ const [pages, setPages] = useState2(1);
159
+ const [prevKey, setPrevKey] = useState2(resetKey);
160
+ if (prevKey !== resetKey) {
161
+ setPrevKey(resetKey);
162
+ setPages(1);
163
+ }
164
+ const shown = pageSize && pageSize > 0 ? Math.min(total, pages * pageSize) : total;
165
+ return { shown, remaining: total - shown, showMore: () => setPages((p) => p + 1) };
166
+ }
157
167
  function slug(value) {
158
168
  return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
159
169
  }
@@ -167,6 +177,8 @@ function AdvertiserQuickFilter({
167
177
  showFooter = false,
168
178
  clearValue = [],
169
179
  parked = [],
180
+ prepopulate = false,
181
+ pageSize,
170
182
  searchPlaceholder = "Search for an advertiser",
171
183
  promptLabel = "an advertiser name",
172
184
  noResultsHint = "Try checking your spelling or searching for a broader brand name.",
@@ -221,10 +233,28 @@ function AdvertiserQuickFilter({
221
233
  () => draft.map((id) => options.find((o) => o.id === id)).filter(Boolean),
222
234
  [draft, options]
223
235
  );
224
- const results = useMemo(
225
- () => ql ? options.filter((o) => !draft.includes(o.id) && o.label.toLowerCase().includes(ql)) : [],
226
- [ql, options, draft]
236
+ const matches = useMemo(
237
+ () => ql || prepopulate ? options.filter((o) => !draft.includes(o.id) && (!ql || o.label.toLowerCase().includes(ql))) : [],
238
+ [ql, prepopulate, options, draft]
227
239
  );
240
+ const { shown: pageEnd, remaining, showMore } = usePaging(
241
+ matches.length,
242
+ prepopulate ? pageSize : void 0,
243
+ `${open}|${ql}`
244
+ );
245
+ const results = useMemo(() => matches.slice(0, pageEnd), [matches, pageEnd]);
246
+ const resultsRef = useRef2(null);
247
+ const focusFrom = useRef2(null);
248
+ const loadMore = () => {
249
+ focusFrom.current = results.length;
250
+ showMore();
251
+ };
252
+ useEffect2(() => {
253
+ const from = focusFrom.current;
254
+ if (from === null) return;
255
+ focusFrom.current = null;
256
+ resultsRef.current?.querySelectorAll('[role="checkbox"]')[from]?.focus();
257
+ }, [pageEnd]);
228
258
  const visibleIds = results.map((o) => o.id);
229
259
  const allVisibleSelected = visibleIds.length > 0 && visibleIds.every((id) => draft.includes(id));
230
260
  const toggleAllVisible = () => setDraft(
@@ -330,14 +360,18 @@ function AdvertiserQuickFilter({
330
360
  o.id
331
361
  )) })
332
362
  ] }),
333
- !ql ? /* @__PURE__ */ jsx4(AdvertiserSearchPrompt, { label: promptLabel }) : results.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-1.5 px-4 py-8 text-center", children: [
363
+ prepopulate && /* @__PURE__ */ jsxs4("p", { role: "status", className: "sr-only", "data-testid": testIdPrefix && `${testIdPrefix}-result-count`, children: [
364
+ matches.length === 1 ? "1 result" : `${matches.length} results`,
365
+ remaining > 0 ? `, showing ${results.length}` : ""
366
+ ] }),
367
+ !ql && !prepopulate ? /* @__PURE__ */ jsx4(AdvertiserSearchPrompt, { label: promptLabel }) : !ql && results.length === 0 ? null : results.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-1.5 px-4 py-8 text-center", children: [
334
368
  /* @__PURE__ */ jsxs4("p", { className: "text-[13px] font-medium text-text-primary", children: [
335
369
  "No results found for \u201C",
336
370
  q.trim(),
337
371
  "\u201D"
338
372
  ] }),
339
373
  /* @__PURE__ */ jsx4("p", { className: "text-[12px] leading-snug text-text-tertiary", children: noResultsHint })
340
- ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
374
+ ] }) : /* @__PURE__ */ jsxs4("div", { ref: resultsRef, children: [
341
375
  results.length > SELECT_ALL_THRESHOLD && /* @__PURE__ */ jsxs4(
342
376
  "button",
343
377
  {
@@ -360,7 +394,22 @@ function AdvertiserQuickFilter({
360
394
  testId: testIdPrefix && `${testIdPrefix}-option-${slug(o.id)}`
361
395
  },
362
396
  o.id
363
- ))
397
+ )),
398
+ remaining > 0 && !!pageSize && /* @__PURE__ */ jsxs4(
399
+ "button",
400
+ {
401
+ type: "button",
402
+ "data-testid": testIdPrefix && `${testIdPrefix}-show-more`,
403
+ onClick: loadMore,
404
+ className: "flex w-full items-center gap-1.5 rounded-control px-2 py-2 text-left text-xs font-semibold text-text-link transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
405
+ children: [
406
+ /* @__PURE__ */ jsx4(Plus, { size: 13, "aria-hidden": "true" }),
407
+ "Show ",
408
+ Math.min(remaining, pageSize),
409
+ " more"
410
+ ]
411
+ }
412
+ )
364
413
  ] })
365
414
  ] }),
366
415
  showFooter ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between border-t border-border-default px-3 py-2.5", children: [
@@ -1024,7 +1073,7 @@ function NavBtn({ children, onClick, ...rest }) {
1024
1073
  // src/SearchBar.tsx
1025
1074
  import { useEffect as useEffect4, useId as useId3, useRef as useRef4, useState as useState4 } from "react";
1026
1075
  import { AlertCircle, Check as Check3, ChevronDown as ChevronDown3, Search as Search3, X as X2 } from "lucide-react";
1027
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1076
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1028
1077
  var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
1029
1078
  var DEFAULT_SEARCH_MATCH = { mode: "anyWord", wordJoin: "Or" };
1030
1079
  var MODE_LABEL = {
@@ -1152,7 +1201,7 @@ function SearchBar({
1152
1201
  selected: matchValue.mode === "anyWord",
1153
1202
  onSelect: () => onMatchChange?.({ mode: "anyWord", wordJoin: matchValue.wordJoin }),
1154
1203
  testId: testIdPrefix && `${testIdPrefix}-mode-anyWord`,
1155
- description: /* @__PURE__ */ jsx9(Fragment3, { children: "Find creatives that contain your keyword(s) using an \u201COr\u201D (match any) or \u201CAnd\u201D (match all) conditional in any order." }),
1204
+ description: /* @__PURE__ */ jsx9(Fragment2, { children: "Find creatives that contain your keyword(s) using an \u201COr\u201D (match any) or \u201CAnd\u201D (match all) conditional in any order." }),
1156
1205
  infoText: "The Or/And choice applies only when Any Word is the active search mode.",
1157
1206
  extra: /* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-3", children: [
1158
1207
  /* @__PURE__ */ jsx9(
@@ -2370,7 +2419,7 @@ function SelectedSection({ count, open, onToggle, children, testIdPrefix }) {
2370
2419
  // src/SelectionPicker.tsx
2371
2420
  import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useMemo as useMemo3, useRef as useRef11, useState as useState9 } from "react";
2372
2421
  import { createPortal as createPortal4 } from "react-dom";
2373
- import { Search as Search4, Plus, Info as Info2, ChevronRight as ChevronRight3, ChevronDown as ChevronDown8, Check as Check6, List, Loader2 } from "lucide-react";
2422
+ import { Search as Search4, Plus as Plus2, Info as Info2, ChevronRight as ChevronRight3, ChevronDown as ChevronDown8, Check as Check6, List, Loader2 } from "lucide-react";
2374
2423
 
2375
2424
  // src/Tabs.tsx
2376
2425
  import { useRef as useRef10 } from "react";
@@ -2465,7 +2514,7 @@ function SegmentedControl({
2465
2514
  }
2466
2515
 
2467
2516
  // src/SelectionPicker.tsx
2468
- import { Fragment as Fragment4, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
2517
+ import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
2469
2518
  function cx8(...parts) {
2470
2519
  return parts.filter(Boolean).join(" ");
2471
2520
  }
@@ -2561,7 +2610,7 @@ function SelectionPicker({
2561
2610
  };
2562
2611
  const rowGridCols = showInfoColumn ? "grid-cols-[36px_1fr_44px]" : "grid-cols-[36px_1fr]";
2563
2612
  return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4", children: [
2564
- helper && /* @__PURE__ */ jsxs25(Fragment4, { children: [
2613
+ helper && /* @__PURE__ */ jsxs25(Fragment3, { children: [
2565
2614
  /* @__PURE__ */ jsx27("p", { className: "text-dense text-text-secondary", children: helper }),
2566
2615
  /* @__PURE__ */ jsx27("hr", { className: "-mx-5 -mt-2 border-border-default sm:-mx-6" })
2567
2616
  ] }),
@@ -2716,7 +2765,7 @@ function SelectionPicker({
2716
2765
  kidSel ? "text-text-tertiary" : "text-text-link hover:bg-subtle"
2717
2766
  ),
2718
2767
  children: [
2719
- kidSel ? /* @__PURE__ */ jsx27(Check6, { size: 13 }) : /* @__PURE__ */ jsx27(Plus, { size: 13 }),
2768
+ kidSel ? /* @__PURE__ */ jsx27(Check6, { size: 13 }) : /* @__PURE__ */ jsx27(Plus2, { size: 13 }),
2720
2769
  kidSel ? "Added" : "Add"
2721
2770
  ]
2722
2771
  }
@@ -2746,7 +2795,7 @@ function SelectionPicker({
2746
2795
  ] }),
2747
2796
  source === "lists" && /* @__PURE__ */ jsxs25("div", { className: "flex min-w-0 flex-col gap-3", children: [
2748
2797
  /* @__PURE__ */ jsx27("p", { className: "text-dense text-text-secondary", children: "Select an account list to add all of its accounts at once. Your workspace stays in sync as the list is updated." }),
2749
- accountLists && accountLists.length > 0 ? /* @__PURE__ */ jsxs25(Fragment4, { children: [
2798
+ accountLists && accountLists.length > 0 ? /* @__PURE__ */ jsxs25(Fragment3, { children: [
2750
2799
  /* @__PURE__ */ jsx27(ScrollFade, { className: "flex max-h-99 flex-col gap-2 overflow-y-auto pr-0.5", children: accountLists.map((list) => {
2751
2800
  const on = (selectedListIds ?? []).includes(list.id);
2752
2801
  return /* @__PURE__ */ jsxs25(
@@ -2768,7 +2817,7 @@ function SelectionPicker({
2768
2817
  "flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
2769
2818
  on ? "text-brand-primaryAction" : "text-text-secondary"
2770
2819
  ),
2771
- children: on ? /* @__PURE__ */ jsx27(Check6, { size: 16 }) : /* @__PURE__ */ jsx27(Plus, { size: 16 })
2820
+ children: on ? /* @__PURE__ */ jsx27(Check6, { size: 16 }) : /* @__PURE__ */ jsx27(Plus2, { size: 16 })
2772
2821
  }
2773
2822
  ),
2774
2823
  /* @__PURE__ */ jsxs25("span", { className: "min-w-0 flex-1", children: [
@@ -3892,7 +3941,7 @@ function DateRangePicker({
3892
3941
  // src/MultiSelectFilter.tsx
3893
3942
  import { useCallback as useCallback4, useEffect as useEffect13, useRef as useRef15, useState as useState14 } from "react";
3894
3943
  import { ChevronDown as ChevronDown10, Search as Search5, X as X5 } from "lucide-react";
3895
- import { Fragment as Fragment5, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
3944
+ import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
3896
3945
  function MultiSelectFilter({
3897
3946
  caption,
3898
3947
  options = [],
@@ -4017,7 +4066,7 @@ function MultiSelectFilter({
4017
4066
  ),
4018
4067
  role: "dialog",
4019
4068
  "aria-label": caption,
4020
- children: loading ? /* @__PURE__ */ jsx40(MenuLoading, {}) : error ? /* @__PURE__ */ jsx40(MenuError, { onRetry }) : /* @__PURE__ */ jsxs36(Fragment5, { children: [
4069
+ children: loading ? /* @__PURE__ */ jsx40(MenuLoading, {}) : error ? /* @__PURE__ */ jsx40(MenuError, { onRetry }) : /* @__PURE__ */ jsxs36(Fragment4, { children: [
4021
4070
  searchable && /* @__PURE__ */ jsx40("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ jsxs36("div", { className: "flex h-8 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5 focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus", children: [
4022
4071
  /* @__PURE__ */ jsx40(Search5, { size: 14, className: "text-text-secondary", "aria-hidden": "true" }),
4023
4072
  /* @__PURE__ */ jsx40(
@@ -4155,10 +4204,10 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
4155
4204
  // src/AISpark.tsx
4156
4205
  import { useId as useId6 } from "react";
4157
4206
  import { Sparkles } from "lucide-react";
4158
- import { Fragment as Fragment6, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
4207
+ import { Fragment as Fragment5, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
4159
4208
  function AISpark({ size = 16, className }) {
4160
4209
  const id = useId6();
4161
- return /* @__PURE__ */ jsxs37(Fragment6, { children: [
4210
+ return /* @__PURE__ */ jsxs37(Fragment5, { children: [
4162
4211
  /* @__PURE__ */ jsx42("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ jsx42("defs", { children: /* @__PURE__ */ jsxs37("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
4163
4212
  /* @__PURE__ */ jsx42("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
4164
4213
  /* @__PURE__ */ jsx42("stop", { offset: "100%", className: "[stop-color:#9474ff] in-data-[theme=dark]:[stop-color:#a488ff]" })