@fluentui/react-tree 9.1.1 → 9.3.1
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 +341 -1
- package/CHANGELOG.md +90 -2
- package/dist/index.d.ts +30 -3
- package/lib/FlatTreeItem.js +1 -0
- package/lib/FlatTreeItem.js.map +1 -0
- package/lib/components/FlatTree/useFlatTree.js +61 -1
- package/lib/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib/components/FlatTree/useFlatTreeNavigation.js +28 -14
- package/lib/components/FlatTree/useFlatTreeNavigation.js.map +1 -1
- package/lib/components/FlatTree/useHeadlessFlatTree.js +22 -19
- package/lib/components/FlatTree/useHeadlessFlatTree.js.map +1 -1
- package/lib/components/FlatTreeItem/FlatTreeItem.js +4 -0
- package/lib/components/FlatTreeItem/FlatTreeItem.js.map +1 -0
- package/lib/components/FlatTreeItem/FlatTreeItem.types.js +1 -0
- package/lib/components/FlatTreeItem/FlatTreeItem.types.js.map +1 -0
- package/lib/components/FlatTreeItem/index.js +2 -0
- package/lib/components/FlatTreeItem/index.js.map +1 -0
- package/lib/components/Tree/Tree.types.js.map +1 -1
- package/lib/components/Tree/useTree.js +28 -19
- package/lib/components/Tree/useTree.js.map +1 -1
- package/lib/components/Tree/useTreeContextValues.js +2 -1
- package/lib/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
- package/lib/components/TreeItem/useTreeItem.js +65 -22
- package/lib/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib/components/TreeItemLayout/useTreeItemLayout.js +2 -3
- package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib/contexts/treeContext.js +1 -0
- package/lib/contexts/treeContext.js.map +1 -1
- package/lib/hooks/useRootTree.js +24 -78
- package/lib/hooks/useRootTree.js.map +1 -1
- package/lib/hooks/useSubtree.js.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/utils/createHTMLElementWalker.js +4 -5
- package/lib/utils/createHTMLElementWalker.js.map +1 -1
- package/lib/utils/createHeadlessTree.js +5 -3
- package/lib/utils/createHeadlessTree.js.map +1 -1
- package/lib/utils/flattenTree.js +1 -2
- package/lib/utils/flattenTree.js.map +1 -1
- package/lib/utils/normalizeOpenItems.js +1 -2
- package/lib/utils/normalizeOpenItems.js.map +1 -1
- package/lib-commonjs/FlatTreeItem.js +6 -0
- package/lib-commonjs/FlatTreeItem.js.map +1 -0
- package/lib-commonjs/components/FlatTree/useFlatTree.js +61 -1
- package/lib-commonjs/components/FlatTree/useFlatTree.js.map +1 -1
- package/lib-commonjs/components/FlatTree/useFlatTreeNavigation.js +27 -13
- package/lib-commonjs/components/FlatTree/useFlatTreeNavigation.js.map +1 -1
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js +22 -19
- package/lib-commonjs/components/FlatTree/useHeadlessFlatTree.js.map +1 -1
- package/lib-commonjs/components/FlatTreeItem/FlatTreeItem.js +12 -0
- package/lib-commonjs/components/FlatTreeItem/FlatTreeItem.js.map +1 -0
- package/lib-commonjs/components/FlatTreeItem/FlatTreeItem.types.js +4 -0
- package/lib-commonjs/components/FlatTreeItem/FlatTreeItem.types.js.map +1 -0
- package/lib-commonjs/components/FlatTreeItem/index.js +7 -0
- package/lib-commonjs/components/FlatTreeItem/index.js.map +1 -0
- package/lib-commonjs/components/Tree/useTree.js +28 -19
- package/lib-commonjs/components/Tree/useTree.js.map +1 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.js +2 -1
- package/lib-commonjs/components/Tree/useTreeContextValues.js.map +1 -1
- package/lib-commonjs/components/TreeItem/useTreeItem.js +64 -21
- package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +2 -3
- package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
- package/lib-commonjs/contexts/treeContext.js +1 -0
- package/lib-commonjs/contexts/treeContext.js.map +1 -1
- package/lib-commonjs/hooks/useRootTree.js +24 -78
- package/lib-commonjs/hooks/useRootTree.js.map +1 -1
- package/lib-commonjs/index.js +11 -6
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/createHTMLElementWalker.js +4 -5
- package/lib-commonjs/utils/createHTMLElementWalker.js.map +1 -1
- package/lib-commonjs/utils/createHeadlessTree.js +5 -3
- package/lib-commonjs/utils/createHeadlessTree.js.map +1 -1
- package/lib-commonjs/utils/flattenTree.js +1 -2
- package/lib-commonjs/utils/flattenTree.js.map +1 -1
- package/lib-commonjs/utils/normalizeOpenItems.js +1 -2
- package/lib-commonjs/utils/normalizeOpenItems.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,347 @@
|
|
|
2
2
|
"name": "@fluentui/react-tree",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 26 Sep 2023 17:44:20 GMT",
|
|
6
|
+
"tag": "@fluentui/react-tree_v9.3.1",
|
|
7
|
+
"version": "9.3.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "yuanboxue@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-tree",
|
|
13
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d",
|
|
14
|
+
"comment": "chore: trigger manual version bump after broken release"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-tree",
|
|
19
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.6",
|
|
20
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-tree",
|
|
25
|
+
"comment": "Bump @fluentui/react-aria to v9.3.38",
|
|
26
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-tree",
|
|
31
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.34",
|
|
32
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-tree",
|
|
37
|
+
"comment": "Bump @fluentui/react-button to v9.3.43",
|
|
38
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-tree",
|
|
43
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.44",
|
|
44
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-tree",
|
|
49
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.36",
|
|
50
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-tree",
|
|
55
|
+
"comment": "Bump @fluentui/react-portal to v9.3.18",
|
|
56
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"author": "beachball",
|
|
60
|
+
"package": "@fluentui/react-tree",
|
|
61
|
+
"comment": "Bump @fluentui/react-radio to v9.1.44",
|
|
62
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"author": "beachball",
|
|
66
|
+
"package": "@fluentui/react-tree",
|
|
67
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.9.1",
|
|
68
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"author": "beachball",
|
|
72
|
+
"package": "@fluentui/react-tree",
|
|
73
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.1",
|
|
74
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"author": "beachball",
|
|
78
|
+
"package": "@fluentui/react-tree",
|
|
79
|
+
"comment": "Bump @fluentui/react-theme to v9.1.14",
|
|
80
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"author": "beachball",
|
|
84
|
+
"package": "@fluentui/react-tree",
|
|
85
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.5",
|
|
86
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"author": "beachball",
|
|
90
|
+
"package": "@fluentui/react-tree",
|
|
91
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.12",
|
|
92
|
+
"commit": "05a23f6f5f331841c9ac9fb63764440c543f791d"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"date": "Tue, 26 Sep 2023 15:31:41 GMT",
|
|
99
|
+
"tag": "@fluentui/react-tree_v9.3.0",
|
|
100
|
+
"version": "9.3.0",
|
|
101
|
+
"comments": {
|
|
102
|
+
"minor": [
|
|
103
|
+
{
|
|
104
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
105
|
+
"package": "@fluentui/react-tree",
|
|
106
|
+
"commit": "aef09fc324e71a15a10a6a3c1c7ed556e2775725",
|
|
107
|
+
"comment": "feat: FlatTree supports navigation without useHeadlessFlatTree"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"author": "beachball",
|
|
111
|
+
"package": "@fluentui/react-tree",
|
|
112
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.5",
|
|
113
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"author": "beachball",
|
|
117
|
+
"package": "@fluentui/react-tree",
|
|
118
|
+
"comment": "Bump @fluentui/react-aria to v9.3.37",
|
|
119
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"author": "beachball",
|
|
123
|
+
"package": "@fluentui/react-tree",
|
|
124
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.33",
|
|
125
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"author": "beachball",
|
|
129
|
+
"package": "@fluentui/react-tree",
|
|
130
|
+
"comment": "Bump @fluentui/react-button to v9.3.42",
|
|
131
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"author": "beachball",
|
|
135
|
+
"package": "@fluentui/react-tree",
|
|
136
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.43",
|
|
137
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"author": "beachball",
|
|
141
|
+
"package": "@fluentui/react-tree",
|
|
142
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.35",
|
|
143
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"author": "beachball",
|
|
147
|
+
"package": "@fluentui/react-tree",
|
|
148
|
+
"comment": "Bump @fluentui/react-portal to v9.3.17",
|
|
149
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"author": "beachball",
|
|
153
|
+
"package": "@fluentui/react-tree",
|
|
154
|
+
"comment": "Bump @fluentui/react-radio to v9.1.43",
|
|
155
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"author": "beachball",
|
|
159
|
+
"package": "@fluentui/react-tree",
|
|
160
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.9.0",
|
|
161
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"author": "beachball",
|
|
165
|
+
"package": "@fluentui/react-tree",
|
|
166
|
+
"comment": "Bump @fluentui/react-tabster to v9.13.0",
|
|
167
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"author": "beachball",
|
|
171
|
+
"package": "@fluentui/react-tree",
|
|
172
|
+
"comment": "Bump @fluentui/react-theme to v9.1.13",
|
|
173
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"author": "beachball",
|
|
177
|
+
"package": "@fluentui/react-tree",
|
|
178
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.4",
|
|
179
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"author": "beachball",
|
|
183
|
+
"package": "@fluentui/react-tree",
|
|
184
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.11",
|
|
185
|
+
"commit": "e16520437e10cd824ac254dd797e32762b5de72d"
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"patch": [
|
|
189
|
+
{
|
|
190
|
+
"author": "martinhochel@microsoft.com",
|
|
191
|
+
"package": "@fluentui/react-tree",
|
|
192
|
+
"commit": "e61473fa10195f6ebf2308205c1e72e91b711831",
|
|
193
|
+
"comment": "fix: bump swc core to mitigate transpilation memory leaks"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"author": "ololubek@microsoft.com",
|
|
197
|
+
"package": "@fluentui/react-tree",
|
|
198
|
+
"commit": "a31e7394d9f169bc5aa55430a22cdc65425a1b49",
|
|
199
|
+
"comment": "chore: Update react-icons version to pick up IconDirectionContextProvider updated export"
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"date": "Wed, 20 Sep 2023 17:47:45 GMT",
|
|
206
|
+
"tag": "@fluentui/react-tree_v9.2.1",
|
|
207
|
+
"version": "9.2.1",
|
|
208
|
+
"comments": {
|
|
209
|
+
"patch": [
|
|
210
|
+
{
|
|
211
|
+
"author": "martinhochel@microsoft.com",
|
|
212
|
+
"package": "@fluentui/react-tree",
|
|
213
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0",
|
|
214
|
+
"comment": "chore: trigger manual version bump after broken release"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"author": "beachball",
|
|
218
|
+
"package": "@fluentui/react-tree",
|
|
219
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.32",
|
|
220
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"author": "beachball",
|
|
224
|
+
"package": "@fluentui/react-tree",
|
|
225
|
+
"comment": "Bump @fluentui/react-button to v9.3.41",
|
|
226
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"author": "beachball",
|
|
230
|
+
"package": "@fluentui/react-tree",
|
|
231
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.42",
|
|
232
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"author": "beachball",
|
|
236
|
+
"package": "@fluentui/react-tree",
|
|
237
|
+
"comment": "Bump @fluentui/react-portal to v9.3.16",
|
|
238
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"author": "beachball",
|
|
242
|
+
"package": "@fluentui/react-tree",
|
|
243
|
+
"comment": "Bump @fluentui/react-radio to v9.1.42",
|
|
244
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"author": "beachball",
|
|
248
|
+
"package": "@fluentui/react-tree",
|
|
249
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.8.1",
|
|
250
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"author": "beachball",
|
|
254
|
+
"package": "@fluentui/react-tree",
|
|
255
|
+
"comment": "Bump @fluentui/react-tabster to v9.12.11",
|
|
256
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"author": "beachball",
|
|
260
|
+
"package": "@fluentui/react-tree",
|
|
261
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.10",
|
|
262
|
+
"commit": "41d0ed0376ad79f1f5f5c4c7487515a1c6be35f0"
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"date": "Wed, 20 Sep 2023 14:59:51 GMT",
|
|
269
|
+
"tag": "@fluentui/react-tree_v9.2.0",
|
|
270
|
+
"version": "9.2.0",
|
|
271
|
+
"comments": {
|
|
272
|
+
"minor": [
|
|
273
|
+
{
|
|
274
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
275
|
+
"package": "@fluentui/react-tree",
|
|
276
|
+
"commit": "54f2d12c318d44326f91d9db9ef7855e48de4520",
|
|
277
|
+
"comment": "feat: adds treeType to tree context"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
281
|
+
"package": "@fluentui/react-tree",
|
|
282
|
+
"commit": "97568b1abb279974b96c47afc32418bd5386166d",
|
|
283
|
+
"comment": "creates FlatTreeItem component"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"author": "beachball",
|
|
287
|
+
"package": "@fluentui/react-tree",
|
|
288
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.31",
|
|
289
|
+
"commit": "c60d4e7169457535c8d23701f6b951d1fff478ab"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"author": "beachball",
|
|
293
|
+
"package": "@fluentui/react-tree",
|
|
294
|
+
"comment": "Bump @fluentui/react-button to v9.3.40",
|
|
295
|
+
"commit": "c60d4e7169457535c8d23701f6b951d1fff478ab"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"author": "beachball",
|
|
299
|
+
"package": "@fluentui/react-tree",
|
|
300
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.41",
|
|
301
|
+
"commit": "c60d4e7169457535c8d23701f6b951d1fff478ab"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"author": "beachball",
|
|
305
|
+
"package": "@fluentui/react-tree",
|
|
306
|
+
"comment": "Bump @fluentui/react-portal to v9.3.15",
|
|
307
|
+
"commit": "c60d4e7169457535c8d23701f6b951d1fff478ab"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"author": "beachball",
|
|
311
|
+
"package": "@fluentui/react-tree",
|
|
312
|
+
"comment": "Bump @fluentui/react-radio to v9.1.41",
|
|
313
|
+
"commit": "c60d4e7169457535c8d23701f6b951d1fff478ab"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"author": "beachball",
|
|
317
|
+
"package": "@fluentui/react-tree",
|
|
318
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.8.0",
|
|
319
|
+
"commit": "c60d4e7169457535c8d23701f6b951d1fff478ab"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"author": "beachball",
|
|
323
|
+
"package": "@fluentui/react-tree",
|
|
324
|
+
"comment": "Bump @fluentui/react-tabster to v9.12.10",
|
|
325
|
+
"commit": "c60d4e7169457535c8d23701f6b951d1fff478ab"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"author": "beachball",
|
|
329
|
+
"package": "@fluentui/react-tree",
|
|
330
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.9",
|
|
331
|
+
"commit": "c60d4e7169457535c8d23701f6b951d1fff478ab"
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
"patch": [
|
|
335
|
+
{
|
|
336
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
337
|
+
"package": "@fluentui/react-tree",
|
|
338
|
+
"commit": "464d9b8df31cd09782e6f5b29db5ab8fad9ce9c2",
|
|
339
|
+
"comment": "chore: stop using global document on HTMLElementWalker"
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"date": "Thu, 14 Sep 2023 16:44:47 GMT",
|
|
6
346
|
"tag": "@fluentui/react-tree_v9.1.1",
|
|
7
347
|
"version": "9.1.1",
|
|
8
348
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,100 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tree
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 26 Sep 2023 17:44:20 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.3.1)
|
|
8
|
+
|
|
9
|
+
Tue, 26 Sep 2023 17:44:20 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.3.0..@fluentui/react-tree_v9.3.1)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore: trigger manual version bump after broken release ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by yuanboxue@microsoft.com)
|
|
15
|
+
- Bump @fluentui/keyboard-keys to v9.0.6 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
16
|
+
- Bump @fluentui/react-aria to v9.3.38 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
17
|
+
- Bump @fluentui/react-avatar to v9.5.34 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
18
|
+
- Bump @fluentui/react-button to v9.3.43 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
19
|
+
- Bump @fluentui/react-checkbox to v9.1.44 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
20
|
+
- Bump @fluentui/react-context-selector to v9.1.36 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
21
|
+
- Bump @fluentui/react-portal to v9.3.18 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
22
|
+
- Bump @fluentui/react-radio to v9.1.44 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
23
|
+
- Bump @fluentui/react-shared-contexts to v9.9.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
24
|
+
- Bump @fluentui/react-tabster to v9.13.1 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
25
|
+
- Bump @fluentui/react-theme to v9.1.14 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
26
|
+
- Bump @fluentui/react-utilities to v9.13.5 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
27
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.12 ([PR #29303](https://github.com/microsoft/fluentui/pull/29303) by beachball)
|
|
28
|
+
|
|
29
|
+
## [9.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.3.0)
|
|
30
|
+
|
|
31
|
+
Tue, 26 Sep 2023 15:31:41 GMT
|
|
32
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.2.1..@fluentui/react-tree_v9.3.0)
|
|
33
|
+
|
|
34
|
+
### Minor changes
|
|
35
|
+
|
|
36
|
+
- feat: FlatTree supports navigation without useHeadlessFlatTree ([PR #29091](https://github.com/microsoft/fluentui/pull/29091) by bernardo.sunderhus@gmail.com)
|
|
37
|
+
- Bump @fluentui/keyboard-keys to v9.0.5 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
38
|
+
- Bump @fluentui/react-aria to v9.3.37 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
39
|
+
- Bump @fluentui/react-avatar to v9.5.33 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
40
|
+
- Bump @fluentui/react-button to v9.3.42 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
41
|
+
- Bump @fluentui/react-checkbox to v9.1.43 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
42
|
+
- Bump @fluentui/react-context-selector to v9.1.35 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
43
|
+
- Bump @fluentui/react-portal to v9.3.17 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
44
|
+
- Bump @fluentui/react-radio to v9.1.43 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
45
|
+
- Bump @fluentui/react-shared-contexts to v9.9.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
46
|
+
- Bump @fluentui/react-tabster to v9.13.0 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
47
|
+
- Bump @fluentui/react-theme to v9.1.13 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
48
|
+
- Bump @fluentui/react-utilities to v9.13.4 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
49
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.11 ([PR #29300](https://github.com/microsoft/fluentui/pull/29300) by beachball)
|
|
50
|
+
|
|
51
|
+
### Patches
|
|
52
|
+
|
|
53
|
+
- fix: bump swc core to mitigate transpilation memory leaks ([PR #29253](https://github.com/microsoft/fluentui/pull/29253) by martinhochel@microsoft.com)
|
|
54
|
+
- chore: Update react-icons version to pick up IconDirectionContextProvider updated export ([PR #29151](https://github.com/microsoft/fluentui/pull/29151) by ololubek@microsoft.com)
|
|
55
|
+
|
|
56
|
+
## [9.2.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.2.1)
|
|
57
|
+
|
|
58
|
+
Wed, 20 Sep 2023 17:47:45 GMT
|
|
59
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.2.0..@fluentui/react-tree_v9.2.1)
|
|
60
|
+
|
|
61
|
+
### Patches
|
|
62
|
+
|
|
63
|
+
- chore: trigger manual version bump after broken release ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by martinhochel@microsoft.com)
|
|
64
|
+
- Bump @fluentui/react-avatar to v9.5.32 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
|
65
|
+
- Bump @fluentui/react-button to v9.3.41 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
|
66
|
+
- Bump @fluentui/react-checkbox to v9.1.42 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
|
67
|
+
- Bump @fluentui/react-portal to v9.3.16 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
|
68
|
+
- Bump @fluentui/react-radio to v9.1.42 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
|
69
|
+
- Bump @fluentui/react-shared-contexts to v9.8.1 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
|
70
|
+
- Bump @fluentui/react-tabster to v9.12.11 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
|
71
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.10 ([PR #29197](https://github.com/microsoft/fluentui/pull/29197) by beachball)
|
|
72
|
+
|
|
73
|
+
## [9.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.2.0)
|
|
74
|
+
|
|
75
|
+
Wed, 20 Sep 2023 14:59:51 GMT
|
|
76
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.1.1..@fluentui/react-tree_v9.2.0)
|
|
77
|
+
|
|
78
|
+
### Minor changes
|
|
79
|
+
|
|
80
|
+
- feat: adds treeType to tree context ([PR #29189](https://github.com/microsoft/fluentui/pull/29189) by bernardo.sunderhus@gmail.com)
|
|
81
|
+
- creates FlatTreeItem component ([PR #29098](https://github.com/microsoft/fluentui/pull/29098) by bernardo.sunderhus@gmail.com)
|
|
82
|
+
- Bump @fluentui/react-avatar to v9.5.31 ([PR #29193](https://github.com/microsoft/fluentui/pull/29193) by beachball)
|
|
83
|
+
- Bump @fluentui/react-button to v9.3.40 ([PR #29193](https://github.com/microsoft/fluentui/pull/29193) by beachball)
|
|
84
|
+
- Bump @fluentui/react-checkbox to v9.1.41 ([PR #29193](https://github.com/microsoft/fluentui/pull/29193) by beachball)
|
|
85
|
+
- Bump @fluentui/react-portal to v9.3.15 ([PR #29193](https://github.com/microsoft/fluentui/pull/29193) by beachball)
|
|
86
|
+
- Bump @fluentui/react-radio to v9.1.41 ([PR #29193](https://github.com/microsoft/fluentui/pull/29193) by beachball)
|
|
87
|
+
- Bump @fluentui/react-shared-contexts to v9.8.0 ([PR #29193](https://github.com/microsoft/fluentui/pull/29193) by beachball)
|
|
88
|
+
- Bump @fluentui/react-tabster to v9.12.10 ([PR #29193](https://github.com/microsoft/fluentui/pull/29193) by beachball)
|
|
89
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.9 ([PR #29193](https://github.com/microsoft/fluentui/pull/29193) by beachball)
|
|
90
|
+
|
|
91
|
+
### Patches
|
|
92
|
+
|
|
93
|
+
- chore: stop using global document on HTMLElementWalker ([PR #29097](https://github.com/microsoft/fluentui/pull/29097) by bernardo.sunderhus@gmail.com)
|
|
94
|
+
|
|
7
95
|
## [9.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.1.1)
|
|
8
96
|
|
|
9
|
-
Thu, 14 Sep 2023 16:
|
|
97
|
+
Thu, 14 Sep 2023 16:44:47 GMT
|
|
10
98
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.1.0..@fluentui/react-tree_v9.1.1)
|
|
11
99
|
|
|
12
100
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { End } from '@fluentui/keyboard-keys';
|
|
|
16
16
|
import type { Enter } from '@fluentui/keyboard-keys';
|
|
17
17
|
import type { ExtractSlotProps } from '@fluentui/react-utilities';
|
|
18
18
|
import { FC } from 'react';
|
|
19
|
-
import
|
|
19
|
+
import { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
20
20
|
import type { Home } from '@fluentui/keyboard-keys';
|
|
21
21
|
import { Provider } from 'react';
|
|
22
22
|
import { ProviderProps } from 'react';
|
|
@@ -108,6 +108,21 @@ export declare const FlatTree: ForwardRefComponent<FlatTreeProps>;
|
|
|
108
108
|
|
|
109
109
|
export declare const flatTreeClassNames: SlotClassNames<TreeSlots>;
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* The `FlatTreeItem` component represents a single item in a flat tree.
|
|
113
|
+
*/
|
|
114
|
+
export declare const FlatTreeItem: ForwardRefComponent<FlatTreeItemProps>;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* FlatTreeItem Props
|
|
118
|
+
*/
|
|
119
|
+
export declare type FlatTreeItemProps = TreeItemProps & {
|
|
120
|
+
value: TreeItemValue;
|
|
121
|
+
'aria-level': number;
|
|
122
|
+
'aria-setsize': number;
|
|
123
|
+
'aria-posinset': number;
|
|
124
|
+
};
|
|
125
|
+
|
|
111
126
|
export declare type FlatTreeProps = ComponentProps<TreeSlots> & {
|
|
112
127
|
/**
|
|
113
128
|
* A tree item can have various appearances:
|
|
@@ -255,7 +270,7 @@ declare type HeadlessTreeItem<Props extends HeadlessTreeItemProps> = {
|
|
|
255
270
|
value: TreeItemValue;
|
|
256
271
|
parentValue: TreeItemValue | undefined;
|
|
257
272
|
itemType: TreeItemType;
|
|
258
|
-
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> &
|
|
273
|
+
getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Props;
|
|
259
274
|
};
|
|
260
275
|
|
|
261
276
|
declare type HeadlessTreeItemProps = Omit<TreeItemProps, 'itemType' | 'value'> & {
|
|
@@ -394,6 +409,7 @@ export declare type TreeCheckedChangeEvent = TreeCheckedChangeData['event'];
|
|
|
394
409
|
export declare const treeClassNames: SlotClassNames<TreeSlots>;
|
|
395
410
|
|
|
396
411
|
export declare type TreeContextValue = {
|
|
412
|
+
treeType: 'nested' | 'flat';
|
|
397
413
|
level: number;
|
|
398
414
|
selectionMode: 'none' | SelectionMode_2;
|
|
399
415
|
appearance: 'subtle' | 'subtle-alpha' | 'transparent';
|
|
@@ -602,13 +618,23 @@ export declare type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {
|
|
|
602
618
|
*/
|
|
603
619
|
open?: boolean;
|
|
604
620
|
onOpenChange?: (e: TreeItemOpenChangeEvent, data: TreeItemOpenChangeData) => void;
|
|
621
|
+
/**
|
|
622
|
+
* This property is inferred through context on a nested tree, and required for a flat tree.
|
|
623
|
+
*/
|
|
624
|
+
parentValue?: TreeItemValue;
|
|
605
625
|
};
|
|
606
626
|
|
|
607
627
|
export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined> & React_2.FC<React_2.ProviderProps<TreeItemContextValue | undefined>>;
|
|
608
628
|
|
|
609
629
|
declare type TreeItemRequest = {
|
|
610
630
|
itemType: TreeItemType;
|
|
611
|
-
} & (OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'>
|
|
631
|
+
} & ((OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'> & {
|
|
632
|
+
requestType: 'open';
|
|
633
|
+
}) | (TreeNavigationData_unstable & {
|
|
634
|
+
requestType: 'navigate';
|
|
635
|
+
}) | (OmitWithoutExpanding<TreeCheckedChangeData, 'selectionMode' | 'checkedItems'> & {
|
|
636
|
+
requestType: 'selection';
|
|
637
|
+
}));
|
|
612
638
|
|
|
613
639
|
export declare type TreeItemSlots = {
|
|
614
640
|
root: Slot<ExtractSlotProps<Slot<'div'> & {
|
|
@@ -631,6 +657,7 @@ export declare type TreeItemValue = string | number;
|
|
|
631
657
|
export declare type TreeNavigationData_unstable = {
|
|
632
658
|
target: HTMLElement;
|
|
633
659
|
value: TreeItemValue;
|
|
660
|
+
parentValue: TreeItemValue | undefined;
|
|
634
661
|
} & ({
|
|
635
662
|
event: React_2.MouseEvent<HTMLElement>;
|
|
636
663
|
type: 'Click';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/FlatTreeItem/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["FlatTreeItem.ts"],"sourcesContent":["export * from './components/FlatTreeItem/index';\n"],"names":[],"mappings":"AAAA,cAAc,kCAAkC"}
|
|
@@ -1,3 +1,63 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRootTree } from '../../hooks/useRootTree';
|
|
3
|
-
|
|
3
|
+
import { useFlatTreeNavigation } from './useFlatTreeNavigation';
|
|
4
|
+
import { createHTMLElementWalker } from '../../utils/createHTMLElementWalker';
|
|
5
|
+
import { useFluent_unstable } from '@fluentui/react-shared-contexts';
|
|
6
|
+
import { treeItemFilter } from '../../utils/treeItemFilter';
|
|
7
|
+
import { slot, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';
|
|
8
|
+
import { useTreeContext_unstable } from '../../contexts/treeContext';
|
|
9
|
+
import { useSubtree } from '../../hooks/useSubtree';
|
|
10
|
+
export const useFlatTree_unstable = (props, ref)=>{
|
|
11
|
+
const level = useTreeContext_unstable((ctx)=>ctx.level);
|
|
12
|
+
// as level is static, this doesn't break rule of hooks
|
|
13
|
+
// and if this becomes an issue later on, this can be easily converted
|
|
14
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
15
|
+
return level > 1 ? useSubFlatTree(props, ref) : useRootFlatTree(props, ref);
|
|
16
|
+
};
|
|
17
|
+
function useRootFlatTree(props, ref) {
|
|
18
|
+
const { navigate, initialize } = useFlatTreeNavigation();
|
|
19
|
+
const walkerRef = React.useRef();
|
|
20
|
+
const { targetDocument } = useFluent_unstable();
|
|
21
|
+
const initializeWalker = React.useCallback((root)=>{
|
|
22
|
+
if (root && targetDocument) {
|
|
23
|
+
walkerRef.current = createHTMLElementWalker(root, targetDocument, treeItemFilter);
|
|
24
|
+
initialize(walkerRef.current);
|
|
25
|
+
}
|
|
26
|
+
}, [
|
|
27
|
+
initialize,
|
|
28
|
+
targetDocument
|
|
29
|
+
]);
|
|
30
|
+
const handleNavigation = useEventCallback((event, data)=>{
|
|
31
|
+
var _props_onNavigation;
|
|
32
|
+
(_props_onNavigation = props.onNavigation) === null || _props_onNavigation === void 0 ? void 0 : _props_onNavigation.call(props, event, data);
|
|
33
|
+
if (walkerRef.current && !event.isDefaultPrevented()) {
|
|
34
|
+
navigate(data, walkerRef.current);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
treeType: 'flat',
|
|
39
|
+
...useRootTree({
|
|
40
|
+
...props,
|
|
41
|
+
onNavigation: handleNavigation
|
|
42
|
+
}, useMergedRefs(ref, initializeWalker))
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function useSubFlatTree(props, ref) {
|
|
46
|
+
if (process.env.NODE_ENV === 'development') {
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
console.error(`@fluentui/react-tree [useFlatTree]:
|
|
49
|
+
Subtrees are not allowed in a FlatTree!
|
|
50
|
+
You cannot use a <FlatTree> component inside of another <FlatTree> component.`);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
...useSubtree(props, ref),
|
|
54
|
+
open: false,
|
|
55
|
+
treeType: 'flat',
|
|
56
|
+
components: {
|
|
57
|
+
root: React.Fragment
|
|
58
|
+
},
|
|
59
|
+
root: slot.always(undefined, {
|
|
60
|
+
elementType: React.Fragment
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useFlatTree.ts"],"sourcesContent":["import * as React from 'react';\nimport { useRootTree } from '../../hooks/useRootTree';\nimport { FlatTreeProps, FlatTreeState } from './FlatTree.types';\n\nexport const useFlatTree_unstable: (props: FlatTreeProps, ref: React.Ref<HTMLElement>) => FlatTreeState = useRootTree;\n"],"names":["React","useRootTree","useFlatTree_unstable"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,WAAW,QAAQ,0BAA0B;
|
|
1
|
+
{"version":3,"sources":["useFlatTree.ts"],"sourcesContent":["import * as React from 'react';\nimport { useRootTree } from '../../hooks/useRootTree';\nimport { FlatTreeProps, FlatTreeSlots, FlatTreeState } from './FlatTree.types';\nimport { useFlatTreeNavigation } from './useFlatTreeNavigation';\nimport { HTMLElementWalker, createHTMLElementWalker } from '../../utils/createHTMLElementWalker';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { treeItemFilter } from '../../utils/treeItemFilter';\nimport { ExtractSlotProps, slot, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport type { TreeNavigationData_unstable, TreeNavigationEvent_unstable } from '../Tree/Tree.types';\nimport { useTreeContext_unstable } from '../../contexts/treeContext';\nimport { useSubtree } from '../../hooks/useSubtree';\n\nexport const useFlatTree_unstable: (props: FlatTreeProps, ref: React.Ref<HTMLElement>) => FlatTreeState = (\n props,\n ref,\n) => {\n const level = useTreeContext_unstable(ctx => ctx.level);\n // as level is static, this doesn't break rule of hooks\n // and if this becomes an issue later on, this can be easily converted\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return level > 1 ? useSubFlatTree(props, ref) : useRootFlatTree(props, ref);\n};\n\nfunction useRootFlatTree(props: FlatTreeProps, ref: React.Ref<HTMLElement>): FlatTreeState {\n const { navigate, initialize } = useFlatTreeNavigation();\n const walkerRef = React.useRef<HTMLElementWalker>();\n const { targetDocument } = useFluent_unstable();\n\n const initializeWalker = React.useCallback(\n (root: HTMLElement | null) => {\n if (root && targetDocument) {\n walkerRef.current = createHTMLElementWalker(root, targetDocument, treeItemFilter);\n initialize(walkerRef.current);\n }\n },\n [initialize, targetDocument],\n );\n\n const handleNavigation = useEventCallback(\n (event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable) => {\n props.onNavigation?.(event, data);\n if (walkerRef.current && !event.isDefaultPrevented()) {\n navigate(data, walkerRef.current);\n }\n },\n );\n\n return {\n treeType: 'flat',\n ...useRootTree({ ...props, onNavigation: handleNavigation }, useMergedRefs(ref, initializeWalker)),\n };\n}\n\nfunction useSubFlatTree(props: FlatTreeProps, ref: React.Ref<HTMLElement>): FlatTreeState {\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.error(/* #__DE-INDENT__ */ `\n @fluentui/react-tree [useFlatTree]:\n Subtrees are not allowed in a FlatTree!\n You cannot use a <FlatTree> component inside of another <FlatTree> component.\n `);\n }\n return {\n ...useSubtree(props, ref),\n open: false,\n treeType: 'flat',\n components: { root: React.Fragment },\n root: slot.always<ExtractSlotProps<FlatTreeSlots['root']>>(undefined, { elementType: React.Fragment }),\n };\n}\n"],"names":["React","useRootTree","useFlatTreeNavigation","createHTMLElementWalker","useFluent_unstable","treeItemFilter","slot","useEventCallback","useMergedRefs","useTreeContext_unstable","useSubtree","useFlatTree_unstable","props","ref","level","ctx","useSubFlatTree","useRootFlatTree","navigate","initialize","walkerRef","useRef","targetDocument","initializeWalker","useCallback","root","current","handleNavigation","event","data","onNavigation","isDefaultPrevented","treeType","process","env","NODE_ENV","console","error","open","components","Fragment","always","undefined","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,WAAW,QAAQ,0BAA0B;AAEtD,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAA4BC,uBAAuB,QAAQ,sCAAsC;AACjG,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAA2BC,IAAI,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,4BAA4B;AAEpG,SAASC,uBAAuB,QAAQ,6BAA6B;AACrE,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,OAAO,MAAMC,uBAA6F,CACxGC,OACAC;IAEA,MAAMC,QAAQL,wBAAwBM,CAAAA,MAAOA,IAAID,KAAK;IACtD,uDAAuD;IACvD,sEAAsE;IACtE,sDAAsD;IACtD,OAAOA,QAAQ,IAAIE,eAAeJ,OAAOC,OAAOI,gBAAgBL,OAAOC;AACzE,EAAE;AAEF,SAASI,gBAAgBL,KAAoB,EAAEC,GAA2B;IACxE,MAAM,EAAEK,QAAQ,EAAEC,UAAU,EAAE,GAAGjB;IACjC,MAAMkB,YAAYpB,MAAMqB,MAAM;IAC9B,MAAM,EAAEC,cAAc,EAAE,GAAGlB;IAE3B,MAAMmB,mBAAmBvB,MAAMwB,WAAW,CACxC,CAACC;QACC,IAAIA,QAAQH,gBAAgB;YAC1BF,UAAUM,OAAO,GAAGvB,wBAAwBsB,MAAMH,gBAAgBjB;YAClEc,WAAWC,UAAUM,OAAO;QAC9B;IACF,GACA;QAACP;QAAYG;KAAe;IAG9B,MAAMK,mBAAmBpB,iBACvB,CAACqB,OAAqCC;YACpCjB;SAAAA,sBAAAA,MAAMkB,YAAY,cAAlBlB,0CAAAA,yBAAAA,OAAqBgB,OAAOC;QAC5B,IAAIT,UAAUM,OAAO,IAAI,CAACE,MAAMG,kBAAkB,IAAI;YACpDb,SAASW,MAAMT,UAAUM,OAAO;QAClC;IACF;IAGF,OAAO;QACLM,UAAU;QACV,GAAG/B,YAAY;YAAE,GAAGW,KAAK;YAAEkB,cAAcH;QAAiB,GAAGnB,cAAcK,KAAKU,kBAAkB;IACpG;AACF;AAEA,SAASP,eAAeJ,KAAoB,EAAEC,GAA2B;IACvE,IAAIoB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,sCAAsC;QACtCC,QAAQC,KAAK,CAAsB,CAAC;;6EAIpC,CAAC;IACH;IACA,OAAO;QACL,GAAG3B,WAAWE,OAAOC,IAAI;QACzByB,MAAM;QACNN,UAAU;QACVO,YAAY;YAAEd,MAAMzB,MAAMwC,QAAQ;QAAC;QACnCf,MAAMnB,KAAKmC,MAAM,CAA0CC,WAAW;YAAEC,aAAa3C,MAAMwC,QAAQ;QAAC;IACtG;AACF"}
|