import type { ColumnDef } from '@tanstack/react-table'; import type { PageChangeEvent } from '../components/pagination/Pagination'; import { type PaginationState } from './usePagination'; import { type SortDirection, type SortState, type ColumnComparators } from './useSorting'; export interface UseTableDataProps { data?: readonly T[]; pagination?: { skip?: number; take?: number; state?: PaginationState; onStateChange?: (next: PaginationState) => void; }; sorting?: { sortBy?: string | null; direction?: SortDirection; state?: SortState; onStateChange?: (next: SortState) => void; columnComparators?: ColumnComparators; nulls?: 'first' | 'last'; allowUnsort?: boolean; columns?: ReadonlyArray>; }; /** * Resets to page 1 whenever sorting changes (typical UX). */ resetPageOnSortChange?: boolean; } export interface UseTableDataResult { rows: T[]; totalCount: number; pagination: { state: PaginationState; onPageChange: (e: PageChangeEvent) => void; resetPage: () => void; }; sorting: { state: SortState; onSortChange: (next: Partial>) => void; clearSort: () => void; }; } export declare function useTableData>({ data, pagination, sorting, resetPageOnSortChange, }: UseTableDataProps): UseTableDataResult;