import type { MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent, TouchEvent as ReactTouchEvent } from 'react'; /** * DataTable columnSizing state represented with a columnId key and a pixel size value. * @public */ export type DataTableColumnSizingState = Record; /** * @public */ export interface DataTableColumnSizingBaseProps { /** * Enables resizable columns for the table. * @defaultValue false */ resizable?: boolean; /** * Callback that triggers when a user finishes resizing a column. */ onColumnSizingChange?: (newSizes: DataTableColumnSizingState) => void; } /** * @public */ export interface DataTableColumnSizingControlledProps extends DataTableColumnSizingBaseProps { /** * ColumnSizing state that lets you set the individual column sizes in a controlled scenario. */ columnSizing?: DataTableColumnSizingState; /** * ColumnSizing state that lets you set the individual column sizes in a uncontrolled scenario. */ defaultColumnSizing?: never; } /** * @public */ export interface DataTableColumnSizingUncontrolledProps extends DataTableColumnSizingBaseProps { /** * ColumnSizing state that lets you set the individual column sizes in a controlled scenario. */ columnSizing?: never; /** * ColumnSizing state that lets you set the individual column sizes in a uncontrolled scenario. */ defaultColumnSizing?: DataTableColumnSizingState; } /** * DataTable props associated with columnSizing / columnResizing feature. * @public */ export type DataTableColumnSizingProps = DataTableColumnSizingControlledProps | DataTableColumnSizingUncontrolledProps; /** * @internal */ export interface DataTableColumnSizingTableState { columnSizing: DataTableColumnSizingState; columnSizingInfo: DataTableColumnSizingInfoState; } /** @internal */ export interface DataTableColumnSizingHeader { handleResize: (event: ReactMouseEvent | ReactTouchEvent) => void; handleResizeExpand: (event: ReactMouseEvent) => void; } /** * @internal */ export interface DataTableColumnSizingInfoState { columnSizingStart: [string, number][]; deltaOffset: null | number; deltaPercentage: null | number; isResizingColumn: false | string; startOffset: null | number; startSize: null | number; } /** * Extension interface to extend the types of the `HeaderCell` from the tanstack table. * @internal */ export interface DataTableColumnSizingHeader { handleKeyboardResize: (event: ReactKeyboardEvent) => void; }