@mediaradar/design-components 0.49.0 → 0.50.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
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, RefObject, ButtonHTMLAttributes, Ref, ReactElement, MouseEventHandler, InputHTMLAttributes } from 'react';
2
+ import { ReactNode, RefObject, ButtonHTMLAttributes, Ref, ReactElement, MouseEventHandler, InputHTMLAttributes, ComponentType } from 'react';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
@@ -3518,4 +3518,118 @@ interface InlineMessageProps extends CommonProps {
3518
3518
  */
3519
3519
  declare function InlineMessage({ tone, title, children, actions, onDismiss, className, testIdPrefix }: InlineMessageProps): react.JSX.Element;
3520
3520
 
3521
- export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, type CommonProps, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, 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, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
3521
+ interface FilterDrawerSection<Id extends string = string> {
3522
+ id: Id;
3523
+ /** The filter's name: "Brand", "Market". */
3524
+ label: string;
3525
+ /** A lucide icon, or any component taking size, className and aria-hidden. Typed loosely so an app on another lucide version fits. */
3526
+ icon: ComponentType<{
3527
+ size?: number | string;
3528
+ className?: string;
3529
+ "aria-hidden"?: boolean | "true" | "false";
3530
+ }>;
3531
+ /** Shown on the row once the filter narrows anything: "3 selected", "Off". Empty hides it. */
3532
+ badge?: string | null;
3533
+ /** One line saying what the filter means; an info tip beside its name in its panel. */
3534
+ info?: string;
3535
+ }
3536
+ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
3537
+ open: boolean;
3538
+ /** Escape, the dimmed page, the ×, and Cancel. Unapplied picks are dropped. */
3539
+ onClose: () => void;
3540
+ sections: FilterDrawerSection<Id>[];
3541
+ /** One filter's contents, shown when its row is opened. The page owns the draft. */
3542
+ renderSection: (id: Id) => ReactNode;
3543
+ /** Filters narrowing anything in the draft -- the count beside the title. */
3544
+ activeCount?: number;
3545
+ /** Empties one filter in the draft: Clear inside a filter's panel. */
3546
+ onClearSection: (id: Id) => void;
3547
+ /** Empties the draft: Clear all on the list. */
3548
+ onClearAll: () => void;
3549
+ /** Commits the draft. The drawer closes itself after. */
3550
+ onApply: () => void;
3551
+ /** Opens straight onto this filter instead of the list. */
3552
+ focus?: Id | null;
3553
+ /** Drawer width: sm 440 (default) for filters; md 640 when a filter holds a deep hierarchy. */
3554
+ size?: DrawerSize;
3555
+ }
3556
+ /**
3557
+ * @pattern FilterDrawer
3558
+ * @status stable
3559
+ * @description The page's filter panel (Target-style). A Drawer listing every
3560
+ * filter as a row with a right arrow; opening a row replaces the list with
3561
+ * that filter as the whole panel, with a back arrow to the list. The page
3562
+ * keeps the draft and renders each filter's contents; FilterDrawer owns the
3563
+ * list, the navigation, the slide between the two and the footer (Clear or
3564
+ * Clear all, Cancel, Apply). Opened from AllFiltersButton.
3565
+ * @tokens border-t, border-b, border-border-default, px-5, py-3.5, text-sm,
3566
+ * font-medium, text-text-primary, text-text-secondary, text-brand-primaryAction,
3567
+ * hover:bg-subtle, rounded-control, focus-visible:outline-border-focus,
3568
+ * transition-transform, duration-(--mr-motion-duration-interactive),
3569
+ * ease-interactive, motion-reduce:transition-none, overflow-x-clip
3570
+ * @dependencies lucide-react, react-dom
3571
+ * @behavior Picks stay in the page's draft until Apply, so moving between
3572
+ * filters loses nothing; Cancel, Escape and the dimmed page drop them. Each
3573
+ * opening starts on the list (or on `focus`). Opening a filter slides it in
3574
+ * from the right as the list moves a third of the way out to the left; the
3575
+ * back arrow reverses it. 200ms, the Drawer's own timing; with reduced motion
3576
+ * it swaps without moving. Clear in a filter calls `onClearSection`, Clear all
3577
+ * on the list `onClearAll`, Apply `onApply` and then `onClose`.
3578
+ * @a11y Built on Drawer: role="dialog", focus trap, Escape, focus back to the
3579
+ * opener. Each row is a button. Opening a filter moves focus to its back
3580
+ * arrow ("Back to all filters"); going back puts focus on the row you left,
3581
+ * so the keyboard never lands back at the top. The outgoing panel is inert
3582
+ * while it slides out.
3583
+ * @use for a page's filters, opened from AllFiltersButton.
3584
+ * @use the filter's own picker inside `renderSection`: a checklist, a tree, a
3585
+ * SearchBar with `scope`.
3586
+ * @avoid filters as on-page buttons beside AllFiltersButton -- the panel is
3587
+ * the one place. A builder's two or three quick dropdowns are the exception.
3588
+ * @avoid an accordion of filters in a drawer -- one filter at a time, full height.
3589
+ * @usage
3590
+ * ```tsx
3591
+ * <FilterDrawer
3592
+ * open={open}
3593
+ * onClose={() => setOpen(false)}
3594
+ * activeCount={count(draft)}
3595
+ * sections={[{ id: "brand", label: "Brand", icon: Package, badge: draft.brands.length ? `${draft.brands.length} selected` : null }]}
3596
+ * renderSection={(id) => <BrandPicker value={draft.brands} onChange={...} />}
3597
+ * onClearSection={(id) => setDraft((d) => ({ ...d, [id]: [] }))}
3598
+ * onClearAll={() => setDraft(empty)}
3599
+ * onApply={() => setApplied(draft)}
3600
+ * />
3601
+ * ```
3602
+ */
3603
+ declare function FilterDrawer<Id extends string>({ open, onClose, sections, renderSection, activeCount, onClearSection, onClearAll, onApply, focus, size, testIdPrefix, }: FilterDrawerProps<Id>): react.JSX.Element;
3604
+
3605
+ interface AllFiltersButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children">, CommonProps {
3606
+ /** Filters narrowing the page; the badge shows when above 0. */
3607
+ count?: number;
3608
+ /** Whether the FilterDrawer is showing, for aria-expanded. */
3609
+ open?: boolean;
3610
+ }
3611
+ /**
3612
+ * @pattern AllFiltersButton
3613
+ * @status stable
3614
+ * @description The one way into a page's FilterDrawer: "All filters" with a
3615
+ * sliders icon and a count of the filters in use. The same bordered look as
3616
+ * the filter row's dropdowns (ChipTrigger), so it lines up beside them.
3617
+ * @tokens text-dense, font-medium, text-text-primary, text-text-secondary,
3618
+ * rounded-control, border-border-strong, bg-input, hover:bg-subtle,
3619
+ * focus-visible:outline-border-focus
3620
+ * @dependencies lucide-react
3621
+ * @behavior The count badge shows only above 0. Forwards its ref to the
3622
+ * <button>, so a page can return focus to it.
3623
+ * @a11y A real <button> with aria-haspopup="dialog" and aria-expanded from
3624
+ * `open`. With filters in use its name includes the count: "All filters, 2
3625
+ * in use".
3626
+ * @use at the end of a page's filter row, opening FilterDrawer.
3627
+ * @avoid a hand-built "Filters" button, or a second one on the same page.
3628
+ * @usage
3629
+ * ```tsx
3630
+ * <AllFiltersButton ref={triggerRef} open={open} count={activeCount} onClick={() => setOpen(true)} />
3631
+ * ```
3632
+ */
3633
+ declare const AllFiltersButton: react.ForwardRefExoticComponent<AllFiltersButtonProps & react.RefAttributes<HTMLButtonElement>>;
3634
+
3635
+ export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, AllFiltersButton, type AllFiltersButtonProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, type CommonProps, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDrawer, type FilterDrawerProps, type FilterDrawerSection, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, 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, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, RefObject, ButtonHTMLAttributes, Ref, ReactElement, MouseEventHandler, InputHTMLAttributes } from 'react';
2
+ import { ReactNode, RefObject, ButtonHTMLAttributes, Ref, ReactElement, MouseEventHandler, InputHTMLAttributes, ComponentType } from 'react';
3
3
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
@@ -3518,4 +3518,118 @@ interface InlineMessageProps extends CommonProps {
3518
3518
  */
3519
3519
  declare function InlineMessage({ tone, title, children, actions, onDismiss, className, testIdPrefix }: InlineMessageProps): react.JSX.Element;
3520
3520
 
3521
- export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, type CommonProps, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, 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, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
3521
+ interface FilterDrawerSection<Id extends string = string> {
3522
+ id: Id;
3523
+ /** The filter's name: "Brand", "Market". */
3524
+ label: string;
3525
+ /** A lucide icon, or any component taking size, className and aria-hidden. Typed loosely so an app on another lucide version fits. */
3526
+ icon: ComponentType<{
3527
+ size?: number | string;
3528
+ className?: string;
3529
+ "aria-hidden"?: boolean | "true" | "false";
3530
+ }>;
3531
+ /** Shown on the row once the filter narrows anything: "3 selected", "Off". Empty hides it. */
3532
+ badge?: string | null;
3533
+ /** One line saying what the filter means; an info tip beside its name in its panel. */
3534
+ info?: string;
3535
+ }
3536
+ interface FilterDrawerProps<Id extends string = string> extends CommonProps {
3537
+ open: boolean;
3538
+ /** Escape, the dimmed page, the ×, and Cancel. Unapplied picks are dropped. */
3539
+ onClose: () => void;
3540
+ sections: FilterDrawerSection<Id>[];
3541
+ /** One filter's contents, shown when its row is opened. The page owns the draft. */
3542
+ renderSection: (id: Id) => ReactNode;
3543
+ /** Filters narrowing anything in the draft -- the count beside the title. */
3544
+ activeCount?: number;
3545
+ /** Empties one filter in the draft: Clear inside a filter's panel. */
3546
+ onClearSection: (id: Id) => void;
3547
+ /** Empties the draft: Clear all on the list. */
3548
+ onClearAll: () => void;
3549
+ /** Commits the draft. The drawer closes itself after. */
3550
+ onApply: () => void;
3551
+ /** Opens straight onto this filter instead of the list. */
3552
+ focus?: Id | null;
3553
+ /** Drawer width: sm 440 (default) for filters; md 640 when a filter holds a deep hierarchy. */
3554
+ size?: DrawerSize;
3555
+ }
3556
+ /**
3557
+ * @pattern FilterDrawer
3558
+ * @status stable
3559
+ * @description The page's filter panel (Target-style). A Drawer listing every
3560
+ * filter as a row with a right arrow; opening a row replaces the list with
3561
+ * that filter as the whole panel, with a back arrow to the list. The page
3562
+ * keeps the draft and renders each filter's contents; FilterDrawer owns the
3563
+ * list, the navigation, the slide between the two and the footer (Clear or
3564
+ * Clear all, Cancel, Apply). Opened from AllFiltersButton.
3565
+ * @tokens border-t, border-b, border-border-default, px-5, py-3.5, text-sm,
3566
+ * font-medium, text-text-primary, text-text-secondary, text-brand-primaryAction,
3567
+ * hover:bg-subtle, rounded-control, focus-visible:outline-border-focus,
3568
+ * transition-transform, duration-(--mr-motion-duration-interactive),
3569
+ * ease-interactive, motion-reduce:transition-none, overflow-x-clip
3570
+ * @dependencies lucide-react, react-dom
3571
+ * @behavior Picks stay in the page's draft until Apply, so moving between
3572
+ * filters loses nothing; Cancel, Escape and the dimmed page drop them. Each
3573
+ * opening starts on the list (or on `focus`). Opening a filter slides it in
3574
+ * from the right as the list moves a third of the way out to the left; the
3575
+ * back arrow reverses it. 200ms, the Drawer's own timing; with reduced motion
3576
+ * it swaps without moving. Clear in a filter calls `onClearSection`, Clear all
3577
+ * on the list `onClearAll`, Apply `onApply` and then `onClose`.
3578
+ * @a11y Built on Drawer: role="dialog", focus trap, Escape, focus back to the
3579
+ * opener. Each row is a button. Opening a filter moves focus to its back
3580
+ * arrow ("Back to all filters"); going back puts focus on the row you left,
3581
+ * so the keyboard never lands back at the top. The outgoing panel is inert
3582
+ * while it slides out.
3583
+ * @use for a page's filters, opened from AllFiltersButton.
3584
+ * @use the filter's own picker inside `renderSection`: a checklist, a tree, a
3585
+ * SearchBar with `scope`.
3586
+ * @avoid filters as on-page buttons beside AllFiltersButton -- the panel is
3587
+ * the one place. A builder's two or three quick dropdowns are the exception.
3588
+ * @avoid an accordion of filters in a drawer -- one filter at a time, full height.
3589
+ * @usage
3590
+ * ```tsx
3591
+ * <FilterDrawer
3592
+ * open={open}
3593
+ * onClose={() => setOpen(false)}
3594
+ * activeCount={count(draft)}
3595
+ * sections={[{ id: "brand", label: "Brand", icon: Package, badge: draft.brands.length ? `${draft.brands.length} selected` : null }]}
3596
+ * renderSection={(id) => <BrandPicker value={draft.brands} onChange={...} />}
3597
+ * onClearSection={(id) => setDraft((d) => ({ ...d, [id]: [] }))}
3598
+ * onClearAll={() => setDraft(empty)}
3599
+ * onApply={() => setApplied(draft)}
3600
+ * />
3601
+ * ```
3602
+ */
3603
+ declare function FilterDrawer<Id extends string>({ open, onClose, sections, renderSection, activeCount, onClearSection, onClearAll, onApply, focus, size, testIdPrefix, }: FilterDrawerProps<Id>): react.JSX.Element;
3604
+
3605
+ interface AllFiltersButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children">, CommonProps {
3606
+ /** Filters narrowing the page; the badge shows when above 0. */
3607
+ count?: number;
3608
+ /** Whether the FilterDrawer is showing, for aria-expanded. */
3609
+ open?: boolean;
3610
+ }
3611
+ /**
3612
+ * @pattern AllFiltersButton
3613
+ * @status stable
3614
+ * @description The one way into a page's FilterDrawer: "All filters" with a
3615
+ * sliders icon and a count of the filters in use. The same bordered look as
3616
+ * the filter row's dropdowns (ChipTrigger), so it lines up beside them.
3617
+ * @tokens text-dense, font-medium, text-text-primary, text-text-secondary,
3618
+ * rounded-control, border-border-strong, bg-input, hover:bg-subtle,
3619
+ * focus-visible:outline-border-focus
3620
+ * @dependencies lucide-react
3621
+ * @behavior The count badge shows only above 0. Forwards its ref to the
3622
+ * <button>, so a page can return focus to it.
3623
+ * @a11y A real <button> with aria-haspopup="dialog" and aria-expanded from
3624
+ * `open`. With filters in use its name includes the count: "All filters, 2
3625
+ * in use".
3626
+ * @use at the end of a page's filter row, opening FilterDrawer.
3627
+ * @avoid a hand-built "Filters" button, or a second one on the same page.
3628
+ * @usage
3629
+ * ```tsx
3630
+ * <AllFiltersButton ref={triggerRef} open={open} count={activeCount} onClick={() => setOpen(true)} />
3631
+ * ```
3632
+ */
3633
+ declare const AllFiltersButton: react.ForwardRefExoticComponent<AllFiltersButtonProps & react.RefAttributes<HTMLButtonElement>>;
3634
+
3635
+ export { AISpark, type AISparkProps, AdvertiserNoResults, type AdvertiserNoResultsProps, AdvertiserQuickFilter, type AdvertiserQuickFilterProps, AdvertiserSearchPrompt, type AdvertiserSearchPromptProps, AllFiltersButton, type AllFiltersButtonProps, Badge, type BadgeKind, type BadgeProps, type BadgeTone, BarChartPlaceholder, type BarChartPlaceholderProps, Button, type ButtonProps, Card, type CardProps, CheckBox, CheckBoxBox, type CheckBoxBoxProps, type CheckBoxProps, ChipContent, type ChipContentProps, type ChipVariant, type CommonProps, CopyButton, type CopyButtonProps, DEFAULT_SEARCH_MATCH, DataScopeFilter, type DataScopeFilterProps, DataTable, type DataTableColumn, type DataTableColumnWidth, type DataTableDensity, type DataTableProps, type DateGranularity, DateRangeFilter, type DateRangeFilterProps, DateRangePicker, type DateRangePickerProps, Delta, type DeltaProps, Drawer, type DrawerProps, type DrawerSize, EmptyState, type EmptyStateProps, type EmptyStateSize, FilterChipBar, type FilterChipBarProps, FilterDrawer, type FilterDrawerProps, type FilterDrawerSection, FilterDropdownFooter, type FilterDropdownFooterProps, Freshness, type FreshnessLevel, type FreshnessProps, InfoTip, type InfoTipProps, InlineMessage, type InlineMessageProps, type InlineMessageTone, LineChartPlaceholder, type LineChartPlaceholderProps, MediaLabel, type MediaLabelProps, type MediaType, Modal, type ModalProps, type ModalSize, MultiSelectFilter, type MultiSelectFilterProps, type MultiSelectGroup, NO_RESULTS_BODY, NO_RESULTS_TITLE, NameListModal, type NameListModalProps, type NoResultsAction, NoResultsEmptyState, type NoResultsEmptyStateProps, PRIMARY_ACTION_CLASS, PageHeader, type PageHeaderProps, Pager, type PagerProps, type PickerColumn, type PickerFilter, type PickerRow, PieChartPlaceholder, type PieChartPlaceholderProps, type PubBreak, PublisherBreakdownList, type PublisherBreakdownListProps, QUIET_ACTION_CLASS, SearchBar, type SearchBarProps, type SearchBarSize, type SearchBarVariant, type SearchMatchMode, type SearchMatchValue, 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, SortButton, type SortButtonProps, type SortDir, type SortState, StackedColumnPlaceholder, type StackedColumnPlaceholderProps, SuggestionChip, type SuggestionChipProps, type SummaryGroup, type SummaryGroupItemValue, type TabItem, TablePagination, type TablePaginationProps, Tabs, type TabsProps, Tag, type TagProps, TextField, type TextFieldProps, type TextFieldSize, Toast, type ToastProps, type ToastTone, Toggle, ToggleChip, type ToggleChipProps, type ToggleProps, Tooltip, type TooltipProps, WorkspaceAvatar, type WorkspaceAvatarProps, WorkspaceSelectedCard, type WorkspaceSelectedCardProps, ariaSortFor, buttonVariants, chipTriggerClass, cycleSort, noResultsBody, resolveRange, sortProp };
package/dist/index.js CHANGED
@@ -5305,11 +5305,199 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
5305
5305
  }
5306
5306
  );
5307
5307
  }
5308
+
5309
+ // src/FilterDrawer.tsx
5310
+ import { useEffect as useEffect17, useLayoutEffect as useLayoutEffect6, useRef as useRef19, useState as useState17 } from "react";
5311
+ import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight6 } from "lucide-react";
5312
+ import { jsx as jsx56, jsxs as jsxs48 } from "react/jsx-runtime";
5313
+ var SLIDE_MS = 200;
5314
+ function reducedMotion() {
5315
+ return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
5316
+ }
5317
+ function FilterDrawer({
5318
+ open,
5319
+ onClose,
5320
+ sections,
5321
+ renderSection,
5322
+ activeCount = 0,
5323
+ onClearSection,
5324
+ onClearAll,
5325
+ onApply,
5326
+ focus = null,
5327
+ size = "sm",
5328
+ testIdPrefix
5329
+ }) {
5330
+ const [view, setViewState] = useState17(focus);
5331
+ const [leaving, setLeaving] = useState17(null);
5332
+ const [phase, setPhase] = useState17("run");
5333
+ const [wasOpen, setWasOpen] = useState17(open);
5334
+ if (open !== wasOpen) {
5335
+ setWasOpen(open);
5336
+ if (open) {
5337
+ setViewState(focus);
5338
+ setLeaving(null);
5339
+ }
5340
+ }
5341
+ const setView = (next) => {
5342
+ if (!reducedMotion()) {
5343
+ setLeaving({ view, dir: next ? 1 : -1 });
5344
+ setPhase("start");
5345
+ }
5346
+ setViewState(next);
5347
+ };
5348
+ useLayoutEffect6(() => {
5349
+ if (phase !== "start") return;
5350
+ const raf = requestAnimationFrame(() => requestAnimationFrame(() => setPhase("run")));
5351
+ return () => cancelAnimationFrame(raf);
5352
+ }, [phase]);
5353
+ useEffect17(() => {
5354
+ if (!leaving || phase !== "run") return;
5355
+ const t = setTimeout(() => setLeaving(null), SLIDE_MS);
5356
+ return () => clearTimeout(t);
5357
+ }, [leaving, phase]);
5358
+ const backRef = useRef19(null);
5359
+ const rowRefs = useRef19(/* @__PURE__ */ new Map());
5360
+ const lastView = useRef19(null);
5361
+ useEffect17(() => {
5362
+ if (!open) return;
5363
+ if (view) backRef.current?.focus();
5364
+ else if (lastView.current) rowRefs.current.get(lastView.current)?.focus();
5365
+ lastView.current = view;
5366
+ }, [view, open]);
5367
+ const focused = view ? sections.find((s) => s.id === view) : void 0;
5368
+ const dir = leaving?.dir ?? 1;
5369
+ const moving = !!leaving;
5370
+ const incoming = moving && phase === "start" ? dir > 0 ? "translateX(100%)" : "translateX(-33%)" : void 0;
5371
+ const outgoing = phase === "start" ? void 0 : dir > 0 ? "translateX(-33%)" : "translateX(100%)";
5372
+ const panel = (v, rows = true) => {
5373
+ const s = v ? sections.find((x) => x.id === v) : void 0;
5374
+ if (s) return /* @__PURE__ */ jsx56("div", { className: "px-5 pt-1", children: renderSection(s.id) });
5375
+ return /* @__PURE__ */ jsx56("ul", { className: "border-t border-border-default", children: sections.map((x) => /* @__PURE__ */ jsx56("li", { className: "border-b border-border-default", children: /* @__PURE__ */ jsxs48(
5376
+ "button",
5377
+ {
5378
+ ref: rows ? (el) => {
5379
+ if (el) rowRefs.current.set(x.id, el);
5380
+ else rowRefs.current.delete(x.id);
5381
+ } : void 0,
5382
+ type: "button",
5383
+ onClick: () => setView(x.id),
5384
+ "data-testid": testIdPrefix && `${testIdPrefix}-row-${x.id}`,
5385
+ className: "flex w-full items-center gap-3 px-5 py-3.5 text-left transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
5386
+ children: [
5387
+ /* @__PURE__ */ jsx56(
5388
+ x.icon,
5389
+ {
5390
+ size: 17,
5391
+ "aria-hidden": "true",
5392
+ className: x.badge ? "text-brand-primaryAction" : "text-text-secondary"
5393
+ }
5394
+ ),
5395
+ /* @__PURE__ */ jsx56("span", { className: "flex-1 text-sm font-medium text-text-primary", children: x.label }),
5396
+ x.badge && /* @__PURE__ */ jsx56(Badge, { tone: "brand", children: x.badge }),
5397
+ /* @__PURE__ */ jsx56(ChevronRight6, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
5398
+ ]
5399
+ }
5400
+ ) }, x.id)) });
5401
+ };
5402
+ return /* @__PURE__ */ jsx56(
5403
+ Drawer,
5404
+ {
5405
+ open,
5406
+ onClose,
5407
+ size,
5408
+ testIdPrefix,
5409
+ title: focused ? /* @__PURE__ */ jsxs48("span", { className: "flex items-center gap-1.5", children: [
5410
+ /* @__PURE__ */ jsx56(
5411
+ "button",
5412
+ {
5413
+ ref: backRef,
5414
+ type: "button",
5415
+ onClick: () => setView(null),
5416
+ "aria-label": "Back to all filters",
5417
+ "data-testid": testIdPrefix && `${testIdPrefix}-back`,
5418
+ className: "-ml-1.5 rounded-control p-1 text-text-secondary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-border-focus",
5419
+ children: /* @__PURE__ */ jsx56(ChevronLeft5, { size: 18, "aria-hidden": "true" })
5420
+ }
5421
+ ),
5422
+ focused.label,
5423
+ focused.info && /* @__PURE__ */ jsx56(InfoTip, { text: focused.info, label: `About ${focused.label}` })
5424
+ ] }) : /* @__PURE__ */ jsxs48("span", { className: "flex items-center gap-2.5", children: [
5425
+ "Filters",
5426
+ activeCount > 0 && /* @__PURE__ */ jsx56(Badge, { tone: "brandSolid", kind: "count", children: activeCount })
5427
+ ] }),
5428
+ footer: /* @__PURE__ */ jsxs48("div", { className: "flex w-full items-center justify-between gap-2", children: [
5429
+ focused ? /* @__PURE__ */ jsx56(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }) : /* @__PURE__ */ jsx56(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
5430
+ /* @__PURE__ */ jsxs48("div", { className: "flex items-center gap-2", children: [
5431
+ /* @__PURE__ */ jsx56(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
5432
+ /* @__PURE__ */ jsx56(
5433
+ Button,
5434
+ {
5435
+ variant: "primary",
5436
+ size: "md",
5437
+ onClick: () => {
5438
+ onApply();
5439
+ onClose();
5440
+ },
5441
+ children: "Apply"
5442
+ }
5443
+ )
5444
+ ] })
5445
+ ] }),
5446
+ children: /* @__PURE__ */ jsxs48("div", { className: "relative -mx-5 overflow-x-clip", children: [
5447
+ /* @__PURE__ */ jsx56(
5448
+ "div",
5449
+ {
5450
+ style: { transform: incoming },
5451
+ className: cn(moving && "transition-transform duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none"),
5452
+ children: panel(view)
5453
+ },
5454
+ view ?? "__list"
5455
+ ),
5456
+ leaving && /* @__PURE__ */ jsx56(
5457
+ "div",
5458
+ {
5459
+ "aria-hidden": "true",
5460
+ ref: (el) => el?.setAttribute("inert", ""),
5461
+ style: { transform: outgoing, opacity: phase === "start" ? 1 : dir > 0 ? 0.4 : 1 },
5462
+ className: "pointer-events-none absolute inset-x-0 top-0 transition duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
5463
+ children: panel(leaving.view, false)
5464
+ }
5465
+ )
5466
+ ] })
5467
+ }
5468
+ );
5469
+ }
5470
+
5471
+ // src/AllFiltersButton.tsx
5472
+ import { forwardRef as forwardRef11 } from "react";
5473
+ import { SlidersHorizontal } from "lucide-react";
5474
+ import { jsx as jsx57, jsxs as jsxs49 } from "react/jsx-runtime";
5475
+ var AllFiltersButton = forwardRef11(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
5476
+ return /* @__PURE__ */ jsxs49(
5477
+ "button",
5478
+ {
5479
+ ref,
5480
+ type: "button",
5481
+ "aria-haspopup": "dialog",
5482
+ "aria-expanded": open,
5483
+ "aria-label": count > 0 ? `All filters, ${count} in use` : void 0,
5484
+ "data-testid": testIdPrefix,
5485
+ className: cn(chipTriggerClass(), className),
5486
+ ...rest,
5487
+ children: [
5488
+ /* @__PURE__ */ jsx57(SlidersHorizontal, { size: 15, "aria-hidden": "true", className: "text-text-secondary" }),
5489
+ /* @__PURE__ */ jsx57("span", { className: "text-dense font-medium text-text-primary", children: "All filters" }),
5490
+ count > 0 && /* @__PURE__ */ jsx57(Badge, { tone: "brandSolid", kind: "count", children: count })
5491
+ ]
5492
+ }
5493
+ );
5494
+ });
5308
5495
  export {
5309
5496
  AISpark,
5310
5497
  AdvertiserNoResults,
5311
5498
  AdvertiserQuickFilter,
5312
5499
  AdvertiserSearchPrompt,
5500
+ AllFiltersButton,
5313
5501
  Badge,
5314
5502
  BarChartPlaceholder,
5315
5503
  Button,
@@ -5327,6 +5515,7 @@ export {
5327
5515
  Drawer,
5328
5516
  EmptyState,
5329
5517
  FilterChipBar,
5518
+ FilterDrawer,
5330
5519
  FilterDropdownFooter,
5331
5520
  Freshness,
5332
5521
  InfoTip,