import type { TableCellResize } from './Table.js'; /** One column a person can hide, show or resize. */ export interface TableColumn { key: Key; /** Its name — the header, and its row in `TableColumnsMenu`. */ label: string; /** * Whether it can be hidden. `false` for the column that names each row: a * table of statuses with no names says nothing. Defaults to `true`. */ canHide?: boolean; /** Starts hidden: detail most people do not need, one choice away. */ defaultHidden?: boolean; /** Whether its header has a resize handle. Defaults to `false`. */ canResize?: boolean; /** Its width in pixels until resized; left out, it fits its content. */ defaultWidth?: number; /** The narrowest a resize takes it. Defaults to 80. */ minWidth?: number; /** The widest a resize takes it. Defaults to 640. */ maxWidth?: number; } export interface UseTableColumnsOptions { /** * A saved view to start from — what `hidden` and `widths` held when it was * stored. Read once, on the first render; the columns' own defaults fill * whatever it leaves out. */ initial?: { hidden?: Key[]; widths?: Partial>; }; /** The resize handle's name, from the column's label. "Resize Agent" by * default; pass one for translation. */ resizeLabel?: (label: string) => string; } export interface UseTableColumnsResult { /** Every column, in order, shown or not — for `TableColumnsMenu`. */ columns: readonly TableColumn[]; /** The columns shown, in order: render the headers and cells from these. */ visibleColumns: TableColumn[]; isVisible: (key: Key) => boolean; /** The hidden columns' keys. */ hidden: Key[]; /** Hide exactly these — from a saved view, a reset. A column that cannot * be hidden stays. */ setHidden: (keys: Key[]) => void; /** Widths people have set, by key. A column not in it has its own. */ widths: Partial>; /** Set every width at once — from a saved view; `{}` resets them. */ setWidths: (widths: Partial>) => void; /** Spread onto a column's header `TableCell`: its resize handle, if it * has one. */ headerProps: (key: Key) => { resize?: TableCellResize; }; } /** * The state of a table whose columns people choose and size: which are * shown, how wide the resized ones are, and the props that wire each header * and the columns menu to it. * * It renders nothing and hides nothing: the caller renders the headers and * cells of `visibleColumns`, so a hidden column's cells are not in the table * at all rather than there and invisible. The state is plain data, so a * saved view is `hidden` and `widths` stored, and restored with the setters. */ export declare function useTableColumns(columns: readonly TableColumn[], { initial, resizeLabel, }?: UseTableColumnsOptions): UseTableColumnsResult; //# sourceMappingURL=use-table-columns.d.ts.map