@itwin/presentation-hierarchies-react 2.0.0-alpha.6 → 2.0.0-alpha.60

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 (163) hide show
  1. package/CHANGELOG.md +1137 -11
  2. package/README.md +93 -160
  3. package/lib/presentation-hierarchies-react/FlatTreeNode.d.ts +49 -0
  4. package/lib/presentation-hierarchies-react/FlatTreeNode.d.ts.map +1 -0
  5. package/lib/presentation-hierarchies-react/FlatTreeNode.js +93 -0
  6. package/lib/presentation-hierarchies-react/FlatTreeNode.js.map +1 -0
  7. package/lib/presentation-hierarchies-react/LocalizationContext.d.ts +24 -0
  8. package/lib/presentation-hierarchies-react/LocalizationContext.d.ts.map +1 -0
  9. package/lib/presentation-hierarchies-react/LocalizationContext.js +40 -0
  10. package/lib/presentation-hierarchies-react/LocalizationContext.js.map +1 -0
  11. package/lib/presentation-hierarchies-react/Renderers.d.ts +92 -0
  12. package/lib/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
  13. package/lib/presentation-hierarchies-react/TreeNode.d.ts +80 -0
  14. package/lib/presentation-hierarchies-react/TreeNode.d.ts.map +1 -0
  15. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseIModelTree.d.ts +28 -15
  16. package/lib/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -0
  17. package/lib/presentation-hierarchies-react/UseIModelTree.js +183 -0
  18. package/lib/presentation-hierarchies-react/UseIModelTree.js.map +1 -0
  19. package/lib/presentation-hierarchies-react/UseNodeHighlighting.d.ts +30 -0
  20. package/lib/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
  21. package/lib/presentation-hierarchies-react/UseNodeHighlighting.js +57 -0
  22. package/lib/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
  23. package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts +23 -0
  24. package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -0
  25. package/lib/presentation-hierarchies-react/UseSelectionHandler.js +124 -0
  26. package/lib/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -0
  27. package/lib/presentation-hierarchies-react/UseTree.d.ts +112 -0
  28. package/lib/presentation-hierarchies-react/UseTree.d.ts.map +1 -0
  29. package/lib/presentation-hierarchies-react/UseTree.js +297 -0
  30. package/lib/presentation-hierarchies-react/UseTree.js.map +1 -0
  31. package/lib/presentation-hierarchies-react/Utils.js +56 -0
  32. package/lib/presentation-hierarchies-react/Utils.js.map +1 -0
  33. package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js +10 -0
  34. package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -0
  35. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts +9 -0
  36. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts.map +1 -0
  37. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js +12 -0
  38. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js.map +1 -0
  39. package/lib/presentation-hierarchies-react/internal/TreeActions.js +294 -0
  40. package/lib/presentation-hierarchies-react/internal/TreeActions.js.map +1 -0
  41. package/lib/presentation-hierarchies-react/internal/TreeLoader.js +98 -0
  42. package/lib/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -0
  43. package/lib/presentation-hierarchies-react/internal/TreeModel.d.ts +1 -0
  44. package/lib/presentation-hierarchies-react/internal/TreeModel.js +120 -0
  45. package/lib/presentation-hierarchies-react/internal/TreeModel.js.map +1 -0
  46. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +35 -0
  47. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -0
  48. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js +141 -0
  49. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -0
  50. package/lib/presentation-hierarchies-react/internal/Utils.js +42 -0
  51. package/lib/presentation-hierarchies-react/internal/Utils.js.map +1 -0
  52. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +38 -0
  53. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
  54. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +380 -0
  55. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
  56. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +27 -0
  57. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
  58. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +185 -0
  59. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
  60. package/lib/presentation-hierarchies-react/stratakit/TreeAction.d.ts +49 -0
  61. package/lib/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -0
  62. package/lib/presentation-hierarchies-react/stratakit/TreeAction.js +88 -0
  63. package/lib/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -0
  64. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +38 -0
  65. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
  66. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +63 -0
  67. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
  68. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts +29 -0
  69. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -0
  70. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js +91 -0
  71. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -0
  72. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts +31 -0
  73. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -0
  74. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js +155 -0
  75. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -0
  76. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.css +25 -0
  77. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +14 -0
  78. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
  79. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +534 -0
  80. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
  81. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +75 -0
  82. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
  83. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js +417 -0
  84. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
  85. package/lib/presentation-hierarchies-react-extract.d.ts +17 -0
  86. package/lib/presentation-hierarchies-react-extract.js +16 -0
  87. package/lib/presentation-hierarchies-react-stratakit.d.ts +8 -0
  88. package/lib/presentation-hierarchies-react-stratakit.js +8 -0
  89. package/lib/presentation-hierarchies-react.d.ts +11 -0
  90. package/lib/presentation-hierarchies-react.js +8 -0
  91. package/lib/public/locales/en/PresentationHierarchies_1.0.json +26 -0
  92. package/package.json +78 -56
  93. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +0 -75
  94. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +0 -1
  95. package/lib/esm/presentation-hierarchies-react/TreeNode.js +0 -12
  96. package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +0 -1
  97. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts +0 -15
  98. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts.map +0 -1
  99. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js +0 -22
  100. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js.map +0 -1
  101. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +0 -1
  102. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +0 -62
  103. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +0 -1
  104. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +0 -46
  105. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +0 -1
  106. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +0 -98
  107. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +0 -1
  108. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +0 -132
  109. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +0 -1
  110. package/lib/esm/presentation-hierarchies-react/UseTree.js +0 -242
  111. package/lib/esm/presentation-hierarchies-react/UseTree.js.map +0 -1
  112. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts +0 -2
  113. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts.map +0 -1
  114. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js +0 -11
  115. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js.map +0 -1
  116. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +0 -53
  117. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +0 -1
  118. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +0 -307
  119. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +0 -1
  120. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +0 -44
  121. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +0 -1
  122. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +0 -94
  123. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +0 -1
  124. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +0 -70
  125. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +0 -1
  126. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +0 -153
  127. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +0 -1
  128. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +0 -28
  129. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +0 -1
  130. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +0 -128
  131. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +0 -1
  132. package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts +0 -23
  133. package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +0 -1
  134. package/lib/esm/presentation-hierarchies-react/internal/Utils.js +0 -58
  135. package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +0 -1
  136. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts +0 -21
  137. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts.map +0 -1
  138. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js +0 -30
  139. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js.map +0 -1
  140. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts +0 -73
  141. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts.map +0 -1
  142. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js +0 -34
  143. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js.map +0 -1
  144. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts +0 -25
  145. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts.map +0 -1
  146. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js +0 -40
  147. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js.map +0 -1
  148. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts +0 -23
  149. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts.map +0 -1
  150. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js +0 -72
  151. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js.map +0 -1
  152. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts +0 -40
  153. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts.map +0 -1
  154. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js +0 -80
  155. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js.map +0 -1
  156. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts +0 -30
  157. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts.map +0 -1
  158. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js +0 -48
  159. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +0 -1
  160. package/lib/esm/presentation-hierarchies-react.d.ts +0 -13
  161. package/lib/esm/presentation-hierarchies-react.d.ts.map +0 -1
  162. package/lib/esm/presentation-hierarchies-react.js +0 -16
  163. package/lib/esm/presentation-hierarchies-react.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,886 @@
1
1
  # @itwin/presentation-hierarchies-react
2
2
 
3
+ ## 2.0.0-alpha.60
4
+
5
+ ### Minor Changes
6
+
7
+ - ce317097cb094c1c0eb15b66f7560dd54ad7893b: Updated optional `@stratakit/*` peer dependencies to their latest versions (`@stratakit/foundations@0.4.7`, `@stratakit/icons@0.3.1`, `@stratakit/structures@0.5.6`).
8
+
9
+ ## 2.0.0-alpha.59
10
+
11
+ ### Major Changes
12
+
13
+ - [#1259](https://github.com/iTwin/presentation/pull/1259): Introduce separate import path for StrataKit based components. StrataKit based components have to be imported through `@itwin/presentation-hierarchies-react/stratakit`. This allows to use this package with or without StrataKit dependencies.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#1256](https://github.com/iTwin/presentation/pull/1256): Fix `alpha` dependencies being specified with a range (`^`), allowing package manager to use higher versions, possibly with breaking changes.
18
+ - Updated dependencies:
19
+ - @itwin/presentation-hierarchies@2.0.0-alpha.14
20
+
21
+ ## 2.0.0-alpha.58
22
+
23
+ ### Major Changes
24
+
25
+ - [#1236](https://github.com/iTwin/presentation/pull/1236): Start using tree structure for defining hierarchy search paths.
26
+
27
+ The expected return type of `useTree` hooks' `getSearchPaths` callback prop has changed from `Promise<HierarchySearchPath[] | undefined>` to `Promise<HierarchySearchTree[] | undefined>`. The newly added `HierarchySearchTree.createFromPathsList` from `@itwin/presentation-hierarchies` can be used to do the conversion:`
28
+
29
+ ```tsx
30
+ import { HierarchySearchTree } from "@itwin/presentation-hierarchies";
31
+
32
+ function MyTree() {
33
+ const [searchText, setSearchText] = useState("");
34
+ const treeProps = useIModelUnifiedSelectionTree({
35
+ // ...
36
+ getSearchPaths: useMemo<UseIModelTreeProps["getSearchPaths"]>(() => {
37
+ return async () => {
38
+ // before
39
+ return getSearchTargetPaths({ searchText }),
40
+ // after
41
+ return HierarchySearchTree.createFromPathsList(await getSearchTargetPaths({ searchText }));
42
+ };
43
+ }, [searchText]),
44
+ });
45
+
46
+ // ...
47
+
48
+ return (
49
+ <StrataKitTreeRenderer
50
+ {...treeProps.treeRendererProps}
51
+ // ...
52
+ />
53
+ );
54
+ }
55
+ ```
56
+
57
+ ### Patch Changes
58
+
59
+ - Updated dependencies:
60
+ - @itwin/unified-selection@1.6.9-alpha.0
61
+ - @itwin/presentation-hierarchies@2.0.0-alpha.13
62
+ - @itwin/presentation-shared@2.0.0-alpha.9
63
+
64
+ ## 2.0.0-alpha.57
65
+
66
+ ### Patch Changes
67
+
68
+ - [#1238](https://github.com/iTwin/presentation/pull/1238): Fix root nodes with errors not being counted when collapsed
69
+
70
+ ## 2.0.0-alpha.56
71
+
72
+ ### Minor Changes
73
+
74
+ - [#1230](https://github.com/iTwin/presentation/pull/1230): Added `isNodeExpandable` property to `GenericErrorInfo`, allowing nodes with generic errors to remain expandable.
75
+
76
+ ## 2.0.0-alpha.55
77
+
78
+ ### Major Changes
79
+
80
+ - [#1223](https://github.com/iTwin/presentation/pull/1223): Reworked `localization` to use `i18next`-compatible approach. Instead of passing a `localizedStrings` object into `LocalizationContextProvider`, the package now delivers an English locale JSON file and resolves strings through a `getLocalizedString` function at runtime.
81
+
82
+ **Breaking changes**
83
+
84
+ - `LocalizationContextProvider` no longer accepts a `localizedStrings` object. It now requires a `localization` prop — an object with a `getLocalizedString(key: string): string` method (compatible with `Localization` from @itwin/core-common).
85
+ - `LOCALIZATION_NAMESPACES` must be registered with your localization provider during app initialization to make localized strings available.
86
+
87
+ ### Minor Changes
88
+
89
+ - [#1221](https://github.com/iTwin/presentation/pull/1221): Add `getTreeNodeError` callback prop to `useTree` hook and its derivatives, providing a way to set custom errors on tree nodes.
90
+
91
+ ### Patch Changes
92
+
93
+ - [#1219](https://github.com/iTwin/presentation/pull/1219): Fix component documentation mentioning iTwinUI
94
+ - Updated dependencies:
95
+ - @itwin/presentation-shared@2.0.0-alpha.8
96
+ - @itwin/presentation-hierarchies@2.0.0-alpha.12
97
+ - @itwin/unified-selection@1.6.8-alpha.0
98
+
99
+ ## 2.0.0-alpha.54
100
+
101
+ ### Patch Changes
102
+
103
+ - [#1198](https://github.com/iTwin/presentation/pull/1198): Change `HierarchyProvider.hierarchyChanged` argument to be required.
104
+
105
+ This simplifies the API for users of `HierarchyProvider`, as they no longer need to check for `undefined` when handling hierarchy changes.
106
+
107
+ For implementors of custom `HierarchyProvider`, this change means that they must always provide an even argument when raising the `hierarchyChanged` event. Since all members of the argument type are optional, it's okay to raise the even with an empty object, e.g.: `this.hierarchyChanged.raiseEvent({})`.
108
+
109
+ - [#1200](https://github.com/iTwin/presentation/pull/1200): Removed unnecessary, always-truthy condition checks.
110
+ - [#1193](https://github.com/iTwin/presentation/pull/1193): Process package output with [React Compiler](https://react.dev/reference/react-compiler/compiling-libraries).
111
+ - Updated dependencies:
112
+ - @itwin/presentation-shared@2.0.0-alpha.7
113
+ - @itwin/presentation-hierarchies@2.0.0-alpha.11
114
+
115
+ ## 2.0.0-alpha.53
116
+
117
+ ### Patch Changes
118
+
119
+ - [#1192](https://github.com/iTwin/presentation/pull/1192): Fix situations where expander was rendered for leaf nodes.
120
+ - [#1196](https://github.com/iTwin/presentation/pull/1196): Added accessible name for tree node rename input.
121
+
122
+ ## 2.0.0-alpha.52
123
+
124
+ ### Patch Changes
125
+
126
+ - [#1187](https://github.com/iTwin/presentation/pull/1187): Fixed tree node rename committed with keyboard activating previously focused element.
127
+
128
+ ## 2.0.0-alpha.51
129
+
130
+ ### Major Changes
131
+
132
+ - [#1185](https://github.com/iTwin/presentation/pull/1185): Bumped peer dependencies:
133
+ - `@stratakit/bricks`: `^0.5.4`
134
+ - `@stratakit/foundations`: `^0.4.5`
135
+ - `@stratakit/icons`: `^0.2.2`
136
+ - `@stratakit/structures`: `^0.5.4`
137
+
138
+ ## 2.0.0-alpha.50
139
+
140
+ ### Major Changes
141
+
142
+ - [#1184](https://github.com/iTwin/presentation/pull/1184): Fixed selection handling in `StrataKitTreeRenderer`. Mouse double clicks are now correctly ignored to prevent rapid selection toggling. Keyboard selection using `Space` and `Enter` keys is working.
143
+
144
+ **Breaking changes**
145
+
146
+ - `useSelectionHandler` is no longer exported. This function is an internal implementation detail of `StrataKitTreeRenderer` and should not be used directly.
147
+
148
+ - [#1181](https://github.com/iTwin/presentation/pull/1181): **Breaking change:** Rename `PresentationHierarchyNode` to `TreeNode` for clarity.
149
+
150
+ We already have a `HierarchyNode` type in `@itwin/presentation-hierarchies`, so having a `PresentationHierarchyNode` in `@itwin/presentation-hierarchies-react` was causing confusion. Additionally, this change aligns with the naming convention that we try to keep, where "hierarchy" refers to data and "tree" refers to UI components.
151
+
152
+ - [#1183](https://github.com/iTwin/presentation/pull/1183): Clean up `TreeErrorRenderer` and `ErrorItemRenderer`.
153
+
154
+ **Breaking changes:**
155
+
156
+ - Replaced `useErrorList` hook with `useErrorNodes` hook that returns error nodes (`TreeNode[]`) instead of error items. The `expandTo` function became unnecessary, because expanding to error nodes is now handled internally. As a result, the whole `ErrorItem` type (result of `useErrorList`) was removed. Reacting to this, the following other breaking changes were made:
157
+ - Renamed `errorItem` -> `errorNode` in `ErrorItemRenderer` component and changed the type from removed `ErrorItem` to `TreeNode`.
158
+ - Renamed `errorList` -> `errorNodes` in `TreeErrorRenderer` component and changed the type from `ErrorItem[]` to `TreeNode[]`.
159
+ - The `reloadTree` function prop in `ErrorItemRenderer` and `TreeErrorRenderer` components no longer takes the `state` option. The option was required and always had the same value, so it was redundant.
160
+ - Renamed `onFilterClick` -> `filterHierarchyLevel` in `ErrorItemRenderer`, `TreeErrorRenderer` and `StrataKitTreeRenderer` components. This makes its name consistent with other function props ("do something" vs "on something happened").
161
+ - Renamed `scrollToElement` -> `scrollToNode` in `ErrorItemRenderer` and `TreeErrorRenderer`, and changed its type to take `TreeNode` instead of an error item returned by `useErrorList` hook.
162
+
163
+ ## 2.0.0-alpha.49
164
+
165
+ ### Major Changes
166
+
167
+ - [#1166](https://github.com/iTwin/presentation/pull/1166): Added ability to enter node rename mode programmatically through `StrataKitTreeRenderer` ref. The `renameNode` method accepts a predicate function to identify the target node. If the node is not visible (because its parent is collapsed), all parents will be expanded automatically to make it visible and the node will be scrolled into view.
168
+
169
+ Example:
170
+
171
+ ```tsx
172
+ import {
173
+ StrataKitTreeRenderer,
174
+ StrataKitTreeRendererAttributes,
175
+ } from "@itwin/presentation-hierarchies-react";
176
+
177
+ function MyTree() {
178
+ const treeRef = useRef<StrataKitTreeRendererAttributes>(null);
179
+
180
+ return (
181
+ <>
182
+ <div className="tree-header">
183
+ <button
184
+ onClick={() => {
185
+ treeRef.current?.renameNode(
186
+ (node) => node.label === "Node to rename"
187
+ );
188
+ }}
189
+ >
190
+ Rename node
191
+ </button>
192
+ </div>
193
+ <StrataKitTreeRenderer ref={treeRef} />
194
+ </>
195
+ );
196
+ }
197
+ ```
198
+
199
+ **Breaking changes**
200
+
201
+ - `StrataKitTreeNodeRenderer` is no longer exported.
202
+ - `RenameContextProvider` is no longer exported. It is not necessary when using `StrataKitTreeRenderer`.
203
+ - `RenameAction` now requires a `node` prop.
204
+
205
+ - [#1179](https://github.com/iTwin/presentation/pull/1179): **Breaking change:** Rename tree node action components for clarity.
206
+
207
+ - `FilterAction` -> `TreeNodeFilterAction`
208
+ - `RenameAction` -> `TreeNodeRenameAction`
209
+
210
+ - [#1178](https://github.com/iTwin/presentation/pull/1178): Updated tree node rename UI to show input in popover instead of inline. Additionally added ability to show hint for supported characters and validate new label.
211
+
212
+ Example:
213
+
214
+ ```tsx
215
+ type TreeRendererProps = ComponentProps<typeof StrataKitTreeRenderer>;
216
+
217
+ const getEditingProps = useCallback<
218
+ Required<TreeRendererProps>["getEditingProps"]
219
+ >((node) => {
220
+ return {
221
+ onLabelChanged: (newLabel: string) => {
222
+ // Handle label change
223
+ },
224
+ labelValidationHint: `Allowed are A to Z, 0 to 9, "-" and "_"`,
225
+ validate: (newLabel: string) => /^[A-Za-z0-9\- ]+$/.test(newLabel),
226
+ };
227
+ }, []);
228
+
229
+ return (
230
+ <StrataKitTreeRenderer {...treeProps} getEditingProps={getEditingProps} />
231
+ );
232
+ ```
233
+
234
+ **Breaking changes**
235
+
236
+ - `getEditingProps` callback was changed to require `onLabelChanged`. If node does not support renaming `getEditingProps` should return `undefined`.
237
+
238
+ ### Patch Changes
239
+
240
+ - Updated dependencies:
241
+ - @itwin/presentation-hierarchies@2.0.0-alpha.10
242
+ - @itwin/presentation-shared@2.0.0-alpha.6
243
+ - @itwin/unified-selection@1.6.6-alpha.0
244
+
245
+ ## 2.0.0-alpha.48
246
+
247
+ ### Minor Changes
248
+
249
+ - [#1159](https://github.com/iTwin/presentation/pull/1159): Introduced `getTreeItemProps` and `treeRootProps` to `StrataKitTreeRenderer`. This allows passing props to underlying `Tree.Item` and `Tree.Root` components.
250
+
251
+ **Breaking changes**
252
+
253
+ `StrataKitTreeNodeRenderer` props changes:
254
+
255
+ - `getMenuActions` callback changed to `menuActions` prop (type: `ReactNode[]`)
256
+ - `getInlineActions` callback changed to `inlineActions` prop (type: `ReactNode[]`)
257
+ - `getContextMenuActions` callback changed to `contextMenuActions` prop (type: `ReactNode[]`)
258
+ - `getLabel` callback removed - use `label` prop instead
259
+ - `getSublabel` callback removed - use `description` prop instead
260
+ - `getDecorations` callback removed - use `decorations` prop instead
261
+ - `getClassName` callback removed - use `className` prop instead
262
+ - `onNodeClick` and `onNodeKeyDown` callbacks removed - use `onClick` and `onKeyDown` props instead
263
+
264
+ `StrataKitTreeRenderer` props changes:
265
+
266
+ - Props previously passed to `StrataKitTreeNodeRenderer` are no longer accepted
267
+ - Use `getTreeItemProps` callback to provide props to specific `Tree.Item` components
268
+ - Use `getMenuActions`, `getInlineActions`, and `getContextMenuActions` on `StrataKitTreeRenderer` to provide actions for nodes
269
+
270
+ ### Patch Changes
271
+
272
+ - Updated dependencies:
273
+ - @itwin/presentation-hierarchies@2.0.0-alpha.9
274
+
275
+ ## 2.0.0-alpha.47
276
+
277
+ ### Patch Changes
278
+
279
+ - [#1142](https://github.com/iTwin/presentation/pull/1142): Bump dependencies.
280
+ - [#1142](https://github.com/iTwin/presentation/pull/1142): Fix `StrataKitTreeRenderer` getting into infinite React render loop.
281
+ - Updated dependencies:
282
+ - @itwin/presentation-hierarchies@2.0.0-alpha.8
283
+ - @itwin/presentation-shared@2.0.0-alpha.5
284
+
285
+ ## 2.0.0-alpha.46
286
+
287
+ ### Minor Changes
288
+
289
+ - [#1011](https://github.com/iTwin/presentation/pull/1011): Renamed `getFilteredPaths` prop to `getSearchPaths` in tree hooks: `useTree`, `useUnifiedSelectionTree`, `useIModelTree`, `useIModelUnifiedSelectionTree`.
290
+
291
+ ### Patch Changes
292
+
293
+ - Updated dependencies:
294
+ - @itwin/presentation-hierarchies@2.0.0-alpha.7
295
+
296
+ ## 2.0.0-alpha.45
297
+
298
+ ### Patch Changes
299
+
300
+ - [#1134](https://github.com/iTwin/presentation/pull/1134): Fixed expanded tree nodes showing expander when tree is reloaded and child nodes are removed.
301
+
302
+ ## 2.0.0-alpha.44
303
+
304
+ ### Patch Changes
305
+
306
+ - Updated dependencies:
307
+ - @itwin/unified-selection@1.6.3-alpha.0
308
+
309
+ ## 2.0.0-alpha.43
310
+
311
+ ### Patch Changes
312
+
313
+ - cc836290199b9ff778773b03ab578f90043e95f0: Do not open tree context menu is there is no actions.
314
+ - Updated dependencies:
315
+ - @itwin/presentation-shared@2.0.0-alpha.4
316
+ - @itwin/presentation-hierarchies@2.0.0-alpha.6
317
+
318
+ ## 2.0.0-alpha.42
319
+
320
+ ### Patch Changes
321
+
322
+ - [#1118](https://github.com/iTwin/presentation/pull/1118): Fixed first hidden inline action causing second action to be focused when navigating using keyboard.
323
+
324
+ ## 2.0.0-alpha.41
325
+
326
+ ### Major Changes
327
+
328
+ - [#1113](https://github.com/iTwin/presentation/pull/1113): Pass selected nodes to tree node action getters to support actions that should be applied on all selected nodes.
329
+
330
+ **Breaking changes**
331
+
332
+ - `StrataKitTreeRenderer.getInlineActions` callback receives `{ targetNode: PresentationHierarchyNode; selectedNodes: PresentationHierarchyNode[] }` props instead of `PresentationHierarchyNode`.
333
+ - `StrataKitTreeRenderer.getMenuActions` callback receives `{ targetNode: PresentationHierarchyNode; selectedNodes: PresentationHierarchyNode[] }` props instead of `PresentationHierarchyNode`.
334
+
335
+ Before
336
+
337
+ ```tsx
338
+ return (
339
+ <StrataKitTreeRenderer
340
+ getInlineActions={(node) => [<InlineAction node={node} />]}
341
+ getMenuActions={(node) => [<MenuAction node={node} />]}
342
+ />
343
+ );
344
+ ```
345
+
346
+ After
347
+
348
+ ```tsx
349
+ return (
350
+ <StrataKitTreeRenderer
351
+ getInlineActions={({ targetNode }) => [
352
+ <InlineAction node={targetNode} />,
353
+ ]}
354
+ getMenuActions={({ targetNode }) => [<MenuAction node={targetNode} />]}
355
+ />
356
+ );
357
+ ```
358
+
359
+ - [#1115](https://github.com/iTwin/presentation/pull/1115): Unified tree actions handling to make it easier defining actions that could be reused in different contexts: inline, context menu and actions dropdown.
360
+
361
+ **Breaking changes**
362
+
363
+ - Removed `reserveSpace` property from `<RenameAction />` and `<FilterAction />`. These actions now automatically infer the context they're used in.
364
+ - Added requirement to render newly introduced `<TreeActionBase />` component instead of `<Tree.ItemAction />` when rendering custom tree actions.
365
+
366
+ ### Minor Changes
367
+
368
+ - [#1115](https://github.com/iTwin/presentation/pull/1115): Added `getContextMenuActions` callback for rendering tree actions in context menu.
369
+
370
+ ## 2.0.0-alpha.40
371
+
372
+ ### Patch Changes
373
+
374
+ - [#1110](https://github.com/iTwin/presentation/pull/1110): Bump dependencies.
375
+ - Updated dependencies:
376
+ - @itwin/presentation-hierarchies@2.0.0-alpha.5
377
+ - @itwin/presentation-shared@2.0.0-alpha.3
378
+ - @itwin/unified-selection@1.6.2-alpha.0
379
+
380
+ ## 2.0.0-alpha.39
381
+
382
+ ### Minor Changes
383
+
384
+ - [#1106](https://github.com/iTwin/presentation/pull/1106): Added an `id` property to `StrataKitTreeRenderer` that is passed to it's scroll wrapper.
385
+ - [#1107](https://github.com/iTwin/presentation/pull/1107): Introduced new `getClassName` callback to `StrataKitTreeRenderer` and `StrataKitTreeNodeRenderer` for providing class to tree node HTML element.
386
+
387
+ ### Patch Changes
388
+
389
+ - [#1109](https://github.com/iTwin/presentation/pull/1109): Fixed error item Anchor font size.
390
+
391
+ ## 2.0.0-alpha.38
392
+
393
+ ### Patch Changes
394
+
395
+ - [#1102](https://github.com/iTwin/presentation/pull/1102): Updated tree error item renderer to render error actions as buttons based on StrataKit docs JSDoc suggestion.
396
+
397
+ ## 2.0.0-alpha.37
398
+
399
+ ### Major Changes
400
+
401
+ - [#1100](https://github.com/iTwin/presentation/pull/1100): Bumped StrataKit peer dependencies to:
402
+ - `@stratakit/structures`: ^0.5.0
403
+ - `@stratakit/icons`: ^0.2.0
404
+ - `@stratakit/foundations`: ^0.4.0
405
+ - `@stratakit/bricks`: ^0.5.0
406
+
407
+ ## 2.0.0-alpha.36
408
+
409
+ ### Major Changes
410
+
411
+ - [#1094](https://github.com/iTwin/presentation/pull/1094): Improve custom errors rendering API:
412
+
413
+ - Separated `ChildrenLoad` error from the `Unknown` error. All expected tree errors have dedicated type and `Unknown` error can be used to handle custom errors encountered outside of tree.
414
+ - Exposed `ErrorItemRenderer` that renders all error types supported by the tree.
415
+ - Updated `TreeErrorRenderer` to pass all props necessary to render `ErrorItemRenderer` into `renderError` callback.
416
+
417
+ These changes makes it easier to customize only some types of errors and leave default handling for others.
418
+
419
+ Example:
420
+
421
+ ```tsx
422
+ <StrataKitTreeRenderer
423
+ {...treeProps}
424
+ errorRenderer={(errorProps) => {
425
+ return (
426
+ <TreeErrorRenderer
427
+ {...errorProps}
428
+ renderError={(errorItemProps) => {
429
+ if (errorItemProps.errorItem.errorNode.error.type === "Unknown") {
430
+ return (
431
+ <ErrorRegion.Item
432
+ message="Custom error"
433
+ messageId={errorItemProps.errorItem.errorNode.id}
434
+ />
435
+ );
436
+ }
437
+ return <ErrorItemRenderer {...errorItemProps} />;
438
+ }}
439
+ />
440
+ );
441
+ }}
442
+ />
443
+ ```
444
+
445
+ ## 2.0.0-alpha.35
446
+
447
+ ### Patch Changes
448
+
449
+ - [#1075](https://github.com/iTwin/presentation/pull/1075): Fix accessibility issues in `<TreeErrorRenderer />`.
450
+
451
+ This involves a few localized string changes:
452
+
453
+ - Added `issuesForTree`, defaulting to "Issues for {{tree_label}}.", used as a region landmark label for the error message container.
454
+ - Added `noIssuesFound`, defaulting to "No issues found.", used as a label for errors' list when there are no issues.
455
+ - Changed `issuesFound` to default to "{{number_of_issues}} issue(s) found.", and updated its usage to inject the number of issues found into the string instead of prefixing it before the string, which allows to place the number at any place in the string (may be a requirement for some languages). This is **a breaking change** for anyone, supplying their own localized strings.
456
+
457
+ Also, **a new required prop** `treeLabel` was added to `<TreeErrorRenderer />` and `<StrataKitTreeRenderer />` components. The label is used to uniquely identify a tree in the application, which is required for accessibility purposes.
458
+
459
+ ## 2.0.0-alpha.34
460
+
461
+ ### Patch Changes
462
+
463
+ - [#1068](https://github.com/iTwin/presentation/pull/1068): Extend `@stratakit` peer dependency range to support the latest versions
464
+
465
+ ## 2.0.0-alpha.33
466
+
467
+ ### Patch Changes
468
+
469
+ - [#1057](https://github.com/iTwin/presentation/pull/1057): Change `useNodeHighlighting` hook to only highlight nodes that are filter targets.
470
+
471
+ ## 2.0.0-alpha.32
472
+
473
+ ### Patch Changes
474
+
475
+ - [#1045](https://github.com/iTwin/presentation/pull/1045): Fix highlight matching in `useNodeHighlighting` hook. Highlighting now works when the `highlightText` contains special characters (`[`, `+`, `*`, etc.).
476
+
477
+ ## 2.0.0-alpha.31
478
+
479
+ ### Patch Changes
480
+
481
+ - [#1042](https://github.com/iTwin/presentation/pull/1042): Version bump
482
+ - [#1040](https://github.com/iTwin/presentation/pull/1040): Added a react hook `useNodeHighlighting` that helps create highlighted node labels based on provided text that should be highlighted.
483
+
484
+ Example usage:
485
+
486
+ ```ts
487
+ import {
488
+ StrataKitTreeRenderer,
489
+ useNodeHighlighting,
490
+ } from "@itwin/presentation-hierarchies-react";
491
+
492
+ type BaseTreeRendererProps = React.ComponentPropsWithoutRef<
493
+ typeof StrataKitTreeRenderer
494
+ >;
495
+
496
+ function MyComponent(props: BaseTreeRendererProps & { searchText: string }) {
497
+ // Create highlight based on searchText
498
+ const highlightText =
499
+ props.searchText !== "" ? props.searchText : undefined;
500
+ const { getLabel } = useNodeHighlighting({ highlightText });
501
+
502
+ // Provide getLabel function to tree renderer
503
+ return <StrataKitTreeRenderer {...props} getLabel={getLabel} />;
504
+ }
505
+ ```
506
+
507
+ - Updated dependencies:
508
+ - @itwin/presentation-hierarchies@2.0.0-alpha.4
509
+ - @itwin/presentation-shared@2.0.0-alpha.2
510
+ - @itwin/unified-selection@1.5.1-alpha.1
511
+
512
+ ## 2.0.0-alpha.30
513
+
514
+ ### Patch Changes
515
+
516
+ - [#1037](https://github.com/iTwin/presentation/pull/1037): Added additional documentation for `RenameAction`
517
+
518
+ ## 2.0.0-alpha.29
519
+
520
+ ### Patch Changes
521
+
522
+ - [#1035](https://github.com/iTwin/presentation/pull/1035): Version bump after merge from `master`.
523
+
524
+ ## 2.0.0-alpha.28
525
+
526
+ ### Patch Changes
527
+
528
+ - [#1031](https://github.com/iTwin/presentation/pull/1031): Version bump
529
+ - Updated dependencies:
530
+ - @itwin/presentation-hierarchies@2.0.0-alpha.3
531
+ - @itwin/unified-selection@1.5.1-alpha.0
532
+
533
+ ## 2.0.0-alpha.27
534
+
535
+ ### Patch Changes
536
+
537
+ - [#1026](https://github.com/iTwin/presentation/pull/1026): Fix `reserveSpace` property being required instead of optional for `FilterAction` and `RenameAction`.
538
+
539
+ ## 2.0.0-alpha.26
540
+
541
+ ### Major Changes
542
+
543
+ - [#1023](https://github.com/iTwin/presentation/pull/1023): Split `getActions` into `getMenuActions` & `getInlineActions` for `StrataKitTreeRenderer` and `StrataKitTreeNodeRenderer`.
544
+
545
+ Updated peer dependencies:
546
+
547
+ - @stratakit/bricks@0.3.3
548
+ - @stratakit/foundations@0.2.2
549
+ - @stratakit/structures@0.3.1
550
+
551
+ Added `reserveSpace` property to `FilterAction` and `RenameAction`, which reserves space for the action when it is not available
552
+
553
+ ### Minor Changes
554
+
555
+ - [#1007](https://github.com/iTwin/presentation/pull/1007): Renames:
556
+ `FlatNode` => `FlatTreeNodeItem`
557
+ `FlatTreeNode` => `FlatTreeItem`
558
+ `PlaceholderNode` => `PlaceholderItem`
559
+ `useFlatTreeNodeList` => `useFlatTreeItems`
560
+
561
+ Changed `FlatTreeNodeItem` (previously `FlatNode`) to have property `node: PresentationHierarchyNode` instead of extending `PresentationHierarchyNode`.
562
+
563
+ ### Patch Changes
564
+
565
+ - Updated dependencies:
566
+ - @itwin/presentation-hierarchies@2.0.0-alpha.2
567
+
568
+ ## 2.0.0-alpha.25
569
+
570
+ ### Patch Changes
571
+
572
+ - Updated dependencies:
573
+ - @itwin/presentation-hierarchies@2.0.0-alpha.1
574
+ - @itwin/presentation-shared@2.0.0-alpha.1
575
+ - @itwin/unified-selection@1.4.3-alpha.0
576
+
577
+ ## 2.0.0-alpha.24
578
+
579
+ ### Patch Changes
580
+
581
+ - [#975](https://github.com/iTwin/presentation/pull/975): Associate tree nodes rendered by `<StrataKitTreeNodeRenderer />` component with error messages rendered in `<TreeErrorRenderer />`. This improves accessibility by linking error information to the node.
582
+ - [#979](https://github.com/iTwin/presentation/pull/979): Adjust how `useTree` and other variants of it determines `isReloading` value. `isReloading` is now set to `true` if root nodes are being loaded.
583
+
584
+ ## 2.0.0-alpha.23
585
+
586
+ ### Minor Changes
587
+
588
+ - [#972](https://github.com/iTwin/presentation/pull/972): Added `getEditingProps` prop to `<StrataKitTreeRenderer />` component that allows to make node labels editable. In order to enter label editing mode `<RenameAction />` component was added.
589
+
590
+ ## 2.0.0-alpha.22
591
+
592
+ ### Minor Changes
593
+
594
+ - [#970](https://github.com/iTwin/presentation/pull/970): Exposed the type of tree state hooks' result `treeRendererProps` attribute - `TreeRendererProps`. The type can be useful when creating custom tree renderers.
595
+
596
+ ## 2.0.0-alpha.21
597
+
598
+ ### Major Changes
599
+
600
+ - [#961](https://github.com/iTwin/presentation/pull/961): **Breaking changes** to tree state hooks `useTree`, `useUnifiedSelectionTree`, `useIModelTree`, `useIModelUnifiedSelectionTree`:
601
+
602
+ - All tree rendering props have been moved under `treeRendererProps`. The value can be passed to `<StrataKitTreeRenderer />` component.
603
+ - In case an error occurs while loading the root hierarchy level, instead of `treeRendererProps`, the `rootErrorRendererProps` are set, which can be passed to `<StrataKitRootErrorRenderer />` component to render the error state.
604
+ - The `isLoading` attribute has been renamed to `isReloading`.
605
+ - Errors are no longer defined as children of `PresentationHierarchyNode` and instead are now included as `error` attribute for more fluent API.
606
+
607
+ When rendering tree state, the recommended order of checks is:
608
+
609
+ 1. If `rootErrorRendererProps` is defined, there was an error - render error state.
610
+ 2. If `treeRendererProps` is not defined, the component is doing the initial load - render loading state.
611
+ 3. If `treeRendererProps` is defined, the hierarchy is loaded - render the tree component.
612
+
613
+ The `isReloading` attribute may also be set at the same time, indicating that the hierarchy is being reloaded in the background. Consumers may want to render an overlay in this case, or not render the tree at all.
614
+
615
+ Example:
616
+
617
+ ```ts
618
+ function MyComponent () {
619
+ const useTreeResult = useIModelUnifiedSelectionTree({...});
620
+
621
+ // handle possible root errors with our provided component or your own custom implementation
622
+ if (treeProps.rootErrorRendererProps) {
623
+ return <StrataKitRootErrorRenderer {...useTreeResult.rootErrorRendererProps} />;
624
+ }
625
+
626
+ // handle loading state
627
+ if (!treeProps.treeRendererProps) {
628
+ return <MyLoadingComponent />;
629
+ }
630
+
631
+ // handle loaded hierarchy
632
+ return <StrataKitTreeRenderer {...useTreeResult.treeProps} />;
633
+ }
634
+ ```
635
+
636
+ ## 2.0.0-alpha.20
637
+
638
+ ### Major Changes
639
+
640
+ - [#965](https://github.com/iTwin/presentation/pull/965): Added `@stratakit/structures` as a peer dependency.
641
+
642
+ ## 2.0.0-alpha.19
643
+
644
+ ### Major Changes
645
+
646
+ - [#954](https://github.com/iTwin/presentation/pull/954): Add additional requirements for types in `EC` metadata namespace, whose objects are returned by `ECSchemaProvider`.
647
+
648
+ - `EC.Schema`, `EC.Class` and `EC.Property` now all have an async `getCustomAttributes()` method that returns an `EC.CustomAttributeSet`, allowing consumers to access custom attributes of these schema items.
649
+ - `EC.Class` now additionally has these members:
650
+ - `baseClass: Promise<Class | undefined>`
651
+ - `getDerivedClasses(): Promise<Class[]>`
652
+
653
+ While this is an addition, it's considered a breaking change, because objects of the updated types are expected to be supplied to us by consumers.
654
+
655
+ In reality, consumers will likely use `@itwin/presentation-core-interop` package for creating them, and the package has been updated to handle the change, so reacting to the breaking change is as simple as bumping the version of `@itwin/presentation-core-interop` package in the consumer's `package.json`.
656
+
657
+ ### Patch Changes
658
+
659
+ - [#957](https://github.com/iTwin/presentation/pull/957): Avoid leaking custom props to the `PlaceholderNode` that are causing console errors.
660
+ - Updated dependencies:
661
+ - @itwin/presentation-hierarchies@2.0.0-alpha.0
662
+ - @itwin/presentation-shared@2.0.0-alpha.0
663
+ - @itwin/unified-selection@1.4.2-alpha.0
664
+
665
+ ## 2.0.0-alpha.18
666
+
667
+ ### Major Changes
668
+
669
+ - [#951](https://github.com/iTwin/presentation/pull/951): Move from `@itwin/itwinui-react@5.0.0-alpha` to `@stratakit/*` packages.
670
+
671
+ ## 2.0.0-alpha.17
672
+
673
+ ### Patch Changes
674
+
675
+ - [#949](https://github.com/iTwin/presentation/pull/949): Use default imports instead of `URL` constructor for icons.
676
+
677
+ ## 2.0.0-alpha.16
678
+
679
+ ### Minor Changes
680
+
681
+ - [#945](https://github.com/iTwin/presentation/pull/945): Re-export `getLogger` and `setLogger` functions from `@itwin/presentation-hierarchies` to allow setting a logger.
682
+
683
+ ## 2.0.0-alpha.15
684
+
685
+ ### Major Changes
686
+
687
+ - [#942](https://github.com/iTwin/presentation/pull/942): Unified selection API cleanup.
688
+
689
+ - Remove deprecated `UnifiedSelectionProvider`.
690
+ - Make `selectionStorage` prop required for unified selection - enabled tree state hooks (`useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree`).
691
+
692
+ Previously, the `selectionStorage` prop was optional, and if not provided, the hooks used unified selection React context (provided by `UnifiedSelectionProvider`) as fallback. Finally, if the context was not provided either, the hooks acted as regular non-unified selection hooks.
693
+
694
+ This didn't make much sense, as the hooks were designed to work with unified selection, as their name suggests. So it makes sense to require the selection storage to be provided to them, and at that point the context becomes redundant.
695
+
696
+ - [#936](https://github.com/iTwin/presentation/pull/936): Replaced `actions` property on `TreeNodeRenderer` with `getActions` to match how decorations are handled. Removed `useFilterAction` hook and replaced it with `FilterAction` component.
697
+
698
+ Before:
699
+
700
+ ```tsx
701
+ import {
702
+ TreeNodeRenderer,
703
+ useFilterAction,
704
+ } from "@itwin/presentation-hierarchies-react";
705
+
706
+ const filterAction = useFilterAction({ onFilter, getHierarchyLevelDetails });
707
+ return (
708
+ <TreeNodeRenderer
709
+ actions={useMemo(
710
+ () => [
711
+ filterAction,
712
+ (node) => ({
713
+ label: "Custom Action",
714
+ actions: () => log(node.label),
715
+ icon: customIconHref,
716
+ }),
717
+ ],
718
+ [filterAction]
719
+ )}
720
+ />
721
+ );
722
+ ```
723
+
724
+ After:
725
+
726
+ ```tsx
727
+ import { Icon, Tree } from "@itwin/itwinui-react";
728
+ import {
729
+ FilterAction,
730
+ TreeNodeRenderer,
731
+ } from "@itwin/presentation-hierarchies-react";
732
+
733
+ return (
734
+ <TreeNodeRenderer
735
+ getActions={useCallback(
736
+ (node) => [
737
+ <FilterAction
738
+ key="filter"
739
+ node={node}
740
+ onFilter={onFilter}
741
+ getHierarchyLevelDetails={getHierarchyLevelDetails}
742
+ />,
743
+ <Tree.ItemAction
744
+ key="customAction"
745
+ label="Custom action"
746
+ onClick={() => log(node.label)}
747
+ icon={<Icon href={customIconHref} />}
748
+ />,
749
+ ],
750
+ [onFilter, getHierarchyLevelDetails]
751
+ )}
752
+ />
753
+ );
754
+ ```
755
+
756
+ ### Minor Changes
757
+
758
+ - [#930](https://github.com/iTwin/presentation/pull/930): Exposed `TreeErrorRenderer`, which takes `renderError` property to render custom error messages.
759
+ `TreeRenderer` now takes `errorRenderer` to render a custom error display component.
760
+
761
+ Custom error display component example:
762
+
763
+ ```ts
764
+ <TreeRenderer
765
+ {...treeProps}
766
+ errorRenderer={(errorsRendererProps) => (
767
+ <MyErrorRenderer {...errorsRendererProps} />
768
+ )}
769
+ />
770
+ ```
771
+
772
+ Custom error message example:
773
+
774
+ ```ts
775
+ <TreeRenderer
776
+ {...treeProps}
777
+ errorRenderer={(errorsRendererProps) => (
778
+ <TreeErrorRenderer
779
+ {...errorsRendererProps}
780
+ renderError={(errorProps) => {
781
+ return <unstable_ErrorRegion.Item message={...} />;
782
+ }}
783
+ />
784
+ )}
785
+ />
786
+ ```
787
+
788
+ - [#937](https://github.com/iTwin/presentation/pull/937): `TreeRenderer` now takes `rootErrorRenderer` to render a custom root error display component.
789
+
790
+ Custom error display component example:
791
+
792
+ ```ts
793
+ <TreeRenderer
794
+ {...treeProps}
795
+ rootErrorRenderer={(rootErrorRendererProps) => (
796
+ <MyRootErrorRenderer {...rootErrorRendererProps} />
797
+ )}
798
+ />
799
+ ```
800
+
801
+ - [#930](https://github.com/iTwin/presentation/pull/930): Changed flat tree building functions to hooks:
802
+ - `flattenNodes` => `useFlatTreeNodeList`.
803
+ - `getErrors` => `useErrorList`.
804
+
805
+ ### Patch Changes
806
+
807
+ - [#930](https://github.com/iTwin/presentation/pull/930): Fix `ResultSetTooLarge` error suggesting filtering when parent node is not filterable.
808
+
809
+ ## 2.0.0-alpha.14
810
+
811
+ ### Patch Changes
812
+
813
+ - [#928](https://github.com/iTwin/presentation/pull/928): Memoize tree components to reduce the amount of renders.
814
+
815
+ ## 2.0.0-alpha.13
816
+
817
+ ### Patch Changes
818
+
819
+ - [#924](https://github.com/iTwin/presentation/pull/924): Fix tree error dropdown not applying actions.
820
+
821
+ ## 2.0.0-alpha.12
822
+
823
+ ### Patch Changes
824
+
825
+ - [#922](https://github.com/iTwin/presentation/pull/922): Fix tree displaying aditional scrollbars, when scrolling to the last element with low tree width.
826
+
827
+ ## 2.0.0-alpha.11
828
+
829
+ ### Patch Changes
830
+
831
+ - [#916](https://github.com/iTwin/presentation/pull/916): Fix tree nodes overlapping when nodes with and without sublabel are rendered alongside.
832
+ - [#920](https://github.com/iTwin/presentation/pull/920): Changed error display for node errors to match new design system.
833
+
834
+ ## 2.0.0-alpha.10
835
+
836
+ ### Patch Changes
837
+
838
+ - [#913](https://github.com/iTwin/presentation/pull/913): Removed outline showed after node expander is clicked.
839
+
840
+ ## 2.0.0-alpha.9
841
+
842
+ ### Patch Changes
843
+
844
+ - [#906](https://github.com/iTwin/presentation/pull/906): Replaced `TreeNodeRenderer.getIcon` prop with `getDecorations` prop.
845
+
846
+ The `getIcon` prop took either an icon URI, or a `ReactElement`. The new `getDecorations` prop allows passing multiple React elements, allowing consumers to render not just the icon, but also addition components like a tag or a color swatch. Migration:
847
+
848
+ ```ts
849
+ // previously, when `getIcon` returned a `ReactElement`:
850
+ function myGetIcon(node: PresentationHierarchyNode): React.ReactElement {
851
+ // implementation...
852
+ }
853
+ <TreeNodeRenderer getIcon={myGetIcon} />
854
+
855
+ // now:
856
+ <TreeNodeRenderer getDecorations={myGetIcon} />
857
+
858
+ // previously, when `getIcon` returned an icon URI:
859
+ function myGetIconUri(node: PresentationHierarchyNode): string {
860
+ // implementation...
861
+ }
862
+ <TreeNodeRenderer getIcon={myGetIconUri} />
863
+
864
+ // now:
865
+ <TreeNodeRenderer getDecorations={(node) => <Icon href={myGetIconUri(node)} />} />
866
+ ```
867
+
868
+ - [#911](https://github.com/iTwin/presentation/pull/911): Fix incorrect left padding on tree items
869
+
870
+ ## 2.0.0-alpha.8
871
+
872
+ ### Patch Changes
873
+
874
+ - [#903](https://github.com/iTwin/presentation/pull/903): Added `activeDescription` optional property to TreeItemAction interface, which when provided a value will display a dot above the button indicating an active state. The provided value is used to set accesible description and should explain why the action item is active.
875
+ - [#903](https://github.com/iTwin/presentation/pull/903): Changed `createFilterAction` function to a React hook and renamed it to `useFilterAction`.
876
+
877
+ ## 2.0.0-alpha.7
878
+
879
+ ### Patch Changes
880
+
881
+ - [#892](https://github.com/iTwin/presentation/pull/892): Fix focus outline for tree items not being visible on action items click.
882
+ - [#894](https://github.com/iTwin/presentation/pull/894): Fix `treeRenderer` property `getSublabel` not being used.
883
+
3
884
  ## 2.0.0-alpha.6
4
885
 
5
886
  ### Patch Changes
@@ -32,7 +913,6 @@
32
913
  ### Patch Changes
33
914
 
34
915
  - [#870](https://github.com/iTwin/presentation/pull/870): `TreeRenderer` and `TreeNodeRenderer` now take actions as specification function array.
35
-
36
916
  - `label`: Action item's label.
37
917
  - `action`: The action performed when the button is clicked.
38
918
  - `show` A boolean determining whether the button should be displayed.
@@ -64,6 +944,244 @@
64
944
 
65
945
  - [#847](https://github.com/iTwin/presentation/pull/847): Moving tree rendering components to a new design systems.
66
946
 
947
+ ## 1.9.13
948
+
949
+ ### Patch Changes
950
+
951
+ - [#1242](https://github.com/iTwin/presentation/pull/1242): Bump dependencies.
952
+ - [#1252](https://github.com/iTwin/presentation/pull/1252): Fix tree node outline not appearing on touch devices.
953
+ - Updated dependencies:
954
+ - @itwin/presentation-hierarchies@1.7.11
955
+ - @itwin/presentation-shared@1.2.10
956
+ - @itwin/unified-selection@1.6.8
957
+
958
+ ## 1.9.12
959
+
960
+ ### Patch Changes
961
+
962
+ - [#1215](https://github.com/iTwin/presentation/pull/1215): Update dependencies.
963
+ - Updated dependencies:
964
+ - @itwin/presentation-hierarchies@1.7.10
965
+ - @itwin/presentation-shared@1.2.9
966
+ - @itwin/unified-selection@1.6.7
967
+
968
+ ## 1.9.11
969
+
970
+ ### Patch Changes
971
+
972
+ - [#1208](https://github.com/iTwin/presentation/pull/1208): Bump dependencies.
973
+ - Updated dependencies:
974
+ - @itwin/presentation-hierarchies@1.7.9
975
+ - @itwin/presentation-shared@1.2.8
976
+ - @itwin/unified-selection@1.6.6
977
+
978
+ ## 1.9.10
979
+
980
+ ### Patch Changes
981
+
982
+ - [#1168](https://github.com/iTwin/presentation/pull/1168): Bump dependencies.
983
+ - [#1167](https://github.com/iTwin/presentation/pull/1167): Fix a greedy regular expression in `TreeNodeRenderer` that renders a "result set too large" error node.
984
+ - [#1161](https://github.com/iTwin/presentation/pull/1161): Bump iTwin.js dependencies to `^5.5.0`.
985
+ - Updated dependencies:
986
+ - @itwin/presentation-hierarchies@1.7.8
987
+ - @itwin/presentation-shared@1.2.7
988
+ - @itwin/unified-selection@1.6.5
989
+
990
+ ## 1.9.9
991
+
992
+ ### Patch Changes
993
+
994
+ - [#1160](https://github.com/iTwin/presentation/pull/1160): Fixed tree placeholder node spinner size to match tree node icons.
995
+
996
+ ## 1.9.8
997
+
998
+ ### Patch Changes
999
+
1000
+ - [#1152](https://github.com/iTwin/presentation/pull/1152): Bump dependencies.
1001
+ - Updated dependencies:
1002
+ - @itwin/presentation-hierarchies@1.7.7
1003
+ - @itwin/presentation-shared@1.2.6
1004
+ - @itwin/unified-selection@1.6.4
1005
+
1006
+ ## 1.9.7
1007
+
1008
+ ### Patch Changes
1009
+
1010
+ - [#1139](https://github.com/iTwin/presentation/pull/1139): Bump dependencies.
1011
+ - Updated dependencies:
1012
+ - @itwin/presentation-hierarchies@1.7.6
1013
+ - @itwin/presentation-shared@1.2.5
1014
+ - @itwin/unified-selection@1.6.3
1015
+
1016
+ ## 1.9.6
1017
+
1018
+ ### Patch Changes
1019
+
1020
+ - [#1124](https://github.com/iTwin/presentation/pull/1124): Bump dependencies.
1021
+ - Updated dependencies:
1022
+ - @itwin/unified-selection@1.6.2
1023
+ - @itwin/presentation-hierarchies@1.7.5
1024
+ - @itwin/presentation-shared@1.2.4
1025
+
1026
+ ## 1.9.5
1027
+
1028
+ ### Patch Changes
1029
+
1030
+ - [#1079](https://github.com/iTwin/presentation/pull/1079): Fixed tree node actions background color when node is selected and hovered.
1031
+
1032
+ ## 1.9.4
1033
+
1034
+ ### Patch Changes
1035
+
1036
+ - [#1063](https://github.com/iTwin/presentation/pull/1063): Make sure tree node actions are properly sticking to the right side when scrolling tree horizontally.
1037
+
1038
+ ## 1.9.3
1039
+
1040
+ ### Patch Changes
1041
+
1042
+ - [#1054](https://github.com/iTwin/presentation/pull/1054): Show tooltip with full label on tree nodes.
1043
+
1044
+ ## 1.9.2
1045
+
1046
+ ### Patch Changes
1047
+
1048
+ - [#1039](https://github.com/iTwin/presentation/pull/1039): Bump iTwin.js core dependencies to `^5.1.1`.
1049
+ - Updated dependencies:
1050
+ - @itwin/presentation-hierarchies@1.7.2
1051
+ - @itwin/presentation-shared@1.2.3
1052
+ - @itwin/unified-selection@1.5.1
1053
+
1054
+ ## 1.9.1
1055
+
1056
+ ### Patch Changes
1057
+
1058
+ - [#1033](https://github.com/iTwin/presentation/pull/1033): Fix unified selection tree state hooks `useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree` not handling the recently added `createSelectableForGenericNode` prop.
1059
+
1060
+ ## 1.9.0
1061
+
1062
+ ### Minor Changes
1063
+
1064
+ - [#1027](https://github.com/iTwin/presentation/pull/1027): Added `getActions` property to `TreeRenderer` and `TreeNodeRenderer` to allow providing custom actions for tree nodes.
1065
+
1066
+ ## 1.8.1
1067
+
1068
+ ### Patch Changes
1069
+
1070
+ - Updated dependencies:
1071
+ - @itwin/presentation-hierarchies@1.7.1
1072
+
1073
+ ## 1.8.0
1074
+
1075
+ ### Minor Changes
1076
+
1077
+ - [#1019](https://github.com/iTwin/presentation/pull/1019): Add ability to customize `Selectable` objects that are added to unified selection, when a generic node in a unified selection-driven tree component is selected.
1078
+
1079
+ By default, when a generic node is selected in a unified selection-driven tree component, the `Selectable` that is created for it gets a per-tree unique identifier. This means that a similar generic node somewhere else in the tree or a different tree will not be considered the same. However, in some cases we do want generic nodes to be treated as the same, and for that matter unified selection-enabling tree state hooks now have a new `createSelectableForGenericNode` option:
1080
+
1081
+ ```tsx
1082
+ import { useUnifiedSelectionTree } from "@itwin/presentation-hierarchies-react";
1083
+
1084
+ const treeState = useUnifiedSelectionTree({
1085
+ selectionStorage,
1086
+ createSelectableForGenericNode: useCallback<
1087
+ NonNullable<
1088
+ Props<typeof useUnifiedSelectionTree>["createSelectableForGenericNode"]
1089
+ >
1090
+ >(
1091
+ (node, uniqueId) => ({
1092
+ identifier: node.key.id,
1093
+ data: node,
1094
+ async *loadInstanceKeys() {},
1095
+ }),
1096
+ []
1097
+ ),
1098
+ // ...other options
1099
+ });
1100
+ ```
1101
+
1102
+ ### Patch Changes
1103
+
1104
+ - Updated dependencies:
1105
+ - @itwin/unified-selection@1.5.0
1106
+
1107
+ ## 1.7.2
1108
+
1109
+ ### Patch Changes
1110
+
1111
+ - Updated dependencies:
1112
+ - @itwin/presentation-hierarchies@1.7.0
1113
+
1114
+ ## 1.7.1
1115
+
1116
+ ### Patch Changes
1117
+
1118
+ - Updated dependencies:
1119
+ - @itwin/presentation-hierarchies@1.6.1
1120
+
1121
+ ## 1.7.0
1122
+
1123
+ ### Minor Changes
1124
+
1125
+ - 64e80beaeb87e5797d8238c14fa9cd8dbfcee7c3: Added `abortSignal` to `getFilteredPaths` callback used by `UseTree` hook. This allows to cancel ongoing requests when component is unmounted or new request is started.
1126
+
1127
+ ### Patch Changes
1128
+
1129
+ - Updated dependencies:
1130
+ - @itwin/presentation-hierarchies@1.6.0
1131
+
1132
+ ## 1.6.9
1133
+
1134
+ ### Patch Changes
1135
+
1136
+ - [#1000](https://github.com/iTwin/presentation/pull/1000): Made sure `Apply filter` button becomes focused after hierarchy level filter is applied.
1137
+
1138
+ ## 1.6.8
1139
+
1140
+ ### Patch Changes
1141
+
1142
+ - [#982](https://github.com/iTwin/presentation/pull/982): Update itwinjs-core dependencies to v5.0.0
1143
+ - Updated dependencies:
1144
+ - @itwin/presentation-hierarchies@1.5.1
1145
+ - @itwin/presentation-shared@1.2.2
1146
+ - @itwin/unified-selection@1.4.2
1147
+
1148
+ ## 1.6.7
1149
+
1150
+ ### Patch Changes
1151
+
1152
+ - [#974](https://github.com/iTwin/presentation/pull/974): Removed tree node outline on mobile devices.
1153
+ - Updated dependencies:
1154
+ - @itwin/presentation-hierarchies@1.5.0
1155
+
1156
+ ## 1.6.6
1157
+
1158
+ ### Patch Changes
1159
+
1160
+ - [#944](https://github.com/iTwin/presentation/pull/944): Fixed `extended` selection mode not replacing existing selection when selected node is clicked.
1161
+
1162
+ ## 1.6.5
1163
+
1164
+ ### Patch Changes
1165
+
1166
+ - [#938](https://github.com/iTwin/presentation/pull/938): Fixed hierarchy level size exceeded message that suggest applying filtering on hierarchy levels that do not support filtering.
1167
+
1168
+ ## 1.6.4
1169
+
1170
+ ### Patch Changes
1171
+
1172
+ - [#909](https://github.com/iTwin/presentation/pull/909): Do not use `dev` versions of `@itwin/*` packages.
1173
+ - Updated dependencies:
1174
+ - @itwin/unified-selection@1.4.1
1175
+ - @itwin/presentation-hierarchies@1.4.2
1176
+ - @itwin/presentation-shared@1.2.1
1177
+
1178
+ ## 1.6.3
1179
+
1180
+ ### Patch Changes
1181
+
1182
+ - Updated dependencies:
1183
+ - @itwin/unified-selection@1.4.0
1184
+
67
1185
  ## 1.6.2
68
1186
 
69
1187
  ### Patch Changes
@@ -128,7 +1246,6 @@
128
1246
  ### Minor Changes
129
1247
 
130
1248
  - [#840](https://github.com/iTwin/presentation/pull/840): Added `filterButtonsVisibility` to `treeNodeRenderer`. Which allows configuring filter buttons visibility for the whole tree.
131
-
132
1249
  - `show-on-hover` - default value, shows filter buttons on node hover or focus.
133
1250
  - `hide` - hides filter buttons on focus and hover, but will continue to show buttons on nodes in which filter is applied. Reaching hierarchy limit will continue to provide a way to filter nodes.
134
1251
 
@@ -159,7 +1276,11 @@
159
1276
  Example usage:
160
1277
 
161
1278
  ```tsx
162
- function MyTreeComponentInternal({ imodelAccess }: { imodelAccess: IModelAccess }) {
1279
+ function MyTreeComponentInternal({
1280
+ imodelAccess,
1281
+ }: {
1282
+ imodelAccess: IModelAccess;
1283
+ }) {
163
1284
  const {
164
1285
  rootNodes,
165
1286
  getNode,
@@ -174,18 +1295,22 @@
174
1295
  async (nodeId: string, isExpanded: boolean) => {
175
1296
  const node = getNode(nodeId);
176
1297
  if (node) {
177
- console.log(`${isExpanded ? "Expanding" : "Collapsing"} node: ${node.label}`);
1298
+ console.log(
1299
+ `${isExpanded ? "Expanding" : "Collapsing"} node: ${node.label}`
1300
+ );
178
1301
  }
179
1302
  doExpandNode(nodeId, isExpanded);
180
1303
  },
181
- [getNode, doExpandNode],
1304
+ [getNode, doExpandNode]
182
1305
  );
183
1306
 
184
1307
  // render the tree
185
1308
  if (!rootNodes || !rootNodes.length) {
186
1309
  return "No data to display";
187
1310
  }
188
- return <TreeRenderer {...state} expandNode={expandNode} rootNodes={rootNodes} />;
1311
+ return (
1312
+ <TreeRenderer {...state} expandNode={expandNode} rootNodes={rootNodes} />
1313
+ );
189
1314
  }
190
1315
  ```
191
1316
 
@@ -532,11 +1657,12 @@
532
1657
  const hierarchyLevelDetails = getHierarchyLevelDetails(nodeId);
533
1658
  someFunc(hierarchyLevelDetails);
534
1659
  }}
535
-
536
1660
  // After the change
537
1661
  onNodeClick={(node, isSelected, event) => someFunc(node.id)}
538
1662
  onNodeKeyDown={(node, isSelected, event) => someFunc(node.id)}
539
- onFilterClick={(hierarchyLevelDetails) => someFunc(hierarchyLevelDetails)}
1663
+ onFilterClick={(hierarchyLevelDetails) =>
1664
+ someFunc(hierarchyLevelDetails)
1665
+ }
540
1666
  />
541
1667
  );
542
1668
  }
@@ -569,7 +1695,7 @@
569
1695
  ...props,
570
1696
  onHierarchyLimitExceeded: ({ nodeId, filter, limit }) => {
571
1697
  console.log(`Hierarchy limit of ${limit} exceeded for node ${nodeId}.`);
572
- }
1698
+ },
573
1699
  });
574
1700
  return <TreeRenderer {...state} />;
575
1701
  }
@@ -580,7 +1706,7 @@
580
1706
  ```ts
581
1707
  import { registerTxnListeners } from "@itwin/presentation-core-interop";
582
1708
 
583
- function MyTree({ imodel, ...props}: Props) {
1709
+ function MyTree({ imodel, ...props }: Props) {
584
1710
  const { reloadTree, treeProps } = useTree(props);
585
1711
  useEffect(() => {
586
1712
  // listen for changes in iModel and reload tree
@@ -606,7 +1732,7 @@
606
1732
  ...props,
607
1733
  onPerformanceMeasured: (action, duration) => {
608
1734
  telemetryClient.log(`MyTree [${feature}] took ${duration} ms`);
609
- }
1735
+ },
610
1736
  });
611
1737
  return <TreeRenderer {...state} />;
612
1738
  }