@mui/material 5.15.4 → 5.15.6

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 (73) hide show
  1. package/Accordion/Accordion.d.ts +30 -2
  2. package/Accordion/Accordion.js +39 -6
  3. package/AccordionSummary/accordionSummaryClasses.d.ts +4 -1
  4. package/Alert/Alert.d.ts +4 -2
  5. package/Alert/Alert.js +1 -1
  6. package/Avatar/Avatar.js +32 -15
  7. package/Badge/Badge.js +1 -1
  8. package/CHANGELOG.md +398 -242
  9. package/Divider/Divider.d.ts +1 -0
  10. package/Divider/Divider.js +1 -0
  11. package/Divider/dividerClasses.d.ts +6 -2
  12. package/PaginationItem/PaginationItem.js +1 -1
  13. package/PaginationItem/paginationItemClasses.d.ts +20 -4
  14. package/PaginationItem/paginationItemClasses.js +1 -1
  15. package/README.md +5 -5
  16. package/Rating/Rating.js +2 -10
  17. package/SpeedDial/SpeedDial.js +1 -9
  18. package/TablePagination/TablePagination.d.ts +1 -1
  19. package/index.js +1 -1
  20. package/legacy/Accordion/Accordion.js +44 -7
  21. package/legacy/Alert/Alert.js +1 -1
  22. package/legacy/Avatar/Avatar.js +32 -15
  23. package/legacy/Badge/Badge.js +1 -1
  24. package/legacy/Divider/Divider.js +1 -0
  25. package/legacy/PaginationItem/PaginationItem.js +1 -1
  26. package/legacy/PaginationItem/paginationItemClasses.js +1 -1
  27. package/legacy/Rating/Rating.js +2 -10
  28. package/legacy/SpeedDial/SpeedDial.js +1 -9
  29. package/legacy/index.js +1 -1
  30. package/legacy/styles/createTheme.js +13 -1
  31. package/legacy/utils/types.js +1 -0
  32. package/legacy/utils/useSlot.js +71 -0
  33. package/legacy/zero-styled/index.js +2 -0
  34. package/modern/Accordion/Accordion.js +39 -6
  35. package/modern/Alert/Alert.js +1 -1
  36. package/modern/Avatar/Avatar.js +32 -15
  37. package/modern/Badge/Badge.js +1 -1
  38. package/modern/Divider/Divider.js +1 -0
  39. package/modern/PaginationItem/PaginationItem.js +1 -1
  40. package/modern/PaginationItem/paginationItemClasses.js +1 -1
  41. package/modern/Rating/Rating.js +2 -10
  42. package/modern/SpeedDial/SpeedDial.js +1 -9
  43. package/modern/index.js +1 -1
  44. package/modern/styles/createTheme.js +15 -1
  45. package/modern/utils/types.js +1 -0
  46. package/modern/utils/useSlot.js +82 -0
  47. package/modern/zero-styled/index.js +2 -0
  48. package/node/Accordion/Accordion.js +39 -6
  49. package/node/Alert/Alert.js +1 -1
  50. package/node/Avatar/Avatar.js +32 -15
  51. package/node/Badge/Badge.js +3 -3
  52. package/node/Divider/Divider.js +1 -0
  53. package/node/PaginationItem/PaginationItem.js +1 -1
  54. package/node/PaginationItem/paginationItemClasses.js +1 -1
  55. package/node/Rating/Rating.js +2 -10
  56. package/node/SpeedDial/SpeedDial.js +2 -10
  57. package/node/index.js +1 -1
  58. package/node/styles/createTheme.js +15 -1
  59. package/node/utils/types.js +5 -0
  60. package/node/utils/useSlot.js +88 -0
  61. package/node/zero-styled/index.js +13 -0
  62. package/package.json +6 -6
  63. package/styles/createTheme.d.ts +1 -0
  64. package/styles/createTheme.js +15 -1
  65. package/umd/material-ui.development.js +647 -516
  66. package/umd/material-ui.production.min.js +4 -4
  67. package/utils/types.d.ts +27 -0
  68. package/utils/types.js +1 -0
  69. package/utils/useSlot.d.ts +84 -0
  70. package/utils/useSlot.js +82 -0
  71. package/zero-styled/index.d.ts +2 -0
  72. package/zero-styled/index.js +2 -0
  73. package/zero-styled/package.json +6 -0
@@ -13,6 +13,7 @@ var _reactIs = require("react-is");
13
13
  var _propTypes = _interopRequireDefault(require("prop-types"));
14
14
  var _clsx = _interopRequireDefault(require("clsx"));
15
15
  var _composeClasses = require("@mui/base/composeClasses");
16
+ var _utils = require("@mui/utils");
16
17
  var _styled = _interopRequireDefault(require("../styles/styled"));
17
18
  var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
18
19
  var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
@@ -51,15 +52,6 @@ function getOrientation(direction) {
51
52
  }
52
53
  return undefined;
53
54
  }
54
- function clamp(value, min, max) {
55
- if (value < min) {
56
- return min;
57
- }
58
- if (value > max) {
59
- return max;
60
- }
61
- return value;
62
- }
63
55
  const dialRadius = 32;
64
56
  const spacingActions = 16;
65
57
  const SpeedDialRoot = (0, _styled.default)('div', {
@@ -247,7 +239,7 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
247
239
  const actionStep = key === nextItemArrowKeyCurrent ? 1 : -1;
248
240
 
249
241
  // stay within array indices
250
- const nextAction = clamp(focusedAction.current + actionStep, 0, actions.current.length - 1);
242
+ const nextAction = (0, _utils.clamp)(focusedAction.current + actionStep, 0, actions.current.length - 1);
251
243
  actions.current[nextAction].focus();
252
244
  focusedAction.current = nextAction;
253
245
  nextItemArrowKey.current = nextItemArrowKeyCurrent;
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.15.4
2
+ * @mui/material v5.15.6
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -40,7 +40,21 @@ Please use another name.` : (0, _formatMuiErrorMessage2.default)(18));
40
40
  shadows: _shadows.default.slice(),
41
41
  typography: (0, _createTypography.default)(palette, typographyInput),
42
42
  transitions: (0, _createTransitions.default)(transitionsInput),
43
- zIndex: (0, _extends2.default)({}, _zIndex.default)
43
+ zIndex: (0, _extends2.default)({}, _zIndex.default),
44
+ applyDarkStyles(css) {
45
+ if (this.vars) {
46
+ // If CssVarsProvider is used as a provider,
47
+ // returns ':where([data-mui-color-scheme="light|dark"]) &'
48
+ const selector = this.getColorSchemeSelector('dark').replace(/(\[[^\]]+\])/, ':where($1)');
49
+ return {
50
+ [selector]: css
51
+ };
52
+ }
53
+ if (this.palette.mode === 'dark') {
54
+ return css;
55
+ }
56
+ return {};
57
+ }
44
58
  });
45
59
  muiTheme = (0, _utils.deepmerge)(muiTheme, other);
46
60
  muiTheme = args.reduce((acc, argument) => (0, _utils.deepmerge)(acc, argument), muiTheme);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = useSlot;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
+ var _utils = require("@mui/utils");
12
+ var _utils2 = require("@mui/base/utils");
13
+ const _excluded = ["className", "elementType", "ownerState", "externalForwardedProps", "getSlotOwnerState", "internalForwardedProps"],
14
+ _excluded2 = ["component", "slots", "slotProps"],
15
+ _excluded3 = ["component"];
16
+ /**
17
+ * An internal function to create a Material UI slot.
18
+ *
19
+ * This is an advanced version of Base UI `useSlotProps` because Material UI allows leaf component to be customized via `component` prop
20
+ * while Base UI does not need to support leaf component customization.
21
+ *
22
+ * @param {string} name: name of the slot
23
+ * @param {object} parameters
24
+ * @returns {[Slot, slotProps]} The slot's React component and the slot's props
25
+ *
26
+ * Note: the returned slot's props
27
+ * - will never contain `component` prop.
28
+ * - might contain `as` prop.
29
+ */
30
+ function useSlot(
31
+ /**
32
+ * The slot's name. All Material UI components should have `root` slot.
33
+ *
34
+ * If the name is `root`, the logic behaves differently from other slots,
35
+ * e.g. the `externalForwardedProps` are spread to `root` slot but not other slots.
36
+ */
37
+ name, parameters) {
38
+ const {
39
+ className,
40
+ elementType: initialElementType,
41
+ ownerState,
42
+ externalForwardedProps,
43
+ getSlotOwnerState,
44
+ internalForwardedProps
45
+ } = parameters,
46
+ useSlotPropsParams = (0, _objectWithoutPropertiesLoose2.default)(parameters, _excluded);
47
+ const {
48
+ component: rootComponent,
49
+ slots = {
50
+ [name]: undefined
51
+ },
52
+ slotProps = {
53
+ [name]: undefined
54
+ }
55
+ } = externalForwardedProps,
56
+ other = (0, _objectWithoutPropertiesLoose2.default)(externalForwardedProps, _excluded2);
57
+ const elementType = slots[name] || initialElementType;
58
+
59
+ // `slotProps[name]` can be a callback that receives the component's ownerState.
60
+ // `resolvedComponentsProps` is always a plain object.
61
+ const resolvedComponentsProps = (0, _utils2.resolveComponentProps)(slotProps[name], ownerState);
62
+ const _mergeSlotProps = (0, _utils2.mergeSlotProps)((0, _extends2.default)({
63
+ className
64
+ }, useSlotPropsParams, {
65
+ externalForwardedProps: name === 'root' ? other : undefined,
66
+ externalSlotProps: resolvedComponentsProps
67
+ })),
68
+ {
69
+ props: {
70
+ component: slotComponent
71
+ },
72
+ internalRef
73
+ } = _mergeSlotProps,
74
+ mergedProps = (0, _objectWithoutPropertiesLoose2.default)(_mergeSlotProps.props, _excluded3);
75
+ const ref = (0, _utils.unstable_useForkRef)(internalRef, resolvedComponentsProps == null ? void 0 : resolvedComponentsProps.ref, parameters.ref);
76
+ const slotOwnerState = getSlotOwnerState ? getSlotOwnerState(mergedProps) : {};
77
+ const finalOwnerState = (0, _extends2.default)({}, ownerState, slotOwnerState);
78
+ const LeafComponent = name === 'root' ? slotComponent || rootComponent : slotComponent;
79
+ const props = (0, _utils2.appendOwnerState)(elementType, (0, _extends2.default)({}, name === 'root' && !rootComponent && !slots[name] && internalForwardedProps, name !== 'root' && !slots[name] && internalForwardedProps, mergedProps, LeafComponent && {
80
+ as: LeafComponent
81
+ }, {
82
+ ref
83
+ }), finalOwnerState);
84
+ Object.keys(slotOwnerState).forEach(propName => {
85
+ delete props[propName];
86
+ });
87
+ return [elementType, props];
88
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "styled", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _styled.default;
11
+ }
12
+ });
13
+ var _styled = _interopRequireDefault(require("../styles/styled"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "5.15.4",
3
+ "version": "5.15.6",
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.",
@@ -27,18 +27,18 @@
27
27
  "url": "https://opencollective.com/mui-org"
28
28
  },
29
29
  "dependencies": {
30
- "@babel/runtime": "^7.23.7",
30
+ "@babel/runtime": "^7.23.8",
31
31
  "@types/react-transition-group": "^4.4.10",
32
32
  "clsx": "^2.1.0",
33
33
  "csstype": "^3.1.2",
34
34
  "prop-types": "^15.8.1",
35
35
  "react-is": "^18.2.0",
36
36
  "react-transition-group": "^4.4.5",
37
- "@mui/base": "5.0.0-beta.31",
38
- "@mui/utils": "^5.15.4",
37
+ "@mui/base": "5.0.0-beta.33",
38
+ "@mui/core-downloads-tracker": "^5.15.6",
39
+ "@mui/system": "^5.15.6",
39
40
  "@mui/types": "^7.2.13",
40
- "@mui/system": "^5.15.4",
41
- "@mui/core-downloads-tracker": "^5.15.4"
41
+ "@mui/utils": "^5.15.6"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.5.0",
@@ -45,6 +45,7 @@ export interface Theme extends BaseTheme {
45
45
  components?: Components<BaseTheme>;
46
46
  unstable_sx: (props: SxProps<Theme>) => CSSObject;
47
47
  unstable_sxConfig: SxConfig;
48
+ applyDarkStyles: (css: CSSObject) => CSSObject;
48
49
  }
49
50
 
50
51
  /**
@@ -32,7 +32,21 @@ Please use another name.` : _formatMuiErrorMessage(18));
32
32
  shadows: shadows.slice(),
33
33
  typography: createTypography(palette, typographyInput),
34
34
  transitions: createTransitions(transitionsInput),
35
- zIndex: _extends({}, zIndex)
35
+ zIndex: _extends({}, zIndex),
36
+ applyDarkStyles(css) {
37
+ if (this.vars) {
38
+ // If CssVarsProvider is used as a provider,
39
+ // returns ':where([data-mui-color-scheme="light|dark"]) &'
40
+ const selector = this.getColorSchemeSelector('dark').replace(/(\[[^\]]+\])/, ':where($1)');
41
+ return {
42
+ [selector]: css
43
+ };
44
+ }
45
+ if (this.palette.mode === 'dark') {
46
+ return css;
47
+ }
48
+ return {};
49
+ }
36
50
  });
37
51
  muiTheme = deepmerge(muiTheme, other);
38
52
  muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);