import type { AriaLabelingProps, DisabledBehavior, DOMProps, DOMRef, Key, SpectrumSelectionProps, StyleProps } from '@react-types/shared'; import { Cell, ColumnSize, Row, TableBody, TableHeader, TableProps } from 'react-stately/useTableState'; import type { DragAndDropHooks } from '../dnd/useDragAndDrop'; import React, { JSX, ReactElement } from 'react'; import { Section } from 'react-stately/Section'; import { SpectrumColumnProps } from './types'; export interface SpectrumTableProps extends Omit, 'treeColumn' | 'expandedKeys' | 'defaultExpandedKeys' | 'onExpandedChange'>, SpectrumSelectionProps, DOMProps, AriaLabelingProps, StyleProps { /** * Sets the amount of vertical padding within each cell. * * @default 'regular' */ density?: 'compact' | 'regular' | 'spacious'; /** * Sets the overflow behavior for the cell contents. * * @default 'truncate' */ overflowMode?: 'wrap' | 'truncate'; /** Whether the TableView should be displayed with a quiet style. */ isQuiet?: boolean; /** Sets what the TableView should render when there is no content to display. */ renderEmptyState?: () => JSX.Element; /** * Whether `disabledKeys` applies to all interactions, or only selection. * * @default 'selection' */ disabledBehavior?: DisabledBehavior; /** Handler that is called when a user performs an action on a row. */ onAction?: (key: Key) => void; /** * Handler that is called when a user starts a column resize. */ onResizeStart?: (widths: Map) => void; /** * Handler that is called when a user performs a column resize. * Can be used with the width property on columns to put the column widths into * a controlled state. */ onResize?: (widths: Map) => void; /** * Handler that is called after a user performs a column resize. * Can be used to store the widths of columns for another future session. */ onResizeEnd?: (widths: Map) => void; /** * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for * the TableView. * * @version beta */ dragAndDropHooks?: DragAndDropHooks>['dragAndDropHooks']; /** * Whether the TableView should support expandable rows. Requires the feature flag to be enabled * first, see https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows. * * @private * @version alpha */ UNSTABLE_allowsExpandableRows?: boolean; /** * The currently expanded keys in the collection (controlled). Requires the feature flag to be * enabled along with UNSTABLE_allowsExpandableRows, see * https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows. * * @private * @version alpha */ UNSTABLE_expandedKeys?: 'all' | Iterable; /** * The initial expanded keys in the collection (uncontrolled). Requires the feature flag to be * enabled along with UNSTABLE_allowsExpandableRows, see * https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows. * * @private * @version alpha */ UNSTABLE_defaultExpandedKeys?: 'all' | Iterable; /** * Handler that is called when items are expanded or collapsed. Requires the feature flag to be * enabled along with UNSTABLE_allowsExpandableRows, see * https://react-spectrum.adobe.com/react-spectrum/TableView.html#expandable-rows. * * @private * @version alpha */ UNSTABLE_onExpandedChange?: (keys: Set) => any; } /** * Tables are containers for displaying information. They allow users to quickly scan, sort, * compare, and take action on large amounts of data. */ declare const TableView: (props: SpectrumTableProps & { ref?: DOMRef | undefined; }) => ReactElement>; export { TableView }; declare const SpectrumColumn: (props: SpectrumColumnProps) => JSX.Element; export { SpectrumColumn as Column }; export { Cell, Row, Section, TableBody, TableHeader };