/** * @usevyre/react — Tree * * AI CONTEXT: * ┌──────────────────────────────────────────────────────────────────┐ * │ Component: Tree │ * │ Import: import { Tree } from "@usevyre/react" │ * │ │ * │ Hierarchical tree view (file explorer / nested nav). DATA-DRIVEN │ * │ and CONTROLLED. Pass a nested array; the Tree renders recursively.│ * │ │ * │ data = TreeNode[] where TreeNode = { │ * │ id: string; label: ReactNode; │ * │ icon?: ReactNode; disabled?: boolean; │ * │ children?: TreeNode[] │ * │ } │ * │ expandedIds? = string[] (controlled) │ * │ defaultExpandedIds = string[] (uncontrolled) │ * │ onExpandedChange? = (ids: string[]) => void │ * │ selectedId? = string | null (controlled) │ * │ defaultSelectedId = string | null (uncontrolled) │ * │ onSelect? = (id: string) => void │ * │ │ * │ Single selection. A node with `children` is a folder (toggles │ * │ expand on click); a leaf fires onSelect. Keyboard: ↑/↓ move, │ * │ →/← expand/collapse, Enter/Space select. │ * └──────────────────────────────────────────────────────────────────┘ * * @example * const [sel, setSel] = useState("a/b.ts"); * */ import React from "react"; import type { BaseProps } from "../../types"; export interface TreeNode { id: string; label: React.ReactNode; icon?: React.ReactNode; disabled?: boolean; children?: TreeNode[]; } export interface TreeProps extends Omit, "onSelect">, BaseProps { data: TreeNode[]; expandedIds?: string[]; defaultExpandedIds?: string[]; onExpandedChange?: (ids: string[]) => void; selectedId?: string | null; defaultSelectedId?: string | null; onSelect?: (id: string) => void; } export declare const Tree: React.ForwardRefExoticComponent>;