UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

43 lines (40 loc) 2.01 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { ReactNode } from 'react'; import { RowData, FilterFn, ColumnDef, Table as Table$1, InitialTableState, Row, TableState, TableOptions, RowSelectionState } from '@tanstack/react-table'; import { TableFilterType } from './TableFilterButton.js'; declare module '@tanstack/react-table' { interface ColumnMeta<TData extends RowData, TValue> { className?: string; filterType?: TableFilterType; } interface TableMeta<TData> { headerRowClassName?: TableFilterType; bodyRowClassName?: string; } interface FilterFns { dateRange: FilterFn<unknown>; } } type TableProps<T> = { data: T[]; columns: ColumnDef<T>[]; fillerRow?: (columnId: string, table: Table$1<T>) => ReactNode; initialState?: Omit<InitialTableState, 'columnSizing' | 'columnSizingInfo'>; className?: string; onRowClick?: (row: Row<T>, table: Table$1<T>) => void; state?: Omit<TableState, 'columnSizing' | 'columnSizingInfo'>; tableClassName?: string; } & Partial<TableOptions<T>>; /** * The standard table */ declare const Table: <T>({ data, fillerRow, initialState, onRowClick, className, tableClassName, defaultColumn, state, columns, ...tableOptions }: TableProps<T>) => react_jsx_runtime.JSX.Element; type TableUncontrolledProps<T> = TableProps<T>; declare const TableUncontrolled: <T>({ data, ...props }: TableUncontrolledProps<T>) => react_jsx_runtime.JSX.Element; type TableWithSelectionProps<T> = TableProps<T> & { rowSelection: RowSelectionState; disableClickRowClickSelection?: boolean; selectionRowId?: string; }; declare const TableWithSelection: <T>({ columns, state, fillerRow, rowSelection, disableClickRowClickSelection, selectionRowId, onRowClick, meta, ...props }: TableWithSelectionProps<T>) => react_jsx_runtime.JSX.Element; export { Table, type TableProps, TableUncontrolled, type TableUncontrolledProps, TableWithSelection, type TableWithSelectionProps };