@mui/lab 5.0.0-alpha.142 → 5.0.0-alpha.143
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 +111 -19
- package/LoadingButton/LoadingButton.d.ts +52 -50
- package/LoadingButton/LoadingButton.js +1 -1
- package/Masonry/Masonry.d.ts +46 -41
- package/TabList/TabList.d.ts +14 -12
- package/TreeItem/TreeItem.d.ts +4 -85
- package/TreeItem/TreeItem.js +17 -375
- package/TreeItem/index.d.ts +2 -6
- package/TreeItem/index.js +1 -3
- package/TreeView/TreeView.d.ts +3 -141
- package/TreeView/TreeView.js +17 -824
- package/TreeView/index.d.ts +2 -4
- package/TreeView/index.js +1 -2
- package/index.js +1 -1
- package/legacy/LoadingButton/LoadingButton.js +1 -1
- package/legacy/TreeItem/TreeItem.js +17 -372
- package/legacy/TreeItem/index.js +1 -3
- package/legacy/TreeView/TreeView.js +17 -878
- package/legacy/TreeView/index.js +1 -2
- package/legacy/index.js +1 -1
- package/modern/LoadingButton/LoadingButton.js +1 -1
- package/modern/TreeItem/TreeItem.js +17 -375
- package/modern/TreeItem/index.js +1 -3
- package/modern/TreeView/TreeView.js +17 -824
- package/modern/TreeView/index.js +1 -2
- package/modern/index.js +1 -1
- package/node/LoadingButton/LoadingButton.js +1 -1
- package/node/TreeItem/TreeItem.js +17 -374
- package/node/TreeItem/index.js +9 -21
- package/node/TreeView/TreeView.js +17 -824
- package/node/TreeView/index.js +8 -18
- package/node/index.js +1 -1
- package/package.json +5 -4
- package/TreeItem/TreeItemContent.d.ts +0 -50
- package/TreeItem/TreeItemContent.js +0 -112
- package/TreeItem/treeItemClasses.d.ts +0 -24
- package/TreeItem/treeItemClasses.js +0 -7
- package/TreeItem/useTreeItem.d.ts +0 -11
- package/TreeItem/useTreeItem.js +0 -68
- package/TreeView/TreeViewContext.js +0 -10
- package/TreeView/descendants.js +0 -186
- package/TreeView/treeViewClasses.d.ts +0 -8
- package/TreeView/treeViewClasses.js +0 -7
- package/legacy/TreeItem/TreeItemContent.js +0 -108
- package/legacy/TreeItem/treeItemClasses.js +0 -7
- package/legacy/TreeItem/useTreeItem.js +0 -67
- package/legacy/TreeView/TreeViewContext.js +0 -10
- package/legacy/TreeView/descendants.js +0 -193
- package/legacy/TreeView/treeViewClasses.js +0 -7
- package/modern/TreeItem/TreeItemContent.js +0 -112
- package/modern/TreeItem/treeItemClasses.js +0 -7
- package/modern/TreeItem/useTreeItem.js +0 -68
- package/modern/TreeView/TreeViewContext.js +0 -10
- package/modern/TreeView/descendants.js +0 -186
- package/modern/TreeView/treeViewClasses.js +0 -7
- package/node/TreeItem/TreeItemContent.js +0 -120
- package/node/TreeItem/treeItemClasses.js +0 -16
- package/node/TreeItem/useTreeItem.js +0 -77
- package/node/TreeView/TreeViewContext.js +0 -18
- package/node/TreeView/descendants.js +0 -194
- package/node/TreeView/treeViewClasses.js +0 -16
package/TreeItem/TreeItem.js
CHANGED
|
@@ -1,391 +1,33 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["children", "className", "collapseIcon", "ContentComponent", "ContentProps", "endIcon", "expandIcon", "disabled", "icon", "id", "label", "nodeId", "onClick", "onMouseDown", "TransitionComponent", "TransitionProps"];
|
|
4
2
|
import * as React from 'react';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
3
|
import PropTypes from 'prop-types';
|
|
7
|
-
import {
|
|
8
|
-
import Collapse from '@mui/material/Collapse';
|
|
9
|
-
import { alpha, styled, useThemeProps } from '@mui/material/styles';
|
|
10
|
-
import { ownerDocument, useForkRef, unsupportedProp } from '@mui/material/utils';
|
|
11
|
-
import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
12
|
-
import TreeViewContext from '../TreeView/TreeViewContext';
|
|
13
|
-
import { DescendantProvider, useDescendant } from '../TreeView/descendants';
|
|
14
|
-
import TreeItemContent from './TreeItemContent';
|
|
15
|
-
import treeItemClasses, { getTreeItemUtilityClass } from './treeItemClasses';
|
|
4
|
+
import { TreeItem as XTreeItem } from '@mui/x-tree-view/TreeItem';
|
|
16
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const slots = {
|
|
23
|
-
root: ['root'],
|
|
24
|
-
content: ['content'],
|
|
25
|
-
expanded: ['expanded'],
|
|
26
|
-
selected: ['selected'],
|
|
27
|
-
focused: ['focused'],
|
|
28
|
-
disabled: ['disabled'],
|
|
29
|
-
iconContainer: ['iconContainer'],
|
|
30
|
-
label: ['label'],
|
|
31
|
-
group: ['group']
|
|
32
|
-
};
|
|
33
|
-
return composeClasses(slots, getTreeItemUtilityClass, classes);
|
|
34
|
-
};
|
|
35
|
-
const TreeItemRoot = styled('li', {
|
|
36
|
-
name: 'MuiTreeItem',
|
|
37
|
-
slot: 'Root',
|
|
38
|
-
overridesResolver: (props, styles) => styles.root
|
|
39
|
-
})({
|
|
40
|
-
listStyle: 'none',
|
|
41
|
-
margin: 0,
|
|
42
|
-
padding: 0,
|
|
43
|
-
outline: 0
|
|
44
|
-
});
|
|
45
|
-
const StyledTreeItemContent = styled(TreeItemContent, {
|
|
46
|
-
name: 'MuiTreeItem',
|
|
47
|
-
slot: 'Content',
|
|
48
|
-
overridesResolver: (props, styles) => {
|
|
49
|
-
return [styles.content, styles.iconContainer && {
|
|
50
|
-
[`& .${treeItemClasses.iconContainer}`]: styles.iconContainer
|
|
51
|
-
}, styles.label && {
|
|
52
|
-
[`& .${treeItemClasses.label}`]: styles.label
|
|
53
|
-
}];
|
|
54
|
-
}
|
|
55
|
-
})(({
|
|
56
|
-
theme
|
|
57
|
-
}) => ({
|
|
58
|
-
padding: '0 8px',
|
|
59
|
-
width: '100%',
|
|
60
|
-
display: 'flex',
|
|
61
|
-
alignItems: 'center',
|
|
62
|
-
cursor: 'pointer',
|
|
63
|
-
WebkitTapHighlightColor: 'transparent',
|
|
64
|
-
'&:hover': {
|
|
65
|
-
backgroundColor: (theme.vars || theme).palette.action.hover,
|
|
66
|
-
// Reset on touch devices, it doesn't add specificity
|
|
67
|
-
'@media (hover: none)': {
|
|
68
|
-
backgroundColor: 'transparent'
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
[`&.${treeItemClasses.disabled}`]: {
|
|
72
|
-
opacity: (theme.vars || theme).palette.action.disabledOpacity,
|
|
73
|
-
backgroundColor: 'transparent'
|
|
74
|
-
},
|
|
75
|
-
[`&.${treeItemClasses.focused}`]: {
|
|
76
|
-
backgroundColor: (theme.vars || theme).palette.action.focus
|
|
77
|
-
},
|
|
78
|
-
[`&.${treeItemClasses.selected}`]: {
|
|
79
|
-
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity),
|
|
80
|
-
'&:hover': {
|
|
81
|
-
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.hoverOpacity}))` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity),
|
|
82
|
-
// Reset on touch devices, it doesn't add specificity
|
|
83
|
-
'@media (hover: none)': {
|
|
84
|
-
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity)
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
[`&.${treeItemClasses.focused}`]: {
|
|
88
|
-
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / calc(${theme.vars.palette.action.selectedOpacity} + ${theme.vars.palette.action.focusOpacity}))` : alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity)
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
[`& .${treeItemClasses.iconContainer}`]: {
|
|
92
|
-
marginRight: 4,
|
|
93
|
-
width: 15,
|
|
94
|
-
display: 'flex',
|
|
95
|
-
flexShrink: 0,
|
|
96
|
-
justifyContent: 'center',
|
|
97
|
-
'& svg': {
|
|
98
|
-
fontSize: 18
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
[`& .${treeItemClasses.label}`]: _extends({
|
|
102
|
-
width: '100%',
|
|
103
|
-
// fixes overflow - see https://github.com/mui/material-ui/issues/27372
|
|
104
|
-
minWidth: 0,
|
|
105
|
-
paddingLeft: 4,
|
|
106
|
-
position: 'relative'
|
|
107
|
-
}, theme.typography.body1)
|
|
108
|
-
}));
|
|
109
|
-
const TreeItemGroup = styled(Collapse, {
|
|
110
|
-
name: 'MuiTreeItem',
|
|
111
|
-
slot: 'Group',
|
|
112
|
-
overridesResolver: (props, styles) => styles.group
|
|
113
|
-
})({
|
|
114
|
-
margin: 0,
|
|
115
|
-
padding: 0,
|
|
116
|
-
marginLeft: 17
|
|
117
|
-
});
|
|
118
|
-
const TreeItem = /*#__PURE__*/React.forwardRef(function TreeItem(inProps, ref) {
|
|
119
|
-
const props = useThemeProps({
|
|
120
|
-
props: inProps,
|
|
121
|
-
name: 'MuiTreeItem'
|
|
122
|
-
});
|
|
123
|
-
const {
|
|
124
|
-
children,
|
|
125
|
-
className,
|
|
126
|
-
collapseIcon,
|
|
127
|
-
ContentComponent = TreeItemContent,
|
|
128
|
-
ContentProps,
|
|
129
|
-
endIcon,
|
|
130
|
-
expandIcon,
|
|
131
|
-
disabled: disabledProp,
|
|
132
|
-
icon,
|
|
133
|
-
id: idProp,
|
|
134
|
-
label,
|
|
135
|
-
nodeId,
|
|
136
|
-
onClick,
|
|
137
|
-
onMouseDown,
|
|
138
|
-
TransitionComponent = Collapse,
|
|
139
|
-
TransitionProps
|
|
140
|
-
} = props,
|
|
141
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
142
|
-
const {
|
|
143
|
-
icons: contextIcons = {},
|
|
144
|
-
focus,
|
|
145
|
-
isExpanded,
|
|
146
|
-
isFocused,
|
|
147
|
-
isSelected,
|
|
148
|
-
isDisabled,
|
|
149
|
-
multiSelect,
|
|
150
|
-
disabledItemsFocusable,
|
|
151
|
-
mapFirstChar,
|
|
152
|
-
unMapFirstChar,
|
|
153
|
-
registerNode,
|
|
154
|
-
unregisterNode,
|
|
155
|
-
treeId
|
|
156
|
-
} = React.useContext(TreeViewContext);
|
|
157
|
-
let id = null;
|
|
158
|
-
if (idProp != null) {
|
|
159
|
-
id = idProp;
|
|
160
|
-
} else if (treeId && nodeId) {
|
|
161
|
-
id = `${treeId}-${nodeId}`;
|
|
162
|
-
}
|
|
163
|
-
const [treeitemElement, setTreeitemElement] = React.useState(null);
|
|
164
|
-
const contentRef = React.useRef(null);
|
|
165
|
-
const handleRef = useForkRef(setTreeitemElement, ref);
|
|
166
|
-
const descendant = React.useMemo(() => ({
|
|
167
|
-
element: treeitemElement,
|
|
168
|
-
id: nodeId
|
|
169
|
-
}), [nodeId, treeitemElement]);
|
|
170
|
-
const {
|
|
171
|
-
index,
|
|
172
|
-
parentId
|
|
173
|
-
} = useDescendant(descendant);
|
|
174
|
-
const expandable = Boolean(Array.isArray(children) ? children.length : children);
|
|
175
|
-
const expanded = isExpanded ? isExpanded(nodeId) : false;
|
|
176
|
-
const focused = isFocused ? isFocused(nodeId) : false;
|
|
177
|
-
const selected = isSelected ? isSelected(nodeId) : false;
|
|
178
|
-
const disabled = isDisabled ? isDisabled(nodeId) : false;
|
|
179
|
-
const ownerState = _extends({}, props, {
|
|
180
|
-
expanded,
|
|
181
|
-
focused,
|
|
182
|
-
selected,
|
|
183
|
-
disabled
|
|
184
|
-
});
|
|
185
|
-
const classes = useUtilityClasses(ownerState);
|
|
186
|
-
let displayIcon;
|
|
187
|
-
let expansionIcon;
|
|
188
|
-
if (expandable) {
|
|
189
|
-
if (!expanded) {
|
|
190
|
-
expansionIcon = expandIcon || contextIcons.defaultExpandIcon;
|
|
191
|
-
} else {
|
|
192
|
-
expansionIcon = collapseIcon || contextIcons.defaultCollapseIcon;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (expandable) {
|
|
196
|
-
displayIcon = contextIcons.defaultParentIcon;
|
|
197
|
-
} else {
|
|
198
|
-
displayIcon = endIcon || contextIcons.defaultEndIcon;
|
|
6
|
+
let warnedOnce = false;
|
|
7
|
+
const warn = () => {
|
|
8
|
+
if (!warnedOnce) {
|
|
9
|
+
console.warn(['MUI: The TreeItem component was moved from `@mui/lab` to `@mui/x-tree-view`.', 'The component will no longer be exported from `@mui/lab` in the first release of October 2023.', '', "You should use `import { TreeItem } from '@mui/x-tree-view'`", "or `import { TreeItem } from '@mui/x-tree-view/TreeItem'`", '', 'More information about this migration on our blog: https://mui.com/blog/lab-tree-view-to-mui-x/.'].join('\n'));
|
|
10
|
+
warnedOnce = true;
|
|
199
11
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
disabled: disabledProp
|
|
210
|
-
});
|
|
211
|
-
return () => {
|
|
212
|
-
unregisterNode(nodeId);
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
return undefined;
|
|
216
|
-
}, [registerNode, unregisterNode, parentId, index, nodeId, expandable, disabledProp, id]);
|
|
217
|
-
React.useEffect(() => {
|
|
218
|
-
if (mapFirstChar && unMapFirstChar && label) {
|
|
219
|
-
mapFirstChar(nodeId, contentRef.current.textContent.substring(0, 1).toLowerCase());
|
|
220
|
-
return () => {
|
|
221
|
-
unMapFirstChar(nodeId);
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
return undefined;
|
|
225
|
-
}, [mapFirstChar, unMapFirstChar, nodeId, label]);
|
|
226
|
-
let ariaSelected;
|
|
227
|
-
if (multiSelect) {
|
|
228
|
-
ariaSelected = selected;
|
|
229
|
-
} else if (selected) {
|
|
230
|
-
/* single-selection trees unset aria-selected on un-selected items.
|
|
231
|
-
*
|
|
232
|
-
* If the tree does not support multiple selection, aria-selected
|
|
233
|
-
* is set to true for the selected node and it is not present on any other node in the tree.
|
|
234
|
-
* Source: https://www.w3.org/WAI/ARIA/apg/patterns/treeview/
|
|
235
|
-
*/
|
|
236
|
-
ariaSelected = true;
|
|
237
|
-
}
|
|
238
|
-
function handleFocus(event) {
|
|
239
|
-
// DOM focus stays on the tree which manages focus with aria-activedescendant
|
|
240
|
-
if (event.target === event.currentTarget) {
|
|
241
|
-
let rootElement;
|
|
242
|
-
if (typeof event.target.getRootNode === 'function') {
|
|
243
|
-
rootElement = event.target.getRootNode();
|
|
244
|
-
} else {
|
|
245
|
-
rootElement = ownerDocument(event.target);
|
|
246
|
-
}
|
|
247
|
-
rootElement.getElementById(treeId).focus({
|
|
248
|
-
preventScroll: true
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
const unfocusable = !disabledItemsFocusable && disabled;
|
|
252
|
-
if (!focused && event.currentTarget === event.target && !unfocusable) {
|
|
253
|
-
focus(event, nodeId);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return /*#__PURE__*/_jsxs(TreeItemRoot, _extends({
|
|
257
|
-
className: clsx(classes.root, className),
|
|
258
|
-
role: "treeitem",
|
|
259
|
-
"aria-expanded": expandable ? expanded : null,
|
|
260
|
-
"aria-selected": ariaSelected,
|
|
261
|
-
"aria-disabled": disabled || null,
|
|
262
|
-
ref: handleRef,
|
|
263
|
-
id: id,
|
|
264
|
-
tabIndex: -1
|
|
265
|
-
}, other, {
|
|
266
|
-
ownerState: ownerState,
|
|
267
|
-
onFocus: handleFocus,
|
|
268
|
-
children: [/*#__PURE__*/_jsx(StyledTreeItemContent, _extends({
|
|
269
|
-
as: ContentComponent,
|
|
270
|
-
ref: contentRef,
|
|
271
|
-
classes: {
|
|
272
|
-
root: classes.content,
|
|
273
|
-
expanded: classes.expanded,
|
|
274
|
-
selected: classes.selected,
|
|
275
|
-
focused: classes.focused,
|
|
276
|
-
disabled: classes.disabled,
|
|
277
|
-
iconContainer: classes.iconContainer,
|
|
278
|
-
label: classes.label
|
|
279
|
-
},
|
|
280
|
-
label: label,
|
|
281
|
-
nodeId: nodeId,
|
|
282
|
-
onClick: onClick,
|
|
283
|
-
onMouseDown: onMouseDown,
|
|
284
|
-
icon: icon,
|
|
285
|
-
expansionIcon: expansionIcon,
|
|
286
|
-
displayIcon: displayIcon,
|
|
287
|
-
ownerState: ownerState
|
|
288
|
-
}, ContentProps)), children && /*#__PURE__*/_jsx(DescendantProvider, {
|
|
289
|
-
id: nodeId,
|
|
290
|
-
children: /*#__PURE__*/_jsx(TreeItemGroup, _extends({
|
|
291
|
-
as: TransitionComponent,
|
|
292
|
-
unmountOnExit: true,
|
|
293
|
-
className: classes.group,
|
|
294
|
-
in: expanded,
|
|
295
|
-
component: "ul",
|
|
296
|
-
role: "group"
|
|
297
|
-
}, TransitionProps, {
|
|
298
|
-
children: children
|
|
299
|
-
}))
|
|
300
|
-
})]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ignore - do not document.
|
|
16
|
+
*/
|
|
17
|
+
const TreeItem = /*#__PURE__*/React.forwardRef(function DeprecatedTreeItem(props, ref) {
|
|
18
|
+
warn();
|
|
19
|
+
return /*#__PURE__*/_jsx(XTreeItem, _extends({}, props, {
|
|
20
|
+
ref: ref
|
|
301
21
|
}));
|
|
302
22
|
});
|
|
303
23
|
process.env.NODE_ENV !== "production" ? TreeItem.propTypes /* remove-proptypes */ = {
|
|
304
24
|
// ----------------------------- Warning --------------------------------
|
|
305
25
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
306
|
-
// | To update them edit
|
|
26
|
+
// | To update them edit TypeScript types and run "yarn proptypes" |
|
|
307
27
|
// ----------------------------------------------------------------------
|
|
308
28
|
/**
|
|
309
29
|
* The content of the component.
|
|
310
30
|
*/
|
|
311
|
-
children: PropTypes.node
|
|
312
|
-
/**
|
|
313
|
-
* Override or extend the styles applied to the component.
|
|
314
|
-
*/
|
|
315
|
-
classes: PropTypes.object,
|
|
316
|
-
/**
|
|
317
|
-
* @ignore
|
|
318
|
-
*/
|
|
319
|
-
className: PropTypes.string,
|
|
320
|
-
/**
|
|
321
|
-
* The icon used to collapse the node.
|
|
322
|
-
*/
|
|
323
|
-
collapseIcon: PropTypes.node,
|
|
324
|
-
/**
|
|
325
|
-
* The component used for the content node.
|
|
326
|
-
* @default TreeItemContent
|
|
327
|
-
*/
|
|
328
|
-
ContentComponent: elementTypeAcceptingRef,
|
|
329
|
-
/**
|
|
330
|
-
* Props applied to ContentComponent
|
|
331
|
-
*/
|
|
332
|
-
ContentProps: PropTypes.object,
|
|
333
|
-
/**
|
|
334
|
-
* If `true`, the node is disabled.
|
|
335
|
-
* @default false
|
|
336
|
-
*/
|
|
337
|
-
disabled: PropTypes.bool,
|
|
338
|
-
/**
|
|
339
|
-
* The icon displayed next to a end node.
|
|
340
|
-
*/
|
|
341
|
-
endIcon: PropTypes.node,
|
|
342
|
-
/**
|
|
343
|
-
* The icon used to expand the node.
|
|
344
|
-
*/
|
|
345
|
-
expandIcon: PropTypes.node,
|
|
346
|
-
/**
|
|
347
|
-
* The icon to display next to the tree node's label.
|
|
348
|
-
*/
|
|
349
|
-
icon: PropTypes.node,
|
|
350
|
-
/**
|
|
351
|
-
* @ignore
|
|
352
|
-
*/
|
|
353
|
-
id: PropTypes.string,
|
|
354
|
-
/**
|
|
355
|
-
* The tree node label.
|
|
356
|
-
*/
|
|
357
|
-
label: PropTypes.node,
|
|
358
|
-
/**
|
|
359
|
-
* The id of the node.
|
|
360
|
-
*/
|
|
361
|
-
nodeId: PropTypes.string.isRequired,
|
|
362
|
-
/**
|
|
363
|
-
* @ignore
|
|
364
|
-
*/
|
|
365
|
-
onClick: PropTypes.func,
|
|
366
|
-
/**
|
|
367
|
-
* This prop isn't supported.
|
|
368
|
-
* Use the `onNodeFocus` callback on the tree if you need to monitor a node's focus.
|
|
369
|
-
*/
|
|
370
|
-
onFocus: unsupportedProp,
|
|
371
|
-
/**
|
|
372
|
-
* @ignore
|
|
373
|
-
*/
|
|
374
|
-
onMouseDown: PropTypes.func,
|
|
375
|
-
/**
|
|
376
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
377
|
-
*/
|
|
378
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
379
|
-
/**
|
|
380
|
-
* The component used for the transition.
|
|
381
|
-
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
382
|
-
* @default Collapse
|
|
383
|
-
*/
|
|
384
|
-
TransitionComponent: PropTypes.elementType,
|
|
385
|
-
/**
|
|
386
|
-
* Props applied to the transition element.
|
|
387
|
-
* By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component.
|
|
388
|
-
*/
|
|
389
|
-
TransitionProps: PropTypes.object
|
|
31
|
+
children: PropTypes.node
|
|
390
32
|
} : void 0;
|
|
391
33
|
export default TreeItem;
|
package/TreeItem/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
export { default } from './TreeItem';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { default as useTreeItem } from './useTreeItem';
|
|
5
|
-
|
|
6
|
-
export { default as treeItemClasses } from './treeItemClasses';
|
|
7
|
-
export * from './treeItemClasses';
|
|
2
|
+
export { getTreeItemUtilityClass, treeItemClasses, useTreeItem } from '@mui/x-tree-view/TreeItem';
|
|
3
|
+
export type { TreeItemProps, TreeItemClasses, TreeItemClassKey, TreeItemContentProps, } from '@mui/x-tree-view/TreeItem';
|
package/TreeItem/index.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
export { default } from './TreeItem';
|
|
2
|
-
export {
|
|
3
|
-
export { default as treeItemClasses } from './treeItemClasses';
|
|
4
|
-
export * from './treeItemClasses';
|
|
2
|
+
export { getTreeItemUtilityClass, treeItemClasses, useTreeItem } from '@mui/x-tree-view/TreeItem';
|
package/TreeView/TreeView.d.ts
CHANGED
|
@@ -1,144 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { InternalStandardProps as StandardProps } from '@mui/material';
|
|
3
|
-
import { Theme } from '@mui/material/styles';
|
|
4
|
-
import { SxProps } from '@mui/system';
|
|
5
|
-
import { TreeViewClasses } from './treeViewClasses';
|
|
6
|
-
|
|
7
|
-
export interface TreeViewPropsBase extends StandardProps<React.HTMLAttributes<HTMLUListElement>> {
|
|
8
|
-
/**
|
|
9
|
-
* The content of the component.
|
|
10
|
-
*/
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* Override or extend the styles applied to the component.
|
|
14
|
-
*/
|
|
15
|
-
classes?: Partial<TreeViewClasses>;
|
|
16
|
-
/**
|
|
17
|
-
* The default icon used to collapse the node.
|
|
18
|
-
*/
|
|
19
|
-
defaultCollapseIcon?: React.ReactNode;
|
|
20
|
-
/**
|
|
21
|
-
* The default icon displayed next to a end node. This is applied to all
|
|
22
|
-
* tree nodes and can be overridden by the TreeItem `icon` prop.
|
|
23
|
-
*/
|
|
24
|
-
defaultEndIcon?: React.ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
* Expanded node ids. (Uncontrolled)
|
|
27
|
-
* @default []
|
|
28
|
-
*/
|
|
29
|
-
defaultExpanded?: string[];
|
|
30
|
-
/**
|
|
31
|
-
* The default icon used to expand the node.
|
|
32
|
-
*/
|
|
33
|
-
defaultExpandIcon?: React.ReactNode;
|
|
34
|
-
/**
|
|
35
|
-
* The default icon displayed next to a parent node. This is applied to all
|
|
36
|
-
* parent nodes and can be overridden by the TreeItem `icon` prop.
|
|
37
|
-
*/
|
|
38
|
-
defaultParentIcon?: React.ReactNode;
|
|
39
|
-
/**
|
|
40
|
-
* If `true`, will allow focus on disabled items.
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
disabledItemsFocusable?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* If `true` selection is disabled.
|
|
46
|
-
* @default false
|
|
47
|
-
*/
|
|
48
|
-
disableSelection?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Expanded node ids. (Controlled)
|
|
51
|
-
*/
|
|
52
|
-
expanded?: string[];
|
|
53
|
-
/**
|
|
54
|
-
* This prop is used to help implement the accessibility logic.
|
|
55
|
-
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
56
|
-
*/
|
|
57
|
-
id?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Callback fired when tree items are focused.
|
|
60
|
-
*
|
|
61
|
-
* @param {React.SyntheticEvent} event The event source of the callback **Warning**: This is a generic event not a focus event.
|
|
62
|
-
* @param {string} value of the focused node.
|
|
63
|
-
*/
|
|
64
|
-
onNodeFocus?: (event: React.SyntheticEvent, nodeId: string) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Callback fired when tree items are expanded/collapsed.
|
|
67
|
-
*
|
|
68
|
-
* @param {React.SyntheticEvent} event The event source of the callback.
|
|
69
|
-
* @param {array} nodeIds The ids of the expanded nodes.
|
|
70
|
-
*/
|
|
71
|
-
onNodeToggle?: (event: React.SyntheticEvent, nodeIds: string[]) => void;
|
|
72
|
-
/**
|
|
73
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
74
|
-
*/
|
|
75
|
-
sx?: SxProps<Theme>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface MultiSelectTreeViewProps extends TreeViewPropsBase {
|
|
79
|
-
/**
|
|
80
|
-
* Selected node ids. (Uncontrolled)
|
|
81
|
-
* When `multiSelect` is true this takes an array of strings; when false (default) a string.
|
|
82
|
-
* @default []
|
|
83
|
-
*/
|
|
84
|
-
defaultSelected?: string[];
|
|
85
|
-
/**
|
|
86
|
-
* Selected node ids. (Controlled)
|
|
87
|
-
* When `multiSelect` is true this takes an array of strings; when false (default) a string.
|
|
88
|
-
*/
|
|
89
|
-
selected?: string[];
|
|
90
|
-
/**
|
|
91
|
-
* If true `ctrl` and `shift` will trigger multiselect.
|
|
92
|
-
* @default false
|
|
93
|
-
*/
|
|
94
|
-
multiSelect?: true;
|
|
95
|
-
/**
|
|
96
|
-
* Callback fired when tree items are selected/unselected.
|
|
97
|
-
*
|
|
98
|
-
* @param {React.SyntheticEvent} event The event source of the callback
|
|
99
|
-
* @param {string[] | string} nodeIds Ids of the selected nodes. When `multiSelect` is true
|
|
100
|
-
* this is an array of strings; when false (default) a string.
|
|
101
|
-
*/
|
|
102
|
-
onNodeSelect?: (event: React.SyntheticEvent, nodeIds: string[]) => void;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface SingleSelectTreeViewProps extends TreeViewPropsBase {
|
|
106
|
-
/**
|
|
107
|
-
* Selected node ids. (Uncontrolled)
|
|
108
|
-
* When `multiSelect` is true this takes an array of strings; when false (default) a string.
|
|
109
|
-
* @default []
|
|
110
|
-
*/
|
|
111
|
-
defaultSelected?: string;
|
|
112
|
-
/**
|
|
113
|
-
* Selected node ids. (Controlled)
|
|
114
|
-
* When `multiSelect` is true this takes an array of strings; when false (default) a string.
|
|
115
|
-
*/
|
|
116
|
-
selected?: string;
|
|
117
|
-
/**
|
|
118
|
-
* If true `ctrl` and `shift` will trigger multiselect.
|
|
119
|
-
* @default false
|
|
120
|
-
*/
|
|
121
|
-
multiSelect?: false;
|
|
122
|
-
/**
|
|
123
|
-
* Callback fired when tree items are selected/unselected.
|
|
124
|
-
*
|
|
125
|
-
* @param {React.SyntheticEvent} event The event source of the callback
|
|
126
|
-
* @param {string[] | string} nodeIds Ids of the selected nodes. When `multiSelect` is true
|
|
127
|
-
* this is an array of strings; when false (default) a string.
|
|
128
|
-
*/
|
|
129
|
-
onNodeSelect?: (event: React.SyntheticEvent, nodeIds: string) => void;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export type TreeViewProps = SingleSelectTreeViewProps | MultiSelectTreeViewProps;
|
|
133
|
-
|
|
134
2
|
/**
|
|
135
|
-
*
|
|
136
|
-
* Demos:
|
|
137
|
-
*
|
|
138
|
-
* - [Tree View](https://mui.com/material-ui/react-tree-view/)
|
|
139
|
-
*
|
|
140
|
-
* API:
|
|
141
|
-
*
|
|
142
|
-
* - [TreeView API](https://mui.com/material-ui/api/tree-view/)
|
|
3
|
+
* @ignore - do not document.
|
|
143
4
|
*/
|
|
144
|
-
|
|
5
|
+
declare const TreeView: React.ForwardRefExoticComponent<(Omit<import("@mui/x-tree-view/TreeView").SingleSelectTreeViewProps, "ref"> | Omit<import("@mui/x-tree-view/TreeView").MultiSelectTreeViewProps, "ref">) & React.RefAttributes<HTMLUListElement>>;
|
|
6
|
+
export default TreeView;
|