import * as react from 'react'; import { ReactNode } from 'react'; /** * Cell renderer — always `(value, row)`. `value` is `row[key]`; ignore it * (`(_value, row) => …`) when you only need the row. * Before 4.8.40 a single-parameter `(row) => …` form was auto-detected from * `fn.length`; that variant was removed because default/rest parameters made * detection unreliable. */ type ColumnRender = (value: unknown, row: T) => ReactNode; interface Column { key: string; /** Column heading — use `label` or `header` (alias). */ label?: string; header?: string; sortable?: boolean; filterable?: boolean; align?: 'left' | 'center' | 'right'; width?: string; render?: ColumnRender; } interface DataTableFilter { key: string; options?: string[]; allLabel?: string; /** Toolbar control — `segmented` (default) or searchable `combobox`. */ variant?: 'segmented' | 'combobox'; /** Combobox placeholder when `variant` is `combobox`. */ placeholder?: string; } interface DataTableBulkAction { label: string; variant?: 'primary' | 'secondary' | 'ghost' | 'ghost-destructive' | 'ghost-success' | 'ghost-warning' | 'ghost-info' | 'destructive' | 'terminal'; icon?: ReactNode; onRun: (selectedIds: (string | number)[], clearSelection: () => void) => void; } interface DataTableRowMenuItem { label: string; onSelect?: () => void; icon?: ReactNode; sep?: boolean; heading?: boolean; } interface DataTableProps> { columns: Column[]; /** Row data — use `data` or `rows` (alias). */ data?: T[]; rows?: T[]; /** Row key extractor — defaults to `row.id` or `row.key` */ rowKey?: keyof T | ((row: T) => string | number); onRowClick?: (row: T) => void; className?: string; emptyMessage?: string; /** Global search across `searchKeys` (or all column keys). */ searchable?: boolean; searchKeys?: (keyof T | string)[]; searchPlaceholder?: string; /** Column filter in rich mode — segmented tabs or searchable combobox. */ filter?: DataTableFilter; selectable?: boolean; /** Rows per page — fixed unless `pageSizeOptions` is set. */ pageSize?: number; /** Lets users change rows per page from the footer (initial value from `pageSize` or first option). */ pageSizeOptions?: number[]; bulkActions?: DataTableBulkAction[]; rowMenu?: (row: T) => DataTableRowMenuItem[]; toolbarRight?: ReactNode; emptyState?: ReactNode; loading?: boolean; skeletonRows?: number; /** Alternating row backgrounds in rich mode. */ striped?: boolean; /** Pin the first column and row-menu column during horizontal scroll (default: on in rich mode). */ pinColumns?: boolean; /** Extra content in the table footer bar (right of the row count). */ footer?: ReactNode; } declare const DataTable: react.ForwardRefExoticComponent> & react.RefAttributes>; export { type Column, type ColumnRender, DataTable, type DataTableBulkAction, type DataTableFilter, type DataTableProps, type DataTableRowMenuItem };