import { type ReactNode, type HTMLAttributes, type ReactElement } from 'react'; import { type WrapperProps } from './data-loader'; import '../styles/components/data-table.scss'; type BasicDatum = Record; export type CommonColumn = { label?: ReactNode; name: string; render: (datum: Datum) => ReactNode; tooltip?: ReactNode; width?: string; }; export interface SortableColumn extends CommonColumn { sortable?: true; sorted?: 'ascend' | 'descend'; } export interface NonSortableColumn extends CommonColumn { sortable?: false | undefined; sorted?: never; } type SharedProps = { /** * An array of objects which specifies attributes about each column of your * data. Each object has label, name and render attributes. */ columns: Array | NonSortableColumn>; /** * Table fixed layout */ fixedLayout?: boolean; }; type HeadProps = { /** * Optional event handler called when a sortable column header gets clicked * Make sure that it doesn't change unecessarily by wrapping it in useCallback */ onHeaderClick?: (columnName: SortableColumn['name']) => void; }; type RowsProps = { /** * The data to be displayed */ data: Datum[]; loading?: boolean; /** * A function that returns a unique ID for each of the data objects. * Same function signature as a map function. */ getIdKey: (datum: Datum, index: number, data: Datum[]) => string; /** * A callback that is called whenever a user selects or unselects a row. */ onSelectionChange?: (event: MouseEvent | KeyboardEvent) => void; }; type TableProps = { /** * Display density of the table (default is 'normal') */ density?: 'normal' | 'compact'; /** * Choose to activate optimised rendering (default: false). Do not use if * - height of row is really tall or variable (scroll bar will jump) * - column width changes (should be fine with "fixedLayout") */ optimisedRendering?: boolean; }; export interface Props extends TableProps, RowsProps, Omit, 'selectable'>, SharedProps { } export declare const DataTable: ({ data, loading, columns, getIdKey, onHeaderClick, onSelectionChange, density, fixedLayout, optimisedRendering, className, ...props }: Props & HTMLAttributes) => ReactElement; export declare const DataTableWithLoader: (props: WrapperProps & Props & HTMLAttributes) => import("react/jsx-runtime").JSX.Element; export {}; //# sourceMappingURL=data-table.d.ts.map