import { ChipSize, PickerSummary } from '../../atoms/Chip'; import { FilterOption } from './types'; export interface FilterMenuProps { /** The field's name, e.g. `Severity`. Shown on the chip and names the panel. */ field: string; options: FilterOption[]; /** Controlled selection. Omit for uncontrolled. */ value?: string[]; defaultValue?: string[]; /** * Called with the new selection. Under `commit="immediate"` this fires on * every toggle; under `"apply"` only when the user presses Apply. */ onChange: (values: string[]) => void; /** * When the selection takes effect. * * `immediate` is the default because a chip is a cheap, reversible control * and live results are the faster loop. Use `apply` when each change costs a * query the user should not pay for mid-thought, or when partial selections * would show a misleading result. */ commit?: 'immediate' | 'apply'; /** Adds a filter field above the options. Worth it past about ten options. */ searchable?: boolean; /** Adds an `All` row that toggles everything currently visible. */ showSelectAll?: boolean; /** How the chip summarises the selection. `count` for values too long to show. */ summary?: PickerSummary; /** * Removes the whole filter, which is what the X on the chip means -- the same * thing it means on `Chip purpose="filter"`. Drop the field from your list of * active filters here; this component cannot do it, since the list is yours. * * Omit it for a bar of fixed fields. Pass it only if the user has some way to * add the filter back, such as an `Add filter` menu, or removing it is a dead * end. * * Emptying the selection while keeping the chip is the panel's `Reset`, and * needs no prop. */ onRemove?: () => void; /** * Fires when the panel opens. For lazily loading options, or analytics. */ onOpen?: () => void; /** * Fires when the panel closes, with the selection as applied at that moment * -- so under `commit="apply"` a panel dismissed without Apply reports the * old values, not the abandoned draft. * * This is the hook for running one query per visit rather than one per tick: * keep `commit="immediate"` so the checkboxes and the chip stay live, drive * local state from `onChange`, and refetch here. */ onClose?: (values: string[]) => void; loading?: boolean; /** A leading icon on the chip, e.g. the kind of thing being filtered. */ icon?: React.ReactElement; /** Shown when a search matches nothing. */ emptyText?: string; /** * Size of the picker trigger chip. Panel internals stay small. * @default 'medium' */ size?: ChipSize; } /** * @example * dropFilter('severity')} * /> */ export declare function FilterMenu({ field, options, value, defaultValue, onChange, commit, searchable, showSelectAll, summary, onRemove, onOpen, onClose, loading, icon, emptyText, size, }: FilterMenuProps): import("react").JSX.Element; export default FilterMenu;