import React from 'react'; export interface TreeViewItem { /** Unique across the whole tree, not only among siblings. */ id: string; /** The row's text. */ label: React.ReactNode; /** Typeahead and the accessible name when `label` is not a string. */ textValue?: string; /** A second line, quieter: a count, a path, a type. */ description?: React.ReactNode; /** A 16px Icon before the label — a folder, a team. */ icon?: React.ReactNode; children?: readonly TreeViewItem[]; isDisabled?: boolean; } export type TreeViewSelectionMode = 'none' | 'single' | 'multiple'; export interface TreeViewProps { items: readonly TreeViewItem[]; /** Names the tree. 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): a row press opens or closes it, or fires `onAction`. * `single` / `multiple`: a press selects, and `multiple` draws a check. */ selectionMode?: TreeViewSelectionMode; selectedKeys?: Iterable; defaultSelectedKeys?: Iterable; onSelectionChange?: (keys: Set) => void; /** * A row was activated — Enter, or a press when nothing is selectable. For * "open this": navigating to a folder, showing a record. */ onAction?: (key: string) => void; id?: string; className?: string; } /** * TreeView — a hierarchy you open level by level: folders, an org chart, * nested permissions. * * NOT FOR NAVIGATION. A site's own pages, nested, are Sidebar sections: links * with `aria-current`, reached by Tab. A tree is one tab stop that the arrow * keys move inside, which is right for data and wrong for a menu of pages. * * HOW IT IS BUILT * * - React Aria's `useTree` and `useTreeItem`, over `useTreeState`: a * `treegrid` of flat rows, each with `aria-level`, `aria-expanded` and * its position among its siblings. One tab stop; ↑ ↓ move between visible * rows, → opens a row, ← closes it or moves to its parent, Home and End * go to the ends, and typing jumps to a label. A second → on an open row * stays put: in a treegrid → moves into the row's cells, not its children * — ↓ is the way down. * - The chevron is a button out of the tab order, named "Expand" or * "Collapse" in the user's locale, so a pointer can open a row that a * press would select. * - Only open rows are rendered. A closed branch's children are not in the * DOM, and the keyboard cannot land on them. * - `multiple` draws a check in each row — MultiSelect's box, for the same * reason: "pick several" has to look like it. Selection does not cascade: * a parent is an item of its own, and ticking it ticks only it. */ export declare function TreeView({ items, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, expandedKeys, defaultExpandedKeys, onExpandedChange, selectionMode, selectedKeys, defaultSelectedKeys, onSelectionChange, onAction, id, className, }: TreeViewProps): React.JSX.Element; export declare namespace TreeView { var displayName: string; } //# sourceMappingURL=TreeView.d.ts.map