import React from 'react'; export interface TreeGridItem { /** Unique across the whole tree, not only among siblings. */ id: string; /** Rows under this one, opened by → or the chevron. */ children?: readonly TreeGridItem[]; /** * Typeahead and the row's name when the first column's cell is not a * string. */ textValue?: string; /** * Cannot be selected: its checkbox is disabled, and Space passes it by. It * can still be opened, read and activated — its rows may not be disabled. */ isDisabled?: boolean; } export type TreeGridColumnAlign = 'start' | 'end'; export interface TreeGridColumn { id: string; /** The header's text. */ header: React.ReactNode; /** The row's cell in this column. */ cell: (item: T) => React.ReactNode; /** `end` for numbers, so their digits line up. */ align?: TreeGridColumnAlign; /** A number is pixels, a string any CSS length. */ width?: number | string; } export type TreeGridSelectionMode = 'none' | 'single' | 'multiple'; export type TreeGridDensity = 'compact' | 'default' | 'relaxed'; export interface TreeGridProps { /** * The columns, in order. The first holds the tree — the indent, the * chevron — and names each row. */ columns: readonly TreeGridColumn[]; items: readonly T[]; /** Names the grid. Required unless `aria-labelledby` is given. */ 'aria-label'?: string; 'aria-labelledby'?: string; /** Rows that are open. Controlled. */ expandedKeys?: Iterable; /** Rows open at first. */ defaultExpandedKeys?: Iterable; onExpandedChange?: (keys: Set) => void; /** * `none` (default). `single`: Space or a press selects one row. * `multiple`: a Checkbox in each row and one in the header for every row. */ selectionMode?: TreeGridSelectionMode; selectedKeys?: Iterable; defaultSelectedKeys?: Iterable; onSelectionChange?: (keys: Set) => void; /** A row was activated — Enter, or a press when nothing is selectable. */ onAction?: (key: string) => void; /** Matches Table's density: vertical padding only. */ density?: TreeGridDensity; /** Shown, in a row of its own, when `items` is empty. */ renderEmptyState?: () => React.ReactNode; id?: string; className?: string; } /** * TreeGrid — rows that open to show the rows under them, in columns compared * down: a cost broken down by agent and run, a budget by team and person, a * folder listing with size and owner. * * HOW IT IS BUILT * * - React Aria's table hooks over its tree-table state * (`UNSTABLE_useTreeGridState`): a `` with `role="treegrid"`. * Only open rows are rendered, flat, each with `aria-level`, * `aria-posinset`, `aria-setsize`, and `aria-expanded` when it has * children. * - One tab stop. ↑ ↓ move between rows, or between cells in a column; → * opens a closed row and, on an open one or a leaf, moves into its cells; * ← moves back out to the row, closes an open row, and on a closed one * moves to its parent. Home and End go to the first and last row, and * typing jumps to a row by its first column. * - The first column holds the tree and names the row: each row is indented * by its level, and a chevron, out of the tab order and named "Expand" or * "Collapse" in the user's locale, opens it with a pointer. * - It draws as a Table does — the same density, header, rules and * selected tint — and its selection is Table's: a Checkbox per row and a * select-all in the header. Selection does not cascade: a parent is a row * of its own. */ export declare function TreeGrid({ columns, items, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, expandedKeys, defaultExpandedKeys, onExpandedChange, selectionMode, selectedKeys, defaultSelectedKeys, onSelectionChange, onAction, density, renderEmptyState, id, className, }: TreeGridProps): React.JSX.Element; export declare namespace TreeGrid { var displayName: string; } //# sourceMappingURL=TreeGrid.d.ts.map