import { default as React } from 'react'; import { DroppableCollectionReorderEvent, DropPosition } from 'react-aria-components'; import { SafeOmit } from '../../.deps/utils/src'; import { TreeItem } from './TreeItem/TreeItem'; import { TreeBaseProps } from './TreeBase'; import { TreeItemKey, TreeNode } from './useTreeState'; export type { TreeItemKey, TreeNode } from './useTreeState'; export type { TreeItemRenderProps } from './TreeItem/TreeItem'; export interface TreeMoveEvent extends SafeOmit { /** The set of item keys being moved. */ keys: Set; /** The drop target information. */ target: { /** The type of the target (always 'item'). */ type: 'item'; /** The key of the target item. */ key: V; /** The position where items should be dropped relative to the target. */ dropPosition: DropPosition; }; } export type TreeMoveHandler = (e: TreeMoveEvent, newTree: TreeNode[]) => void | Promise; export interface TreeOwnProps { /** The items to render in the tree (controlled). */ items?: T[]; /** The default items to render in the tree (uncontrolled). */ defaultItems?: T[]; /** * Defines the scope of selection: 'node' selects only the node, 'children' also selects all descendants, * 'parents' also selects all ancestors. */ selectionScope?: 'node' | 'children' | 'parents'; /** Handler called when children need to be loaded for an item. Returns a promise of child items. */ onLoadChildren?: (key: V) => Promise; /** Handler called when items are moved via drag and drop. */ onMove?: TreeMoveHandler; } export interface InheritedTreeBaseProps extends SafeOmit, 'items' | 'onLoadChildren' | 'dragAndDropHooks'> { } export interface TreeProps extends TreeOwnProps, InheritedTreeBaseProps { } export declare const Tree: ((props: TreeProps) => React.JSX.Element) & { Item: typeof TreeItem; };