UNPKG

mithril-materialized

Version:
40 lines (39 loc) 1.33 kB
import { FactoryComponent, Attributes } from 'mithril'; import { EventHandler, SelectionMode } from './types'; export interface TreeNode { id: string; label: string; icon?: string; disabled?: boolean; expanded?: boolean; children?: TreeNode[]; } export type TreeIconType = 'caret' | 'chevron' | 'plus-minus' | 'triangle'; export interface TreeViewAttrs<T extends TreeNode = TreeNode> extends Attributes { /** Tree data structure */ data: T[]; /** Selection mode - none, single, or multiple */ selectionMode?: SelectionMode; /** Currently selected node IDs */ selectedIds?: string[]; /** Called when selection changes */ onselection?: EventHandler<string[]>; /** Called when node is expanded/collapsed */ onexpand?: EventHandler<{ nodeId: string; expanded: boolean; }>; /** Icon type for expand/collapse indicators */ iconType?: TreeIconType; /** Show connecting lines between tree levels (VSCode-style) */ showConnectors?: boolean; /** Allow keyboard navigation */ keyboardNavigation?: boolean; /** Optional CSS class */ className?: string; /** Optional inline styles */ style?: Record<string, any>; /** Component ID */ id?: string; } export declare const TreeView: FactoryComponent<TreeViewAttrs>;