@mui/x-tree-view 7.6.2 → 7.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +163 -0
- package/RichTreeView/RichTreeView.d.ts +1 -3
- package/RichTreeView/RichTreeView.js +12 -15
- package/RichTreeView/RichTreeView.plugins.d.ts +13 -0
- package/RichTreeView/RichTreeView.plugins.js +9 -0
- package/RichTreeView/RichTreeView.types.d.ts +6 -6
- package/RichTreeView/index.d.ts +2 -0
- package/RichTreeView/index.js +1 -1
- package/SimpleTreeView/SimpleTreeView.d.ts +1 -1
- package/SimpleTreeView/SimpleTreeView.js +11 -14
- package/SimpleTreeView/SimpleTreeView.plugins.d.ts +12 -7
- package/SimpleTreeView/SimpleTreeView.plugins.js +7 -2
- package/SimpleTreeView/SimpleTreeView.types.d.ts +3 -3
- package/TreeItem/TreeItem.js +7 -1
- package/TreeItem/TreeItem.types.d.ts +27 -1
- package/TreeItem2/TreeItem2.js +12 -2
- package/TreeItem2/TreeItem2.types.d.ts +10 -1
- package/TreeView/TreeView.js +2 -1
- package/hooks/useTreeItem2Utils/useTreeItem2Utils.d.ts +4 -0
- package/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
- package/hooks/useTreeViewApiRef.d.ts +1 -1
- package/index.js +1 -1
- package/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
- package/internals/TreeViewProvider/TreeViewContext.d.ts +2 -8
- package/internals/TreeViewProvider/TreeViewProvider.d.ts +1 -1
- package/internals/TreeViewProvider/TreeViewProvider.types.d.ts +10 -9
- package/internals/TreeViewProvider/index.d.ts +1 -1
- package/internals/TreeViewProvider/useTreeViewContext.d.ts +1 -1
- package/internals/corePlugins/corePlugins.d.ts +6 -3
- package/internals/corePlugins/corePlugins.js +2 -1
- package/internals/corePlugins/index.d.ts +1 -1
- package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.d.ts +0 -4
- package/internals/hooks/useInstanceEventHandler.d.ts +2 -2
- package/internals/index.d.ts +2 -7
- package/internals/index.js +4 -4
- package/internals/models/helpers.d.ts +3 -16
- package/internals/models/plugin.d.ts +25 -19
- package/internals/models/treeView.d.ts +5 -4
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.d.ts +1 -1
- package/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.d.ts +1 -3
- package/internals/plugins/useTreeViewIcons/useTreeViewIcons.types.d.ts +1 -1
- package/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.types.d.ts +1 -1
- package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +4 -5
- package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.d.ts +1 -1
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.d.ts +1 -1
- package/internals/useTreeView/extractPluginParamsFromProps.d.ts +13 -0
- package/internals/{utils → useTreeView}/extractPluginParamsFromProps.js +16 -16
- package/internals/useTreeView/index.d.ts +0 -1
- package/internals/useTreeView/useTreeView.d.ts +4 -4
- package/internals/useTreeView/useTreeView.js +85 -72
- package/internals/useTreeView/useTreeView.types.d.ts +13 -12
- package/internals/useTreeView/useTreeViewModels.d.ts +3 -2
- package/internals/utils/publishTreeViewEvent.d.ts +1 -1
- package/internals/utils/utils.d.ts +1 -0
- package/internals/utils/utils.js +7 -1
- package/internals/zero-styled/index.d.ts +3 -0
- package/internals/zero-styled/index.js +7 -0
- package/modern/RichTreeView/RichTreeView.js +12 -15
- package/modern/RichTreeView/RichTreeView.plugins.js +9 -0
- package/modern/RichTreeView/index.js +1 -1
- package/modern/SimpleTreeView/SimpleTreeView.js +11 -14
- package/modern/SimpleTreeView/SimpleTreeView.plugins.js +7 -2
- package/modern/TreeItem/TreeItem.js +7 -1
- package/modern/TreeItem2/TreeItem2.js +12 -2
- package/modern/TreeView/TreeView.js +2 -1
- package/modern/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
- package/modern/index.js +1 -1
- package/modern/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
- package/modern/internals/corePlugins/corePlugins.js +2 -1
- package/modern/internals/index.js +4 -4
- package/modern/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +4 -5
- package/modern/internals/{utils → useTreeView}/extractPluginParamsFromProps.js +16 -16
- package/modern/internals/useTreeView/useTreeView.js +85 -72
- package/modern/internals/utils/utils.js +7 -1
- package/modern/internals/zero-styled/index.js +7 -0
- package/node/RichTreeView/RichTreeView.js +14 -17
- package/node/RichTreeView/RichTreeView.plugins.js +15 -0
- package/node/RichTreeView/index.js +13 -1
- package/node/SimpleTreeView/SimpleTreeView.js +13 -16
- package/node/SimpleTreeView/SimpleTreeView.plugins.js +7 -2
- package/node/TreeItem/TreeItem.js +10 -4
- package/node/TreeItem2/TreeItem2.js +18 -8
- package/node/TreeView/TreeView.js +4 -3
- package/node/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
- package/node/index.js +1 -1
- package/node/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
- package/node/internals/corePlugins/corePlugins.js +2 -1
- package/node/internals/index.js +1 -22
- package/node/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +4 -5
- package/node/internals/{utils → useTreeView}/extractPluginParamsFromProps.js +16 -16
- package/node/internals/useTreeView/useTreeView.js +85 -72
- package/node/internals/utils/utils.js +8 -1
- package/node/internals/zero-styled/index.js +17 -0
- package/package.json +4 -4
- package/useTreeItem2/useTreeItem2.d.ts +2 -2
- package/useTreeItem2/useTreeItem2.types.d.ts +20 -3
- package/internals/plugins/defaultPlugins.d.ts +0 -13
- package/internals/plugins/defaultPlugins.js +0 -10
- package/internals/plugins/index.d.ts +0 -2
- package/internals/plugins/index.js +0 -1
- package/internals/utils/extractPluginParamsFromProps.d.ts +0 -18
- package/modern/internals/plugins/defaultPlugins.js +0 -10
- package/modern/internals/plugins/index.js +0 -1
- package/node/internals/plugins/defaultPlugins.js +0 -16
- package/node/internals/plugins/index.js +0 -12
- /package/internals/{plugins → corePlugins}/useTreeViewId/index.d.ts +0 -0
- /package/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
- /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.d.ts +0 -0
- /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
- /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
- /package/modern/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
- /package/modern/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
- /package/modern/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
- /package/node/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
- /package/node/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
- /package/node/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,169 @@
|
|
|
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.7.1
|
|
7
|
+
|
|
8
|
+
_Jun 21, 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
|
+
- 🌍 Improve Portuguese (pt-PT) locale on the Data Grid
|
|
13
|
+
- 🌍 Improve Danish (da-DK) locale on the Date and Time Pickers
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
- 📚 Documentation improvements
|
|
16
|
+
|
|
17
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
18
|
+
|
|
19
|
+
### Data Grid
|
|
20
|
+
|
|
21
|
+
#### `@mui/x-data-grid@7.7.1`
|
|
22
|
+
|
|
23
|
+
- [DataGrid][docs] Clarify enabling pagination (#13350) @oliviertassinari
|
|
24
|
+
- [DataGrid] Fix CSV export escaping for non-string values (#13560) @joeycumines-scw
|
|
25
|
+
- [l10n] Improve Portuguese (pt-PT) locale (#13348) @joaosreis
|
|
26
|
+
|
|
27
|
+
#### `@mui/x-data-grid-pro@7.7.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
28
|
+
|
|
29
|
+
Same changes as in `@mui/x-data-grid@7.7.1`, plus:
|
|
30
|
+
|
|
31
|
+
- [DataGrid] Warn about `getTreeDataPath` reference (#13519) @cherniavskii
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-premium@7.7.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid-pro@7.7.1`.
|
|
36
|
+
|
|
37
|
+
### Date and Time Pickers
|
|
38
|
+
|
|
39
|
+
#### `@mui/x-date-pickers@7.7.1`
|
|
40
|
+
|
|
41
|
+
- [fields] Prevent digit editing on the `Space` key down (#13510) @flaviendelangle
|
|
42
|
+
- [l10n] Improve Danish (da-DK) locale (#13375) @jacrowland1
|
|
43
|
+
- [pickers] Add context to `onAccept` callback (#13511) @flaviendelangle
|
|
44
|
+
- [pickers] Always use the same timezone in the field, the view and the layout components (#13481) @flaviendelangle
|
|
45
|
+
- [pickers] Fix `AdapterDateFnsV3` generated method types (#13464) @alexey-kozlenkov
|
|
46
|
+
- [pickers] Fix controlled `view` behavior (#13552) @LukasTy
|
|
47
|
+
- [TimePicker] Improves RTL verification for the time pickers default views (#13447) @arthurbalduini
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers-pro@7.7.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-date-pickers@7.7.1`, plus:
|
|
52
|
+
|
|
53
|
+
- [DateRangePicker] Add accessible name to calendar grid (#13538) @LukasTy
|
|
54
|
+
|
|
55
|
+
### Charts
|
|
56
|
+
|
|
57
|
+
#### `@mui/x-charts@7.7.1`
|
|
58
|
+
|
|
59
|
+
- [charts] Divide `CartesianProvider` to use logic in Pro package (#13531) @JCQuintas
|
|
60
|
+
- [charts] Do not publish the pro package (#13539) @alexfauquette
|
|
61
|
+
- [charts] Export `Pro` versions of regular charts (#13547) @JCQuintas
|
|
62
|
+
- [charts] Prepare `ChartContainerPro` for future Zoom changes (#13532) @JCQuintas
|
|
63
|
+
- [charts] Remove unnecessary proptypes from internal component (#13518) @JCQuintas
|
|
64
|
+
|
|
65
|
+
### Tree View
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-tree-view@7.7.1`
|
|
68
|
+
|
|
69
|
+
- [TreeView] Improve typing to support optional dependencies in plugins and in the item (#13523) @flaviendelangle
|
|
70
|
+
- [TreeView] Move `useTreeViewId` to the core plugins (#13566) @flaviendelangle
|
|
71
|
+
- [TreeView] Remove unused state from `useTreeViewId` (#13579) @flaviendelangle
|
|
72
|
+
- [TreeView] Support `itemId` with escaping characters when using `SimpleTreeView` (#13487) @oukunan
|
|
73
|
+
|
|
74
|
+
### Docs
|
|
75
|
+
|
|
76
|
+
- [docs] Add section about the new uncovered product watermark (#13568) @michelengelen
|
|
77
|
+
- [docs] Document the `PickerValidDate` type override (#13476) @flaviendelangle
|
|
78
|
+
- [docs] Fix typo (#13507) @anshtiwatne
|
|
79
|
+
- [docs] Remove "-" in heat-map and tree-map urls (#13569) @alexfauquette
|
|
80
|
+
- [docs] Use dedicated tab for weather dataset (#13513) @alexfauquette
|
|
81
|
+
- [x-license] license update proposal (#13459) @michelengelen
|
|
82
|
+
|
|
83
|
+
### Core
|
|
84
|
+
|
|
85
|
+
- [core] Fix failing CI test (#13574) @alexfauquette
|
|
86
|
+
- [infra] Remove explicit `@testing-library/react` dependency (#13478) @LukasTy
|
|
87
|
+
|
|
88
|
+
## 7.7.0
|
|
89
|
+
|
|
90
|
+
_Jun 13, 2024_
|
|
91
|
+
|
|
92
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
93
|
+
|
|
94
|
+
- 🎁 Allow customization of the Pickers month and the year buttons
|
|
95
|
+
- 🌍 Improve Persian (fa-IR), Portuguese (pt-PT), and Russian (ru-RU) locales on the Data Grid
|
|
96
|
+
- 🌍 Improve Korean (ko-KR) and Persian (fa-IR) locales on the Date and Time Pickers
|
|
97
|
+
- 🐞 Bugfixes
|
|
98
|
+
- 📚 Documentation improvements
|
|
99
|
+
|
|
100
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
101
|
+
|
|
102
|
+
### Data Grid
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-data-grid@7.7.0`
|
|
105
|
+
|
|
106
|
+
- [DataGrid] Add `getFilterState` method (#13418) @cherniavskii
|
|
107
|
+
- [DataGrid] Do not show resize separators for column groups (#13455) @cherniavskii
|
|
108
|
+
- [l10n] Improve Persian (fa-IR) locale (#13402) @fakhamatia
|
|
109
|
+
- [l10n] Improve Portuguese (pt-PT) locale (#13384) @olavocarvalho
|
|
110
|
+
- [l10n] Improve Russian (ru-RU) locale (#11210) @dastan-akhmetov-scity
|
|
111
|
+
|
|
112
|
+
#### `@mui/x-data-grid-pro@7.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
113
|
+
|
|
114
|
+
Same changes as in `@mui/x-data-grid@7.7.0`, plus:
|
|
115
|
+
|
|
116
|
+
- [DataGridPro] Do not render detail panel if the focused cell is not visible (#13456) @cherniavskii
|
|
117
|
+
|
|
118
|
+
#### `@mui/x-data-grid-premium@7.7.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
119
|
+
|
|
120
|
+
Same changes as in `@mui/x-data-grid-pro@7.7.0`.
|
|
121
|
+
|
|
122
|
+
### Date and Time Pickers
|
|
123
|
+
|
|
124
|
+
#### `@mui/x-date-pickers@7.7.0`
|
|
125
|
+
|
|
126
|
+
- [l10n] Improve Korean (ko-KR) locale (#13452) @ryxxn
|
|
127
|
+
- [l10n] Improve Persian (fa-IR) locale (#13402) @fakhamatia
|
|
128
|
+
- [pickers] Allow to customize the month and the year buttons (#13321) @flaviendelangle
|
|
129
|
+
|
|
130
|
+
#### `@mui/x-date-pickers-pro@7.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
131
|
+
|
|
132
|
+
Same changes as in `@mui/x-date-pickers@7.7.0`.
|
|
133
|
+
|
|
134
|
+
### Charts
|
|
135
|
+
|
|
136
|
+
#### `@mui/x-charts@7.7.0`
|
|
137
|
+
|
|
138
|
+
- [charts] Add watermark on the pro `ResponsiveChartContainer` (#13398) @alexfauquette
|
|
139
|
+
- [charts] Allow to specify y-axis configuration (#13438) @alexfauquette
|
|
140
|
+
- [charts] Fix eslint for react compiler (#13444) @alexfauquette
|
|
141
|
+
- [charts] Improve themeAugmentation typing (#13433) @noraleonte
|
|
142
|
+
- [charts] Move the `ZAxisContextProvider` by default in the `ChartContainer` (#13465) @alexfauquette
|
|
143
|
+
- [charts] Use plugins to define series extremum and colors (#13397) @alexfauquette
|
|
144
|
+
|
|
145
|
+
### Tree View
|
|
146
|
+
|
|
147
|
+
#### `@mui/x-tree-view@7.7.0`
|
|
148
|
+
|
|
149
|
+
- [TreeView] Improve TypeScript for plugins (#13380) @flaviendelangle
|
|
150
|
+
- [TreeView] Improve the typing of the cancelable events (#13152) @flaviendelangle
|
|
151
|
+
- [TreeView] Prepare support for PigmentCSS (#13412) @flaviendelangle
|
|
152
|
+
- [TreeView] Refactor the tree view internals to prepare for headless API (#13311) @flaviendelangle
|
|
153
|
+
|
|
154
|
+
### Docs
|
|
155
|
+
|
|
156
|
+
- [docs] Add `renderHeader` recipe to the Master Details docs (#13370) @michelengelen
|
|
157
|
+
- [docs] Add lazy loading detail panel demo (#13453) @cherniavskii
|
|
158
|
+
- [docs] Add small edits to the Data Grid overview page (#13060) @danilo-leal
|
|
159
|
+
- [docs] Update a11y pages description (#13417) @danilo-leal
|
|
160
|
+
- [docs] improve the writing on the "Quick filter outside of the grid" example (#13155) @michelengelen
|
|
161
|
+
|
|
162
|
+
### Core
|
|
163
|
+
|
|
164
|
+
- [core] Add `eslint-plugin-react-compiler` experimental version and rules (#13415) @JCQuintas
|
|
165
|
+
- [core] Minor setup cleanup (#13467) @LukasTy
|
|
166
|
+
- [infra] Adjust CI setup (#13448) @LukasTy
|
|
167
|
+
- [test] Add tests for the custom slots of `TreeItem2` (#13314) @flaviendelangle
|
|
168
|
+
|
|
6
169
|
## 7.6.2
|
|
7
170
|
|
|
8
171
|
_Jun 6, 2024_
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RichTreeViewProps } from './RichTreeView.types';
|
|
3
|
-
export declare const RichTreeViewRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material
|
|
4
|
-
ownerState: RichTreeViewProps<any, any>;
|
|
5
|
-
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, keyof React.ClassAttributes<HTMLUListElement> | keyof React.HTMLAttributes<HTMLUListElement>>, {}>;
|
|
3
|
+
export declare const RichTreeViewRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, keyof React.ClassAttributes<HTMLUListElement> | keyof React.HTMLAttributes<HTMLUListElement>>, {}>;
|
|
6
4
|
type RichTreeViewComponent = (<R extends {}, Multiple extends boolean | undefined = undefined>(props: RichTreeViewProps<R, Multiple> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element) & {
|
|
7
5
|
propTypes?: any;
|
|
8
6
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { styled, useThemeProps } from '@mui/material/styles';
|
|
5
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
5
|
import { useSlotProps } from '@mui/base/utils';
|
|
7
6
|
import { getRichTreeViewUtilityClass } from './richTreeViewClasses';
|
|
7
|
+
import { styled, createUseThemeProps } from '../internals/zero-styled';
|
|
8
8
|
import { useTreeView } from '../internals/useTreeView';
|
|
9
9
|
import { TreeViewProvider } from '../internals/TreeViewProvider';
|
|
10
|
-
import {
|
|
10
|
+
import { RICH_TREE_VIEW_PLUGINS } from './RichTreeView.plugins';
|
|
11
11
|
import { TreeItem } from '../TreeItem';
|
|
12
12
|
import { buildWarning } from '../internals/utils/warning';
|
|
13
|
-
import { extractPluginParamsFromProps } from '../internals/utils/extractPluginParamsFromProps';
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const useThemeProps = createUseThemeProps('MuiRichTreeView');
|
|
15
15
|
const useUtilityClasses = ownerState => {
|
|
16
16
|
const {
|
|
17
17
|
classes
|
|
@@ -80,27 +80,24 @@ const RichTreeView = /*#__PURE__*/React.forwardRef(function RichTreeView(inProps
|
|
|
80
80
|
childrenWarning();
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
const {
|
|
84
|
-
pluginParams,
|
|
85
|
-
slots,
|
|
86
|
-
slotProps,
|
|
87
|
-
otherProps
|
|
88
|
-
} = extractPluginParamsFromProps({
|
|
89
|
-
props,
|
|
90
|
-
plugins: DEFAULT_TREE_VIEW_PLUGINS,
|
|
91
|
-
rootRef: ref
|
|
92
|
-
});
|
|
93
83
|
const {
|
|
94
84
|
getRootProps,
|
|
95
85
|
contextValue,
|
|
96
86
|
instance
|
|
97
|
-
} = useTreeView(
|
|
87
|
+
} = useTreeView({
|
|
88
|
+
plugins: RICH_TREE_VIEW_PLUGINS,
|
|
89
|
+
rootRef: ref,
|
|
90
|
+
props
|
|
91
|
+
});
|
|
92
|
+
const {
|
|
93
|
+
slots,
|
|
94
|
+
slotProps
|
|
95
|
+
} = props;
|
|
98
96
|
const classes = useUtilityClasses(props);
|
|
99
97
|
const Root = slots?.root ?? RichTreeViewRoot;
|
|
100
98
|
const rootProps = useSlotProps({
|
|
101
99
|
elementType: Root,
|
|
102
100
|
externalSlotProps: slotProps?.root,
|
|
103
|
-
externalForwardedProps: otherProps,
|
|
104
101
|
className: classes.root,
|
|
105
102
|
getSlotProps: getRootProps,
|
|
106
103
|
ownerState: props
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TreeViewCorePluginParameters } from '../internals/corePlugins';
|
|
2
|
+
import { UseTreeViewItemsParameters } from '../internals/plugins/useTreeViewItems';
|
|
3
|
+
import { UseTreeViewExpansionParameters } from '../internals/plugins/useTreeViewExpansion';
|
|
4
|
+
import { UseTreeViewSelectionParameters } from '../internals/plugins/useTreeViewSelection';
|
|
5
|
+
import { UseTreeViewFocusParameters } from '../internals/plugins/useTreeViewFocus';
|
|
6
|
+
import { UseTreeViewIconsParameters } from '../internals/plugins/useTreeViewIcons';
|
|
7
|
+
import { ConvertPluginsIntoSignatures, MergeSignaturesProperty } from '../internals/models';
|
|
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
|
+
export type RichTreeViewPluginSignatures = ConvertPluginsIntoSignatures<typeof RICH_TREE_VIEW_PLUGINS>;
|
|
10
|
+
export type RichTreeViewPluginSlots = MergeSignaturesProperty<RichTreeViewPluginSignatures, 'slots'>;
|
|
11
|
+
export type RichTreeViewPluginSlotProps = MergeSignaturesProperty<RichTreeViewPluginSignatures, 'slotProps'>;
|
|
12
|
+
export interface RichTreeViewPluginParameters<R extends {}, Multiple extends boolean | undefined> extends TreeViewCorePluginParameters, UseTreeViewItemsParameters<R>, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters<Multiple>, UseTreeViewIconsParameters {
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useTreeViewItems } from '../internals/plugins/useTreeViewItems';
|
|
2
|
+
import { useTreeViewExpansion } from '../internals/plugins/useTreeViewExpansion';
|
|
3
|
+
import { useTreeViewSelection } from '../internals/plugins/useTreeViewSelection';
|
|
4
|
+
import { useTreeViewFocus } from '../internals/plugins/useTreeViewFocus';
|
|
5
|
+
import { useTreeViewKeyboardNavigation } from '../internals/plugins/useTreeViewKeyboardNavigation';
|
|
6
|
+
import { useTreeViewIcons } from '../internals/plugins/useTreeViewIcons';
|
|
7
|
+
export const RICH_TREE_VIEW_PLUGINS = [useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons];
|
|
8
|
+
|
|
9
|
+
// We can't infer this type from the plugin, otherwise we would lose the generics.
|
|
@@ -3,7 +3,7 @@ import { Theme } from '@mui/material/styles';
|
|
|
3
3
|
import { SxProps } from '@mui/system';
|
|
4
4
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
5
5
|
import { RichTreeViewClasses } from './richTreeViewClasses';
|
|
6
|
-
import {
|
|
6
|
+
import { RichTreeViewPluginParameters, RichTreeViewPluginSlotProps, RichTreeViewPluginSlots, RichTreeViewPluginSignatures } from './RichTreeView.plugins';
|
|
7
7
|
import { TreeItemProps } from '../TreeItem';
|
|
8
8
|
import { TreeItem2Props } from '../TreeItem2';
|
|
9
9
|
import { TreeViewItemId } from '../models';
|
|
@@ -12,7 +12,7 @@ interface RichTreeViewItemSlotOwnerState {
|
|
|
12
12
|
itemId: TreeViewItemId;
|
|
13
13
|
label: string;
|
|
14
14
|
}
|
|
15
|
-
export interface RichTreeViewSlots extends
|
|
15
|
+
export interface RichTreeViewSlots extends RichTreeViewPluginSlots {
|
|
16
16
|
/**
|
|
17
17
|
* Element rendered at the root.
|
|
18
18
|
* @default RichTreeViewRoot
|
|
@@ -24,11 +24,11 @@ export interface RichTreeViewSlots extends DefaultTreeViewPluginSlots {
|
|
|
24
24
|
*/
|
|
25
25
|
item?: React.JSXElementConstructor<TreeItemProps> | React.JSXElementConstructor<TreeItem2Props>;
|
|
26
26
|
}
|
|
27
|
-
export interface RichTreeViewSlotProps<R extends {}, Multiple extends boolean | undefined> extends
|
|
27
|
+
export interface RichTreeViewSlotProps<R extends {}, Multiple extends boolean | undefined> extends RichTreeViewPluginSlotProps {
|
|
28
28
|
root?: SlotComponentProps<'ul', {}, RichTreeViewProps<R, Multiple>>;
|
|
29
29
|
item?: SlotComponentPropsFromProps<TreeItemProps | TreeItem2Props, {}, RichTreeViewItemSlotOwnerState>;
|
|
30
30
|
}
|
|
31
|
-
export type RichTreeViewApiRef = React.MutableRefObject<TreeViewPublicAPI<
|
|
31
|
+
export type RichTreeViewApiRef = React.MutableRefObject<TreeViewPublicAPI<RichTreeViewPluginSignatures> | undefined>;
|
|
32
32
|
export interface RichTreeViewPropsBase extends React.HTMLAttributes<HTMLUListElement> {
|
|
33
33
|
className?: string;
|
|
34
34
|
/**
|
|
@@ -40,7 +40,7 @@ export interface RichTreeViewPropsBase extends React.HTMLAttributes<HTMLUListEle
|
|
|
40
40
|
*/
|
|
41
41
|
sx?: SxProps<Theme>;
|
|
42
42
|
}
|
|
43
|
-
export interface RichTreeViewProps<R extends {}, Multiple extends boolean | undefined> extends
|
|
43
|
+
export interface RichTreeViewProps<R extends {}, Multiple extends boolean | undefined> extends RichTreeViewPluginParameters<R, Multiple>, RichTreeViewPropsBase {
|
|
44
44
|
/**
|
|
45
45
|
* Overridable component slots.
|
|
46
46
|
* @default {}
|
|
@@ -60,6 +60,6 @@ export interface RichTreeViewProps<R extends {}, Multiple extends boolean | unde
|
|
|
60
60
|
* For each feature, if the flag is not explicitly set to `true`,
|
|
61
61
|
* the feature will be fully disabled and any property / method call will not have any effect.
|
|
62
62
|
*/
|
|
63
|
-
experimentalFeatures?: TreeViewExperimentalFeatures<
|
|
63
|
+
experimentalFeatures?: TreeViewExperimentalFeatures<RichTreeViewPluginSignatures>;
|
|
64
64
|
}
|
|
65
65
|
export {};
|
package/RichTreeView/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export * from './RichTreeView';
|
|
2
2
|
export * from './richTreeViewClasses';
|
|
3
3
|
export type { RichTreeViewProps, RichTreeViewPropsBase, RichTreeViewSlots, RichTreeViewSlotProps, } from './RichTreeView.types';
|
|
4
|
+
export { RICH_TREE_VIEW_PLUGINS } from './RichTreeView.plugins';
|
|
5
|
+
export type { RichTreeViewPluginSlots, RichTreeViewPluginSlotProps, RichTreeViewPluginParameters, } from './RichTreeView.plugins';
|
package/RichTreeView/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SimpleTreeViewProps } from './SimpleTreeView.types';
|
|
3
|
-
export declare const SimpleTreeViewRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material
|
|
3
|
+
export declare const SimpleTreeViewRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
4
4
|
ownerState: SimpleTreeViewProps<any>;
|
|
5
5
|
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, keyof React.ClassAttributes<HTMLUListElement> | keyof React.HTMLAttributes<HTMLUListElement>>, {}>;
|
|
6
6
|
type SimpleTreeViewComponent = (<Multiple extends boolean | undefined = undefined>(props: SimpleTreeViewProps<Multiple> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element) & {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { styled, useThemeProps } from '@mui/material/styles';
|
|
5
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
5
|
import { useSlotProps } from '@mui/base/utils';
|
|
6
|
+
import { styled, createUseThemeProps } from '../internals/zero-styled';
|
|
7
7
|
import { getSimpleTreeViewUtilityClass } from './simpleTreeViewClasses';
|
|
8
8
|
import { useTreeView } from '../internals/useTreeView';
|
|
9
9
|
import { TreeViewProvider } from '../internals/TreeViewProvider';
|
|
10
10
|
import { SIMPLE_TREE_VIEW_PLUGINS } from './SimpleTreeView.plugins';
|
|
11
11
|
import { buildWarning } from '../internals/utils/warning';
|
|
12
|
-
import { extractPluginParamsFromProps } from '../internals/utils/extractPluginParamsFromProps';
|
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const useThemeProps = createUseThemeProps('MuiSimpleTreeView');
|
|
14
14
|
const useUtilityClasses = ownerState => {
|
|
15
15
|
const {
|
|
16
16
|
classes
|
|
@@ -56,27 +56,24 @@ const SimpleTreeView = /*#__PURE__*/React.forwardRef(function SimpleTreeView(inP
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
const {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
getRootProps,
|
|
60
|
+
contextValue
|
|
61
|
+
} = useTreeView({
|
|
62
|
+
plugins: SIMPLE_TREE_VIEW_PLUGINS,
|
|
63
|
+
rootRef: ref,
|
|
64
64
|
props: _extends({}, props, {
|
|
65
65
|
items: EMPTY_ITEMS
|
|
66
|
-
})
|
|
67
|
-
plugins: SIMPLE_TREE_VIEW_PLUGINS,
|
|
68
|
-
rootRef: ref
|
|
66
|
+
})
|
|
69
67
|
});
|
|
70
68
|
const {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
} =
|
|
69
|
+
slots,
|
|
70
|
+
slotProps
|
|
71
|
+
} = props;
|
|
74
72
|
const classes = useUtilityClasses(props);
|
|
75
73
|
const Root = slots?.root ?? SimpleTreeViewRoot;
|
|
76
74
|
const rootProps = useSlotProps({
|
|
77
75
|
elementType: Root,
|
|
78
76
|
externalSlotProps: slotProps?.root,
|
|
79
|
-
externalForwardedProps: otherProps,
|
|
80
77
|
className: classes.root,
|
|
81
78
|
getSlotProps: getRootProps,
|
|
82
79
|
ownerState
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { TreeViewCorePluginParameters } from '../internals/corePlugins';
|
|
2
|
+
import { UseTreeViewItemsParameters } from '../internals/plugins/useTreeViewItems';
|
|
3
|
+
import { UseTreeViewExpansionParameters } from '../internals/plugins/useTreeViewExpansion';
|
|
4
|
+
import { UseTreeViewSelectionParameters } from '../internals/plugins/useTreeViewSelection';
|
|
5
|
+
import { UseTreeViewFocusParameters } from '../internals/plugins/useTreeViewFocus';
|
|
6
|
+
import { UseTreeViewIconsParameters } from '../internals/plugins/useTreeViewIcons';
|
|
7
|
+
import { ConvertPluginsIntoSignatures, MergeSignaturesProperty } from '../internals/models';
|
|
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
|
+
export type SimpleTreeViewPluginSignatures = ConvertPluginsIntoSignatures<typeof SIMPLE_TREE_VIEW_PLUGINS>;
|
|
10
|
+
export type SimpleTreeViewPluginSlots = MergeSignaturesProperty<SimpleTreeViewPluginSignatures, 'slots'>;
|
|
11
|
+
export type SimpleTreeViewPluginSlotProps = MergeSignaturesProperty<SimpleTreeViewPluginSignatures, 'slotProps'>;
|
|
12
|
+
export interface SimpleTreeViewPluginParameters<Multiple extends boolean | undefined> extends TreeViewCorePluginParameters, Omit<UseTreeViewItemsParameters<any>, 'items' | 'isItemDisabled' | 'getItemLabel' | 'getItemId'>, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters<Multiple>, UseTreeViewIconsParameters {
|
|
8
13
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTreeViewItems } from '../internals/plugins/useTreeViewItems';
|
|
2
|
+
import { useTreeViewExpansion } from '../internals/plugins/useTreeViewExpansion';
|
|
3
|
+
import { useTreeViewSelection } from '../internals/plugins/useTreeViewSelection';
|
|
4
|
+
import { useTreeViewFocus } from '../internals/plugins/useTreeViewFocus';
|
|
5
|
+
import { useTreeViewKeyboardNavigation } from '../internals/plugins/useTreeViewKeyboardNavigation';
|
|
6
|
+
import { useTreeViewIcons } from '../internals/plugins/useTreeViewIcons';
|
|
2
7
|
import { useTreeViewJSXItems } from '../internals/plugins/useTreeViewJSXItems';
|
|
3
|
-
export const SIMPLE_TREE_VIEW_PLUGINS = [
|
|
8
|
+
export const SIMPLE_TREE_VIEW_PLUGINS = [useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons, useTreeViewJSXItems];
|
|
4
9
|
|
|
5
10
|
// We can't infer this type from the plugin, otherwise we would lose the generics.
|
|
@@ -3,7 +3,7 @@ import { Theme } from '@mui/material/styles';
|
|
|
3
3
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
4
4
|
import { SxProps } from '@mui/system';
|
|
5
5
|
import { SimpleTreeViewClasses } from './simpleTreeViewClasses';
|
|
6
|
-
import { SimpleTreeViewPluginParameters, SimpleTreeViewPluginSlotProps, SimpleTreeViewPluginSlots,
|
|
6
|
+
import { SimpleTreeViewPluginParameters, SimpleTreeViewPluginSlotProps, SimpleTreeViewPluginSlots, SimpleTreeViewPluginSignatures } from './SimpleTreeView.plugins';
|
|
7
7
|
import { TreeViewExperimentalFeatures, TreeViewPublicAPI } from '../internals/models';
|
|
8
8
|
export interface SimpleTreeViewSlots extends SimpleTreeViewPluginSlots {
|
|
9
9
|
/**
|
|
@@ -15,7 +15,7 @@ export interface SimpleTreeViewSlots extends SimpleTreeViewPluginSlots {
|
|
|
15
15
|
export interface SimpleTreeViewSlotProps extends SimpleTreeViewPluginSlotProps {
|
|
16
16
|
root?: SlotComponentProps<'ul', {}, {}>;
|
|
17
17
|
}
|
|
18
|
-
export type SimpleTreeViewApiRef = React.MutableRefObject<TreeViewPublicAPI<
|
|
18
|
+
export type SimpleTreeViewApiRef = React.MutableRefObject<TreeViewPublicAPI<SimpleTreeViewPluginSignatures> | undefined>;
|
|
19
19
|
export interface SimpleTreeViewProps<Multiple extends boolean | undefined> extends SimpleTreeViewPluginParameters<Multiple>, React.HTMLAttributes<HTMLUListElement> {
|
|
20
20
|
/**
|
|
21
21
|
* The content of the component.
|
|
@@ -47,5 +47,5 @@ export interface SimpleTreeViewProps<Multiple extends boolean | undefined> exten
|
|
|
47
47
|
* For each feature, if the flag is not explicitly set to `true`,
|
|
48
48
|
* the feature will be fully disabled and any property / method call will not have any effect.
|
|
49
49
|
*/
|
|
50
|
-
experimentalFeatures?: TreeViewExperimentalFeatures<
|
|
50
|
+
experimentalFeatures?: TreeViewExperimentalFeatures<SimpleTreeViewPluginSignatures>;
|
|
51
51
|
}
|
package/TreeItem/TreeItem.js
CHANGED
|
@@ -11,10 +11,11 @@ import Collapse from '@mui/material/Collapse';
|
|
|
11
11
|
import { resolveComponentProps, useSlotProps } from '@mui/base/utils';
|
|
12
12
|
import useForkRef from '@mui/utils/useForkRef';
|
|
13
13
|
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
14
|
-
import { alpha
|
|
14
|
+
import { alpha } from '@mui/material/styles';
|
|
15
15
|
import unsupportedProp from '@mui/utils/unsupportedProp';
|
|
16
16
|
import elementTypeAcceptingRef from '@mui/utils/elementTypeAcceptingRef';
|
|
17
17
|
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
18
|
+
import { styled, createUseThemeProps } from '../internals/zero-styled';
|
|
18
19
|
import { TreeItemContent } from './TreeItemContent';
|
|
19
20
|
import { treeItemClasses, getTreeItemUtilityClass } from './treeItemClasses';
|
|
20
21
|
import { useTreeViewContext } from '../internals/TreeViewProvider/useTreeViewContext';
|
|
@@ -22,6 +23,7 @@ import { TreeViewCollapseIcon, TreeViewExpandIcon } from '../icons';
|
|
|
22
23
|
import { TreeItem2Provider } from '../TreeItem2Provider';
|
|
23
24
|
import { TreeViewItemDepthContext } from '../internals/TreeViewItemDepthContext';
|
|
24
25
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
const useThemeProps = createUseThemeProps('MuiTreeItem');
|
|
25
27
|
const useUtilityClasses = ownerState => {
|
|
26
28
|
const {
|
|
27
29
|
classes
|
|
@@ -390,6 +392,10 @@ process.env.NODE_ENV !== "production" ? TreeItem.propTypes = {
|
|
|
390
392
|
* Use the `onItemFocus` callback on the tree if you need to monitor a item's focus.
|
|
391
393
|
*/
|
|
392
394
|
onFocus: unsupportedProp,
|
|
395
|
+
/**
|
|
396
|
+
* Callback fired when a key of the keyboard is pressed on the item.
|
|
397
|
+
*/
|
|
398
|
+
onKeyDown: PropTypes.func,
|
|
393
399
|
/**
|
|
394
400
|
* The props used for each component slot.
|
|
395
401
|
* @default {}
|
|
@@ -7,6 +7,13 @@ import { TreeItemContentProps } from './TreeItemContent';
|
|
|
7
7
|
import { TreeItemClasses } from './treeItemClasses';
|
|
8
8
|
import { TreeViewItemId } from '../models';
|
|
9
9
|
import { SlotComponentPropsFromProps } from '../internals/models';
|
|
10
|
+
import { MuiCancellableEventHandler } from '../internals/models/MuiCancellableEvent';
|
|
11
|
+
import { UseTreeViewIconsSignature } from '../internals/plugins/useTreeViewIcons';
|
|
12
|
+
import { UseTreeViewSelectionSignature } from '../internals/plugins/useTreeViewSelection';
|
|
13
|
+
import { UseTreeViewItemsSignature } from '../internals/plugins/useTreeViewItems';
|
|
14
|
+
import { UseTreeViewFocusSignature } from '../internals/plugins/useTreeViewFocus';
|
|
15
|
+
import { UseTreeViewExpansionSignature } from '../internals/plugins/useTreeViewExpansion';
|
|
16
|
+
import { UseTreeViewKeyboardNavigationSignature } from '../internals/plugins/useTreeViewKeyboardNavigation';
|
|
10
17
|
export interface TreeItemSlots {
|
|
11
18
|
/**
|
|
12
19
|
* The icon used to collapse the item.
|
|
@@ -25,7 +32,7 @@ export interface TreeItemSlots {
|
|
|
25
32
|
*/
|
|
26
33
|
icon?: React.ElementType;
|
|
27
34
|
/**
|
|
28
|
-
* The component that animates
|
|
35
|
+
* The component that animates the appearance / disappearance of the item's children.
|
|
29
36
|
* @default TreeItem2Group
|
|
30
37
|
*/
|
|
31
38
|
groupTransition?: React.ElementType;
|
|
@@ -90,6 +97,10 @@ export interface TreeItemProps extends Omit<React.HTMLAttributes<HTMLLIElement>,
|
|
|
90
97
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
91
98
|
*/
|
|
92
99
|
sx?: SxProps<Theme>;
|
|
100
|
+
/**
|
|
101
|
+
* Callback fired when a key of the keyboard is pressed on the item.
|
|
102
|
+
*/
|
|
103
|
+
onKeyDown?: MuiCancellableEventHandler<React.KeyboardEvent<HTMLLIElement>>;
|
|
93
104
|
}
|
|
94
105
|
export interface TreeItemOwnerState extends TreeItemProps {
|
|
95
106
|
expanded: boolean;
|
|
@@ -98,3 +109,18 @@ export interface TreeItemOwnerState extends TreeItemProps {
|
|
|
98
109
|
disabled: boolean;
|
|
99
110
|
indentationAtItemLevel: boolean;
|
|
100
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Plugins that need to be present in the Tree View in order for `TreeItem` to work correctly.
|
|
114
|
+
*/
|
|
115
|
+
export type TreeItemMinimalPlugins = readonly [
|
|
116
|
+
UseTreeViewIconsSignature,
|
|
117
|
+
UseTreeViewSelectionSignature,
|
|
118
|
+
UseTreeViewItemsSignature,
|
|
119
|
+
UseTreeViewFocusSignature,
|
|
120
|
+
UseTreeViewExpansionSignature,
|
|
121
|
+
UseTreeViewKeyboardNavigationSignature
|
|
122
|
+
];
|
|
123
|
+
/**
|
|
124
|
+
* Plugins that `TreeItem` can use if they are present, but are not required.
|
|
125
|
+
*/
|
|
126
|
+
export type TreeItemOptionalPlugins = readonly [];
|
package/TreeItem2/TreeItem2.js
CHANGED
|
@@ -6,17 +6,19 @@ import * as React from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import unsupportedProp from '@mui/utils/unsupportedProp';
|
|
9
|
-
import { alpha
|
|
9
|
+
import { alpha } 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
13
|
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
14
14
|
import composeClasses from '@mui/utils/composeClasses';
|
|
15
|
+
import { styled, createUseThemeProps } from '../internals/zero-styled';
|
|
15
16
|
import { unstable_useTreeItem2 as useTreeItem2 } from '../useTreeItem2';
|
|
16
17
|
import { getTreeItemUtilityClass } from '../TreeItem';
|
|
17
18
|
import { TreeItem2Icon } from '../TreeItem2Icon';
|
|
18
19
|
import { TreeItem2Provider } from '../TreeItem2Provider';
|
|
19
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
const useThemeProps = createUseThemeProps('MuiTreeItem2');
|
|
20
22
|
export const TreeItem2Root = styled('li', {
|
|
21
23
|
name: 'MuiTreeItem2',
|
|
22
24
|
slot: 'Root',
|
|
@@ -321,11 +323,19 @@ process.env.NODE_ENV !== "production" ? TreeItem2.propTypes = {
|
|
|
321
323
|
* The label of the item.
|
|
322
324
|
*/
|
|
323
325
|
label: PropTypes.node,
|
|
326
|
+
/**
|
|
327
|
+
* Callback fired when the item root is blurred.
|
|
328
|
+
*/
|
|
329
|
+
onBlur: PropTypes.func,
|
|
324
330
|
/**
|
|
325
331
|
* This prop isn't supported.
|
|
326
|
-
* Use the `onItemFocus` callback on the tree if you need to monitor
|
|
332
|
+
* Use the `onItemFocus` callback on the tree if you need to monitor an item's focus.
|
|
327
333
|
*/
|
|
328
334
|
onFocus: unsupportedProp,
|
|
335
|
+
/**
|
|
336
|
+
* Callback fired when a key is pressed on the keyboard and the tree is in focus.
|
|
337
|
+
*/
|
|
338
|
+
onKeyDown: PropTypes.func,
|
|
329
339
|
/**
|
|
330
340
|
* The props used for each component slot.
|
|
331
341
|
* @default {}
|
|
@@ -3,6 +3,7 @@ import { SlotComponentProps } from '@mui/base/utils';
|
|
|
3
3
|
import { UseTreeItem2Parameters, UseTreeItem2Status } from '../useTreeItem2';
|
|
4
4
|
import { TreeItemClasses } from '../TreeItem';
|
|
5
5
|
import { TreeItem2IconSlotProps, TreeItem2IconSlots } from '../TreeItem2Icon';
|
|
6
|
+
import { MuiCancellableEventHandler } from '../internals/models/MuiCancellableEvent';
|
|
6
7
|
export interface TreeItem2Slots extends TreeItem2IconSlots {
|
|
7
8
|
/**
|
|
8
9
|
* The component that renders the root.
|
|
@@ -62,9 +63,17 @@ export interface TreeItem2Props extends Omit<UseTreeItem2Parameters, 'rootRef'>,
|
|
|
62
63
|
slotProps?: TreeItem2SlotProps;
|
|
63
64
|
/**
|
|
64
65
|
* This prop isn't supported.
|
|
65
|
-
* Use the `onItemFocus` callback on the tree if you need to monitor
|
|
66
|
+
* Use the `onItemFocus` callback on the tree if you need to monitor an item's focus.
|
|
66
67
|
*/
|
|
67
68
|
onFocus?: null;
|
|
69
|
+
/**
|
|
70
|
+
* Callback fired when the item root is blurred.
|
|
71
|
+
*/
|
|
72
|
+
onBlur?: MuiCancellableEventHandler<React.FocusEvent<HTMLLIElement>>;
|
|
73
|
+
/**
|
|
74
|
+
* Callback fired when a key is pressed on the keyboard and the tree is in focus.
|
|
75
|
+
*/
|
|
76
|
+
onKeyDown?: MuiCancellableEventHandler<React.KeyboardEvent<HTMLLIElement>>;
|
|
68
77
|
}
|
|
69
78
|
export interface TreeItem2OwnerState extends Omit<TreeItem2Props, 'disabled'>, UseTreeItem2Status {
|
|
70
79
|
}
|
package/TreeView/TreeView.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { styled, useThemeProps } from '@mui/material/styles';
|
|
5
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
+
import { styled, createUseThemeProps } from '../internals/zero-styled';
|
|
6
6
|
import { getTreeViewUtilityClass } from './treeViewClasses';
|
|
7
7
|
import { SimpleTreeView, SimpleTreeViewRoot } from '../SimpleTreeView';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const useThemeProps = createUseThemeProps('MuiTreeView');
|
|
9
10
|
const useUtilityClasses = ownerState => {
|
|
10
11
|
const {
|
|
11
12
|
classes
|
|
@@ -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;
|