@fluentui/react-tree 9.0.0-beta.20 → 9.0.0-beta.21

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 (105) hide show
  1. package/CHANGELOG.json +54 -9
  2. package/CHANGELOG.md +24 -10
  3. package/dist/index.d.ts +64 -147
  4. package/lib/components/Tree/Tree.js.map +1 -1
  5. package/lib/components/Tree/Tree.types.js.map +1 -1
  6. package/lib/components/Tree/useRootTree.js +1 -1
  7. package/lib/components/Tree/useRootTree.js.map +1 -1
  8. package/lib/components/TreeItem/TreeItem.js.map +1 -1
  9. package/lib/components/TreeItem/TreeItem.types.js.map +1 -1
  10. package/lib/components/TreeItem/useTreeItem.js +8 -6
  11. package/lib/components/TreeItem/useTreeItem.js.map +1 -1
  12. package/lib/components/TreeItem/useTreeItemStyles.styles.js +3 -5
  13. package/lib/components/TreeItem/useTreeItemStyles.styles.js.map +1 -1
  14. package/lib/components/TreeItemLayout/TreeItemLayout.types.js.map +1 -1
  15. package/lib/components/TreeItemLayout/renderTreeItemLayout.js +4 -1
  16. package/lib/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
  17. package/lib/components/TreeItemLayout/useTreeItemLayout.js +22 -2
  18. package/lib/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
  19. package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js +75 -22
  20. package/lib/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js.map +1 -1
  21. package/lib/components/TreeItemPersonaLayout/TreeItemPersonaLayout.types.js.map +1 -1
  22. package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +4 -1
  23. package/lib/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
  24. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +4 -6
  25. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
  26. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js +96 -26
  27. package/lib/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -1
  28. package/lib/contexts/treeContext.js.map +1 -1
  29. package/lib/contexts/treeItemContext.js +1 -1
  30. package/lib/contexts/treeItemContext.js.map +1 -1
  31. package/lib/hooks/useFlatTree.js +11 -2
  32. package/lib/hooks/useFlatTree.js.map +1 -1
  33. package/lib/hooks/useFlatTreeNavigation.js +8 -5
  34. package/lib/hooks/useFlatTreeNavigation.js.map +1 -1
  35. package/lib/hooks/useNestedTreeNavigation.js.map +1 -1
  36. package/lib/hooks/useOpenItemsState.js +3 -0
  37. package/lib/hooks/useOpenItemsState.js.map +1 -1
  38. package/lib/index.js +0 -1
  39. package/lib/index.js.map +1 -1
  40. package/lib/utils/createFlatTreeItems.js +4 -11
  41. package/lib/utils/createFlatTreeItems.js.map +1 -1
  42. package/lib/utils/flattenTree.js.map +1 -1
  43. package/lib/utils/getTreeItemValueFromElement.js +4 -0
  44. package/lib/utils/getTreeItemValueFromElement.js.map +1 -0
  45. package/lib-commonjs/components/Tree/useRootTree.js +1 -1
  46. package/lib-commonjs/components/Tree/useRootTree.js.map +1 -1
  47. package/lib-commonjs/components/TreeItem/useTreeItem.js +8 -6
  48. package/lib-commonjs/components/TreeItem/useTreeItem.js.map +1 -1
  49. package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.js +4 -8
  50. package/lib-commonjs/components/TreeItem/useTreeItemStyles.styles.js.map +1 -1
  51. package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js +4 -1
  52. package/lib-commonjs/components/TreeItemLayout/renderTreeItemLayout.js.map +1 -1
  53. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js +21 -2
  54. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayout.js.map +1 -1
  55. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js +127 -27
  56. package/lib-commonjs/components/TreeItemLayout/useTreeItemLayoutStyles.styles.js.map +1 -1
  57. package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js +4 -1
  58. package/lib-commonjs/components/TreeItemPersonaLayout/renderTreeItemPersonaLayout.js.map +1 -1
  59. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js +4 -6
  60. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayout.js.map +1 -1
  61. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js +176 -31
  62. package/lib-commonjs/components/TreeItemPersonaLayout/useTreeItemPersonaLayoutStyles.styles.js.map +1 -1
  63. package/lib-commonjs/contexts/treeItemContext.js +1 -1
  64. package/lib-commonjs/contexts/treeItemContext.js.map +1 -1
  65. package/lib-commonjs/hooks/useFlatTree.js +10 -1
  66. package/lib-commonjs/hooks/useFlatTree.js.map +1 -1
  67. package/lib-commonjs/hooks/useFlatTreeNavigation.js +8 -5
  68. package/lib-commonjs/hooks/useFlatTreeNavigation.js.map +1 -1
  69. package/lib-commonjs/hooks/useOpenItemsState.js +3 -0
  70. package/lib-commonjs/hooks/useOpenItemsState.js.map +1 -1
  71. package/lib-commonjs/index.js +0 -6
  72. package/lib-commonjs/index.js.map +1 -1
  73. package/lib-commonjs/utils/createFlatTreeItems.js +8 -13
  74. package/lib-commonjs/utils/createFlatTreeItems.js.map +1 -1
  75. package/lib-commonjs/utils/getTreeItemValueFromElement.js +18 -0
  76. package/lib-commonjs/utils/getTreeItemValueFromElement.js.map +1 -0
  77. package/package.json +5 -5
  78. package/lib/TreeItemAside.js +0 -1
  79. package/lib/TreeItemAside.js.map +0 -1
  80. package/lib/components/TreeItemAside/TreeItemAside.js +0 -13
  81. package/lib/components/TreeItemAside/TreeItemAside.js.map +0 -1
  82. package/lib/components/TreeItemAside/TreeItemAside.types.js +0 -1
  83. package/lib/components/TreeItemAside/TreeItemAside.types.js.map +0 -1
  84. package/lib/components/TreeItemAside/index.js +0 -5
  85. package/lib/components/TreeItemAside/index.js.map +0 -1
  86. package/lib/components/TreeItemAside/renderTreeItemAside.js +0 -14
  87. package/lib/components/TreeItemAside/renderTreeItemAside.js.map +0 -1
  88. package/lib/components/TreeItemAside/useTreeItemAside.js +0 -30
  89. package/lib/components/TreeItemAside/useTreeItemAside.js.map +0 -1
  90. package/lib/components/TreeItemAside/useTreeItemAsideStyles.styles.js +0 -47
  91. package/lib/components/TreeItemAside/useTreeItemAsideStyles.styles.js.map +0 -1
  92. package/lib-commonjs/TreeItemAside.js +0 -6
  93. package/lib-commonjs/TreeItemAside.js.map +0 -1
  94. package/lib-commonjs/components/TreeItemAside/TreeItemAside.js +0 -19
  95. package/lib-commonjs/components/TreeItemAside/TreeItemAside.js.map +0 -1
  96. package/lib-commonjs/components/TreeItemAside/TreeItemAside.types.js +0 -4
  97. package/lib-commonjs/components/TreeItemAside/TreeItemAside.types.js.map +0 -1
  98. package/lib-commonjs/components/TreeItemAside/index.js +0 -10
  99. package/lib-commonjs/components/TreeItemAside/index.js.map +0 -1
  100. package/lib-commonjs/components/TreeItemAside/renderTreeItemAside.js +0 -20
  101. package/lib-commonjs/components/TreeItemAside/renderTreeItemAside.js.map +0 -1
  102. package/lib-commonjs/components/TreeItemAside/useTreeItemAside.js +0 -31
  103. package/lib-commonjs/components/TreeItemAside/useTreeItemAside.js.map +0 -1
  104. package/lib-commonjs/components/TreeItemAside/useTreeItemAsideStyles.styles.js +0 -90
  105. package/lib-commonjs/components/TreeItemAside/useTreeItemAsideStyles.styles.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,52 @@
2
2
  "name": "@fluentui/react-tree",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 26 Jun 2023 09:51:06 GMT",
5
+ "date": "Tue, 27 Jun 2023 11:19:43 GMT",
6
+ "tag": "@fluentui/react-tree_v9.0.0-beta.21",
7
+ "version": "9.0.0-beta.21",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "bernardo.sunderhus@gmail.com",
12
+ "package": "@fluentui/react-tree",
13
+ "commit": "90acd97916fbb771d436062cad6a3f85be974e39",
14
+ "comment": "bugfix: makes value property on TreeItem less generic to simplify internals"
15
+ },
16
+ {
17
+ "author": "bernardo.sunderhus@gmail.com",
18
+ "package": "@fluentui/react-tree",
19
+ "commit": "56143ef533ed77608a3590e81b1d6fb3bca1357c",
20
+ "comment": "bugfix: rollback to actions and aside as a slot to ensure positioning of internals"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-tree",
25
+ "comment": "Bump @fluentui/react-avatar to v9.5.8",
26
+ "commit": "1c7e6451a11fb9c59e344df616394a320e8031c4"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-tree",
31
+ "comment": "Bump @fluentui/react-button to v9.3.19",
32
+ "commit": "1c7e6451a11fb9c59e344df616394a320e8031c4"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-tree",
37
+ "comment": "Bump @fluentui/react-portal to v9.2.15",
38
+ "commit": "1c7e6451a11fb9c59e344df616394a320e8031c4"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-tree",
43
+ "comment": "Bump @fluentui/react-tabster to v9.9.0",
44
+ "commit": "1c7e6451a11fb9c59e344df616394a320e8031c4"
45
+ }
46
+ ]
47
+ }
48
+ },
49
+ {
50
+ "date": "Mon, 26 Jun 2023 09:53:55 GMT",
6
51
  "tag": "@fluentui/react-tree_v9.0.0-beta.20",
7
52
  "version": "9.0.0-beta.20",
8
53
  "comments": {
@@ -11,49 +56,49 @@
11
56
  "author": "beachball",
12
57
  "package": "@fluentui/react-tree",
13
58
  "comment": "Bump @fluentui/react-aria to v9.3.24",
14
- "commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
59
+ "commit": "3e47257676ace0598b9ed336a54befd4d063c332"
15
60
  },
16
61
  {
17
62
  "author": "beachball",
18
63
  "package": "@fluentui/react-tree",
19
64
  "comment": "Bump @fluentui/react-avatar to v9.5.7",
20
- "commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
65
+ "commit": "3e47257676ace0598b9ed336a54befd4d063c332"
21
66
  },
22
67
  {
23
68
  "author": "beachball",
24
69
  "package": "@fluentui/react-tree",
25
70
  "comment": "Bump @fluentui/react-button to v9.3.18",
26
- "commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
71
+ "commit": "3e47257676ace0598b9ed336a54befd4d063c332"
27
72
  },
28
73
  {
29
74
  "author": "beachball",
30
75
  "package": "@fluentui/react-tree",
31
76
  "comment": "Bump @fluentui/react-context-selector to v9.1.24",
32
- "commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
77
+ "commit": "3e47257676ace0598b9ed336a54befd4d063c332"
33
78
  },
34
79
  {
35
80
  "author": "beachball",
36
81
  "package": "@fluentui/react-tree",
37
82
  "comment": "Bump @fluentui/react-portal to v9.2.14",
38
- "commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
83
+ "commit": "3e47257676ace0598b9ed336a54befd4d063c332"
39
84
  },
40
85
  {
41
86
  "author": "beachball",
42
87
  "package": "@fluentui/react-tree",
43
88
  "comment": "Bump @fluentui/react-tabster to v9.8.1",
44
- "commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
89
+ "commit": "3e47257676ace0598b9ed336a54befd4d063c332"
45
90
  },
46
91
  {
47
92
  "author": "beachball",
48
93
  "package": "@fluentui/react-tree",
49
94
  "comment": "Bump @fluentui/react-utilities to v9.9.4",
50
- "commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
95
+ "commit": "3e47257676ace0598b9ed336a54befd4d063c332"
51
96
  },
52
97
  {
53
98
  "author": "beachball",
54
99
  "package": "@fluentui/react-tree",
55
100
  "comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.8",
56
- "commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
101
+ "commit": "3e47257676ace0598b9ed336a54befd4d063c332"
57
102
  }
58
103
  ]
59
104
  }
package/CHANGELOG.md CHANGED
@@ -1,24 +1,38 @@
1
1
  # Change Log - @fluentui/react-tree
2
2
 
3
- This log was last generated on Mon, 26 Jun 2023 09:51:06 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 27 Jun 2023 11:19:43 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.0-beta.21](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.21)
8
+
9
+ Tue, 27 Jun 2023 11:19:43 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.20..@fluentui/react-tree_v9.0.0-beta.21)
11
+
12
+ ### Changes
13
+
14
+ - bugfix: makes value property on TreeItem less generic to simplify internals ([PR #28257](https://github.com/microsoft/fluentui/pull/28257) by bernardo.sunderhus@gmail.com)
15
+ - bugfix: rollback to actions and aside as a slot to ensure positioning of internals ([PR #28318](https://github.com/microsoft/fluentui/pull/28318) by bernardo.sunderhus@gmail.com)
16
+ - Bump @fluentui/react-avatar to v9.5.8 ([PR #28291](https://github.com/microsoft/fluentui/pull/28291) by beachball)
17
+ - Bump @fluentui/react-button to v9.3.19 ([PR #28291](https://github.com/microsoft/fluentui/pull/28291) by beachball)
18
+ - Bump @fluentui/react-portal to v9.2.15 ([PR #28291](https://github.com/microsoft/fluentui/pull/28291) by beachball)
19
+ - Bump @fluentui/react-tabster to v9.9.0 ([PR #28291](https://github.com/microsoft/fluentui/pull/28291) by beachball)
20
+
7
21
  ## [9.0.0-beta.20](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.20)
8
22
 
9
- Mon, 26 Jun 2023 09:51:06 GMT
23
+ Mon, 26 Jun 2023 09:53:55 GMT
10
24
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tree_v9.0.0-beta.19..@fluentui/react-tree_v9.0.0-beta.20)
11
25
 
12
26
  ### Changes
13
27
 
14
- - Bump @fluentui/react-aria to v9.3.24 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
15
- - Bump @fluentui/react-avatar to v9.5.7 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
16
- - Bump @fluentui/react-button to v9.3.18 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
17
- - Bump @fluentui/react-context-selector to v9.1.24 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
18
- - Bump @fluentui/react-portal to v9.2.14 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
19
- - Bump @fluentui/react-tabster to v9.8.1 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
20
- - Bump @fluentui/react-utilities to v9.9.4 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
21
- - Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.8 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
28
+ - Bump @fluentui/react-aria to v9.3.24 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
29
+ - Bump @fluentui/react-avatar to v9.5.7 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
30
+ - Bump @fluentui/react-button to v9.3.18 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
31
+ - Bump @fluentui/react-context-selector to v9.1.24 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
32
+ - Bump @fluentui/react-portal to v9.2.14 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
33
+ - Bump @fluentui/react-tabster to v9.8.1 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
34
+ - Bump @fluentui/react-utilities to v9.9.4 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
35
+ - Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.8 ([PR #28296](https://github.com/microsoft/fluentui/pull/28296) by beachball)
22
36
 
23
37
  ## [9.0.0-beta.19](https://github.com/microsoft/fluentui/tree/@fluentui/react-tree_v9.0.0-beta.19)
24
38
 
package/dist/index.d.ts CHANGED
@@ -21,9 +21,8 @@ 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
- import { SlotRenderFunction } from '@fluentui/react-utilities';
25
24
 
26
- declare type FlattenedTreeItem<Props extends TreeItemProps<unknown>> = FlatTreeItemProps<NonNullable<Props['value']>> & Props;
25
+ declare type FlattenedTreeItem<Props extends TreeItemProps> = FlatTreeItemProps & Props;
27
26
 
28
27
  /**
29
28
  * Converts a nested structure to a flat one which can be consumed by `useFlatTreeItems`
@@ -65,7 +64,7 @@ declare type FlattenedTreeItem<Props extends TreeItemProps<unknown>> = FlatTreeI
65
64
  * ]);
66
65
  * ```
67
66
  */
68
- export declare const flattenTree_unstable: <Props extends TreeItemProps<unknown>>(items: NestedTreeItem<Props>[]) => FlattenedTreeItem<Props>[];
67
+ export declare const flattenTree_unstable: <Props extends TreeItemProps>(items: NestedTreeItem<Props>[]) => FlattenedTreeItem<Props>[];
69
68
 
70
69
  /**
71
70
  * FlatTree API to manage all required mechanisms to convert a list of items into renderable TreeItems
@@ -77,13 +76,13 @@ export declare const flattenTree_unstable: <Props extends TreeItemProps<unknown>
77
76
  *
78
77
  * On simple scenarios it is advised to simply use a nested structure instead.
79
78
  */
80
- export declare type FlatTree<Props extends FlatTreeItemProps<unknown> = FlatTreeItemProps> = {
79
+ export declare type FlatTree<Props extends FlatTreeItemProps = FlatTreeItemProps> = {
81
80
  /**
82
81
  * returns the properties required for the Tree component to work properly.
83
82
  * That includes:
84
83
  * `openItems`, `onOpenChange`, `onNavigation_unstable` and `ref`
85
84
  */
86
- getTreeProps(): FlatTreeProps<Props['value']>;
85
+ getTreeProps(): FlatTreeProps;
87
86
  /**
88
87
  * internal method used to react to an `onNavigation` event.
89
88
  * This method ensures proper navigation on keyboard and mouse interaction.
@@ -97,7 +96,7 @@ export declare type FlatTree<Props extends FlatTreeItemProps<unknown> = FlatTree
97
96
  * event.preventDefault();
98
97
  * const nextItem = tree.getNextNavigableItem(data);
99
98
  * // scroll to item using virtualization scroll mechanism
100
- * if (nextItem && document.getElementById(nextItem.id)) {
99
+ * if (nextItem && tree.getElementFromItem(nextItem)) {
101
100
  * listRef.current.scrollToItem(nextItem.index);
102
101
  * }
103
102
  * // wait for scrolling to happen and then invoke navigate method
@@ -107,7 +106,7 @@ export declare type FlatTree<Props extends FlatTreeItemProps<unknown> = FlatTree
107
106
  * };
108
107
  *```
109
108
  */
110
- navigate(data: TreeNavigationData_unstable<Props['value']>): void;
109
+ navigate(data: TreeNavigationData_unstable): void;
111
110
  /**
112
111
  * returns next item to be focused on a navigation.
113
112
  * This method is provided to decouple the element that needs to be focused from
@@ -115,7 +114,11 @@ export declare type FlatTree<Props extends FlatTreeItemProps<unknown> = FlatTree
115
114
  *
116
115
  * On the case of TypeAhead navigation this method returns the current item.
117
116
  */
118
- getNextNavigableItem(visibleItems: FlatTreeItem<Props>[], data: TreeNavigationData_unstable<Props['value']>): FlatTreeItem<Props> | undefined;
117
+ getNextNavigableItem(visibleItems: FlatTreeItem<Props>[], data: TreeNavigationData_unstable): FlatTreeItem<Props> | undefined;
118
+ /**
119
+ * similar to getElementById but for FlatTreeItems
120
+ */
121
+ getElementFromItem(item: FlatTreeItem<Props>): HTMLElement | null;
119
122
  /**
120
123
  * an iterable containing all visually available flat tree items
121
124
  */
@@ -126,31 +129,25 @@ export declare type FlatTree<Props extends FlatTreeItemProps<unknown> = FlatTree
126
129
  * The item that is returned by `useFlatTree`, it represents a wrapper around the properties provided to
127
130
  * `useFlatTree` but with extra information that might be useful on flat tree scenarios
128
131
  */
129
- export declare type FlatTreeItem<Props extends FlatTreeItemProps<unknown> = FlatTreeItemProps> = {
132
+ export declare type FlatTreeItem<Props extends FlatTreeItemProps = FlatTreeItemProps> = {
130
133
  index: number;
131
134
  level: number;
132
135
  childrenSize: number;
133
- value: Props['value'];
134
- parentValue: Props['parentValue'];
135
- /**
136
- * A reference to the element that will render the `TreeItem`,
137
- * this is necessary for nodes with parents (to ensure child to parent navigation),
138
- * if a node has no parent then this reference will be null.
139
- */
140
- ref: React_2.RefObject<HTMLDivElement>;
141
- getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Omit<Props, 'parentValue'>;
136
+ value: TreeItemValue;
137
+ parentValue: TreeItemValue | undefined;
138
+ getTreeItemProps(): Required<Pick<Props, 'value' | 'aria-setsize' | 'aria-level' | 'aria-posinset' | 'itemType'>> & Omit<Props, 'parentId'>;
142
139
  };
143
140
 
144
- export declare type FlatTreeItemProps<Value = string> = Omit<TreeItemProps<Value>, 'itemType'> & Partial<Pick<TreeItemProps<Value>, 'itemType'>> & {
145
- value: Value;
146
- parentValue?: Value;
141
+ export declare type FlatTreeItemProps = Omit<TreeItemProps, 'itemType'> & Partial<Pick<TreeItemProps, 'itemType'>> & {
142
+ value: TreeItemValue;
143
+ parentValue?: TreeItemValue;
147
144
  };
148
145
 
149
- declare type FlatTreeOptions<Props extends FlatTreeItemProps<unknown> = FlatTreeItemProps> = Pick<TreeProps<Props['value']>, 'openItems' | 'defaultOpenItems' | 'onOpenChange' | 'onNavigation_unstable'>;
146
+ declare type FlatTreeOptions = Pick<TreeProps, 'openItems' | 'defaultOpenItems' | 'onOpenChange' | 'onNavigation_unstable'>;
150
147
 
151
- export declare type FlatTreeProps<Value = string> = Required<Pick<TreeProps<Value>, 'openItems' | 'onOpenChange' | 'onNavigation_unstable'>> & {
148
+ export declare type FlatTreeProps = Required<Pick<TreeProps, 'openItems' | 'onOpenChange' | 'onNavigation_unstable'>> & {
152
149
  ref: React_2.Ref<HTMLDivElement>;
153
- openItems: ImmutableSet<Value>;
150
+ openItems: ImmutableSet<string>;
154
151
  };
155
152
 
156
153
  declare interface ImmutableSet<Value> {
@@ -179,7 +176,7 @@ declare interface ImmutableSet<Value> {
179
176
  [Symbol.iterator](): IterableIterator<Value>;
180
177
  }
181
178
 
182
- export declare type NestedTreeItem<Props extends TreeItemProps<unknown>> = Omit<Props, 'subtree' | 'itemType'> & {
179
+ export declare type NestedTreeItem<Props extends TreeItemProps> = Omit<Props, 'subtree' | 'itemType'> & {
183
180
  subtree?: NestedTreeItem<Props>[];
184
181
  };
185
182
 
@@ -192,11 +189,6 @@ export declare const renderTree_unstable: (state: TreeState, contextValues: Tree
192
189
  */
193
190
  export declare const renderTreeItem_unstable: (state: TreeItemState, contextValues: TreeItemContextValues) => JSX.Element;
194
191
 
195
- /**
196
- * Render the final JSX of TreeItemAside
197
- */
198
- export declare const renderTreeItemAside_unstable: (state: TreeItemAsideState) => JSX.Element | null;
199
-
200
192
  /**
201
193
  * Render the final JSX of TreeItemLayout
202
194
  */
@@ -215,22 +207,7 @@ export declare const renderTreeItemPersonaLayout_unstable: (state: TreeItemPerso
215
207
  * an item representing a folder can be expanded to reveal the contents of the folder,
216
208
  * which may be files, folders, or both.
217
209
  */
218
- export declare const Tree: React_2.ForwardRefExoticComponent<Omit<TreeSlots, "root"> & Omit<{
219
- as?: "div" | undefined;
220
- } & Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
221
- ref?: ((instance: HTMLDivElement | null) => void) | React_2.RefObject<HTMLDivElement> | null | undefined;
222
- } & {
223
- children?: React_2.ReactNode | SlotRenderFunction<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
224
- ref?: ((instance: HTMLDivElement | null) => void) | React_2.RefObject<HTMLDivElement> | null | undefined;
225
- }>;
226
- }, "ref"> & {
227
- appearance?: "transparent" | "subtle" | "subtle-alpha" | undefined;
228
- size?: "small" | "medium" | undefined;
229
- openItems?: Iterable<string> | undefined;
230
- defaultOpenItems?: Iterable<string> | undefined;
231
- onOpenChange?(event: React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement, MouseEvent>, data: TreeOpenChangeData<string>): void;
232
- onNavigation_unstable?(event: React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement, MouseEvent>, data: TreeNavigationData_unstable<string>): void;
233
- } & React_2.RefAttributes<HTMLDivElement>> & (<Value = string>(props: TreeProps<Value>) => JSX.Element);
210
+ export declare const Tree: ForwardRefComponent<TreeProps>;
234
211
 
235
212
  export declare const treeClassNames: SlotClassNames<TreeSlots>;
236
213
 
@@ -242,7 +219,7 @@ export declare type TreeContextValue = {
242
219
  /**
243
220
  * requests root Tree component to respond to some tree item event,
244
221
  */
245
- requestTreeResponse(request: TreeItemRequest<unknown>): void;
222
+ requestTreeResponse(request: TreeItemRequest): void;
246
223
  };
247
224
 
248
225
  declare type TreeContextValues = {
@@ -261,58 +238,7 @@ declare type TreeContextValues = {
261
238
  * When a TreeItem has nested child subtree, an expand/collapse control is displayed,
262
239
  * allowing the user to show or hide the children.
263
240
  */
264
- export declare const TreeItem: React_2.ForwardRefExoticComponent<Omit<Partial<TreeItemSlots>, "root"> & Omit<{
265
- as?: "div" | undefined;
266
- } & Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
267
- ref?: ((instance: HTMLDivElement | null) => void) | React_2.RefObject<HTMLDivElement> | null | undefined;
268
- } & {
269
- children?: React_2.ReactNode | SlotRenderFunction<Pick<React_2.DetailedHTMLProps<React_2.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React_2.HTMLAttributes<HTMLDivElement>> & {
270
- ref?: ((instance: HTMLDivElement | null) => void) | React_2.RefObject<HTMLDivElement> | null | undefined;
271
- }>;
272
- } & {
273
- style?: TreeItemCSSProperties | undefined;
274
- }, "ref"> & {
275
- value?: string | undefined;
276
- itemType: TreeItemType;
277
- } & React_2.RefAttributes<HTMLDivElement>> & (<Value = string>(props: TreeItemProps<Value>) => JSX.Element);
278
-
279
- /**
280
- * TreeItemAside component - represents a custom set of actionable elements that will be visible when a certain
281
- * `TreeItem` is currently "active".
282
- */
283
- export declare const TreeItemAside: ForwardRefComponent<TreeItemAsideProps>;
284
-
285
- export declare const treeItemAsideClassNames: SlotClassNames<TreeItemAsideSlots>;
286
-
287
- /**
288
- * TreeItemAside Props
289
- */
290
- export declare type TreeItemAsideProps = ComponentProps<TreeItemAsideSlots> & {
291
- /**
292
- * boolean indicating if the aside content should behave as "actions"
293
- *
294
- * actionable elements are normally buttons, menus, or other focusable elements.
295
- * Those elements are only visibly available if the given tree item is currently active.
296
- */
297
- actions?: boolean;
298
- /**
299
- * Forces visibility of the aside content, even if they're actions
300
- */
301
- visible?: true;
302
- };
303
-
304
- export declare type TreeItemAsideSlots = {
305
- root: Slot<'div'>;
306
- };
307
-
308
- /**
309
- * State used in rendering TreeItemAside
310
- */
311
- export declare type TreeItemAsideState = ComponentState<TreeItemAsideSlots> & {
312
- actions: boolean;
313
- visible: boolean;
314
- buttonContextValue: ButtonContextValue;
315
- };
241
+ export declare const TreeItem: ForwardRefComponent<TreeItemProps>;
316
242
 
317
243
  export declare const treeItemClassNames: SlotClassNames<TreeItemSlots>;
318
244
 
@@ -323,8 +249,8 @@ declare type TreeItemContextValue = {
323
249
  expandIconRef: React_2.Ref<HTMLDivElement>;
324
250
  layoutRef: React_2.Ref<HTMLDivElement>;
325
251
  subtreeRef: React_2.Ref<HTMLDivElement>;
326
- value: unknown;
327
252
  itemType: TreeItemType;
253
+ value: string;
328
254
  open: boolean;
329
255
  };
330
256
 
@@ -352,11 +278,6 @@ export declare type TreeItemLayoutProps = ComponentProps<Partial<TreeItemLayoutS
352
278
 
353
279
  export declare type TreeItemLayoutSlots = {
354
280
  root: Slot<'div'>;
355
- /**
356
- * Expand icon slot,
357
- * by default renders a chevron icon to indicate opening and closing
358
- */
359
- expandIcon?: Slot<'div'>;
360
281
  /**
361
282
  * Icon slot that renders right before main content
362
283
  */
@@ -365,12 +286,30 @@ export declare type TreeItemLayoutSlots = {
365
286
  * Icon slot that renders right after main content
366
287
  */
367
288
  iconAfter?: Slot<'div'>;
289
+ /**
290
+ * Expand icon slot,
291
+ * by default renders a chevron icon to indicate opening and closing
292
+ */
293
+ expandIcon?: Slot<'div'>;
294
+ aside?: Slot<'div'>;
295
+ /**
296
+ * actionable elements are normally buttons, menus, or other focusable elements.
297
+ * Those elements are only visibly available if the given tree item is currently active.
298
+ */
299
+ actions?: Slot<ExtractSlotProps<Slot<'div'> & {
300
+ /**
301
+ * Forces visibility of the aside/action content
302
+ */
303
+ visible?: boolean;
304
+ }>>;
368
305
  };
369
306
 
370
307
  /**
371
308
  * State used in rendering TreeItemLayout
372
309
  */
373
- export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots>;
310
+ export declare type TreeItemLayoutState = ComponentState<TreeItemLayoutSlots> & {
311
+ buttonContextValue: ButtonContextValue;
312
+ };
374
313
 
375
314
  export declare const treeItemLevelToken: "--fluent-TreeItem--level";
376
315
 
@@ -392,13 +331,8 @@ declare type TreeItemPersonaLayoutContextValues = {
392
331
  */
393
332
  export declare type TreeItemPersonaLayoutProps = ComponentProps<Partial<TreeItemPersonaLayoutSlots>>;
394
333
 
395
- export declare type TreeItemPersonaLayoutSlots = {
334
+ export declare type TreeItemPersonaLayoutSlots = Pick<TreeItemLayoutSlots, 'actions' | 'aside' | 'expandIcon'> & {
396
335
  root: NonNullable<Slot<'div'>>;
397
- /**
398
- * Expand icon slot,
399
- * by default renders a chevron icon to indicate opening and closing
400
- */
401
- expandIcon?: Slot<'div'>;
402
336
  /**
403
337
  * Avatar to display.
404
338
  */
@@ -411,10 +345,6 @@ export declare type TreeItemPersonaLayoutSlots = {
411
345
  * Secondary text that describes or complements the main text
412
346
  */
413
347
  description?: Slot<'div'>;
414
- /**
415
- * A layout wrapper for the main and description slots
416
- */
417
- content: NonNullable<Slot<'div'>>;
418
348
  };
419
349
 
420
350
  /**
@@ -422,21 +352,22 @@ export declare type TreeItemPersonaLayoutSlots = {
422
352
  */
423
353
  export declare type TreeItemPersonaLayoutState = ComponentState<TreeItemPersonaLayoutSlots> & {
424
354
  avatarSize: AvatarSize;
355
+ buttonContextValue: ButtonContextValue;
425
356
  };
426
357
 
427
358
  /**
428
359
  * TreeItem Props
429
360
  */
430
- export declare type TreeItemProps<Value = string> = ComponentProps<Partial<TreeItemSlots>> & {
431
- value?: Value;
361
+ export declare type TreeItemProps = ComponentProps<Partial<TreeItemSlots>> & {
432
362
  itemType: TreeItemType;
363
+ value?: TreeItemValue;
433
364
  };
434
365
 
435
366
  export declare const TreeItemProvider: React_2.Provider<TreeItemContextValue | undefined> & React_2.FC<React_2.ProviderProps<TreeItemContextValue | undefined>>;
436
367
 
437
- declare type TreeItemRequest<Value> = {
368
+ declare type TreeItemRequest = {
438
369
  itemType: TreeItemType;
439
- } & (OmitWithoutExpanding<TreeOpenChangeData<Value>, 'open' | 'target'> | OmitWithoutExpanding<TreeNavigationData_unstable<Value>, 'target'>);
370
+ } & (OmitWithoutExpanding<TreeOpenChangeData, 'open' | 'target'> | OmitWithoutExpanding<TreeNavigationData_unstable, 'target'>);
440
371
 
441
372
  export declare type TreeItemSlots = {
442
373
  root: Slot<ExtractSlotProps<Slot<'div'> & {
@@ -454,9 +385,11 @@ export declare type TreeItemState = ComponentState<TreeItemSlots> & TreeItemCont
454
385
 
455
386
  declare type TreeItemType = 'leaf' | 'branch';
456
387
 
457
- export declare type TreeNavigationData_unstable<Value = string> = {
458
- value: Value;
388
+ declare type TreeItemValue = string | number;
389
+
390
+ export declare type TreeNavigationData_unstable = {
459
391
  target: HTMLElement;
392
+ value: string;
460
393
  } & ({
461
394
  event: React_2.MouseEvent<HTMLElement>;
462
395
  type: 'Click';
@@ -485,9 +418,9 @@ export declare type TreeNavigationData_unstable<Value = string> = {
485
418
 
486
419
  export declare type TreeNavigationEvent_unstable = TreeNavigationData_unstable['event'];
487
420
 
488
- export declare type TreeOpenChangeData<Value = string> = {
421
+ export declare type TreeOpenChangeData = {
489
422
  open: boolean;
490
- value: Value;
423
+ value: string;
491
424
  } & ({
492
425
  event: React_2.MouseEvent<HTMLElement>;
493
426
  target: HTMLElement;
@@ -512,7 +445,7 @@ export declare type TreeOpenChangeData<Value = string> = {
512
445
 
513
446
  export declare type TreeOpenChangeEvent = TreeOpenChangeData['event'];
514
447
 
515
- export declare type TreeProps<Value = string> = ComponentProps<TreeSlots> & {
448
+ export declare type TreeProps = ComponentProps<TreeSlots> & {
516
449
  /**
517
450
  * A tree item can have various appearances:
518
451
  * - 'subtle' (default): The default tree item styles.
@@ -531,13 +464,13 @@ export declare type TreeProps<Value = string> = ComponentProps<TreeSlots> & {
531
464
  * Controls the state of the open tree items.
532
465
  * These property is ignored for subtrees.
533
466
  */
534
- openItems?: Iterable<Value>;
467
+ openItems?: Iterable<string>;
535
468
  /**
536
469
  * This refers to a list of ids of opened tree items.
537
470
  * Default value for the uncontrolled state of open tree items.
538
471
  * These property is ignored for subtrees.
539
472
  */
540
- defaultOpenItems?: Iterable<Value>;
473
+ defaultOpenItems?: Iterable<string>;
541
474
  /**
542
475
  * Callback fired when the component changes value from open state.
543
476
  * These property is ignored for subtrees.
@@ -546,7 +479,7 @@ export declare type TreeProps<Value = string> = ComponentProps<TreeSlots> & {
546
479
  * @param data - A data object with relevant information,
547
480
  * such as open value and type of interaction that created the event.
548
481
  */
549
- onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData<Value>): void;
482
+ onOpenChange?(event: TreeOpenChangeEvent, data: TreeOpenChangeData): void;
550
483
  /**
551
484
  * Callback fired when navigation happens inside the component.
552
485
  * These property is ignored for subtrees.
@@ -556,7 +489,7 @@ export declare type TreeProps<Value = string> = ComponentProps<TreeSlots> & {
556
489
  * @param event - a React's Synthetic event
557
490
  * @param data - A data object with relevant information,
558
491
  */
559
- onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable<Value>): void;
492
+ onNavigation_unstable?(event: TreeNavigationEvent_unstable, data: TreeNavigationData_unstable): void;
560
493
  };
561
494
 
562
495
  export declare const TreeProvider: Provider<TreeContextValue | undefined> & FC<ProviderProps<TreeContextValue | undefined>>;
@@ -584,7 +517,7 @@ export declare type TreeState = ComponentState<TreeSlots> & TreeContextValue & {
584
517
  * @param flatTreeItemProps - a list of tree items
585
518
  * @param options - in case control over the internal openItems is required
586
519
  */
587
- export declare function useFlatTree_unstable<Props extends FlatTreeItemProps<unknown> = FlatTreeItemProps>(flatTreeItemProps: Props[], options?: FlatTreeOptions<Props>): FlatTree<Props>;
520
+ export declare function useFlatTree_unstable<Props extends FlatTreeItemProps = FlatTreeItemProps>(flatTreeItemProps: Props[], options?: FlatTreeOptions): FlatTree<Props>;
588
521
 
589
522
  /**
590
523
  * Create the state required to render Tree.
@@ -610,23 +543,7 @@ export declare function useTreeContextValues_unstable(state: TreeState): TreeCon
610
543
  * @param props - props from this instance of TreeItem
611
544
  * @param ref - reference to root HTMLElement of TreeItem
612
545
  */
613
- export declare function useTreeItem_unstable<Value = string>(props: TreeItemProps<Value>, ref: React_2.Ref<HTMLDivElement>): TreeItemState;
614
-
615
- /**
616
- * Create the state required to render TreeItemAside.
617
- *
618
- * The returned state can be modified with hooks such as useTreeItemAsideStyles_unstable,
619
- * before being passed to renderTreeItemAside_unstable.
620
- *
621
- * @param props - props from this instance of TreeItemAside
622
- * @param ref - reference to root HTMLElement of TreeItemAside
623
- */
624
- export declare const useTreeItemAside_unstable: (props: TreeItemAsideProps, ref: React_2.Ref<HTMLElement>) => TreeItemAsideState;
625
-
626
- /**
627
- * Apply styling to the TreeItemAside slots based on the state
628
- */
629
- export declare const useTreeItemAsideStyles_unstable: (state: TreeItemAsideState) => TreeItemAsideState;
546
+ export declare function useTreeItem_unstable(props: TreeItemProps, ref: React_2.Ref<HTMLDivElement>): TreeItemState;
630
547
 
631
548
  export declare const useTreeItemContext_unstable: <T>(selector: ContextSelector<TreeItemContextValue, T>) => T;
632
549
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Tree.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTree_unstable } from './useTree';\nimport { renderTree_unstable } from './renderTree';\nimport { useTreeStyles_unstable } from './useTreeStyles.styles';\nimport type { TreeProps } from './Tree.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTreeContextValues_unstable } from './useTreeContextValues';\n\n/**\n * A tree view widget presents a hierarchical list.\n * Any item in the hierarchy may have child items,\n * and items that have children may be expanded or collapsed to show or hide the children.\n * For example, in a file system navigator that uses a tree view to display folders and files,\n * an item representing a folder can be expanded to reveal the contents of the folder,\n * which may be files, folders, or both.\n */\nexport const Tree = React.forwardRef((props, ref) => {\n const state = useTree_unstable(props, ref);\n useTreeStyles_unstable(state);\n const contextValues = useTreeContextValues_unstable(state);\n return renderTree_unstable(state, contextValues);\n}) as ForwardRefComponent<TreeProps> & (<Value = string>(props: TreeProps<Value>) => JSX.Element);\n\nTree.displayName = 'Tree';\n"],"names":["React","useTree_unstable","renderTree_unstable","useTreeStyles_unstable","useTreeContextValues_unstable","Tree","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,yBAAyB;AAGhE,SAASC,6BAA6B,QAAQ,yBAAyB;AAEvE;;;;;;;CAOC,GACD,OAAO,MAAMC,qBAAOL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACnD,MAAMC,QAAQR,iBAAiBM,OAAOC;IACtCL,uBAAuBM;IACvB,MAAMC,gBAAgBN,8BAA8BK;IACpD,OAAOP,oBAAoBO,OAAOC;AACpC,GAAkG;AAElGL,KAAKM,WAAW,GAAG"}
1
+ {"version":3,"sources":["Tree.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTree_unstable } from './useTree';\nimport { renderTree_unstable } from './renderTree';\nimport { useTreeStyles_unstable } from './useTreeStyles.styles';\nimport type { TreeProps } from './Tree.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useTreeContextValues_unstable } from './useTreeContextValues';\n\n/**\n * A tree view widget presents a hierarchical list.\n * Any item in the hierarchy may have child items,\n * and items that have children may be expanded or collapsed to show or hide the children.\n * For example, in a file system navigator that uses a tree view to display folders and files,\n * an item representing a folder can be expanded to reveal the contents of the folder,\n * which may be files, folders, or both.\n */\nexport const Tree: ForwardRefComponent<TreeProps> = React.forwardRef((props, ref) => {\n const state = useTree_unstable(props, ref);\n useTreeStyles_unstable(state);\n const contextValues = useTreeContextValues_unstable(state);\n return renderTree_unstable(state, contextValues);\n});\n\nTree.displayName = 'Tree';\n"],"names":["React","useTree_unstable","renderTree_unstable","useTreeStyles_unstable","useTreeContextValues_unstable","Tree","forwardRef","props","ref","state","contextValues","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,yBAAyB;AAGhE,SAASC,6BAA6B,QAAQ,yBAAyB;AAEvE;;;;;;;CAOC,GACD,OAAO,MAAMC,qBAAuCL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACnF,MAAMC,QAAQR,iBAAiBM,OAAOC;IACtCL,uBAAuBM;IACvB,MAAMC,gBAAgBN,8BAA8BK;IACpD,OAAOP,oBAAoBO,OAAOC;AACpC,GAAG;AAEHL,KAAKM,WAAW,GAAG"}
@@ -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<Value = string> = { value: Value; target: HTMLElement } & (\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<Value = string> = { open: boolean; value: Value } & (\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<Value = string> = 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<Value>;\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<Value>;\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<Value>): 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<Value>): 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 * 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"}
@@ -49,7 +49,7 @@ import { treeDataTypes } from '../../utils/tokens';
49
49
  });
50
50
  });
51
51
  };
52
- const handleTreeItemKeyDown = ({ event , value , type , itemType })=>{
52
+ const handleTreeItemKeyDown = ({ event , type , value , itemType })=>{
53
53
  const open = openItems.has(value);
54
54
  switch(type){
55
55
  case treeDataTypes.ArrowRight: