UNPKG

3.33 kBTypeScriptView Raw
1import * as React from 'react';
2import { TreeViewCheckProps } from './TreeViewListItem';
3export interface TreeViewDataItem {
4 /** Internal content of a tree view item */
5 name: React.ReactNode;
6 /** Title a tree view item. Only used in Compact presentations. */
7 title?: React.ReactNode;
8 /** ID of a tree view item */
9 id?: string;
10 /** Child nodes of a tree view item */
11 children?: TreeViewDataItem[];
12 /** Flag indicating if node is expanded by default */
13 defaultExpanded?: boolean;
14 /** Default icon of a tree view item */
15 icon?: React.ReactNode;
16 /** Expanded icon of a tree view item */
17 expandedIcon?: React.ReactNode;
18 /** Flag indicating if a tree view item has a checkbox */
19 hasCheck?: boolean;
20 /** Additional properties of the tree view item checkbox */
21 checkProps?: TreeViewCheckProps;
22 /** Flag indicating if a tree view item has a badge */
23 hasBadge?: boolean;
24 /** Optional prop for custom badge */
25 customBadgeContent?: React.ReactNode;
26 /** Additional properties of the tree view item badge */
27 badgeProps?: any;
28 /** Action of a tree view item, can be a Button or Dropdown */
29 action?: React.ReactNode;
30}
31export interface TreeViewProps {
32 /** Data of the tree view */
33 data: TreeViewDataItem[];
34 /** ID of the tree view */
35 id?: string;
36 /** Flag indicating if the tree view is nested */
37 isNested?: boolean;
38 /** Flag indicating if all nodes in the tree view should have checkboxes */
39 hasChecks?: boolean;
40 /** Flag indicating if all nodes in the tree view should have badges */
41 hasBadges?: boolean;
42 /** Flag indicating if tree view has guide lines. */
43 hasGuides?: boolean;
44 /** Variant presentation styles for the tree view. */
45 variant?: 'default' | 'compact' | 'compactNoBackground';
46 /** Icon for all leaf or unexpanded node items */
47 icon?: React.ReactNode;
48 /** Icon for all expanded node items */
49 expandedIcon?: React.ReactNode;
50 /** Sets the expanded state on all tree nodes, overriding default behavior and current internal state */
51 allExpanded?: boolean;
52 /** Sets the default expanded behavior */
53 defaultAllExpanded?: boolean;
54 /** Callback for item selection */
55 onSelect?: (event: React.MouseEvent, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void;
56 /** Callback for item checkbox selection */
57 onCheck?: (event: React.ChangeEvent, item: TreeViewDataItem, parentItem: TreeViewDataItem) => void;
58 /** Active items of tree view */
59 activeItems?: TreeViewDataItem[];
60 /** Internal. Parent item of a TreeViewListItem */
61 parentItem?: TreeViewDataItem;
62 /** Comparison function for determining active items */
63 compareItems?: (item: TreeViewDataItem, itemToCheck: TreeViewDataItem) => boolean;
64 /** Class to add to add if not passed a parentItem */
65 className?: string;
66 /** Toolbar to display above the tree view */
67 toolbar?: React.ReactNode;
68 /** Flag indicating the TreeView should utilize memoization to help render large data sets. Setting this property requires that `activeItems` pass in an array containing every node in the selected item's path. */
69 useMemo?: boolean;
70}
71export declare const TreeView: React.FunctionComponent<TreeViewProps>;
72//# sourceMappingURL=TreeView.d.ts.map
\No newline at end of file