@furystack/shades-common-components
Version:
Common UI components for FuryStack Shades
27 lines • 1.08 kB
TypeScript
import type { ChildrenList, PartialElement } from '@furystack/shades';
import type { TreeService } from '../../services/tree-service.js';
export type TreeItemState = {
isFocused: boolean;
isSelected: boolean;
level: number;
hasChildren: boolean;
isExpanded: boolean;
};
export type TreeProps<T> = {
rootItems: T[];
treeService: TreeService<T>;
renderItem: (item: T, state: TreeItemState) => JSX.Element;
renderIcon?: (item: T, isExpanded: boolean) => JSX.Element;
variant?: 'contained' | 'outlined';
onItemActivate?: (item: T) => void;
onSelectionChange?: (selected: T[]) => void;
/**
* Section name for spatial navigation scoping.
* Sets `data-nav-section` on the tree host so that SpatialNavigationService
* constrains arrow-key navigation within the tree.
* Auto-generated per instance when not provided.
*/
navSection?: string;
} & PartialElement<HTMLDivElement>;
export declare const Tree: <T>(props: TreeProps<T>, children: ChildrenList) => JSX.Element<any>;
//# sourceMappingURL=tree.d.ts.map