@mui/material 6.4.6 → 6.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/Accordion/Accordion.d.ts +17 -2
  2. package/Accordion/Accordion.js +18 -6
  3. package/AccordionSummary/AccordionSummary.d.ts +59 -4
  4. package/AccordionSummary/AccordionSummary.js +67 -16
  5. package/CHANGELOG.md +67 -4
  6. package/ListItemText/ListItemText.d.ts +10 -0
  7. package/ListItemText/ListItemText.js +14 -5
  8. package/Radio/Radio.js +3 -1
  9. package/Rating/Rating.d.ts +59 -1
  10. package/Rating/Rating.js +131 -45
  11. package/Snackbar/Snackbar.js +7 -1
  12. package/SpeedDial/SpeedDial.d.ts +10 -0
  13. package/SpeedDial/SpeedDial.js +40 -11
  14. package/SpeedDialAction/SpeedDialAction.js +1 -1
  15. package/TextareaAutosize/TextareaAutosize.js +26 -15
  16. package/Tooltip/Tooltip.d.ts +1 -13
  17. package/Tooltip/Tooltip.js +1 -1
  18. package/index.js +1 -1
  19. package/modern/Accordion/Accordion.js +18 -6
  20. package/modern/AccordionSummary/AccordionSummary.js +67 -16
  21. package/modern/ListItemText/ListItemText.js +14 -5
  22. package/modern/Radio/Radio.js +3 -1
  23. package/modern/Rating/Rating.js +131 -45
  24. package/modern/Snackbar/Snackbar.js +7 -1
  25. package/modern/SpeedDial/SpeedDial.js +40 -11
  26. package/modern/SpeedDialAction/SpeedDialAction.js +1 -1
  27. package/modern/TextareaAutosize/TextareaAutosize.js +26 -15
  28. package/modern/Tooltip/Tooltip.js +1 -1
  29. package/modern/index.js +1 -1
  30. package/modern/styles/ThemeProvider.js +11 -0
  31. package/modern/useScrollTrigger/useScrollTrigger.js +3 -0
  32. package/modern/version/index.js +2 -2
  33. package/node/Accordion/Accordion.js +18 -6
  34. package/node/AccordionSummary/AccordionSummary.js +67 -16
  35. package/node/ListItemText/ListItemText.js +14 -5
  36. package/node/Radio/Radio.js +3 -1
  37. package/node/Rating/Rating.js +132 -46
  38. package/node/Snackbar/Snackbar.js +7 -1
  39. package/node/SpeedDial/SpeedDial.js +40 -11
  40. package/node/SpeedDialAction/SpeedDialAction.js +1 -1
  41. package/node/TextareaAutosize/TextareaAutosize.js +25 -14
  42. package/node/Tooltip/Tooltip.js +1 -1
  43. package/node/index.js +1 -1
  44. package/node/styles/ThemeProvider.js +11 -0
  45. package/node/useScrollTrigger/useScrollTrigger.js +3 -0
  46. package/node/version/index.js +2 -2
  47. package/package.json +6 -6
  48. package/styles/ThemeProvider.d.ts +6 -0
  49. package/styles/ThemeProvider.js +11 -0
  50. package/styles/ThemeProviderWithVars.d.ts +1 -0
  51. package/styles/index.d.ts +1 -0
  52. package/useScrollTrigger/useScrollTrigger.d.ts +1 -1
  53. package/useScrollTrigger/useScrollTrigger.js +3 -0
  54. package/version/index.js +2 -2
@@ -119,6 +119,15 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
119
119
  overflowing
120
120
  };
121
121
  }, [maxRows, minRows, props.placeholder]);
122
+ const didHeightChange = (0, _utils.unstable_useEventCallback)(() => {
123
+ const textarea = textareaRef.current;
124
+ const textareaStyles = calculateTextareaStyles();
125
+ if (!textarea || !textareaStyles || isEmpty(textareaStyles)) {
126
+ return false;
127
+ }
128
+ const outerHeightStyle = textareaStyles.outerHeightStyle;
129
+ return heightRef.current != null && heightRef.current !== outerHeightStyle;
130
+ });
122
131
  const syncHeight = React.useCallback(() => {
123
132
  const textarea = textareaRef.current;
124
133
  const textareaStyles = calculateTextareaStyles();
@@ -134,37 +143,39 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
134
143
  }, [calculateTextareaStyles]);
135
144
  const frameRef = React.useRef(-1);
136
145
  (0, _utils.unstable_useEnhancedEffect)(() => {
137
- const debounceHandleResize = (0, _utils.unstable_debounce)(() => syncHeight());
146
+ const debouncedHandleResize = (0, _utils.unstable_debounce)(syncHeight);
138
147
  const textarea = textareaRef?.current;
139
148
  if (!textarea) {
140
149
  return undefined;
141
150
  }
142
151
  const containerWindow = (0, _utils.unstable_ownerWindow)(textarea);
143
- containerWindow.addEventListener('resize', debounceHandleResize);
152
+ containerWindow.addEventListener('resize', debouncedHandleResize);
144
153
  let resizeObserver;
145
154
  if (typeof ResizeObserver !== 'undefined') {
146
155
  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
+ if (didHeightChange()) {
157
+ // avoid "ResizeObserver loop completed with undelivered notifications" error
158
+ // by temporarily unobserving the textarea element while manipulating the height
159
+ // and reobserving one frame later
160
+ resizeObserver.unobserve(textarea);
161
+ cancelAnimationFrame(frameRef.current);
162
+ syncHeight();
163
+ frameRef.current = requestAnimationFrame(() => {
164
+ resizeObserver.observe(textarea);
165
+ });
166
+ }
156
167
  });
157
168
  resizeObserver.observe(textarea);
158
169
  }
159
170
  return () => {
160
- debounceHandleResize.clear();
171
+ debouncedHandleResize.clear();
161
172
  cancelAnimationFrame(frameRef.current);
162
- containerWindow.removeEventListener('resize', debounceHandleResize);
173
+ containerWindow.removeEventListener('resize', debouncedHandleResize);
163
174
  if (resizeObserver) {
164
175
  resizeObserver.disconnect();
165
176
  }
166
177
  };
167
- }, [calculateTextareaStyles, syncHeight]);
178
+ }, [calculateTextareaStyles, syncHeight, didHeightChange]);
168
179
  (0, _utils.unstable_useEnhancedEffect)(() => {
169
180
  syncHeight();
170
181
  });
@@ -849,7 +849,7 @@ process.env.NODE_ENV !== "production" ? Tooltip.propTypes /* remove-proptypes */
849
849
  * Tooltip placement.
850
850
  * @default 'bottom'
851
851
  */
852
- placement: _propTypes.default.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
852
+ placement: _propTypes.default.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
853
853
  /**
854
854
  * The component used for the popper.
855
855
  * @deprecated use the `slots.popper` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.4.6
2
+ * @mui/material v6.4.8
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -24,6 +24,17 @@ function ThemeProvider({
24
24
  }
25
25
  const muiTheme = _identifier.default in theme ? theme[_identifier.default] : theme;
26
26
  if (!('colorSchemes' in muiTheme)) {
27
+ if (!('vars' in muiTheme)) {
28
+ // For non-CSS variables themes, set `vars` to null to prevent theme inheritance from the upper theme.
29
+ // The example use case is the docs demo that uses ThemeProvider to customize the theme while the upper theme is using CSS variables.
30
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ThemeProviderNoVars.default, {
31
+ theme: {
32
+ ...theme,
33
+ vars: null
34
+ },
35
+ ...props
36
+ });
37
+ }
27
38
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ThemeProviderNoVars.default, {
28
39
  theme: theme,
29
40
  ...props
@@ -35,6 +35,9 @@ function useScrollTrigger(options = {}) {
35
35
  const store = React.useRef();
36
36
  const [trigger, setTrigger] = React.useState(() => getTrigger(store, other));
37
37
  React.useEffect(() => {
38
+ if (target === null) {
39
+ return setTrigger(false);
40
+ }
38
41
  const handleScroll = () => {
39
42
  setTrigger(getTrigger(store, {
40
43
  target,
@@ -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.6";
7
+ const version = exports.version = "6.4.8";
8
8
  const major = exports.major = Number("6");
9
9
  const minor = exports.minor = Number("4");
10
- const patch = exports.patch = Number("6");
10
+ const patch = exports.patch = Number("8");
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.6",
3
+ "version": "6.4.8",
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.6",
39
- "@mui/system": "^6.4.6",
40
- "@mui/utils": "^6.4.6",
41
- "@mui/types": "^7.2.21"
38
+ "@mui/utils": "^6.4.8",
39
+ "@mui/types": "~7.2.24",
40
+ "@mui/system": "^6.4.8",
41
+ "@mui/core-downloads-tracker": "^6.4.8"
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.6"
49
+ "@mui/material-pigment-css": "^6.4.8"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@types/react": {
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { DefaultTheme } from '@mui/system';
3
+ import { StorageManager } from '@mui/system/cssVars';
3
4
  import { CssThemeVariables } from './createThemeNoVars';
4
5
  type ThemeProviderCssVariablesProps = CssThemeVariables extends {
5
6
  enabled: true;
@@ -40,6 +41,11 @@ export interface ThemeProviderProps<Theme = DefaultTheme> extends ThemeProviderC
40
41
  * @default window
41
42
  */
42
43
  storageWindow?: Window | null;
44
+ /**
45
+ * The storage manager to be used for storing the mode and color scheme
46
+ * @default using `window.localStorage`
47
+ */
48
+ storageManager?: StorageManager | null;
43
49
  /**
44
50
  * localStorage key used to store application `mode`
45
51
  * @default 'mui-mode'
@@ -17,6 +17,17 @@ export default function ThemeProvider({
17
17
  }
18
18
  const muiTheme = THEME_ID in theme ? theme[THEME_ID] : theme;
19
19
  if (!('colorSchemes' in muiTheme)) {
20
+ if (!('vars' in muiTheme)) {
21
+ // For non-CSS variables themes, set `vars` to null to prevent theme inheritance from the upper theme.
22
+ // The example use case is the docs demo that uses ThemeProvider to customize the theme while the upper theme is using CSS variables.
23
+ return /*#__PURE__*/_jsx(ThemeProviderNoVars, {
24
+ theme: {
25
+ ...theme,
26
+ vars: null
27
+ },
28
+ ...props
29
+ });
30
+ }
20
31
  return /*#__PURE__*/_jsx(ThemeProviderNoVars, {
21
32
  theme: theme,
22
33
  ...props
@@ -43,6 +43,7 @@ export declare const CssVarsProvider: (props: React.PropsWithChildren<Partial<im
43
43
  defaultMode?: "light" | "dark" | "system";
44
44
  documentNode?: Document | null;
45
45
  colorSchemeNode?: Element | null;
46
+ storageManager?: import("@mui/system").StorageManager | null;
46
47
  storageWindow?: Window | null;
47
48
  disableNestedContext?: boolean;
48
49
  disableStyleSheetGeneration?: boolean;
package/styles/index.d.ts CHANGED
@@ -103,6 +103,7 @@ export { default as withStyles } from './withStyles';
103
103
  export { default as withTheme } from './withTheme';
104
104
 
105
105
  export * from './ThemeProviderWithVars';
106
+ export type { StorageManager } from '@mui/system/cssVars';
106
107
 
107
108
  export { default as extendTheme } from './createThemeWithVars';
108
109
 
@@ -1,6 +1,6 @@
1
1
  export interface UseScrollTriggerOptions {
2
2
  disableHysteresis?: boolean;
3
- target?: Node | Window;
3
+ target?: Node | Window | null;
4
4
  threshold?: number;
5
5
  }
6
6
 
@@ -29,6 +29,9 @@ export default function useScrollTrigger(options = {}) {
29
29
  const store = React.useRef();
30
30
  const [trigger, setTrigger] = React.useState(() => getTrigger(store, other));
31
31
  React.useEffect(() => {
32
+ if (target === null) {
33
+ return setTrigger(false);
34
+ }
32
35
  const handleScroll = () => {
33
36
  setTrigger(getTrigger(store, {
34
37
  target,
package/version/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export const version = "6.4.6";
1
+ export const version = "6.4.8";
2
2
  export const major = Number("6");
3
3
  export const minor = Number("4");
4
- export const patch = Number("6");
4
+ export const patch = Number("8");
5
5
  export const prerelease = undefined;
6
6
  export default version;