@fluentui/react-tree 9.0.0-beta.24 → 9.0.0-beta.26
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/CHANGELOG.json +118 -1
- package/CHANGELOG.md +32 -2
- package/dist/index.d.ts +192 -52
- package/lib/components/Tree/Tree.types.js +1 -1
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/useRootTree.js +71 -73
- package/lib/components/Tree/useRootTree.js.map +1 -1
- package/lib/components/Tree/useSubtree.js +4 -0
- package/lib/components/Tree/useSubtree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js +4 -2
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/renderTreeItem.js +4 -2
- package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +104 -18
- package/lib/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib/components/TreeItem/useTreeItemContextValues.js +15 -6
- package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js +1 -1
- package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +14 -30
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js +15 -8
- package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
- package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
- package/lib/contexts/index.js +1 -0
- package/lib/contexts/index.js.map +1 -1
- package/lib/contexts/treeContext.js +5 -2
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/contexts/treeItemContext.js +0 -4
- package/lib/contexts/treeItemContext.js.map +1 -1
- package/lib/contexts/treeItemSlotsContext.js +9 -0
- package/lib/contexts/treeItemSlotsContext.js.map +1 -0
- package/lib/hooks/index.js +3 -1
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useControllableOpenItems.js +25 -0
- package/lib/hooks/useControllableOpenItems.js.map +1 -0
- package/lib/hooks/useFlatControllableCheckedItems.js +76 -0
- package/lib/hooks/useFlatControllableCheckedItems.js.map +1 -0
- package/lib/hooks/useFlatTree.js +17 -6
- package/lib/hooks/useFlatTree.js.map +1 -1
- package/lib/hooks/useNestedControllableCheckedItems.js +107 -0
- package/lib/hooks/useNestedControllableCheckedItems.js.map +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/ImmutableMap.js +37 -0
- package/lib/utils/ImmutableMap.js.map +1 -0
- package/lib/utils/ImmutableSet.js +17 -9
- package/lib/utils/ImmutableSet.js.map +1 -1
- package/lib/utils/createFlatTreeItems.js +60 -8
- package/lib/utils/createFlatTreeItems.js.map +1 -1
- package/lib/utils/flattenTree.js +0 -5
- package/lib/utils/flattenTree.js.map +1 -1
- package/lib/utils/tokens.js +2 -1
- package/lib/utils/tokens.js.map +1 -1
- package/lib-commonjs/components/Tree/Tree.types.js +0 -2
- package/lib-commonjs/components/Tree/Tree.types.js.map +1 -1
- package/lib-commonjs/components/Tree/useRootTree.js +70 -72
- package/lib-commonjs/components/Tree/useRootTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useSubtree.js +4 -0
- package/lib-commonjs/components/Tree/useSubtree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.js +4 -2
- package/lib-commonjs/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItem/renderTreeItem.js +3 -1
- package/lib-commonjs/components/TreeItem/renderTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js +103 -17
- package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js +16 -6
- package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js +1 -1
- package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +14 -29
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js +12 -8
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js.map +1 -1
- package/lib-commonjs/contexts/index.js +1 -0
- package/lib-commonjs/contexts/index.js.map +1 -1
- package/lib-commonjs/contexts/treeContext.js +4 -1
- package/lib-commonjs/contexts/treeContext.js.map +1 -1
- package/lib-commonjs/contexts/treeItemContext.js +0 -4
- package/lib-commonjs/contexts/treeItemContext.js.map +1 -1
- package/lib-commonjs/contexts/treeItemSlotsContext.js +25 -0
- package/lib-commonjs/contexts/treeItemSlotsContext.js.map +1 -0
- package/lib-commonjs/hooks/index.js +3 -1
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/{useOpenItemsState.js → useControllableOpenItems.js} +15 -14
- package/lib-commonjs/hooks/useControllableOpenItems.js.map +1 -0
- package/lib-commonjs/hooks/useFlatControllableCheckedItems.js +91 -0
- package/lib-commonjs/hooks/useFlatControllableCheckedItems.js.map +1 -0
- package/lib-commonjs/hooks/useFlatTree.js +16 -5
- package/lib-commonjs/hooks/useFlatTree.js.map +1 -1
- package/lib-commonjs/hooks/useNestedControllableCheckedItems.js +116 -0
- package/lib-commonjs/hooks/useNestedControllableCheckedItems.js.map +1 -0
- package/lib-commonjs/utils/ImmutableMap.js +45 -0
- package/lib-commonjs/utils/ImmutableMap.js.map +1 -0
- package/lib-commonjs/utils/ImmutableSet.js +22 -16
- package/lib-commonjs/utils/ImmutableSet.js.map +1 -1
- package/lib-commonjs/utils/createFlatTreeItems.js +60 -8
- package/lib-commonjs/utils/createFlatTreeItems.js.map +1 -1
- package/lib-commonjs/utils/flattenTree.js +0 -5
- package/lib-commonjs/utils/flattenTree.js.map +1 -1
- package/lib-commonjs/utils/tokens.js +2 -1
- package/lib-commonjs/utils/tokens.js.map +1 -1
- package/package.json +9 -7
- package/lib/hooks/useOpenItemsState.js +0 -28
- package/lib/hooks/useOpenItemsState.js.map +0 -1
- package/lib-commonjs/hooks/useOpenItemsState.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,124 @@
|
|
|
2
2
|
"name": "@fluentui/react-tree",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 20 Jul 2023 18:24:27 GMT",
|
|
6
|
+
"tag": "@fluentui/react-tree_v9.0.0-beta.26",
|
|
7
|
+
"version": "9.0.0-beta.26",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
12
|
+
"package": "@fluentui/react-tree",
|
|
13
|
+
"commit": "f5b6134905e28c124b2dc34cc6bd286ca621de6a",
|
|
14
|
+
"comment": "feat: implements selection"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-tree",
|
|
19
|
+
"comment": "Bump @fluentui/react-aria to v9.3.27",
|
|
20
|
+
"commit": "5a4b16715e8e929f11d8113f710e578ca73acaa6"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-tree",
|
|
25
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.13",
|
|
26
|
+
"commit": "5a4b16715e8e929f11d8113f710e578ca73acaa6"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-tree",
|
|
31
|
+
"comment": "Bump @fluentui/react-button to v9.3.24",
|
|
32
|
+
"commit": "5a4b16715e8e929f11d8113f710e578ca73acaa6"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-tree",
|
|
37
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.25",
|
|
38
|
+
"commit": "5a4b16715e8e929f11d8113f710e578ca73acaa6"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-tree",
|
|
43
|
+
"comment": "Bump @fluentui/react-portal to v9.3.2",
|
|
44
|
+
"commit": "5a4b16715e8e929f11d8113f710e578ca73acaa6"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-tree",
|
|
49
|
+
"comment": "Bump @fluentui/react-radio to v9.1.25",
|
|
50
|
+
"commit": "5a4b16715e8e929f11d8113f710e578ca73acaa6"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-tree",
|
|
55
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.12",
|
|
56
|
+
"commit": "5a4b16715e8e929f11d8113f710e578ca73acaa6"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"date": "Thu, 13 Jul 2023 21:25:48 GMT",
|
|
63
|
+
"tag": "@fluentui/react-tree_v9.0.0-beta.25",
|
|
64
|
+
"version": "9.0.0-beta.25",
|
|
65
|
+
"comments": {
|
|
66
|
+
"none": [
|
|
67
|
+
{
|
|
68
|
+
"author": "martinhochel@microsoft.com",
|
|
69
|
+
"package": "@fluentui/react-tree",
|
|
70
|
+
"commit": "8a9e1018f2abb2c7608c49d32acf44e93c43cba6",
|
|
71
|
+
"comment": "chore: update devDependencies to use * for inner workspace dependencies"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"date": "Tue, 11 Jul 2023 18:46:36 GMT",
|
|
78
|
+
"tag": "@fluentui/react-tree_v9.0.0-beta.25",
|
|
79
|
+
"version": "9.0.0-beta.25",
|
|
80
|
+
"comments": {
|
|
81
|
+
"prerelease": [
|
|
82
|
+
{
|
|
83
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
84
|
+
"package": "@fluentui/react-tree",
|
|
85
|
+
"commit": "64752d9a76638ccc4c91303347993b50e0e6d053",
|
|
86
|
+
"comment": "chore: move slots back to TreeItem and creates slot context"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
90
|
+
"package": "@fluentui/react-tree",
|
|
91
|
+
"commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74",
|
|
92
|
+
"comment": "chore: openItems property added to TreeOpenChangeData + minor internal improvements"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"author": "beachball",
|
|
96
|
+
"package": "@fluentui/react-tree",
|
|
97
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.12",
|
|
98
|
+
"commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"author": "beachball",
|
|
102
|
+
"package": "@fluentui/react-tree",
|
|
103
|
+
"comment": "Bump @fluentui/react-button to v9.3.23",
|
|
104
|
+
"commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"author": "beachball",
|
|
108
|
+
"package": "@fluentui/react-tree",
|
|
109
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.11",
|
|
110
|
+
"commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"author": "beachball",
|
|
114
|
+
"package": "@fluentui/react-tree",
|
|
115
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0",
|
|
116
|
+
"commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"date": "Mon, 03 Jul 2023 13:34:28 GMT",
|
|
6
123
|
"tag": "@fluentui/react-tree_v9.0.0-beta.24",
|
|
7
124
|
"version": "9.0.0-beta.24",
|
|
8
125
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tree
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 20 Jul 2023 18:24:27 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-beta.26](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.26)
|
|
8
|
+
|
|
9
|
+
Thu, 20 Jul 2023 18:24:27 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.25..@fluentui/react-tree_v9.0.0-beta.26)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- feat: implements selection ([PR #28497](https://github.com/microsoft/fluentui/pull/28497) by bernardo.sunderhus@gmail.com)
|
|
15
|
+
- Bump @fluentui/react-aria to v9.3.27 ([PR #26826](https://github.com/microsoft/fluentui/pull/26826) by beachball)
|
|
16
|
+
- Bump @fluentui/react-avatar to v9.5.13 ([PR #26826](https://github.com/microsoft/fluentui/pull/26826) by beachball)
|
|
17
|
+
- Bump @fluentui/react-button to v9.3.24 ([PR #26826](https://github.com/microsoft/fluentui/pull/26826) by beachball)
|
|
18
|
+
- Bump @fluentui/react-checkbox to v9.1.25 ([PR #26826](https://github.com/microsoft/fluentui/pull/26826) by beachball)
|
|
19
|
+
- Bump @fluentui/react-portal to v9.3.2 ([PR #26826](https://github.com/microsoft/fluentui/pull/26826) by beachball)
|
|
20
|
+
- Bump @fluentui/react-radio to v9.1.25 ([PR #26826](https://github.com/microsoft/fluentui/pull/26826) by beachball)
|
|
21
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.12 ([PR #26826](https://github.com/microsoft/fluentui/pull/26826) by beachball)
|
|
22
|
+
|
|
23
|
+
## [9.0.0-beta.25](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.25)
|
|
24
|
+
|
|
25
|
+
Tue, 11 Jul 2023 18:46:36 GMT
|
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.24..@fluentui/react-tree_v9.0.0-beta.25)
|
|
27
|
+
|
|
28
|
+
### Changes
|
|
29
|
+
|
|
30
|
+
- chore: move slots back to TreeItem and creates slot context ([PR #28492](https://github.com/microsoft/fluentui/pull/28492) by bernardo.sunderhus@gmail.com)
|
|
31
|
+
- chore: openItems property added to TreeOpenChangeData + minor internal improvements ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by bernardo.sunderhus@gmail.com)
|
|
32
|
+
- Bump @fluentui/react-avatar to v9.5.12 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
|
|
33
|
+
- Bump @fluentui/react-button to v9.3.23 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
|
|
34
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.11 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
|
|
35
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
|
|
36
|
+
|
|
7
37
|
## [9.0.0-beta.24](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.24)
|
|
8
38
|
|
|
9
|
-
Mon, 03 Jul 2023 13:
|
|
39
|
+
Mon, 03 Jul 2023 13:34:28 GMT
|
|
10
40
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.23..@fluentui/react-tree_v9.0.0-beta.24)
|
|
11
41
|
|
|
12
42
|
### Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,54 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
|
|
3
|
-
import { ArrowDown } from '@fluentui/keyboard-keys';
|
|
4
|
-
import { ArrowLeft } from '@fluentui/keyboard-keys';
|
|
5
|
-
import { ArrowRight } from '@fluentui/keyboard-keys';
|
|
6
|
-
import { ArrowUp } from '@fluentui/keyboard-keys';
|
|
3
|
+
import type { ArrowDown } from '@fluentui/keyboard-keys';
|
|
4
|
+
import type { ArrowLeft } from '@fluentui/keyboard-keys';
|
|
5
|
+
import type { ArrowRight } from '@fluentui/keyboard-keys';
|
|
6
|
+
import type { ArrowUp } from '@fluentui/keyboard-keys';
|
|
7
7
|
import type { AvatarContextValue } from '@fluentui/react-avatar';
|
|
8
8
|
import type { AvatarSize } from '@fluentui/react-avatar';
|
|
9
9
|
import { ButtonContextValue } from '@fluentui/react-button';
|
|
10
|
+
import type { Checkbox } from '@fluentui/react-checkbox';
|
|
11
|
+
import { CheckboxProps } from '@fluentui/react-checkbox';
|
|
10
12
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
11
13
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
12
14
|
import { ContextSelector } from '@fluentui/react-context-selector';
|
|
13
|
-
import { End } from '@fluentui/keyboard-keys';
|
|
14
|
-
import { Enter } from '@fluentui/keyboard-keys';
|
|
15
|
+
import type { End } from '@fluentui/keyboard-keys';
|
|
16
|
+
import type { Enter } from '@fluentui/keyboard-keys';
|
|
15
17
|
import type { ExtractSlotProps } from '@fluentui/react-utilities';
|
|
16
18
|
import { FC } from 'react';
|
|
17
19
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
18
|
-
import { Home } from '@fluentui/keyboard-keys';
|
|
20
|
+
import type { Home } from '@fluentui/keyboard-keys';
|
|
19
21
|
import { Provider } from 'react';
|
|
20
22
|
import { ProviderProps } from 'react';
|
|
23
|
+
import type { Radio } from '@fluentui/react-radio';
|
|
24
|
+
import { RadioProps } from '@fluentui/react-radio';
|
|
21
25
|
import * as React_2 from 'react';
|
|
26
|
+
import { SelectionMode as SelectionMode_2 } from '@fluentui/react-utilities';
|
|
22
27
|
import type { Slot } from '@fluentui/react-utilities';
|
|
23
28
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
24
29
|
|
|
30
|
+
/**
|
|
31
|
+
* properly creates an ImmutableMap instance from an iterable
|
|
32
|
+
*/
|
|
33
|
+
declare function createImmutableMap<Key, Value>(iterable?: Iterable<[Key, Value]>): ImmutableMap<Key, Value>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* properly creates an ImmutableSet instance from an iterable
|
|
37
|
+
*/
|
|
38
|
+
declare function createImmutableSet<Value>(iterable?: Iterable<Value>): ImmutableSet<Value>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Avoid using *dangerouslyCreateImmutableMap*, since this method will expose internally used set, use createImmutableMap instead,
|
|
42
|
+
* @param internalMap - a set that is used internally to store values.
|
|
43
|
+
*/
|
|
44
|
+
declare function dangerouslyCreateImmutableMap<Key, Value>(internalMap: Map<Key, Value>): ImmutableMap<Key, Value>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Avoid using *dangerouslyCreateImmutableSet*, since this method will expose internally used set, use createImmutableSet instead,
|
|
48
|
+
* @param internalSet - a set that is used internally to store values.
|
|
49
|
+
*/
|
|
50
|
+
declare function dangerouslyCreateImmutableSet<Value>(internalSet: Set<Value>): ImmutableSet<Value>;
|
|
51
|
+
|
|
25
52
|
declare type FlattenedTreeItem<Props extends TreeItemProps> = FlatTreeItemProps & Props;
|
|
26
53
|
|
|
27
54
|
/**
|
|
@@ -132,22 +159,58 @@ export declare type FlatTree<Props extends FlatTreeItemProps = FlatTreeItemProps
|
|
|
132
159
|
export declare type FlatTreeItem<Props extends FlatTreeItemProps = FlatTreeItemProps> = {
|
|
133
160
|
index: number;
|
|
134
161
|
level: number;
|
|
135
|
-
|
|
162
|
+
childrenValues: TreeItemValue[];
|
|
136
163
|
value: TreeItemValue;
|
|
137
164
|
parentValue: TreeItemValue | undefined;
|
|
138
165
|
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Omit<Props, 'parentId'>;
|
|
139
166
|
};
|
|
140
167
|
|
|
141
|
-
export declare type FlatTreeItemProps = Omit<TreeItemProps, 'itemType'> & Partial<Pick<TreeItemProps, 'itemType'>> & {
|
|
168
|
+
export declare type FlatTreeItemProps = Omit<TreeItemProps, 'itemType' | 'value'> & Partial<Pick<TreeItemProps, 'itemType'>> & {
|
|
142
169
|
value: TreeItemValue;
|
|
143
170
|
parentValue?: TreeItemValue;
|
|
144
171
|
};
|
|
145
172
|
|
|
146
|
-
declare type FlatTreeOptions = Pick<TreeProps, 'openItems' | 'defaultOpenItems' | 'onOpenChange' | 'onNavigation_unstable'>;
|
|
173
|
+
declare type FlatTreeOptions = Pick<TreeProps, 'openItems' | 'defaultOpenItems' | 'onOpenChange' | 'onNavigation_unstable' | 'selectionMode' | 'checkedItems' | 'defaultCheckedItems' | 'onCheckedChange'>;
|
|
147
174
|
|
|
148
|
-
export declare type FlatTreeProps = Required<Pick<TreeProps, 'openItems' | 'onOpenChange' | 'onNavigation_unstable'>> & {
|
|
175
|
+
export declare type FlatTreeProps = Required<Pick<TreeProps, 'openItems' | 'onOpenChange' | 'onNavigation_unstable' | 'checkedItems' | 'onCheckedChange'>> & {
|
|
149
176
|
ref: React_2.Ref<HTMLDivElement>;
|
|
150
|
-
openItems: ImmutableSet<
|
|
177
|
+
openItems: ImmutableSet<TreeItemValue>;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
declare interface ImmutableMap<Key, Value> {
|
|
181
|
+
clear(): ImmutableMap<Key, Value>;
|
|
182
|
+
delete(key: Key): ImmutableMap<Key, Value>;
|
|
183
|
+
/**
|
|
184
|
+
* Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
|
|
185
|
+
* @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
|
|
186
|
+
*/
|
|
187
|
+
get(key: Key): Value | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* @returns boolean indicating whether an element with the specified key exists or not.
|
|
190
|
+
*/
|
|
191
|
+
has(key: Key): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
|
|
194
|
+
*/
|
|
195
|
+
set(key: Key, value: Value): ImmutableMap<Key, Value>;
|
|
196
|
+
/**
|
|
197
|
+
* @returns the number of elements in the Map.
|
|
198
|
+
*/
|
|
199
|
+
readonly size: number;
|
|
200
|
+
/** Iterates over entries in the Map. */
|
|
201
|
+
[Symbol.iterator](): IterableIterator<[Key, Value]>;
|
|
202
|
+
/**
|
|
203
|
+
* @internal
|
|
204
|
+
* Exposes the internal map used to store values.
|
|
205
|
+
* This is an internal API and should not be used directly.
|
|
206
|
+
*/
|
|
207
|
+
dangerouslyGetInternalMap_unstable(): Map<Key, Value>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
declare const ImmutableMap: {
|
|
211
|
+
empty: ImmutableMap<never, never>;
|
|
212
|
+
create: typeof createImmutableMap;
|
|
213
|
+
dangerouslyCreate_unstable: typeof dangerouslyCreateImmutableMap;
|
|
151
214
|
};
|
|
152
215
|
|
|
153
216
|
declare interface ImmutableSet<Value> {
|
|
@@ -174,9 +237,24 @@ declare interface ImmutableSet<Value> {
|
|
|
174
237
|
has(value: Value): boolean;
|
|
175
238
|
/** Iterates over values in the ImmutableSet. */
|
|
176
239
|
[Symbol.iterator](): IterableIterator<Value>;
|
|
240
|
+
/**
|
|
241
|
+
* @internal
|
|
242
|
+
* Exposes the internal set used to store values.
|
|
243
|
+
* This is an internal API and should not be used directly.
|
|
244
|
+
*/
|
|
245
|
+
dangerouslyGetInternalSet_unstable(): Set<Value>;
|
|
177
246
|
}
|
|
178
247
|
|
|
248
|
+
declare const ImmutableSet: {
|
|
249
|
+
empty: ImmutableSet<never>;
|
|
250
|
+
create: typeof createImmutableSet;
|
|
251
|
+
dangerouslyCreate_unstable: typeof dangerouslyCreateImmutableSet;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
declare type MultiSelectValue = NonNullable<CheckboxProps['checked']>;
|
|
255
|
+
|
|
179
256
|
export declare type NestedTreeItem<Props extends TreeItemProps> = Omit<Props, 'subtree' | 'itemType'> & {
|
|
257
|
+
value: TreeItemValue;
|
|
180
258
|
subtree?: NestedTreeItem<Props>[];
|
|
181
259
|
};
|
|
182
260
|
|
|
@@ -199,6 +277,8 @@ export declare const renderTreeItemLayout_unstable: (state: TreeItemLayoutState)
|
|
|
199
277
|
*/
|
|
200
278
|
export declare const renderTreeItemPersonaLayout_unstable: (state: TreeItemPersonaLayoutState, contextValues: TreeItemPersonaLayoutContextValues) => JSX.Element;
|
|
201
279
|
|
|
280
|
+
declare type SingleSelectValue = NonNullable<RadioProps['checked']>;
|
|
281
|
+
|
|
202
282
|
/**
|
|
203
283
|
* A tree view widget presents a hierarchical list.
|
|
204
284
|
* Any item in the hierarchy may have child items,
|
|
@@ -209,13 +289,30 @@ export declare const renderTreeItemPersonaLayout_unstable: (state: TreeItemPerso
|
|
|
209
289
|
*/
|
|
210
290
|
export declare const Tree: ForwardRefComponent<TreeProps>;
|
|
211
291
|
|
|
292
|
+
export declare type TreeCheckedChangeData = {
|
|
293
|
+
value: TreeItemValue;
|
|
294
|
+
target: HTMLElement;
|
|
295
|
+
event: React_2.ChangeEvent<HTMLElement>;
|
|
296
|
+
type: 'Change';
|
|
297
|
+
} & ({
|
|
298
|
+
selectionMode: 'multiselect';
|
|
299
|
+
checked: MultiSelectValue;
|
|
300
|
+
} | {
|
|
301
|
+
selectionMode: 'single';
|
|
302
|
+
checked: SingleSelectValue;
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
export declare type TreeCheckedChangeEvent = TreeCheckedChangeData['event'];
|
|
306
|
+
|
|
212
307
|
export declare const treeClassNames: SlotClassNames<TreeSlots>;
|
|
213
308
|
|
|
214
309
|
export declare type TreeContextValue = {
|
|
215
310
|
level: number;
|
|
311
|
+
selectionMode: 'none' | SelectionMode_2;
|
|
216
312
|
appearance: 'subtle' | 'subtle-alpha' | 'transparent';
|
|
217
313
|
size: 'small' | 'medium';
|
|
218
|
-
openItems: ImmutableSet<
|
|
314
|
+
openItems: ImmutableSet<TreeItemValue>;
|
|
315
|
+
checkedItems: ImmutableMap<TreeItemValue, 'mixed' | boolean>;
|
|
219
316
|
/**
|
|
220
317
|
* requests root Tree component to respond to some tree item event,
|
|
221
318
|
*/
|
|
@@ -240,13 +337,9 @@ declare type TreeContextValues = {
|
|
|
240
337
|
*/
|
|
241
338
|
export declare const TreeItem: ForwardRefComponent<TreeItemProps>;
|
|
242
339
|
|
|
243
|
-
export declare const treeItemClassNames: SlotClassNames<
|
|
340
|
+
export declare const treeItemClassNames: SlotClassNames<TreeItemInternalSlot>;
|
|
244
341
|
|
|
245
342
|
declare type TreeItemContextValue = {
|
|
246
|
-
isActionsVisible: boolean;
|
|
247
|
-
isAsideVisible: boolean;
|
|
248
|
-
actionsRef: React_2.Ref<HTMLDivElement>;
|
|
249
|
-
expandIconRef: React_2.Ref<HTMLDivElement>;
|
|
250
343
|
layoutRef: React_2.Ref<HTMLDivElement>;
|
|
251
344
|
subtreeRef: React_2.Ref<HTMLDivElement>;
|
|
252
345
|
itemType: TreeItemType;
|
|
@@ -256,12 +349,15 @@ declare type TreeItemContextValue = {
|
|
|
256
349
|
|
|
257
350
|
declare type TreeItemContextValues = {
|
|
258
351
|
treeItem: TreeItemContextValue;
|
|
352
|
+
treeItemSlots: TreeItemSlotsContextValue;
|
|
259
353
|
};
|
|
260
354
|
|
|
261
355
|
declare type TreeItemCSSProperties = React_2.CSSProperties & {
|
|
262
356
|
[treeItemLevelToken]?: string | number;
|
|
263
357
|
};
|
|
264
358
|
|
|
359
|
+
declare type TreeItemInternalSlot = Pick<TreeItemSlots, 'root'>;
|
|
360
|
+
|
|
265
361
|
/**
|
|
266
362
|
* The `TreeItemLayout` component is used as a child of `TreeItem` to define the content and layout of a tree item.
|
|
267
363
|
* It provides a consistent visual structure for tree items in a `Tree` component.
|
|
@@ -269,7 +365,9 @@ declare type TreeItemCSSProperties = React_2.CSSProperties & {
|
|
|
269
365
|
*/
|
|
270
366
|
export declare const TreeItemLayout: ForwardRefComponent<TreeItemLayoutProps>;
|
|
271
367
|
|
|
272
|
-
export declare const treeItemLayoutClassNames: SlotClassNames<
|
|
368
|
+
export declare const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutInternalSlots>;
|
|
369
|
+
|
|
370
|
+
declare type TreeItemLayoutInternalSlots = TreeItemLayoutSlots & TreeItemSlotsContextValue;
|
|
273
371
|
|
|
274
372
|
/**
|
|
275
373
|
* TreeItemLayout Props
|
|
@@ -290,28 +388,12 @@ export declare type TreeItemLayoutSlots = {
|
|
|
290
388
|
* Icon slot that renders right after main content
|
|
291
389
|
*/
|
|
292
390
|
iconAfter?: Slot<'div'>;
|
|
293
|
-
/**
|
|
294
|
-
* Expand icon slot,
|
|
295
|
-
* by default renders a chevron icon to indicate opening and closing
|
|
296
|
-
*/
|
|
297
|
-
expandIcon?: Slot<'div'>;
|
|
298
|
-
aside?: Slot<'div'>;
|
|
299
|
-
/**
|
|
300
|
-
* actionable elements are normally buttons, menus, or other focusable elements.
|
|
301
|
-
* Those elements are only visibly available if the given tree item is currently active.
|
|
302
|
-
*/
|
|
303
|
-
actions?: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
304
|
-
/**
|
|
305
|
-
* Forces visibility of the aside/action content
|
|
306
|
-
*/
|
|
307
|
-
visible?: boolean;
|
|
308
|
-
}>>;
|
|
309
391
|
};
|
|
310
392
|
|
|
311
393
|
/**
|
|
312
394
|
* State used in rendering TreeItemLayout
|
|
313
395
|
*/
|
|
314
|
-
export declare type TreeItemLayoutState = ComponentState<
|
|
396
|
+
export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutInternalSlots> & {
|
|
315
397
|
buttonContextValue: ButtonContextValue;
|
|
316
398
|
};
|
|
317
399
|
|
|
@@ -324,18 +406,20 @@ export declare const treeItemLevelToken: "--fluent-TreeItem--level";
|
|
|
324
406
|
*/
|
|
325
407
|
export declare const TreeItemPersonaLayout: ForwardRefComponent<TreeItemPersonaLayoutProps>;
|
|
326
408
|
|
|
327
|
-
export declare const treeItemPersonaLayoutClassNames: SlotClassNames<
|
|
409
|
+
export declare const treeItemPersonaLayoutClassNames: SlotClassNames<TreeItemPersonaLayoutInternalSlots>;
|
|
328
410
|
|
|
329
411
|
declare type TreeItemPersonaLayoutContextValues = {
|
|
330
412
|
avatar: AvatarContextValue;
|
|
331
413
|
};
|
|
332
414
|
|
|
415
|
+
declare type TreeItemPersonaLayoutInternalSlots = TreeItemPersonaLayoutSlots & Pick<TreeItemSlots, 'actions' | 'aside' | 'expandIcon'>;
|
|
416
|
+
|
|
333
417
|
/**
|
|
334
418
|
* TreeItemPersonaLayout Props
|
|
335
419
|
*/
|
|
336
420
|
export declare type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;
|
|
337
421
|
|
|
338
|
-
export declare type TreeItemPersonaLayoutSlots =
|
|
422
|
+
export declare type TreeItemPersonaLayoutSlots = {
|
|
339
423
|
root: NonNullable<Slot<'div'>>;
|
|
340
424
|
/**
|
|
341
425
|
* Avatar to display.
|
|
@@ -354,7 +438,7 @@ export declare type TreeItemPersonaLayoutSlots = Pick<TreeItemLayoutSlots, 'acti
|
|
|
354
438
|
/**
|
|
355
439
|
* State used in rendering TreeItemPersonaLayout
|
|
356
440
|
*/
|
|
357
|
-
export declare type TreeItemPersonaLayoutState = ComponentState<
|
|
441
|
+
export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutInternalSlots> & {
|
|
358
442
|
avatarSize: AvatarSize;
|
|
359
443
|
buttonContextValue: ButtonContextValue;
|
|
360
444
|
};
|
|
@@ -371,29 +455,57 @@ export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | u
|
|
|
371
455
|
|
|
372
456
|
declare type TreeItemRequest = {
|
|
373
457
|
itemType: TreeItemType;
|
|
374
|
-
} & (OmitWithoutExpanding<TreeOpenChangeData, 'open' |
|
|
458
|
+
} & (OmitWithoutExpanding<TreeOpenChangeData, 'open'> | TreeNavigationData_unstable | OmitWithoutExpanding<TreeCheckedChangeData, 'checked' | 'selectionMode'>);
|
|
375
459
|
|
|
376
460
|
export declare type TreeItemSlots = {
|
|
377
461
|
root: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
378
462
|
style?: TreeItemCSSProperties;
|
|
379
463
|
}>>;
|
|
464
|
+
/**
|
|
465
|
+
* Expand icon slot,
|
|
466
|
+
* by default renders a chevron icon to indicate opening and closing
|
|
467
|
+
*/
|
|
468
|
+
expandIcon?: Slot<'div'>;
|
|
469
|
+
aside?: Slot<'div'>;
|
|
470
|
+
/**
|
|
471
|
+
* actionable elements are normally buttons, menus, or other focusable elements.
|
|
472
|
+
* Those elements are only visibly available if the given tree item is currently active.
|
|
473
|
+
*/
|
|
474
|
+
actions?: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
475
|
+
/**
|
|
476
|
+
* Forces visibility of the aside/action content
|
|
477
|
+
*/
|
|
478
|
+
visible?: boolean;
|
|
479
|
+
}>>;
|
|
480
|
+
/**
|
|
481
|
+
* Selection indicator if selection type is checkbox
|
|
482
|
+
*/
|
|
483
|
+
checkboxIndicator?: Slot<typeof Checkbox>;
|
|
484
|
+
/**
|
|
485
|
+
* Selection indicator if selection type is radio
|
|
486
|
+
*/
|
|
487
|
+
radioIndicator?: Slot<typeof Radio>;
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
declare type TreeItemSlotsContextValue = Pick<TreeItemSlots, 'actions' | 'aside' | 'expandIcon'> & {
|
|
491
|
+
selector?: Slot<typeof Checkbox> | Slot<typeof Radio>;
|
|
380
492
|
};
|
|
381
493
|
|
|
382
494
|
/**
|
|
383
495
|
* State used in rendering TreeItem
|
|
384
496
|
*/
|
|
385
|
-
export declare type TreeItemState = ComponentState<
|
|
497
|
+
export declare type TreeItemState = ComponentState<TreeItemInternalSlot> & TreeItemContextValue & TreeItemSlotsContextValue & {
|
|
386
498
|
level: number;
|
|
387
499
|
itemType: TreeItemType;
|
|
388
500
|
};
|
|
389
501
|
|
|
390
502
|
declare type TreeItemType = 'leaf' | 'branch';
|
|
391
503
|
|
|
392
|
-
declare type TreeItemValue = string | number;
|
|
504
|
+
export declare type TreeItemValue = string | number;
|
|
393
505
|
|
|
394
506
|
export declare type TreeNavigationData_unstable = {
|
|
395
507
|
target: HTMLElement;
|
|
396
|
-
value:
|
|
508
|
+
value: TreeItemValue;
|
|
397
509
|
} & ({
|
|
398
510
|
event: React_2.MouseEvent<HTMLElement>;
|
|
399
511
|
type: 'Click';
|
|
@@ -424,26 +536,22 @@ export declare type TreeNavigationEvent_unstable = TreeNavigationData_unstable['
|
|
|
424
536
|
|
|
425
537
|
export declare type TreeOpenChangeData = {
|
|
426
538
|
open: boolean;
|
|
427
|
-
value:
|
|
539
|
+
value: TreeItemValue;
|
|
540
|
+
target: HTMLElement;
|
|
428
541
|
} & ({
|
|
429
542
|
event: React_2.MouseEvent<HTMLElement>;
|
|
430
|
-
target: HTMLElement;
|
|
431
543
|
type: 'ExpandIconClick';
|
|
432
544
|
} | {
|
|
433
545
|
event: React_2.MouseEvent<HTMLElement>;
|
|
434
|
-
target: HTMLElement;
|
|
435
546
|
type: 'Click';
|
|
436
547
|
} | {
|
|
437
548
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
438
|
-
target: HTMLElement;
|
|
439
549
|
type: typeof Enter;
|
|
440
550
|
} | {
|
|
441
551
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
442
|
-
target: HTMLElement;
|
|
443
552
|
type: typeof ArrowRight;
|
|
444
553
|
} | {
|
|
445
554
|
event: React_2.KeyboardEvent<HTMLElement>;
|
|
446
|
-
target: HTMLElement;
|
|
447
555
|
type: typeof ArrowLeft;
|
|
448
556
|
});
|
|
449
557
|
|
|
@@ -468,13 +576,13 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
468
576
|
* Controls the state of the open tree items.
|
|
469
577
|
* These property is ignored for subtrees.
|
|
470
578
|
*/
|
|
471
|
-
openItems?: Iterable<
|
|
579
|
+
openItems?: Iterable<TreeItemValue>;
|
|
472
580
|
/**
|
|
473
581
|
* This refers to a list of ids of opened tree items.
|
|
474
582
|
* Default value for the uncontrolled state of open tree items.
|
|
475
583
|
* These property is ignored for subtrees.
|
|
476
584
|
*/
|
|
477
|
-
defaultOpenItems?: Iterable<
|
|
585
|
+
defaultOpenItems?: Iterable<TreeItemValue>;
|
|
478
586
|
/**
|
|
479
587
|
* Callback fired when the component changes value from open state.
|
|
480
588
|
* These property is ignored for subtrees.
|
|
@@ -494,10 +602,42 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
|
|
|
494
602
|
* @param data - A data object with relevant information,
|
|
495
603
|
*/
|
|
496
604
|
onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;
|
|
605
|
+
/**
|
|
606
|
+
* This refers to the selection mode of the tree.
|
|
607
|
+
* - undefined: No selection can be done.
|
|
608
|
+
* - 'single': Only one tree item can be selected, radio buttons are rendered.
|
|
609
|
+
* - 'multiselect': Multiple tree items can be selected, checkboxes are rendered.
|
|
610
|
+
*
|
|
611
|
+
* @default undefined
|
|
612
|
+
*/
|
|
613
|
+
selectionMode?: SelectionMode_2;
|
|
614
|
+
/**
|
|
615
|
+
* This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.
|
|
616
|
+
* Controls the state of the checked tree items.
|
|
617
|
+
* These property is ignored for subtrees.
|
|
618
|
+
*/
|
|
619
|
+
checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;
|
|
620
|
+
/**
|
|
621
|
+
* This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.
|
|
622
|
+
* Default value for the uncontrolled state of checked tree items.
|
|
623
|
+
* These property is ignored for subtrees.
|
|
624
|
+
*/
|
|
625
|
+
defaultCheckedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;
|
|
626
|
+
/**
|
|
627
|
+
* Callback fired when the component changes value from checked state.
|
|
628
|
+
* These property is ignored for subtrees.
|
|
629
|
+
*
|
|
630
|
+
* @param event - a React's Synthetic event
|
|
631
|
+
* @param data - A data object with relevant information,
|
|
632
|
+
* such as checked value and type of interaction that created the event.
|
|
633
|
+
*/
|
|
634
|
+
onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;
|
|
497
635
|
};
|
|
498
636
|
|
|
499
637
|
export declare const TreeProvider: Provider<TreeContextValue | undefined> & FC<ProviderProps<TreeContextValue | undefined>>;
|
|
500
638
|
|
|
639
|
+
export declare type TreeSelectionValue = MultiSelectValue | SingleSelectValue;
|
|
640
|
+
|
|
501
641
|
export declare type TreeSlots = {
|
|
502
642
|
root: Slot<'div'>;
|
|
503
643
|
};
|
|
@@ -551,7 +691,7 @@ export declare function useTreeItem_unstable(props: TreeItemProps, ref: React_2.
|
|
|
551
691
|
|
|
552
692
|
export declare const useTreeItemContext_unstable: <T>(selector: ContextSelector<TreeItemContextValue, T>) => T;
|
|
553
693
|
|
|
554
|
-
export declare function useTreeItemContextValues_unstable(state:
|
|
694
|
+
export declare function useTreeItemContextValues_unstable(state: TreeItemState): TreeItemContextValues;
|
|
555
695
|
|
|
556
696
|
/**
|
|
557
697
|
* Create the state required to render TreeItemLayout.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Tree.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { TreeContextValue } from '../../contexts/treeContext';\nimport { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\n\nexport type TreeSlots = {\n root: Slot<'div'>;\n};\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationData_unstable = { target: HTMLElement; value:
|
|
1
|
+
{"version":3,"sources":["Tree.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState, SelectionMode, Slot } from '@fluentui/react-utilities';\nimport type { TreeContextValue } from '../../contexts/treeContext';\nimport type { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Home } from '@fluentui/keyboard-keys';\nimport type { TreeItemValue } from '../TreeItem/TreeItem.types';\nimport { CheckboxProps } from '@fluentui/react-checkbox';\nimport { RadioProps } from '@fluentui/react-radio';\n\nexport type MultiSelectValue = NonNullable<CheckboxProps['checked']>;\nexport type SingleSelectValue = NonNullable<RadioProps['checked']>;\nexport type TreeSelectionValue = MultiSelectValue | SingleSelectValue;\n\nexport type TreeSlots = {\n root: Slot<'div'>;\n};\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationData_unstable = { target: HTMLElement; value: TreeItemValue } & (\n | { event: React.MouseEvent<HTMLElement>; type: 'Click' }\n | { event: React.KeyboardEvent<HTMLElement>; type: 'TypeAhead' }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowRight }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowLeft }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowUp }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowDown }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof Home }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof End }\n);\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport type TreeNavigationEvent_unstable = TreeNavigationData_unstable['event'];\n\nexport type TreeOpenChangeData = {\n open: boolean;\n value: TreeItemValue;\n target: HTMLElement;\n} & (\n | { event: React.MouseEvent<HTMLElement>; type: 'ExpandIconClick' }\n | { event: React.MouseEvent<HTMLElement>; type: 'Click' }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof Enter }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowRight }\n | { event: React.KeyboardEvent<HTMLElement>; type: typeof ArrowLeft }\n);\n\nexport type TreeOpenChangeEvent = TreeOpenChangeData['event'];\n\nexport type TreeCheckedChangeData = {\n value: TreeItemValue;\n target: HTMLElement;\n event: React.ChangeEvent<HTMLElement>;\n type: 'Change';\n} & (\n | {\n selectionMode: 'multiselect';\n checked: MultiSelectValue;\n }\n | {\n selectionMode: 'single';\n checked: SingleSelectValue;\n }\n);\n\nexport type TreeCheckedChangeEvent = TreeCheckedChangeData['event'];\n\nexport type TreeContextValues = {\n tree: TreeContextValue;\n};\n\nexport type TreeProps = ComponentProps<TreeSlots> & {\n /**\n * A tree item can have various appearances:\n * - 'subtle' (default): The default tree item styles.\n * - 'subtle-alpha': Minimizes emphasis on hovered or focused states.\n * - 'transparent': Removes background color.\n * @default 'subtle'\n */\n appearance?: 'subtle' | 'subtle-alpha' | 'transparent';\n /**\n * Size of the tree item.\n * @default 'medium'\n */\n size?: 'small' | 'medium';\n /**\n * This refers to a list of ids of opened tree items.\n * Controls the state of the open tree items.\n * These property is ignored for subtrees.\n */\n openItems?: Iterable<TreeItemValue>;\n /**\n * This refers to a list of ids of opened tree items.\n * Default value for the uncontrolled state of open tree items.\n * These property is ignored for subtrees.\n */\n defaultOpenItems?: Iterable<TreeItemValue>;\n /**\n * Callback fired when the component changes value from open state.\n * These property is ignored for subtrees.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n * such as open value and type of interaction that created the event.\n */\n onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData): void;\n\n /**\n * Callback fired when navigation happens inside the component.\n * These property is ignored for subtrees.\n *\n * FIXME: This method is not ideal, as navigation should be handled internally by tabster.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;\n\n /**\n * This refers to the selection mode of the tree.\n * - undefined: No selection can be done.\n * - 'single': Only one tree item can be selected, radio buttons are rendered.\n * - 'multiselect': Multiple tree items can be selected, checkboxes are rendered.\n *\n * @default undefined\n */\n selectionMode?: SelectionMode;\n /**\n * This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.\n * Controls the state of the checked tree items.\n * These property is ignored for subtrees.\n */\n checkedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;\n /**\n * This refers to a list of ids of checked tree items, or a list of tuples of ids and checked state.\n * Default value for the uncontrolled state of checked tree items.\n * These property is ignored for subtrees.\n */\n defaultCheckedItems?: Iterable<TreeItemValue | [TreeItemValue, TreeSelectionValue]>;\n /**\n * Callback fired when the component changes value from checked state.\n * These property is ignored for subtrees.\n *\n * @param event - a React's Synthetic event\n * @param data - A data object with relevant information,\n * such as checked value and type of interaction that created the event.\n */\n onCheckedChange?(event: TreeCheckedChangeEvent, data: TreeCheckedChangeData): void;\n};\n\n/**\n * State used in rendering Tree\n */\nexport type TreeState = ComponentState<TreeSlots> &\n TreeContextValue & {\n open: boolean;\n };\n"],"names":[],"mappings":"AAAA,WAyJI"}
|