import * as React from 'react';

interface DataTableColumn<T> {
    id: string;
    header: React.ReactNode;
    cell?(row: T): React.ReactNode;
    sortable?: boolean;
    sortValue?(row: T): string | number | null;
    searchValue?(row: T): string;
    resizable?: boolean;
    width?: number;
    minWidth?: number;
}
interface DataTableSort {
    columnId: string;
    direction: 'asc' | 'desc';
}
interface DataTableSortingOptions {
    sort?: DataTableSort | null;
    defaultSort?: DataTableSort | null;
    onSortChange?(sort: DataTableSort | null): void;
    manual?: boolean;
}
interface DataTableSearchOptions {
    query?: string;
    defaultQuery?: string;
    onQueryChange?(query: string): void;
    manual?: boolean;
    label?: string;
}
interface DataTableColumnResizingOptions {
    widths?: Record<string, number>;
    defaultWidths?: Record<string, number>;
    onWidthsChange?(widths: Record<string, number>): void;
}
interface DataTablePaginationBaseOptions {
    page?: number;
    defaultPage?: number;
    onPageChange?(page: number): void;
    label?: string;
}
type DataTablePaginationOptions = DataTablePaginationBaseOptions & ({
    manual: true;
    pageCount: number;
    pageSize?: never;
} | {
    manual?: false;
    pageSize?: number;
    pageCount?: never;
});
interface DataTableCapability {
    readonly kind: 'sorting' | 'search' | 'resizing' | 'pagination';
}
declare function withSorting(options?: DataTableSortingOptions): DataTableCapability;
declare function withSearch(options?: DataTableSearchOptions): DataTableCapability;
declare function withColumnResizing(options?: DataTableColumnResizingOptions): DataTableCapability;
declare function withPagination(options: DataTablePaginationOptions): DataTableCapability;
interface DataTableProps<T> {
    caption: string;
    columns: Array<DataTableColumn<T>>;
    rows: readonly T[];
    getRowId(row: T): string;
    capabilities?: DataTableCapability[];
    loading?: boolean;
    error?: string | null;
    onRetry?(): void;
    emptyState?: React.ReactNode;
    className?: string;
}
declare function DataTable<T>({ caption, columns, rows, getRowId, capabilities, loading, error, onRetry, emptyState, className, }: DataTableProps<T>): React.JSX.Element;

export { DataTable, type DataTableCapability, type DataTableColumn, type DataTableColumnResizingOptions, type DataTablePaginationOptions, type DataTableProps, type DataTableSearchOptions, type DataTableSort, type DataTableSortingOptions, withColumnResizing, withPagination, withSearch, withSorting };
