@mui/x-tree-view 7.5.1 → 7.6.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +87 -1
  2. package/RichTreeView/RichTreeView.js +14 -0
  3. package/RichTreeView/RichTreeView.types.d.ts +7 -1
  4. package/SimpleTreeView/SimpleTreeView.js +14 -0
  5. package/SimpleTreeView/SimpleTreeView.types.d.ts +7 -1
  6. package/TreeItem/TreeItem.js +35 -7
  7. package/TreeItem/TreeItem.types.d.ts +1 -0
  8. package/TreeItem2/TreeItem2.d.ts +12 -6
  9. package/TreeItem2/TreeItem2.js +21 -10
  10. package/TreeItem2Provider/TreeItem2Provider.js +4 -2
  11. package/TreeView/TreeView.js +14 -0
  12. package/index.js +1 -1
  13. package/internals/TreeViewItemDepthContext/TreeViewItemDepthContext.d.ts +3 -0
  14. package/internals/TreeViewItemDepthContext/TreeViewItemDepthContext.js +5 -0
  15. package/internals/TreeViewItemDepthContext/index.d.ts +1 -0
  16. package/internals/TreeViewItemDepthContext/index.js +1 -0
  17. package/internals/TreeViewProvider/TreeViewContext.d.ts +2 -2
  18. package/internals/TreeViewProvider/TreeViewProvider.types.d.ts +2 -2
  19. package/internals/index.d.ts +1 -1
  20. package/internals/models/helpers.d.ts +1 -0
  21. package/internals/models/plugin.d.ts +12 -5
  22. package/internals/models/treeView.d.ts +8 -1
  23. package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.d.ts +28 -4
  24. package/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +11 -26
  25. package/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.d.ts +20 -5
  26. package/internals/plugins/useTreeViewId/useTreeViewId.types.d.ts +10 -1
  27. package/internals/plugins/useTreeViewItems/useTreeViewItems.js +29 -8
  28. package/internals/plugins/useTreeViewItems/useTreeViewItems.types.d.ts +50 -7
  29. package/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.js +34 -25
  30. package/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.types.d.ts +22 -4
  31. package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.d.ts +14 -1
  32. package/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.d.ts +5 -0
  33. package/internals/useTreeView/useTreeView.js +8 -3
  34. package/internals/useTreeView/useTreeView.types.d.ts +2 -1
  35. package/internals/utils/extractPluginParamsFromProps.d.ts +3 -2
  36. package/internals/utils/extractPluginParamsFromProps.js +4 -2
  37. package/internals/utils/tree.js +18 -1
  38. package/modern/RichTreeView/RichTreeView.js +14 -0
  39. package/modern/SimpleTreeView/SimpleTreeView.js +14 -0
  40. package/modern/TreeItem/TreeItem.js +35 -7
  41. package/modern/TreeItem2/TreeItem2.js +21 -10
  42. package/modern/TreeItem2Provider/TreeItem2Provider.js +4 -2
  43. package/modern/TreeView/TreeView.js +14 -0
  44. package/modern/index.js +1 -1
  45. package/modern/internals/TreeViewItemDepthContext/TreeViewItemDepthContext.js +5 -0
  46. package/modern/internals/TreeViewItemDepthContext/index.js +1 -0
  47. package/modern/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +11 -26
  48. package/modern/internals/plugins/useTreeViewItems/useTreeViewItems.js +29 -8
  49. package/modern/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.js +34 -25
  50. package/modern/internals/useTreeView/useTreeView.js +8 -3
  51. package/modern/internals/utils/extractPluginParamsFromProps.js +4 -2
  52. package/modern/internals/utils/tree.js +18 -1
  53. package/modern/useTreeItem2/useTreeItem2.js +20 -3
  54. package/node/RichTreeView/RichTreeView.js +14 -0
  55. package/node/SimpleTreeView/SimpleTreeView.js +14 -0
  56. package/node/TreeItem/TreeItem.js +35 -7
  57. package/node/TreeItem2/TreeItem2.js +20 -9
  58. package/node/TreeItem2Provider/TreeItem2Provider.js +4 -2
  59. package/node/TreeView/TreeView.js +14 -0
  60. package/node/index.js +1 -1
  61. package/node/internals/TreeViewItemDepthContext/TreeViewItemDepthContext.js +13 -0
  62. package/node/internals/TreeViewItemDepthContext/index.js +12 -0
  63. package/node/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +11 -26
  64. package/node/internals/plugins/useTreeViewItems/useTreeViewItems.js +29 -8
  65. package/node/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.js +34 -25
  66. package/node/internals/useTreeView/useTreeView.js +8 -3
  67. package/node/internals/utils/extractPluginParamsFromProps.js +4 -2
  68. package/node/internals/utils/tree.js +18 -1
  69. package/node/useTreeItem2/useTreeItem2.js +20 -3
  70. package/package.json +3 -3
  71. package/useTreeItem2/useTreeItem2.js +20 -3
  72. package/useTreeItem2/useTreeItem2.types.d.ts +12 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,92 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.6.0
7
+
8
+ _May 30, 2024_
9
+
10
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Allow to define and customize the indentation of nested items in the Tree View
13
+ - ✨ Allow charts highlights to be controlled
14
+ - 🌍 Improve Persian (fa-IR) locale on the Data Grid
15
+ - 🐞 Bugfixes
16
+ - 📚 Documentation improvements
17
+
18
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
19
+
20
+ ### Data Grid
21
+
22
+ #### `@mui/x-data-grid@7.6.0`
23
+
24
+ - [DataGrid] Avoid re-rendering all cells on column change (#12980) @romgrk
25
+ - [DataGrid] Export `GridColumnHeadersProps` (#13229) @cherniavskii
26
+ - [DataGrid] Fix header filters' issue with custom filters (#13255) @MBilalShafi
27
+ - [DataGrid] Remove dead logic to support Safari < 13 (#13249) @oliviertassinari
28
+ - [l10n] Improve Persian (fa-IR) locale (#12994) @amiryxe
29
+
30
+ #### `@mui/x-data-grid-pro@7.6.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
31
+
32
+ Same changes as in `@mui/x-data-grid@7.6.0`.
33
+
34
+ #### `@mui/x-data-grid-premium@7.6.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
35
+
36
+ Same changes as in `@mui/x-data-grid-pro@7.6.0`, plus:
37
+
38
+ - [DataGridPremium] Fix excel export causing column with wrong width (#13191) @romgrk
39
+
40
+ ### Date and Time Pickers
41
+
42
+ #### `@mui/x-date-pickers@7.6.0`
43
+
44
+ - [pickers] Fix `DateBuilderReturnType` when the date is `undefined` (#13244) @alexey-kozlenkov
45
+
46
+ #### `@mui/x-date-pickers-pro@7.6.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
47
+
48
+ Same changes as in `@mui/x-date-pickers@7.6.0`.
49
+
50
+ ### Charts
51
+
52
+ #### `@mui/x-charts@7.6.0`
53
+
54
+ - [charts] Allow charts highlights to be controlled (#12828) @JCQuintas
55
+ - [charts] Refactor axis band scaleType check (#13295) @JCQuintas
56
+ - [charts] Refactor checkScaleErrors to improve readability and simplify axis message logic (#13305) @JCQuintas
57
+
58
+ ### Tree View
59
+
60
+ #### `@mui/x-tree-view@7.6.0`
61
+
62
+ - [TreeView] Add JSDoc to every instance method (#13219) @flaviendelangle
63
+ - [TreeView] Allow to customize the indentation of nested items (#13225) @flaviendelangle
64
+ - [TreeView] Allow to define indentation at the item level (#13126) @flaviendelangle
65
+
66
+ ### Docs
67
+
68
+ - [docs] Add Bulk editing demo for the Community plan (#12800) @cherniavskii
69
+ - [docs] Add conditional label formatting on tooltip page and link to label page (#13235) @JCQuintas
70
+ - [docs] Add information about key combinations on a11y sections (#13234) @arthurbalduini
71
+ - [docs] Cleanup of the Tree View demos (#13237) @flaviendelangle
72
+ - [docs] Document how to customize a subsection of a line chart (#13210) @alexfauquette
73
+ - [docs] Fix Pickers FAQ callout (#13238) @LukasTy
74
+ - [docs] Fix Vale errors @oliviertassinari
75
+ - [docs] Fix a small typo in property comment (#13245) @Janpot
76
+ - [docs] Improve the Data Grid FAQ page (#13258) @MBilalShafi
77
+ - [docs] Removes unused lines in TreeItem2 styling (#13264) @arthurbalduini
78
+ - [docs] Small improvements on accessibility data grid doc (#13233) @arthurbalduini
79
+ - [docs] Update Pickers demo configurations (#13303) @LukasTy
80
+
81
+ ### Core
82
+
83
+ - [core] Add comment on why logic to sync column header (#13248) @oliviertassinari
84
+ - [core] Fix `l10n` script execution with arguments (#13297) @LukasTy
85
+ - [core] Prevent "Add reviewers" workflow from triggering since it doesn't work (#13236) @JCQuintas
86
+ - [docs-infra] Fix `@mui/material` version used in sandboxes (#13260) @LukasTy
87
+ - [test] Use `describeTreeView` for keyboard navigation tests on disabled items (#13184) @flaviendelangle
88
+ - [test] Use `describeTreeView` for remaining items tests (#13262) @flaviendelangle
89
+ - [test] Use test-utils from npm (#12880) @michaldudak
90
+ - [typescript] Remove duplicate `DateRangePosition` type in favor of `RangePosition` (#13288) @LukasTy
91
+
6
92
  ## v7.5.1
7
93
 
8
94
  _May 23, 2024_
@@ -339,7 +425,7 @@ Same changes as in `@mui/x-date-pickers@7.3.1`.
339
425
  ### Core
340
426
 
341
427
  - [core] Fix `l10n` GH workflow (#12895) @LukasTy
342
- - [core] Match Base UI and Toolpad @oliviertassinari
428
+ - [core] Match Base UI and Toolpad @oliviertassinari
343
429
  - [core] Remove redundant `setupFiles` entries in `package.json` (#12899) @LukasTy
344
430
  - [core] Use `describeTreeView` for focus tests (#12698) @flaviendelangle
345
431
  - [core] Use `describeTreeView` for type-ahead tests (#12811) @flaviendelangle
@@ -180,6 +180,14 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
180
180
  * Used when the item's expansion is controlled.
181
181
  */
182
182
  expandedItems: PropTypes.arrayOf(PropTypes.string),
183
+ /**
184
+ * Unstable features, breaking changes might be introduced.
185
+ * For each feature, if the flag is not explicitly set to `true`,
186
+ * the feature will be fully disabled and any property / method call will not have any effect.
187
+ */
188
+ experimentalFeatures: PropTypes.shape({
189
+ indentationAtItemLevel: PropTypes.bool
190
+ }),
183
191
  /**
184
192
  * Used to determine the id of a given item.
185
193
  *
@@ -210,6 +218,12 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
210
218
  * @returns {boolean} `true` if the item should be disabled.
211
219
  */
212
220
  isItemDisabled: PropTypes.func,
221
+ /**
222
+ * Horizontal indentation between an item and its children.
223
+ * Examples: 24, "24px", "2rem", "2em".
224
+ * @default 12px
225
+ */
226
+ itemChildrenIndentation: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
213
227
  items: PropTypes.array.isRequired,
214
228
  /**
215
229
  * If `true`, `ctrl` and `shift` will trigger multiselect.
@@ -7,7 +7,7 @@ import { DefaultTreeViewPluginParameters, DefaultTreeViewPluginSlotProps, Defaul
7
7
  import { TreeItemProps } from '../TreeItem';
8
8
  import { TreeItem2Props } from '../TreeItem2';
9
9
  import { TreeViewItemId } from '../models';
10
- import { SlotComponentPropsFromProps, TreeViewPublicAPI } from '../internals/models';
10
+ import { SlotComponentPropsFromProps, TreeViewExperimentalFeatures, TreeViewPublicAPI } from '../internals/models';
11
11
  interface RichTreeViewItemSlotOwnerState {
12
12
  itemId: TreeViewItemId;
13
13
  label: string;
@@ -55,5 +55,11 @@ export interface RichTreeViewProps<R extends {}, Multiple extends boolean | unde
55
55
  * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
56
56
  */
57
57
  apiRef?: RichTreeViewApiRef;
58
+ /**
59
+ * Unstable features, breaking changes might be introduced.
60
+ * For each feature, if the flag is not explicitly set to `true`,
61
+ * the feature will be fully disabled and any property / method call will not have any effect.
62
+ */
63
+ experimentalFeatures?: TreeViewExperimentalFeatures<DefaultTreeViewPlugins>;
58
64
  }
59
65
  export {};
@@ -142,11 +142,25 @@ process.env.NODE_ENV !== "production" ? SimpleTreeView.propTypes = {
142
142
  * Used when the item's expansion is controlled.
143
143
  */
144
144
  expandedItems: PropTypes.arrayOf(PropTypes.string),
145
+ /**
146
+ * Unstable features, breaking changes might be introduced.
147
+ * For each feature, if the flag is not explicitly set to `true`,
148
+ * the feature will be fully disabled and any property / method call will not have any effect.
149
+ */
150
+ experimentalFeatures: PropTypes.shape({
151
+ indentationAtItemLevel: PropTypes.bool
152
+ }),
145
153
  /**
146
154
  * This prop is used to help implement the accessibility logic.
147
155
  * If you don't provide this prop. It falls back to a randomly generated id.
148
156
  */
149
157
  id: PropTypes.string,
158
+ /**
159
+ * Horizontal indentation between an item and its children.
160
+ * Examples: 24, "24px", "2rem", "2em".
161
+ * @default 12px
162
+ */
163
+ itemChildrenIndentation: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
150
164
  /**
151
165
  * If `true`, `ctrl` and `shift` will trigger multiselect.
152
166
  * @default false
@@ -4,7 +4,7 @@ import { SlotComponentProps } from '@mui/base/utils';
4
4
  import { SxProps } from '@mui/system';
5
5
  import { SimpleTreeViewClasses } from './simpleTreeViewClasses';
6
6
  import { SimpleTreeViewPluginParameters, SimpleTreeViewPluginSlotProps, SimpleTreeViewPluginSlots, SimpleTreeViewPlugins } from './SimpleTreeView.plugins';
7
- import { TreeViewPublicAPI } from '../internals/models';
7
+ import { TreeViewExperimentalFeatures, TreeViewPublicAPI } from '../internals/models';
8
8
  export interface SimpleTreeViewSlots extends SimpleTreeViewPluginSlots {
9
9
  /**
10
10
  * Element rendered at the root.
@@ -42,4 +42,10 @@ export interface SimpleTreeViewProps<Multiple extends boolean | undefined> exten
42
42
  * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
43
43
  */
44
44
  apiRef?: SimpleTreeViewApiRef;
45
+ /**
46
+ * Unstable features, breaking changes might be introduced.
47
+ * For each feature, if the flag is not explicitly set to `true`,
48
+ * the feature will be fully disabled and any property / method call will not have any effect.
49
+ */
50
+ experimentalFeatures?: TreeViewExperimentalFeatures<SimpleTreeViewPlugins>;
45
51
  }
@@ -10,6 +10,7 @@ import clsx from 'clsx';
10
10
  import Collapse from '@mui/material/Collapse';
11
11
  import { resolveComponentProps, useSlotProps } from '@mui/base/utils';
12
12
  import useForkRef from '@mui/utils/useForkRef';
13
+ import { shouldForwardProp } from '@mui/system/createStyled';
13
14
  import { alpha, styled, useThemeProps } from '@mui/material/styles';
14
15
  import unsupportedProp from '@mui/utils/unsupportedProp';
15
16
  import elementTypeAcceptingRef from '@mui/utils/elementTypeAcceptingRef';
@@ -19,6 +20,7 @@ import { treeItemClasses, getTreeItemUtilityClass } from './treeItemClasses';
19
20
  import { useTreeViewContext } from '../internals/TreeViewProvider/useTreeViewContext';
20
21
  import { TreeViewCollapseIcon, TreeViewExpandIcon } from '../icons';
21
22
  import { TreeItem2Provider } from '../TreeItem2Provider';
23
+ import { TreeViewItemDepthContext } from '../internals/TreeViewItemDepthContext';
22
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
25
  const useUtilityClasses = ownerState => {
24
26
  const {
@@ -57,7 +59,8 @@ const StyledTreeItemContent = styled(TreeItemContent, {
57
59
  }, styles.label && {
58
60
  [`& .${treeItemClasses.label}`]: styles.label
59
61
  }];
60
- }
62
+ },
63
+ shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'indentationAtItemLevel'
61
64
  })(({
62
65
  theme
63
66
  }) => ({
@@ -117,16 +120,33 @@ const StyledTreeItemContent = styled(TreeItemContent, {
117
120
  }, theme.typography.body1),
118
121
  [`& .${treeItemClasses.checkbox}`]: {
119
122
  padding: 0
120
- }
123
+ },
124
+ variants: [{
125
+ props: {
126
+ indentationAtItemLevel: true
127
+ },
128
+ style: {
129
+ paddingLeft: `calc(${theme.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`
130
+ }
131
+ }]
121
132
  }));
122
133
  const TreeItemGroup = styled(Collapse, {
123
134
  name: 'MuiTreeItem',
124
135
  slot: 'GroupTransition',
125
- overridesResolver: (props, styles) => styles.groupTransition
136
+ overridesResolver: (props, styles) => styles.groupTransition,
137
+ shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'indentationAtItemLevel'
126
138
  })({
127
139
  margin: 0,
128
140
  padding: 0,
129
- paddingLeft: 12
141
+ paddingLeft: 'var(--TreeView-itemChildrenIndentation)',
142
+ variants: [{
143
+ props: {
144
+ indentationAtItemLevel: true
145
+ },
146
+ style: {
147
+ paddingLeft: 0
148
+ }
149
+ }]
130
150
  });
131
151
 
132
152
  /**
@@ -147,8 +167,10 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
147
167
  multiSelect
148
168
  },
149
169
  disabledItemsFocusable,
170
+ indentationAtItemLevel,
150
171
  instance
151
172
  } = useTreeViewContext();
173
+ const depthContext = React.useContext(TreeViewItemDepthContext);
152
174
  const props = useThemeProps({
153
175
  props: inProps,
154
176
  name: 'MuiTreeItem'
@@ -197,7 +219,8 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
197
219
  expanded,
198
220
  focused,
199
221
  selected,
200
- disabled
222
+ disabled,
223
+ indentationAtItemLevel
201
224
  });
202
225
  const classes = useUtilityClasses(ownerState);
203
226
  const GroupTransition = slots.groupTransition ?? undefined;
@@ -205,12 +228,14 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
205
228
  elementType: GroupTransition,
206
229
  ownerState: {},
207
230
  externalSlotProps: inSlotProps?.groupTransition,
208
- additionalProps: {
231
+ additionalProps: _extends({
209
232
  unmountOnExit: true,
210
233
  in: expanded,
211
234
  component: 'ul',
212
235
  role: 'group'
213
- },
236
+ }, indentationAtItemLevel ? {
237
+ indentationAtItemLevel: true
238
+ } : {}),
214
239
  className: classes.groupTransition
215
240
  });
216
241
  const ExpansionIcon = expanded ? slots.collapseIcon : slots.expandIcon;
@@ -291,6 +316,9 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
291
316
  onBlur: handleBlur,
292
317
  onKeyDown: handleKeyDown,
293
318
  ref: handleRootRef,
319
+ style: indentationAtItemLevel ? _extends({}, other.style, {
320
+ '--TreeView-itemDepth': typeof depthContext === 'function' ? depthContext(itemId) : depthContext
321
+ }) : other.style,
294
322
  children: [/*#__PURE__*/_jsx(StyledTreeItemContent, _extends({
295
323
  as: ContentComponent,
296
324
  classes: {
@@ -96,4 +96,5 @@ export interface TreeItemOwnerState extends TreeItemProps {
96
96
  focused: boolean;
97
97
  selected: boolean;
98
98
  disabled: boolean;
99
+ indentationAtItemLevel: boolean;
99
100
  }
@@ -1,14 +1,20 @@
1
1
  import * as React from 'react';
2
2
  import { CheckboxProps } from '@mui/material/Checkbox';
3
3
  import { TreeItem2Props } from './TreeItem2.types';
4
- export declare const TreeItem2Root: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, keyof React.ClassAttributes<HTMLLIElement> | keyof React.LiHTMLAttributes<HTMLLIElement>>, {}>;
5
- export declare const TreeItem2Content: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
- export declare const TreeItem2Label: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
7
- export declare const TreeItem2IconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
8
- export declare const TreeItem2GroupTransition: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Collapse").CollapseProps, keyof import("@mui/material/Collapse").CollapseProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
4
+ import { UseTreeItem2Status } from '../useTreeItem2';
5
+ export declare const TreeItem2Root: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, keyof React.ClassAttributes<HTMLLIElement> | keyof React.LiHTMLAttributes<HTMLLIElement>>, {}>;
6
+ export declare const TreeItem2Content: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
7
+ status: UseTreeItem2Status;
8
+ indentationAtItemLevel?: true | undefined;
9
+ }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
+ export declare const TreeItem2Label: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
11
+ export declare const TreeItem2IconContainer: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
12
+ export declare const TreeItem2GroupTransition: import("@emotion/styled").StyledComponent<import("@mui/material/Collapse").CollapseProps & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
13
+ indentationAtItemLevel?: true | undefined;
14
+ }, {}, {}>;
9
15
  export declare const TreeItem2Checkbox: import("@emotion/styled").StyledComponent<Pick<Omit<CheckboxProps & {
10
16
  visible: boolean;
11
- }, "ref"> & React.RefAttributes<HTMLButtonElement>, "hidden" | "visible" | "color" | "content" | "size" | "style" | "icon" | "translate" | "disabled" | "form" | "slot" | "title" | "suppressHydrationWarning" | "className" | "id" | "lang" | "name" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "readOnly" | "required" | "action" | "checked" | "component" | "sx" | "classes" | "onFocusVisible" | "inputRef" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "checkedIcon" | "inputProps" | "indeterminate" | "indeterminateIcon" | keyof React.RefAttributes<HTMLButtonElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
17
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>, "hidden" | "visible" | "color" | "content" | "size" | "style" | "icon" | "translate" | "disabled" | "form" | "slot" | "title" | "suppressHydrationWarning" | "className" | "id" | "lang" | "name" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "readOnly" | "required" | "action" | "checked" | "component" | "sx" | "classes" | "onFocusVisible" | "inputRef" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "checkedIcon" | "inputProps" | "indeterminate" | "indeterminateIcon" | keyof React.RefAttributes<HTMLButtonElement>> & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
12
18
  type TreeItem2Component = ((props: TreeItem2Props & React.RefAttributes<HTMLLIElement>) => React.JSX.Element) & {
13
19
  propTypes?: any;
14
20
  };
@@ -10,10 +10,10 @@ import { alpha, styled, useThemeProps } from '@mui/material/styles';
10
10
  import Collapse from '@mui/material/Collapse';
11
11
  import MuiCheckbox from '@mui/material/Checkbox';
12
12
  import { useSlotProps } from '@mui/base/utils';
13
- import { shouldForwardProp } from '@mui/system';
13
+ import { shouldForwardProp } from '@mui/system/createStyled';
14
14
  import composeClasses from '@mui/utils/composeClasses';
15
15
  import { unstable_useTreeItem2 as useTreeItem2 } from '../useTreeItem2';
16
- import { getTreeItemUtilityClass, treeItemClasses } from '../TreeItem';
16
+ import { getTreeItemUtilityClass } from '../TreeItem';
17
17
  import { TreeItem2Icon } from '../TreeItem2Icon';
18
18
  import { TreeItem2Provider } from '../TreeItem2Provider';
19
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -31,7 +31,7 @@ export const TreeItem2Content = styled('div', {
31
31
  name: 'MuiTreeItem2',
32
32
  slot: 'Content',
33
33
  overridesResolver: (props, styles) => styles.content,
34
- shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'status'
34
+ shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'status' && prop !== 'indentationAtItemLevel'
35
35
  })(({
36
36
  theme
37
37
  }) => ({
@@ -52,12 +52,14 @@ export const TreeItem2Content = styled('div', {
52
52
  backgroundColor: 'transparent'
53
53
  }
54
54
  },
55
- [`& .${treeItemClasses.groupTransition}`]: {
56
- margin: 0,
57
- padding: 0,
58
- paddingLeft: 12
59
- },
60
55
  variants: [{
56
+ props: {
57
+ indentationAtItemLevel: true
58
+ },
59
+ style: {
60
+ paddingLeft: `calc(${theme.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`
61
+ }
62
+ }, {
61
63
  props: ({
62
64
  status
63
65
  }) => status.disabled,
@@ -125,11 +127,20 @@ export const TreeItem2IconContainer = styled('div', {
125
127
  export const TreeItem2GroupTransition = styled(Collapse, {
126
128
  name: 'MuiTreeItem2',
127
129
  slot: 'GroupTransition',
128
- overridesResolver: (props, styles) => styles.groupTransition
130
+ overridesResolver: (props, styles) => styles.groupTransition,
131
+ shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'indentationAtItemLevel'
129
132
  })({
130
133
  margin: 0,
131
134
  padding: 0,
132
- paddingLeft: 12
135
+ paddingLeft: 'var(--TreeView-itemChildrenIndentation)',
136
+ variants: [{
137
+ props: {
138
+ indentationAtItemLevel: true
139
+ },
140
+ style: {
141
+ paddingLeft: 0
142
+ }
143
+ }]
133
144
  });
134
145
  export const TreeItem2Checkbox = styled( /*#__PURE__*/React.forwardRef((props, ref) => {
135
146
  const {
@@ -6,11 +6,13 @@ function TreeItem2Provider(props) {
6
6
  itemId
7
7
  } = props;
8
8
  const {
9
- wrapItem
9
+ wrapItem,
10
+ instance
10
11
  } = useTreeViewContext();
11
12
  return wrapItem({
12
13
  children,
13
- itemId
14
+ itemId,
15
+ instance
14
16
  });
15
17
  }
16
18
  TreeItem2Provider.propTypes = {
@@ -115,11 +115,25 @@ process.env.NODE_ENV !== "production" ? TreeView.propTypes = {
115
115
  * Used when the item's expansion is controlled.
116
116
  */
117
117
  expandedItems: PropTypes.arrayOf(PropTypes.string),
118
+ /**
119
+ * Unstable features, breaking changes might be introduced.
120
+ * For each feature, if the flag is not explicitly set to `true`,
121
+ * the feature will be fully disabled and any property / method call will not have any effect.
122
+ */
123
+ experimentalFeatures: PropTypes.shape({
124
+ indentationAtItemLevel: PropTypes.bool
125
+ }),
118
126
  /**
119
127
  * This prop is used to help implement the accessibility logic.
120
128
  * If you don't provide this prop. It falls back to a randomly generated id.
121
129
  */
122
130
  id: PropTypes.string,
131
+ /**
132
+ * Horizontal indentation between an item and its children.
133
+ * Examples: 24, "24px", "2rem", "2em".
134
+ * @default 12px
135
+ */
136
+ itemChildrenIndentation: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
123
137
  /**
124
138
  * If `true`, `ctrl` and `shift` will trigger multiselect.
125
139
  * @default false
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v7.5.1
2
+ * @mui/x-tree-view v7.6.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import { TreeViewItemId } from '../../models';
3
+ export declare const TreeViewItemDepthContext: React.Context<number | ((itemId: TreeViewItemId) => number)>;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export const TreeViewItemDepthContext = /*#__PURE__*/React.createContext(() => -1);
3
+ if (process.env.NODE_ENV !== 'production') {
4
+ TreeViewItemDepthContext.displayName = 'TreeViewItemDepthContext';
5
+ }
@@ -0,0 +1 @@
1
+ export { TreeViewItemDepthContext } from './TreeViewItemDepthContext';
@@ -0,0 +1 @@
1
+ export { TreeViewItemDepthContext } from './TreeViewItemDepthContext';
@@ -6,7 +6,7 @@ export declare const TreeViewContext: React.Context<{
6
6
  instance: {};
7
7
  publicAPI: {};
8
8
  rootRef: React.RefObject<HTMLUListElement>;
9
- wrapItem: import("../models").TreeItemWrapper;
10
- wrapRoot: import("../models").TreeRootWrapper;
9
+ wrapItem: import("../models").TreeItemWrapper<any>;
10
+ wrapRoot: import("../models").TreeRootWrapper<any>;
11
11
  runItemPlugins: <TProps extends {}>(props: TProps) => Required<import("../models").TreeViewItemPluginResponse>;
12
12
  } | null>;
@@ -4,8 +4,8 @@ export type TreeViewContextValue<TPlugins extends readonly TreeViewAnyPluginSign
4
4
  instance: TreeViewInstance<TPlugins>;
5
5
  publicAPI: TreeViewPublicAPI<TPlugins>;
6
6
  rootRef: React.RefObject<HTMLUListElement>;
7
- wrapItem: TreeItemWrapper;
8
- wrapRoot: TreeRootWrapper;
7
+ wrapItem: TreeItemWrapper<TPlugins>;
8
+ wrapRoot: TreeRootWrapper<TPlugins>;
9
9
  runItemPlugins: <TProps extends {}>(props: TProps) => Required<TreeViewItemPluginResponse>;
10
10
  };
11
11
  export interface TreeViewProviderProps<TPlugins extends readonly TreeViewAnyPluginSignature[]> {
@@ -1,7 +1,7 @@
1
1
  export { useTreeView } from './useTreeView';
2
2
  export { TreeViewProvider } from './TreeViewProvider';
3
3
  export { unstable_resetCleanupTracking } from './hooks/useInstanceEventHandler';
4
- export type { TreeViewPlugin, TreeViewPluginSignature, ConvertPluginsIntoSignatures, MergePluginsProperty, TreeViewPublicAPI, } from './models';
4
+ export type { TreeViewPlugin, TreeViewPluginSignature, ConvertPluginsIntoSignatures, MergePluginsProperty, TreeViewPublicAPI, TreeViewExperimentalFeatures, } from './models';
5
5
  export { DEFAULT_TREE_VIEW_PLUGINS } from './plugins/defaultPlugins';
6
6
  export type { DefaultTreeViewPlugins, DefaultTreeViewPluginSlots, DefaultTreeViewPluginSlotProps, } from './plugins/defaultPlugins';
7
7
  export type { DefaultTreeViewPluginParameters } from './plugins/defaultPlugins';
@@ -17,5 +17,6 @@ export interface MergePlugins<TPlugins extends readonly any[]> {
17
17
  slotProps: MergePluginsProperty<TPlugins, 'slotProps'>;
18
18
  events: MergePluginsProperty<TPlugins, 'events'>;
19
19
  models: MergePluginsProperty<TPlugins, 'models'>;
20
+ experimentalFeatures: MergePluginsProperty<TPlugins, 'experimentalFeatures'>;
20
21
  }
21
22
  export {};
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { EventHandlers } from '@mui/base/utils';
3
- import { TreeViewModel } from './treeView';
3
+ import { TreeViewExperimentalFeatures, TreeViewInstance, TreeViewModel } from './treeView';
4
4
  import type { MergePluginsProperty, OptionalIfEmpty } from './helpers';
5
5
  import { TreeViewEventLookupElement } from './events';
6
6
  import type { TreeViewCorePluginsSignature } from '../corePlugins';
@@ -11,6 +11,7 @@ export interface TreeViewPluginOptions<TSignature extends TreeViewAnyPluginSigna
11
11
  state: TreeViewUsedState<TSignature>;
12
12
  slots: TSignature['slots'];
13
13
  slotProps: TSignature['slotProps'];
14
+ experimentalFeatures: TreeViewUsedExperimentalFeatures<TSignature>;
14
15
  models: TreeViewUsedModels<TSignature>;
15
16
  setState: React.Dispatch<React.SetStateAction<TreeViewUsedState<TSignature>>>;
16
17
  rootRef: React.RefObject<HTMLUListElement>;
@@ -40,6 +41,7 @@ export type TreeViewPluginSignature<T extends {
40
41
  [key in keyof T['slotProps']]: {} | (() => {});
41
42
  };
42
43
  modelNames?: keyof T['defaultizedParams'];
44
+ experimentalFeatures?: string;
43
45
  dependantPlugins?: readonly TreeViewAnyPluginSignature[];
44
46
  }> = {
45
47
  params: T extends {
@@ -75,6 +77,7 @@ export type TreeViewPluginSignature<T extends {
75
77
  } ? {
76
78
  [TControlled in T['modelNames']]-?: TreeViewModel<Exclude<T['defaultizedParams'][TControlled], undefined>>;
77
79
  } : {};
80
+ experimentalFeatures: T['experimentalFeatures'];
78
81
  dependantPlugins: T extends {
79
82
  dependantPlugins: Array<any>;
80
83
  } ? T['dependantPlugins'] : [];
@@ -90,6 +93,7 @@ export type TreeViewAnyPluginSignature = {
90
93
  slots: any;
91
94
  slotProps: any;
92
95
  models: any;
96
+ experimentalFeatures: any;
93
97
  publicAPI: any;
94
98
  };
95
99
  type TreeViewUsedPlugins<TSignature extends TreeViewAnyPluginSignature> = [
@@ -105,6 +109,7 @@ export type TreeViewUsedInstance<TSignature extends TreeViewAnyPluginSignature>
105
109
  $$signature: TSignature;
106
110
  };
107
111
  type TreeViewUsedState<TSignature extends TreeViewAnyPluginSignature> = TSignature['state'] & MergePluginsProperty<TreeViewUsedPlugins<TSignature>, 'state'>;
112
+ type TreeViewUsedExperimentalFeatures<TSignature extends TreeViewAnyPluginSignature> = TreeViewExperimentalFeatures<[TSignature, ...TSignature['dependantPlugins']]>;
108
113
  type RemoveSetValue<Models extends Record<string, TreeViewModel<any>>> = {
109
114
  [K in keyof Models]: Omit<Models[K], 'setValue'>;
110
115
  };
@@ -124,12 +129,14 @@ export interface TreeViewItemPluginResponse {
124
129
  rootRef?: React.RefCallback<HTMLLIElement> | null;
125
130
  }
126
131
  export type TreeViewItemPlugin<TProps extends {}> = (options: TreeViewItemPluginOptions<TProps>) => void | TreeViewItemPluginResponse;
127
- export type TreeItemWrapper = (params: {
132
+ export type TreeItemWrapper<TSignatures extends readonly TreeViewAnyPluginSignature[]> = (params: {
128
133
  itemId: TreeViewItemId;
129
134
  children: React.ReactNode;
135
+ instance: TreeViewInstance<TSignatures>;
130
136
  }) => React.ReactNode;
131
- export type TreeRootWrapper = (params: {
137
+ export type TreeRootWrapper<TSignatures extends readonly TreeViewAnyPluginSignature[]> = (params: {
132
138
  children: React.ReactNode;
139
+ instance: TreeViewInstance<TSignatures>;
133
140
  }) => React.ReactNode;
134
141
  export type TreeViewPlugin<TSignature extends TreeViewAnyPluginSignature> = {
135
142
  (options: TreeViewPluginOptions<TSignature>): TreeViewResponse<TSignature>;
@@ -143,12 +150,12 @@ export type TreeViewPlugin<TSignature extends TreeViewAnyPluginSignature> = {
143
150
  * @param {{ nodeId: TreeViewItemId; children: React.ReactNode; }} params The params of the item.
144
151
  * @returns {React.ReactNode} The wrapped item.
145
152
  */
146
- wrapItem?: TreeItemWrapper;
153
+ wrapItem?: TreeItemWrapper<[TSignature, ...TSignature['dependantPlugins']]>;
147
154
  /**
148
155
  * Render function used to add React wrappers around the TreeView.
149
156
  * @param {{ children: React.ReactNode; }} params The params of the root.
150
157
  * @returns {React.ReactNode} The wrapped root.
151
158
  */
152
- wrapRoot?: TreeRootWrapper;
159
+ wrapRoot?: TreeRootWrapper<[TSignature, ...TSignature['dependantPlugins']]>;
153
160
  };
154
161
  export {};