@mediaradar/design-components 0.63.0 → 0.64.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.cts CHANGED
@@ -2733,6 +2733,8 @@ declare function Tag({ children, className, testIdPrefix }: TagProps): react.JSX
2733
2733
  * so nothing moves.
2734
2734
  * @use under a full-page table: the results of a search or a list the user
2735
2735
  * works through, where the total and the page size matter.
2736
+ * @use as the `footer` of a `sticky` DataTable, which pins it to the bottom
2737
+ * of the screen once the page scrolls.
2736
2738
  * @avoid in a card or a compact list -- use Pager, which is only the page
2737
2739
  * controls and fits the narrower space.
2738
2740
  * @tokens text-dense, rounded-control, text-text-primary, text-text-secondary, text-text-tertiary, bg-subtle, hover:bg-subtle, hover:text-text-primary, focus-visible:outline-border-focus
@@ -2868,7 +2870,10 @@ interface MultiSelectGroup {
2868
2870
  * there's no error state, the click just does nothing. Group parents are
2869
2871
  * tri-state and toggle all of their children in one action.
2870
2872
  * @a11y Trigger is a <button> with aria-expanded; the menu is role="dialog" and
2871
- * Escape closes it. Option rows carry their own checkbox semantics. Focus
2873
+ * Escape closes it. Each option row is a button with role="checkbox" and
2874
+ * aria-checked, so screen readers hear whether it's ticked; a group parent
2875
+ * with some children ticked is aria-checked="mixed". The box drawn inside
2876
+ * (CheckBoxBox) is aria-hidden. Focus
2872
2877
  * is not moved into the menu on open, so keyboard users tab into it in DOM
2873
2878
  * order. The loading rows carry role="status" and the error line role="alert".
2874
2879
  * @behavior `valueLabel` replaces the trigger's value text, for when a picked
@@ -2877,17 +2882,32 @@ interface MultiSelectGroup {
2877
2882
  * definition under an option's label, keyed by option or group id, for a term
2878
2883
  * the user may not know. `note` is one line of explanation under the list.
2879
2884
  * Clear all applies the default at once and closes the menu.
2885
+ * @behavior `hideCaption` drops the visible caption for a 40px trigger with
2886
+ * only the value, SelectFilter's `hideCaption`; the caption becomes the
2887
+ * trigger's aria-label. `max` caps the ticks: at the cap every unticked
2888
+ * option greys out (text-text-tertiary, a disabled box, no hover wash) and
2889
+ * keeps its place in the tab order with aria-disabled; hover or keyboard
2890
+ * focus shows why in a Tooltip (`maxReason`, default "Up to {max}. Untick one
2891
+ * to add another."), and a click does nothing, live or with `showFooter`. A
2892
+ * group parent ticks all its children or none, so a parent whose unticked
2893
+ * children wouldn't all fit under the cap greys out the same way; unticking
2894
+ * a full parent always works.
2880
2895
  * @behavior `loading` swaps the list for grey placeholder rows and `error`
2881
2896
  * for a plain "Couldn't load options." line with a Try again link
2882
2897
  * (`onRetry`). The trigger never changes in either state.
2898
+ * @use `hideCaption` in a toolbar above a table, beside a SearchBar `md`,
2899
+ * when the value names itself; `max` with `valueLabel` ("Charted · 3 of 3")
2900
+ * for picking what a chart above the table shows.
2883
2901
  * @usage
2884
2902
  * ```tsx
2885
2903
  * <MultiSelectFilter caption="Media" options={mediaOptions} selected={selected} onChange={setSelected} />
2904
+ * <MultiSelectFilter caption="Charted brands" hideCaption max={3} valueLabel={`Charted · ${picked.length} of 3`}
2905
+ * options={brands} selected={picked} onChange={setPicked} />
2886
2906
  * <MultiSelectFilter caption="Market" options={markets} selected={selected} onChange={setSelected}
2887
2907
  * hints={{ national: "Ads that run nationwide" }} note="Nothing picked means every market." />
2888
2908
  * ```
2889
2909
  */
2890
- declare function MultiSelectFilter({ caption, options, groups, counts, variant, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, loading, error, onRetry, valueLabel, hints, note, className, testIdPrefix, }: Omit<CommonProps, 'testIdPrefix'> & {
2910
+ declare function MultiSelectFilter({ caption, options, groups, counts, variant, selected, onChange, allLabel, searchable, searchPlaceholder, align, fullIsAll, min, icon, showFooter, clearValue, menuWidthClass, plainParent, fullWidth, loading, error, onRetry, valueLabel, hints, note, hideCaption, max, maxReason, className, testIdPrefix, }: Omit<CommonProps, 'testIdPrefix'> & {
2891
2911
  /**
2892
2912
  * `data-testid` on the wrapper, and the prefix for the trigger
2893
2913
  * (`${testIdPrefix}-trigger`) and the open menu (`${testIdPrefix}-popover`).
@@ -2954,6 +2974,21 @@ declare function MultiSelectFilter({ caption, options, groups, counts, variant,
2954
2974
  hints?: Record<string, string>;
2955
2975
  /** One line of explanation under the list, above the footer. */
2956
2976
  note?: React.ReactNode;
2977
+ /**
2978
+ * Drop the visible caption for a 40px trigger showing only the value, as
2979
+ * SelectFilter's `hideCaption` -- for a toolbar above a table, where the
2980
+ * value names itself ("Charted · 3 of 7"; pass it as `valueLabel`). The
2981
+ * caption becomes the trigger's accessible name.
2982
+ */
2983
+ hideCaption?: boolean;
2984
+ /**
2985
+ * The most options that can be ticked. Once that many are, the others grey
2986
+ * out and say why on hover and focus (`maxReason`); ticking past it does
2987
+ * nothing, live or with `showFooter`.
2988
+ */
2989
+ max?: number;
2990
+ /** Why the other options can't be ticked at the cap. Default "Up to {max}. Untick one to add another." */
2991
+ maxReason?: string;
2957
2992
  }): react.JSX.Element;
2958
2993
  type MultiSelectFilterProps = Parameters<typeof MultiSelectFilter>[0];
2959
2994
 
@@ -3512,8 +3547,8 @@ interface DrawerProps extends CommonProps {
3512
3547
  * @behavior Portals to <body>. Slides in from the right over 200ms while the
3513
3548
  * scrim fades in, and slides back out before it unmounts; with reduced motion
3514
3549
  * it appears and goes without moving. Escape, a click on the dimmed page and
3515
- * the × all call `onClose` -- in a filter drawer, unapplied changes are dropped,
3516
- * as with Cancel. Focus moves to the first field (else the first footer
3550
+ * the × all call `onClose` -- FilterDrawer asks "Discard changes?" there
3551
+ * first when it holds picks not yet applied. Focus moves to the first field (else the first footer
3517
3552
  * button) on open, Tab stays inside, and focus goes back to whatever opened it
3518
3553
  * on close. The page behind stops scrolling while it's open.
3519
3554
  * @a11y role="dialog" with aria-modal, named by its title and described by
@@ -3560,6 +3595,13 @@ interface DataTableColumn<T, K extends string = string> {
3560
3595
  numeric?: boolean;
3561
3596
  /** The rank (1, 2, 3 …) before the name: narrow, right-aligned, grey. */
3562
3597
  rank?: boolean;
3598
+ /**
3599
+ * A column that sits before the name (a trend sparkline): put it before the
3600
+ * name in `columns`. On a wide table it pins with the name, like the
3601
+ * checkbox, chevron and rank. Left-aligned unless `numeric`; `sm` (96)
3602
+ * wide unless `width` says otherwise. Blank on sub-rows and the totals row.
3603
+ */
3604
+ lead?: boolean;
3563
3605
  /**
3564
3606
  * What the column means, for a non-obvious measure only ("Share of the
3565
3607
  * set's total spend"). Dotted underline on the header; shows on hover and
@@ -3713,10 +3755,29 @@ interface DataTableProps<T, K extends string = string> extends CommonProps {
3713
3755
  onRetry?: () => void;
3714
3756
  /** What the body shows when `rows` is empty. Defaults to NoResultsEmptyState. */
3715
3757
  empty?: ReactNode;
3716
- /** Caps the height so the body scrolls under a pinned header: sm 320, md 480, lg 640. */
3758
+ /** Caps the height so the body scrolls under a pinned header: sm 320, md 480, lg 640. Ignored with `sticky`. */
3717
3759
  maxHeight?: "sm" | "md" | "lg";
3718
- /** Inside the frame, under the rows -- a `Pager`. A full-page table puts `TablePagination` after the table instead. */
3760
+ /**
3761
+ * Inside the frame, under the rows -- a `Pager`. A full-page table puts
3762
+ * `TablePagination` after the table instead; with `sticky`, pass it here
3763
+ * and the table pins it to the bottom of the screen once the page scrolls.
3764
+ */
3719
3765
  footer?: ReactNode;
3766
+ /**
3767
+ * For a full-page data table only -- the table that is the page's main
3768
+ * content; never in a modal, a drawer or a dashboard card. The header row
3769
+ * stays in view while the page scrolls, right under the page's StickyBar,
3770
+ * and `footer` (the page's TablePagination) sits under the frame, pinned to
3771
+ * the bottom of the screen once the page starts to scroll. Pinned first
3772
+ * columns and sideways scrolling work as usual.
3773
+ */
3774
+ sticky?: boolean;
3775
+ /**
3776
+ * With `sticky`: how far from the top of the screen the header row sticks,
3777
+ * in pixels. Default: the height of the page's StickyBar, or 0 without one.
3778
+ * Set it for a page with its own sticky bar that isn't a StickyBar.
3779
+ */
3780
+ stickyTop?: number;
3720
3781
  className?: string;
3721
3782
  /** `data-testid` on the frame; each sortable header's button gets `${testIdPrefix}-sort-<key>`. */
3722
3783
  testIdPrefix?: string;
@@ -3752,7 +3813,10 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3752
3813
  * in place, as a panel or as sub-rows in the same columns, or open a side
3753
3814
  * panel on click; the name links to the entity's overview (UXD-196). A
3754
3815
  * totals row can sit first, and the reader's own brand can be marked with a
3755
- * light brand fill on its row or column.
3816
+ * light brand fill on its row or column. A full-page table (`sticky`) keeps
3817
+ * its header row in view under the page's StickyBar and pins its pager to the
3818
+ * bottom of the screen once the page scrolls. A table wider than its space
3819
+ * always shows a thin scroll bar.
3756
3820
  * @variant default - Default. Tables people read and act on.
3757
3821
  * @variant compact - Reference data and long lists.
3758
3822
  * @tokens rounded-card, rounded-small, border, border-border-default, bg-surface,
@@ -3763,7 +3827,10 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3763
3827
  * animate-pulse, border-t, decoration-text-tertiary, rounded-control,
3764
3828
  * focus-visible:outline-border-focus, border-r-border-default,
3765
3829
  * bg-brand-primaryTint, pl-10, pl-9, cursor-not-allowed, sr-only,
3766
- * bg-linear-to-r, from-brand-primaryAction/10, border-border-focus
3830
+ * bg-linear-to-r, from-brand-primaryAction/10, border-border-focus,
3831
+ * [&::-webkit-scrollbar-thumb]:bg-border-strong, bg-canvas,
3832
+ * duration-(--mr-motion-duration-interactive), ease-interactive,
3833
+ * supports-[not_selector(::-webkit-scrollbar)]:[scrollbar-color:var(--mr-color-border-strong)_var(--mr-color-subtle)]
3767
3834
  * @behavior Sorting: a `sortable` column's header gets a SortButton; clicks
3768
3835
  * cycle the column's `firstDir`, then the reverse, then back to
3769
3836
  * `defaultSort` (`cycleSort`), and call `onSortChange`. The sorted column
@@ -3814,9 +3881,30 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3814
3881
  * with a limit on ticks, where ticking every row would break it.
3815
3882
  * `selectionBar={false}` leaves out the "3 selected … Clear" bar, for a
3816
3883
  * picker table where ticking chooses what a chart shows.
3884
+ * A `lead` column (a trend sparkline) sits before the name: it counts as part
3885
+ * of the row's start, so it pins with the checkbox, chevron, rank and name,
3886
+ * keeps its own alignment (left unless numeric), is `sm` wide by default, and
3887
+ * is blank on sub-rows and the totals row.
3817
3888
  * `maxHeight` makes the body
3818
3889
  * scroll under a pinned header; wide tables always scroll sideways rather than
3819
- * squeeze.
3890
+ * squeeze, with a thin scroll bar at the bottom of the frame on every
3891
+ * computer (a rounded border-strong thumb on a subtle track; drawn by the
3892
+ * table, so a Mac trackpad's hide-while-idle setting doesn't hide it; Firefox
3893
+ * gets the same colours and follows the system setting).
3894
+ * `sticky` (a full-page table only): once the header row scrolls up to the
3895
+ * page's StickyBar (or `stickyTop` pixels from the top), a copy of it stays
3896
+ * there, right under the bar, until the last row goes by. The copy scrolls
3897
+ * sideways with the frame, keeps the pinned columns and their edge, and its
3898
+ * sort buttons work with the mouse. The frame's own scroll bar stays at the
3899
+ * bottom of the frame. `footer` (the page's TablePagination) sits under the
3900
+ * frame on the page background, `sticky` to the bottom of the screen: hidden
3901
+ * at first, it slides up once the page scrolls and stays pinned to the
3902
+ * end, where it settles under the last row without a jump; a line above it
3903
+ * while pinned. Scrolled back to the very top, it hides again, as on first
3904
+ * load. A table that fits on screen shows it under the last row from
3905
+ * the start, so it's never out of reach; it's also shown while it has
3906
+ * keyboard focus. With reduced motion it appears without moving. `maxHeight`
3907
+ * is ignored with `sticky`.
3820
3908
  * @a11y A real <table>. Named by `title` (aria-labelledby) or `aria-label`.
3821
3909
  * Sorted columns carry aria-sort on the header cell; the sort control is a
3822
3910
  * button inside it. A header's `info` shows on hover and keyboard focus and
@@ -3838,6 +3926,9 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3838
3926
  * The brand fill is never the only cue: the app puts a "You" badge in the
3839
3927
  * row or column header beside it, and colour alone says nothing to someone
3840
3928
  * who can't see it. `NoValue` reads its reason, not "dash". `loading` sets aria-busy.
3929
+ * With `sticky`, the header copy is aria-hidden and out of the tab order
3930
+ * (tabindex -1 on its buttons): screen readers and the keyboard use the real
3931
+ * header, so nothing is announced or reached twice.
3841
3932
  * @use for every table of rows and columns, in a page or in a card.
3842
3933
  * @use `title` for the table's name: it sits above the frame as a Section
3843
3934
  * heading, with `subtitle` and `action` beside it. On a dashboard, beside
@@ -3848,6 +3939,8 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3848
3939
  * the cell of a change column. A bar or badge beside a figure goes before
3849
3940
  * it, so the figure ends at the right edge.
3850
3941
  * @use `rank` for a 1, 2, 3 … column before the name.
3942
+ * @use `lead` for another column before the name (a trend sparkline); it
3943
+ * pins with the name on a wide table and is blank on sub-rows and totals.
3851
3944
  * @use a total column right after the name, styled like every other figure:
3852
3945
  * no fill, no bold.
3853
3946
  * @use `info` only for non-obvious measures (share of spend, index), never
@@ -3855,6 +3948,8 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3855
3948
  * @use `TableLink` for the name, to the entity's overview; end an expanded
3856
3949
  * row with a "View overview" link.
3857
3950
  * @use `footer={<Pager />}` in a card; `TablePagination` after a full-page table.
3951
+ * @use `sticky` with `footer={<TablePagination />}` for the table that is a
3952
+ * page's main content, under the page's filters in a StickyBar.
3858
3953
  * @use `subRows` for children that share the parent's columns (products
3859
3954
  * under a brand); `renderExpanded` for anything else (a trend, a list).
3860
3955
  * @use `totalsRow` for a sum of the rows in a totals row (not a total column).
@@ -3870,6 +3965,8 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3870
3965
  * @avoid zebra stripes, or a row click that navigates: a row click opens the
3871
3966
  * row or a side panel, and only the name goes to another page.
3872
3967
  * @avoid `onRowClick` together with `renderExpanded` or `subRows`.
3968
+ * @avoid `sticky` in a modal, a drawer or a dashboard card: only a full-page
3969
+ * data table sticks.
3873
3970
  * @avoid a layout of label/value pairs -- that's a description list, not a table.
3874
3971
  * @usage
3875
3972
  * ```tsx
@@ -3913,9 +4010,62 @@ declare function TableLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnc
3913
4010
  * selectAll={false}
3914
4011
  * columns={columns}
3915
4012
  * />
4013
+ *
4014
+ * // A full-page table: the header stays under the filters, the pager at the bottom
4015
+ * <StickyBar><FilterChipBar … /></StickyBar>
4016
+ * <DataTable
4017
+ * sticky
4018
+ * aria-label="Advertisers"
4019
+ * rowKey={(r) => r.id}
4020
+ * rows={pageRows}
4021
+ * columns={columns}
4022
+ * footer={<TablePagination page={page} perPage={25} totalItems={total} onPageChange={setPage} />}
4023
+ * />
4024
+ * ```
4025
+ */
4026
+ declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded: renderExpandedProp, canExpand, subRows: subRowsProp, subRowNoun, totalsRow, totalsLabel, onRowClick, rowClickLabel, highlightRow, rowLabel, selected, onSelectedChange, totalCount, onSelectAll, selectedCount, selectionActions, selectionDisabled, selectionBar, selectAll, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight: maxHeightProp, footer, sticky, stickyTop, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
4027
+
4028
+ interface StickyBarProps extends CommonProps {
4029
+ /** The page's filter bar: AllFiltersButton, the chips, the date range. */
4030
+ children: ReactNode;
4031
+ className?: string;
4032
+ }
4033
+ /**
4034
+ * @pattern StickyBar
4035
+ * @since 0.64.0
4036
+ * @description Keeps a full-page table's filter bar at the top of the screen
4037
+ * while the page scrolls. Once pinned it becomes a full-width band in the
4038
+ * page colour, edge to edge of what scrolls, with a hairline under it and no
4039
+ * shadow, so rows scrolling under it never show through; at rest there is no
4040
+ * band. A DataTable with `sticky` on the same page finds it and
4041
+ * pins its header row right under it, whatever the bar's height. The filter
4042
+ * bar inside keeps its own card or row.
4043
+ * @tokens bg-canvas, border-b, border-border-default
4044
+ * @behavior Sticks to the very top of whatever the page scrolls in (the
4045
+ * window or the app's scrolling `<main>`, past that box's own padding), and
4046
+ * only within its parent: put it in the
4047
+ * same column as the table, so it stays stuck down to the table's last row.
4048
+ * While stuck it carries `data-stuck`, reaches out past its column's sides to
4049
+ * the scroll box's edges (the filter bar inside stays where it was) and shows
4050
+ * its hairline (border-border-default; transparent at rest, so nothing moves). DataTable measures the bar's height as it
4051
+ * changes (chips wrapping onto a second line), so its header stays flush
4052
+ * under it.
4053
+ * @a11y Adds no role or landmark: the filter bar inside keeps its own.
4054
+ * @use for the filter bar above a full-page data table with `sticky`.
4055
+ * @avoid in a modal, a drawer or a dashboard card -- only a page's own
4056
+ * filters stick.
4057
+ * @avoid more than one StickyBar on a page.
4058
+ * @usage
4059
+ * ```tsx
4060
+ * <div className="flex flex-col gap-4">
4061
+ * <StickyBar>
4062
+ * <FilterChipBar … />
4063
+ * </StickyBar>
4064
+ * <DataTable sticky … footer={<TablePagination … />} />
4065
+ * </div>
3916
4066
  * ```
3917
4067
  */
3918
- declare function DataTable<T, K extends string = string>({ columns, rows, rowKey, title, subtitle, action, variant, titleAs, sort, onSortChange, defaultSort, renderExpanded: renderExpandedProp, canExpand, subRows: subRowsProp, subRowNoun, totalsRow, totalsLabel, onRowClick, rowClickLabel, highlightRow, rowLabel, selected, onSelectedChange, totalCount, onSelectAll, selectedCount, selectionActions, selectionDisabled, selectionBar, selectAll, density, loading, loadingRows, refreshing, onRetry, empty, maxHeight, footer, className, testIdPrefix, ...rest }: DataTableProps<T, K>): react.JSX.Element;
4068
+ declare function StickyBar({ children, className, testIdPrefix }: StickyBarProps): react.JSX.Element;
3919
4069
 
3920
4070
  type MediaType = "TV" | "CTV" | "Digital" | "Social" | "Radio" | "Newspaper" | "Magazine";
3921
4071
  interface MediaLabelProps extends CommonProps {
@@ -4153,7 +4303,12 @@ interface FilterDrawerSection<Id extends string = string> {
4153
4303
  }
4154
4304
  interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4155
4305
  open: boolean;
4156
- /** Escape, the dimmed page, the ×, and Cancel. Unapplied picks are dropped. */
4306
+ /**
4307
+ * Closes the drawer: Cancel, and the ×, Escape or the dimmed page. Those
4308
+ * three first ask "Discard changes?" while there are picks not yet
4309
+ * applied to the page (`hasChanges`); Discard then calls this. Unapplied
4310
+ * picks are dropped.
4311
+ */
4157
4312
  onClose: () => void;
4158
4313
  sections: FilterDrawerSection<Id>[];
4159
4314
  /** One filter's contents, shown when its row is opened. The page owns the draft. */
@@ -4173,6 +4328,14 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4173
4328
  focus?: Id | null;
4174
4329
  /** Drawer width: sm 440 (default) for filters; md 640 when a filter holds a deep hierarchy. */
4175
4330
  size?: DrawerSize;
4331
+ /**
4332
+ * Whether the draft holds picks the page doesn't show yet: closing with the
4333
+ * ×, Escape or the dimmed page asks "Discard changes?" while it's true.
4334
+ * Pass it from the page (draft differs from what's applied). Left out, the
4335
+ * drawer compares each filter's `count` and `badge` with what they were
4336
+ * when it opened, which misses a swap that keeps the same count.
4337
+ */
4338
+ hasChanges?: boolean;
4176
4339
  }
4177
4340
  /**
4178
4341
  * @pattern FilterDrawer
@@ -4183,8 +4346,9 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4183
4346
  * that filter as the whole panel, with a back arrow and a line under its
4184
4347
  * title. The page keeps the draft and renders each filter's contents;
4185
4348
  * FilterDrawer owns the list, the navigation, the slide between the two and
4186
- * the footer: Clear inside a filter; Clear all, Cancel and See
4187
- * results on the list. Opened from AllFiltersButton, which carries the
4349
+ * the footer: Clear and Apply inside a filter; Clear all, Cancel and See
4350
+ * results on the list. Closing with picks not yet applied asks "Discard
4351
+ * changes?" first. Opened from AllFiltersButton, which carries the
4188
4352
  * total. A filter with picks shows their number as a count badge (the
4189
4353
  * style guide's Badge, brandSolid, count) on its row and beside its title
4190
4354
  * in its panel.
@@ -4195,17 +4359,26 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4195
4359
  * ease-interactive, motion-reduce:transition-none, overflow-x-clip, pt-4,
4196
4360
  * focus-visible:outline-offset-1
4197
4361
  * @dependencies lucide-react, react-dom
4198
- * @behavior Picks are kept in the page's draft as they're made: a filter's
4199
- * panel has no apply button, only Clear, and the back arrow beside its
4200
- * title returns to the list. See results, on the list only, applies the draft. Moving between
4201
- * filters loses nothing; Cancel, Escape and the dimmed page drop them. Each
4362
+ * @behavior Picks are kept in the page's draft as they're made. A filter's
4363
+ * panel ends with Clear and Apply: Apply returns to the list, where the
4364
+ * filter's row shows its count; the back arrow beside its title does the
4365
+ * same. See results, on the list only, applies the draft to the page. Moving
4366
+ * between filters loses nothing. The ×, Escape and the dimmed page, with
4367
+ * picks not yet applied (`hasChanges`, or a filter's count or badge changed
4368
+ * since opening), ask "Discard changes?" in a small Modal over the drawer,
4369
+ * with one line, "Your filter picks haven't been applied.": Keep editing
4370
+ * (secondary, focused first; Escape and its × do the same) returns to the
4371
+ * drawer as it was, Discard (danger) closes it and drops them. Nothing changed, they
4372
+ * close straight away. Cancel always closes without asking. Each
4202
4373
  * opening starts on the list (or on `focus`). Opening a filter slides it in
4203
4374
  * from the right as the list moves a third of the way out to the left; the
4204
4375
  * back arrow reverses it. 200ms, the Drawer's own timing; with reduced motion
4205
4376
  * it swaps without moving. Clear in a filter calls `onClearSection`, Clear all
4206
4377
  * on the list `onClearAll`, See results `onApply` and then `onClose`.
4207
4378
  * @a11y Built on Drawer: role="dialog", focus trap, Escape, focus back to the
4208
- * opener. Each row is a button. Opening a filter moves focus to its
4379
+ * opener. The discard question is a Modal (role="dialog", its own focus trap)
4380
+ * with focus on Keep editing; Keep editing puts focus back where it was in the
4381
+ * drawer, Discard on the drawer's opener. Each row is a button. Opening a filter moves focus to its
4209
4382
  * back arrow ("Back to all filters"); going back puts focus on the row you left,
4210
4383
  * so the keyboard never lands back at the top. The outgoing panel is inert
4211
4384
  * while it slides out.
@@ -4228,7 +4401,7 @@ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
4228
4401
  * />
4229
4402
  * ```
4230
4403
  */
4231
- declare function FilterDrawer<Id extends string>({ open, onClose, sections, renderSection, activeCount: _activeCount, onClearSection, onClearAll, onApply, focus, size, testIdPrefix, }: FilterDrawerProps<Id>): react.JSX.Element;
4404
+ declare function FilterDrawer<Id extends string>({ open, onClose, sections, renderSection, activeCount: _activeCount, onClearSection, onClearAll, onApply, focus, size, hasChanges, testIdPrefix, }: FilterDrawerProps<Id>): react.JSX.Element;
4232
4405
 
4233
4406
  interface AllFiltersButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children">, CommonProps {
4234
4407
  /** Filters narrowing the page; the badge shows when above 0. */
@@ -4519,4 +4692,4 @@ declare function LoadError({ onRetry, children }: {
4519
4692
  /** The thin moving line along a card's top edge while new data loads over old. */
4520
4693
  declare function RefreshLine(): react.JSX.Element;
4521
4694
 
4522
- export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, AllFiltersButton, type AllFiltersButtonProps, type AxisMonthLabel, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, BarList, type BarListProps, type BarListRow, Button, type ButtonProps, Card, type CardProps, ChartLegend, type ChartLegendProps, ChartSkeleton, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, type CommonProps, CopyButton, type CopyButtonProps, type Currency, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateFormatOptions, type DateGranularity, type DateOrder, DateRangeFilter, type DateRangeFilterProps, type DateRangeFormatOptions, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, Figure, type FigureProps, FilterChipBar, type FilterChipBarProps, FilterDrawer, type FilterDrawerProps, type FilterDrawerSection, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LegendItem, type LegendItemProps, type LegendMark, LineChartPlaceholder, type LineChartPlaceholderProps, LoadError, LongWait, MediaLabel, type MediaLabelProps, type MediaType, Menu, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, Modal, type ModalProps, type ModalSize, type MoneyFormatOptions, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NO_VALUE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, NoValue, type NumberFormatOptions, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, PrimaryBadge, type PrimaryBadgeProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, RefreshLine, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, type SearchScope, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, type SegmentedOption, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, Skeleton, SkeletonLines, type SkeletonProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, StatStrip, type StatStripProps, StatStripSkeleton, StatTile, type StatTileProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TableLink, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, defaultDateOrder, formatCount, formatCountFull, formatDate, formatDateRange, formatDateTime, formatIsoDate, formatMoney, formatMoneyFull, formatMonth, formatMonthAxis, formatOpenRange, formatPercent, formatQuarter, formatRelative, formatTime, formatWeek, noResultsBody, resolveRange, sortProp, useDelayedLoading };
4695
+ export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, AllFiltersButton, type AllFiltersButtonProps, type AxisMonthLabel, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, BarList, type BarListProps, type BarListRow, Button, type ButtonProps, Card, type CardProps, ChartLegend, type ChartLegendProps, ChartSkeleton, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, type CommonProps, CopyButton, type CopyButtonProps, type Currency, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateFormatOptions, type DateGranularity, type DateOrder, DateRangeFilter, type DateRangeFilterProps, type DateRangeFormatOptions, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, Figure, type FigureProps, FilterChipBar, type FilterChipBarProps, FilterDrawer, type FilterDrawerProps, type FilterDrawerSection, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LegendItem, type LegendItemProps, type LegendMark, LineChartPlaceholder, type LineChartPlaceholderProps, LoadError, LongWait, MediaLabel, type MediaLabelProps, type MediaType, Menu, MenuItem, type MenuItemProps, MenuLabel, type MenuProps, MenuSeparator, Modal, type ModalProps, type ModalSize, type MoneyFormatOptions, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NO_VALUE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, NoValue, type NumberFormatOptions, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, PrimaryBadge, type PrimaryBadgeProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, RefreshLine, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, type SearchScope, SectionHeading, type SectionHeadingProps, SectionRail, type SectionRailProps, SegmentedControl, type SegmentedControlProps, type SegmentedControlSize, type SegmentedOption, SelectAllVisible, type SelectAllVisibleProps, SelectFilter, type SelectFilterProps, SelectedSection, type SelectedSectionProps, SelectionPicker, type SelectionPickerAccountList, type SelectionPickerProps, Skeleton, SkeletonLines, type SkeletonProps, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, StatStrip, type StatStripProps, StatStripSkeleton, StatTile, type StatTileProps, StickyBar, type StickyBarProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TableLink, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, defaultDateOrder, formatCount, formatCountFull, formatDate, formatDateRange, formatDateTime, formatIsoDate, formatMoney, formatMoneyFull, formatMonth, formatMonthAxis, formatOpenRange, formatPercent, formatQuarter, formatRelative, formatTime, formatWeek, noResultsBody, resolveRange, sortProp, useDelayedLoading };