import { Key, ReactElement, ReactNode, RefObject } from 'react'; import { Layout, ReusableView } from '@react-stately/virtualizer'; import type { GridNode } from '@react-types/grid'; import type { ColumnSize, TableCollection } from '@react-types/table'; import { BadgeProps } from './badge'; import { BoxProps } from './box'; import { IconTypeExtended } from './icon'; import { loadingState } from './shared'; export interface DataTableBadgeProps extends BadgeProps { cell?: string; } export interface MultiLineCell { name?: string; accountId?: number | string; icon?: IconTypeExtended; key?: Key; } export interface DataTableMultiLineProps { cell: MultiLineCell[]; } export interface DataTableItem { type: string; } export interface DataTableVirtualizerProps { renderWrapper: (parent: ReusableView | null, reusableView: ReusableView, children: ReusableView[], renderChildren: (views: ReusableView[]) => ReactElement[]) => ReactElement; collection: TableCollection; layout: Layout; focusedKey?: Key; sizeToFit?: 'width' | 'height'; scrollDirection?: 'horizontal' | 'vertical' | 'both'; isLoading?: boolean; onLoadMore?: () => void; shouldUseVirtualFocus?: boolean; scrollToItem?: (key: Key) => void; hasAutoFocus?: boolean; children?: ReactNode | ((type: string, content: T | ReactNode) => V); renderView: (type: string, content: T) => V | undefined; domRef: RefObject; bodyRef: RefObject; onVisibleRectChange(rect: object): void; headerRef: RefObject; isFocusVisible?: boolean; height?: string | number; style?: { whiteSpace?: 'normal' | 'initial'; }; } export type SortDescriptor = { column?: string; direction?: 'ascending' | 'descending'; }; export interface DataTableProps { onSelectedKeyChange?: () => void; selectedKeys?: Key[]; defaultSelectedKeys?: Key[]; selectionMode?: 'single' | 'none'; 'aria-label'?: string; onAction?: () => void; density?: 'compact' | 'medium' | 'spacious'; height?: string | number; hasHiddenHeader?: boolean; isSortable?: boolean; items?: Iterable; overflowMode?: 'wrap' | 'truncate'; onLoadMore?: () => void; onSortChange?: () => void; loadingState?: loadingState; sortDescriptor?: SortDescriptor; width?: string | number; children: ReactNode; scale?: 'large' | 'medium' | 'xl'; containerProps?: BoxProps; } export interface DataTableCellProps { cell: GridNode; } export interface DataTableHeaderRowProps { item: GridNode; children: ReactNode; style: object; } export interface DataTableRowProps { item: GridNode; children: ReactNode; hasActions?: () => void; style: object; } export interface DataTableColumnHeader { column: GridNode; isFirst: boolean; isLast: boolean; align?: string; hideHeader?: boolean; } export type GetDefaultMinWidth = (column: GridNode) => ColumnSize | null | undefined;