UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

35 lines (34 loc) 1.51 kB
import { Row, Table as TableType } from '@tanstack/table-core'; import { ReactNode } from 'react'; import { AsyncProps, FullEmptyProps } from '../Async/Async'; import { DataTableTableViewSpecificProps } from './DataTableTableView'; import { UseDataTableProps } from './DataTable.utils'; export type DataTableViewProps<Data> = { table: TableType<Data>; rows: Array<Row<Data>>; } & Pick<DataTableProps<Data>, "entityName">; type ViewRenderProp<Data> = (props: DataTableViewProps<Data>) => ReactNode; export interface DataTableProps<Data> extends UseDataTableProps<Data>, Pick<AsyncProps, "error" | "loading"> { className?: string; /** * Name of the presented data entity * Used inside empty states, placeholders * Provide pluralized and lowercased * @example "users" * */ entityName?: string; header?: ReactNode | ViewRenderProp<Data>; /** * Render props pattern to define different type of views than standard DataTableView * */ children?: ViewRenderProp<Data>; bordered?: boolean; /** * Hides DataTable features, like header or pagination if not required * */ minimal?: boolean; tableView?: DataTableTableViewSpecificProps<Data>; empty?: boolean | Partial<FullEmptyProps>; } export declare const DataTable: <Data>({ className, columns, entityName, data, pageSize, header, children, bordered, minimal, tableView, loading, error, empty, ...props }: DataTableProps<Data>) => import("react").JSX.Element; export {};