import { ReactNode } from 'react'; import { MRT_ColumnDef, MRT_RowData, MRT_TableOptions } from 'material-react-table'; import { SurfaceRung } from '../../tokens/colors'; /** * Table (DataTable) * Classification: mui-wrapper (wraps material-react-table) * Base: https://www.material-react-table.com/ * * The product's standard list view. With nothing but `columns` and `data` it * renders the shape every AiStrike surface actually wants: a bordered table, a * recessed uppercase header, comfortable rows with a hairline rule between * them, and hover feedback. Spreadsheet behaviour — toolbar, pagination, * sorting, column menus — is off until you ask for it. * * Compose rows out of the exported cell primitives (`TableTitleCell`, * `TableStatusCell`, `TableMetricCell`, `TableMetaCell`, `TableChipsCell`, * `TableActionsCell`) rather than hand-building cells from Box/Typography. * * Do not restyle this component through `muiTablePaperProps` descendant * selectors or hardcoded hex — every value it uses is a token, and the props * below cover the cases that used to require an override. */ /** Background rung the table paints onto, or `transparent` to inherit. */ export type TableSurface = SurfaceRung | 'transparent'; /** Row rhythm. `compact` is for sub-tables, drawers and dialogs. */ export type TableDensity = 'comfortable' | 'compact'; export interface DataTableProps extends Omit, 'columns' | 'data'> { columns: MRT_ColumnDef[]; data: T[]; /** * Makes the whole row activate. Wires click, Enter/Space, `tabIndex`, * `aria-selected` and the pointer cursor — you do not need to add any of it. */ onRowClick?: (row: T) => void; /** * Marks a row as the current one. Matched against the row's id, which is * `row.id` on your data unless you pass your own `getRowId`. */ selectedRowId?: string | number; /** Rows this returns true for render at 72% opacity (drafts, disabled records). */ isRowDimmed?: (row: T) => boolean; /** Show skeleton rows in place of content. */ loading?: boolean; /** * What to show when there are no rows. Distinguish "nothing exists yet" from * "nothing matched the filter" — they need different words. */ empty?: ReactNode; /** Pin the header while the body scrolls. Pair with `maxHeight`. */ sticky?: boolean; /** Cap the body height and scroll inside the card. */ maxHeight?: number | string; /** Row rhythm. Defaults to `comfortable`. */ density?: TableDensity; /** Show the top toolbar (global search, filter and density controls). */ toolbar?: boolean; /** Show the pagination footer. */ pagination?: boolean; /** Allow sorting from the column headers. */ sortable?: boolean; /** Show the per-column action menu (hide, group, filter). */ columnActions?: boolean; /** * Which background the table paints. Defaults to the host rung via * `--ds-bg`, so a table in a dialog does not paint app-shell colours. Pass a * ladder rung to pin an absolute fill, or `'transparent'` to dissolve into a * container that already provides its own surface and border. */ surface?: TableSurface; /** Draw the rounded outline. On by default; turn off inside a Card. */ bordered?: boolean; } export declare function DataTable({ columns, data, onRowClick, selectedRowId, isRowDimmed, loading, empty, sticky, maxHeight, density, toolbar, pagination, sortable, columnActions, surface, bordered, ...rest }: DataTableProps): import("react").JSX.Element; export type { MRT_ColumnDef };