@mediaradar/design-components 0.49.0 → 0.50.1
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/approved-components.json +3 -1
- package/dist/index.cjs +249 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -6
- package/dist/index.d.ts +120 -6
- package/dist/index.js +247 -56
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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
|
|
|
@@ -1115,8 +1115,8 @@ interface NoResultsAction {
|
|
|
1115
1115
|
/** Rendered as the filled button; every other action renders as the quiet link/button. */
|
|
1116
1116
|
primary?: boolean;
|
|
1117
1117
|
}
|
|
1118
|
-
declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-dense font-semibold text-brand-onprimary transition-colors hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-
|
|
1119
|
-
declare const QUIET_ACTION_CLASS = "rounded-control text-dense font-medium text-text-link transition-colors hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus";
|
|
1118
|
+
declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-dense font-semibold text-brand-onprimary transition-colors hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus";
|
|
1119
|
+
declare const QUIET_ACTION_CLASS = "rounded-control text-dense font-medium text-text-link transition-colors hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus";
|
|
1120
1120
|
/**
|
|
1121
1121
|
* @pattern NoResultsEmptyState
|
|
1122
1122
|
* @status stable
|
|
@@ -3366,7 +3366,7 @@ interface SuggestionChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
3366
3366
|
* @tokens rounded-full, border, border-border-default, bg-surface, text-sm,
|
|
3367
3367
|
* text-text-primary, hover:bg-subtle, hover:border-border-strong,
|
|
3368
3368
|
* transition-colors, duration-(--mr-motion-duration-interactive),
|
|
3369
|
-
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-
|
|
3369
|
+
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-1,
|
|
3370
3370
|
* focus-visible:outline-border-focus
|
|
3371
3371
|
* @use for shortcuts the user may take instead of typing: example searches,
|
|
3372
3372
|
* follow-up questions, spelling suggestions. Put a short lead-in before the
|
|
@@ -3409,7 +3409,7 @@ interface ToggleChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
3409
3409
|
* text-text-primary, hover:bg-subtle, hover:border-border-strong,
|
|
3410
3410
|
* bg-brand-primaryAction/15, border-brand-primaryAction, text-brand-primaryAction,
|
|
3411
3411
|
* transition-colors, duration-(--mr-motion-duration-interactive),
|
|
3412
|
-
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-
|
|
3412
|
+
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-1,
|
|
3413
3413
|
* focus-visible:outline-border-focus
|
|
3414
3414
|
* @use for pick-many options short enough to show all at once.
|
|
3415
3415
|
* @avoid when only one can be on -- that's SegmentedControl.
|
|
@@ -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
|
-
|
|
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
|
|
|
@@ -1115,8 +1115,8 @@ interface NoResultsAction {
|
|
|
1115
1115
|
/** Rendered as the filled button; every other action renders as the quiet link/button. */
|
|
1116
1116
|
primary?: boolean;
|
|
1117
1117
|
}
|
|
1118
|
-
declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-dense font-semibold text-brand-onprimary transition-colors hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-
|
|
1119
|
-
declare const QUIET_ACTION_CLASS = "rounded-control text-dense font-medium text-text-link transition-colors hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus";
|
|
1118
|
+
declare const PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-dense font-semibold text-brand-onprimary transition-colors hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus";
|
|
1119
|
+
declare const QUIET_ACTION_CLASS = "rounded-control text-dense font-medium text-text-link transition-colors hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus";
|
|
1120
1120
|
/**
|
|
1121
1121
|
* @pattern NoResultsEmptyState
|
|
1122
1122
|
* @status stable
|
|
@@ -3366,7 +3366,7 @@ interface SuggestionChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
3366
3366
|
* @tokens rounded-full, border, border-border-default, bg-surface, text-sm,
|
|
3367
3367
|
* text-text-primary, hover:bg-subtle, hover:border-border-strong,
|
|
3368
3368
|
* transition-colors, duration-(--mr-motion-duration-interactive),
|
|
3369
|
-
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-
|
|
3369
|
+
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-1,
|
|
3370
3370
|
* focus-visible:outline-border-focus
|
|
3371
3371
|
* @use for shortcuts the user may take instead of typing: example searches,
|
|
3372
3372
|
* follow-up questions, spelling suggestions. Put a short lead-in before the
|
|
@@ -3409,7 +3409,7 @@ interface ToggleChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
3409
3409
|
* text-text-primary, hover:bg-subtle, hover:border-border-strong,
|
|
3410
3410
|
* bg-brand-primaryAction/15, border-brand-primaryAction, text-brand-primaryAction,
|
|
3411
3411
|
* transition-colors, duration-(--mr-motion-duration-interactive),
|
|
3412
|
-
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-
|
|
3412
|
+
* ease-interactive, focus-visible:outline-2, focus-visible:outline-offset-1,
|
|
3413
3413
|
* focus-visible:outline-border-focus
|
|
3414
3414
|
* @use for pick-many options short enough to show all at once.
|
|
3415
3415
|
* @avoid when only one can be on -- that's SegmentedControl.
|
|
@@ -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
|
-
|
|
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 };
|