@attebyte/react-tree-select 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,45 +1,55 @@
1
- # React Tree Select &nbsp;&nbsp;<img src="https://firebasestorage.googleapis.com/v0/b/attebyte-8542f.appspot.com/o/react-tree-select%2Freact.svg?alt=media&token=a2cf555d-d091-4b45-af56-6fc97062c66d" alt="React Icon" width="30" height="30" /> &nbsp; <img src="https://firebasestorage.googleapis.com/v0/b/attebyte-8542f.appspot.com/o/react-tree-select%2Ftailwind.svg?alt=media&token=7655c1f4-9525-4c53-acfa-07b4d95edb22" alt="React Icon" width="30" height="30" />
2
- A simple, highly customizable tree component. <br/>
3
- [View Full Documentation](https://rts.attebyte.io)
1
+ # React Tree Select
2
+
3
+ **An accessible, customizable tree select and checkbox tree component for React**, with tri-state (indeterminate) selection, keyboard navigation, TypeScript generics, and replaceable parts.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@attebyte/react-tree-select)](https://www.npmjs.com/package/@attebyte/react-tree-select)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@attebyte/react-tree-select)](https://www.npmjs.com/package/@attebyte/react-tree-select)
7
+ [![CI](https://github.com/Attebyte/react-tree-select/actions/workflows/ci.yml/badge.svg)](https://github.com/Attebyte/react-tree-select/actions/workflows/ci.yml)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
9
+ ![TypeScript](https://img.shields.io/badge/types-TypeScript-3178c6)
10
+
11
+ **[Documentation](https://rts.attebyte.io)** · **[Examples](https://rts.attebyte.io/docs/examples)** · **[Storybook playground](https://rts.attebyte.io/storybook/index.html)** · **[API reference](https://rts.attebyte.io/docs/api)**
12
+
13
+ <img src="https://firebasestorage.googleapis.com/v0/b/attebyte-8542f.appspot.com/o/react-tree-select%2Ftree-select-example.gif?alt=media&token=0fb3fbaf-95b2-40d9-a065-be2e08515272" alt="Animated example of React Tree Select: expanding nodes and checking a parent, which checks its children and marks its ancestors as partially selected">
14
+
15
+ ## Features
16
+
17
+ - **Tri-state selection.** Checking a parent checks its descendants, and parents show checked, unchecked or indeterminate based on what is selected beneath them. Disabled nodes are respected. Turn it off for independent selection.
18
+ - **Accessible.** Follows the [WAI-ARIA tree view pattern](https://www.w3.org/WAI/ARIA/apg/patterns/treeview/): a single tab stop, arrow key navigation, and screen reader support for expanded, checked and mixed states. Tested with axe.
19
+ - **Works with your data.** Pass your own tree-shaped objects and name the properties that hold the ID, label, children and checked state. TypeScript checks the property names against your node type.
20
+ - **Customizable.** Style every part with class names (merged with tailwind-merge), or replace the node, label, checkbox or expand icon with your own components, for example to build a file tree or a comment thread.
21
+ - **Controlled or uncontrolled**, with helpers to read the selected IDs.
22
+ - **Fast with large trees.** Changes copy only the affected branch and unchanged nodes skip re-rendering.
23
+ - **Small.** About 17 KB of JavaScript and 3 KB of CSS, with no global style resets. Supports React 18 and 19 and server-side rendering.
4
24
 
5
25
  ## Installation
6
- Install using the package manager of your choice.
7
26
 
27
+ ```sh
28
+ npm install @attebyte/react-tree-select
8
29
  ```
9
- npm i @attebyte/react-tree-select
10
- ```
11
- ```
30
+
31
+ ```sh
12
32
  yarn add @attebyte/react-tree-select
13
33
  ```
14
34
 
15
- ## Getting Started
35
+ ```sh
36
+ pnpm add @attebyte/react-tree-select
37
+ ```
16
38
 
17
- Simply pass your tree shaped data to TreeSelect along with the required properties.
39
+ ## Quick start
18
40
 
19
- ```
41
+ ```tsx
20
42
  import TreeSelect from '@attebyte/react-tree-select';
21
- import '@attebyte/react-tree-select/dist/style.css';
43
+ import '@attebyte/react-tree-select/style.css';
22
44
 
23
- function App() {
24
- return (
25
- <>
26
- <TreeSelect
27
- defaultData={ExampleData}
28
- labelProperty={'label'}
29
- valueProperty={'included'}
30
- childrenProperty={'children'}
31
- uniqueIDProperty={'value'}
32
-
33
- />
34
- </>
35
- )
45
+ interface Category {
46
+ label: string;
47
+ value: number;
48
+ included?: boolean | null; // true = checked, null = partially checked
49
+ children?: Category[];
36
50
  }
37
51
 
38
- export default App
39
- ```
40
-
41
- ```
42
- const ExampleData: ExampleNode[] = [
52
+ const categories: Category[] = [
43
53
  {
44
54
  label: 'Root 1',
45
55
  value: 1,
@@ -48,73 +58,190 @@ const ExampleData: ExampleNode[] = [
48
58
  label: 'Child 1',
49
59
  value: 2,
50
60
  children: [
51
- {
52
- label: 'Grandchild 1',
53
- value: 3,
54
- },
55
- {
56
- label: 'Grandchild 2',
57
- value: 4,
58
- }
61
+ { label: 'Grandchild 1', value: 3 },
62
+ { label: 'Grandchild 2', value: 4 }
59
63
  ]
60
64
  },
61
- {
62
- label: 'Child 2',
63
- value: 5,
64
- }
65
+ { label: 'Child 2', value: 5 }
65
66
  ]
66
67
  },
67
68
  {
68
69
  label: 'Root 2',
69
70
  value: 6,
70
71
  children: [
71
- {
72
- label: 'Child 3',
73
- value: 7,
74
- },
75
- {
76
- label: 'Child 4',
77
- value: 8,
78
- }
72
+ { label: 'Child 3', value: 7 },
73
+ { label: 'Child 4', value: 8 }
79
74
  ]
80
75
  }
81
76
  ];
77
+
78
+ export default function App() {
79
+ return (
80
+ <TreeSelect
81
+ defaultData={categories}
82
+ uniqueIDProperty='value'
83
+ labelProperty='label'
84
+ childrenProperty='children'
85
+ valueProperty='included'
86
+ onChange={tree => console.log(tree)}
87
+ aria-label='Categories'
88
+ />
89
+ );
90
+ }
91
+ ```
92
+
93
+ ## Reading the selection
94
+
95
+ `onChange` receives the updated tree. To get the selected IDs, use `getSelectedIDs`:
96
+
97
+ ```tsx
98
+ import { getSelectedIDs } from '@attebyte/react-tree-select';
99
+
100
+ const ids = getSelectedIDs(tree, {
101
+ uniqueIDProperty: 'value',
102
+ childrenProperty: 'children',
103
+ valueProperty: 'included',
104
+ mode: 'leaves' // or 'all' (default), or 'topmost'
105
+ });
106
+ ```
107
+
108
+ `'leaves'` returns only checked nodes without children, and `'topmost'` lets a fully checked parent stand in for its subtree. `getSelectedNodes` returns the nodes instead of their IDs. See [Selection](https://rts.attebyte.io/docs/selection).
109
+
110
+ ## Controlled usage
111
+
112
+ Pass `data` instead of `defaultData` to keep the tree in your own state. The tree renders exactly the data it is given, so update it from `onChange`:
113
+
114
+ ```tsx
115
+ const [data, setData] = useState(categories);
116
+
117
+ <TreeSelect
118
+ data={data}
119
+ onChange={setData}
120
+ uniqueIDProperty='value'
121
+ labelProperty='label'
122
+ childrenProperty='children'
123
+ valueProperty='included'
124
+ />
82
125
  ```
83
126
 
84
- <img src="https://firebasestorage.googleapis.com/v0/b/attebyte-8542f.appspot.com/o/react-tree-select%2Ftree-select-example.gif?alt=media&token=0fb3fbaf-95b2-40d9-a065-be2e08515272" alt="Example GIF">
127
+ Your data is never modified. `onChange` receives a new tree in which unchanged nodes are reused from the previous one, so treat it as immutable. See [Controlled usage](https://rts.attebyte.io/docs/controlled).
85
128
 
86
129
  ## Props
87
- Commonly required props for most use cases. To see a full list of available properties, see our [full documentation](https://rts.attebyte.io/#api).
88
-
89
- | Property | Type | Required? | Description |
90
- | ----------- | ----------- | ----------- | ----------- |
91
- | `data` | `T[]` | yes* | The data to be rendered, if controlled |
92
- | `defaultData` | `T[]` | yes* | The data to be rendered, if uncontrolled |
93
- | `uniqueIDProperty` | `keyof T` | yes | The property of your tree node that uniquely identifies the node |
94
- | `labelProperty` | `keyof T` | yes | The property of your node to display |
95
- | `childrenProperty` | `keyof T` | yes | The property of your node that holds the node's children |
96
- | `valueProperty` | `keyof T` | yes* | Required if you intend to use the tree to select nodes. If using for display purposes only, not required |
97
- | `onChange` | `(data: T[]) => void` | yes* | Required if you intend to use the the tree to select nodes. Called every time a node selection is changed with the updated tree
130
+
131
+ The most commonly used props. See the [API reference](https://rts.attebyte.io/docs/api) for all of them.
132
+
133
+ | Prop | Type | Description |
134
+ | --- | --- | --- |
135
+ | `data` / `defaultData` | `T[]` | The tree to render, controlled or uncontrolled. |
136
+ | `uniqueIDProperty` | `keyof T` | **Required.** Property that uniquely identifies each node. |
137
+ | `labelProperty` | `keyof T` | **Required.** Property holding the node's label. |
138
+ | `childrenProperty` | `keyof T` | **Required.** Property holding the node's children. |
139
+ | `valueProperty` | `keyof T` | Property holding the checked state. Without it, the tree is display-only. |
140
+ | `disabledProperty` | `keyof T` | Property that marks a node as disabled. |
141
+ | `onChange` | `(data: T[]) => void` | Called with the updated tree whenever a selection changes. |
142
+ | `chainedSelect` | `boolean` | Default `true`. Selection flows to descendants and parents reflect their children. |
143
+ | `defaultExpanded` | `boolean` | Default `false`. Whether nodes start expanded. |
98
144
 
99
145
  ## Customization
100
- This library is built with customization in mind and contains minimal default styles using tailwind. The library consists of 4 replacable parts:
101
- - `TreeNode` - The container for an individual node
102
- - `NodeLabel` - The label displyed within each node
103
- - `NodeCheck` - The checkbox used to select a node or indicate descendent's selections
104
- - `ExpandIcon` - Icon to indicate if a node has children or is collapsed / expanded
105
- For additional information and examples of customization, please see our full documentation.
106
146
 
107
- <br/>
147
+ TreeSelect is made of four replaceable parts:
148
+
149
+ - `TreeNode`: the container for a node and its nested nodes
150
+ - `NodeLabel`: the label displayed in each node
151
+ - `NodeCheck`: the checkbox that selects a node or shows its descendants' selection
152
+ - `ExpandIcon`: the icon that shows whether a node with children is expanded or collapsed
153
+
154
+ Style them with `nodeClassName`, `labelClassName`, `inputClassName` and `iconClassName`, or replace them with `CustomNodeComponent`, `CustomLabelComponent`, `CustomCheckComponent` and `CustomExpandIconComponent`. A custom `TreeNode` should spread `treeItemProps` onto its root element and render `children` (the nested nodes) so keyboard navigation keeps working:
155
+
156
+ ```tsx
157
+ const MyNode = (props: TreeNodeProps<Category>) => {
158
+ const { standardComponentProps, treeItemProps, expanded, onExpandedChange, children } = props;
159
+
160
+ return (
161
+ <div {...treeItemProps}>
162
+ <button onClick={() => onExpandedChange?.(!expanded)}>{standardComponentProps.node.label}</button>
163
+ {children && <div role='group'>{children}</div>}
164
+ </div>
165
+ );
166
+ };
167
+ ```
168
+
169
+ See [Customization](https://rts.attebyte.io/docs/customization) and the [examples](https://rts.attebyte.io/docs/examples).
170
+
171
+ ## Accessibility
172
+
173
+ Give each tree an accessible name with `aria-label` or `aria-labelledby`. The tree is a single tab stop. Once it has focus:
174
+
175
+ | Key | Action |
176
+ | --- | --- |
177
+ | <kbd>↓</kbd> / <kbd>↑</kbd> | Move to the next or previous visible node |
178
+ | <kbd>→</kbd> | Expand a collapsed node, or move to the first child of an expanded node |
179
+ | <kbd>←</kbd> | Collapse an expanded node, or move to the parent node |
180
+ | <kbd>Home</kbd> / <kbd>End</kbd> | Move to the first or last visible node |
181
+ | <kbd>Space</kbd> | Check or uncheck the node |
182
+ | <kbd>Enter</kbd> | Activate the node, the same as clicking its label |
183
+
184
+ See [Accessibility](https://rts.attebyte.io/docs/accessibility).
185
+
186
+ ## Upgrading from 1.x
187
+
188
+ Version 2.0 contains breaking changes:
189
+
190
+ - **Controlled mode is now fully controlled.** When you pass `data`, the tree renders exactly that data, so selections only appear once you pass the tree from `onChange` back in as `data`. Previously the tree kept its own copy and updated it even if you ignored `onChange`. If you don't want to manage the state yourself, use `defaultData`.
191
+ - **Parents with disabled children are mixed, not checked.** With chained selection, checking a parent whose disabled child is unchecked now makes the parent mixed (`null`) instead of checked, so its value always reflects its subtree. Clicking it again unchecks its enabled descendants. A parent whose descendants are all disabled is now shown as disabled, since it can never change (in 1.x it could be checked on its own).
192
+ - **`onChange` receives a structurally shared tree, and is only called when something changed.** Changed nodes and their ancestors are new objects, and every other node is the same object as before. Previously every change produced a full deep copy. Your input data is still never modified.
193
+ - **Nodes no longer contain a `_parentID` property.** Custom components that read `node._parentID` must track parents themselves.
194
+ - **Expansion state is managed by `TreeSelect`.** `TreeNode` now receives `expanded`, `onExpandedChange`, `treeItemProps`, and its nested nodes as `children`, instead of managing its own state and rendering its children itself. Custom node components that manage their own expansion and render their own children still work, but they aren't part of keyboard navigation unless they spread `treeItemProps` and render `children`. If such a component spreads its remaining props onto a DOM element, destructure `treeItemProps`, `expanded`, `onExpandedChange` and `children` first.
195
+ - **Changing `defaultExpanded` after the first render** now expands or collapses every node. Previously it only affected nodes rendered afterward.
196
+ - **New DOM structure and ARIA roles.** The root element has `role="tree"`, each node has `role="treeitem"`, and nested nodes are wrapped in a `role="group"` element. The label no longer has `role="button"`, the checkbox is removed from the tab order (the tree item carries its checked state), and the expand icon is hidden from assistive technology. Update any CSS selectors that relied on child nodes being direct children of their parent node.
197
+ - **The stylesheet no longer resets global styles.** Version 1.x shipped Tailwind's Preflight reset, which changed the styles of the entire page. If your app relied on that reset, include one yourself (for example, Tailwind's `@import "tailwindcss"`).
198
+ - **Styles are built with Tailwind CSS 4.** The default styles need Safari 16.4+, Chrome 111+ or Firefox 128+. Class names are merged with tailwind-merge 3, which understands Tailwind 4 class names; if you style the tree with Tailwind 3, overrides that use utilities renamed in Tailwind 4 (such as `rounded-sm` or `outline-none`) may not replace the defaults.
199
+ - **Package exports are restricted.** The package now defines `exports`, so only the main entry point and the stylesheet can be imported. Import styles from `@attebyte/react-tree-select/style.css`. The old `@attebyte/react-tree-select/dist/style.css` path still works.
200
+ - **The license changed from GPL-3.0 to MIT.**
201
+
202
+ ### Fixes and improvements
203
+
204
+ - Keyboard navigation and screen reader support following the WAI-ARIA tree view pattern.
205
+ - New `getSelectedIDs` and `getSelectedNodes` helpers.
206
+ - Each selection change now updates only the affected nodes, and unchanged nodes skip re-rendering. Previously, every change cloned the entire tree and re-rendered every node.
207
+ - Expanding or collapsing a parent keeps the expansion state of its descendants.
208
+ - Nodes may contain values that cannot be cloned, such as functions or class instances. Previously, these caused an error.
209
+ - Several `onChange` calls from a custom component in one event (for example, "select all children") now combine instead of overwriting each other.
210
+ - Controlled data renders on the first render and during server-side rendering, instead of after an effect.
211
+ - The checkbox sets its `indeterminate` state for partially selected nodes and scales with the surrounding font size.
212
+ - `NodeLabel` no longer passes `label` and `disabled` through to the DOM.
213
+ - A warning is logged when several nodes share the same ID.
214
+ - A custom component can call `onChange(node, value)` as a plain setter, or pass `{ toggle: true }` to get the same behavior as a click.
215
+ - Labels that are not text (such as React elements) are no longer turned into "[object Object]" as the accessible name.
216
+ - The bundle no longer includes `clsx`, `class-variance-authority`, and `tailwind-merge`, which are installed as dependencies. This reduces `main.js` from 69 KB to 17 KB.
217
+ - The stylesheet only contains the component's own styles (3 KB, down from 14 KB).
218
+ - Type declarations are bundled into a single file, so they also work with `"moduleResolution": "node16"` or `"nodenext"`, and the package can be loaded with `require()` in Node.js and Jest.
219
+
220
+ ## Development
221
+
222
+ ```sh
223
+ npm install
224
+ npm run storybook # Storybook at http://localhost:6006
225
+ npm test # unit tests (watch mode)
226
+ npm run test:storybook # stories with interaction and accessibility checks in a real browser
227
+ npm run lint
228
+ npm run build # library to dist/
229
+ npm run build-site # library, Storybook and the documentation site
230
+ ```
231
+
232
+ The documentation site lives in [`website/`](./website) (Docusaurus), and the examples it shares with Storybook live in [`examples/`](./examples).
233
+
234
+ ## License
108
235
 
109
- ---
236
+ [MIT](./LICENSE) © Attebyte LLC
110
237
 
111
238
  <br/>
112
239
 
113
240
  <a href="https://www.buymeacoffee.com/tristan10" target="_blank">
114
241
  <picture>
115
242
  <source media="(prefers-color-scheme: dark)" srcset="https://firebasestorage.googleapis.com/v0/b/attebyte-8542f.appspot.com/o/react-tree-select%2Fbmc-logo-light.svg?alt=media&token=03a8ffd4-3e98-4c8e-9e7a-b8c200c92ed6">
116
- <img style="color: white;" src="https://firebasestorage.googleapis.com/v0/b/attebyte-8542f.appspot.com/o/react-tree-select%2Fbmc-logo.svg?alt=media&token=357749a8-a191-46de-88f4-b7783517b806" alt="Buy Me A Coffee Logo" title="Buy Me A Coffee" height="40" />
243
+ <img src="https://firebasestorage.googleapis.com/v0/b/attebyte-8542f.appspot.com/o/react-tree-select%2Fbmc-logo.svg?alt=media&token=357749a8-a191-46de-88f4-b7783517b806" alt="Buy Me A Coffee" title="Buy Me A Coffee" height="40" />
117
244
  </picture>
118
245
  </a>
119
246
 
120
- This is my first open source project and feedback is always appreciated. [Twitter](https://twitter.com/tristanattebery)
247
+ This is my first open-source project, and feedback is always appreciated. [Twitter](https://twitter.com/tristanattebery)
package/dist/main.d.ts CHANGED
@@ -1,12 +1,157 @@
1
- import { TreeSelect } from './components/TreeSelect';
2
- export default TreeSelect;
3
- export { default as NodeLabel } from './components/NodeLabel';
4
- export { default as NodeCheck } from './components/NodeCheck';
5
- export { default as ExpandIcon } from './components/ExpandIcon';
6
- export { default as TreeNode } from './components/TreeNode';
7
- export type { NodeLabelProps } from './components/NodeLabel';
8
- export type { StandardComponentProps } from './components/TreeSelect';
9
- export type { ExpandIconProps } from './components/ExpandIcon';
10
- export type { NodeCheckProps } from './components/NodeCheck';
11
- export type { TreeNodeProps } from './components/TreeNode';
12
- export type { TreeSelectProps } from './components/TreeSelect';
1
+ import { ClassProp } from 'class-variance-authority/types';
2
+ import { default as default_2 } from 'react';
3
+ import { VariantProps } from 'class-variance-authority';
4
+
5
+ declare const checkVariants: (props?: ({
6
+ mixed?: boolean | null | undefined;
7
+ } & ClassProp) | undefined) => string;
8
+
9
+ export declare const ExpandIcon: typeof ExpandIcon_2;
10
+
11
+ declare const ExpandIcon_2: <T>(props: ExpandIconProps<T>) => default_2.JSX.Element | null;
12
+
13
+ export declare interface ExpandIconProps<T> extends default_2.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof iconVariants>, Props_4<T> {
14
+ }
15
+
16
+ export declare function getSelectedIDs<T>(data: T[], options: SelectedIDsOptions<T>): T[keyof T][];
17
+
18
+ export declare function getSelectedNodes<T>(data: T[], options: SelectedNodesOptions<T>): T[];
19
+
20
+ declare const iconVariants: (props?: ({
21
+ rotated?: boolean | null | undefined;
22
+ } & ClassProp) | undefined) => string;
23
+
24
+ declare const labelVariants: (props?: ({
25
+ disabled?: boolean | null | undefined;
26
+ expandEnabled?: boolean | null | undefined;
27
+ } & ClassProp) | undefined) => string;
28
+
29
+ export declare interface NodeChangeOptions {
30
+ toggle?: boolean;
31
+ }
32
+
33
+ export declare const NodeCheck: typeof NodeCheck_2;
34
+
35
+ declare const NodeCheck_2: <T>(props: NodeCheckProps<T>) => default_2.JSX.Element;
36
+
37
+ export declare interface NodeCheckProps<T> extends default_2.HTMLAttributes<HTMLInputElement>, VariantProps<typeof checkVariants>, Props_2<T> {
38
+ }
39
+
40
+ export declare const NodeLabel: typeof NodeLabel_2;
41
+
42
+ declare const NodeLabel_2: <T>(props: NodeLabelProps<T>) => default_2.JSX.Element;
43
+
44
+ export declare interface NodeLabelProps<T> extends default_2.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof labelVariants>, Props_3<T> {
45
+ }
46
+
47
+ declare const nodeVariants: (props?: ({
48
+ nested?: boolean | null | undefined;
49
+ } & ClassProp) | undefined) => string;
50
+
51
+ declare interface Props<T> {
52
+ standardComponentProps: StandardComponentProps<T>;
53
+ treeItemProps?: TreeItemAttributes;
54
+ disabled?: boolean;
55
+ level?: number;
56
+ expanded?: boolean;
57
+ defaultExpanded?: boolean;
58
+ expandDisabledNodes?: boolean;
59
+ chainedSelect?: boolean;
60
+ labelClassName?: string;
61
+ labelStyle?: default_2.CSSProperties;
62
+ iconClassName?: string;
63
+ iconStyle?: default_2.CSSProperties;
64
+ inputClassName?: string;
65
+ inputStyle?: default_2.CSSProperties;
66
+ CheckComponent: default_2.ComponentType<NodeCheckProps<T>>;
67
+ LabelComponent: default_2.ComponentType<NodeLabelProps<T>>;
68
+ ExpandIconComponent: default_2.ComponentType<ExpandIconProps<T>>;
69
+ onChange: (node: T, value: boolean | null, options?: NodeChangeOptions) => void;
70
+ onExpandedChange?: (expanded: boolean) => void;
71
+ }
72
+
73
+ declare interface Props_2<T> {
74
+ myRef?: default_2.Ref<HTMLInputElement>;
75
+ standardComponentProps: StandardComponentProps<T>;
76
+ checked?: boolean | null;
77
+ expanded?: boolean;
78
+ disabled?: boolean;
79
+ }
80
+
81
+ declare interface Props_3<T> {
82
+ standardComponentProps: StandardComponentProps<T>;
83
+ label: string;
84
+ hasChildren: boolean;
85
+ expanded?: boolean;
86
+ expandDisabledNodes?: boolean;
87
+ iconClassName?: string;
88
+ iconStyle?: default_2.CSSProperties;
89
+ ExpandIconComponent: default_2.ComponentType<ExpandIconProps<T>>;
90
+ }
91
+
92
+ declare interface Props_4<T> {
93
+ standardComponentProps: StandardComponentProps<T>;
94
+ expanded: boolean;
95
+ show: boolean;
96
+ }
97
+
98
+ export declare interface SelectedIDsOptions<T> extends SelectedNodesOptions<T> {
99
+ uniqueIDProperty: keyof T;
100
+ }
101
+
102
+ export declare interface SelectedNodesOptions<T> {
103
+ childrenProperty: keyof T;
104
+ valueProperty: keyof T;
105
+ mode?: SelectionMode_2;
106
+ }
107
+
108
+ declare type SelectionMode_2 = 'all' | 'leaves' | 'topmost';
109
+ export { SelectionMode_2 as SelectionMode }
110
+
111
+ export declare interface StandardComponentProps<T> {
112
+ node: T;
113
+ expanded?: boolean;
114
+ uniqueIDProperty: keyof T;
115
+ labelProperty: keyof T;
116
+ valueProperty?: keyof T;
117
+ childrenProperty: keyof T;
118
+ disabledProperty?: keyof T;
119
+ }
120
+
121
+ export declare interface TreeItemAttributes extends default_2.HTMLAttributes<HTMLElement> {
122
+ ref: default_2.RefCallback<HTMLElement>;
123
+ }
124
+
125
+ export declare const TreeNode: typeof TreeNode_2;
126
+
127
+ declare const TreeNode_2: <T>(props: TreeNodeProps<T>) => default_2.JSX.Element;
128
+
129
+ export declare interface TreeNodeProps<T> extends Omit<default_2.HTMLAttributes<HTMLDivElement>, 'onChange'>, VariantProps<typeof nodeVariants>, Props<T> {
130
+ }
131
+
132
+ declare const TreeSelect: <T>(props: TreeSelectProps<T>) => default_2.JSX.Element;
133
+ export default TreeSelect;
134
+
135
+ export declare interface TreeSelectProps<T> extends Omit<default_2.HTMLProps<HTMLDivElement>, "data" | "onChange">, Omit<StandardComponentProps<T>, "node" | "expanded"> {
136
+ data?: T[];
137
+ defaultData?: T[];
138
+ disabled?: boolean;
139
+ expandDisabledNodes?: boolean;
140
+ defaultExpanded?: boolean;
141
+ chainedSelect?: boolean;
142
+ nodeClassName?: string;
143
+ nodeStyle?: default_2.CSSProperties;
144
+ labelClassName?: string;
145
+ labelStyle?: default_2.CSSProperties;
146
+ iconClassName?: string;
147
+ iconStyle?: default_2.CSSProperties;
148
+ inputClassName?: string;
149
+ inputStyle?: default_2.CSSProperties;
150
+ CustomNodeComponent?: default_2.ComponentType<TreeNodeProps<T>>;
151
+ CustomCheckComponent?: default_2.ComponentType<NodeCheckProps<T>>;
152
+ CustomLabelComponent?: default_2.ComponentType<NodeLabelProps<T>>;
153
+ CustomExpandIconComponent?: default_2.ComponentType<ExpandIconProps<T>>;
154
+ onChange?: (data: T[]) => void;
155
+ }
156
+
157
+ export { }