import type { GridApi } from 'ag-grid-community'; /** One saved-filter tab. */ export interface SavedTab { /** Opaque machine-generated id — emitted as `data-tab-id`, never the label. */ id: string; /** User-typed name; rendered text only — never used in DOM hooks or keys. */ label: string; /** AG Grid filter model (`DataTableHandle.getFilter()` shape); `{}` = none. */ filterModel: Record; /** Captured quick-filter text — only present when `captureQuickFilter`. */ quickFilter?: string; /** Locked tabs cannot be renamed or removed (e.g. an "All" tab). */ locked?: boolean; } /** * The narrow grid seam the tabs ride on. Structural, and `getRawApi` is * deliberately typed against the un-parameterised `GridApi` so any * `DataTableHandle` (incl. `PatientTableHandle`) satisfies it — * `GridApi` is invariant, so pinning a row type here would reject * every concretely-typed handle. */ export interface DataTableTabsGridSeam { getFilter: () => Record; setFilter: (model: Record) => void; getRawApi: () => GridApi | undefined; } export interface UseDataTableFilterTabsOptions { /** Resolve the grid seam at call time — `undefined` until grid-ready. */ getTable: () => DataTableTabsGridSeam | null | undefined; tabs?: SavedTab[]; defaultTabs?: SavedTab[]; onTabsChange?: (tabs: SavedTab[]) => void; activeTabId?: string; defaultActiveTabId?: string; onActiveTabChange?: (id: string) => void; /** Opt-in localStorage persistence — disabled while `tabs` is controlled. */ persistKey?: string; /** * Also persist the active tab id (needs `persistKey`), so a return to the * page lands on the tab — and the filter — the user left. Off by default: * the kit's baseline lands on the first tab so a stale aggressive filter is * never re-applied silently. */ persistActiveTab?: boolean; /** Capture/restore `quickFilterText` alongside the model. Default false. */ captureQuickFilter?: boolean; /** Apply the active tab's model on mount + tab switch. Default true. */ applyOnActivate?: boolean; /** Cap on the number of tabs. Default 8. */ maxTabs?: number; /** Factory for a new tab; `index` is 1-based (used for the default name). */ createTab?: (index: number) => SavedTab; /** Id factory — default `crypto.randomUUID()` with a counter fallback. */ makeTabId?: () => string; } export interface UseDataTableFilterTabsResult { tabs: SavedTab[]; activeTabId: string; selectTab: (id: string) => void; addTab: (label?: string, filterModel?: Record) => string; renameTab: (id: string, label: string) => void; removeTab: (id: string) => void; atCapacity: boolean; /** Synchronous snapshots for the imperative handle / agent adapter — * fresh immediately after a mutation, before React re-renders. */ getTabsSnapshot: () => SavedTab[]; getActiveTabIdSnapshot: () => string; } export declare function useDataTableFilterTabs(options: UseDataTableFilterTabsOptions): UseDataTableFilterTabsResult; //# sourceMappingURL=use-data-table-filter-tabs.d.ts.map