@mui/material 6.1.9 → 6.2.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.
Files changed (77) hide show
  1. package/Avatar/Avatar.js +7 -6
  2. package/Box/Box.d.ts +3 -1
  3. package/ButtonBase/ButtonBase.js +21 -22
  4. package/CHANGELOG.md +82 -0
  5. package/ClickAwayListener/ClickAwayListener.js +1 -4
  6. package/FilledInput/FilledInput.js +1 -1
  7. package/FormHelperText/FormHelperText.js +1 -0
  8. package/Grid/Grid.js +2 -2
  9. package/Grid2/Grid2.js +9 -2
  10. package/Hidden/HiddenJs.js +4 -8
  11. package/InputAdornment/InputAdornment.js +1 -0
  12. package/ListItemText/ListItemText.d.ts +36 -1
  13. package/ListItemText/ListItemText.js +46 -7
  14. package/Modal/useModal.js +3 -2
  15. package/Modal/useModal.types.d.ts +5 -1
  16. package/NoSsr/NoSsr.js +2 -5
  17. package/OutlinedInput/NotchedOutline.js +1 -0
  18. package/PigmentGrid/PigmentGrid.js +1 -1
  19. package/Portal/Portal.js +2 -7
  20. package/Select/SelectInput.js +1 -0
  21. package/Slider/SliderValueLabel.d.ts +4 -1
  22. package/Slider/SliderValueLabel.types.d.ts +4 -1
  23. package/Slider/useSlider.js +64 -10
  24. package/Tabs/ScrollbarSize.js +2 -2
  25. package/Unstable_TrapFocus/FocusTrap.types.d.ts +4 -1
  26. package/index.js +1 -1
  27. package/modern/Avatar/Avatar.js +7 -6
  28. package/modern/ButtonBase/ButtonBase.js +21 -22
  29. package/modern/ClickAwayListener/ClickAwayListener.js +1 -4
  30. package/modern/FilledInput/FilledInput.js +1 -1
  31. package/modern/FormHelperText/FormHelperText.js +1 -0
  32. package/modern/Grid/Grid.js +2 -2
  33. package/modern/Grid2/Grid2.js +9 -2
  34. package/modern/Hidden/HiddenJs.js +4 -8
  35. package/modern/InputAdornment/InputAdornment.js +1 -0
  36. package/modern/ListItemText/ListItemText.js +46 -7
  37. package/modern/Modal/useModal.js +3 -2
  38. package/modern/NoSsr/NoSsr.js +2 -5
  39. package/modern/OutlinedInput/NotchedOutline.js +1 -0
  40. package/modern/PigmentGrid/PigmentGrid.js +1 -1
  41. package/modern/Portal/Portal.js +2 -7
  42. package/modern/Select/SelectInput.js +1 -0
  43. package/modern/Slider/useSlider.js +64 -10
  44. package/modern/Tabs/ScrollbarSize.js +2 -2
  45. package/modern/index.js +1 -1
  46. package/modern/styles/createThemeWithVars.js +2 -2
  47. package/modern/utils/useSlot.js +1 -10
  48. package/modern/version/index.js +3 -3
  49. package/node/Avatar/Avatar.js +7 -6
  50. package/node/ButtonBase/ButtonBase.js +21 -22
  51. package/node/ClickAwayListener/ClickAwayListener.js +1 -4
  52. package/node/FilledInput/FilledInput.js +1 -1
  53. package/node/FormHelperText/FormHelperText.js +1 -0
  54. package/node/Grid/Grid.js +2 -2
  55. package/node/Grid2/Grid2.js +9 -2
  56. package/node/Hidden/HiddenJs.js +7 -10
  57. package/node/InputAdornment/InputAdornment.js +1 -0
  58. package/node/ListItemText/ListItemText.js +46 -7
  59. package/node/Modal/useModal.js +3 -2
  60. package/node/NoSsr/NoSsr.js +2 -5
  61. package/node/OutlinedInput/NotchedOutline.js +1 -0
  62. package/node/PigmentGrid/PigmentGrid.js +2 -2
  63. package/node/Portal/Portal.js +2 -7
  64. package/node/Select/SelectInput.js +1 -0
  65. package/node/Slider/useSlider.js +64 -10
  66. package/node/Tabs/ScrollbarSize.js +2 -2
  67. package/node/index.js +1 -1
  68. package/node/styles/createThemeWithVars.js +2 -2
  69. package/node/utils/useSlot.js +1 -10
  70. package/node/version/index.js +3 -3
  71. package/package.json +7 -7
  72. package/styles/createThemeWithVars.js +2 -2
  73. package/useLazyRipple/useLazyRipple.d.ts +1 -1
  74. package/utils/memoTheme.d.ts +1 -1
  75. package/utils/useSlot.d.ts +0 -7
  76. package/utils/useSlot.js +1 -10
  77. package/version/index.js +3 -3
@@ -14,6 +14,9 @@ var _utils = require("@mui/utils");
14
14
  var _extractEventHandlers = _interopRequireDefault(require("@mui/utils/extractEventHandlers"));
15
15
  var _areArraysEqual = _interopRequireDefault(require("../utils/areArraysEqual"));
16
16
  const INTENTIONAL_DRAG_COUNT_THRESHOLD = 2;
17
+ function getNewValue(currentValue, step, direction, min, max) {
18
+ return direction === 1 ? Math.min(currentValue + step, max) : Math.max(currentValue - step, min);
19
+ }
17
20
  function asc(a, b) {
18
21
  return a - b;
19
22
  }
@@ -290,20 +293,65 @@ function useSlider(parameters) {
290
293
  }
291
294
  };
292
295
  const createHandleHiddenInputKeyDown = otherHandlers => event => {
293
- // The Shift + Up/Down keyboard shortcuts for moving the slider makes sense to be supported
294
- // only if the step is defined. If the step is null, this means tha the marks are used for specifying the valid values.
295
- if (step !== null) {
296
+ if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'PageUp', 'PageDown', 'Home', 'End'].includes(event.key)) {
297
+ event.preventDefault();
296
298
  const index = Number(event.currentTarget.getAttribute('data-index'));
297
299
  const value = values[index];
298
300
  let newValue = null;
299
- if ((event.key === 'ArrowLeft' || event.key === 'ArrowDown') && event.shiftKey || event.key === 'PageDown') {
300
- newValue = Math.max(value - shiftStep, min);
301
- } else if ((event.key === 'ArrowRight' || event.key === 'ArrowUp') && event.shiftKey || event.key === 'PageUp') {
302
- newValue = Math.min(value + shiftStep, max);
301
+ // Keys actions that change the value by more than the most granular `step`
302
+ // value are only applied if the step not `null`.
303
+ // When step is `null`, the `marks` prop is used instead to define valid values.
304
+ if (step != null) {
305
+ const stepSize = event.shiftKey ? shiftStep : step;
306
+ switch (event.key) {
307
+ case 'ArrowUp':
308
+ newValue = getNewValue(value, stepSize, 1, min, max);
309
+ break;
310
+ case 'ArrowRight':
311
+ newValue = getNewValue(value, stepSize, isRtl ? -1 : 1, min, max);
312
+ break;
313
+ case 'ArrowDown':
314
+ newValue = getNewValue(value, stepSize, -1, min, max);
315
+ break;
316
+ case 'ArrowLeft':
317
+ newValue = getNewValue(value, stepSize, isRtl ? 1 : -1, min, max);
318
+ break;
319
+ case 'PageUp':
320
+ newValue = getNewValue(value, shiftStep, 1, min, max);
321
+ break;
322
+ case 'PageDown':
323
+ newValue = getNewValue(value, shiftStep, -1, min, max);
324
+ break;
325
+ case 'Home':
326
+ newValue = min;
327
+ break;
328
+ case 'End':
329
+ newValue = max;
330
+ break;
331
+ default:
332
+ break;
333
+ }
334
+ } else if (marks) {
335
+ const maxMarksValue = marksValues[marksValues.length - 1];
336
+ const currentMarkIndex = marksValues.indexOf(value);
337
+ const decrementKeys = [isRtl ? 'ArrowRight' : 'ArrowLeft', 'ArrowDown', 'PageDown', 'Home'];
338
+ const incrementKeys = [isRtl ? 'ArrowLeft' : 'ArrowRight', 'ArrowUp', 'PageUp', 'End'];
339
+ if (decrementKeys.includes(event.key)) {
340
+ if (currentMarkIndex === 0) {
341
+ newValue = marksValues[0];
342
+ } else {
343
+ newValue = marksValues[currentMarkIndex - 1];
344
+ }
345
+ } else if (incrementKeys.includes(event.key)) {
346
+ if (currentMarkIndex === marksValues.length - 1) {
347
+ newValue = maxMarksValue;
348
+ } else {
349
+ newValue = marksValues[currentMarkIndex + 1];
350
+ }
351
+ }
303
352
  }
304
- if (newValue !== null) {
353
+ if (newValue != null) {
305
354
  changeValue(event, newValue);
306
- event.preventDefault();
307
355
  }
308
356
  }
309
357
  otherHandlers?.onKeyDown?.(event);
@@ -325,6 +373,7 @@ function useSlider(parameters) {
325
373
  }
326
374
  const createHandleHiddenInputChange = otherHandlers => event => {
327
375
  otherHandlers.onChange?.(event);
376
+ // this handles value change by Pointer or Touch events
328
377
  // @ts-ignore
329
378
  changeValue(event, event.target.valueAsNumber);
330
379
  };
@@ -601,6 +650,10 @@ function useSlider(parameters) {
601
650
  pointerEvents: active !== -1 && active !== index ? 'none' : undefined
602
651
  };
603
652
  };
653
+ let cssWritingMode;
654
+ if (orientation === 'vertical') {
655
+ cssWritingMode = isRtl ? 'vertical-rl' : 'vertical-lr';
656
+ }
604
657
  const getHiddenInputProps = (externalProps = {}) => {
605
658
  const externalHandlers = (0, _extractEventHandlers.default)(externalProps);
606
659
  const ownEventHandlers = {
@@ -632,7 +685,8 @@ function useSlider(parameters) {
632
685
  direction: isRtl ? 'rtl' : 'ltr',
633
686
  // So that VoiceOver's focus indicator matches the thumb's dimensions
634
687
  width: '100%',
635
- height: '100%'
688
+ height: '100%',
689
+ writingMode: cssWritingMode
636
690
  }
637
691
  };
638
692
  };
@@ -56,8 +56,8 @@ function ScrollbarSize(props) {
56
56
  }, [onChange]);
57
57
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
58
58
  style: styles,
59
- ref: nodeRef,
60
- ...other
59
+ ...other,
60
+ ref: nodeRef
61
61
  });
62
62
  }
63
63
  process.env.NODE_ENV !== "production" ? ScrollbarSize.propTypes = {
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.1.9
2
+ * @mui/material v6.2.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -32,7 +32,7 @@ function setColor(obj, key, defaultValue) {
32
32
  }
33
33
  }
34
34
  function toRgb(color) {
35
- if (!color || !color.startsWith('hsl')) {
35
+ if (typeof color !== 'string' || !color.startsWith('hsl')) {
36
36
  return color;
37
37
  }
38
38
  return (0, _colorManipulator.hslToRgb)(color);
@@ -325,7 +325,7 @@ function createThemeWithVars(options = {}, ...args) {
325
325
 
326
326
  // The default palettes (primary, secondary, error, info, success, and warning) errors are handled by the above `createTheme(...)`.
327
327
 
328
- if (colors && typeof colors === 'object') {
328
+ if (color !== 'tonalOffset' && colors && typeof colors === 'object') {
329
329
  // Silent the error for custom palettes.
330
330
  if (colors.main) {
331
331
  setColor(palette[color], 'mainChannel', (0, _colorManipulator.private_safeColorChannel)(toRgb(colors.main)));
@@ -37,7 +37,6 @@ name, parameters) {
37
37
  elementType: initialElementType,
38
38
  ownerState,
39
39
  externalForwardedProps,
40
- getSlotOwnerState,
41
40
  internalForwardedProps,
42
41
  ...useSlotPropsParams
43
42
  } = parameters;
@@ -69,11 +68,6 @@ name, parameters) {
69
68
  externalSlotProps: resolvedComponentsProps
70
69
  });
71
70
  const ref = (0, _useForkRef.default)(internalRef, resolvedComponentsProps?.ref, parameters.ref);
72
- const slotOwnerState = getSlotOwnerState ? getSlotOwnerState(mergedProps) : {};
73
- const finalOwnerState = {
74
- ...ownerState,
75
- ...slotOwnerState
76
- };
77
71
  const LeafComponent = name === 'root' ? slotComponent || rootComponent : slotComponent;
78
72
  const props = (0, _appendOwnerState.default)(elementType, {
79
73
  ...(name === 'root' && !rootComponent && !slots[name] && internalForwardedProps),
@@ -83,9 +77,6 @@ name, parameters) {
83
77
  as: LeafComponent
84
78
  }),
85
79
  ref
86
- }, finalOwnerState);
87
- Object.keys(slotOwnerState).forEach(propName => {
88
- delete props[propName];
89
- });
80
+ }, ownerState);
90
81
  return [elementType, props];
91
82
  }
@@ -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.1.9";
7
+ const version = exports.version = "6.2.0";
8
8
  const major = exports.major = Number("6");
9
- const minor = exports.minor = Number("1");
10
- const patch = exports.patch = Number("9");
9
+ const minor = exports.minor = Number("2");
10
+ const patch = exports.patch = Number("0");
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.1.9",
3
+ "version": "6.2.0",
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.",
@@ -33,12 +33,12 @@
33
33
  "clsx": "^2.1.1",
34
34
  "csstype": "^3.1.3",
35
35
  "prop-types": "^15.8.1",
36
- "react-is": "^18.3.1",
36
+ "react-is": "^19.0.0",
37
37
  "react-transition-group": "^4.4.5",
38
- "@mui/types": "^7.2.19",
39
- "@mui/system": "^6.1.9",
40
- "@mui/utils": "^6.1.9",
41
- "@mui/core-downloads-tracker": "^6.1.9"
38
+ "@mui/system": "^6.2.0",
39
+ "@mui/utils": "^6.2.0",
40
+ "@mui/core-downloads-tracker": "^6.2.0",
41
+ "@mui/types": "^7.2.19"
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.1.9"
49
+ "@mui/material-pigment-css": "^6.2.0"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@types/react": {
@@ -23,7 +23,7 @@ function setColor(obj, key, defaultValue) {
23
23
  }
24
24
  }
25
25
  function toRgb(color) {
26
- if (!color || !color.startsWith('hsl')) {
26
+ if (typeof color !== 'string' || !color.startsWith('hsl')) {
27
27
  return color;
28
28
  }
29
29
  return hslToRgb(color);
@@ -315,7 +315,7 @@ export default function createThemeWithVars(options = {}, ...args) {
315
315
 
316
316
  // The default palettes (primary, secondary, error, info, success, and warning) errors are handled by the above `createTheme(...)`.
317
317
 
318
- if (colors && typeof colors === 'object') {
318
+ if (color !== 'tonalOffset' && colors && typeof colors === 'object') {
319
319
  // Silent the error for custom palettes.
320
320
  if (colors.main) {
321
321
  setColor(palette[color], 'mainChannel', safeColorChannel(toRgb(colors.main)));
@@ -10,7 +10,7 @@ type ControlledPromise<T = unknown> = Promise<T> & {
10
10
  */
11
11
  export declare class LazyRipple {
12
12
  /** React ref to the ripple instance */
13
- ref: React.MutableRefObject<TouchRippleActions | null>;
13
+ ref: React.RefObject<TouchRippleActions | null>;
14
14
  /** If the ripple component should be mounted */
15
15
  shouldMount: boolean;
16
16
  /** Promise that resolves when the ripple component is mounted */
@@ -3,5 +3,5 @@ declare const memoTheme: (styleFn: (props: {
3
3
  theme: Theme;
4
4
  }) => import("@mui/styled-engine").CSSInterpolation) => (props: {
5
5
  theme: Theme;
6
- }) => string | number | boolean | import("@mui/styled-engine").ComponentSelector | import("@mui/styled-engine").Keyframes | import("@mui/styled-engine").SerializedStyles | import("@mui/styled-engine").CSSObject | import("@mui/styled-engine").ArrayCSSInterpolation | null;
6
+ }) => string | number | boolean | import("@mui/styled-engine").CSSObject | import("@mui/styled-engine").ComponentSelector | import("@mui/styled-engine").Keyframes | import("@mui/styled-engine").SerializedStyles | import("@mui/styled-engine").ArrayCSSInterpolation | null;
7
7
  export default memoTheme;
@@ -65,13 +65,6 @@ name: T, parameters: (T extends 'root' ? {
65
65
  externalForwardedProps: ExternalForwardedProps;
66
66
  getSlotProps?: (other: EventHandlers) => WithCommonProps<SlotProps>;
67
67
  additionalProps?: WithCommonProps<AdditionalProps>;
68
- /**
69
- * For overriding the component's ownerState for the slot.
70
- * This is required for some components that need styling via `ownerState`.
71
- *
72
- * It is a function because `slotProps.{slot}` can be a function which has to be resolved first.
73
- */
74
- getSlotOwnerState?: (mergedProps: AdditionalProps & SlotProps & ExternalSlotProps & ExtractComponentProps<Exclude<Exclude<ExternalForwardedProps['slotProps'], undefined>[T], undefined>>) => SlotOwnerState;
75
68
  /**
76
69
  * props forward to `T` only if the `slotProps.*.component` is not provided.
77
70
  * e.g. Autocomplete's listbox uses Popper + StyledComponent
package/utils/useSlot.js CHANGED
@@ -31,7 +31,6 @@ name, parameters) {
31
31
  elementType: initialElementType,
32
32
  ownerState,
33
33
  externalForwardedProps,
34
- getSlotOwnerState,
35
34
  internalForwardedProps,
36
35
  ...useSlotPropsParams
37
36
  } = parameters;
@@ -63,11 +62,6 @@ name, parameters) {
63
62
  externalSlotProps: resolvedComponentsProps
64
63
  });
65
64
  const ref = useForkRef(internalRef, resolvedComponentsProps?.ref, parameters.ref);
66
- const slotOwnerState = getSlotOwnerState ? getSlotOwnerState(mergedProps) : {};
67
- const finalOwnerState = {
68
- ...ownerState,
69
- ...slotOwnerState
70
- };
71
65
  const LeafComponent = name === 'root' ? slotComponent || rootComponent : slotComponent;
72
66
  const props = appendOwnerState(elementType, {
73
67
  ...(name === 'root' && !rootComponent && !slots[name] && internalForwardedProps),
@@ -77,9 +71,6 @@ name, parameters) {
77
71
  as: LeafComponent
78
72
  }),
79
73
  ref
80
- }, finalOwnerState);
81
- Object.keys(slotOwnerState).forEach(propName => {
82
- delete props[propName];
83
- });
74
+ }, ownerState);
84
75
  return [elementType, props];
85
76
  }
package/version/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export const version = "6.1.9";
1
+ export const version = "6.2.0";
2
2
  export const major = Number("6");
3
- export const minor = Number("1");
4
- export const patch = Number("9");
3
+ export const minor = Number("2");
4
+ export const patch = Number("0");
5
5
  export const prerelease = undefined;
6
6
  export default version;