@mui/x-tree-view 7.7.0 → 7.8.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 (92) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/RichTreeView/RichTreeView.js +5 -0
  3. package/RichTreeView/RichTreeView.plugins.d.ts +3 -3
  4. package/RichTreeView/RichTreeView.plugins.js +1 -2
  5. package/SimpleTreeView/SimpleTreeView.js +5 -0
  6. package/SimpleTreeView/SimpleTreeView.plugins.d.ts +3 -3
  7. package/SimpleTreeView/SimpleTreeView.plugins.js +1 -2
  8. package/TreeItem/TreeItem.js +19 -4
  9. package/TreeItem/TreeItem.types.d.ts +8 -3
  10. package/TreeItem/TreeItemContent.js +5 -2
  11. package/TreeItem/useTreeItemState.d.ts +1 -0
  12. package/TreeItem/useTreeItemState.js +5 -1
  13. package/TreeItem2/TreeItem2.d.ts +3 -3
  14. package/TreeItem2Provider/TreeItem2Provider.d.ts +0 -1
  15. package/TreeView/TreeView.js +5 -0
  16. package/hooks/useTreeItem2Utils/useTreeItem2Utils.d.ts +4 -0
  17. package/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
  18. package/hooks/useTreeViewApiRef.d.ts +1 -1
  19. package/index.js +1 -1
  20. package/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
  21. package/internals/TreeViewProvider/TreeViewContext.d.ts +2 -8
  22. package/internals/TreeViewProvider/TreeViewProvider.types.d.ts +3 -3
  23. package/internals/TreeViewProvider/useTreeViewContext.d.ts +1 -1
  24. package/internals/corePlugins/corePlugins.d.ts +4 -1
  25. package/internals/corePlugins/corePlugins.js +2 -1
  26. package/internals/corePlugins/index.d.ts +1 -1
  27. package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.d.ts +0 -4
  28. package/internals/hooks/useInstanceEventHandler.d.ts +2 -2
  29. package/internals/index.d.ts +1 -2
  30. package/internals/index.js +3 -1
  31. package/internals/models/plugin.d.ts +27 -17
  32. package/internals/models/treeView.d.ts +3 -5
  33. package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +13 -1
  34. package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.d.ts +11 -1
  35. package/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.d.ts +1 -3
  36. package/internals/plugins/useTreeViewIcons/useTreeViewIcons.types.d.ts +1 -1
  37. package/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.types.d.ts +1 -1
  38. package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.d.ts +1 -1
  39. package/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.d.ts +1 -1
  40. package/internals/useTreeView/useTreeViewModels.d.ts +1 -1
  41. package/internals/utils/cleanupTracking/TimerBasedCleanupTracking.d.ts +0 -1
  42. package/internals/utils/publishTreeViewEvent.d.ts +1 -1
  43. package/internals/utils/utils.d.ts +1 -0
  44. package/internals/utils/utils.js +7 -1
  45. package/internals/utils/warning.d.ts +1 -1
  46. package/modern/RichTreeView/RichTreeView.js +5 -0
  47. package/modern/RichTreeView/RichTreeView.plugins.js +1 -2
  48. package/modern/SimpleTreeView/SimpleTreeView.js +5 -0
  49. package/modern/SimpleTreeView/SimpleTreeView.plugins.js +1 -2
  50. package/modern/TreeItem/TreeItem.js +19 -4
  51. package/modern/TreeItem/TreeItemContent.js +5 -2
  52. package/modern/TreeItem/useTreeItemState.js +5 -1
  53. package/modern/TreeView/TreeView.js +5 -0
  54. package/modern/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
  55. package/modern/index.js +1 -1
  56. package/modern/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
  57. package/modern/internals/corePlugins/corePlugins.js +2 -1
  58. package/modern/internals/index.js +3 -1
  59. package/modern/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +13 -1
  60. package/modern/internals/utils/utils.js +7 -1
  61. package/modern/useTreeItem2/useTreeItem2.js +18 -2
  62. package/node/RichTreeView/RichTreeView.js +5 -0
  63. package/node/RichTreeView/RichTreeView.plugins.js +1 -2
  64. package/node/SimpleTreeView/SimpleTreeView.js +5 -0
  65. package/node/SimpleTreeView/SimpleTreeView.plugins.js +1 -2
  66. package/node/TreeItem/TreeItem.js +19 -4
  67. package/node/TreeItem/TreeItemContent.js +5 -2
  68. package/node/TreeItem/useTreeItemState.js +5 -1
  69. package/node/TreeView/TreeView.js +5 -0
  70. package/node/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
  71. package/node/index.js +1 -1
  72. package/node/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
  73. package/node/internals/corePlugins/corePlugins.js +2 -1
  74. package/node/internals/index.js +0 -7
  75. package/node/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +13 -1
  76. package/node/internals/utils/utils.js +8 -1
  77. package/node/useTreeItem2/useTreeItem2.js +18 -2
  78. package/package.json +3 -3
  79. package/useTreeItem2/useTreeItem2.d.ts +2 -2
  80. package/useTreeItem2/useTreeItem2.js +18 -2
  81. package/useTreeItem2/useTreeItem2.types.d.ts +13 -5
  82. /package/internals/{plugins → corePlugins}/useTreeViewId/index.d.ts +0 -0
  83. /package/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
  84. /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.d.ts +0 -0
  85. /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
  86. /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
  87. /package/modern/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
  88. /package/modern/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
  89. /package/modern/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
  90. /package/node/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
  91. /package/node/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
  92. /package/node/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,187 @@
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.8.0
7
+
8
+ _Jun 28, 2024_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🛰 Introduce server-side data source for improved server integration in the Data Grid.
13
+
14
+ Supports server-side pagination, sorting and filtering on plain and tree data, and automatic caching.
15
+
16
+ To enable, provide a `getRows` function to the `unstable_dataSource` prop on the Data Grid component.
17
+
18
+ ```tsx
19
+ const dataSource = {
20
+ getRows: async (params: GridServerGetRowsParams) => {
21
+ const data = await fetch(
22
+ `https://api.example.com/data?${new URLSearchParams({
23
+ page: params.page,
24
+ pageSize: params.pageSize,
25
+ sortModel: JSON.stringify(params.sortModel),
26
+ filterModel: JSON.stringify(params.filterModel),
27
+ }).toString()}`,
28
+ );
29
+ return {
30
+ rows: data.rows,
31
+ totalRows: data.totalRows,
32
+ };
33
+ },
34
+ }
35
+ <DataGridPro
36
+ unstable_dataSource={dataSource}
37
+ {...otherProps}
38
+ />
39
+ ```
40
+
41
+ See [server-side data documentation](https://mui.com/x/react-data-grid/server-side-data/) for more details.
42
+
43
+ - 📈 Support Date data on the BarChart component
44
+ - ↕️ Support custom column sort icons on the Data Grid
45
+ - 🖱️ Support modifying the expansion trigger on the Tree View components
46
+
47
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
48
+
49
+ ### Data Grid
50
+
51
+ #### `@mui/x-data-grid@7.8.0`
52
+
53
+ - [DataGrid] Add `columnHeaderSortIcon` slot (#13563) @arminmeh
54
+ - [DataGrid] Fix dimensions lag issue after autosize (#13587) @MBilalShafi
55
+ - [DataGrid] Fix print export failure when `hideFooter` option is set (#13034) @tarunrajput
56
+
57
+ #### `@mui/x-data-grid-pro@7.8.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
58
+
59
+ Same changes as in `@mui/x-data-grid@7.8.0`, plus:
60
+
61
+ - [DataGridPro] Fix multi-sorting indicator being cut off (#13625) @KenanYusuf
62
+ - [DataGridPro] Server-side tree data support (#12317) @MBilalShafi
63
+
64
+ #### `@mui/x-data-grid-premium@7.8.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
65
+
66
+ Same changes as in `@mui/x-data-grid-pro@7.8.0`.
67
+
68
+ ### Date and Time Pickers
69
+
70
+ #### `@mui/x-date-pickers@7.8.0`
71
+
72
+ - [fields] Fix section clearing behavior on Android (#13652) @LukasTy
73
+
74
+ #### `@mui/x-date-pickers-pro@7.8.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
75
+
76
+ Same changes as in `@mui/x-date-pickers@7.8.0`.
77
+
78
+ ### Charts
79
+
80
+ #### `@mui/x-charts@7.8.0`
81
+
82
+ - [charts] Fix line chart props not passing correct event handlers (#13609) @JCQuintas
83
+ - [charts] Support BarChart with `Date` data (#13471) @alexfauquette
84
+ - [charts] Support RTL for y-axis (#13614) @alexfauquette
85
+ - [charts] Use default values instead of non-null assertion to prevent error being thrown (#13637) @JCQuintas
86
+
87
+ ### Tree View
88
+
89
+ #### `@mui/x-tree-view@7.8.0`
90
+
91
+ - [TreeView] Add `expansionTrigger` prop (#13533) @noraleonte
92
+ - [TreeView] Support experimental features from plugin's dependencies (#13632) @flaviendelangle
93
+
94
+ ### Docs
95
+
96
+ - [docs] Add callout for `Luxon` `throwOnInvalid` support (#13621) @LukasTy
97
+ - [docs] Add "Overlays" section to the Data Grid documentation (#13624) @KenanYusuf
98
+
99
+ ### Core
100
+
101
+ - [core] Add eslint rule to restrict import from `../internals` root (#13633) @JCQuintas
102
+ - [docs-infra] Sync `\_app` folder with monorepo (#13582) @Janpot
103
+ - [license] Allow usage of charts and tree view pro package for old premium licenses (#13619) @flaviendelangle
104
+
105
+ ## 7.7.1
106
+
107
+ _Jun 21, 2024_
108
+
109
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
110
+
111
+ - 🌍 Improve Portuguese (pt-PT) locale on the Data Grid
112
+ - 🌍 Improve Danish (da-DK) locale on the Date and Time Pickers
113
+ - 🐞 Bugfixes
114
+ - 📚 Documentation improvements
115
+
116
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
117
+
118
+ ### Data Grid
119
+
120
+ #### `@mui/x-data-grid@7.7.1`
121
+
122
+ - [DataGrid][docs] Clarify enabling pagination (#13350) @oliviertassinari
123
+ - [DataGrid] Fix CSV export escaping for non-string values (#13560) @joeycumines-scw
124
+ - [l10n] Improve Portuguese (pt-PT) locale (#13348) @joaosreis
125
+
126
+ #### `@mui/x-data-grid-pro@7.7.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
127
+
128
+ Same changes as in `@mui/x-data-grid@7.7.1`, plus:
129
+
130
+ - [DataGrid] Warn about `getTreeDataPath` reference (#13519) @cherniavskii
131
+
132
+ #### `@mui/x-data-grid-premium@7.7.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
133
+
134
+ Same changes as in `@mui/x-data-grid-pro@7.7.1`.
135
+
136
+ ### Date and Time Pickers
137
+
138
+ #### `@mui/x-date-pickers@7.7.1`
139
+
140
+ - [fields] Prevent digit editing on the `Space` key down (#13510) @flaviendelangle
141
+ - [l10n] Improve Danish (da-DK) locale (#13375) @jacrowland1
142
+ - [pickers] Add context to `onAccept` callback (#13511) @flaviendelangle
143
+ - [pickers] Always use the same timezone in the field, the view and the layout components (#13481) @flaviendelangle
144
+ - [pickers] Fix `AdapterDateFnsV3` generated method types (#13464) @alexey-kozlenkov
145
+ - [pickers] Fix controlled `view` behavior (#13552) @LukasTy
146
+ - [TimePicker] Improves RTL verification for the time pickers default views (#13447) @arthurbalduini
147
+
148
+ #### `@mui/x-date-pickers-pro@7.7.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
149
+
150
+ Same changes as in `@mui/x-date-pickers@7.7.1`, plus:
151
+
152
+ - [DateRangePicker] Add accessible name to calendar grid (#13538) @LukasTy
153
+
154
+ ### Charts
155
+
156
+ #### `@mui/x-charts@7.7.1`
157
+
158
+ - [charts] Divide `CartesianProvider` to use logic in Pro package (#13531) @JCQuintas
159
+ - [charts] Do not publish the pro package (#13539) @alexfauquette
160
+ - [charts] Export `Pro` versions of regular charts (#13547) @JCQuintas
161
+ - [charts] Prepare `ChartContainerPro` for future Zoom changes (#13532) @JCQuintas
162
+ - [charts] Remove unnecessary proptypes from internal component (#13518) @JCQuintas
163
+
164
+ ### Tree View
165
+
166
+ #### `@mui/x-tree-view@7.7.1`
167
+
168
+ - [TreeView] Improve typing to support optional dependencies in plugins and in the item (#13523) @flaviendelangle
169
+ - [TreeView] Move `useTreeViewId` to the core plugins (#13566) @flaviendelangle
170
+ - [TreeView] Remove unused state from `useTreeViewId` (#13579) @flaviendelangle
171
+ - [TreeView] Support `itemId` with escaping characters when using `SimpleTreeView` (#13487) @oukunan
172
+
173
+ ### Docs
174
+
175
+ - [docs] Add section about the new uncovered product watermark (#13568) @michelengelen
176
+ - [docs] Document the `PickerValidDate` type override (#13476) @flaviendelangle
177
+ - [docs] Fix typo (#13507) @anshtiwatne
178
+ - [docs] Remove "-" in heat-map and tree-map urls (#13569) @alexfauquette
179
+ - [docs] Use dedicated tab for weather dataset (#13513) @alexfauquette
180
+ - [x-license] license update proposal (#13459) @michelengelen
181
+
182
+ ### Core
183
+
184
+ - [core] Fix failing CI test (#13574) @alexfauquette
185
+ - [infra] Remove explicit `@testing-library/react` dependency (#13478) @LukasTy
186
+
6
187
  ## 7.7.0
7
188
 
8
189
  _Jun 13, 2024_
@@ -177,6 +177,11 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
177
177
  * Used when the item's expansion is controlled.
178
178
  */
179
179
  expandedItems: PropTypes.arrayOf(PropTypes.string),
180
+ /**
181
+ * The slot that triggers the item's expansion when clicked.
182
+ * @default 'content'
183
+ */
184
+ expansionTrigger: PropTypes.oneOf(['content', 'iconContainer']),
180
185
  /**
181
186
  * Unstable features, breaking changes might be introduced.
182
187
  * For each feature, if the flag is not explicitly set to `true`,
@@ -1,13 +1,13 @@
1
- import { UseTreeViewIdParameters } from '../internals/plugins/useTreeViewId';
1
+ import { TreeViewCorePluginParameters } from '../internals/corePlugins';
2
2
  import { UseTreeViewItemsParameters } from '../internals/plugins/useTreeViewItems';
3
3
  import { UseTreeViewExpansionParameters } from '../internals/plugins/useTreeViewExpansion';
4
4
  import { UseTreeViewSelectionParameters } from '../internals/plugins/useTreeViewSelection';
5
5
  import { UseTreeViewFocusParameters } from '../internals/plugins/useTreeViewFocus';
6
6
  import { UseTreeViewIconsParameters } from '../internals/plugins/useTreeViewIcons';
7
7
  import { ConvertPluginsIntoSignatures, MergeSignaturesProperty } from '../internals/models';
8
- export declare const RICH_TREE_VIEW_PLUGINS: readonly [import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewId").UseTreeViewIdSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewItems").UseTreeViewItemsSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewExpansion").UseTreeViewExpansionSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewSelection").UseTreeViewSelectionSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewFocus").UseTreeViewFocusSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewKeyboardNavigation").UseTreeViewKeyboardNavigationSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewIcons").UseTreeViewIconsSignature>];
8
+ export declare const RICH_TREE_VIEW_PLUGINS: readonly [import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewItems").UseTreeViewItemsSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewExpansion").UseTreeViewExpansionSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewSelection").UseTreeViewSelectionSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewFocus").UseTreeViewFocusSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewKeyboardNavigation").UseTreeViewKeyboardNavigationSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewIcons").UseTreeViewIconsSignature>];
9
9
  export type RichTreeViewPluginSignatures = ConvertPluginsIntoSignatures<typeof RICH_TREE_VIEW_PLUGINS>;
10
10
  export type RichTreeViewPluginSlots = MergeSignaturesProperty<RichTreeViewPluginSignatures, 'slots'>;
11
11
  export type RichTreeViewPluginSlotProps = MergeSignaturesProperty<RichTreeViewPluginSignatures, 'slotProps'>;
12
- export interface RichTreeViewPluginParameters<R extends {}, Multiple extends boolean | undefined> extends UseTreeViewIdParameters, UseTreeViewItemsParameters<R>, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters<Multiple>, UseTreeViewIconsParameters {
12
+ export interface RichTreeViewPluginParameters<R extends {}, Multiple extends boolean | undefined> extends TreeViewCorePluginParameters, UseTreeViewItemsParameters<R>, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters<Multiple>, UseTreeViewIconsParameters {
13
13
  }
@@ -1,10 +1,9 @@
1
- import { useTreeViewId } from '../internals/plugins/useTreeViewId';
2
1
  import { useTreeViewItems } from '../internals/plugins/useTreeViewItems';
3
2
  import { useTreeViewExpansion } from '../internals/plugins/useTreeViewExpansion';
4
3
  import { useTreeViewSelection } from '../internals/plugins/useTreeViewSelection';
5
4
  import { useTreeViewFocus } from '../internals/plugins/useTreeViewFocus';
6
5
  import { useTreeViewKeyboardNavigation } from '../internals/plugins/useTreeViewKeyboardNavigation';
7
6
  import { useTreeViewIcons } from '../internals/plugins/useTreeViewIcons';
8
- export const RICH_TREE_VIEW_PLUGINS = [useTreeViewId, useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons];
7
+ export const RICH_TREE_VIEW_PLUGINS = [useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons];
9
8
 
10
9
  // We can't infer this type from the plugin, otherwise we would lose the generics.
@@ -139,6 +139,11 @@ process.env.NODE_ENV !== "production" ? SimpleTreeView.propTypes = {
139
139
  * Used when the item's expansion is controlled.
140
140
  */
141
141
  expandedItems: PropTypes.arrayOf(PropTypes.string),
142
+ /**
143
+ * The slot that triggers the item's expansion when clicked.
144
+ * @default 'content'
145
+ */
146
+ expansionTrigger: PropTypes.oneOf(['content', 'iconContainer']),
142
147
  /**
143
148
  * Unstable features, breaking changes might be introduced.
144
149
  * For each feature, if the flag is not explicitly set to `true`,
@@ -1,13 +1,13 @@
1
- import { UseTreeViewIdParameters } from '../internals/plugins/useTreeViewId';
1
+ import { TreeViewCorePluginParameters } from '../internals/corePlugins';
2
2
  import { UseTreeViewItemsParameters } from '../internals/plugins/useTreeViewItems';
3
3
  import { UseTreeViewExpansionParameters } from '../internals/plugins/useTreeViewExpansion';
4
4
  import { UseTreeViewSelectionParameters } from '../internals/plugins/useTreeViewSelection';
5
5
  import { UseTreeViewFocusParameters } from '../internals/plugins/useTreeViewFocus';
6
6
  import { UseTreeViewIconsParameters } from '../internals/plugins/useTreeViewIcons';
7
7
  import { ConvertPluginsIntoSignatures, MergeSignaturesProperty } from '../internals/models';
8
- export declare const SIMPLE_TREE_VIEW_PLUGINS: readonly [import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewId").UseTreeViewIdSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewItems").UseTreeViewItemsSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewExpansion").UseTreeViewExpansionSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewSelection").UseTreeViewSelectionSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewFocus").UseTreeViewFocusSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewKeyboardNavigation").UseTreeViewKeyboardNavigationSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewIcons").UseTreeViewIconsSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewJSXItems").UseTreeViewJSXItemsSignature>];
8
+ export declare const SIMPLE_TREE_VIEW_PLUGINS: readonly [import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewItems").UseTreeViewItemsSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewExpansion").UseTreeViewExpansionSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewSelection").UseTreeViewSelectionSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewFocus").UseTreeViewFocusSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewKeyboardNavigation").UseTreeViewKeyboardNavigationSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewIcons").UseTreeViewIconsSignature>, import("../internals/models").TreeViewPlugin<import("../internals/plugins/useTreeViewJSXItems").UseTreeViewJSXItemsSignature>];
9
9
  export type SimpleTreeViewPluginSignatures = ConvertPluginsIntoSignatures<typeof SIMPLE_TREE_VIEW_PLUGINS>;
10
10
  export type SimpleTreeViewPluginSlots = MergeSignaturesProperty<SimpleTreeViewPluginSignatures, 'slots'>;
11
11
  export type SimpleTreeViewPluginSlotProps = MergeSignaturesProperty<SimpleTreeViewPluginSignatures, 'slotProps'>;
12
- export interface SimpleTreeViewPluginParameters<Multiple extends boolean | undefined> extends UseTreeViewIdParameters, Omit<UseTreeViewItemsParameters<any>, 'items' | 'isItemDisabled' | 'getItemLabel' | 'getItemId'>, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters<Multiple>, UseTreeViewIconsParameters {
12
+ export interface SimpleTreeViewPluginParameters<Multiple extends boolean | undefined> extends TreeViewCorePluginParameters, Omit<UseTreeViewItemsParameters<any>, 'items' | 'isItemDisabled' | 'getItemLabel' | 'getItemId'>, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters<Multiple>, UseTreeViewIconsParameters {
13
13
  }
@@ -1,4 +1,3 @@
1
- import { useTreeViewId } from '../internals/plugins/useTreeViewId';
2
1
  import { useTreeViewItems } from '../internals/plugins/useTreeViewItems';
3
2
  import { useTreeViewExpansion } from '../internals/plugins/useTreeViewExpansion';
4
3
  import { useTreeViewSelection } from '../internals/plugins/useTreeViewSelection';
@@ -6,6 +5,6 @@ import { useTreeViewFocus } from '../internals/plugins/useTreeViewFocus';
6
5
  import { useTreeViewKeyboardNavigation } from '../internals/plugins/useTreeViewKeyboardNavigation';
7
6
  import { useTreeViewIcons } from '../internals/plugins/useTreeViewIcons';
8
7
  import { useTreeViewJSXItems } from '../internals/plugins/useTreeViewJSXItems';
9
- export const SIMPLE_TREE_VIEW_PLUGINS = [useTreeViewId, useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons, useTreeViewJSXItems];
8
+ export const SIMPLE_TREE_VIEW_PLUGINS = [useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons, useTreeViewJSXItems];
10
9
 
11
10
  // We can't infer this type from the plugin, otherwise we would lose the generics.
@@ -22,6 +22,7 @@ import { useTreeViewContext } from '../internals/TreeViewProvider/useTreeViewCon
22
22
  import { TreeViewCollapseIcon, TreeViewExpandIcon } from '../icons';
23
23
  import { TreeItem2Provider } from '../TreeItem2Provider';
24
24
  import { TreeViewItemDepthContext } from '../internals/TreeViewItemDepthContext';
25
+ import { useTreeItemState } from './useTreeItemState';
25
26
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
27
  const useThemeProps = createUseThemeProps('MuiTreeItem');
27
28
  const useUtilityClasses = ownerState => {
@@ -168,6 +169,9 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
168
169
  selection: {
169
170
  multiSelect
170
171
  },
172
+ expansion: {
173
+ expansionTrigger
174
+ },
171
175
  disabledItemsFocusable,
172
176
  indentationAtItemLevel,
173
177
  instance
@@ -193,6 +197,13 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
193
197
  onKeyDown
194
198
  } = props,
195
199
  other = _objectWithoutPropertiesLoose(props, _excluded);
200
+ const {
201
+ expanded,
202
+ focused,
203
+ selected,
204
+ disabled,
205
+ handleExpansion
206
+ } = useTreeItemState(itemId);
196
207
  const {
197
208
  contentRef,
198
209
  rootRef
@@ -213,10 +224,6 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
213
224
  return Boolean(reactChildren);
214
225
  };
215
226
  const expandable = isExpandable(children);
216
- const expanded = instance.isItemExpanded(itemId);
217
- const focused = instance.isItemFocused(itemId);
218
- const selected = instance.isItemSelected(itemId);
219
- const disabled = instance.isItemDisabled(itemId);
220
227
  const ownerState = _extends({}, props, {
221
228
  expanded,
222
229
  focused,
@@ -240,6 +247,11 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
240
247
  } : {}),
241
248
  className: classes.groupTransition
242
249
  });
250
+ const handleIconContainerClick = event => {
251
+ if (expansionTrigger === 'iconContainer') {
252
+ handleExpansion(event);
253
+ }
254
+ };
243
255
  const ExpansionIcon = expanded ? slots.collapseIcon : slots.expandIcon;
244
256
  const _useSlotProps = useSlotProps({
245
257
  elementType: ExpansionIcon,
@@ -249,6 +261,9 @@ export const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps,
249
261
  return _extends({}, resolveComponentProps(contextIcons.slotProps.collapseIcon, tempOwnerState), resolveComponentProps(inSlotProps?.collapseIcon, tempOwnerState));
250
262
  }
251
263
  return _extends({}, resolveComponentProps(contextIcons.slotProps.expandIcon, tempOwnerState), resolveComponentProps(inSlotProps?.expandIcon, tempOwnerState));
264
+ },
265
+ additionalProps: {
266
+ onClick: handleIconContainerClick
252
267
  }
253
268
  }),
254
269
  expansionIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
@@ -14,7 +14,6 @@ import { UseTreeViewItemsSignature } from '../internals/plugins/useTreeViewItems
14
14
  import { UseTreeViewFocusSignature } from '../internals/plugins/useTreeViewFocus';
15
15
  import { UseTreeViewExpansionSignature } from '../internals/plugins/useTreeViewExpansion';
16
16
  import { UseTreeViewKeyboardNavigationSignature } from '../internals/plugins/useTreeViewKeyboardNavigation';
17
- import { UseTreeViewIdSignature } from '../internals/plugins/useTreeViewId';
18
17
  export interface TreeItemSlots {
19
18
  /**
20
19
  * The icon used to collapse the item.
@@ -110,12 +109,18 @@ export interface TreeItemOwnerState extends TreeItemProps {
110
109
  disabled: boolean;
111
110
  indentationAtItemLevel: boolean;
112
111
  }
112
+ /**
113
+ * Plugins that need to be present in the Tree View in order for `TreeItem` to work correctly.
114
+ */
113
115
  export type TreeItemMinimalPlugins = readonly [
114
116
  UseTreeViewIconsSignature,
115
117
  UseTreeViewSelectionSignature,
116
118
  UseTreeViewItemsSignature,
117
119
  UseTreeViewFocusSignature,
118
120
  UseTreeViewExpansionSignature,
119
- UseTreeViewKeyboardNavigationSignature,
120
- UseTreeViewIdSignature
121
+ UseTreeViewKeyboardNavigationSignature
121
122
  ];
123
+ /**
124
+ * Plugins that `TreeItem` can use if they are present, but are not required.
125
+ */
126
+ export type TreeItemOptionalPlugins = readonly [];
@@ -33,7 +33,8 @@ const TreeItemContent = /*#__PURE__*/React.forwardRef(function TreeItemContent(p
33
33
  handleExpansion,
34
34
  handleSelection,
35
35
  handleCheckboxSelection,
36
- preventSelection
36
+ preventSelection,
37
+ expansionTrigger
37
38
  } = useTreeItemState(itemId);
38
39
  const icon = iconProp || expansionIcon || displayIcon;
39
40
  const checkboxRef = React.useRef(null);
@@ -47,7 +48,9 @@ const TreeItemContent = /*#__PURE__*/React.forwardRef(function TreeItemContent(p
47
48
  if (checkboxRef.current?.contains(event.target)) {
48
49
  return;
49
50
  }
50
- handleExpansion(event);
51
+ if (expansionTrigger === 'content') {
52
+ handleExpansion(event);
53
+ }
51
54
  if (!checkboxSelection) {
52
55
  handleSelection(event);
53
56
  }
@@ -10,4 +10,5 @@ export declare function useTreeItemState(itemId: string): {
10
10
  handleSelection: (event: React.MouseEvent) => void;
11
11
  handleCheckboxSelection: (event: React.ChangeEvent<HTMLInputElement>) => void;
12
12
  preventSelection: (event: React.MouseEvent<HTMLDivElement>) => void;
13
+ expansionTrigger: "content" | "iconContainer" | undefined;
13
14
  };
@@ -6,6 +6,9 @@ export function useTreeItemState(itemId) {
6
6
  multiSelect,
7
7
  checkboxSelection,
8
8
  disableSelection
9
+ },
10
+ expansion: {
11
+ expansionTrigger
9
12
  }
10
13
  } = useTreeViewContext();
11
14
  const expandable = instance.isItemExpandable(itemId);
@@ -70,6 +73,7 @@ export function useTreeItemState(itemId) {
70
73
  handleExpansion,
71
74
  handleSelection,
72
75
  handleCheckboxSelection,
73
- preventSelection
76
+ preventSelection,
77
+ expansionTrigger
74
78
  };
75
79
  }
@@ -5,16 +5,16 @@ import { UseTreeItem2Status } from '../useTreeItem2';
5
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
6
  export declare const TreeItem2Content: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
7
7
  status: UseTreeItem2Status;
8
- indentationAtItemLevel?: true | undefined;
8
+ indentationAtItemLevel?: true;
9
9
  }, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
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
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
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;
13
+ indentationAtItemLevel?: true;
14
14
  }, {}, {}>;
15
15
  export declare const TreeItem2Checkbox: import("@emotion/styled").StyledComponent<Pick<Omit<CheckboxProps & {
16
16
  visible: boolean;
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>, {}, {}>;
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" | "onPointerLeave" | "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>, {}, {}>;
18
18
  type TreeItem2Component = ((props: TreeItem2Props & React.RefAttributes<HTMLLIElement>) => React.JSX.Element) & {
19
19
  propTypes?: any;
20
20
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { TreeItem2ProviderProps } from './TreeItem2Provider.types';
3
2
  declare function TreeItem2Provider(props: TreeItem2ProviderProps): import("react").ReactNode;
4
3
  declare namespace TreeItem2Provider {
@@ -116,6 +116,11 @@ process.env.NODE_ENV !== "production" ? TreeView.propTypes = {
116
116
  * Used when the item's expansion is controlled.
117
117
  */
118
118
  expandedItems: PropTypes.arrayOf(PropTypes.string),
119
+ /**
120
+ * The slot that triggers the item's expansion when clicked.
121
+ * @default 'content'
122
+ */
123
+ expansionTrigger: PropTypes.oneOf(['content', 'iconContainer']),
119
124
  /**
120
125
  * Unstable features, breaking changes might be introduced.
121
126
  * For each feature, if the flag is not explicitly set to `true`,
@@ -9,6 +9,10 @@ interface UseTreeItem2UtilsReturnValue {
9
9
  interactions: UseTreeItem2Interactions;
10
10
  status: UseTreeItem2Status;
11
11
  }
12
+ /**
13
+ * Plugins that `useTreeItem2Utils` can use if they are present, but are not required.
14
+ */
15
+ export type UseTreeItem2UtilsOptionalPlugins = readonly [];
12
16
  export declare const useTreeItem2Utils: ({ itemId, children, }: {
13
17
  itemId: string;
14
18
  children: React.ReactNode;
@@ -5,6 +5,15 @@ const isItemExpandable = reactChildren => {
5
5
  }
6
6
  return Boolean(reactChildren);
7
7
  };
8
+
9
+ /**
10
+ * Plugins that need to be present in the Tree View in order for `useTreeItem2Utils` to work correctly.
11
+ */
12
+
13
+ /**
14
+ * Plugins that `useTreeItem2Utils` can use if they are present, but are not required.
15
+ */
16
+
8
17
  export const useTreeItem2Utils = ({
9
18
  itemId,
10
19
  children
@@ -3,4 +3,4 @@ import { TreeViewAnyPluginSignature, TreeViewPublicAPI } from '../internals/mode
3
3
  /**
4
4
  * Hook that instantiates a [[TreeViewApiRef]].
5
5
  */
6
- export declare const useTreeViewApiRef: <TSignatures extends readonly TreeViewAnyPluginSignature[] = readonly [import("../internals").UseTreeViewIdSignature, import("../internals").UseTreeViewItemsSignature, import("../internals").UseTreeViewExpansionSignature, import("../internals").UseTreeViewSelectionSignature, import("../internals").UseTreeViewFocusSignature, import("../internals").UseTreeViewKeyboardNavigationSignature, import("../internals").UseTreeViewIconsSignature]>() => React.MutableRefObject<TreeViewPublicAPI<TSignatures> | undefined>;
6
+ export declare const useTreeViewApiRef: <TSignatures extends readonly TreeViewAnyPluginSignature[] = readonly [import("../internals").UseTreeViewItemsSignature, import("../internals").UseTreeViewExpansionSignature, import("../internals").UseTreeViewSelectionSignature, import("../internals").UseTreeViewFocusSignature, import("../internals").UseTreeViewKeyboardNavigationSignature, import("../internals").UseTreeViewIconsSignature]>() => React.MutableRefObject<TreeViewPublicAPI<TSignatures> | undefined>;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-tree-view v7.7.0
2
+ * @mui/x-tree-view v7.8.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useTreeViewContext } from './useTreeViewContext';
4
+ import { escapeOperandAttributeSelector } from '../utils/utils';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  export const TreeViewChildrenItemContext = /*#__PURE__*/React.createContext(null);
6
7
  if (process.env.NODE_ENV !== 'production') {
@@ -34,7 +35,8 @@ export function TreeViewChildrenItemProvider(props) {
34
35
  return;
35
36
  }
36
37
  const previousChildrenIds = instance.getItemOrderedChildrenIds(itemId ?? null) ?? [];
37
- const childrenElements = rootRef.current.querySelectorAll(`${itemId == null ? '' : `*[id="${idAttr}"] `}[role="treeitem"]:not(*[id="${idAttr}"] [role="treeitem"] [role="treeitem"])`);
38
+ const escapedIdAttr = escapeOperandAttributeSelector(idAttr);
39
+ const childrenElements = rootRef.current.querySelectorAll(`${itemId == null ? '' : `*[id="${escapedIdAttr}"] `}[role="treeitem"]:not(*[id="${escapedIdAttr}"] [role="treeitem"] [role="treeitem"])`);
38
40
  const childrenIds = Array.from(childrenElements).map(child => childrenIdAttrToIdRef.current.get(child.id));
39
41
  const hasChanged = childrenIds.length !== previousChildrenIds.length || childrenIds.some((childId, index) => childId !== previousChildrenIds[index]);
40
42
  if (hasChanged) {
@@ -1,12 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { TreeViewContextValue } from './TreeViewProvider.types';
2
3
  /**
3
4
  * @ignore - internal component.
4
5
  */
5
- export declare const TreeViewContext: React.Context<{
6
- instance: import("../corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.types").UseTreeViewInstanceEventsInstance;
7
- publicAPI: {};
8
- rootRef: React.RefObject<HTMLUListElement>;
9
- wrapItem: import("../models").TreeItemWrapper<any>;
10
- wrapRoot: import("../models").TreeRootWrapper<any>;
11
- runItemPlugins: import("./TreeViewProvider.types").TreeViewItemPluginsRunner;
12
- } | null>;
6
+ export declare const TreeViewContext: React.Context<TreeViewContextValue<any> | null>;
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { MergeSignaturesProperty, TreeItemWrapper, TreeRootWrapper, TreeViewAnyPluginSignature, TreeViewInstance, TreeViewItemPluginResponse, TreeViewPublicAPI } from '../models';
3
3
  export type TreeViewItemPluginsRunner = <TProps extends {}>(props: TProps) => Required<TreeViewItemPluginResponse>;
4
- export type TreeViewContextValue<TSignatures extends readonly TreeViewAnyPluginSignature[]> = MergeSignaturesProperty<TSignatures, 'contextValue'> & {
5
- instance: TreeViewInstance<TSignatures>;
6
- publicAPI: TreeViewPublicAPI<TSignatures>;
4
+ export type TreeViewContextValue<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = MergeSignaturesProperty<TSignatures, 'contextValue'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'contextValue'>> & {
5
+ instance: TreeViewInstance<TSignatures, TOptionalSignatures>;
6
+ publicAPI: TreeViewPublicAPI<TSignatures, TOptionalSignatures>;
7
7
  rootRef: React.RefObject<HTMLUListElement>;
8
8
  wrapItem: TreeItemWrapper<TSignatures>;
9
9
  wrapRoot: TreeRootWrapper<TSignatures>;
@@ -1,3 +1,3 @@
1
1
  import { TreeViewAnyPluginSignature } from '../models';
2
2
  import { TreeViewContextValue } from './TreeViewProvider.types';
3
- export declare const useTreeViewContext: <TSignatures extends readonly TreeViewAnyPluginSignature[]>() => NonNullable<TreeViewContextValue<TSignatures>>;
3
+ export declare const useTreeViewContext: <TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []>() => NonNullable<TreeViewContextValue<TSignatures, TOptionalSignatures>>;
@@ -1,7 +1,10 @@
1
+ import { UseTreeViewIdParameters } from './useTreeViewId';
1
2
  import { ConvertPluginsIntoSignatures } from '../models';
2
3
  /**
3
4
  * Internal plugins that create the tools used by the other plugins.
4
5
  * These plugins are used by the tree view components.
5
6
  */
6
- export declare const TREE_VIEW_CORE_PLUGINS: readonly [import("../models").TreeViewPlugin<import("./useTreeViewInstanceEvents").UseTreeViewInstanceEventsSignature>];
7
+ export declare const TREE_VIEW_CORE_PLUGINS: readonly [import("../models").TreeViewPlugin<import("./useTreeViewInstanceEvents").UseTreeViewInstanceEventsSignature>, import("../models").TreeViewPlugin<import("./useTreeViewId").UseTreeViewIdSignature>];
7
8
  export type TreeViewCorePluginSignatures = ConvertPluginsIntoSignatures<typeof TREE_VIEW_CORE_PLUGINS>;
9
+ export interface TreeViewCorePluginParameters extends UseTreeViewIdParameters {
10
+ }
@@ -1,6 +1,7 @@
1
1
  import { useTreeViewInstanceEvents } from './useTreeViewInstanceEvents';
2
+ import { useTreeViewId } from './useTreeViewId';
2
3
  /**
3
4
  * Internal plugins that create the tools used by the other plugins.
4
5
  * These plugins are used by the tree view components.
5
6
  */
6
- export const TREE_VIEW_CORE_PLUGINS = [useTreeViewInstanceEvents];
7
+ export const TREE_VIEW_CORE_PLUGINS = [useTreeViewInstanceEvents, useTreeViewId];