@mui/material 6.4.0 → 6.4.2
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/AppBar/AppBar.d.ts +1 -1
- package/ButtonBase/ButtonBase.d.ts +2 -0
- package/ButtonGroup/ButtonGroupButtonContext.js +2 -0
- package/ButtonGroup/ButtonGroupContext.js +2 -0
- package/CHANGELOG.md +69 -0
- package/Card/Card.d.ts +1 -1
- package/Dialog/Dialog.d.ts +85 -1
- package/Dialog/Dialog.js +91 -20
- package/Dialog/DialogContext.js +2 -0
- package/Drawer/Drawer.js +1 -1
- package/Drawer/drawerClasses.d.ts +32 -8
- package/Drawer/drawerClasses.js +1 -1
- package/FormControl/FormControl.js +9 -7
- package/FormControl/FormControlContext.js +2 -0
- package/Hidden/withWidth.js +2 -0
- package/IconButton/IconButton.d.ts +3 -2
- package/IconButton/IconButton.js +18 -7
- package/IconButton/iconButtonClasses.d.ts +2 -0
- package/IconButton/iconButtonClasses.js +1 -1
- package/OverridableComponent/index.d.ts +41 -0
- package/OverridableComponent/index.js +1 -0
- package/OverridableComponent/package.json +6 -0
- package/PaginationItem/PaginationItem.d.ts +1 -1
- package/RadioGroup/RadioGroupContext.js +2 -0
- package/Slider/useSlider.js +2 -2
- package/Step/StepContext.js +2 -0
- package/Stepper/StepperContext.js +2 -0
- package/Table/Tablelvl2Context.js +2 -0
- package/TextareaAutosize/TextareaAutosize.js +50 -40
- package/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +2 -0
- package/ToggleButtonGroup/ToggleButtonGroupContext.js +2 -0
- package/index.js +1 -1
- package/modern/ButtonGroup/ButtonGroupButtonContext.js +2 -0
- package/modern/ButtonGroup/ButtonGroupContext.js +2 -0
- package/modern/Dialog/Dialog.js +91 -20
- package/modern/Dialog/DialogContext.js +2 -0
- package/modern/Drawer/Drawer.js +1 -1
- package/modern/Drawer/drawerClasses.js +1 -1
- package/modern/FormControl/FormControl.js +9 -7
- package/modern/FormControl/FormControlContext.js +2 -0
- package/modern/Hidden/withWidth.js +2 -0
- package/modern/IconButton/IconButton.js +18 -7
- package/modern/IconButton/iconButtonClasses.js +1 -1
- package/modern/OverridableComponent/index.js +1 -0
- package/modern/RadioGroup/RadioGroupContext.js +2 -0
- package/modern/Slider/useSlider.js +2 -2
- package/modern/Step/StepContext.js +2 -0
- package/modern/Stepper/StepperContext.js +2 -0
- package/modern/Table/Tablelvl2Context.js +2 -0
- package/modern/TextareaAutosize/TextareaAutosize.js +50 -40
- package/modern/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +2 -0
- package/modern/ToggleButtonGroup/ToggleButtonGroupContext.js +2 -0
- package/modern/index.js +1 -1
- package/modern/styles/components.js +1 -0
- package/modern/styles/overrides.js +1 -0
- package/modern/styles/props.js +1 -0
- package/modern/styles/variants.js +1 -0
- package/modern/useAutocomplete/useAutocomplete.js +13 -10
- package/modern/version/index.js +2 -2
- package/node/ButtonGroup/ButtonGroupButtonContext.js +1 -0
- package/node/ButtonGroup/ButtonGroupContext.js +1 -0
- package/node/Dialog/Dialog.js +91 -20
- package/node/Dialog/DialogContext.js +1 -0
- package/node/Drawer/Drawer.js +1 -1
- package/node/Drawer/drawerClasses.js +1 -1
- package/node/FormControl/FormControl.js +9 -7
- package/node/FormControl/FormControlContext.js +1 -0
- package/node/Hidden/withWidth.js +1 -0
- package/node/IconButton/IconButton.js +18 -7
- package/node/IconButton/iconButtonClasses.js +1 -1
- package/node/OverridableComponent/index.js +5 -0
- package/node/RadioGroup/RadioGroupContext.js +1 -0
- package/node/Slider/useSlider.js +2 -2
- package/node/Step/StepContext.js +1 -0
- package/node/Stepper/StepperContext.js +1 -0
- package/node/Table/Tablelvl2Context.js +1 -0
- package/node/TextareaAutosize/TextareaAutosize.js +50 -40
- package/node/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +1 -0
- package/node/ToggleButtonGroup/ToggleButtonGroupContext.js +1 -0
- package/node/index.js +1 -1
- package/node/styles/components.js +5 -0
- package/node/styles/overrides.js +5 -0
- package/node/styles/props.js +5 -0
- package/node/styles/variants.js +5 -0
- package/node/useAutocomplete/useAutocomplete.js +13 -10
- package/node/version/index.js +2 -2
- package/package.json +5 -5
- package/styles/components.d.ts +590 -591
- package/styles/components.js +1 -0
- package/styles/createThemeNoVars.d.ts +1 -1
- package/styles/overrides.d.ts +123 -142
- package/styles/overrides.js +1 -0
- package/styles/props.d.ts +120 -122
- package/styles/props.js +1 -0
- package/styles/variants.d.ts +7 -10
- package/styles/variants.js +1 -0
- package/useAutocomplete/useAutocomplete.js +13 -10
- package/version/index.js +2 -2
- package/OverridableComponent.d.ts +0 -67
|
@@ -29,8 +29,15 @@ const styles = {
|
|
|
29
29
|
transform: 'translateZ(0)'
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
+
function isObjectEmpty(object) {
|
|
33
|
+
// eslint-disable-next-line
|
|
34
|
+
for (const _ in object) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
32
39
|
function isEmpty(obj) {
|
|
33
|
-
return
|
|
40
|
+
return isObjectEmpty(obj) || obj.outerHeightStyle === 0 && !obj.overflowing;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
/**
|
|
@@ -55,14 +62,18 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
55
62
|
const {
|
|
56
63
|
current: isControlled
|
|
57
64
|
} = React.useRef(value != null);
|
|
58
|
-
const
|
|
59
|
-
const handleRef = (0, _utils.unstable_useForkRef)(forwardedRef,
|
|
65
|
+
const textareaRef = React.useRef(null);
|
|
66
|
+
const handleRef = (0, _utils.unstable_useForkRef)(forwardedRef, textareaRef);
|
|
60
67
|
const heightRef = React.useRef(null);
|
|
61
|
-
const
|
|
68
|
+
const hiddenTextareaRef = React.useRef(null);
|
|
62
69
|
const calculateTextareaStyles = React.useCallback(() => {
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
70
|
+
const textarea = textareaRef.current;
|
|
71
|
+
const hiddenTextarea = hiddenTextareaRef.current;
|
|
72
|
+
if (!textarea || !hiddenTextarea) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const containerWindow = (0, _utils.unstable_ownerWindow)(textarea);
|
|
76
|
+
const computedStyle = containerWindow.getComputedStyle(textarea);
|
|
66
77
|
|
|
67
78
|
// If input's width is shrunk and it's not visible, don't sync height.
|
|
68
79
|
if (computedStyle.width === '0px') {
|
|
@@ -71,25 +82,24 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
71
82
|
overflowing: false
|
|
72
83
|
};
|
|
73
84
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (inputShallow.value.slice(-1) === '\n') {
|
|
85
|
+
hiddenTextarea.style.width = computedStyle.width;
|
|
86
|
+
hiddenTextarea.value = textarea.value || props.placeholder || 'x';
|
|
87
|
+
if (hiddenTextarea.value.slice(-1) === '\n') {
|
|
78
88
|
// Certain fonts which overflow the line height will cause the textarea
|
|
79
89
|
// to report a different scrollHeight depending on whether the last line
|
|
80
90
|
// is empty. Make it non-empty to avoid this issue.
|
|
81
|
-
|
|
91
|
+
hiddenTextarea.value += ' ';
|
|
82
92
|
}
|
|
83
93
|
const boxSizing = computedStyle.boxSizing;
|
|
84
94
|
const padding = getStyleValue(computedStyle.paddingBottom) + getStyleValue(computedStyle.paddingTop);
|
|
85
95
|
const border = getStyleValue(computedStyle.borderBottomWidth) + getStyleValue(computedStyle.borderTopWidth);
|
|
86
96
|
|
|
87
97
|
// The height of the inner content
|
|
88
|
-
const innerHeight =
|
|
98
|
+
const innerHeight = hiddenTextarea.scrollHeight;
|
|
89
99
|
|
|
90
100
|
// Measure height of a textarea with a single row
|
|
91
|
-
|
|
92
|
-
const singleRowHeight =
|
|
101
|
+
hiddenTextarea.value = 'x';
|
|
102
|
+
const singleRowHeight = hiddenTextarea.scrollHeight;
|
|
93
103
|
|
|
94
104
|
// The height of the outer content
|
|
95
105
|
let outerHeight = innerHeight;
|
|
@@ -110,45 +120,45 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
110
120
|
};
|
|
111
121
|
}, [maxRows, minRows, props.placeholder]);
|
|
112
122
|
const syncHeight = React.useCallback(() => {
|
|
123
|
+
const textarea = textareaRef.current;
|
|
113
124
|
const textareaStyles = calculateTextareaStyles();
|
|
114
|
-
if (isEmpty(textareaStyles)) {
|
|
125
|
+
if (!textarea || !textareaStyles || isEmpty(textareaStyles)) {
|
|
115
126
|
return;
|
|
116
127
|
}
|
|
117
128
|
const outerHeightStyle = textareaStyles.outerHeightStyle;
|
|
118
|
-
const input = inputRef.current;
|
|
119
129
|
if (heightRef.current !== outerHeightStyle) {
|
|
120
130
|
heightRef.current = outerHeightStyle;
|
|
121
|
-
|
|
131
|
+
textarea.style.height = `${outerHeightStyle}px`;
|
|
122
132
|
}
|
|
123
|
-
|
|
133
|
+
textarea.style.overflow = textareaStyles.overflowing ? 'hidden' : '';
|
|
124
134
|
}, [calculateTextareaStyles]);
|
|
135
|
+
const frameRef = React.useRef(-1);
|
|
125
136
|
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
// Also see https://github.com/mui/mui-x/issues/8733
|
|
133
|
-
let rAF;
|
|
134
|
-
const rAFHandleResize = () => {
|
|
135
|
-
cancelAnimationFrame(rAF);
|
|
136
|
-
rAF = requestAnimationFrame(() => {
|
|
137
|
-
handleResize();
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
const debounceHandleResize = (0, _utils.unstable_debounce)(handleResize);
|
|
141
|
-
const input = inputRef.current;
|
|
142
|
-
const containerWindow = (0, _utils.unstable_ownerWindow)(input);
|
|
137
|
+
const debounceHandleResize = (0, _utils.unstable_debounce)(() => syncHeight());
|
|
138
|
+
const textarea = textareaRef?.current;
|
|
139
|
+
if (!textarea) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
const containerWindow = (0, _utils.unstable_ownerWindow)(textarea);
|
|
143
143
|
containerWindow.addEventListener('resize', debounceHandleResize);
|
|
144
144
|
let resizeObserver;
|
|
145
145
|
if (typeof ResizeObserver !== 'undefined') {
|
|
146
|
-
resizeObserver = new ResizeObserver(
|
|
147
|
-
|
|
146
|
+
resizeObserver = new ResizeObserver(() => {
|
|
147
|
+
// avoid "ResizeObserver loop completed with undelivered notifications" error
|
|
148
|
+
// by temporarily unobserving the textarea element while manipulating the height
|
|
149
|
+
// and reobserving one frame later
|
|
150
|
+
resizeObserver.unobserve(textarea);
|
|
151
|
+
cancelAnimationFrame(frameRef.current);
|
|
152
|
+
syncHeight();
|
|
153
|
+
frameRef.current = requestAnimationFrame(() => {
|
|
154
|
+
resizeObserver.observe(textarea);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
resizeObserver.observe(textarea);
|
|
148
158
|
}
|
|
149
159
|
return () => {
|
|
150
160
|
debounceHandleResize.clear();
|
|
151
|
-
cancelAnimationFrame(
|
|
161
|
+
cancelAnimationFrame(frameRef.current);
|
|
152
162
|
containerWindow.removeEventListener('resize', debounceHandleResize);
|
|
153
163
|
if (resizeObserver) {
|
|
154
164
|
resizeObserver.disconnect();
|
|
@@ -180,7 +190,7 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
180
190
|
"aria-hidden": true,
|
|
181
191
|
className: props.className,
|
|
182
192
|
readOnly: true,
|
|
183
|
-
ref:
|
|
193
|
+
ref: hiddenTextareaRef,
|
|
184
194
|
tabIndex: -1,
|
|
185
195
|
style: {
|
|
186
196
|
...styles.shadow,
|
package/node/index.js
CHANGED
|
@@ -53,6 +53,13 @@ const defaultFilterOptions = createFilterOptions();
|
|
|
53
53
|
const pageSize = 5;
|
|
54
54
|
const defaultIsActiveElementInListbox = listboxRef => listboxRef.current !== null && listboxRef.current.parentElement?.contains(document.activeElement);
|
|
55
55
|
const MULTIPLE_DEFAULT_VALUE = [];
|
|
56
|
+
function getInputValue(value, multiple, getOptionLabel) {
|
|
57
|
+
if (multiple || value == null) {
|
|
58
|
+
return '';
|
|
59
|
+
}
|
|
60
|
+
const optionLabel = getOptionLabel(value);
|
|
61
|
+
return typeof optionLabel === 'string' ? optionLabel : '';
|
|
62
|
+
}
|
|
56
63
|
function useAutocomplete(props) {
|
|
57
64
|
const {
|
|
58
65
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -118,6 +125,10 @@ function useAutocomplete(props) {
|
|
|
118
125
|
const [focusedTag, setFocusedTag] = React.useState(-1);
|
|
119
126
|
const defaultHighlighted = autoHighlight ? 0 : -1;
|
|
120
127
|
const highlightedIndexRef = React.useRef(defaultHighlighted);
|
|
128
|
+
|
|
129
|
+
// Calculate the initial inputValue on mount only.
|
|
130
|
+
// Using useRef since defaultValue doesn't need to update inputValue dynamically.
|
|
131
|
+
const initialInputValue = React.useRef(getInputValue(defaultValue, multiple, getOptionLabel)).current;
|
|
121
132
|
const [value, setValueState] = (0, _utils.unstable_useControlled)({
|
|
122
133
|
controlled: valueProp,
|
|
123
134
|
default: defaultValue,
|
|
@@ -125,7 +136,7 @@ function useAutocomplete(props) {
|
|
|
125
136
|
});
|
|
126
137
|
const [inputValue, setInputValueState] = (0, _utils.unstable_useControlled)({
|
|
127
138
|
controlled: inputValueProp,
|
|
128
|
-
default:
|
|
139
|
+
default: initialInputValue,
|
|
129
140
|
name: componentName,
|
|
130
141
|
state: 'inputValue'
|
|
131
142
|
});
|
|
@@ -137,15 +148,7 @@ function useAutocomplete(props) {
|
|
|
137
148
|
if (!isOptionSelected && !clearOnBlur) {
|
|
138
149
|
return;
|
|
139
150
|
}
|
|
140
|
-
|
|
141
|
-
if (multiple) {
|
|
142
|
-
newInputValue = '';
|
|
143
|
-
} else if (newValue == null) {
|
|
144
|
-
newInputValue = '';
|
|
145
|
-
} else {
|
|
146
|
-
const optionLabel = getOptionLabel(newValue);
|
|
147
|
-
newInputValue = typeof optionLabel === 'string' ? optionLabel : '';
|
|
148
|
-
}
|
|
151
|
+
const newInputValue = getInputValue(newValue, multiple, getOptionLabel);
|
|
149
152
|
if (inputValue === newInputValue) {
|
|
150
153
|
return;
|
|
151
154
|
}
|
package/node/version/index.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.prerelease = exports.patch = exports.minor = exports.major = exports.default = void 0;
|
|
7
|
-
const version = exports.version = "6.4.
|
|
7
|
+
const version = exports.version = "6.4.2";
|
|
8
8
|
const major = exports.major = Number("6");
|
|
9
9
|
const minor = exports.minor = Number("4");
|
|
10
|
-
const patch = exports.patch = Number("
|
|
10
|
+
const patch = exports.patch = Number("2");
|
|
11
11
|
const prerelease = exports.prerelease = undefined;
|
|
12
12
|
var _default = exports.default = version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"prop-types": "^15.8.1",
|
|
36
36
|
"react-is": "^19.0.0",
|
|
37
37
|
"react-transition-group": "^4.4.5",
|
|
38
|
-
"@mui/core-downloads-tracker": "^6.4.
|
|
39
|
-
"@mui/
|
|
38
|
+
"@mui/core-downloads-tracker": "^6.4.2",
|
|
39
|
+
"@mui/system": "^6.4.2",
|
|
40
40
|
"@mui/types": "^7.2.21",
|
|
41
|
-
"@mui/
|
|
41
|
+
"@mui/utils": "^6.4.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@emotion/react": "^11.5.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
47
47
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
48
48
|
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
49
|
-
"@mui/material-pigment-css": "^6.4.
|
|
49
|
+
"@mui/material-pigment-css": "^6.4.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"@types/react": {
|