@fluentui/react-tree 9.0.0-beta.23 → 9.0.0-beta.25

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.
Files changed (75) hide show
  1. package/CHANGELOG.json +88 -10
  2. package/CHANGELOG.md +37 -11
  3. package/dist/index.d.ts +75 -49
  4. package/lib/components/Tree/Tree.types.js +1 -1
  5. package/lib/components/Tree/Tree.types.js.map +1 -1
  6. package/lib/components/Tree/useRootTree.js +55 -73
  7. package/lib/components/Tree/useRootTree.js.map +1 -1
  8. package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
  9. package/lib/components/TreeItem/renderTreeItem.js +4 -2
  10. package/lib/components/TreeItem/renderTreeItem.js.map +1 -1
  11. package/lib/components/TreeItem/useTreeItem.js +58 -16
  12. package/lib/components/TreeItem/useTreeItem.js.map +1 -1
  13. package/lib/components/TreeItem/useTreeItemContextValues.js +13 -6
  14. package/lib/components/TreeItem/useTreeItemContextValues.js.map +1 -1
  15. package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
  16. package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
  17. package/lib/components/TreeItemLayout/useTreeItemLayout.js +7 -28
  18. package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
  19. package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
  20. package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
  21. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
  22. package/lib/contexts/index.js +1 -0
  23. package/lib/contexts/index.js.map +1 -1
  24. package/lib/contexts/treeContext.js +2 -2
  25. package/lib/contexts/treeContext.js.map +1 -1
  26. package/lib/contexts/treeItemContext.js +0 -4
  27. package/lib/contexts/treeItemContext.js.map +1 -1
  28. package/lib/contexts/treeItemSlotsContext.js +9 -0
  29. package/lib/contexts/treeItemSlotsContext.js.map +1 -0
  30. package/lib/hooks/index.js +1 -1
  31. package/lib/hooks/index.js.map +1 -1
  32. package/lib/hooks/useControllableOpenItems.js +25 -0
  33. package/lib/hooks/useControllableOpenItems.js.map +1 -0
  34. package/lib/hooks/useFlatTree.js +3 -3
  35. package/lib/hooks/useFlatTree.js.map +1 -1
  36. package/lib/index.js.map +1 -1
  37. package/lib/utils/ImmutableSet.js +16 -9
  38. package/lib/utils/ImmutableSet.js.map +1 -1
  39. package/lib/utils/createFlatTreeItems.js.map +1 -1
  40. package/lib/utils/flattenTree.js +0 -5
  41. package/lib/utils/flattenTree.js.map +1 -1
  42. package/lib-commonjs/components/Tree/Tree.types.js +0 -2
  43. package/lib-commonjs/components/Tree/Tree.types.js.map +1 -1
  44. package/lib-commonjs/components/Tree/useRootTree.js +54 -72
  45. package/lib-commonjs/components/Tree/useRootTree.js.map +1 -1
  46. package/lib-commonjs/components/TreeItem/renderTreeItem.js +3 -1
  47. package/lib-commonjs/components/TreeItem/renderTreeItem.js.map +1 -1
  48. package/lib-commonjs/components/TreeItem/useTreeItem.js +57 -15
  49. package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
  50. package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js +14 -6
  51. package/lib-commonjs/components/TreeItem/useTreeItemContextValues.js.map +1 -1
  52. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +6 -26
  53. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
  54. package/lib-commonjs/contexts/index.js +1 -0
  55. package/lib-commonjs/contexts/index.js.map +1 -1
  56. package/lib-commonjs/contexts/treeContext.js +1 -1
  57. package/lib-commonjs/contexts/treeContext.js.map +1 -1
  58. package/lib-commonjs/contexts/treeItemContext.js +0 -4
  59. package/lib-commonjs/contexts/treeItemContext.js.map +1 -1
  60. package/lib-commonjs/contexts/treeItemSlotsContext.js +25 -0
  61. package/lib-commonjs/contexts/treeItemSlotsContext.js.map +1 -0
  62. package/lib-commonjs/hooks/index.js +1 -1
  63. package/lib-commonjs/hooks/index.js.map +1 -1
  64. package/lib-commonjs/hooks/{useOpenItemsState.js → useControllableOpenItems.js} +15 -14
  65. package/lib-commonjs/hooks/useControllableOpenItems.js.map +1 -0
  66. package/lib-commonjs/hooks/useFlatTree.js +3 -3
  67. package/lib-commonjs/hooks/useFlatTree.js.map +1 -1
  68. package/lib-commonjs/utils/ImmutableSet.js +21 -16
  69. package/lib-commonjs/utils/ImmutableSet.js.map +1 -1
  70. package/lib-commonjs/utils/flattenTree.js +0 -5
  71. package/lib-commonjs/utils/flattenTree.js.map +1 -1
  72. package/package.json +7 -7
  73. package/lib/hooks/useOpenItemsState.js +0 -28
  74. package/lib/hooks/useOpenItemsState.js.map +0 -1
  75. package/lib-commonjs/hooks/useOpenItemsState.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,85 @@
2
2
  "name": "@fluentui/react-tree",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 03 Jul 2023 11:54:01 GMT",
5
+ "date": "Tue, 11 Jul 2023 18:44:11 GMT",
6
+ "tag": "@fluentui/react-tree_v9.0.0-beta.25",
7
+ "version": "9.0.0-beta.25",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "bernardo.sunderhus@gmail.com",
12
+ "package": "@fluentui/react-tree",
13
+ "commit": "64752d9a76638ccc4c91303347993b50e0e6d053",
14
+ "comment": "chore: move slots back to TreeItem and creates slot context"
15
+ },
16
+ {
17
+ "author": "bernardo.sunderhus@gmail.com",
18
+ "package": "@fluentui/react-tree",
19
+ "commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74",
20
+ "comment": "chore: openItems property added to TreeOpenChangeData + minor internal improvements"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-tree",
25
+ "comment": "Bump @fluentui/react-avatar to v9.5.12",
26
+ "commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-tree",
31
+ "comment": "Bump @fluentui/react-button to v9.3.23",
32
+ "commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-tree",
37
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.11",
38
+ "commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-tree",
43
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0",
44
+ "commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Mon, 03 Jul 2023 13:34:28 GMT",
51
+ "tag": "@fluentui/react-tree_v9.0.0-beta.24",
52
+ "version": "9.0.0-beta.24",
53
+ "comments": {
54
+ "prerelease": [
55
+ {
56
+ "author": "beachball",
57
+ "package": "@fluentui/react-tree",
58
+ "comment": "Bump @fluentui/react-avatar to v9.5.11",
59
+ "commit": "d2c95969c67521ea1df57e1339f8743b09b68772"
60
+ },
61
+ {
62
+ "author": "beachball",
63
+ "package": "@fluentui/react-tree",
64
+ "comment": "Bump @fluentui/react-button to v9.3.22",
65
+ "commit": "d2c95969c67521ea1df57e1339f8743b09b68772"
66
+ },
67
+ {
68
+ "author": "beachball",
69
+ "package": "@fluentui/react-tree",
70
+ "comment": "Bump @fluentui/react-portal to v9.3.1",
71
+ "commit": "d2c95969c67521ea1df57e1339f8743b09b68772"
72
+ },
73
+ {
74
+ "author": "beachball",
75
+ "package": "@fluentui/react-tree",
76
+ "comment": "Bump @fluentui/react-tabster to v9.10.0",
77
+ "commit": "d2c95969c67521ea1df57e1339f8743b09b68772"
78
+ }
79
+ ]
80
+ }
81
+ },
82
+ {
83
+ "date": "Mon, 03 Jul 2023 11:57:14 GMT",
6
84
  "tag": "@fluentui/react-tree_v9.0.0-beta.23",
7
85
  "version": "9.0.0-beta.23",
8
86
  "comments": {
@@ -11,55 +89,55 @@
11
89
  "author": "beachball",
12
90
  "package": "@fluentui/react-tree",
13
91
  "comment": "Bump @fluentui/react-aria to v9.3.26",
14
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
92
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
15
93
  },
16
94
  {
17
95
  "author": "beachball",
18
96
  "package": "@fluentui/react-tree",
19
97
  "comment": "Bump @fluentui/react-avatar to v9.5.10",
20
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
98
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
21
99
  },
22
100
  {
23
101
  "author": "beachball",
24
102
  "package": "@fluentui/react-tree",
25
103
  "comment": "Bump @fluentui/react-button to v9.3.21",
26
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
104
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
27
105
  },
28
106
  {
29
107
  "author": "beachball",
30
108
  "package": "@fluentui/react-tree",
31
109
  "comment": "Bump @fluentui/react-context-selector to v9.1.26",
32
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
110
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
33
111
  },
34
112
  {
35
113
  "author": "beachball",
36
114
  "package": "@fluentui/react-tree",
37
115
  "comment": "Bump @fluentui/react-portal to v9.3.0",
38
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
116
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
39
117
  },
40
118
  {
41
119
  "author": "beachball",
42
120
  "package": "@fluentui/react-tree",
43
121
  "comment": "Bump @fluentui/react-shared-contexts to v9.6.0",
44
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
122
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
45
123
  },
46
124
  {
47
125
  "author": "beachball",
48
126
  "package": "@fluentui/react-tree",
49
127
  "comment": "Bump @fluentui/react-tabster to v9.9.2",
50
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
128
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
51
129
  },
52
130
  {
53
131
  "author": "beachball",
54
132
  "package": "@fluentui/react-tree",
55
133
  "comment": "Bump @fluentui/react-utilities to v9.10.1",
56
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
134
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
57
135
  },
58
136
  {
59
137
  "author": "beachball",
60
138
  "package": "@fluentui/react-tree",
61
139
  "comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.10",
62
- "commit": "e7a838bfd1ce4b077d265295fcbef8dc2177e724"
140
+ "commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
63
141
  }
64
142
  ]
65
143
  }
package/CHANGELOG.md CHANGED
@@ -1,25 +1,51 @@
1
1
  # Change Log - @fluentui/react-tree
2
2
 
3
- This log was last generated on Mon, 03 Jul 2023 11:54:01 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 11 Jul 2023 18:44:11 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-beta.25](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.25)
8
+
9
+ Tue, 11 Jul 2023 18:44:11 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.24..@fluentui/react-tree_v9.0.0-beta.25)
11
+
12
+ ### Changes
13
+
14
+ - chore: move slots back to TreeItem and creates slot context ([PR #28492](https://github.com/microsoft/fluentui/pull/28492) by bernardo.sunderhus@gmail.com)
15
+ - chore: openItems property added to TreeOpenChangeData + minor internal improvements ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by bernardo.sunderhus@gmail.com)
16
+ - Bump @fluentui/react-avatar to v9.5.12 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
17
+ - Bump @fluentui/react-button to v9.3.23 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
18
+ - Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.11 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
19
+ - Bump @fluentui/react-conformance-griffel to v9.0.0 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
20
+
21
+ ## [9.0.0-beta.24](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.24)
22
+
23
+ Mon, 03 Jul 2023 13:34:28 GMT
24
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.23..@fluentui/react-tree_v9.0.0-beta.24)
25
+
26
+ ### Changes
27
+
28
+ - Bump @fluentui/react-avatar to v9.5.11 ([PR #28394](https://github.com/microsoft/fluentui/pull/28394) by beachball)
29
+ - Bump @fluentui/react-button to v9.3.22 ([PR #28394](https://github.com/microsoft/fluentui/pull/28394) by beachball)
30
+ - Bump @fluentui/react-portal to v9.3.1 ([PR #28394](https://github.com/microsoft/fluentui/pull/28394) by beachball)
31
+ - Bump @fluentui/react-tabster to v9.10.0 ([PR #28394](https://github.com/microsoft/fluentui/pull/28394) by beachball)
32
+
7
33
  ## [9.0.0-beta.23](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.23)
8
34
 
9
- Mon, 03 Jul 2023 11:54:01 GMT
35
+ Mon, 03 Jul 2023 11:57:14 GMT
10
36
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.22..@fluentui/react-tree_v9.0.0-beta.23)
11
37
 
12
38
  ### Changes
13
39
 
14
- - Bump @fluentui/react-aria to v9.3.26 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
15
- - Bump @fluentui/react-avatar to v9.5.10 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
16
- - Bump @fluentui/react-button to v9.3.21 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
17
- - Bump @fluentui/react-context-selector to v9.1.26 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
18
- - Bump @fluentui/react-portal to v9.3.0 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
19
- - Bump @fluentui/react-shared-contexts to v9.6.0 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
20
- - Bump @fluentui/react-tabster to v9.9.2 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
21
- - Bump @fluentui/react-utilities to v9.10.1 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
22
- - Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.10 ([PR #28399](https://github.com/microsoft/fluentui/pull/28399) by beachball)
40
+ - Bump @fluentui/react-aria to v9.3.26 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
41
+ - Bump @fluentui/react-avatar to v9.5.10 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
42
+ - Bump @fluentui/react-button to v9.3.21 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
43
+ - Bump @fluentui/react-context-selector to v9.1.26 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
44
+ - Bump @fluentui/react-portal to v9.3.0 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
45
+ - Bump @fluentui/react-shared-contexts to v9.6.0 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
46
+ - Bump @fluentui/react-tabster to v9.9.2 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
47
+ - Bump @fluentui/react-utilities to v9.10.1 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
48
+ - Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.10 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
23
49
 
24
50
  ## [9.0.0-beta.22](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.22)
25
51
 
package/dist/index.d.ts CHANGED
@@ -1,27 +1,38 @@
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
10
  import type { ComponentProps } from '@fluentui/react-utilities';
11
11
  import type { ComponentState } from '@fluentui/react-utilities';
12
12
  import { ContextSelector } from '@fluentui/react-context-selector';
13
- import { End } from '@fluentui/keyboard-keys';
14
- import { Enter } from '@fluentui/keyboard-keys';
13
+ import type { End } from '@fluentui/keyboard-keys';
14
+ import type { Enter } from '@fluentui/keyboard-keys';
15
15
  import type { ExtractSlotProps } from '@fluentui/react-utilities';
16
16
  import { FC } from 'react';
17
17
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
18
- import { Home } from '@fluentui/keyboard-keys';
18
+ import type { Home } from '@fluentui/keyboard-keys';
19
19
  import { Provider } from 'react';
20
20
  import { ProviderProps } from 'react';
21
21
  import * as React_2 from 'react';
22
22
  import type { Slot } from '@fluentui/react-utilities';
23
23
  import type { SlotClassNames } from '@fluentui/react-utilities';
24
24
 
25
+ /**
26
+ * properly creates an ImmutableSet instance from an iterable
27
+ */
28
+ declare function createImmutableSet<Value>(iterable?: Iterable<Value>): ImmutableSet<Value>;
29
+
30
+ /**
31
+ * Avoid using *dangerouslyCreateImmutableSet*, since this method will expose internally used set, use createImmutableSet instead,
32
+ * @param internalSet - a set that is used internally to store values.
33
+ */
34
+ declare function dangerouslyCreateImmutableSet<Value>(internalSet: Set<Value>): ImmutableSet<Value>;
35
+
25
36
  declare type FlattenedTreeItem<Props extends TreeItemProps> = FlatTreeItemProps & Props;
26
37
 
27
38
  /**
@@ -138,7 +149,7 @@ export declare type FlatTreeItem<Props extends FlatTreeItemProps = FlatTreeItemP
138
149
  getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Omit<Props, 'parentId'>;
139
150
  };
140
151
 
141
- export declare type FlatTreeItemProps = Omit<TreeItemProps, 'itemType'> & Partial<Pick<TreeItemProps, 'itemType'>> & {
152
+ export declare type FlatTreeItemProps = Omit<TreeItemProps, 'itemType' | 'value'> & Partial<Pick<TreeItemProps, 'itemType'>> & {
142
153
  value: TreeItemValue;
143
154
  parentValue?: TreeItemValue;
144
155
  };
@@ -147,7 +158,7 @@ declare type FlatTreeOptions = Pick<TreeProps, 'openItems' | 'defaultOpenItems'
147
158
 
148
159
  export declare type FlatTreeProps = Required<Pick<TreeProps, 'openItems' | 'onOpenChange' | 'onNavigation_unstable'>> & {
149
160
  ref: React_2.Ref<HTMLDivElement>;
150
- openItems: ImmutableSet<string>;
161
+ openItems: ImmutableSet<TreeItemValue>;
151
162
  };
152
163
 
153
164
  declare interface ImmutableSet<Value> {
@@ -174,9 +185,22 @@ declare interface ImmutableSet<Value> {
174
185
  has(value: Value): boolean;
175
186
  /** Iterates over values in the ImmutableSet. */
176
187
  [Symbol.iterator](): IterableIterator<Value>;
188
+ /**
189
+ * @internal
190
+ * Exposes the internal set used to store values.
191
+ * This is an internal API and should not be used directly.
192
+ */
193
+ dangerousGetInternalSet_unstable(): Set<Value>;
177
194
  }
178
195
 
196
+ declare const ImmutableSet: {
197
+ empty: ImmutableSet<never>;
198
+ create: typeof createImmutableSet;
199
+ dangerouslyCreate: typeof dangerouslyCreateImmutableSet;
200
+ };
201
+
179
202
  export declare type NestedTreeItem<Props extends TreeItemProps> = Omit<Props, 'subtree' | 'itemType'> & {
203
+ value: TreeItemValue;
180
204
  subtree?: NestedTreeItem<Props>[];
181
205
  };
182
206
 
@@ -215,7 +239,7 @@ export declare type TreeContextValue = {
215
239
  level: number;
216
240
  appearance: 'subtle' | 'subtle-alpha' | 'transparent';
217
241
  size: 'small' | 'medium';
218
- openItems: ImmutableSet<unknown>;
242
+ openItems: ImmutableSet<TreeItemValue>;
219
243
  /**
220
244
  * requests root Tree component to respond to some tree item event,
221
245
  */
@@ -240,13 +264,9 @@ declare type TreeContextValues = {
240
264
  */
241
265
  export declare const TreeItem: ForwardRefComponent<TreeItemProps>;
242
266
 
243
- export declare const treeItemClassNames: SlotClassNames<TreeItemSlots>;
267
+ export declare const treeItemClassNames: SlotClassNames<TreeItemInternalSlot>;
244
268
 
245
269
  declare type TreeItemContextValue = {
246
- isActionsVisible: boolean;
247
- isAsideVisible: boolean;
248
- actionsRef: React_2.Ref<HTMLDivElement>;
249
- expandIconRef: React_2.Ref<HTMLDivElement>;
250
270
  layoutRef: React_2.Ref<HTMLDivElement>;
251
271
  subtreeRef: React_2.Ref<HTMLDivElement>;
252
272
  itemType: TreeItemType;
@@ -256,12 +276,15 @@ declare type TreeItemContextValue = {
256
276
 
257
277
  declare type TreeItemContextValues = {
258
278
  treeItem: TreeItemContextValue;
279
+ treeItemSlots: TreeItemSlotsContextValue;
259
280
  };
260
281
 
261
282
  declare type TreeItemCSSProperties = React_2.CSSProperties & {
262
283
  [treeItemLevelToken]?: string | number;
263
284
  };
264
285
 
286
+ declare type TreeItemInternalSlot = Pick<TreeItemSlots, 'root'>;
287
+
265
288
  /**
266
289
  * The `TreeItemLayout` component is used as a child of `TreeItem` to define the content and layout of a tree item.
267
290
  * It provides a consistent visual structure for tree items in a `Tree` component.
@@ -269,7 +292,9 @@ declare type TreeItemCSSProperties = React_2.CSSProperties & {
269
292
  */
270
293
  export declare const TreeItemLayout: ForwardRefComponent<TreeItemLayoutProps>;
271
294
 
272
- export declare const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutSlots>;
295
+ export declare const treeItemLayoutClassNames: SlotClassNames<TreeItemLayoutInternalSlots>;
296
+
297
+ declare type TreeItemLayoutInternalSlots = TreeItemLayoutSlots & Pick<TreeItemSlots, 'actions' | 'aside' | 'expandIcon'>;
273
298
 
274
299
  /**
275
300
  * TreeItemLayout Props
@@ -290,28 +315,12 @@ export declare type TreeItemLayoutSlots = {
290
315
  * Icon slot that renders right after main content
291
316
  */
292
317
  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
318
  };
310
319
 
311
320
  /**
312
321
  * State used in rendering TreeItemLayout
313
322
  */
314
- export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots> & {
323
+ export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutInternalSlots> & {
315
324
  buttonContextValue: ButtonContextValue;
316
325
  };
317
326
 
@@ -324,18 +333,20 @@ export declare const treeItemLevelToken: "--fluent-TreeItem--level";
324
333
  */
325
334
  export declare const TreeItemPersonaLayout: ForwardRefComponent<TreeItemPersonaLayoutProps>;
326
335
 
327
- export declare const treeItemPersonaLayoutClassNames: SlotClassNames<TreeItemPersonaLayoutSlots>;
336
+ export declare const treeItemPersonaLayoutClassNames: SlotClassNames<TreeItemPersonaLayoutInternalSlots>;
328
337
 
329
338
  declare type TreeItemPersonaLayoutContextValues = {
330
339
  avatar: AvatarContextValue;
331
340
  };
332
341
 
342
+ declare type TreeItemPersonaLayoutInternalSlots = TreeItemPersonaLayoutSlots & Pick<TreeItemSlots, 'actions' | 'aside' | 'expandIcon'>;
343
+
333
344
  /**
334
345
  * TreeItemPersonaLayout Props
335
346
  */
336
347
  export declare type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;
337
348
 
338
- export declare type TreeItemPersonaLayoutSlots = Pick<TreeItemLayoutSlots, 'actions' | 'aside' | 'expandIcon'> & {
349
+ export declare type TreeItemPersonaLayoutSlots = {
339
350
  root: NonNullable<Slot<'div'>>;
340
351
  /**
341
352
  * Avatar to display.
@@ -354,7 +365,7 @@ export declare type TreeItemPersonaLayoutSlots = Pick<TreeItemLayoutSlots, 'acti
354
365
  /**
355
366
  * State used in rendering TreeItemPersonaLayout
356
367
  */
357
- export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> & {
368
+ export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutInternalSlots> & {
358
369
  avatarSize: AvatarSize;
359
370
  buttonContextValue: ButtonContextValue;
360
371
  };
@@ -371,29 +382,47 @@ export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | u
371
382
 
372
383
  declare type TreeItemRequest = {
373
384
  itemType: TreeItemType;
374
- } & (OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'target'> | OmitWithoutExpanding<TreeNavigationData_unstable, 'target'>);
385
+ } & (OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'openItems'> | TreeNavigationData_unstable);
375
386
 
376
387
  export declare type TreeItemSlots = {
377
388
  root: Slot<ExtractSlotProps<Slot<'div'> & {
378
389
  style?: TreeItemCSSProperties;
379
390
  }>>;
391
+ /**
392
+ * Expand icon slot,
393
+ * by default renders a chevron icon to indicate opening and closing
394
+ */
395
+ expandIcon?: Slot<'div'>;
396
+ aside?: Slot<'div'>;
397
+ /**
398
+ * actionable elements are normally buttons, menus, or other focusable elements.
399
+ * Those elements are only visibly available if the given tree item is currently active.
400
+ */
401
+ actions?: Slot<ExtractSlotProps<Slot<'div'> & {
402
+ /**
403
+ * Forces visibility of the aside/action content
404
+ */
405
+ visible?: boolean;
406
+ }>>;
380
407
  };
381
408
 
409
+ declare type TreeItemSlotsContextValue = Pick<TreeItemSlots, 'actions' | 'aside' | 'expandIcon'>;
410
+
382
411
  /**
383
412
  * State used in rendering TreeItem
384
413
  */
385
- export declare type TreeItemState = ComponentState<TreeItemSlots> & TreeItemContextValue & {
414
+ export declare type TreeItemState = ComponentState<TreeItemInternalSlot> & TreeItemContextValue & TreeItemSlotsContextValue & {
386
415
  level: number;
387
416
  itemType: TreeItemType;
388
417
  };
389
418
 
390
419
  declare type TreeItemType = 'leaf' | 'branch';
391
420
 
392
- declare type TreeItemValue = string | number;
421
+ export declare type TreeItemValue = string | number;
393
422
 
394
423
  export declare type TreeNavigationData_unstable = {
395
424
  target: HTMLElement;
396
- value: string;
425
+ value: TreeItemValue;
397
426
  } & ({
398
427
  event: React_2.MouseEvent<HTMLElement>;
399
428
  type: 'Click';
@@ -424,26 +453,23 @@ export declare type TreeNavigationEvent_unstable = TreeNavigationData_unstable['
424
453
 
425
454
  export declare type TreeOpenChangeData = {
426
455
  open: boolean;
427
- value: string;
456
+ value: TreeItemValue;
457
+ target: HTMLElement;
458
+ openItems: ImmutableSet<TreeItemValue>;
428
459
  } & ({
429
460
  event: React_2.MouseEvent<HTMLElement>;
430
- target: HTMLElement;
431
461
  type: 'ExpandIconClick';
432
462
  } | {
433
463
  event: React_2.MouseEvent<HTMLElement>;
434
- target: HTMLElement;
435
464
  type: 'Click';
436
465
  } | {
437
466
  event: React_2.KeyboardEvent<HTMLElement>;
438
- target: HTMLElement;
439
467
  type: typeof Enter;
440
468
  } | {
441
469
  event: React_2.KeyboardEvent<HTMLElement>;
442
- target: HTMLElement;
443
470
  type: typeof ArrowRight;
444
471
  } | {
445
472
  event: React_2.KeyboardEvent<HTMLElement>;
446
- target: HTMLElement;
447
473
  type: typeof ArrowLeft;
448
474
  });
449
475
 
@@ -468,13 +494,13 @@ export declare type TreeProps = ComponentProps<TreeSlots> & {
468
494
  * Controls the state of the open tree items.
469
495
  * These property is ignored for subtrees.
470
496
  */
471
- openItems?: Iterable<string>;
497
+ openItems?: Iterable<TreeItemValue>;
472
498
  /**
473
499
  * This refers to a list of ids of opened tree items.
474
500
  * Default value for the uncontrolled state of open tree items.
475
501
  * These property is ignored for subtrees.
476
502
  */
477
- defaultOpenItems?: Iterable<string>;
503
+ defaultOpenItems?: Iterable<TreeItemValue>;
478
504
  /**
479
505
  * Callback fired when the component changes value from open state.
480
506
  * These property is ignored for subtrees.
@@ -551,7 +577,7 @@ export declare function useTreeItem_unstable(props: TreeItemProps, ref: React_2.
551
577
 
552
578
  export declare const useTreeItemContext_unstable: <T>(selector: ContextSelector<TreeItemContextValue, T>) => T;
553
579
 
554
- export declare function useTreeItemContextValues_unstable(state: Pick<TreeItemState, keyof TreeItemContextValue>): TreeItemContextValues;
580
+ export declare function useTreeItemContextValues_unstable(state: TreeItemState): TreeItemContextValues;
555
581
 
556
582
  /**
557
583
  * Create the state required to render TreeItemLayout.
@@ -1 +1 @@
1
- import * as React from 'react';
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: string } & (\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 = { open: boolean; value: string } & (\n | {\n event: React.MouseEvent<HTMLElement>;\n target: HTMLElement;\n type: 'ExpandIconClick';\n }\n | {\n event: React.MouseEvent<HTMLElement>;\n target: HTMLElement;\n type: 'Click';\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof Enter;\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof ArrowRight;\n }\n | {\n event: React.KeyboardEvent<HTMLElement>;\n target: HTMLElement;\n type: typeof ArrowLeft;\n }\n);\n\nexport type TreeOpenChangeEvent = TreeOpenChangeData['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<string>;\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<string>;\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/**\n * State used in rendering Tree\n */\nexport type TreeState = ComponentState<TreeSlots> &\n TreeContextValue & {\n open: boolean;\n };\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["Tree.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { ComponentProps, ComponentState, 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 { ImmutableSet } from '../../utils/ImmutableSet';\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 openItems: ImmutableSet<TreeItemValue>;\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 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/**\n * State used in rendering Tree\n */\nexport type TreeState = ComponentState<TreeSlots> &\n TreeContextValue & {\n open: boolean;\n };\n"],"names":[],"mappings":"AAAA,WAoGI"}