# @itwin/presentation-hierarchies-react

## 2.0.2

### Patch Changes

- [#1709](https://github.com/iTwin/presentation/pull/1709): Update iTwin.js Core dependencies to `5.14.5`.
- [#1709](https://github.com/iTwin/presentation/pull/1709): Update StrataKit & `@tanstack/react-virtual` dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@2.1.0
  - @itwin/presentation-shared@2.2.0
  - @itwin/unified-selection@2.0.2

## 2.0.1

### Patch Changes

- [#1672](https://github.com/iTwin/presentation/pull/1672): Bump `@tanstack/react-virtual` dependency to `3.14.22`.
- [#1672](https://github.com/iTwin/presentation/pull/1672): Bump iTwin.js Core dependencies to `5.14.4`.
- [#1675](https://github.com/iTwin/presentation/pull/1675): `StrataKitTreeRenderer`: Fixed the node label editor being positioned incorrectly due to usage of spacing tokens that were removed in `@stratakit/foundations@1.0.0`.
- Updated dependencies:
  - @itwin/presentation-shared@2.1.0
  - @itwin/presentation-hierarchies@2.0.1
  - @itwin/unified-selection@2.0.1

## 2.0.0

### Major Changes

- 3696e4e01a67c41216adaf4fd0469dbcf87ab232: Tree rendering components now build on the StrataKit design system (with MUI) instead of iTwinUI.
  
  As a result, the package now declares `@stratakit/icons@^0.4.7`, `@stratakit/foundations@^1.0.4`, `@stratakit/mui@^1.2.0` and `@mui/material@^9.5.0` as optional peer dependencies. Applications that use these components must add the three packages to their own `dependencies`; libraries that re-export the components should forward them as peer dependencies.
- de7d3b9556a438d64e4457e780b0f1eda3b0d8d4: `StrataKitTreeRenderer` exposes per-node action callbacks `getInlineActions`, `getMenuActions` and `getContextMenuActions`. Each receives `{ targetNode: TreeNode; selectedNodes: TreeNode[] }`, so actions can be applied to the target node or to all selected nodes.
  
  ```tsx
  return <StrataKitTreeRenderer
    getInlineActions={({ targetNode }) => [
      <InlineAction node={targetNode} />
    ]}
    getMenuActions={({ targetNode }) => [
      <MenuAction node={targetNode} />
    ]}
  />
  ```
- 009368e05bf0696a39b1edc3c1573fa808fcadb1: 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.
  
  Example:
  ```tsx
  import { StrataKitTreeRenderer, StrataKitTreeRendererAttributes } from "@itwin/presentation-hierarchies-react/stratakit";
  
  function MyTree() {
    const treeRef = useRef<StrataKitTreeRendererAttributes>(null);
  
    return (
      <>
        <div className="tree-header">
          <button
            onClick={() => {
              treeRef.current?.renameNode((node) => node.label === "Node to rename");
            }}
          >
            Rename node
          </button>
        </div>
        <StrataKitTreeRenderer ref={treeRef} />
      </>
    );
  }
  ```
- 2763fe9d437088c6906207a85eb73b66f0e5639c: Rename `PresentationHierarchyNode` to `TreeNode` for clarity.
  
  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.
- a40d5a3a1192853a2c5af3e9608842e06105139e: 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.
  
  - `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).
  - `LOCALIZATION_NAMESPACES` must be registered with your localization provider during app initialization to make localized strings available.
- 6aef711266d26ef3587736150c3b0ccc5e82c68a: 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.
- 8436f7e40f108d7546e08191062792ddb2c2d53a: Tree node rename UI shows the label editor in a popover, with support for a hint describing allowed characters and validation of the new label.
  
  Example:
  ```tsx
  type TreeRendererProps = ComponentProps<typeof StrataKitTreeRenderer>;
  
  const getEditingProps = useCallback<Required<TreeRendererProps>["getEditingProps"]>((node) => {
    return {
      onLabelChanged: (newLabel: string) => {
        // Handle label change
      },
      labelValidationHint: `Allowed are A to Z, 0 to 9, "-" and "_"`,
      validate: (newLabel: string) => /^[A-Za-z0-9\- ]+$/.test(newLabel),
    };
  }, []);
  
  return <StrataKitTreeRenderer {...treeProps} getEditingProps={getEditingProps} />;
  ```
- e7ed0fe883be8177954ef0861458d7242dc4460f: Improve custom errors rendering API:
  
  - Separated the `ChildrenLoad` error from the `Generic` error. All expected tree errors have a dedicated type, and the `Generic` error can be used to handle custom errors encountered outside of the tree.
  - Exposed `ErrorItemRenderer` that renders all error types supported by the tree.
  - Updated `TreeErrorRenderer` to pass all props necessary to render `ErrorItemRenderer` into the `renderError` callback.
  
  These changes make it easier to customize only some types of errors and leave default handling for others.
  
  Example:
  ```tsx
  <StrataKitTreeRenderer
    {...treeProps}
    errorRenderer={(errorProps) => {
      return (
        <TreeErrorRenderer
          {...errorProps}
          renderError={(errorItemProps) => {
            if (errorItemProps.error.type === "Generic") {
              return <ErrorRegion.Item message="Custom error" messageId={errorItemProps.treeNode.id} />;
            }
            return <ErrorItemRenderer {...errorItemProps} />;
          }}
        />
      );
    }}
  />
  ```
- 7d413f16022c328a90d3612041c1142672b4048b: Unified selection API cleanup.
  
  - Remove deprecated `UnifiedSelectionProvider`.
  - Make `selectionStorage` prop required for unified selection - enabled tree state hooks (`useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree`).
  
  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.
  
  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.
- a3d12518b05b062c9bc08203100d13388a21cc91: Start using tree structure for defining hierarchy search paths.
  
  The `getFilteredPaths` callback prop of tree hooks (`useTree`, `useUnifiedSelectionTree`, `useIModelTree`, `useIModelUnifiedSelectionTree`) has been renamed to `getSearchPaths`, and its return type changed from `Promise<HierarchyFilteringPath[] | undefined>` to `Promise<HierarchySearchTree[] | undefined>`. The newly added `HierarchySearchTree.createFromPathsList` from `@itwin/presentation-hierarchies` can be used to do the conversion:
  
  ```tsx
  import { HierarchySearchTree } from "@itwin/presentation-hierarchies";
  
  function MyTree() {
    const [searchText, setSearchText] = useState("");
    const treeProps = useIModelUnifiedSelectionTree({
      // ...
      getSearchPaths: useMemo<UseIModelTreeProps["getSearchPaths"]>(() => {
        return async () => {
          // before: `getFilteredPaths` returned the paths directly:
          return getSearchTargetPaths({ searchText });
          // after: convert the paths into a `HierarchySearchTree`:
          return HierarchySearchTree.createFromPathsList(await getSearchTargetPaths({ searchText }));
        };
      }, [searchText]),
    });
  
    // ...
  
    return (
      <StrataKitTreeRenderer
        {...treeProps.treeRendererProps}
        // ...
      />
    );
  }
  ```
- 8e87d3452a6af627efe201623ebc0d2812824639: Improved API of `useTree`, `useUnifiedSelectionTree`, `useIModelTree` and `useIModelUnifiedSelectionTree` tree state hooks.
  
  - All tree rendering props have been moved under `treeRendererProps`. The value can be passed to `<StrataKitTreeRenderer />` component.
  - 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.
  
  When rendering tree state, the recommended order of checks is:
  1. If `rootErrorRendererProps` is defined, there was an error - render error state.
  2. If `treeRendererProps` is not defined, the component is doing the initial load - render loading state.
  3. If `treeRendererProps` is defined, the hierarchy is loaded - render the tree component.
  
     The `isLoading` 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.
  
  Example:
  
  ```ts
  function MyComponent () {
      const useTreeResult = useIModelUnifiedSelectionTree({...});
  
      // handle possible root errors with our provided component or your own custom implementation
      if (useTreeResult.rootErrorRendererProps) {
        return <StrataKitRootErrorRenderer {...useTreeResult.rootErrorRendererProps} />;
      }
  
      // handle loading state
      if (!useTreeResult.treeRendererProps) {
        return <MyLoadingComponent />;
      }
  
      // handle loaded hierarchy
      return <StrataKitTreeRenderer {...useTreeResult.treeRendererProps} />;
  }
  ```
- 43b242db1bdc43f3e6c0e39f6d9ca7c5ce2c5bd8: Tree nodes expose their errors through a `TreeNode.errors: ErrorInfo[]` attribute instead of separate info child nodes. Both internal errors and custom errors provided through the `getTreeNodeErrors` callback of `useTree` (and its variants) are combined in this attribute.
- 1652c3a964684db82502a6c32f4d7b64ef0e996b: Unified tree actions handling to make it easier to define actions that can be reused in different contexts: inline, context menu and actions dropdown. Custom tree actions are rendered with the newly introduced `TreeActionBase` component (instead of `Tree.ItemAction`), which automatically infers the context it's used in.

### Minor Changes

- 47a5be7aeb216636fcf4377296afb417dc29132b: Added `TreeNodeFilterAction` and `TreeNodeRenameAction` components for rendering hierarchy level filtering and node renaming actions.
- 734c6b312ca3c11cd4794db4e3af3b9575b9d1e5: Added a react hook `useNodeHighlighting` that helps create highlighted node labels based on provided text that should be highlighted.
  
  Example usage:
  
  ```ts
  import { useNodeHighlighting } from "@itwin/presentation-hierarchies-react";
  import { StrataKitTreeRenderer } from "@itwin/presentation-hierarchies-react/stratakit";
  
  type BaseTreeRendererProps = React.ComponentPropsWithoutRef<typeof StrataKitTreeRenderer>;
  
  function MyComponent(props: BaseTreeRendererProps & { searchText: string }) {
    // Create highlight based on searchText
    const highlightText = props.searchText !== "" ? props.searchText : undefined;
    const { getLabel } = useNodeHighlighting({ highlightText });
  
    // Provide getLabel function to tree renderer
    return <StrataKitTreeRenderer {...props} getLabel={getLabel} />;
  }
  ```
- a607dea48cba687ca9449b5669909703e6f42b7a: Added `isNodeExpandable` property to `GenericErrorInfo`, allowing nodes with generic errors to remain expandable.
- 843dc841bbe228eca7323ed458e2d36ea7d5c893: Re-export `getLogger` and `setLogger` functions from `@itwin/presentation-hierarchies` to allow setting a logger.

### Patch Changes

- 664acffbbe5ca9677363174f1b227cf52b8007b7: Process package output with [React Compiler](https://react.dev/reference/react-compiler/compiling-libraries).
- Updated dependencies:
  - @itwin/presentation-shared@2.0.0
  - @itwin/presentation-hierarchies@2.0.0
  - @itwin/unified-selection@2.0.0

## 2.0.0-alpha.71

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.22

## 2.0.0-alpha.70

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.16
  - @itwin/presentation-hierarchies@2.0.0-alpha.21
  - @itwin/unified-selection@2.0.0-alpha.4

## 2.0.0-alpha.69

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.15
  - @itwin/presentation-hierarchies@2.0.0-alpha.20
  - @itwin/unified-selection@2.0.0-alpha.3

## 2.0.0-alpha.68

### Major Changes

- [#1571](https://github.com/iTwin/presentation/pull/1571): Moved `@stratakit/icons` from a regular dependency to an optional peer dependency.

## 2.0.0-alpha.67

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.14
  - @itwin/presentation-hierarchies@2.0.0-alpha.19
  - @itwin/unified-selection@2.0.0-alpha.2

## 2.0.0-alpha.66

### Major Changes

- [#1540](https://github.com/iTwin/presentation/pull/1540): Updated StrataKit dependencies to newer versions, including `@stratakit/mui@1.0.0` and `@stratakit/structures@0.6.0`. `@stratakit/foundations` is now a peer dependency and should be installed by the application, along with `@mui/material@^9.4.0`.

### Patch Changes

- [#1514](https://github.com/iTwin/presentation/pull/1514): Fix label editor validation message size
- [#1538](https://github.com/iTwin/presentation/pull/1538): Fixed keyboard-initiated node rename instantly closing the label editor. Additionally, improved tree node rendering performance by rendering a single shared context menu and label editor at the tree level instead of mounting them in every node.
- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.13
  - @itwin/presentation-hierarchies@2.0.0-alpha.18
  - @itwin/unified-selection@2.0.0-alpha.1

## 2.0.0-alpha.65

### Patch Changes

- [#1477](https://github.com/iTwin/presentation/pull/1477): `ErrorItemRenderer`: Improved unknown error formatting by displaying the affected node before the error message, separated by a colon. Localized error messages now preserve their defined spacing around the node link.

## 2.0.0-alpha.64

### Patch Changes

- [#1469](https://github.com/iTwin/presentation/pull/1469): `TreeActionBase`: Made the `onClick` prop optional.
- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.12
  - @itwin/presentation-hierarchies@2.0.0-alpha.17
  - @itwin/unified-selection@2.0.0-alpha.0

## 2.0.0-alpha.63

### Major Changes

- [#1425](https://github.com/iTwin/presentation/pull/1425): Moved the package to use `@mui/material` and `@stratakit/mui`.

  **Breaking:** Removed `@stratakit/foundations`, `@stratakit/icons` optional peer dependencies. Added `@mui/material` and `@stratakit/mui` as optional peer dependencies.

### Patch Changes

- [#1325](https://github.com/iTwin/presentation/pull/1325): Add accessible name for tree context menu.
- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.11
  - @itwin/presentation-hierarchies@2.0.0-alpha.16
  - @itwin/unified-selection@1.8.1-alpha.0

## 2.0.0-alpha.62

### Patch Changes

- [#1304](https://github.com/iTwin/presentation/pull/1304): Remove `@stratakit/bricks` and `@stratakit/structures` from peer dependencies list.

  Only `@stratakit/foundations` and `@stratakit/icons` are required as peer dependencies when using StrataKit components, the rest of `@stratakit` packages can be used as direct dependencies.

- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.15
  - @itwin/presentation-shared@2.0.0-alpha.10
  - @itwin/unified-selection@1.7.1-alpha.0

## 2.0.0-alpha.61

### Minor Changes

- [#1267](https://github.com/iTwin/presentation/pull/1267): `TreeNode` now supports multiple errors via `errors: ErrorInfo[]`, allowing both internal errors and custom errors provided through `getTreeNodeErrors` to be combined and displayed.

  **Breaking changes:**

  - `TreeNode.error?: ErrorInfo` replaced by `TreeNode.errors: ErrorInfo[]`.
  - `UseTreeProps.getTreeNodeError` renamed to `getTreeNodeErrors` and now returns `ErrorInfo[]` instead of `ErrorInfo | undefined`.
  - `ErrorItemRendererProps` now provides `treeNode` without `errors` and `error` instead of `errorNode`.
  - `TreeErrorRenderer`'s `renderError` callback is now called once per error (instead of once per node), receiving the updated `ErrorItemRendererProps`.
  - `scrollToNode` callback in `ErrorItemRendererProps` now receives `Omit<TreeNode, "errors">` instead of `TreeNode`.

## 2.0.0-alpha.60

### Minor Changes

- 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`).

## 2.0.0-alpha.59

### Major Changes

- [#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.

### Patch Changes

- [#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.
- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.14

## 2.0.0-alpha.58

### Major Changes

- [#1236](https://github.com/iTwin/presentation/pull/1236): Start using tree structure for defining hierarchy search paths.

  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:`

  ```tsx
  import { HierarchySearchTree } from "@itwin/presentation-hierarchies";

  function MyTree() {
    const [searchText, setSearchText] = useState("");
    const treeProps = useIModelUnifiedSelectionTree({
      // ...
      getSearchPaths: useMemo<UseIModelTreeProps["getSearchPaths"]>(() => {
        return async () => {
          // before
          return getSearchTargetPaths({ searchText }),
          // after
          return HierarchySearchTree.createFromPathsList(await getSearchTargetPaths({ searchText }));
          };
      }, [searchText]),
    });

    // ...

    return (
      <StrataKitTreeRenderer
        {...treeProps.treeRendererProps}
        // ...
      />
    );
  }
  ```

### Patch Changes

- Updated dependencies:
  - @itwin/unified-selection@1.6.9-alpha.0
  - @itwin/presentation-hierarchies@2.0.0-alpha.13
  - @itwin/presentation-shared@2.0.0-alpha.9

## 2.0.0-alpha.57

### Patch Changes

- [#1238](https://github.com/iTwin/presentation/pull/1238): Fix root nodes with errors not being counted when collapsed

## 2.0.0-alpha.56

### Minor Changes

- [#1230](https://github.com/iTwin/presentation/pull/1230): Added `isNodeExpandable` property to `GenericErrorInfo`, allowing nodes with generic errors to remain expandable.

## 2.0.0-alpha.55

### Major Changes

- [#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.

  **Breaking changes**

  - `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).
  - `LOCALIZATION_NAMESPACES` must be registered with your localization provider during app initialization to make localized strings available.

### Minor Changes

- [#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.

### Patch Changes

- [#1219](https://github.com/iTwin/presentation/pull/1219): Fix component documentation mentioning iTwinUI
- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.8
  - @itwin/presentation-hierarchies@2.0.0-alpha.12
  - @itwin/unified-selection@1.6.8-alpha.0

## 2.0.0-alpha.54

### Patch Changes

- [#1198](https://github.com/iTwin/presentation/pull/1198): Change `HierarchyProvider.hierarchyChanged` argument to be required.

  This simplifies the API for users of `HierarchyProvider`, as they no longer need to check for `undefined` when handling hierarchy changes.

  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({})`.

- [#1200](https://github.com/iTwin/presentation/pull/1200): Removed unnecessary, always-truthy condition checks.
- [#1193](https://github.com/iTwin/presentation/pull/1193): Process package output with [React Compiler](https://react.dev/reference/react-compiler/compiling-libraries).
- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.7
  - @itwin/presentation-hierarchies@2.0.0-alpha.11

## 2.0.0-alpha.53

### Patch Changes

- [#1192](https://github.com/iTwin/presentation/pull/1192): Fix situations where expander was rendered for leaf nodes.
- [#1196](https://github.com/iTwin/presentation/pull/1196): Added accessible name for tree node rename input.

## 2.0.0-alpha.52

### Patch Changes

- [#1187](https://github.com/iTwin/presentation/pull/1187): Fixed tree node rename committed with keyboard activating previously focused element.

## 2.0.0-alpha.51

### Major Changes

- [#1185](https://github.com/iTwin/presentation/pull/1185): Bumped peer dependencies:
  - `@stratakit/bricks`: `^0.5.4`
  - `@stratakit/foundations`: `^0.4.5`
  - `@stratakit/icons`: `^0.2.2`
  - `@stratakit/structures`: `^0.5.4`

## 2.0.0-alpha.50

### Major Changes

- [#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.

  **Breaking changes**

  - `useSelectionHandler` is no longer exported. This function is an internal implementation detail of `StrataKitTreeRenderer` and should not be used directly.

- [#1181](https://github.com/iTwin/presentation/pull/1181): **Breaking change:** Rename `PresentationHierarchyNode` to `TreeNode` for clarity.

  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.

- [#1183](https://github.com/iTwin/presentation/pull/1183): Clean up `TreeErrorRenderer` and `ErrorItemRenderer`.

  **Breaking changes:**

  - 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:
    - Renamed `errorItem` -> `errorNode` in `ErrorItemRenderer` component and changed the type from removed `ErrorItem` to `TreeNode`.
    - Renamed `errorList` -> `errorNodes` in `TreeErrorRenderer` component and changed the type from `ErrorItem[]` to `TreeNode[]`.
  - 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.
  - Renamed `onFilterClick` -> `filterHierarchyLevel` in `ErrorItemRenderer`, `TreeErrorRenderer` and `StrataKitTreeRenderer` components. This makes its name consistent with other function props ("do something" vs "on something happened").
  - Renamed `scrollToElement` -> `scrollToNode` in `ErrorItemRenderer` and `TreeErrorRenderer`, and changed its type to take `TreeNode` instead of an error item returned by `useErrorList` hook.

## 2.0.0-alpha.49

### Major Changes

- [#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.

  Example:

  ```tsx
  import {
    StrataKitTreeRenderer,
    StrataKitTreeRendererAttributes,
  } from "@itwin/presentation-hierarchies-react";

  function MyTree() {
    const treeRef = useRef<StrataKitTreeRendererAttributes>(null);

    return (
      <>
        <div className="tree-header">
          <button
            onClick={() => {
              treeRef.current?.renameNode(
                (node) => node.label === "Node to rename"
              );
            }}
          >
            Rename node
          </button>
        </div>
        <StrataKitTreeRenderer ref={treeRef} />
      </>
    );
  }
  ```

  **Breaking changes**

  - `StrataKitTreeNodeRenderer` is no longer exported.
  - `RenameContextProvider` is no longer exported. It is not necessary when using `StrataKitTreeRenderer`.
  - `RenameAction` now requires a `node` prop.

- [#1179](https://github.com/iTwin/presentation/pull/1179): **Breaking change:** Rename tree node action components for clarity.

  - `FilterAction` -> `TreeNodeFilterAction`
  - `RenameAction` -> `TreeNodeRenameAction`

- [#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.

  Example:

  ```tsx
  type TreeRendererProps = ComponentProps<typeof StrataKitTreeRenderer>;

  const getEditingProps = useCallback<
    Required<TreeRendererProps>["getEditingProps"]
  >((node) => {
    return {
      onLabelChanged: (newLabel: string) => {
        // Handle label change
      },
      labelValidationHint: `Allowed are A to Z, 0 to 9, "-" and "_"`,
      validate: (newLabel: string) => /^[A-Za-z0-9\- ]+$/.test(newLabel),
    };
  }, []);

  return (
    <StrataKitTreeRenderer {...treeProps} getEditingProps={getEditingProps} />
  );
  ```

  **Breaking changes**

  - `getEditingProps` callback was changed to require `onLabelChanged`. If node does not support renaming `getEditingProps` should return `undefined`.

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.10
  - @itwin/presentation-shared@2.0.0-alpha.6
  - @itwin/unified-selection@1.6.6-alpha.0

## 2.0.0-alpha.48

### Minor Changes

- [#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.

  **Breaking changes**

  `StrataKitTreeNodeRenderer` props changes:

  - `getMenuActions` callback changed to `menuActions` prop (type: `ReactNode[]`)
  - `getInlineActions` callback changed to `inlineActions` prop (type: `ReactNode[]`)
  - `getContextMenuActions` callback changed to `contextMenuActions` prop (type: `ReactNode[]`)
  - `getLabel` callback removed - use `label` prop instead
  - `getSublabel` callback removed - use `description` prop instead
  - `getDecorations` callback removed - use `decorations` prop instead
  - `getClassName` callback removed - use `className` prop instead
  - `onNodeClick` and `onNodeKeyDown` callbacks removed - use `onClick` and `onKeyDown` props instead

  `StrataKitTreeRenderer` props changes:

  - Props previously passed to `StrataKitTreeNodeRenderer` are no longer accepted
  - Use `getTreeItemProps` callback to provide props to specific `Tree.Item` components
  - Use `getMenuActions`, `getInlineActions`, and `getContextMenuActions` on `StrataKitTreeRenderer` to provide actions for nodes

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.9

## 2.0.0-alpha.47

### Patch Changes

- [#1142](https://github.com/iTwin/presentation/pull/1142): Bump dependencies.
- [#1142](https://github.com/iTwin/presentation/pull/1142): Fix `StrataKitTreeRenderer` getting into infinite React render loop.
- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.8
  - @itwin/presentation-shared@2.0.0-alpha.5

## 2.0.0-alpha.46

### Minor Changes

- [#1011](https://github.com/iTwin/presentation/pull/1011): Renamed `getFilteredPaths` prop to `getSearchPaths` in tree hooks: `useTree`, `useUnifiedSelectionTree`, `useIModelTree`, `useIModelUnifiedSelectionTree`.

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.7

## 2.0.0-alpha.45

### Patch Changes

- [#1134](https://github.com/iTwin/presentation/pull/1134): Fixed expanded tree nodes showing expander when tree is reloaded and child nodes are removed.

## 2.0.0-alpha.44

### Patch Changes

- Updated dependencies:
  - @itwin/unified-selection@1.6.3-alpha.0

## 2.0.0-alpha.43

### Patch Changes

- cc836290199b9ff778773b03ab578f90043e95f0: Do not open tree context menu is there is no actions.
- Updated dependencies:
  - @itwin/presentation-shared@2.0.0-alpha.4
  - @itwin/presentation-hierarchies@2.0.0-alpha.6

## 2.0.0-alpha.42

### Patch Changes

- [#1118](https://github.com/iTwin/presentation/pull/1118): Fixed first hidden inline action causing second action to be focused when navigating using keyboard.

## 2.0.0-alpha.41

### Major Changes

- [#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.

  **Breaking changes**

  - `StrataKitTreeRenderer.getInlineActions` callback receives `{ targetNode: PresentationHierarchyNode; selectedNodes: PresentationHierarchyNode[] }` props instead of `PresentationHierarchyNode`.
  - `StrataKitTreeRenderer.getMenuActions` callback receives `{ targetNode: PresentationHierarchyNode; selectedNodes: PresentationHierarchyNode[] }` props instead of `PresentationHierarchyNode`.

  Before

  ```tsx
  return (
    <StrataKitTreeRenderer
      getInlineActions={(node) => [<InlineAction node={node} />]}
      getMenuActions={(node) => [<MenuAction node={node} />]}
    />
  );
  ```

  After

  ```tsx
  return (
    <StrataKitTreeRenderer
      getInlineActions={({ targetNode }) => [
        <InlineAction node={targetNode} />,
      ]}
      getMenuActions={({ targetNode }) => [<MenuAction node={targetNode} />]}
    />
  );
  ```

- [#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.

  **Breaking changes**

  - Removed `reserveSpace` property from `<RenameAction />` and `<FilterAction />`. These actions now automatically infer the context they're used in.
  - Added requirement to render newly introduced `<TreeActionBase />` component instead of `<Tree.ItemAction />` when rendering custom tree actions.

### Minor Changes

- [#1115](https://github.com/iTwin/presentation/pull/1115): Added `getContextMenuActions` callback for rendering tree actions in context menu.

## 2.0.0-alpha.40

### Patch Changes

- [#1110](https://github.com/iTwin/presentation/pull/1110): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.5
  - @itwin/presentation-shared@2.0.0-alpha.3
  - @itwin/unified-selection@1.6.2-alpha.0

## 2.0.0-alpha.39

### Minor Changes

- [#1106](https://github.com/iTwin/presentation/pull/1106): Added an `id` property to `StrataKitTreeRenderer` that is passed to it's scroll wrapper.
- [#1107](https://github.com/iTwin/presentation/pull/1107): Introduced new `getClassName` callback to `StrataKitTreeRenderer` and `StrataKitTreeNodeRenderer` for providing class to tree node HTML element.

### Patch Changes

- [#1109](https://github.com/iTwin/presentation/pull/1109): Fixed error item Anchor font size.

## 2.0.0-alpha.38

### Patch Changes

- [#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.

## 2.0.0-alpha.37

### Major Changes

- [#1100](https://github.com/iTwin/presentation/pull/1100): Bumped StrataKit peer dependencies to:
  - `@stratakit/structures`: ^0.5.0
  - `@stratakit/icons`: ^0.2.0
  - `@stratakit/foundations`: ^0.4.0
  - `@stratakit/bricks`: ^0.5.0

## 2.0.0-alpha.36

### Major Changes

- [#1094](https://github.com/iTwin/presentation/pull/1094): Improve custom errors rendering API:

  - 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.
  - Exposed `ErrorItemRenderer` that renders all error types supported by the tree.
  - Updated `TreeErrorRenderer` to pass all props necessary to render `ErrorItemRenderer` into `renderError` callback.

  These changes makes it easier to customize only some types of errors and leave default handling for others.

  Example:

  ```tsx
  <StrataKitTreeRenderer
    {...treeProps}
    errorRenderer={(errorProps) => {
      return (
        <TreeErrorRenderer
          {...errorProps}
          renderError={(errorItemProps) => {
            if (errorItemProps.errorItem.errorNode.error.type === "Unknown") {
              return (
                <ErrorRegion.Item
                  message="Custom error"
                  messageId={errorItemProps.errorItem.errorNode.id}
                />
              );
            }
            return <ErrorItemRenderer {...errorItemProps} />;
          }}
        />
      );
    }}
  />
  ```

## 2.0.0-alpha.35

### Patch Changes

- [#1075](https://github.com/iTwin/presentation/pull/1075): Fix accessibility issues in `<TreeErrorRenderer />`.

  This involves a few localized string changes:

  - Added `issuesForTree`, defaulting to "Issues for {{tree_label}}.", used as a region landmark label for the error message container.
  - Added `noIssuesFound`, defaulting to "No issues found.", used as a label for errors' list when there are no issues.
  - 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.

  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.

## 2.0.0-alpha.34

### Patch Changes

- [#1068](https://github.com/iTwin/presentation/pull/1068): Extend `@stratakit` peer dependency range to support the latest versions

## 2.0.0-alpha.33

### Patch Changes

- [#1057](https://github.com/iTwin/presentation/pull/1057): Change `useNodeHighlighting` hook to only highlight nodes that are filter targets.

## 2.0.0-alpha.32

### Patch Changes

- [#1045](https://github.com/iTwin/presentation/pull/1045): Fix highlight matching in `useNodeHighlighting` hook. Highlighting now works when the `highlightText` contains special characters (`[`, `+`, `*`, etc.).

## 2.0.0-alpha.31

### Patch Changes

- [#1042](https://github.com/iTwin/presentation/pull/1042): Version bump
- [#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.

  Example usage:

  ```ts
  import {
    StrataKitTreeRenderer,
    useNodeHighlighting,
  } from "@itwin/presentation-hierarchies-react";

  type BaseTreeRendererProps = React.ComponentPropsWithoutRef<
    typeof StrataKitTreeRenderer
  >;

  function MyComponent(props: BaseTreeRendererProps & { searchText: string }) {
    // Create highlight based on searchText
    const highlightText =
      props.searchText !== "" ? props.searchText : undefined;
    const { getLabel } = useNodeHighlighting({ highlightText });

    // Provide getLabel function to tree renderer
    return <StrataKitTreeRenderer {...props} getLabel={getLabel} />;
  }
  ```

- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.4
  - @itwin/presentation-shared@2.0.0-alpha.2
  - @itwin/unified-selection@1.5.1-alpha.1

## 2.0.0-alpha.30

### Patch Changes

- [#1037](https://github.com/iTwin/presentation/pull/1037): Added additional documentation for `RenameAction`

## 2.0.0-alpha.29

### Patch Changes

- [#1035](https://github.com/iTwin/presentation/pull/1035): Version bump after merge from `master`.

## 2.0.0-alpha.28

### Patch Changes

- [#1031](https://github.com/iTwin/presentation/pull/1031): Version bump
- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.3
  - @itwin/unified-selection@1.5.1-alpha.0

## 2.0.0-alpha.27

### Patch Changes

- [#1026](https://github.com/iTwin/presentation/pull/1026): Fix `reserveSpace` property being required instead of optional for `FilterAction` and `RenameAction`.

## 2.0.0-alpha.26

### Major Changes

- [#1023](https://github.com/iTwin/presentation/pull/1023): Split `getActions` into `getMenuActions` & `getInlineActions` for `StrataKitTreeRenderer` and `StrataKitTreeNodeRenderer`.

  Updated peer dependencies:

  - @stratakit/bricks@0.3.3
  - @stratakit/foundations@0.2.2
  - @stratakit/structures@0.3.1

  Added `reserveSpace` property to `FilterAction` and `RenameAction`, which reserves space for the action when it is not available

### Minor Changes

- [#1007](https://github.com/iTwin/presentation/pull/1007): Renames:
  `FlatNode` => `FlatTreeNodeItem`
  `FlatTreeNode` => `FlatTreeItem`
  `PlaceholderNode` => `PlaceholderItem`
  `useFlatTreeNodeList` => `useFlatTreeItems`

  Changed `FlatTreeNodeItem` (previously `FlatNode`) to have property `node: PresentationHierarchyNode` instead of extending `PresentationHierarchyNode`.

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.2

## 2.0.0-alpha.25

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.1
  - @itwin/presentation-shared@2.0.0-alpha.1
  - @itwin/unified-selection@1.4.3-alpha.0

## 2.0.0-alpha.24

### Patch Changes

- [#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.
- [#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.

## 2.0.0-alpha.23

### Minor Changes

- [#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.

## 2.0.0-alpha.22

### Minor Changes

- [#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.

## 2.0.0-alpha.21

### Major Changes

- [#961](https://github.com/iTwin/presentation/pull/961): **Breaking changes** to tree state hooks `useTree`, `useUnifiedSelectionTree`, `useIModelTree`, `useIModelUnifiedSelectionTree`:

  - All tree rendering props have been moved under `treeRendererProps`. The value can be passed to `<StrataKitTreeRenderer />` component.
  - 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.
  - The `isLoading` attribute has been renamed to `isReloading`.
  - Errors are no longer defined as children of `PresentationHierarchyNode` and instead are now included as `error` attribute for more fluent API.

  When rendering tree state, the recommended order of checks is:

  1. If `rootErrorRendererProps` is defined, there was an error - render error state.
  2. If `treeRendererProps` is not defined, the component is doing the initial load - render loading state.
  3. If `treeRendererProps` is defined, the hierarchy is loaded - render the tree component.

     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.

  Example:

  ```ts
  function MyComponent () {
      const useTreeResult = useIModelUnifiedSelectionTree({...});

      // handle possible root errors with our provided component or your own custom implementation
      if (treeProps.rootErrorRendererProps) {
        return <StrataKitRootErrorRenderer {...useTreeResult.rootErrorRendererProps} />;
      }

      // handle loading state
      if (!treeProps.treeRendererProps) {
        return <MyLoadingComponent />;
      }

      // handle loaded hierarchy
      return <StrataKitTreeRenderer {...useTreeResult.treeProps} />;
  }
  ```

## 2.0.0-alpha.20

### Major Changes

- [#965](https://github.com/iTwin/presentation/pull/965): Added `@stratakit/structures` as a peer dependency.

## 2.0.0-alpha.19

### Major Changes

- [#954](https://github.com/iTwin/presentation/pull/954): Add additional requirements for types in `EC` metadata namespace, whose objects are returned by `ECSchemaProvider`.

  - `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.
  - `EC.Class` now additionally has these members:
    - `baseClass: Promise<Class | undefined>`
    - `getDerivedClasses(): Promise<Class[]>`

  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.

  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`.

### Patch Changes

- [#957](https://github.com/iTwin/presentation/pull/957): Avoid leaking custom props to the `PlaceholderNode` that are causing console errors.
- Updated dependencies:
  - @itwin/presentation-hierarchies@2.0.0-alpha.0
  - @itwin/presentation-shared@2.0.0-alpha.0
  - @itwin/unified-selection@1.4.2-alpha.0

## 2.0.0-alpha.18

### Major Changes

- [#951](https://github.com/iTwin/presentation/pull/951): Move from `@itwin/itwinui-react@5.0.0-alpha` to `@stratakit/*` packages.

## 2.0.0-alpha.17

### Patch Changes

- [#949](https://github.com/iTwin/presentation/pull/949): Use default imports instead of `URL` constructor for icons.

## 2.0.0-alpha.16

### Minor Changes

- [#945](https://github.com/iTwin/presentation/pull/945): Re-export `getLogger` and `setLogger` functions from `@itwin/presentation-hierarchies` to allow setting a logger.

## 2.0.0-alpha.15

### Major Changes

- [#942](https://github.com/iTwin/presentation/pull/942): Unified selection API cleanup.

  - Remove deprecated `UnifiedSelectionProvider`.
  - Make `selectionStorage` prop required for unified selection - enabled tree state hooks (`useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree`).

  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.

  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.

- [#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.

  Before:

  ```tsx
  import {
    TreeNodeRenderer,
    useFilterAction,
  } from "@itwin/presentation-hierarchies-react";

  const filterAction = useFilterAction({ onFilter, getHierarchyLevelDetails });
  return (
    <TreeNodeRenderer
      actions={useMemo(
        () => [
          filterAction,
          (node) => ({
            label: "Custom Action",
            actions: () => log(node.label),
            icon: customIconHref,
          }),
        ],
        [filterAction]
      )}
    />
  );
  ```

  After:

  ```tsx
  import { Icon, Tree } from "@itwin/itwinui-react";
  import {
    FilterAction,
    TreeNodeRenderer,
  } from "@itwin/presentation-hierarchies-react";

  return (
    <TreeNodeRenderer
      getActions={useCallback(
        (node) => [
          <FilterAction
            key="filter"
            node={node}
            onFilter={onFilter}
            getHierarchyLevelDetails={getHierarchyLevelDetails}
          />,
          <Tree.ItemAction
            key="customAction"
            label="Custom action"
            onClick={() => log(node.label)}
            icon={<Icon href={customIconHref} />}
          />,
        ],
        [onFilter, getHierarchyLevelDetails]
      )}
    />
  );
  ```

### Minor Changes

- [#930](https://github.com/iTwin/presentation/pull/930): Exposed `TreeErrorRenderer`, which takes `renderError` property to render custom error messages.
  `TreeRenderer` now takes `errorRenderer` to render a custom error display component.

  Custom error display component example:

  ```ts
  <TreeRenderer
    {...treeProps}
    errorRenderer={(errorsRendererProps) => (
      <MyErrorRenderer {...errorsRendererProps} />
    )}
  />
  ```

  Custom error message example:

  ```ts
  <TreeRenderer
      {...treeProps}
      errorRenderer={(errorsRendererProps) => (
          <TreeErrorRenderer
              {...errorsRendererProps}
              renderError={(errorProps) => {
                  return <unstable_ErrorRegion.Item message={...} />;
              }}
          />
      )}
  />
  ```

- [#937](https://github.com/iTwin/presentation/pull/937): `TreeRenderer` now takes `rootErrorRenderer` to render a custom root error display component.

  Custom error display component example:

  ```ts
  <TreeRenderer
    {...treeProps}
    rootErrorRenderer={(rootErrorRendererProps) => (
      <MyRootErrorRenderer {...rootErrorRendererProps} />
    )}
  />
  ```

- [#930](https://github.com/iTwin/presentation/pull/930): Changed flat tree building functions to hooks:
  - `flattenNodes` => `useFlatTreeNodeList`.
  - `getErrors` => `useErrorList`.

### Patch Changes

- [#930](https://github.com/iTwin/presentation/pull/930): Fix `ResultSetTooLarge` error suggesting filtering when parent node is not filterable.

## 2.0.0-alpha.14

### Patch Changes

- [#928](https://github.com/iTwin/presentation/pull/928): Memoize tree components to reduce the amount of renders.

## 2.0.0-alpha.13

### Patch Changes

- [#924](https://github.com/iTwin/presentation/pull/924): Fix tree error dropdown not applying actions.

## 2.0.0-alpha.12

### Patch Changes

- [#922](https://github.com/iTwin/presentation/pull/922): Fix tree displaying aditional scrollbars, when scrolling to the last element with low tree width.

## 2.0.0-alpha.11

### Patch Changes

- [#916](https://github.com/iTwin/presentation/pull/916): Fix tree nodes overlapping when nodes with and without sublabel are rendered alongside.
- [#920](https://github.com/iTwin/presentation/pull/920): Changed error display for node errors to match new design system.

## 2.0.0-alpha.10

### Patch Changes

- [#913](https://github.com/iTwin/presentation/pull/913): Removed outline showed after node expander is clicked.

## 2.0.0-alpha.9

### Patch Changes

- [#906](https://github.com/iTwin/presentation/pull/906): Replaced `TreeNodeRenderer.getIcon` prop with `getDecorations` prop.

  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:

  ```ts
  // previously, when `getIcon` returned a `ReactElement`:
  function myGetIcon(node: PresentationHierarchyNode): React.ReactElement {
    // implementation...
  }
  <TreeNodeRenderer getIcon={myGetIcon} />

  // now:
  <TreeNodeRenderer getDecorations={myGetIcon} />

  // previously, when `getIcon` returned an icon URI:
  function myGetIconUri(node: PresentationHierarchyNode): string {
    // implementation...
  }
  <TreeNodeRenderer getIcon={myGetIconUri} />

  // now:
  <TreeNodeRenderer getDecorations={(node) => <Icon href={myGetIconUri(node)} />} />
  ```

- [#911](https://github.com/iTwin/presentation/pull/911): Fix incorrect left padding on tree items

## 2.0.0-alpha.8

### Patch Changes

- [#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.
- [#903](https://github.com/iTwin/presentation/pull/903): Changed `createFilterAction` function to a React hook and renamed it to `useFilterAction`.

## 2.0.0-alpha.7

### Patch Changes

- [#892](https://github.com/iTwin/presentation/pull/892): Fix focus outline for tree items not being visible on action items click.
- [#894](https://github.com/iTwin/presentation/pull/894): Fix `treeRenderer` property `getSublabel` not being used.

## 2.0.0-alpha.6

### Patch Changes

- [#890](https://github.com/iTwin/presentation/pull/890): Fix alpha peer dependencies to no longer have caret.

## 2.0.0-alpha.5

### Minor Changes

- [#883](https://github.com/iTwin/presentation/pull/883): Trees rendered with `TreeRenderer` will now be virtualized.

## 2.0.0-alpha.4

### Minor Changes

- [#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:

  - `undefined` - visible on hover/focus,
  - `true` - visible at all times,
  - `false` - hidden at all times.

  Updated peer dependencies:

  - itwinui-icons to 5.0.0-alpha.3,
  - itwinui-react to 5.0.0-alpha.6,

## 2.0.0-alpha.3

### Patch Changes

- [#870](https://github.com/iTwin/presentation/pull/870): `TreeRenderer` and `TreeNodeRenderer` now take actions as specification function array.
  - `label`: Action item's label.
  - `action`: The action performed when the button is clicked.
  - `show` A boolean determining whether the button should be displayed.
  - `icon`: The button's icon.

## 2.0.0-alpha.2

### Major Changes

- [#864](https://github.com/iTwin/presentation/pull/864): Add `@itwin/itwinui-icons` as optional peer dependency (only required when using iTwinUI-based tree / node renderers).

## 2.0.0-alpha.1

### Patch Changes

- [#860](https://github.com/iTwin/presentation/pull/860): Changes to tree node action buttons related to filtering:
  - Fix filter button style.
  - Removed "reset filter" button. The filter can be reset through the filter editing dialog.
- [#862](https://github.com/iTwin/presentation/pull/862): Update `@itwin/itwinui-react` dependency to `5.0.0-alpha.3`.

  This fixes the following issues:

  - nodes being selected on expand,
  - node action buttons being rendered incorrectly.

## 2.0.0-alpha.0

### Major Changes

- [#847](https://github.com/iTwin/presentation/pull/847): Moving tree rendering components to a new design systems.

## 1.11.8

### Patch Changes

- [#1650](https://github.com/iTwin/presentation/pull/1650): Update iTwin.js Core dependencies to `5.14.3`.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.23
  - @itwin/presentation-shared@1.2.24
  - @itwin/unified-selection@1.8.8

## 1.11.7

### Patch Changes

- [#1580](https://github.com/iTwin/presentation/pull/1580): Update iTwin.js Core dependencies to `5.14.2`.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.22
  - @itwin/presentation-shared@1.2.23
  - @itwin/unified-selection@1.8.7

## 1.11.6

### Patch Changes

- [#1543](https://github.com/iTwin/presentation/pull/1543): Update iTwin.js core dependencies to `^5.13.1` and refresh related tooling/test dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.21
  - @itwin/presentation-shared@1.2.22
  - @itwin/unified-selection@1.8.6

## 1.11.5

### Patch Changes

- [#1500](https://github.com/iTwin/presentation/pull/1500): Update iTwin.js core dependencies to ^5.12.4 and refresh related tooling/test dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.20
  - @itwin/presentation-shared@1.2.20
  - @itwin/unified-selection@1.8.5

## 1.11.4

### Patch Changes

- [#1473](https://github.com/iTwin/presentation/pull/1473): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.19
  - @itwin/presentation-shared@1.2.19
  - @itwin/unified-selection@1.8.4

## 1.11.3

### Patch Changes

- [#1430](https://github.com/iTwin/presentation/pull/1430): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.18
  - @itwin/presentation-shared@1.2.18
  - @itwin/unified-selection@1.8.3

## 1.11.2

### Patch Changes

- [#1400](https://github.com/iTwin/presentation/pull/1400): Bump dependencies.
- Updated dependencies:
  - @itwin/unified-selection@1.8.2
  - @itwin/presentation-hierarchies@1.7.17
  - @itwin/presentation-shared@1.2.17

## 1.11.1

### Patch Changes

- [#1390](https://github.com/iTwin/presentation/pull/1390): Update `@itwin/core-*` dependencies to `^5.10.0`.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.16
  - @itwin/presentation-shared@1.2.16
  - @itwin/unified-selection@1.7.6

## 1.11.0

### Minor Changes

- [#1387](https://github.com/iTwin/presentation/pull/1387): Added support for React version 19

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-shared@1.2.15

## 1.10.4

### Patch Changes

- [#1358](https://github.com/iTwin/presentation/pull/1358): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.15
  - @itwin/presentation-shared@1.2.14
  - @itwin/unified-selection@1.7.5

## 1.10.3

### Patch Changes

- [#1338](https://github.com/iTwin/presentation/pull/1338): Bump iTwin.js core dependencies to `^5.9.1`.
- Updated dependencies:
  - @itwin/unified-selection@1.7.3
  - @itwin/presentation-hierarchies@1.7.14
  - @itwin/presentation-shared@1.2.13

## 1.10.2

### Patch Changes

- [#1313](https://github.com/iTwin/presentation/pull/1313): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-shared@1.2.12
  - @itwin/unified-selection@1.7.1
  - @itwin/presentation-hierarchies@1.7.13

## 1.10.1

### Patch Changes

- [#1286](https://github.com/iTwin/presentation/pull/1286): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.12
  - @itwin/presentation-shared@1.2.11
  - @itwin/unified-selection@1.7.0

## 1.10.0

### Minor Changes

- [#1258](https://github.com/iTwin/presentation/pull/1258): Introduced new import paths: `@itwin/presentation-hierarchies-react/core` and `@itwin/presentation-hierarchies-react/itwinui`. They should allow to use this package without `@itwin/itwinui-react` dependency.

## 1.9.13

### Patch Changes

- [#1242](https://github.com/iTwin/presentation/pull/1242): Bump dependencies.
- [#1252](https://github.com/iTwin/presentation/pull/1252): Fix tree node outline not appearing on touch devices.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.11
  - @itwin/presentation-shared@1.2.10
  - @itwin/unified-selection@1.6.8

## 1.9.12

### Patch Changes

- [#1215](https://github.com/iTwin/presentation/pull/1215): Update dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.10
  - @itwin/presentation-shared@1.2.9
  - @itwin/unified-selection@1.6.7

## 1.9.11

### Patch Changes

- [#1208](https://github.com/iTwin/presentation/pull/1208): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.9
  - @itwin/presentation-shared@1.2.8
  - @itwin/unified-selection@1.6.6

## 1.9.10

### Patch Changes

- [#1168](https://github.com/iTwin/presentation/pull/1168): Bump dependencies.
- [#1167](https://github.com/iTwin/presentation/pull/1167): Fix a greedy regular expression in `TreeNodeRenderer` that renders a "result set too large" error node.
- [#1161](https://github.com/iTwin/presentation/pull/1161): Bump iTwin.js dependencies to `^5.5.0`.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.8
  - @itwin/presentation-shared@1.2.7
  - @itwin/unified-selection@1.6.5

## 1.9.9

### Patch Changes

- [#1160](https://github.com/iTwin/presentation/pull/1160): Fixed tree placeholder node spinner size to match tree node icons.

## 1.9.8

### Patch Changes

- [#1152](https://github.com/iTwin/presentation/pull/1152): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.7
  - @itwin/presentation-shared@1.2.6
  - @itwin/unified-selection@1.6.4

## 1.9.7

### Patch Changes

- [#1139](https://github.com/iTwin/presentation/pull/1139): Bump dependencies.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.6
  - @itwin/presentation-shared@1.2.5
  - @itwin/unified-selection@1.6.3

## 1.9.6

### Patch Changes

- [#1124](https://github.com/iTwin/presentation/pull/1124): Bump dependencies.
- Updated dependencies:
  - @itwin/unified-selection@1.6.2
  - @itwin/presentation-hierarchies@1.7.5
  - @itwin/presentation-shared@1.2.4

## 1.9.5

### Patch Changes

- [#1079](https://github.com/iTwin/presentation/pull/1079): Fixed tree node actions background color when node is selected and hovered.

## 1.9.4

### Patch Changes

- [#1063](https://github.com/iTwin/presentation/pull/1063): Make sure tree node actions are properly sticking to the right side when scrolling tree horizontally.

## 1.9.3

### Patch Changes

- [#1054](https://github.com/iTwin/presentation/pull/1054): Show tooltip with full label on tree nodes.

## 1.9.2

### Patch Changes

- [#1039](https://github.com/iTwin/presentation/pull/1039): Bump iTwin.js core dependencies to `^5.1.1`.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.2
  - @itwin/presentation-shared@1.2.3
  - @itwin/unified-selection@1.5.1

## 1.9.1

### Patch Changes

- [#1033](https://github.com/iTwin/presentation/pull/1033): Fix unified selection tree state hooks `useUnifiedSelectionTree` and `useIModelUnifiedSelectionTree` not handling the recently added `createSelectableForGenericNode` prop.

## 1.9.0

### Minor Changes

- [#1027](https://github.com/iTwin/presentation/pull/1027): Added `getActions` property to `TreeRenderer` and `TreeNodeRenderer` to allow providing custom actions for tree nodes.

## 1.8.1

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.1

## 1.8.0

### Minor Changes

- [#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.

  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:

  ```tsx
  import { useUnifiedSelectionTree } from "@itwin/presentation-hierarchies-react";

  const treeState = useUnifiedSelectionTree({
    selectionStorage,
    createSelectableForGenericNode: useCallback<
      NonNullable<
        Props<typeof useUnifiedSelectionTree>["createSelectableForGenericNode"]
      >
    >(
      (node, uniqueId) => ({
        identifier: node.key.id,
        data: node,
        async *loadInstanceKeys() {},
      }),
      []
    ),
    // ...other options
  });
  ```

### Patch Changes

- Updated dependencies:
  - @itwin/unified-selection@1.5.0

## 1.7.2

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@1.7.0

## 1.7.1

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@1.6.1

## 1.7.0

### Minor Changes

- 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.

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@1.6.0

## 1.6.9

### Patch Changes

- [#1000](https://github.com/iTwin/presentation/pull/1000): Made sure `Apply filter` button becomes focused after hierarchy level filter is applied.

## 1.6.8

### Patch Changes

- [#982](https://github.com/iTwin/presentation/pull/982): Update itwinjs-core dependencies to v5.0.0
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.5.1
  - @itwin/presentation-shared@1.2.2
  - @itwin/unified-selection@1.4.2

## 1.6.7

### Patch Changes

- [#974](https://github.com/iTwin/presentation/pull/974): Removed tree node outline on mobile devices.
- Updated dependencies:
  - @itwin/presentation-hierarchies@1.5.0

## 1.6.6

### Patch Changes

- [#944](https://github.com/iTwin/presentation/pull/944): Fixed `extended` selection mode not replacing existing selection when selected node is clicked.

## 1.6.5

### Patch Changes

- [#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.

## 1.6.4

### Patch Changes

- [#909](https://github.com/iTwin/presentation/pull/909): Do not use `dev` versions of `@itwin/*` packages.
- Updated dependencies:
  - @itwin/unified-selection@1.4.1
  - @itwin/presentation-hierarchies@1.4.2
  - @itwin/presentation-shared@1.2.1

## 1.6.3

### Patch Changes

- Updated dependencies:
  - @itwin/unified-selection@1.4.0

## 1.6.2

### Patch Changes

- [#873](https://github.com/iTwin/presentation/pull/873): Fix hierarchy level size exceeds limit info message wrapping in narrow Tree on Safari browser.
- [#873](https://github.com/iTwin/presentation/pull/873): Do not require two clicks to expand node with filter buttons on touch devices.

## 1.6.1

### Patch Changes

- [#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.

## 1.6.0

### Minor Changes

- [#841](https://github.com/iTwin/presentation/pull/841): Changed how tree state hooks access unified selection storage.

  - 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.
  - 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.

  Example of how to migrate to the new API:

  ```tsx
  const selectionStorage = createStorage();

  // before
  function MyTreeComponent() {
    // the hook takes selection storage from context, set up by the App component
    const treeState = useUnifiedSelectionTree({ ... });
    // ...
  }
  function App() {
    return (
      <UnifiedSelectionProvider storage={selectionStorage}>
        <MyTreeComponent />
      </UnifiedSelectionProvider>
    );
  }

  // after
  function MyTreeComponent({ selectionStorage }: { selectionStorage: SelectionStorage }) {
    // the hook takes selection storage from props
    const treeState = useUnifiedSelectionTree({ selectionStorage, ... });
    // ...
  }
  function App() {
    return (
      <MyTreeComponent selectionStorage={selectionStorage} />
    );
  }
  ```

### Patch Changes

- Updated dependencies:
  - @itwin/unified-selection@1.3.0

## 1.5.0

### Minor Changes

- [#840](https://github.com/iTwin/presentation/pull/840): Added `filterButtonsVisibility` to `treeNodeRenderer`. Which allows configuring filter buttons visibility for the whole tree.
  - `show-on-hover` - default value, shows filter buttons on node hover or focus.
  - `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.

### Patch Changes

- [#831](https://github.com/iTwin/presentation/pull/831): Clicking on tree node buttons now visually show focus on node.
- [#812](https://github.com/iTwin/presentation/pull/812): Fixed tree state hooks not returning root nodes when hierarchy provider doesn't raise the `onHierarchyChanged` event upon setting a hierarchy filter.

## 1.4.0

### Minor Changes

- [#827](https://github.com/iTwin/presentation/pull/827): Changed `onHierarchyLoadError` callback in `UseTreeProps`, it now accepts error as one of the props arguments.

### Patch Changes

- [#828](https://github.com/iTwin/presentation/pull/828): Polyfill `Symbol.dispose` and `Symbol.asyncDispose` to make sure that code using the upcoming JS recource management API works in all environments.
- Updated dependencies:
  - @itwin/unified-selection@1.2.1
  - @itwin/presentation-hierarchies@1.4.1

## 1.3.0

### Minor Changes

- [#807](https://github.com/iTwin/presentation/pull/807): Added `getNode` function to tree state hooks to allow getting a node by id.

  Example usage:

  ```tsx
  function MyTreeComponentInternal({
    imodelAccess,
  }: {
    imodelAccess: IModelAccess;
  }) {
    const {
      rootNodes,
      getNode,
      expandNode: doExpandNode,
      ...state
    } = useTree({
      // tree props
    });

    // enhance the default `expandNode` handler to log the action to console
    const expandNode = React.useCallback(
      async (nodeId: string, isExpanded: boolean) => {
        const node = getNode(nodeId);
        if (node) {
          console.log(
            `${isExpanded ? "Expanding" : "Collapsing"} node: ${node.label}`
          );
        }
        doExpandNode(nodeId, isExpanded);
      },
      [getNode, doExpandNode]
    );

    // render the tree
    if (!rootNodes || !rootNodes.length) {
      return "No data to display";
    }
    return (
      <TreeRenderer {...state} expandNode={expandNode} rootNodes={rootNodes} />
    );
  }
  ```

- [#802](https://github.com/iTwin/presentation/pull/802): Prefer `Symbol.dispose` over `dispose` for disposable objects.

  The package contained a number of types for disposable objects, that had a requirement of `dispose` method being called on them after they are no longer needed. In conjunction with the `using` utility from `@itwin/core-bentley`, usage of such objects looked like this:

  ```ts
  class MyDisposable() {
    dispose() {
      // do some cleanup
    }
  }
  using(new MyDisposable(), (obj) => {
    // do something with obj, it'll get disposed when the callback returns
  });
  ```

  In version `5.2`, TypeScript [introduced](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management) `Disposable` type and `using` declarations (from the upcoming [Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management) feature in ECMAScript). Now we're making use of those new utilities in this package (while still supporting the old `dispose` method), which allows using `MyDisposable` from the above snippet like this:

  ```ts
  using obj = new MyDisposable();
  // do something with obj, it'll get disposed when it goes out of scope
  ```

### Patch Changes

- Updated dependencies:
  - @itwin/unified-selection@1.2.0
  - @itwin/presentation-hierarchies@1.4.0

## 1.2.0

### Minor Changes

- [#795](https://github.com/iTwin/presentation/pull/795): Added `size` property to `TreeNodeRenderer` to improve styling of `small` tree.
- [#791](https://github.com/iTwin/presentation/pull/791): Unify hierarchy updates' handling.

  Previously, we'd only raise the `HierarchyProvider.hierarchyChanged` event on data source changes. The tree state hooks would listen to this event and trigger a hierarchy update. However, there are a few other reasons for the hierarchy to change - changing formatter or active hierarchy filter. In those situations the event was not raised, but tree state hooks still had to trigger hierarchy update. So we ended up with a mix of event-driven and manual hierarchy updates.

  With this change we're clearly stating that a hierarchy provider should trigger its `hierarchyChanged` event whenever something happens that causes the hierarchy to change. That means, the event will be raised when formatter or hierarchy filter is set, and tree state hooks can initiate hierarchy reload from a single place - the `hierarchyChanged` event listener.

  To let event listeners know what caused the hierarchy change, the event now has event arguments, which should be set by the hierarchy provider when raising the event. This allows listeners to customize hierarchy reload logic - for example, our tree state hooks always keep existing tree state except when a new hierarchy filter is set, in which case the existing state is discarded.

### Patch Changes

- [#795](https://github.com/iTwin/presentation/pull/795): Fix tree node loading indicator to match other icons size.
- [#786](https://github.com/iTwin/presentation/pull/786): Bump package dependencies.
- [#794](https://github.com/iTwin/presentation/pull/794): Add missing `ref` to the placeholder and error nodes to have correct styling in virtualized small tree.
- Updated dependencies:
  - @itwin/presentation-shared@1.2.0
  - @itwin/presentation-hierarchies@1.3.0
  - @itwin/unified-selection@1.1.2

## 1.1.3

### Patch Changes

- [#780](https://github.com/iTwin/presentation/pull/780): Avoid double tree load when `getFilteredPaths` are provided during first render.

## 1.1.2

### Patch Changes

- Updated dependencies:
  - @itwin/unified-selection@1.1.1

## 1.1.1

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@1.2.1

## 1.1.0

### Minor Changes

- [#740](https://github.com/iTwin/presentation/pull/740): Define `type` and `exports` attributes in `package.json`.

  The change moves this package a step closer towards dropping CommonJS support - it's now transpiled from ESM to CommonJS instead of the opposite.

  In addition, the `exports` attribute has been added to `package.json` to prohibit access to APIs that are not intended to be used by external consumers.

### Patch Changes

- [#758](https://github.com/iTwin/presentation/pull/758): Promote `@beta` APIs to `@public`.
- [#756](https://github.com/iTwin/presentation/pull/756): Added missing `ref` property to `TreeNodeRendererProps` type.
- Updated dependencies:
  - @itwin/presentation-shared@1.1.0
  - @itwin/unified-selection@1.1.0
  - @itwin/presentation-hierarchies@1.2.0

## 1.0.1

### Patch Changes

- [#734](https://github.com/iTwin/presentation/pull/734): Fixed `onHierarchyLimitExceeded` callback of [tree state hooks](./README.md#tree-state-hooks) being called with incorrect `limit` value.
- Updated dependencies:
  - @itwin/unified-selection@1.0.1
  - @itwin/presentation-hierarchies@1.1.0

## 1.0.0

### Major Changes

- [#727](https://github.com/iTwin/presentation/pull/727): 1.0 release.

  The APIs are now considered stable and ready for production use.

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@1.0.0
  - @itwin/presentation-shared@1.0.0
  - @itwin/unified-selection@1.0.0

## 0.8.2

### Patch Changes

- [#724](https://github.com/iTwin/presentation/pull/724): Fixed `@itwin/core-bentley` dependency version to be `^4.9.0`.

## 0.8.1

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@0.7.1

## 0.8.0

### Minor Changes

- [#708](https://github.com/iTwin/presentation/pull/708): **BREAKING:** A new attribute - `imodelKey` - has been added to `imodelAccess` prop of "use tree" hooks. For the most common case when a hierarchy is built from an `IModelConnection`, it's recommended to use `key` attribute of the connection as this value.

  Example:

  ```ts
  function createHierarchyProvider(imodel: IModelConnection) {
    return createIModelHierarchyProvider({
      imodelAccess: {
        imodelKey: imodel.key, // set the newly introduced `imodelKey` attribute
        // ... other iModel access props
      },
      // ... other provider props
    });
  }
  ```

  See "Basic example" section in README learning page for the full example.

- [#717](https://github.com/iTwin/presentation/pull/717): **BREAKING:** Add support for non-iModel-driven trees.

  - `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.
  - 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.

  Reacting to this breaking change is as simple as renaming the calls to `useTree` and `useUnifiedSelectionTree` to `useIModelTree` and `useIModelUnifiedSelectionTree`, respectively.

- [#717](https://github.com/iTwin/presentation/pull/717): **BREAKING:** The `reloadTree` function attribute returned by "use tree" hooks has been changed to **not** accept a `dataSourceChanged` parameter.

  The parameter was used to notify the tree component that the underlying data source has changed and the tree should be reloaded. For example, something like this was necessary:

  ```tsx
  const { reloadTree } = useIModelUnifiedSelectionTree({
    // ...
  });

  useEffect(() => {
    if (!imodel.isBriefcaseConnection()) {
      return;
    }

    return registerTxnListeners(imodel.txns, () => {
      reloadTree({ dataSourceChanged: true });
    });
  }, [imodel, reloadTree]);
  ```

  Now, the `HierarchyProvider` notifies the hook about hierarchy changes.

  Note that iModel-based hierarchy providers require an `imodelChanged` event object to be provided and raised when the underlying iModel changes:

  ```tsx
  const [imodelChanged] = useState(new BeEvent<() => void>());
  useEffect(() => {
    if (imodel.isBriefcaseConnection()) {
      return registerTxnListeners(imodel.txns, () => imodelChanged.raiseEvent());
    }
    return undefined;
  }, [imodel, imodelChanged]);

  const { ... } = useIModelUnifiedSelectionTree({
    imodelChanged,
    ...,
  });
  ```

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@0.7.0

## 0.7.2

### Patch Changes

- [#699](https://github.com/iTwin/presentation/pull/699): Fixed warnings related to passing `ref` to the component that is not wrapped in `forwardRef` function.
- Updated dependencies:
  - @itwin/presentation-hierarchies@0.5.1
  - @itwin/presentation-shared@0.5.0
  - @itwin/unified-selection@0.5.1

## 0.7.1

### Patch Changes

- Updated dependencies:
  - @itwin/unified-selection@0.5.0
  - @itwin/presentation-hierarchies@0.5.0
  - @itwin/presentation-shared@0.4.1

## 0.7.0

### Minor Changes

- [#676](https://github.com/iTwin/presentation/pull/676): `useTree` and `useUnifiedSelectionTree`: Extended return type of `getFilteredPaths` prop to allow specifying whether hierarchy should be expanded to filtering path target.

  With this change, hierarchy is no longer expanded to filter targets by default. To achieve the same behavior, paths with `autoExpand` option should be returned:

  _Before:_

  ```tsx
  async function getFilteredPaths(): Promise<HierarchyNodeIdentifiersPath[]> {
    return paths;
  }
  ```

  _Now:_

  ```tsx
  async function getFilteredPaths(): Promise<Array<{ path: HierarchyNodeIdentifiersPath; options?: { autoExpand?: boolean }>> {
    return paths.map((path) => ({ path, options: { autoExpand: true } }));
  }
  ```

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@0.4.0
  - @itwin/presentation-shared@0.4.0
  - @itwin/unified-selection@0.4.6

## 0.6.0

### Minor Changes

- [#661](https://github.com/iTwin/presentation/pull/661): Added `onHierarchyLoadError` callback to `useTree` and `useUnifiedSelectionTree` that is called when an error occurs while loading hierarchy.

### Patch Changes

- [#660](https://github.com/iTwin/presentation/pull/660): Switch to `onClick` and `onNodeKeyDown` callbacks provided by `TreeNode` in `TreeNodeRenderer`.
- [#655](https://github.com/iTwin/presentation/pull/655): Remove exposed internal APIs.
- Updated dependencies:
  - @itwin/presentation-hierarchies@0.3.0
  - @itwin/unified-selection@0.4.5
  - @itwin/presentation-shared@0.3.2

## 0.5.3

### Patch Changes

- [#649](https://github.com/iTwin/presentation/pull/649): Changed "Clear active filter" button to switch focus to "Apply filter" button when clicked.

## 0.5.2

### Patch Changes

- [#647](https://github.com/iTwin/presentation/pull/647): Correctly detect when `RowsLimitExceededError` is thrown.

## 0.5.1

### Patch Changes

- [#645](https://github.com/iTwin/presentation/pull/645): Fixed node filtering buttons not showing when node is hovered.

## 0.5.0

### Minor Changes

- [#639](https://github.com/iTwin/presentation/pull/639): Added ability to retry loading hierarchy level that failed to load.

### Patch Changes

- [#640](https://github.com/iTwin/presentation/pull/640): Fix keyboard hierarchy navigation and visual issues when nodes are focused.
- [#636](https://github.com/iTwin/presentation/pull/636): Updated `TreeModel` to auto-expand nodes when a filter is applied to them.
- Updated dependencies:
  - @itwin/presentation-hierarchies@0.2.0

## 0.4.3

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@0.1.6

## 0.4.2

### Patch Changes

- [#630](https://github.com/iTwin/presentation/pull/630): Added `getLabel` function to `TreeRenderer` and `TreeNodeRenderer` to allow customizing node labels.
- Updated dependencies:
  - @itwin/presentation-hierarchies@0.1.5
  - @itwin/presentation-shared@0.3.1
  - @itwin/unified-selection@0.4.4

## 0.4.1

### Patch Changes

- [#627](https://github.com/iTwin/presentation/pull/627): Changed `extended` selection mode to not deselect nodes when `ctrl` is not used.
- Updated dependencies:
  - @itwin/presentation-shared@0.3.0
  - @itwin/presentation-hierarchies@0.1.4
  - @itwin/unified-selection@0.4.3

## 0.4.0

### Minor Changes

- [#615](https://github.com/iTwin/presentation/pull/615): Modified `onNodeClick` and `onNodeKeyDown` callbacks to pass node instead of id and changed `onFilterClick` to pass `HierarchyLevelDetails` instead of node id in `TreeNodeRenderer`. This change allows to access additional information about a node (such as `extendedData`) without having to perform a lookup. This change breaks the existing API, so the consuming code needs to be adjusted:

  ```typescript
  import { TreeNodeRenderer } from "@itwin/presentation-hierarchies-react";

  export function MyTreeNodeRenderer(props) {
    return (
      <TreeNodeRenderer
        {...props}
        // Previous implementation
        onNodeClick={(nodeId, isSelected, event) => someFunc(nodeId)}
        onNodeKeyDown={(nodeId, isSelected, event) => someFunc(nodeId)}
        onFilterClick={(nodeId) => {
          const hierarchyLevelDetails = getHierarchyLevelDetails(nodeId);
          someFunc(hierarchyLevelDetails);
        }}
        // After the change
        onNodeClick={(node, isSelected, event) => someFunc(node.id)}
        onNodeKeyDown={(node, isSelected, event) => someFunc(node.id)}
        onFilterClick={(hierarchyLevelDetails) =>
          someFunc(hierarchyLevelDetails)
        }
      />
    );
  }
  ```

### Patch Changes

- [#624](https://github.com/iTwin/presentation/pull/624): Reset tree state when filter is applied on hierarchy.
- Updated dependencies:
  - @itwin/presentation-hierarchies@0.1.3

## 0.3.1

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@0.1.2

## 0.3.0

### Minor Changes

- [#605](https://github.com/iTwin/presentation/pull/605): Added `onHierarchyLimitExceeded` callback to `useTree` and `useUnifiedSelectionTree` for tracking when hierarchy level exceeds the limit.

  ```typescript
  import { TreeRenderer, useTree } from "@itwin/presentation-hierarchies-react";

  function MyTree(props: MyTreeProps) {
    const state = useTree({
      ...props,
      onHierarchyLimitExceeded: ({ nodeId, filter, limit }) => {
        console.log(`Hierarchy limit of ${limit} exceeded for node ${nodeId}.`);
      },
    });
    return <TreeRenderer {...state} />;
  }
  ```

- [#607](https://github.com/iTwin/presentation/pull/607): Added `dataSourceChanged` option to `reloadTree` function retuned by `useTree` and `useUnifiedSelectionTree`. It allows to specify that data used to build the tree might have changed and need to be repulled when reloading the hierarchy.

  ```ts
  import { registerTxnListeners } from "@itwin/presentation-core-interop";

  function MyTree({ imodel, ...props }: Props) {
    const { reloadTree, treeProps } = useTree(props);
    useEffect(() => {
      // listen for changes in iModel and reload tree
      return registerTxnListeners(imodel.txns, () => {
        reloadTree({ dataSourceChanged: true });
      });
    }, [imodel, reloadTree]);
    return <TreeRenderer {...treeProps} />;
  }
  ```

## 0.2.0

### Minor Changes

- [#600](https://github.com/iTwin/presentation/pull/600): Added `onPerformanceMeasured` callback to `useTree` and `useUnifiedSelectionTree` for performance metrics reporting. This callback is invoked for `initial-load`, `hierarchy-level-load` and `reload` actions.

  ```typescript
  import { TreeRenderer, useTree } from "@itwin/presentation-hierarchies-react";

  function MyTree(props: MyTreeProps) {
    const state = useTree({
      ...props,
      onPerformanceMeasured: (action, duration) => {
        telemetryClient.log(`MyTree [${feature}] took ${duration} ms`);
      },
    });
    return <TreeRenderer {...state} />;
  }
  ```

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-hierarchies@0.1.1

## 0.1.0

### Minor Changes

- [#587](https://github.com/iTwin/presentation/pull/587): Initial release.

### Patch Changes

- Updated dependencies:
  - @itwin/presentation-shared@0.2.0
  - @itwin/unified-selection@0.4.2
  - @itwin/presentation-hierarchies@0.1.0
