import type { ColumnDef, Row } from "@tanstack/react-table"; import type { ReactNode } from "react"; import React from "react"; import type { PaginationType, SortingType } from "./types"; import { DataTableActions, DataTableBody, DataTableContainer, DataTableFooter, DataTableHeader, DataTableHeaderCell, DataTablePagination, DataTablePaginationButton, DataTableRowActions, DataTableSortableHeader, DataTableTable } from "./components"; export interface DataTableProps { /** * The actual data that will be used for the table. * Typescript should infer T from typeof data. * */ readonly data: T[]; /** * Should follow the @tanstack/react-table [ColumnDef](https://tanstack.com/table/v8/docs/guide/column-defs). * [createColumnHelper](https://tanstack.com/table/v8/docs/guide/column-defs#column-helpers) is also exposed to make it more convenient * to create columns. */ readonly columns: ColumnDef[]; /** * Enables pagination, mostly follows: * https://tanstack.com/table/v8/docs/api/features/pagination * */ readonly pagination?: PaginationType; /** * Enables sorting, mostly follows: * https://tanstack.com/table/v8/docs/api/features/sorting#table-options * */ readonly sorting?: SortingType; /** * This will force the table to have the specified hight * */ readonly height?: number; /** * When set to true makes the header sticky while scrolling vertically * */ readonly stickyHeader?: boolean; /** * Pins the firstColumn when scrolling horizontally * */ readonly pinFirstColumn?: boolean; /** * Enables row click action. The provided callback will be executed when the row is clicked. */ readonly onRowClick?: (row: Row) => void; /** * The elements to display when the data table is empty */ readonly emptyState?: ReactNode | ReactNode[]; /** * When true, shows the loading state of the DataTable */ readonly loading?: boolean; } export declare function DataTable({ data, columns, pagination, sorting, height, stickyHeader, pinFirstColumn, onRowClick, emptyState, loading, }: DataTableProps): React.JSX.Element; export declare namespace DataTable { var Table: typeof DataTableTable; var Header: typeof DataTableHeader; var HeaderCell: typeof DataTableHeaderCell; var Row: React.ForwardRefExoticComponent & React.RefAttributes>; var Cell: React.ForwardRefExoticComponent & React.RefAttributes>; var RowActions: typeof DataTableRowActions; var Actions: typeof DataTableActions; var Body: typeof DataTableBody; var Container: typeof DataTableContainer; var SortableHeader: typeof DataTableSortableHeader; var Footer: typeof DataTableFooter; var Pagination: typeof DataTablePagination; var PaginationButton: typeof DataTablePaginationButton; }