import { ComponentPropsWithoutRef, Ref, ReactNode } from 'react'; import { LayoutUtilProps } from '../../../../types'; import { ColumnDef, CustomTableFooterCellProps, TableRow } from '../types'; import { DataTableCacheOptions, DataTableEmptyState, DataTablePaginationConfig, DataTableRef, SortedColumn } from './types'; export type { DataTableCacheOptions, DataTableRef, DataTableEmptyState, SortedColumn, }; type DataTableCellValue = object | string | number | boolean | bigint | symbol | null | undefined; export type DataTableRowData = Record; /** * Props for the DataTable component * @extends LayoutUtilProps * @extends ComponentPropsWithoutRef<"div"> */ export type DataTableProps = LayoutUtilProps & ComponentPropsWithoutRef<"div"> & { /** * The columns for the table, created with the `createColumnHelper` factory function. */ columns: ColumnDef[]; /** * The custom footer content for the table. Will be overridden by the footer content of the columns. */ customFooter?: CustomTableFooterCellProps[][]; /** * The data for the table. Must be an array of objects with an `id` property. */ data?: TableRow[] | Promise[]>; /** * The default expanded row ids. Can be "all" to expand all rows, or an array of row ids to expand specific rows. */ defaultExpandedRowIds?: "all" | TableRow["id"][]; /** * Disables the "expand all" action in the table header. * When true, users can only expand individual rows. * @default false */ disableExpandAll?: boolean; /** * The default selected row ids. */ defaultSelectedRowIds?: TableRow["id"][]; /** * The default sorted column. */ defaultSortedColumn?: SortedColumn; /** * The expanded row ids. */ expandedRowIds?: "all" | TableRow["id"][]; /** * Disables the "select all" action in the table header. * When true, users can only select individual rows. * @default false */ disableSelectAll?: boolean; /** * Whether the table is selectable. Can be a boolean or a function to customize the selection logic. * @default false */ isSelectable?: boolean | ((row: T) => boolean); /** * Called when the row expansion state changes. Passes the expanded row ids. */ onExpandRow?: (expandedRowIds: "all" | TableRow["id"][]) => void; /** * Called when the row selection state changes. Passes the selected row ids. */ onSelectRow?: (selectedRowIds: TableRow["id"][]) => void; /** * Called when the column sorting state changes. Passes the sorted column. */ onSort?: (sortedColumn: SortedColumn | undefined) => void; /** * Pagination configuration. When provided, enables pagination and filters data to show only the current page. * When `true`, the default pagination configuration is used. * When `false` or `undefined`, no pagination is applied and all data is shown. */ pagination?: boolean | DataTablePaginationConfig; /** * The selected row ids. */ selectedRowIds?: TableRow["id"][]; /** * The sorted column. */ sortedColumn?: SortedColumn; /** * Configuration for the empty state displayed when the table has no data. * Only shown when data is empty and the table is not loading. */ emptyState?: DataTableEmptyState; /** * Custom content to display when a cell value is empty (null, undefined, or empty string). * Overrides the default em dash for all columns. Individual columns can further override * this with their own `emptyCellContent` property. */ emptyCellContent?: ReactNode; }; declare function DataTableInner(props: DataTableProps, ref: Ref): import("react/jsx-runtime").JSX.Element; /** * Data table component for complex data grid layouts * * Features: * - Built-in focus management for accessibility * - Column resizing * - Column pinning * - Column grouping * - Controlled or uncontrolled column sorting * - Row selection * - Row expansion * - Row sub-component * - Row sub-rows * - Default and Strong backgrounds * - Pagination support with configurable items per page * - Imperative refresh via ref * - Customizable empty state with optional SVG illustration and content * * @param props - The props for the DataTable component * @param props.data - The data for the table. Must be an array of objects with an `id` property. * @param props.columns - The columns for the table, created with the `createColumnHelper` factory function. * @param props.customFooter - The custom footer content for the table. Will be overridden by the footer content of the columns. * @param props.defaultExpandedRowIds - The default expanded row ids. * @param props.defaultSelectedRowIds - The default selected row ids. * @param props.defaultSortedColumn - The default sorted column. * @param props.expandedRowIds - The expanded row ids. * @param props.isSelectable - Whether the table is selectable. Can be a boolean or a function to customize the selection logic. * @param props.onSelectRow - Called when the row selection state changes. Passes the selected row ids. * @param props.onSort - Called when the column sorting state changes. Passes the sorted column. * @param props.onExpandRow - Called when the row expansion state changes. Passes the expanded row ids. * @param props.pagination - Pagination configuration. When provided, enables pagination and filters data to show only the current page. When undefined, all data is shown and no pagination controls are rendered. * @param props.selectedRowIds - The selected row ids. * @param props.sortedColumn - The sorted column. * @param props.emptyState - Configuration for the empty state displayed when the table has no data. * @param props.style - The style of the table container. * @param props.rest - The rest of the props for the DataTable component, spread to the div surrounding the table. * * @example * console.log('Page changed to:', pageIndex), * showCount: true, * }} * /> */ type DataTableComponent = (props: DataTableProps & { ref?: Ref; }) => ReturnType; export declare const DataTable: DataTableComponent;