@mediaradar/design-components 0.48.1 → 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/approved-components.json +3 -1
- package/dist/index.cjs +314 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +151 -4
- package/dist/index.d.ts +151 -4
- package/dist/index.js +312 -1
- 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
|
|
|
@@ -668,6 +668,9 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
668
668
|
* text once something is typed. In Ad Code mode (`filterable`, mode
|
|
669
669
|
* `adCode`, with `onAdCodesChange`) typed or pasted codes collect in a chip
|
|
670
670
|
* that opens a list of each code, matched or not.
|
|
671
|
+
* With `scope`, a dropdown in front of the field picks what it searches
|
|
672
|
+
* (media owner / publisher / property; holding company / network /
|
|
673
|
+
* independent), for pickers that search one of several pools.
|
|
671
674
|
* @tokens text-dense, focus-within:outline-border-focus, focus-within:outline-2,
|
|
672
675
|
* focus-within:outline-offset-1, rounded-control, border-border-strong, bg-input, text-text-primary,
|
|
673
676
|
* text-text-tertiary, hover:bg-subtle, bg-brand-primaryAction, bg-subtle,
|
|
@@ -675,14 +678,24 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
675
678
|
* bg-surface, border-brand-primaryAction, border-border-default,
|
|
676
679
|
* border-border-interactive, focus-visible:outline-border-focus,
|
|
677
680
|
* hover:text-text-primary, placeholder:text-text-tertiary, rounded-card,
|
|
678
|
-
* rounded-full, shadow-overlay, text-brand-primaryAction, text-text-secondary
|
|
681
|
+
* rounded-full, shadow-overlay, text-brand-primaryAction, text-text-secondary,
|
|
682
|
+
* rounded-l-control, text-micro
|
|
679
683
|
* @variant default - Default. Plain keyword input, no match-type control.
|
|
680
684
|
* @variant filterable - Adds an attached match-type dropdown sharing one
|
|
681
685
|
* bordered control, mirroring the legacy Creative Intel search + match-type
|
|
682
686
|
* modal (Any Word/Exact Match/Contextual/Ad Code), including the Or/And
|
|
683
687
|
* sub-choice nested under Any Word.
|
|
688
|
+
* @variant scoped - `scope` set: a scope dropdown in front of the field picks
|
|
689
|
+
* which pool the text searches. Works with either variant.
|
|
684
690
|
* @dependencies lucide-react
|
|
685
|
-
* @behavior The
|
|
691
|
+
* @behavior The frame is `flex-auto`: it fills a row, and keeps its height in
|
|
692
|
+
* a column (a filter panel) -- before 0.49.0 it was `flex-1` and squashed to
|
|
693
|
+
* its text's height there.
|
|
694
|
+
* Scope dropdown: a listbox opened from the trigger at the field's front.
|
|
695
|
+
* The picked choice takes focus on open; Up/Down/Home/End move, Enter or
|
|
696
|
+
* Space picks and closes, Escape closes without reaching an enclosing dialog,
|
|
697
|
+
* and focus goes back to the trigger. Outside click and Tab close it too.
|
|
698
|
+
* The match-type dropdown ('filterable' variant) closes on Escape
|
|
686
699
|
* and outside click. Each mode row is a real `radio` role, with a nested
|
|
687
700
|
* Or/And sub-choice under Any Word and its own click-to-toggle info tooltip.
|
|
688
701
|
* The text input carries an `aria-label` derived from `placeholder` — the
|
|
@@ -722,6 +735,8 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
722
735
|
* ```tsx
|
|
723
736
|
* <SearchBar value={query} onChange={setQuery} />
|
|
724
737
|
* <SearchBar variant="filterable" value={query} onChange={setQuery} matchValue={matchValue} onMatchChange={setMatchValue} />
|
|
738
|
+
* <SearchBar size="sm" value={query} onChange={setQuery} placeholder="Search for a media owner"
|
|
739
|
+
* scope={{ label: "Search by", options: ["Media owner", "Publisher", "Property"], value: by, onChange: setBy }} />
|
|
725
740
|
* <SearchBar variant="filterable" value={query} onChange={setQuery} matchValue={matchValue} onMatchChange={setMatchValue}
|
|
726
741
|
* adCodes={codes} onAdCodesChange={setCodes} isAdCodeMatched={(c) => found.has(c)} onDownloadAdCodes={exportStatus} />
|
|
727
742
|
* ```
|
|
@@ -736,6 +751,16 @@ interface SearchMatchValue {
|
|
|
736
751
|
wordJoin: "Or" | "And";
|
|
737
752
|
}
|
|
738
753
|
declare const DEFAULT_SEARCH_MATCH: SearchMatchValue;
|
|
754
|
+
/** A choice of what to search, in front of the field: "Media owner", "Publisher", "Property". */
|
|
755
|
+
interface SearchScope {
|
|
756
|
+
/** Heading over the choices: "Search by", "Agency type". Also the trigger's accessible name. */
|
|
757
|
+
label: string;
|
|
758
|
+
options: readonly string[];
|
|
759
|
+
value: string;
|
|
760
|
+
onChange: (v: string) => void;
|
|
761
|
+
/** One line under the heading saying what the choices mean. */
|
|
762
|
+
info?: string;
|
|
763
|
+
}
|
|
739
764
|
interface SearchBarProps extends CommonProps {
|
|
740
765
|
/** Input placeholder text. Also used as the input's `aria-label`. */
|
|
741
766
|
placeholder?: string;
|
|
@@ -745,6 +770,14 @@ interface SearchBarProps extends CommonProps {
|
|
|
745
770
|
variant?: SearchBarVariant;
|
|
746
771
|
/** sm 32 in toolbars and dropdowns, md 40 in forms, lg 44 (default) in a filter row -- match the controls beside it. */
|
|
747
772
|
size?: SearchBarSize;
|
|
773
|
+
/**
|
|
774
|
+
* Puts a scope dropdown in front of the field, so one box searches one of
|
|
775
|
+
* several pools (media owner / publisher / property). Picking a scope is the
|
|
776
|
+
* consumer's cue to swap what it searches; the text is left alone.
|
|
777
|
+
*/
|
|
778
|
+
scope?: SearchScope;
|
|
779
|
+
/** Fired when the scope menu opens or closes. */
|
|
780
|
+
onScopeOpenChange?: (open: boolean) => void;
|
|
748
781
|
/** The 'filterable' variant's dropdown state. */
|
|
749
782
|
matchValue?: SearchMatchValue;
|
|
750
783
|
onMatchChange?: (v: SearchMatchValue) => void;
|
|
@@ -3485,4 +3518,118 @@ interface InlineMessageProps extends CommonProps {
|
|
|
3485
3518
|
*/
|
|
3486
3519
|
declare function InlineMessage({ tone, title, children, actions, onDismiss, className, testIdPrefix }: InlineMessageProps): react.JSX.Element;
|
|
3487
3520
|
|
|
3488
|
-
|
|
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
|
|
|
@@ -668,6 +668,9 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
668
668
|
* text once something is typed. In Ad Code mode (`filterable`, mode
|
|
669
669
|
* `adCode`, with `onAdCodesChange`) typed or pasted codes collect in a chip
|
|
670
670
|
* that opens a list of each code, matched or not.
|
|
671
|
+
* With `scope`, a dropdown in front of the field picks what it searches
|
|
672
|
+
* (media owner / publisher / property; holding company / network /
|
|
673
|
+
* independent), for pickers that search one of several pools.
|
|
671
674
|
* @tokens text-dense, focus-within:outline-border-focus, focus-within:outline-2,
|
|
672
675
|
* focus-within:outline-offset-1, rounded-control, border-border-strong, bg-input, text-text-primary,
|
|
673
676
|
* text-text-tertiary, hover:bg-subtle, bg-brand-primaryAction, bg-subtle,
|
|
@@ -675,14 +678,24 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
675
678
|
* bg-surface, border-brand-primaryAction, border-border-default,
|
|
676
679
|
* border-border-interactive, focus-visible:outline-border-focus,
|
|
677
680
|
* hover:text-text-primary, placeholder:text-text-tertiary, rounded-card,
|
|
678
|
-
* rounded-full, shadow-overlay, text-brand-primaryAction, text-text-secondary
|
|
681
|
+
* rounded-full, shadow-overlay, text-brand-primaryAction, text-text-secondary,
|
|
682
|
+
* rounded-l-control, text-micro
|
|
679
683
|
* @variant default - Default. Plain keyword input, no match-type control.
|
|
680
684
|
* @variant filterable - Adds an attached match-type dropdown sharing one
|
|
681
685
|
* bordered control, mirroring the legacy Creative Intel search + match-type
|
|
682
686
|
* modal (Any Word/Exact Match/Contextual/Ad Code), including the Or/And
|
|
683
687
|
* sub-choice nested under Any Word.
|
|
688
|
+
* @variant scoped - `scope` set: a scope dropdown in front of the field picks
|
|
689
|
+
* which pool the text searches. Works with either variant.
|
|
684
690
|
* @dependencies lucide-react
|
|
685
|
-
* @behavior The
|
|
691
|
+
* @behavior The frame is `flex-auto`: it fills a row, and keeps its height in
|
|
692
|
+
* a column (a filter panel) -- before 0.49.0 it was `flex-1` and squashed to
|
|
693
|
+
* its text's height there.
|
|
694
|
+
* Scope dropdown: a listbox opened from the trigger at the field's front.
|
|
695
|
+
* The picked choice takes focus on open; Up/Down/Home/End move, Enter or
|
|
696
|
+
* Space picks and closes, Escape closes without reaching an enclosing dialog,
|
|
697
|
+
* and focus goes back to the trigger. Outside click and Tab close it too.
|
|
698
|
+
* The match-type dropdown ('filterable' variant) closes on Escape
|
|
686
699
|
* and outside click. Each mode row is a real `radio` role, with a nested
|
|
687
700
|
* Or/And sub-choice under Any Word and its own click-to-toggle info tooltip.
|
|
688
701
|
* The text input carries an `aria-label` derived from `placeholder` — the
|
|
@@ -722,6 +735,8 @@ declare function DateRangeFilter({ caption, defaultValue, value: controlledValue
|
|
|
722
735
|
* ```tsx
|
|
723
736
|
* <SearchBar value={query} onChange={setQuery} />
|
|
724
737
|
* <SearchBar variant="filterable" value={query} onChange={setQuery} matchValue={matchValue} onMatchChange={setMatchValue} />
|
|
738
|
+
* <SearchBar size="sm" value={query} onChange={setQuery} placeholder="Search for a media owner"
|
|
739
|
+
* scope={{ label: "Search by", options: ["Media owner", "Publisher", "Property"], value: by, onChange: setBy }} />
|
|
725
740
|
* <SearchBar variant="filterable" value={query} onChange={setQuery} matchValue={matchValue} onMatchChange={setMatchValue}
|
|
726
741
|
* adCodes={codes} onAdCodesChange={setCodes} isAdCodeMatched={(c) => found.has(c)} onDownloadAdCodes={exportStatus} />
|
|
727
742
|
* ```
|
|
@@ -736,6 +751,16 @@ interface SearchMatchValue {
|
|
|
736
751
|
wordJoin: "Or" | "And";
|
|
737
752
|
}
|
|
738
753
|
declare const DEFAULT_SEARCH_MATCH: SearchMatchValue;
|
|
754
|
+
/** A choice of what to search, in front of the field: "Media owner", "Publisher", "Property". */
|
|
755
|
+
interface SearchScope {
|
|
756
|
+
/** Heading over the choices: "Search by", "Agency type". Also the trigger's accessible name. */
|
|
757
|
+
label: string;
|
|
758
|
+
options: readonly string[];
|
|
759
|
+
value: string;
|
|
760
|
+
onChange: (v: string) => void;
|
|
761
|
+
/** One line under the heading saying what the choices mean. */
|
|
762
|
+
info?: string;
|
|
763
|
+
}
|
|
739
764
|
interface SearchBarProps extends CommonProps {
|
|
740
765
|
/** Input placeholder text. Also used as the input's `aria-label`. */
|
|
741
766
|
placeholder?: string;
|
|
@@ -745,6 +770,14 @@ interface SearchBarProps extends CommonProps {
|
|
|
745
770
|
variant?: SearchBarVariant;
|
|
746
771
|
/** sm 32 in toolbars and dropdowns, md 40 in forms, lg 44 (default) in a filter row -- match the controls beside it. */
|
|
747
772
|
size?: SearchBarSize;
|
|
773
|
+
/**
|
|
774
|
+
* Puts a scope dropdown in front of the field, so one box searches one of
|
|
775
|
+
* several pools (media owner / publisher / property). Picking a scope is the
|
|
776
|
+
* consumer's cue to swap what it searches; the text is left alone.
|
|
777
|
+
*/
|
|
778
|
+
scope?: SearchScope;
|
|
779
|
+
/** Fired when the scope menu opens or closes. */
|
|
780
|
+
onScopeOpenChange?: (open: boolean) => void;
|
|
748
781
|
/** The 'filterable' variant's dropdown state. */
|
|
749
782
|
matchValue?: SearchMatchValue;
|
|
750
783
|
onMatchChange?: (v: SearchMatchValue) => void;
|
|
@@ -3485,4 +3518,118 @@ interface InlineMessageProps extends CommonProps {
|
|
|
3485
3518
|
*/
|
|
3486
3519
|
declare function InlineMessage({ tone, title, children, actions, onDismiss, className, testIdPrefix }: InlineMessageProps): react.JSX.Element;
|
|
3487
3520
|
|
|
3488
|
-
|
|
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 };
|