@mui/material 5.16.13 → 5.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Autocomplete/Autocomplete.js +49 -58
- package/CHANGELOG.md +27 -0
- package/TextareaAutosize/TextareaAutosize.js +66 -45
- package/index.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +51 -62
- package/legacy/TextareaAutosize/TextareaAutosize.js +66 -45
- package/legacy/index.js +1 -1
- package/legacy/styles/ThemeProvider.js +13 -1
- package/legacy/styles/createTheme.js +4 -1
- package/legacy/version/index.js +3 -3
- package/modern/Autocomplete/Autocomplete.js +49 -58
- package/modern/TextareaAutosize/TextareaAutosize.js +66 -45
- package/modern/index.js +1 -1
- package/modern/styles/ThemeProvider.js +13 -1
- package/modern/styles/createTheme.js +4 -1
- package/modern/version/index.js +3 -3
- package/node/Autocomplete/Autocomplete.js +49 -58
- package/node/TextareaAutosize/TextareaAutosize.js +65 -44
- package/node/index.js +1 -1
- package/node/styles/ThemeProvider.js +13 -1
- package/node/styles/createTheme.js +4 -1
- package/node/version/index.js +3 -3
- package/package.json +5 -5
- package/styles/ThemeProvider.js +13 -1
- package/styles/createTheme.js +4 -1
- package/umd/material-ui.development.js +136 -105
- package/umd/material-ui.production.min.js +2 -2
- package/version/index.js +3 -3
|
@@ -11,9 +11,21 @@ export default function ThemeProvider(_ref) {
|
|
|
11
11
|
var themeInput = _ref.theme,
|
|
12
12
|
props = _objectWithoutProperties(_ref, ["theme"]);
|
|
13
13
|
var scopedTheme = themeInput[THEME_ID];
|
|
14
|
+
var finalTheme = scopedTheme || themeInput;
|
|
15
|
+
if (typeof themeInput !== 'function') {
|
|
16
|
+
if (scopedTheme && !scopedTheme.vars) {
|
|
17
|
+
finalTheme = _extends({}, scopedTheme, {
|
|
18
|
+
vars: null
|
|
19
|
+
});
|
|
20
|
+
} else if (themeInput && !themeInput.vars) {
|
|
21
|
+
finalTheme = _extends({}, themeInput, {
|
|
22
|
+
vars: null
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
14
26
|
return /*#__PURE__*/_jsx(SystemThemeProvider, _extends({}, props, {
|
|
15
27
|
themeId: scopedTheme ? THEME_ID : undefined,
|
|
16
|
-
theme:
|
|
28
|
+
theme: finalTheme
|
|
17
29
|
}));
|
|
18
30
|
}
|
|
19
31
|
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
@@ -26,7 +26,10 @@ function createTheme() {
|
|
|
26
26
|
typographyInput = _options$typography === void 0 ? {} : _options$typography,
|
|
27
27
|
shapeInput = options.shape,
|
|
28
28
|
other = _objectWithoutProperties(options, ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"]);
|
|
29
|
-
if (options.vars
|
|
29
|
+
if (options.vars &&
|
|
30
|
+
// The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
|
|
31
|
+
// `generateCssVars` is the closest identifier for checking that the `options` is a result of `extendTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
|
|
32
|
+
options.generateCssVars === undefined) {
|
|
30
33
|
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: `vars` is a private field used for CSS variables support.\nPlease use another name." : _formatMuiErrorMessage(18));
|
|
31
34
|
}
|
|
32
35
|
var palette = createPalette(paletteInput);
|
package/legacy/version/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export var version = "5.
|
|
1
|
+
export var version = "5.17.0";
|
|
2
2
|
export var major = Number("5");
|
|
3
|
-
export var minor = Number("
|
|
4
|
-
export var patch = Number("
|
|
3
|
+
export var minor = Number("17");
|
|
4
|
+
export var patch = Number("0");
|
|
5
5
|
export var preReleaseLabel = undefined || null;
|
|
6
6
|
export var preReleaseNumber = Number(undefined) || null;
|
|
7
7
|
export default version;
|
|
@@ -596,63 +596,6 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
596
596
|
const paperSlotProps = slotProps.paper ?? componentsProps.paper;
|
|
597
597
|
const popperSlotProps = slotProps.popper ?? componentsProps.popper;
|
|
598
598
|
const popupIndicatorSlotProps = slotProps.popupIndicator ?? componentsProps.popupIndicator;
|
|
599
|
-
const renderAutocompletePopperChildren = children => /*#__PURE__*/_jsx(AutocompletePopper, _extends({
|
|
600
|
-
as: PopperComponent,
|
|
601
|
-
disablePortal: disablePortal,
|
|
602
|
-
style: {
|
|
603
|
-
width: anchorEl ? anchorEl.clientWidth : null
|
|
604
|
-
},
|
|
605
|
-
ownerState: ownerState,
|
|
606
|
-
role: "presentation",
|
|
607
|
-
anchorEl: anchorEl,
|
|
608
|
-
open: popupOpen
|
|
609
|
-
}, popperSlotProps, {
|
|
610
|
-
className: clsx(classes.popper, popperSlotProps?.className),
|
|
611
|
-
children: /*#__PURE__*/_jsx(AutocompletePaper, _extends({
|
|
612
|
-
ownerState: ownerState,
|
|
613
|
-
as: PaperComponent
|
|
614
|
-
}, paperSlotProps, {
|
|
615
|
-
className: clsx(classes.paper, paperSlotProps?.className),
|
|
616
|
-
children: children
|
|
617
|
-
}))
|
|
618
|
-
}));
|
|
619
|
-
let autocompletePopper = null;
|
|
620
|
-
if (groupedOptions.length > 0) {
|
|
621
|
-
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteListbox, _extends({
|
|
622
|
-
as: ListboxComponent,
|
|
623
|
-
className: classes.listbox,
|
|
624
|
-
ownerState: ownerState
|
|
625
|
-
}, otherListboxProps, ListboxProps, {
|
|
626
|
-
ref: combinedListboxRef,
|
|
627
|
-
children: groupedOptions.map((option, index) => {
|
|
628
|
-
if (groupBy) {
|
|
629
|
-
return renderGroup({
|
|
630
|
-
key: option.key,
|
|
631
|
-
group: option.group,
|
|
632
|
-
children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
return renderListOption(option, index);
|
|
636
|
-
})
|
|
637
|
-
})));
|
|
638
|
-
} else if (loading && groupedOptions.length === 0) {
|
|
639
|
-
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
640
|
-
className: classes.loading,
|
|
641
|
-
ownerState: ownerState,
|
|
642
|
-
children: loadingText
|
|
643
|
-
}));
|
|
644
|
-
} else if (groupedOptions.length === 0 && !freeSolo && !loading) {
|
|
645
|
-
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/_jsx(AutocompleteNoOptions, {
|
|
646
|
-
className: classes.noOptions,
|
|
647
|
-
ownerState: ownerState,
|
|
648
|
-
role: "presentation",
|
|
649
|
-
onMouseDown: event => {
|
|
650
|
-
// Prevent input blur when interacting with the "no options" content
|
|
651
|
-
event.preventDefault();
|
|
652
|
-
},
|
|
653
|
-
children: noOptionsText
|
|
654
|
-
}));
|
|
655
|
-
}
|
|
656
599
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
657
600
|
children: [/*#__PURE__*/_jsx(AutocompleteRoot, _extends({
|
|
658
601
|
ref: ref,
|
|
@@ -702,7 +645,55 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
702
645
|
readOnly
|
|
703
646
|
}, getInputProps())
|
|
704
647
|
})
|
|
705
|
-
})), anchorEl ?
|
|
648
|
+
})), anchorEl ? /*#__PURE__*/_jsx(AutocompletePopper, _extends({
|
|
649
|
+
as: PopperComponent,
|
|
650
|
+
disablePortal: disablePortal,
|
|
651
|
+
style: {
|
|
652
|
+
width: anchorEl ? anchorEl.clientWidth : null
|
|
653
|
+
},
|
|
654
|
+
ownerState: ownerState,
|
|
655
|
+
role: "presentation",
|
|
656
|
+
anchorEl: anchorEl,
|
|
657
|
+
open: popupOpen
|
|
658
|
+
}, popperSlotProps, {
|
|
659
|
+
className: clsx(classes.popper, popperSlotProps?.className),
|
|
660
|
+
children: /*#__PURE__*/_jsxs(AutocompletePaper, _extends({
|
|
661
|
+
ownerState: ownerState,
|
|
662
|
+
as: PaperComponent
|
|
663
|
+
}, paperSlotProps, {
|
|
664
|
+
className: clsx(classes.paper, paperSlotProps?.className),
|
|
665
|
+
children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
666
|
+
className: classes.loading,
|
|
667
|
+
ownerState: ownerState,
|
|
668
|
+
children: loadingText
|
|
669
|
+
}) : null, groupedOptions.length === 0 && !freeSolo && !loading ? /*#__PURE__*/_jsx(AutocompleteNoOptions, {
|
|
670
|
+
className: classes.noOptions,
|
|
671
|
+
ownerState: ownerState,
|
|
672
|
+
role: "presentation",
|
|
673
|
+
onMouseDown: event => {
|
|
674
|
+
// Prevent input blur when interacting with the "no options" content
|
|
675
|
+
event.preventDefault();
|
|
676
|
+
},
|
|
677
|
+
children: noOptionsText
|
|
678
|
+
}) : null, groupedOptions.length > 0 ? /*#__PURE__*/_jsx(AutocompleteListbox, _extends({
|
|
679
|
+
as: ListboxComponent,
|
|
680
|
+
className: classes.listbox,
|
|
681
|
+
ownerState: ownerState
|
|
682
|
+
}, otherListboxProps, ListboxProps, {
|
|
683
|
+
ref: combinedListboxRef,
|
|
684
|
+
children: groupedOptions.map((option, index) => {
|
|
685
|
+
if (groupBy) {
|
|
686
|
+
return renderGroup({
|
|
687
|
+
key: option.key,
|
|
688
|
+
group: option.group,
|
|
689
|
+
children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
return renderListOption(option, index);
|
|
693
|
+
})
|
|
694
|
+
})) : null]
|
|
695
|
+
}))
|
|
696
|
+
})) : null]
|
|
706
697
|
});
|
|
707
698
|
});
|
|
708
699
|
process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptypes */ = {
|
|
@@ -5,7 +5,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["onChange", "maxRows", "minRows", "style", "value"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { unstable_debounce as debounce, unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect, unstable_ownerWindow as ownerWindow } from '@mui/utils';
|
|
8
|
+
import { unstable_debounce as debounce, unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback, unstable_ownerWindow as ownerWindow } from '@mui/utils';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
function getStyleValue(value) {
|
|
@@ -26,8 +26,15 @@ const styles = {
|
|
|
26
26
|
transform: 'translateZ(0)'
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
+
function isObjectEmpty(object) {
|
|
30
|
+
// eslint-disable-next-line
|
|
31
|
+
for (const _ in object) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
29
36
|
function isEmpty(obj) {
|
|
30
|
-
return
|
|
37
|
+
return isObjectEmpty(obj) || obj.outerHeightStyle === 0 && !obj.overflowing;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
/**
|
|
@@ -52,14 +59,18 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
52
59
|
const {
|
|
53
60
|
current: isControlled
|
|
54
61
|
} = React.useRef(value != null);
|
|
55
|
-
const
|
|
56
|
-
const handleRef = useForkRef(forwardedRef,
|
|
62
|
+
const textareaRef = React.useRef(null);
|
|
63
|
+
const handleRef = useForkRef(forwardedRef, textareaRef);
|
|
57
64
|
const heightRef = React.useRef(null);
|
|
58
|
-
const
|
|
65
|
+
const hiddenTextareaRef = React.useRef(null);
|
|
59
66
|
const calculateTextareaStyles = React.useCallback(() => {
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
67
|
+
const textarea = textareaRef.current;
|
|
68
|
+
const hiddenTextarea = hiddenTextareaRef.current;
|
|
69
|
+
if (!textarea || !hiddenTextarea) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
const containerWindow = ownerWindow(textarea);
|
|
73
|
+
const computedStyle = containerWindow.getComputedStyle(textarea);
|
|
63
74
|
|
|
64
75
|
// If input's width is shrunk and it's not visible, don't sync height.
|
|
65
76
|
if (computedStyle.width === '0px') {
|
|
@@ -68,25 +79,24 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
68
79
|
overflowing: false
|
|
69
80
|
};
|
|
70
81
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (inputShallow.value.slice(-1) === '\n') {
|
|
82
|
+
hiddenTextarea.style.width = computedStyle.width;
|
|
83
|
+
hiddenTextarea.value = textarea.value || props.placeholder || 'x';
|
|
84
|
+
if (hiddenTextarea.value.slice(-1) === '\n') {
|
|
75
85
|
// Certain fonts which overflow the line height will cause the textarea
|
|
76
86
|
// to report a different scrollHeight depending on whether the last line
|
|
77
87
|
// is empty. Make it non-empty to avoid this issue.
|
|
78
|
-
|
|
88
|
+
hiddenTextarea.value += ' ';
|
|
79
89
|
}
|
|
80
90
|
const boxSizing = computedStyle.boxSizing;
|
|
81
91
|
const padding = getStyleValue(computedStyle.paddingBottom) + getStyleValue(computedStyle.paddingTop);
|
|
82
92
|
const border = getStyleValue(computedStyle.borderBottomWidth) + getStyleValue(computedStyle.borderTopWidth);
|
|
83
93
|
|
|
84
94
|
// The height of the inner content
|
|
85
|
-
const innerHeight =
|
|
95
|
+
const innerHeight = hiddenTextarea.scrollHeight;
|
|
86
96
|
|
|
87
97
|
// Measure height of a textarea with a single row
|
|
88
|
-
|
|
89
|
-
const singleRowHeight =
|
|
98
|
+
hiddenTextarea.value = 'x';
|
|
99
|
+
const singleRowHeight = hiddenTextarea.scrollHeight;
|
|
90
100
|
|
|
91
101
|
// The height of the outer content
|
|
92
102
|
let outerHeight = innerHeight;
|
|
@@ -106,52 +116,63 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
106
116
|
overflowing
|
|
107
117
|
};
|
|
108
118
|
}, [maxRows, minRows, props.placeholder]);
|
|
119
|
+
const didHeightChange = useEventCallback(() => {
|
|
120
|
+
const textarea = textareaRef.current;
|
|
121
|
+
const textareaStyles = calculateTextareaStyles();
|
|
122
|
+
if (!textarea || !textareaStyles || isEmpty(textareaStyles)) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
const outerHeightStyle = textareaStyles.outerHeightStyle;
|
|
126
|
+
return heightRef.current != null && heightRef.current !== outerHeightStyle;
|
|
127
|
+
});
|
|
109
128
|
const syncHeight = React.useCallback(() => {
|
|
129
|
+
const textarea = textareaRef.current;
|
|
110
130
|
const textareaStyles = calculateTextareaStyles();
|
|
111
|
-
if (isEmpty(textareaStyles)) {
|
|
131
|
+
if (!textarea || !textareaStyles || isEmpty(textareaStyles)) {
|
|
112
132
|
return;
|
|
113
133
|
}
|
|
114
134
|
const outerHeightStyle = textareaStyles.outerHeightStyle;
|
|
115
|
-
const input = inputRef.current;
|
|
116
135
|
if (heightRef.current !== outerHeightStyle) {
|
|
117
136
|
heightRef.current = outerHeightStyle;
|
|
118
|
-
|
|
137
|
+
textarea.style.height = `${outerHeightStyle}px`;
|
|
119
138
|
}
|
|
120
|
-
|
|
139
|
+
textarea.style.overflow = textareaStyles.overflowing ? 'hidden' : '';
|
|
121
140
|
}, [calculateTextareaStyles]);
|
|
141
|
+
const frameRef = React.useRef(-1);
|
|
122
142
|
useEnhancedEffect(() => {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let rAF;
|
|
131
|
-
const rAFHandleResize = () => {
|
|
132
|
-
cancelAnimationFrame(rAF);
|
|
133
|
-
rAF = requestAnimationFrame(() => {
|
|
134
|
-
handleResize();
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
const debounceHandleResize = debounce(handleResize);
|
|
138
|
-
const input = inputRef.current;
|
|
139
|
-
const containerWindow = ownerWindow(input);
|
|
140
|
-
containerWindow.addEventListener('resize', debounceHandleResize);
|
|
143
|
+
const debouncedHandleResize = debounce(syncHeight);
|
|
144
|
+
const textarea = textareaRef?.current;
|
|
145
|
+
if (!textarea) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
const containerWindow = ownerWindow(textarea);
|
|
149
|
+
containerWindow.addEventListener('resize', debouncedHandleResize);
|
|
141
150
|
let resizeObserver;
|
|
142
151
|
if (typeof ResizeObserver !== 'undefined') {
|
|
143
|
-
resizeObserver = new ResizeObserver(
|
|
144
|
-
|
|
152
|
+
resizeObserver = new ResizeObserver(() => {
|
|
153
|
+
if (didHeightChange()) {
|
|
154
|
+
// avoid "ResizeObserver loop completed with undelivered notifications" error
|
|
155
|
+
// by temporarily unobserving the textarea element while manipulating the height
|
|
156
|
+
// and reobserving one frame later
|
|
157
|
+
resizeObserver.unobserve(textarea);
|
|
158
|
+
cancelAnimationFrame(frameRef.current);
|
|
159
|
+
syncHeight();
|
|
160
|
+
frameRef.current = requestAnimationFrame(() => {
|
|
161
|
+
resizeObserver.observe(textarea);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
resizeObserver.observe(textarea);
|
|
145
166
|
}
|
|
146
167
|
return () => {
|
|
147
|
-
|
|
148
|
-
cancelAnimationFrame(
|
|
149
|
-
containerWindow.removeEventListener('resize',
|
|
168
|
+
debouncedHandleResize.clear();
|
|
169
|
+
cancelAnimationFrame(frameRef.current);
|
|
170
|
+
containerWindow.removeEventListener('resize', debouncedHandleResize);
|
|
150
171
|
if (resizeObserver) {
|
|
151
172
|
resizeObserver.disconnect();
|
|
152
173
|
}
|
|
153
174
|
};
|
|
154
|
-
}, [calculateTextareaStyles, syncHeight]);
|
|
175
|
+
}, [calculateTextareaStyles, syncHeight, didHeightChange]);
|
|
155
176
|
useEnhancedEffect(() => {
|
|
156
177
|
syncHeight();
|
|
157
178
|
});
|
|
@@ -176,7 +197,7 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
176
197
|
"aria-hidden": true,
|
|
177
198
|
className: props.className,
|
|
178
199
|
readOnly: true,
|
|
179
|
-
ref:
|
|
200
|
+
ref: hiddenTextareaRef,
|
|
180
201
|
tabIndex: -1,
|
|
181
202
|
style: _extends({}, styles.shadow, style, {
|
|
182
203
|
paddingTop: 0,
|
package/modern/index.js
CHANGED
|
@@ -14,9 +14,21 @@ export default function ThemeProvider(_ref) {
|
|
|
14
14
|
} = _ref,
|
|
15
15
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16
16
|
const scopedTheme = themeInput[THEME_ID];
|
|
17
|
+
let finalTheme = scopedTheme || themeInput;
|
|
18
|
+
if (typeof themeInput !== 'function') {
|
|
19
|
+
if (scopedTheme && !scopedTheme.vars) {
|
|
20
|
+
finalTheme = _extends({}, scopedTheme, {
|
|
21
|
+
vars: null
|
|
22
|
+
});
|
|
23
|
+
} else if (themeInput && !themeInput.vars) {
|
|
24
|
+
finalTheme = _extends({}, themeInput, {
|
|
25
|
+
vars: null
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
17
29
|
return /*#__PURE__*/_jsx(SystemThemeProvider, _extends({}, props, {
|
|
18
30
|
themeId: scopedTheme ? THEME_ID : undefined,
|
|
19
|
-
theme:
|
|
31
|
+
theme: finalTheme
|
|
20
32
|
}));
|
|
21
33
|
}
|
|
22
34
|
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = {
|
|
@@ -20,7 +20,10 @@ function createTheme(options = {}, ...args) {
|
|
|
20
20
|
typography: typographyInput = {}
|
|
21
21
|
} = options,
|
|
22
22
|
other = _objectWithoutPropertiesLoose(options, _excluded);
|
|
23
|
-
if (options.vars
|
|
23
|
+
if (options.vars &&
|
|
24
|
+
// The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
|
|
25
|
+
// `generateCssVars` is the closest identifier for checking that the `options` is a result of `extendTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
|
|
26
|
+
options.generateCssVars === undefined) {
|
|
24
27
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`vars\` is a private field used for CSS variables support.
|
|
25
28
|
Please use another name.` : _formatMuiErrorMessage(18));
|
|
26
29
|
}
|
package/modern/version/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export const version = "5.
|
|
1
|
+
export const version = "5.17.0";
|
|
2
2
|
export const major = Number("5");
|
|
3
|
-
export const minor = Number("
|
|
4
|
-
export const patch = Number("
|
|
3
|
+
export const minor = Number("17");
|
|
4
|
+
export const patch = Number("0");
|
|
5
5
|
export const preReleaseLabel = undefined || null;
|
|
6
6
|
export const preReleaseNumber = Number(undefined) || null;
|
|
7
7
|
export default version;
|
|
@@ -612,63 +612,6 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
612
612
|
const paperSlotProps = (_slotProps$paper = slotProps.paper) != null ? _slotProps$paper : componentsProps.paper;
|
|
613
613
|
const popperSlotProps = (_slotProps$popper = slotProps.popper) != null ? _slotProps$popper : componentsProps.popper;
|
|
614
614
|
const popupIndicatorSlotProps = (_slotProps$popupIndic = slotProps.popupIndicator) != null ? _slotProps$popupIndic : componentsProps.popupIndicator;
|
|
615
|
-
const renderAutocompletePopperChildren = children => /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePopper, (0, _extends2.default)({
|
|
616
|
-
as: PopperComponent,
|
|
617
|
-
disablePortal: disablePortal,
|
|
618
|
-
style: {
|
|
619
|
-
width: anchorEl ? anchorEl.clientWidth : null
|
|
620
|
-
},
|
|
621
|
-
ownerState: ownerState,
|
|
622
|
-
role: "presentation",
|
|
623
|
-
anchorEl: anchorEl,
|
|
624
|
-
open: popupOpen
|
|
625
|
-
}, popperSlotProps, {
|
|
626
|
-
className: (0, _clsx.default)(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
|
|
627
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePaper, (0, _extends2.default)({
|
|
628
|
-
ownerState: ownerState,
|
|
629
|
-
as: PaperComponent
|
|
630
|
-
}, paperSlotProps, {
|
|
631
|
-
className: (0, _clsx.default)(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
|
|
632
|
-
children: children
|
|
633
|
-
}))
|
|
634
|
-
}));
|
|
635
|
-
let autocompletePopper = null;
|
|
636
|
-
if (groupedOptions.length > 0) {
|
|
637
|
-
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteListbox, (0, _extends2.default)({
|
|
638
|
-
as: ListboxComponent,
|
|
639
|
-
className: classes.listbox,
|
|
640
|
-
ownerState: ownerState
|
|
641
|
-
}, otherListboxProps, ListboxProps, {
|
|
642
|
-
ref: combinedListboxRef,
|
|
643
|
-
children: groupedOptions.map((option, index) => {
|
|
644
|
-
if (groupBy) {
|
|
645
|
-
return renderGroup({
|
|
646
|
-
key: option.key,
|
|
647
|
-
group: option.group,
|
|
648
|
-
children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
return renderListOption(option, index);
|
|
652
|
-
})
|
|
653
|
-
})));
|
|
654
|
-
} else if (loading && groupedOptions.length === 0) {
|
|
655
|
-
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteLoading, {
|
|
656
|
-
className: classes.loading,
|
|
657
|
-
ownerState: ownerState,
|
|
658
|
-
children: loadingText
|
|
659
|
-
}));
|
|
660
|
-
} else if (groupedOptions.length === 0 && !freeSolo && !loading) {
|
|
661
|
-
autocompletePopper = renderAutocompletePopperChildren( /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteNoOptions, {
|
|
662
|
-
className: classes.noOptions,
|
|
663
|
-
ownerState: ownerState,
|
|
664
|
-
role: "presentation",
|
|
665
|
-
onMouseDown: event => {
|
|
666
|
-
// Prevent input blur when interacting with the "no options" content
|
|
667
|
-
event.preventDefault();
|
|
668
|
-
},
|
|
669
|
-
children: noOptionsText
|
|
670
|
-
}));
|
|
671
|
-
}
|
|
672
615
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
673
616
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteRoot, (0, _extends2.default)({
|
|
674
617
|
ref: ref,
|
|
@@ -718,7 +661,55 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
718
661
|
readOnly
|
|
719
662
|
}, getInputProps())
|
|
720
663
|
})
|
|
721
|
-
})), anchorEl ?
|
|
664
|
+
})), anchorEl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompletePopper, (0, _extends2.default)({
|
|
665
|
+
as: PopperComponent,
|
|
666
|
+
disablePortal: disablePortal,
|
|
667
|
+
style: {
|
|
668
|
+
width: anchorEl ? anchorEl.clientWidth : null
|
|
669
|
+
},
|
|
670
|
+
ownerState: ownerState,
|
|
671
|
+
role: "presentation",
|
|
672
|
+
anchorEl: anchorEl,
|
|
673
|
+
open: popupOpen
|
|
674
|
+
}, popperSlotProps, {
|
|
675
|
+
className: (0, _clsx.default)(classes.popper, popperSlotProps == null ? void 0 : popperSlotProps.className),
|
|
676
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(AutocompletePaper, (0, _extends2.default)({
|
|
677
|
+
ownerState: ownerState,
|
|
678
|
+
as: PaperComponent
|
|
679
|
+
}, paperSlotProps, {
|
|
680
|
+
className: (0, _clsx.default)(classes.paper, paperSlotProps == null ? void 0 : paperSlotProps.className),
|
|
681
|
+
children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteLoading, {
|
|
682
|
+
className: classes.loading,
|
|
683
|
+
ownerState: ownerState,
|
|
684
|
+
children: loadingText
|
|
685
|
+
}) : null, groupedOptions.length === 0 && !freeSolo && !loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteNoOptions, {
|
|
686
|
+
className: classes.noOptions,
|
|
687
|
+
ownerState: ownerState,
|
|
688
|
+
role: "presentation",
|
|
689
|
+
onMouseDown: event => {
|
|
690
|
+
// Prevent input blur when interacting with the "no options" content
|
|
691
|
+
event.preventDefault();
|
|
692
|
+
},
|
|
693
|
+
children: noOptionsText
|
|
694
|
+
}) : null, groupedOptions.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteListbox, (0, _extends2.default)({
|
|
695
|
+
as: ListboxComponent,
|
|
696
|
+
className: classes.listbox,
|
|
697
|
+
ownerState: ownerState
|
|
698
|
+
}, otherListboxProps, ListboxProps, {
|
|
699
|
+
ref: combinedListboxRef,
|
|
700
|
+
children: groupedOptions.map((option, index) => {
|
|
701
|
+
if (groupBy) {
|
|
702
|
+
return renderGroup({
|
|
703
|
+
key: option.key,
|
|
704
|
+
group: option.group,
|
|
705
|
+
children: option.options.map((option2, index2) => renderListOption(option2, option.index + index2))
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
return renderListOption(option, index);
|
|
709
|
+
})
|
|
710
|
+
})) : null]
|
|
711
|
+
}))
|
|
712
|
+
})) : null]
|
|
722
713
|
});
|
|
723
714
|
});
|
|
724
715
|
process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptypes */ = {
|