@itwin/presentation-hierarchies-react 2.0.0-alpha.4 → 2.0.0-alpha.40

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 (116) hide show
  1. package/CHANGELOG.md +656 -7
  2. package/README.md +25 -27
  3. package/lib/esm/presentation-hierarchies-react/Renderers.d.ts +85 -0
  4. package/lib/esm/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
  5. package/lib/esm/presentation-hierarchies-react/Renderers.js +6 -0
  6. package/lib/esm/presentation-hierarchies-react/Renderers.js.map +1 -0
  7. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +27 -28
  8. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +1 -1
  9. package/lib/esm/presentation-hierarchies-react/TreeNode.js +1 -7
  10. package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +1 -1
  11. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts +2 -0
  12. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -1
  13. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +1 -1
  14. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +1 -1
  15. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts +24 -0
  16. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
  17. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js +52 -0
  18. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
  19. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +3 -3
  20. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -1
  21. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +1 -8
  22. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -1
  23. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +32 -70
  24. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
  25. package/lib/esm/presentation-hierarchies-react/UseTree.js +48 -49
  26. package/lib/esm/presentation-hierarchies-react/UseTree.js.map +1 -1
  27. package/lib/esm/presentation-hierarchies-react/Utils.d.ts +5 -0
  28. package/lib/esm/presentation-hierarchies-react/Utils.d.ts.map +1 -0
  29. package/lib/esm/presentation-hierarchies-react/Utils.js +23 -0
  30. package/lib/esm/presentation-hierarchies-react/Utils.js.map +1 -0
  31. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +2 -2
  32. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +1 -1
  33. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +31 -16
  34. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
  35. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +24 -6
  36. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +1 -1
  37. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +29 -33
  38. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
  39. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +6 -29
  40. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +1 -1
  41. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +31 -27
  42. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +1 -1
  43. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +23 -9
  44. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
  45. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +16 -29
  46. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
  47. package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +1 -1
  48. package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +1 -1
  49. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +26 -0
  50. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
  51. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +75 -0
  52. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
  53. package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.d.ts +34 -0
  54. package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.d.ts.map +1 -0
  55. package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.js +26 -0
  56. package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.js.map +1 -0
  57. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts +58 -0
  58. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +1 -0
  59. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js +77 -0
  60. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -0
  61. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +123 -0
  62. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -0
  63. package/lib/esm/presentation-hierarchies-react/{itwinui → stratakit}/LocalizationContext.js +15 -5
  64. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -0
  65. package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.d.ts +33 -0
  66. package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.d.ts.map +1 -0
  67. package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.js +39 -0
  68. package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.js.map +1 -0
  69. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +16 -0
  70. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
  71. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +42 -0
  72. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
  73. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +47 -0
  74. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
  75. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +28 -0
  76. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
  77. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +51 -0
  78. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
  79. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +117 -0
  80. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
  81. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +45 -0
  82. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
  83. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js +94 -0
  84. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
  85. package/lib/esm/presentation-hierarchies-react.d.ts +14 -9
  86. package/lib/esm/presentation-hierarchies-react.d.ts.map +1 -1
  87. package/lib/esm/presentation-hierarchies-react.js +11 -8
  88. package/lib/esm/presentation-hierarchies-react.js.map +1 -1
  89. package/package.json +55 -47
  90. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts +0 -15
  91. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts.map +0 -1
  92. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js +0 -22
  93. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js.map +0 -1
  94. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts +0 -20
  95. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts.map +0 -1
  96. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js +0 -30
  97. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js.map +0 -1
  98. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts +0 -73
  99. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts.map +0 -1
  100. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js.map +0 -1
  101. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts +0 -25
  102. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts.map +0 -1
  103. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js +0 -40
  104. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js.map +0 -1
  105. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts +0 -13
  106. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts.map +0 -1
  107. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js +0 -72
  108. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js.map +0 -1
  109. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts +0 -46
  110. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts.map +0 -1
  111. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js +0 -80
  112. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js.map +0 -1
  113. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts +0 -30
  114. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts.map +0 -1
  115. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js +0 -30
  116. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,17 +1,507 @@
1
1
  # @itwin/presentation-hierarchies-react
2
2
 
3
+ ## 2.0.0-alpha.40
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1110](https://github.com/iTwin/presentation/pull/1110): Bump dependencies.
8
+ - Updated dependencies:
9
+ - @itwin/presentation-hierarchies@2.0.0-alpha.5
10
+ - @itwin/presentation-shared@2.0.0-alpha.3
11
+ - @itwin/unified-selection@1.6.2-alpha.0
12
+
13
+ ## 2.0.0-alpha.39
14
+
15
+ ### Minor Changes
16
+
17
+ - [#1106](https://github.com/iTwin/presentation/pull/1106): Added an `id` property to `StrataKitTreeRenderer` that is passed to it's scroll wrapper.
18
+ - [#1107](https://github.com/iTwin/presentation/pull/1107): Introduced new `getClassName` callback to `StrataKitTreeRenderer` and `StrataKitTreeNodeRenderer` for providing class to tree node HTML element.
19
+
20
+ ### Patch Changes
21
+
22
+ - [#1109](https://github.com/iTwin/presentation/pull/1109): Fixed error item Anchor font size.
23
+
24
+ ## 2.0.0-alpha.38
25
+
26
+ ### Patch Changes
27
+
28
+ - [#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.
29
+
30
+ ## 2.0.0-alpha.37
31
+
32
+ ### Major Changes
33
+
34
+ - [#1100](https://github.com/iTwin/presentation/pull/1100): Bumped StrataKit peer dependencies to:
35
+ - `@stratakit/structures`: ^0.5.0
36
+ - `@stratakit/icons`: ^0.2.0
37
+ - `@stratakit/foundations`: ^0.4.0
38
+ - `@stratakit/bricks`: ^0.5.0
39
+
40
+ ## 2.0.0-alpha.36
41
+
42
+ ### Major Changes
43
+
44
+ - [#1094](https://github.com/iTwin/presentation/pull/1094): Improve custom errors rendering API:
45
+ - 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.
46
+ - Exposed `ErrorItemRenderer` that renders all error types supported by the tree.
47
+ - Updated `TreeErrorRenderer` to pass all props necessary to render `ErrorItemRenderer` into `renderError` callback.
48
+
49
+ These changes makes it easier to customize only some types of errors and leave default handling for others.
50
+
51
+ Example:
52
+
53
+ ```tsx
54
+ <StrataKitTreeRenderer
55
+ {...treeProps}
56
+ errorRenderer={(errorProps) => {
57
+ return (
58
+ <TreeErrorRenderer
59
+ {...errorProps}
60
+ renderError={(errorItemProps) => {
61
+ if (errorItemProps.errorItem.errorNode.error.type === "Unknown") {
62
+ return <ErrorRegion.Item message="Custom error" messageId={errorItemProps.errorItem.errorNode.id} />;
63
+ }
64
+ return <ErrorItemRenderer {...errorItemProps} />;
65
+ }}
66
+ />
67
+ );
68
+ }}
69
+ />
70
+ ```
71
+
72
+ ## 2.0.0-alpha.35
73
+
74
+ ### Patch Changes
75
+
76
+ - [#1075](https://github.com/iTwin/presentation/pull/1075): Fix accessibility issues in `<TreeErrorRenderer />`.
77
+
78
+ This involves a few localized string changes:
79
+ - Added `issuesForTree`, defaulting to "Issues for {{tree_label}}.", used as a region landmark label for the error message container.
80
+ - Added `noIssuesFound`, defaulting to "No issues found.", used as a label for errors' list when there are no issues.
81
+ - 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.
82
+
83
+ 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.
84
+
85
+ ## 2.0.0-alpha.34
86
+
87
+ ### Patch Changes
88
+
89
+ - [#1068](https://github.com/iTwin/presentation/pull/1068): Extend `@stratakit` peer dependency range to support the latest versions
90
+
91
+ ## 2.0.0-alpha.33
92
+
93
+ ### Patch Changes
94
+
95
+ - [#1057](https://github.com/iTwin/presentation/pull/1057): Change `useNodeHighlighting` hook to only highlight nodes that are filter targets.
96
+
97
+ ## 2.0.0-alpha.32
98
+
99
+ ### Patch Changes
100
+
101
+ - [#1045](https://github.com/iTwin/presentation/pull/1045): Fix highlight matching in `useNodeHighlighting` hook. Highlighting now works when the `highlightText` contains special characters (`[`, `+`, `*`, etc.).
102
+
103
+ ## 2.0.0-alpha.31
104
+
105
+ ### Patch Changes
106
+
107
+ - [#1042](https://github.com/iTwin/presentation/pull/1042): Version bump
108
+ - [#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.
109
+
110
+ Example usage:
111
+
112
+ ```ts
113
+ import { StrataKitTreeRenderer, useNodeHighlighting } from "@itwin/presentation-hierarchies-react";
114
+
115
+ type BaseTreeRendererProps = React.ComponentPropsWithoutRef<typeof StrataKitTreeRenderer>;
116
+
117
+ function MyComponent(props: BaseTreeRendererProps & { searchText: string }) {
118
+ // Create highlight based on searchText
119
+ const highlightText = props.searchText !== "" ? props.searchText : undefined;
120
+ const { getLabel } = useNodeHighlighting({ highlightText });
121
+
122
+ // Provide getLabel function to tree renderer
123
+ return <StrataKitTreeRenderer {...props} getLabel={getLabel} />;
124
+ }
125
+ ```
126
+
127
+ - Updated dependencies:
128
+ - @itwin/presentation-hierarchies@2.0.0-alpha.4
129
+ - @itwin/presentation-shared@2.0.0-alpha.2
130
+ - @itwin/unified-selection@1.5.1-alpha.1
131
+
132
+ ## 2.0.0-alpha.30
133
+
134
+ ### Patch Changes
135
+
136
+ - [#1037](https://github.com/iTwin/presentation/pull/1037): Added additional documentation for `RenameAction`
137
+
138
+ ## 2.0.0-alpha.29
139
+
140
+ ### Patch Changes
141
+
142
+ - [#1035](https://github.com/iTwin/presentation/pull/1035): Version bump after merge from `master`.
143
+
144
+ ## 2.0.0-alpha.28
145
+
146
+ ### Patch Changes
147
+
148
+ - [#1031](https://github.com/iTwin/presentation/pull/1031): Version bump
149
+ - Updated dependencies:
150
+ - @itwin/presentation-hierarchies@2.0.0-alpha.3
151
+ - @itwin/unified-selection@1.5.1-alpha.0
152
+
153
+ ## 2.0.0-alpha.27
154
+
155
+ ### Patch Changes
156
+
157
+ - [#1026](https://github.com/iTwin/presentation/pull/1026): Fix `reserveSpace` property being required instead of optional for `FilterAction` and `RenameAction`.
158
+
159
+ ## 2.0.0-alpha.26
160
+
161
+ ### Major Changes
162
+
163
+ - [#1023](https://github.com/iTwin/presentation/pull/1023): Split `getActions` into `getMenuActions` & `getInlineActions` for `StrataKitTreeRenderer` and `StrataKitTreeNodeRenderer`.
164
+
165
+ Updated peer dependencies:
166
+ - @stratakit/bricks@0.3.3
167
+ - @stratakit/foundations@0.2.2
168
+ - @stratakit/structures@0.3.1
169
+
170
+ Added `reserveSpace` property to `FilterAction` and `RenameAction`, which reserves space for the action when it is not available
171
+
172
+ ### Minor Changes
173
+
174
+ - [#1007](https://github.com/iTwin/presentation/pull/1007): Renames:
175
+ `FlatNode` => `FlatTreeNodeItem`
176
+ `FlatTreeNode` => `FlatTreeItem`
177
+ `PlaceholderNode` => `PlaceholderItem`
178
+ `useFlatTreeNodeList` => `useFlatTreeItems`
179
+
180
+ Changed `FlatTreeNodeItem` (previously `FlatNode`) to have property `node: PresentationHierarchyNode` instead of extending `PresentationHierarchyNode`.
181
+
182
+ ### Patch Changes
183
+
184
+ - Updated dependencies:
185
+ - @itwin/presentation-hierarchies@2.0.0-alpha.2
186
+
187
+ ## 2.0.0-alpha.25
188
+
189
+ ### Patch Changes
190
+
191
+ - Updated dependencies:
192
+ - @itwin/presentation-hierarchies@2.0.0-alpha.1
193
+ - @itwin/presentation-shared@2.0.0-alpha.1
194
+ - @itwin/unified-selection@1.4.3-alpha.0
195
+
196
+ ## 2.0.0-alpha.24
197
+
198
+ ### Patch Changes
199
+
200
+ - [#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.
201
+ - [#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.
202
+
203
+ ## 2.0.0-alpha.23
204
+
205
+ ### Minor Changes
206
+
207
+ - [#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.
208
+
209
+ ## 2.0.0-alpha.22
210
+
211
+ ### Minor Changes
212
+
213
+ - [#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.
214
+
215
+ ## 2.0.0-alpha.21
216
+
217
+ ### Major Changes
218
+
219
+ - [#961](https://github.com/iTwin/presentation/pull/961): **Breaking changes** to tree state hooks `useTree`, `useUnifiedSelectionTree`, `useIModelTree`, `useIModelUnifiedSelectionTree`:
220
+ - All tree rendering props have been moved under `treeRendererProps`. The value can be passed to `<StrataKitTreeRenderer />` component.
221
+ - 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.
222
+ - The `isLoading` attribute has been renamed to `isReloading`.
223
+ - Errors are no longer defined as children of `PresentationHierarchyNode` and instead are now included as `error` attribute for more fluent API.
224
+
225
+ When rendering tree state, the recommended order of checks is:
226
+ 1. If `rootErrorRendererProps` is defined, there was an error - render error state.
227
+ 2. If `treeRendererProps` is not defined, the component is doing the initial load - render loading state.
228
+ 3. If `treeRendererProps` is defined, the hierarchy is loaded - render the tree component.
229
+
230
+ 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.
231
+
232
+ Example:
233
+
234
+ ```ts
235
+ function MyComponent () {
236
+ const useTreeResult = useIModelUnifiedSelectionTree({...});
237
+
238
+ // handle possible root errors with our provided component or your own custom implementation
239
+ if (treeProps.rootErrorRendererProps) {
240
+ return <StrataKitRootErrorRenderer {...useTreeResult.rootErrorRendererProps} />;
241
+ }
242
+
243
+ // handle loading state
244
+ if (!treeProps.treeRendererProps) {
245
+ return <MyLoadingComponent />;
246
+ }
247
+
248
+ // handle loaded hierarchy
249
+ return <StrataKitTreeRenderer {...useTreeResult.treeProps} />;
250
+ }
251
+ ```
252
+
253
+ ## 2.0.0-alpha.20
254
+
255
+ ### Major Changes
256
+
257
+ - [#965](https://github.com/iTwin/presentation/pull/965): Added `@stratakit/structures` as a peer dependency.
258
+
259
+ ## 2.0.0-alpha.19
260
+
261
+ ### Major Changes
262
+
263
+ - [#954](https://github.com/iTwin/presentation/pull/954): Add additional requirements for types in `EC` metadata namespace, whose objects are returned by `ECSchemaProvider`.
264
+ - `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.
265
+ - `EC.Class` now additionally has these members:
266
+ - `baseClass: Promise<Class | undefined>`
267
+ - `getDerivedClasses(): Promise<Class[]>`
268
+
269
+ 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.
270
+
271
+ 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`.
272
+
273
+ ### Patch Changes
274
+
275
+ - [#957](https://github.com/iTwin/presentation/pull/957): Avoid leaking custom props to the `PlaceholderNode` that are causing console errors.
276
+ - Updated dependencies:
277
+ - @itwin/presentation-hierarchies@2.0.0-alpha.0
278
+ - @itwin/presentation-shared@2.0.0-alpha.0
279
+ - @itwin/unified-selection@1.4.2-alpha.0
280
+
281
+ ## 2.0.0-alpha.18
282
+
283
+ ### Major Changes
284
+
285
+ - [#951](https://github.com/iTwin/presentation/pull/951): Move from `@itwin/itwinui-react@5.0.0-alpha` to `@stratakit/*` packages.
286
+
287
+ ## 2.0.0-alpha.17
288
+
289
+ ### Patch Changes
290
+
291
+ - [#949](https://github.com/iTwin/presentation/pull/949): Use default imports instead of `URL` constructor for icons.
292
+
293
+ ## 2.0.0-alpha.16
294
+
295
+ ### Minor Changes
296
+
297
+ - [#945](https://github.com/iTwin/presentation/pull/945): Re-export `getLogger` and `setLogger` functions from `@itwin/presentation-hierarchies` to allow setting a logger.
298
+
299
+ ## 2.0.0-alpha.15
300
+
301
+ ### Major Changes
302
+
303
+ - [#942](https://github.com/iTwin/presentation/pull/942): Unified selection API cleanup.
304
+ - Remove deprecated `UnifiedSelectionProvider`.
305
+ - Make `selectionStorage` prop required for unified selection - enabled tree state hooks (`useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree`).
306
+
307
+ 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.
308
+
309
+ 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.
310
+
311
+ - [#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.
312
+
313
+ Before:
314
+
315
+ ```tsx
316
+ import { TreeNodeRenderer, useFilterAction } from "@itwin/presentation-hierarchies-react";
317
+
318
+ const filterAction = useFilterAction({ onFilter, getHierarchyLevelDetails });
319
+ return (
320
+ <TreeNodeRenderer
321
+ actions={useMemo(
322
+ () => [
323
+ filterAction,
324
+ (node) => ({
325
+ label: "Custom Action",
326
+ actions: () => log(node.label),
327
+ icon: customIconHref,
328
+ }),
329
+ ],
330
+ [filterAction],
331
+ )}
332
+ />
333
+ );
334
+ ```
335
+
336
+ After:
337
+
338
+ ```tsx
339
+ import { Icon, Tree } from "@itwin/itwinui-react";
340
+ import { FilterAction, TreeNodeRenderer } from "@itwin/presentation-hierarchies-react";
341
+
342
+ return (
343
+ <TreeNodeRenderer
344
+ getActions={useCallback(
345
+ (node) => [
346
+ <FilterAction key="filter" node={node} onFilter={onFilter} getHierarchyLevelDetails={getHierarchyLevelDetails} />,
347
+ <Tree.ItemAction key="customAction" label="Custom action" onClick={() => log(node.label)} icon={<Icon href={customIconHref} />} />,
348
+ ],
349
+ [onFilter, getHierarchyLevelDetails],
350
+ )}
351
+ />
352
+ );
353
+ ```
354
+
355
+ ### Minor Changes
356
+
357
+ - [#930](https://github.com/iTwin/presentation/pull/930): Exposed `TreeErrorRenderer`, which takes `renderError` property to render custom error messages.
358
+ `TreeRenderer` now takes `errorRenderer` to render a custom error display component.
359
+
360
+ Custom error display component example:
361
+
362
+ ```ts
363
+ <TreeRenderer
364
+ {...treeProps}
365
+ errorRenderer={(errorsRendererProps) => (
366
+ <MyErrorRenderer {...errorsRendererProps} />
367
+ )}
368
+ />
369
+ ```
370
+
371
+ Custom error message example:
372
+
373
+ ```ts
374
+ <TreeRenderer
375
+ {...treeProps}
376
+ errorRenderer={(errorsRendererProps) => (
377
+ <TreeErrorRenderer
378
+ {...errorsRendererProps}
379
+ renderError={(errorProps) => {
380
+ return <unstable_ErrorRegion.Item message={...} />;
381
+ }}
382
+ />
383
+ )}
384
+ />
385
+ ```
386
+
387
+ - [#937](https://github.com/iTwin/presentation/pull/937): `TreeRenderer` now takes `rootErrorRenderer` to render a custom root error display component.
388
+
389
+ Custom error display component example:
390
+
391
+ ```ts
392
+ <TreeRenderer
393
+ {...treeProps}
394
+ rootErrorRenderer={(rootErrorRendererProps) => (
395
+ <MyRootErrorRenderer {...rootErrorRendererProps} />
396
+ )}
397
+ />
398
+ ```
399
+
400
+ - [#930](https://github.com/iTwin/presentation/pull/930): Changed flat tree building functions to hooks:
401
+ - `flattenNodes` => `useFlatTreeNodeList`.
402
+ - `getErrors` => `useErrorList`.
403
+
404
+ ### Patch Changes
405
+
406
+ - [#930](https://github.com/iTwin/presentation/pull/930): Fix `ResultSetTooLarge` error suggesting filtering when parent node is not filterable.
407
+
408
+ ## 2.0.0-alpha.14
409
+
410
+ ### Patch Changes
411
+
412
+ - [#928](https://github.com/iTwin/presentation/pull/928): Memoize tree components to reduce the amount of renders.
413
+
414
+ ## 2.0.0-alpha.13
415
+
416
+ ### Patch Changes
417
+
418
+ - [#924](https://github.com/iTwin/presentation/pull/924): Fix tree error dropdown not applying actions.
419
+
420
+ ## 2.0.0-alpha.12
421
+
422
+ ### Patch Changes
423
+
424
+ - [#922](https://github.com/iTwin/presentation/pull/922): Fix tree displaying aditional scrollbars, when scrolling to the last element with low tree width.
425
+
426
+ ## 2.0.0-alpha.11
427
+
428
+ ### Patch Changes
429
+
430
+ - [#916](https://github.com/iTwin/presentation/pull/916): Fix tree nodes overlapping when nodes with and without sublabel are rendered alongside.
431
+ - [#920](https://github.com/iTwin/presentation/pull/920): Changed error display for node errors to match new design system.
432
+
433
+ ## 2.0.0-alpha.10
434
+
435
+ ### Patch Changes
436
+
437
+ - [#913](https://github.com/iTwin/presentation/pull/913): Removed outline showed after node expander is clicked.
438
+
439
+ ## 2.0.0-alpha.9
440
+
441
+ ### Patch Changes
442
+
443
+ - [#906](https://github.com/iTwin/presentation/pull/906): Replaced `TreeNodeRenderer.getIcon` prop with `getDecorations` prop.
444
+
445
+ 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:
446
+
447
+ ```ts
448
+ // previously, when `getIcon` returned a `ReactElement`:
449
+ function myGetIcon(node: PresentationHierarchyNode): React.ReactElement {
450
+ // implementation...
451
+ }
452
+ <TreeNodeRenderer getIcon={myGetIcon} />
453
+
454
+ // now:
455
+ <TreeNodeRenderer getDecorations={myGetIcon} />
456
+
457
+ // previously, when `getIcon` returned an icon URI:
458
+ function myGetIconUri(node: PresentationHierarchyNode): string {
459
+ // implementation...
460
+ }
461
+ <TreeNodeRenderer getIcon={myGetIconUri} />
462
+
463
+ // now:
464
+ <TreeNodeRenderer getDecorations={(node) => <Icon href={myGetIconUri(node)} />} />
465
+ ```
466
+
467
+ - [#911](https://github.com/iTwin/presentation/pull/911): Fix incorrect left padding on tree items
468
+
469
+ ## 2.0.0-alpha.8
470
+
471
+ ### Patch Changes
472
+
473
+ - [#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.
474
+ - [#903](https://github.com/iTwin/presentation/pull/903): Changed `createFilterAction` function to a React hook and renamed it to `useFilterAction`.
475
+
476
+ ## 2.0.0-alpha.7
477
+
478
+ ### Patch Changes
479
+
480
+ - [#892](https://github.com/iTwin/presentation/pull/892): Fix focus outline for tree items not being visible on action items click.
481
+ - [#894](https://github.com/iTwin/presentation/pull/894): Fix `treeRenderer` property `getSublabel` not being used.
482
+
483
+ ## 2.0.0-alpha.6
484
+
485
+ ### Patch Changes
486
+
487
+ - [#890](https://github.com/iTwin/presentation/pull/890): Fix alpha peer dependencies to no longer have caret.
488
+
489
+ ## 2.0.0-alpha.5
490
+
491
+ ### Minor Changes
492
+
493
+ - [#883](https://github.com/iTwin/presentation/pull/883): Trees rendered with `TreeRenderer` will now be virtualized.
494
+
3
495
  ## 2.0.0-alpha.4
4
496
 
5
497
  ### Minor Changes
6
498
 
7
499
  - [#878](https://github.com/iTwin/presentation/pull/878): Tree node renderer now uses `Tree.ItemAction`. `Show` property now takes in undefined values, values behave like this:
8
-
9
500
  - `undefined` - visible on hover/focus,
10
501
  - `true` - visible at all times,
11
502
  - `false` - hidden at all times.
12
503
 
13
504
  Updated peer dependencies:
14
-
15
505
  - itwinui-icons to 5.0.0-alpha.3,
16
506
  - itwinui-react to 5.0.0-alpha.6,
17
507
 
@@ -20,7 +510,6 @@
20
510
  ### Patch Changes
21
511
 
22
512
  - [#870](https://github.com/iTwin/presentation/pull/870): `TreeRenderer` and `TreeNodeRenderer` now take actions as specification function array.
23
-
24
513
  - `label`: Action item's label.
25
514
  - `action`: The action performed when the button is clicked.
26
515
  - `show` A boolean determining whether the button should be displayed.
@@ -42,7 +531,6 @@
42
531
  - [#862](https://github.com/iTwin/presentation/pull/862): Update `@itwin/itwinui-react` dependency to `5.0.0-alpha.3`.
43
532
 
44
533
  This fixes the following issues:
45
-
46
534
  - nodes being selected on expand,
47
535
  - node action buttons being rendered incorrectly.
48
536
 
@@ -52,12 +540,175 @@
52
540
 
53
541
  - [#847](https://github.com/iTwin/presentation/pull/847): Moving tree rendering components to a new design systems.
54
542
 
543
+ ## 1.9.5
544
+
545
+ ### Patch Changes
546
+
547
+ - [#1079](https://github.com/iTwin/presentation/pull/1079): Fixed tree node actions background color when node is selected and hovered.
548
+
549
+ ## 1.9.4
550
+
551
+ ### Patch Changes
552
+
553
+ - [#1063](https://github.com/iTwin/presentation/pull/1063): Make sure tree node actions are properly sticking to the right side when scrolling tree horizontally.
554
+
555
+ ## 1.9.3
556
+
557
+ ### Patch Changes
558
+
559
+ - [#1054](https://github.com/iTwin/presentation/pull/1054): Show tooltip with full label on tree nodes.
560
+
561
+ ## 1.9.2
562
+
563
+ ### Patch Changes
564
+
565
+ - [#1039](https://github.com/iTwin/presentation/pull/1039): Bump iTwin.js core dependencies to `^5.1.1`.
566
+ - Updated dependencies:
567
+ - @itwin/presentation-hierarchies@1.7.2
568
+ - @itwin/presentation-shared@1.2.3
569
+ - @itwin/unified-selection@1.5.1
570
+
571
+ ## 1.9.1
572
+
573
+ ### Patch Changes
574
+
575
+ - [#1033](https://github.com/iTwin/presentation/pull/1033): Fix unified selection tree state hooks `useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree` not handling the recently added `createSelectableForGenericNode` prop.
576
+
577
+ ## 1.9.0
578
+
579
+ ### Minor Changes
580
+
581
+ - [#1027](https://github.com/iTwin/presentation/pull/1027): Added `getActions` property to `TreeRenderer` and `TreeNodeRenderer` to allow providing custom actions for tree nodes.
582
+
583
+ ## 1.8.1
584
+
585
+ ### Patch Changes
586
+
587
+ - Updated dependencies:
588
+ - @itwin/presentation-hierarchies@1.7.1
589
+
590
+ ## 1.8.0
591
+
592
+ ### Minor Changes
593
+
594
+ - [#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.
595
+
596
+ 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:
597
+
598
+ ```tsx
599
+ import { useUnifiedSelectionTree } from "@itwin/presentation-hierarchies-react";
600
+
601
+ const treeState = useUnifiedSelectionTree({
602
+ selectionStorage,
603
+ createSelectableForGenericNode: useCallback<NonNullable<Props<typeof useUnifiedSelectionTree>["createSelectableForGenericNode"]>>(
604
+ (node, uniqueId) => ({ identifier: node.key.id, data: node, async *loadInstanceKeys() {} }),
605
+ [],
606
+ ),
607
+ // ...other options
608
+ });
609
+ ```
610
+
611
+ ### Patch Changes
612
+
613
+ - Updated dependencies:
614
+ - @itwin/unified-selection@1.5.0
615
+
616
+ ## 1.7.2
617
+
618
+ ### Patch Changes
619
+
620
+ - Updated dependencies:
621
+ - @itwin/presentation-hierarchies@1.7.0
622
+
623
+ ## 1.7.1
624
+
625
+ ### Patch Changes
626
+
627
+ - Updated dependencies:
628
+ - @itwin/presentation-hierarchies@1.6.1
629
+
630
+ ## 1.7.0
631
+
632
+ ### Minor Changes
633
+
634
+ - 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.
635
+
636
+ ### Patch Changes
637
+
638
+ - Updated dependencies:
639
+ - @itwin/presentation-hierarchies@1.6.0
640
+
641
+ ## 1.6.9
642
+
643
+ ### Patch Changes
644
+
645
+ - [#1000](https://github.com/iTwin/presentation/pull/1000): Made sure `Apply filter` button becomes focused after hierarchy level filter is applied.
646
+
647
+ ## 1.6.8
648
+
649
+ ### Patch Changes
650
+
651
+ - [#982](https://github.com/iTwin/presentation/pull/982): Update itwinjs-core dependencies to v5.0.0
652
+ - Updated dependencies:
653
+ - @itwin/presentation-hierarchies@1.5.1
654
+ - @itwin/presentation-shared@1.2.2
655
+ - @itwin/unified-selection@1.4.2
656
+
657
+ ## 1.6.7
658
+
659
+ ### Patch Changes
660
+
661
+ - [#974](https://github.com/iTwin/presentation/pull/974): Removed tree node outline on mobile devices.
662
+ - Updated dependencies:
663
+ - @itwin/presentation-hierarchies@1.5.0
664
+
665
+ ## 1.6.6
666
+
667
+ ### Patch Changes
668
+
669
+ - [#944](https://github.com/iTwin/presentation/pull/944): Fixed `extended` selection mode not replacing existing selection when selected node is clicked.
670
+
671
+ ## 1.6.5
672
+
673
+ ### Patch Changes
674
+
675
+ - [#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.
676
+
677
+ ## 1.6.4
678
+
679
+ ### Patch Changes
680
+
681
+ - [#909](https://github.com/iTwin/presentation/pull/909): Do not use `dev` versions of `@itwin/*` packages.
682
+ - Updated dependencies:
683
+ - @itwin/unified-selection@1.4.1
684
+ - @itwin/presentation-hierarchies@1.4.2
685
+ - @itwin/presentation-shared@1.2.1
686
+
687
+ ## 1.6.3
688
+
689
+ ### Patch Changes
690
+
691
+ - Updated dependencies:
692
+ - @itwin/unified-selection@1.4.0
693
+
694
+ ## 1.6.2
695
+
696
+ ### Patch Changes
697
+
698
+ - [#873](https://github.com/iTwin/presentation/pull/873): Fix hierarchy level size exceeds limit info message wrapping in narrow Tree on Safari browser.
699
+ - [#873](https://github.com/iTwin/presentation/pull/873): Do not require two clicks to expand node with filter buttons on touch devices.
700
+
701
+ ## 1.6.1
702
+
703
+ ### Patch Changes
704
+
705
+ - [#866](https://github.com/iTwin/presentation/pull/866): Updated hierarchy level size exceeded info message styling in narrow tree component to avoid cutting out text.
706
+
55
707
  ## 1.6.0
56
708
 
57
709
  ### Minor Changes
58
710
 
59
711
  - [#841](https://github.com/iTwin/presentation/pull/841): Changed how tree state hooks access unified selection storage.
60
-
61
712
  - The tree state hooks that hook into unified selection system now accept a `selectionStorage` prop. At the moment the prop is optional, but will be made required in the next major release of the package.
62
713
  - The `UnifiedSelectionProvider` React context provider is now deprecated. The context is still used by tree state hooks if the selection storage is not provided through prop.
63
714
 
@@ -103,7 +754,6 @@
103
754
  ### Minor Changes
104
755
 
105
756
  - [#840](https://github.com/iTwin/presentation/pull/840): Added `filterButtonsVisibility` to `treeNodeRenderer`. Which allows configuring filter buttons visibility for the whole tree.
106
-
107
757
  - `show-on-hover` - default value, shows filter buttons on node hover or focus.
108
758
  - `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.
109
759
 
@@ -314,7 +964,6 @@
314
964
  See "Basic example" section in README learning page for the full example.
315
965
 
316
966
  - [#717](https://github.com/iTwin/presentation/pull/717): **BREAKING:** Add support for non-iModel-driven trees.
317
-
318
967
  - `useTree` and `useUnifiedSelectionTree` hooks have been changed to support non-iModel-driven trees. The hooks take a `getHierarchyProvider` prop, which returns a `HierarchyProvider`. The provider can return data from any data source.
319
968
  - New `useIModelTree` and `useIModelUnifiedSelectionTree` hooks have been added to cover the most common case, where a tree is created from a iModel's data. The API of these hooks is exactly the same as of the old `useTree` and `useUnifiedSelectionTree` hooks.
320
969