import type { ButtonIconSpec } from '@ankhorage/surface'; import type React from 'react'; import type { ZoraBaseProps } from './base'; import type { PopoverMenuActionIntent } from './popover-menu'; export type DataTableColumnAlign = 'start' | 'center' | 'end'; export type DataTableDensity = 'comfortable' | 'compact'; export type DataTableSortDirection = 'asc' | 'desc'; export interface DataTableSortState { columnId: string; direction: DataTableSortDirection; } export interface DataTableCellContext { row: TRow; rowIndex: number; column: DataTableColumn; value: unknown; } export interface DataTableColumn { id: string; header: React.ReactNode; accessor?: keyof TRow; align?: DataTableColumnAlign; width?: number; minWidth?: number; sortable?: boolean; renderCell?: (context: DataTableCellContext) => React.ReactNode; } export interface DataTableRowAction { id: string; title: React.ReactNode; description?: React.ReactNode; icon?: ButtonIconSpec; intent?: PopoverMenuActionIntent; disabled?: boolean; onPress?: (row: TRow) => void; } export interface DataTableProps extends ZoraBaseProps { columns: readonly DataTableColumn[]; rows: readonly TRow[]; rowId?: (row: TRow, index: number) => string; rowKey?: keyof TRow; rowActions?: (row: TRow, index: number) => readonly DataTableRowAction[]; sort?: DataTableSortState; onSortChange?: (sort: DataTableSortState) => void; loading?: boolean; loadingRows?: number; emptyTitle?: React.ReactNode; emptyDescription?: React.ReactNode; density?: DataTableDensity; testID?: string; }