export type TableSelection = Set; type RowSelectionState = Record; type RowSelectionUpdater = RowSelectionState | ((previous: RowSelectionState) => RowSelectionState); interface TableSelectionStore { clearSelection: (tableId: string) => void; getSelection: (tableId: string) => string[]; selections: Record; setSelection: (tableId: string, keys: string[]) => void; } type PersistedTableSelectionStore = Pick; export interface UseTableSelectionOptions { /** 'single' | 'multiple' - affects toggle behavior in the helper. */ selectionMode?: "single" | "multiple"; /** Unique identifier for the table (used as key in localStorage). */ tableId: string; } /** * Low-level persisted selection store. * Exported so advanced users can use it directly with TanStack Table or custom UIs. */ export declare const useTableSelectionStore: import('zustand').UseBoundStore, "setState" | "persist"> & { setState(partial: TableSelectionStore | Partial | ((state: TableSelectionStore) => TableSelectionStore | Partial), replace?: false | undefined): unknown; setState(state: TableSelectionStore | ((state: TableSelectionStore) => TableSelectionStore), replace: true): unknown; persist: { setOptions: (options: Partial>) => void; clearStorage: () => void; rehydrate: () => Promise | void; hasHydrated: () => boolean; onHydrate: (fn: (state: TableSelectionStore) => void) => () => void; onFinishHydration: (fn: (state: TableSelectionStore) => void) => () => void; getOptions: () => Partial>; }; }>; /** * Really nice, reusable hook for row selection with localStorage persistence (via Zustand). * * Designed to be composed with TanStack Table (or any UI). * Does NOT wrap the entire table - just the selection concern. * * @example with TanStack Table + HeroUI * const selection = useTableSelection({ tableId: 'my-table', selectionMode: 'multiple' }) * const { rowSelection, onRowSelectionChange } = toTanstackRowSelection(selection) * * const table = useReactTable({ * data, * columns, * state: { rowSelection }, * onRowSelectionChange, * getCoreRowModel: getCoreRowModel(), * // ... * }) */ export declare function useTableSelection({ tableId, selectionMode }: UseTableSelectionOptions): { /** Clear all for this table. */ clear: () => void; /** Whether multiple selection is enabled for this instance. */ isMultiple: boolean; isSelected: (key: string) => boolean; /** Select all provided keys (no-op for single mode). */ selectAll: (allKeys: string[]) => void; selectedCount: number; /** Current selection as Set (easy to work with). */ selectedKeys: Set; /** Set the entire selection (replaces current). */ setSelectedKeys: (keys: TableSelection | string[]) => void; /** Toggle a single row. Respects single vs multiple. */ toggle: (key: string) => void; }; /** * Tiny helper to turn our selection into TanStack rowSelection state shape. * This makes it easy to use with useReactTable without us over-wrapping the whole table. * * Example: * const { rowSelection, onRowSelectionChange } = toTanstackRowSelection(selection) * const table = useReactTable({ state: { rowSelection }, onRowSelectionChange, ... }) */ export declare function toTanstackRowSelection(selection: ReturnType): { enableRowSelection: boolean; onRowSelectionChange: (updater: RowSelectionUpdater) => void; rowSelection: RowSelectionState; }; export {};