@mui/x-tree-view 8.21.0 → 8.22.0

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,142 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.22.0
9
+
10
+ _Dec 11, 2025_
11
+
12
+ We'd like to extend a big thank you to the 11 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - Each Tree View component now exposes its own hook to initialize the `apiRef` object with accurate typing:
15
+
16
+ ```diff
17
+ -import { useTreeViewApiRef } from '@mui/x-tree-view/hooks';
18
+ +import { useSimpleTreeViewApiRef } from '@mui/x-tree-view/hooks';
19
+ -const apiRef = useTreeViewApiRef();
20
+ +const apiRef = useSimpleTreeViewApiRef();
21
+
22
+ -import { useTreeViewApiRef } from '@mui/x-tree-view/hooks';
23
+ +import { useRichTreeViewApiRef } from '@mui/x-tree-view/hooks';
24
+ -const apiRef = useTreeViewApiRef();
25
+ +const apiRef = useRichTreeViewApiRef();
26
+
27
+ -import { useTreeViewApiRef } from '@mui/x-tree-view/hooks';
28
+ +import { useRichTreeViewProApiRef } from '@mui/x-tree-view-pro/hooks';
29
+ -const apiRef = useTreeViewApiRef();
30
+ +const apiRef = useRichTreeViewProApiRef();
31
+ ```
32
+
33
+ - 📚 [Tutorial](https://mui.com/x/react-data-grid/tutorials/server-side-data/) on building a Data Grid with server-side data
34
+ - 🐞 Bugfixes
35
+
36
+ Special thanks go out to this community member for their valuable contributions:
37
+ @kzhgit
38
+
39
+ The following team members contributed to this release:
40
+ @alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @flaviendelangle, @JCQuintas, @mapache-salvaje, @michelengelen, @noraleonte, @oliviertassinari
41
+
42
+ ### Data Grid
43
+
44
+ #### `@mui/x-data-grid@8.22.0`
45
+
46
+ - [DataGrid] Sync component props with theme defaults (#20590) @michelengelen
47
+ - [DataGrid] Add fallback for CSS `color-mix` if it is unsupported (#20597) @cherniavskii
48
+ - [DataGrid] Use `baseTooltip` slot for column header sort icon (#20460) @kzhgit
49
+
50
+ #### `@mui/x-data-grid-pro@8.22.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
51
+
52
+ Same changes as in `@mui/x-data-grid@8.22.0`.
53
+
54
+ #### `@mui/x-data-grid-premium@8.22.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
55
+
56
+ Same changes as in `@mui/x-data-grid-pro@8.22.0`, plus:
57
+
58
+ - [DataGridPremium] Handle pivoting column name generation for empty strings (#20608) @arminmeh
59
+ - [DataGridPremium] Pass a row with aggregated value to the custom aggregation function `valueFormatter` (#20607) @arminmeh
60
+
61
+ ### Date and Time Pickers
62
+
63
+ #### `@mui/x-date-pickers@8.22.0`
64
+
65
+ - [pickers] Fix invalid date tests (#20606) @michelengelen
66
+
67
+ #### `@mui/x-date-pickers-pro@8.22.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
68
+
69
+ Same changes as in `@mui/x-date-pickers@8.22.0`.
70
+
71
+ ### Charts
72
+
73
+ #### `@mui/x-charts@8.22.0`
74
+
75
+ - [charts] Add consistent animation duration and timing (#20564) @JCQuintas
76
+ - [charts] Extract a tooltip plugin from the interaction one (#20591) @alexfauquette
77
+ - [charts] General type improvements (#20565) @JCQuintas
78
+ - [charts] Place ordinal ticks according to a continuous scale (#19808) @alexfauquette
79
+ - [charts] Remove layout data from the tooltip internals (#20548) @alexfauquette
80
+ - [charts] Remove usage of focus outline for item highlight (#19856) @alexfauquette
81
+ - [charts] Simplify `MarkPlot` by moving calculation to `useMarkPlotData` (#20570) @JCQuintas
82
+ - [charts] Use `store.state` over `store.getSnapshot()` (#20616) @bernardobelchior
83
+ - [charts] Vendor flatqueue (#20610) @bernardobelchior
84
+ - [charts] Extract pie layout computation (#20611) @alexfauquette
85
+ - [charts][infra] Enable `@typescript-eslint/consistent-type-imports` eslint rules (#20560) @JCQuintas
86
+ - [charts][infra] Enable `import/no-cycle` eslint rules (#20554) @JCQuintas
87
+
88
+ #### `@mui/x-charts-pro@8.22.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
89
+
90
+ Same changes as in `@mui/x-charts@8.22.0`, plus:
91
+
92
+ - [charts-pro] Display sankey labels on top of nodes (#20569) @alexfauquette
93
+
94
+ #### `@mui/x-charts-premium@8.22.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
95
+
96
+ Same changes as in `@mui/x-charts-pro@8.22.0`.
97
+
98
+ ### Tree View
99
+
100
+ #### `@mui/x-tree-view@8.22.0`
101
+
102
+ - [tree view] Expose one hook per component to initialize the `apiRef` (#20235) @flaviendelangle
103
+ - [tree view] Update the typing of `updateItemChildren()` to accept `null` (#20483) @noraleonte
104
+
105
+ #### `@mui/x-tree-view-pro@8.22.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
106
+
107
+ Same changes as in `@mui/x-tree-view@8.22.0`.
108
+
109
+ ### Codemod
110
+
111
+ #### `@mui/x-codemod@8.22.0`
112
+
113
+ Internal changes.
114
+
115
+ ### Docs
116
+
117
+ - [docs] Add tutorial on building a Data Grid with server-side data (DX-22) (#19782) @mapache-salvaje
118
+ - [docs] Modify the default value for the stacking demo (#20596) @alexfauquette
119
+ - [docs] Revise the Charts Custom Components doc (#19793) @mapache-salvaje
120
+ - [docs] Remove copy-pasted `aria-label` (#20620) @alexfauquette
121
+
122
+ ### Core
123
+
124
+ - [internal] Remove unsafe dependency version from range (#20574) @oliviertassinari
125
+
126
+ ### Miscellaneous
127
+
128
+ - Bump `@mui/monorepo` digest to `800638d` (#20337) @renovate[bot]
129
+ - Bump `@next/eslint-plugin-next` to `15.5.7` (#20575) @renovate[bot]
130
+ - Bump GitHub Actions (#20577) @renovate[bot]
131
+ - Bump Tanstack query to `^5.90.12` (#20582) @renovate[bot]
132
+ - Bump Vite & Vitest (#20583) @renovate[bot]
133
+ - Bump `eslint` to `^8.48.1` (#20576) @renovate[bot]
134
+ - Bump `markdown-to-jsx` to `^9.3.2` (#20507) @renovate[bot]
135
+ - Bump `motion` to `^12.23.25` (#20579) @renovate[bot]
136
+ - Bump react monorepo to `19.2.1` (#20581) @renovate[bot]
137
+ - Bump `react-hook-form` to `^7.68.0` (#20584) @renovate[bot]
138
+ - Bump `react-router` to `^7.10.1` (#20341) @renovate[bot]
139
+ - Bump `tsx` to `^4.21.0` (#20585) @renovate[bot]
140
+ - Bump MUI infra packages (#20478) @renovate[bot]
141
+ - [infra] Automatically add teams to release PRs (#20558) @JCQuintas
142
+ - [infra] Fix codeowners typo (#20562) @JCQuintas
143
+
8
144
  ## 8.21.0
9
145
 
10
146
  _Dec 3, 2025_
@@ -115,7 +251,7 @@ Internal changes.
115
251
  - Bump react-hook-form to ^7.66.1 (#20497) @renovate[bot]
116
252
  - Bump rimraf to ^6.1.2 (#20498) @renovate[bot]
117
253
  - Bump webpack-bundle-analyzer to ^5.0.1 (#20508) @renovate[bot]
118
- - Bump next to ^15.5.6 [SECURITY] (#20555) @renovate[bot]
254
+ - Bump next to ^15.5.7 [SECURITY] (#20555) @renovate[bot]
119
255
 
120
256
  ## 8.20.0
121
257
 
@@ -132,7 +132,7 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
132
132
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
133
133
  // ----------------------------------------------------------------------
134
134
  /**
135
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
135
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useRichTreeViewApiRef()`.
136
136
  */
137
137
  apiRef: _propTypes.default.shape({
138
138
  current: _propTypes.default.shape({
@@ -41,7 +41,7 @@ export interface RichTreeViewProps<R extends {}, Multiple extends boolean | unde
41
41
  */
42
42
  slotProps?: RichTreeViewSlotProps<R, Multiple>;
43
43
  /**
44
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
44
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useRichTreeViewApiRef()`.
45
45
  */
46
46
  apiRef?: RichTreeViewApiRef;
47
47
  }
@@ -113,7 +113,7 @@ process.env.NODE_ENV !== "production" ? SimpleTreeView.propTypes = {
113
113
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
114
114
  // ----------------------------------------------------------------------
115
115
  /**
116
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
116
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useSimpleTreeViewApiRef()`.
117
117
  */
118
118
  apiRef: _propTypes.default.shape({
119
119
  current: _propTypes.default.shape({
@@ -40,7 +40,7 @@ export interface SimpleTreeViewProps<Multiple extends boolean | undefined> exten
40
40
  */
41
41
  sx?: SxProps<Theme>;
42
42
  /**
43
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
43
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useSimpleTreeViewApiRef()`.
44
44
  */
45
45
  apiRef?: SimpleTreeViewApiRef;
46
46
  }
@@ -125,7 +125,7 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
125
125
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
126
126
  // ----------------------------------------------------------------------
127
127
  /**
128
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
128
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useRichTreeViewApiRef()`.
129
129
  */
130
130
  apiRef: PropTypes.shape({
131
131
  current: PropTypes.shape({
@@ -41,7 +41,7 @@ export interface RichTreeViewProps<R extends {}, Multiple extends boolean | unde
41
41
  */
42
42
  slotProps?: RichTreeViewSlotProps<R, Multiple>;
43
43
  /**
44
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
44
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useRichTreeViewApiRef()`.
45
45
  */
46
46
  apiRef?: RichTreeViewApiRef;
47
47
  }
@@ -106,7 +106,7 @@ process.env.NODE_ENV !== "production" ? SimpleTreeView.propTypes = {
106
106
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
107
107
  // ----------------------------------------------------------------------
108
108
  /**
109
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
109
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useSimpleTreeViewApiRef()`.
110
110
  */
111
111
  apiRef: PropTypes.shape({
112
112
  current: PropTypes.shape({
@@ -40,7 +40,7 @@ export interface SimpleTreeViewProps<Multiple extends boolean | undefined> exten
40
40
  */
41
41
  sx?: SxProps<Theme>;
42
42
  /**
43
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
43
+ * The ref object that allows Tree View manipulation. Can be instantiated with `useSimpleTreeViewApiRef()`.
44
44
  */
45
45
  apiRef?: SimpleTreeViewApiRef;
46
46
  }
@@ -1,4 +1,6 @@
1
- export { useTreeViewApiRef } from "./useTreeViewApiRef.js";
2
1
  export { useTreeItemUtils } from "./useTreeItemUtils/index.js";
3
2
  export { useTreeItemModel } from "./useTreeItemModel.js";
4
- export { useApplyPropagationToSelectedItemsOnMount } from "./useApplyPropagationToSelectedItemsOnMount.js";
3
+ export { useApplyPropagationToSelectedItemsOnMount } from "./useApplyPropagationToSelectedItemsOnMount.js";
4
+ export { useTreeViewApiRef } from "./useTreeViewApiRef.js";
5
+ export { useRichTreeViewApiRef } from "./useRichTreeViewApiRef.js";
6
+ export { useSimpleTreeViewApiRef } from "./useSimpleTreeViewApiRef.js";
@@ -1,4 +1,6 @@
1
- export { useTreeViewApiRef } from "./useTreeViewApiRef.js";
2
1
  export { useTreeItemUtils } from "./useTreeItemUtils/index.js";
3
2
  export { useTreeItemModel } from "./useTreeItemModel.js";
4
- export { useApplyPropagationToSelectedItemsOnMount } from "./useApplyPropagationToSelectedItemsOnMount.js";
3
+ export { useApplyPropagationToSelectedItemsOnMount } from "./useApplyPropagationToSelectedItemsOnMount.js";
4
+ export { useTreeViewApiRef } from "./useTreeViewApiRef.js";
5
+ export { useRichTreeViewApiRef } from "./useRichTreeViewApiRef.js";
6
+ export { useSimpleTreeViewApiRef } from "./useSimpleTreeViewApiRef.js";
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { TreeViewDefaultItemModelProperties, TreeViewValidItem } from "../models/index.js";
3
+ import { TreeViewPublicAPI } from "../internals/models/index.js";
4
+ import { RichTreeViewPluginSignatures } from "../RichTreeView/RichTreeView.plugins.js";
5
+ /**
6
+ * Creates the ref to pass to the `apiRef` prop of the `RichTreeView` component.
7
+ */
8
+ export declare function useRichTreeViewApiRef<R extends TreeViewValidItem<R> = TreeViewDefaultItemModelProperties>(): React.RefObject<TreeViewPublicAPI<RichTreeViewPluginSignatures> | undefined>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Creates the ref to pass to the `apiRef` prop of the `RichTreeView` component.
4
+ */
5
+ export function useRichTreeViewApiRef() {
6
+ return React.useRef(undefined);
7
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { TreeViewDefaultItemModelProperties, TreeViewValidItem } from "../models/index.js";
3
+ import { TreeViewPublicAPI } from "../internals/models/index.js";
4
+ import { SimpleTreeViewPluginSignatures } from "../SimpleTreeView/SimpleTreeView.plugins.js";
5
+ /**
6
+ * Creates the ref to pass to the `apiRef` prop of the `SimpleTreeView` component.
7
+ */
8
+ export declare function useSimpleTreeViewApiRef<R extends TreeViewValidItem<R> = TreeViewDefaultItemModelProperties>(): React.RefObject<TreeViewPublicAPI<SimpleTreeViewPluginSignatures> | undefined>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Creates the ref to pass to the `apiRef` prop of the `SimpleTreeView` component.
4
+ */
5
+ export function useSimpleTreeViewApiRef() {
6
+ return React.useRef(undefined);
7
+ }
@@ -3,5 +3,6 @@ import { TreeViewAnyPluginSignature, TreeViewPublicAPI } from "../internals/mode
3
3
  import { RichTreeViewPluginSignatures } from "../RichTreeView/RichTreeView.plugins.js";
4
4
  /**
5
5
  * Hook that instantiates a [[TreeViewApiRef]].
6
+ * @deprecated Use `useRichTreeViewApiRef`, `useRichTreeViewProApiRef` or `useSimpleTreeViewApiRef` instead.
6
7
  */
7
8
  export declare const useTreeViewApiRef: <TSignatures extends readonly TreeViewAnyPluginSignature[] = RichTreeViewPluginSignatures>() => React.RefObject<TreeViewPublicAPI<TSignatures> | undefined>;
@@ -3,5 +3,6 @@
3
3
  import * as React from 'react';
4
4
  /**
5
5
  * Hook that instantiates a [[TreeViewApiRef]].
6
+ * @deprecated Use `useRichTreeViewApiRef`, `useRichTreeViewProApiRef` or `useSimpleTreeViewApiRef` instead.
6
7
  */
7
8
  export const useTreeViewApiRef = () => React.useRef(undefined);
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v8.21.0
2
+ * @mui/x-tree-view v8.22.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -30,10 +30,10 @@ export interface UseTreeViewLazyLoadingPublicAPI {
30
30
  * Method used for updating an item's children.
31
31
  * Only relevant for lazy-loaded tree views.
32
32
  *
33
- * @param {TreeViewItemId} itemId The The id of the item to update the children of.
33
+ * @param {TreeViewItemId | null} itemId The id of the item to update the children of. If null is passed, it will update the root's children.
34
34
  * @returns {Promise<void>} The promise resolved when the items are fetched.
35
35
  */
36
- updateItemChildren: (itemId: TreeViewItemId) => Promise<void>;
36
+ updateItemChildren: (itemId: TreeViewItemId | null) => Promise<void>;
37
37
  }
38
38
  export interface UseTreeViewLazyLoadingInstance extends UseTreeViewLazyLoadingPublicAPI {
39
39
  /**
@@ -4,9 +4,12 @@ export type TreeViewDefaultItemModelProperties = {
4
4
  label: string;
5
5
  children?: TreeViewDefaultItemModelProperties[];
6
6
  };
7
- export type TreeViewBaseItem<R extends {} = TreeViewDefaultItemModelProperties> = R & {
7
+ export type TreeViewBaseItem<R extends object = TreeViewDefaultItemModelProperties> = R & {
8
8
  children?: TreeViewBaseItem<R>[];
9
9
  };
10
+ export type TreeViewValidItem<R extends object> = {
11
+ children?: R[];
12
+ };
10
13
  export type TreeViewItemsReorderingAction = 'reorder-above' | 'reorder-below' | 'make-child' | 'move-to-parent';
11
14
  export interface TreeViewSelectionPropagation {
12
15
  descendants?: boolean;
package/hooks/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- export { useTreeViewApiRef } from "./useTreeViewApiRef.js";
2
1
  export { useTreeItemUtils } from "./useTreeItemUtils/index.js";
3
2
  export { useTreeItemModel } from "./useTreeItemModel.js";
4
- export { useApplyPropagationToSelectedItemsOnMount } from "./useApplyPropagationToSelectedItemsOnMount.js";
3
+ export { useApplyPropagationToSelectedItemsOnMount } from "./useApplyPropagationToSelectedItemsOnMount.js";
4
+ export { useTreeViewApiRef } from "./useTreeViewApiRef.js";
5
+ export { useRichTreeViewApiRef } from "./useRichTreeViewApiRef.js";
6
+ export { useSimpleTreeViewApiRef } from "./useSimpleTreeViewApiRef.js";
package/hooks/index.js CHANGED
@@ -9,6 +9,18 @@ Object.defineProperty(exports, "useApplyPropagationToSelectedItemsOnMount", {
9
9
  return _useApplyPropagationToSelectedItemsOnMount.useApplyPropagationToSelectedItemsOnMount;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "useRichTreeViewApiRef", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _useRichTreeViewApiRef.useRichTreeViewApiRef;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "useSimpleTreeViewApiRef", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _useSimpleTreeViewApiRef.useSimpleTreeViewApiRef;
22
+ }
23
+ });
12
24
  Object.defineProperty(exports, "useTreeItemModel", {
13
25
  enumerable: true,
14
26
  get: function () {
@@ -27,7 +39,9 @@ Object.defineProperty(exports, "useTreeViewApiRef", {
27
39
  return _useTreeViewApiRef.useTreeViewApiRef;
28
40
  }
29
41
  });
30
- var _useTreeViewApiRef = require("./useTreeViewApiRef");
31
42
  var _useTreeItemUtils = require("./useTreeItemUtils");
32
43
  var _useTreeItemModel = require("./useTreeItemModel");
33
- var _useApplyPropagationToSelectedItemsOnMount = require("./useApplyPropagationToSelectedItemsOnMount");
44
+ var _useApplyPropagationToSelectedItemsOnMount = require("./useApplyPropagationToSelectedItemsOnMount");
45
+ var _useTreeViewApiRef = require("./useTreeViewApiRef");
46
+ var _useRichTreeViewApiRef = require("./useRichTreeViewApiRef");
47
+ var _useSimpleTreeViewApiRef = require("./useSimpleTreeViewApiRef");
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { TreeViewDefaultItemModelProperties, TreeViewValidItem } from "../models/index.js";
3
+ import { TreeViewPublicAPI } from "../internals/models/index.js";
4
+ import { RichTreeViewPluginSignatures } from "../RichTreeView/RichTreeView.plugins.js";
5
+ /**
6
+ * Creates the ref to pass to the `apiRef` prop of the `RichTreeView` component.
7
+ */
8
+ export declare function useRichTreeViewApiRef<R extends TreeViewValidItem<R> = TreeViewDefaultItemModelProperties>(): React.RefObject<TreeViewPublicAPI<RichTreeViewPluginSignatures> | undefined>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useRichTreeViewApiRef = useRichTreeViewApiRef;
8
+ var React = _interopRequireWildcard(require("react"));
9
+ /**
10
+ * Creates the ref to pass to the `apiRef` prop of the `RichTreeView` component.
11
+ */
12
+ function useRichTreeViewApiRef() {
13
+ return React.useRef(undefined);
14
+ }
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { TreeViewDefaultItemModelProperties, TreeViewValidItem } from "../models/index.js";
3
+ import { TreeViewPublicAPI } from "../internals/models/index.js";
4
+ import { SimpleTreeViewPluginSignatures } from "../SimpleTreeView/SimpleTreeView.plugins.js";
5
+ /**
6
+ * Creates the ref to pass to the `apiRef` prop of the `SimpleTreeView` component.
7
+ */
8
+ export declare function useSimpleTreeViewApiRef<R extends TreeViewValidItem<R> = TreeViewDefaultItemModelProperties>(): React.RefObject<TreeViewPublicAPI<SimpleTreeViewPluginSignatures> | undefined>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useSimpleTreeViewApiRef = useSimpleTreeViewApiRef;
8
+ var React = _interopRequireWildcard(require("react"));
9
+ /**
10
+ * Creates the ref to pass to the `apiRef` prop of the `SimpleTreeView` component.
11
+ */
12
+ function useSimpleTreeViewApiRef() {
13
+ return React.useRef(undefined);
14
+ }
@@ -3,5 +3,6 @@ import { TreeViewAnyPluginSignature, TreeViewPublicAPI } from "../internals/mode
3
3
  import { RichTreeViewPluginSignatures } from "../RichTreeView/RichTreeView.plugins.js";
4
4
  /**
5
5
  * Hook that instantiates a [[TreeViewApiRef]].
6
+ * @deprecated Use `useRichTreeViewApiRef`, `useRichTreeViewProApiRef` or `useSimpleTreeViewApiRef` instead.
6
7
  */
7
8
  export declare const useTreeViewApiRef: <TSignatures extends readonly TreeViewAnyPluginSignature[] = RichTreeViewPluginSignatures>() => React.RefObject<TreeViewPublicAPI<TSignatures> | undefined>;
@@ -9,6 +9,7 @@ exports.useTreeViewApiRef = void 0;
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
  /**
11
11
  * Hook that instantiates a [[TreeViewApiRef]].
12
+ * @deprecated Use `useRichTreeViewApiRef`, `useRichTreeViewProApiRef` or `useSimpleTreeViewApiRef` instead.
12
13
  */
13
14
  const useTreeViewApiRef = () => React.useRef(undefined);
14
15
  exports.useTreeViewApiRef = useTreeViewApiRef;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v8.21.0
2
+ * @mui/x-tree-view v8.22.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -30,10 +30,10 @@ export interface UseTreeViewLazyLoadingPublicAPI {
30
30
  * Method used for updating an item's children.
31
31
  * Only relevant for lazy-loaded tree views.
32
32
  *
33
- * @param {TreeViewItemId} itemId The The id of the item to update the children of.
33
+ * @param {TreeViewItemId | null} itemId The id of the item to update the children of. If null is passed, it will update the root's children.
34
34
  * @returns {Promise<void>} The promise resolved when the items are fetched.
35
35
  */
36
- updateItemChildren: (itemId: TreeViewItemId) => Promise<void>;
36
+ updateItemChildren: (itemId: TreeViewItemId | null) => Promise<void>;
37
37
  }
38
38
  export interface UseTreeViewLazyLoadingInstance extends UseTreeViewLazyLoadingPublicAPI {
39
39
  /**
package/models/items.d.ts CHANGED
@@ -4,9 +4,12 @@ export type TreeViewDefaultItemModelProperties = {
4
4
  label: string;
5
5
  children?: TreeViewDefaultItemModelProperties[];
6
6
  };
7
- export type TreeViewBaseItem<R extends {} = TreeViewDefaultItemModelProperties> = R & {
7
+ export type TreeViewBaseItem<R extends object = TreeViewDefaultItemModelProperties> = R & {
8
8
  children?: TreeViewBaseItem<R>[];
9
9
  };
10
+ export type TreeViewValidItem<R extends object> = {
11
+ children?: R[];
12
+ };
10
13
  export type TreeViewItemsReorderingAction = 'reorder-above' | 'reorder-below' | 'make-child' | 'move-to-parent';
11
14
  export interface TreeViewSelectionPropagation {
12
15
  descendants?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-tree-view",
3
- "version": "8.21.0",
3
+ "version": "8.22.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The community edition of the MUI X Tree View components.",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "clsx": "^2.1.1",
39
39
  "prop-types": "^15.8.1",
40
40
  "react-transition-group": "^4.4.5",
41
- "@mui/x-internals": "8.21.0"
41
+ "@mui/x-internals": "8.22.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.9.0",