import type { MRT_ColumnFiltersState } from 'material-react-table'; /** * Describes one server-side filter chip. * * - `dateRange` — two-date popover. `fromKey` / `toKey` map to `filterValues`. * - `text` — single text-input popover. `filterKey` maps to `filterValues`. * - `dropdown` — single-select popover with a fixed list of `options`. * `filterKey` maps to `filterValues`. * - `searchableDropdown` — like `dropdown` but the popover has a search box so users can * quickly filter long option lists. Same `filterKey` / `options` * shape as `dropdown`. * - `date` — single date-picker chip. Applied client-side via MRT `columnFilters`. * - `multiSelect` — checkbox list that allows picking multiple values at once. * Selected values are joined as a comma-separated string in * `filterValues[filterKey]` (e.g. `"Pending,Shipped"`). * Your `fetchPage` function should split on `","` to build the * correct server query. * * Every variant accepts an optional **`defaultVisible`** flag. * Set it to `true` on any filter that should appear in the chip bar on first * render — without needing `defaultVisibleFilterIds` on the grid: * * ```ts * { type: 'dateRange', id: 'dateRange', label: 'Date Range', * fromKey: 'From', toKey: 'To', defaultVisible: true } * ``` */ export type ServerFilterDef = { type: 'dateRange'; id: string; label: string; fromKey: string; toKey: string; /** Show this chip in the filter bar on first render. Default: `false`. */ defaultVisible?: boolean; } | { type: 'text'; id: string; label: string; filterKey: string; placeholder?: string; /** Show this chip in the filter bar on first render. Default: `false`. */ defaultVisible?: boolean; } | { type: 'dropdown'; id: string; label: string; filterKey: string; options: { label: string; value: string; }[]; /** Show this chip in the filter bar on first render. Default: `false`. */ defaultVisible?: boolean; } | { /** * Like `dropdown` but adds a search input at the top of the popover so users * can filter through long option lists by typing. */ type: 'searchableDropdown'; id: string; label: string; filterKey: string; options: { label: string; value: string; }[]; placeholder?: string; /** Show this chip in the filter bar on first render. Default: `false`. */ defaultVisible?: boolean; } | { /** * Single-date picker chip — applied client-side against the MRT column * whose `accessorKey` matches `columnKey`. */ type: 'date'; id: string; label: string; columnKey: string; /** Show this chip in the filter bar on first render. Default: `false`. */ defaultVisible?: boolean; } | { /** * Multi-select checkbox chip — users can pick **multiple** values at once. * Selected values are stored as a comma-separated string in * `filterValues[filterKey]` (e.g. `"Pending,Shipped,Delivered"`). * Split on `","` in your `fetchPage` handler to build the server query. */ type: 'multiSelect'; id: string; label: string; filterKey: string; options: { label: string; value: string; }[]; /** Show this chip in the filter bar on first render. Default: `false`. */ defaultVisible?: boolean; } | { /** * Month-picker chip — by default lets users select **one or more months** * across years. Selected months are stored as a comma-separated string of * `"YYYY-MM"` values in `filterValues[filterKey]` (e.g. `"2025-01,2025-03"`, * or just `"2025-01"` when `single: true`). Split on `","` in your * `fetchPage` handler to build the server query. */ type: 'monthPicker'; id: string; label: string; filterKey: string; /** Show this chip in the filter bar on first render. Default: `false`. */ defaultVisible?: boolean; /** * Restrict selection to a single month instead of the default * multi-select behaviour. Clicking a month immediately applies and * closes the popover (no Apply button), matching other single-value * chips like the date picker. Default: `false` (multi-select). */ single?: boolean; }; interface AvailableColumn { id: string; label: string; /** * Filter chip variant used in the "Column Filters" section of Manage Filters. * Sourced from the `filterType` prop on the column's `TPColumnDef`. * Defaults to `'text'` when omitted. */ filterType?: 'text' | 'date' | 'select' | 'searchable-select' | 'number' | 'multi-select'; /** Options for `'select'` / `'searchable-select'` chip variants. */ filterOptions?: { label: string; value: string; }[]; } export interface DynamicFilterBarProps { serverFilterDefs: ServerFilterDef[]; visibleFilterIds: string[]; onToggleFilter: (id: string) => void; filterValues: Record; onFilterValuesChange: (values: Record) => void; columnFilters: MRT_ColumnFiltersState; onColumnFilterChange: (f: MRT_ColumnFiltersState | ((prev: MRT_ColumnFiltersState) => MRT_ColumnFiltersState)) => void; availableColumns: AvailableColumn[]; /** Maximum number of chips that may be visible at once. Default: 4. */ maxVisibleFilters?: number; uiDensity?: 'default' | 'compact'; filterChipFontSize?: number; filterChipMinHeight?: number; filterLabelFontSize?: number; /** * Current value of MRT's global filter (free-text search across every * visible column). When provided together with `onGlobalFilterChange`, a * search box is rendered next to "Manage Filters". */ globalFilter?: string; /** Called (debounced) as the user types in the global search box. */ onGlobalFilterChange?: (value: string) => void; /** Placeholder text for the global search box. Default: "Search…". */ globalSearchPlaceholder?: string; /** ID prefix for all interactive elements — passed down to chips and ManageFilters. */ gridId?: string; } declare const _default: import("react").MemoExoticComponent<({ serverFilterDefs, visibleFilterIds, onToggleFilter, filterValues, onFilterValuesChange, columnFilters, onColumnFilterChange, availableColumns, maxVisibleFilters, uiDensity, filterChipFontSize, filterChipMinHeight, filterLabelFontSize, globalFilter, onGlobalFilterChange, globalSearchPlaceholder, gridId, }: DynamicFilterBarProps) => import("react/jsx-runtime").JSX.Element>; export default _default;