@mui/material 5.15.4 → 5.15.5

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 (53) 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/Badge/Badge.js +1 -1
  7. package/CHANGELOG.md +98 -0
  8. package/Divider/Divider.d.ts +1 -0
  9. package/Divider/Divider.js +1 -0
  10. package/Divider/dividerClasses.d.ts +6 -2
  11. package/Rating/Rating.js +1 -10
  12. package/SpeedDial/SpeedDial.js +1 -9
  13. package/index.js +1 -1
  14. package/legacy/Accordion/Accordion.js +44 -7
  15. package/legacy/Alert/Alert.js +1 -1
  16. package/legacy/Badge/Badge.js +1 -1
  17. package/legacy/Divider/Divider.js +1 -0
  18. package/legacy/Rating/Rating.js +1 -10
  19. package/legacy/SpeedDial/SpeedDial.js +1 -9
  20. package/legacy/index.js +1 -1
  21. package/legacy/utils/types.js +1 -0
  22. package/legacy/utils/useSlot.js +71 -0
  23. package/legacy/zero-styled/index.js +2 -0
  24. package/modern/Accordion/Accordion.js +39 -6
  25. package/modern/Alert/Alert.js +1 -1
  26. package/modern/Badge/Badge.js +1 -1
  27. package/modern/Divider/Divider.js +1 -0
  28. package/modern/Rating/Rating.js +1 -10
  29. package/modern/SpeedDial/SpeedDial.js +1 -9
  30. package/modern/index.js +1 -1
  31. package/modern/utils/types.js +1 -0
  32. package/modern/utils/useSlot.js +82 -0
  33. package/modern/zero-styled/index.js +2 -0
  34. package/node/Accordion/Accordion.js +39 -6
  35. package/node/Alert/Alert.js +1 -1
  36. package/node/Badge/Badge.js +3 -3
  37. package/node/Divider/Divider.js +1 -0
  38. package/node/Rating/Rating.js +1 -10
  39. package/node/SpeedDial/SpeedDial.js +2 -10
  40. package/node/index.js +1 -1
  41. package/node/utils/types.js +5 -0
  42. package/node/utils/useSlot.js +88 -0
  43. package/node/zero-styled/index.js +13 -0
  44. package/package.json +7 -7
  45. package/umd/material-ui.development.js +600 -499
  46. package/umd/material-ui.production.min.js +4 -4
  47. package/utils/types.d.ts +27 -0
  48. package/utils/types.js +1 -0
  49. package/utils/useSlot.d.ts +84 -0
  50. package/utils/useSlot.js +82 -0
  51. package/zero-styled/index.d.ts +2 -0
  52. package/zero-styled/index.js +2 -0
  53. package/zero-styled/package.json +6 -0
@@ -0,0 +1,71 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
6
+ import { unstable_useForkRef as useForkRef } from '@mui/utils';
7
+ import { appendOwnerState, resolveComponentProps, mergeSlotProps } from '@mui/base/utils';
8
+ /**
9
+ * An internal function to create a Material UI slot.
10
+ *
11
+ * This is an advanced version of Base UI `useSlotProps` because Material UI allows leaf component to be customized via `component` prop
12
+ * while Base UI does not need to support leaf component customization.
13
+ *
14
+ * @param {string} name: name of the slot
15
+ * @param {object} parameters
16
+ * @returns {[Slot, slotProps]} The slot's React component and the slot's props
17
+ *
18
+ * Note: the returned slot's props
19
+ * - will never contain `component` prop.
20
+ * - might contain `as` prop.
21
+ */
22
+ export default function useSlot(
23
+ /**
24
+ * The slot's name. All Material UI components should have `root` slot.
25
+ *
26
+ * If the name is `root`, the logic behaves differently from other slots,
27
+ * e.g. the `externalForwardedProps` are spread to `root` slot but not other slots.
28
+ */
29
+ name, parameters) {
30
+ var className = parameters.className,
31
+ initialElementType = parameters.elementType,
32
+ ownerState = parameters.ownerState,
33
+ externalForwardedProps = parameters.externalForwardedProps,
34
+ getSlotOwnerState = parameters.getSlotOwnerState,
35
+ internalForwardedProps = parameters.internalForwardedProps,
36
+ useSlotPropsParams = _objectWithoutProperties(parameters, ["className", "elementType", "ownerState", "externalForwardedProps", "getSlotOwnerState", "internalForwardedProps"]);
37
+ var rootComponent = externalForwardedProps.component,
38
+ _externalForwardedPro = externalForwardedProps.slots,
39
+ slots = _externalForwardedPro === void 0 ? _defineProperty({}, name, undefined) : _externalForwardedPro,
40
+ _externalForwardedPro2 = externalForwardedProps.slotProps,
41
+ slotProps = _externalForwardedPro2 === void 0 ? _defineProperty({}, name, undefined) : _externalForwardedPro2,
42
+ other = _objectWithoutProperties(externalForwardedProps, ["component", "slots", "slotProps"]);
43
+ var elementType = slots[name] || initialElementType;
44
+
45
+ // `slotProps[name]` can be a callback that receives the component's ownerState.
46
+ // `resolvedComponentsProps` is always a plain object.
47
+ var resolvedComponentsProps = resolveComponentProps(slotProps[name], ownerState);
48
+ var _mergeSlotProps = mergeSlotProps(_extends({
49
+ className: className
50
+ }, useSlotPropsParams, {
51
+ externalForwardedProps: name === 'root' ? other : undefined,
52
+ externalSlotProps: resolvedComponentsProps
53
+ })),
54
+ _mergeSlotProps$props = _mergeSlotProps.props,
55
+ slotComponent = _mergeSlotProps$props.component,
56
+ mergedProps = _objectWithoutProperties(_mergeSlotProps$props, ["component"]),
57
+ internalRef = _mergeSlotProps.internalRef;
58
+ var ref = useForkRef(internalRef, resolvedComponentsProps == null ? void 0 : resolvedComponentsProps.ref, parameters.ref);
59
+ var slotOwnerState = getSlotOwnerState ? getSlotOwnerState(mergedProps) : {};
60
+ var finalOwnerState = _extends({}, ownerState, slotOwnerState);
61
+ var LeafComponent = name === 'root' ? slotComponent || rootComponent : slotComponent;
62
+ var props = appendOwnerState(elementType, _extends({}, name === 'root' && !rootComponent && !slots[name] && internalForwardedProps, name !== 'root' && !slots[name] && internalForwardedProps, mergedProps, LeafComponent && {
63
+ as: LeafComponent
64
+ }, {
65
+ ref: ref
66
+ }), finalOwnerState);
67
+ Object.keys(slotOwnerState).forEach(function (propName) {
68
+ delete props[propName];
69
+ });
70
+ return [elementType, props];
71
+ }
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export { default as styled } from '../styles/styled';
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
- const _excluded = ["children", "className", "defaultExpanded", "disabled", "disableGutters", "expanded", "onChange", "square", "TransitionComponent", "TransitionProps"];
5
+ const _excluded = ["children", "className", "defaultExpanded", "disabled", "disableGutters", "expanded", "onChange", "square", "slots", "slotProps", "TransitionComponent", "TransitionProps"];
6
6
  import * as React from 'react';
7
7
  import { isFragment } from 'react-is';
8
8
  import PropTypes from 'prop-types';
@@ -15,6 +15,7 @@ import Collapse from '../Collapse';
15
15
  import Paper from '../Paper';
16
16
  import AccordionContext from './AccordionContext';
17
17
  import useControlled from '../utils/useControlled';
18
+ import useSlot from '../utils/useSlot';
18
19
  import accordionClasses, { getAccordionUtilityClass } from './accordionClasses';
19
20
  import { jsx as _jsx } from "react/jsx-runtime";
20
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -127,8 +128,10 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
127
128
  expanded: expandedProp,
128
129
  onChange,
129
130
  square = false,
130
- TransitionComponent = Collapse,
131
- TransitionProps
131
+ slots = {},
132
+ slotProps = {},
133
+ TransitionComponent: TransitionComponentProp,
134
+ TransitionProps: TransitionPropsProp
132
135
  } = props,
133
136
  other = _objectWithoutPropertiesLoose(props, _excluded);
134
137
  const [expanded, setExpandedState] = useControlled({
@@ -157,6 +160,21 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
157
160
  expanded
158
161
  });
159
162
  const classes = useUtilityClasses(ownerState);
163
+ const backwardCompatibleSlots = _extends({
164
+ transition: TransitionComponentProp
165
+ }, slots);
166
+ const backwardCompatibleSlotProps = _extends({
167
+ transition: TransitionPropsProp
168
+ }, slotProps);
169
+ const [TransitionSlot, transitionProps] = useSlot('transition', {
170
+ elementType: Collapse,
171
+ externalForwardedProps: {
172
+ slots: backwardCompatibleSlots,
173
+ slotProps: backwardCompatibleSlotProps
174
+ },
175
+ ownerState
176
+ });
177
+ delete transitionProps.ownerState;
160
178
  return /*#__PURE__*/_jsxs(AccordionRoot, _extends({
161
179
  className: clsx(classes.root, className),
162
180
  ref: ref,
@@ -166,10 +184,10 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
166
184
  children: [/*#__PURE__*/_jsx(AccordionContext.Provider, {
167
185
  value: contextValue,
168
186
  children: summary
169
- }), /*#__PURE__*/_jsx(TransitionComponent, _extends({
187
+ }), /*#__PURE__*/_jsx(TransitionSlot, _extends({
170
188
  in: expanded,
171
189
  timeout: "auto"
172
- }, TransitionProps, {
190
+ }, transitionProps, {
173
191
  children: /*#__PURE__*/_jsx("div", {
174
192
  "aria-labelledby": summary.props.id,
175
193
  id: summary.props['aria-controls'],
@@ -233,6 +251,20 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
233
251
  * @param {boolean} expanded The `expanded` state of the accordion.
234
252
  */
235
253
  onChange: PropTypes.func,
254
+ /**
255
+ * The props used for each slot inside.
256
+ * @default {}
257
+ */
258
+ slotProps: PropTypes.shape({
259
+ transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
260
+ }),
261
+ /**
262
+ * The components used for each slot inside.
263
+ * @default {}
264
+ */
265
+ slots: PropTypes.shape({
266
+ transition: PropTypes.elementType
267
+ }),
236
268
  /**
237
269
  * If `true`, rounded corners are disabled.
238
270
  * @default false
@@ -245,12 +277,13 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
245
277
  /**
246
278
  * The component used for the transition.
247
279
  * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
248
- * @default Collapse
280
+ * @deprecated Use `slots.transition` instead. This prop will be removed in v7.
249
281
  */
250
282
  TransitionComponent: PropTypes.elementType,
251
283
  /**
252
284
  * Props applied to the transition element.
253
285
  * By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component.
286
+ * @deprecated Use `slotProps.transition` instead. This prop will be removed in v7.
254
287
  */
255
288
  TransitionProps: PropTypes.object
256
289
  } : void 0;
@@ -288,7 +288,7 @@ process.env.NODE_ENV !== "production" ? Alert.propTypes /* remove-proptypes */ =
288
288
  * The severity of the alert. This defines the color and icon used.
289
289
  * @default 'success'
290
290
  */
291
- severity: PropTypes.oneOf(['error', 'info', 'success', 'warning']),
291
+ severity: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'success', 'warning']), PropTypes.string]),
292
292
  /**
293
293
  * The extra props for the slot components.
294
294
  * You can override the existing props or add new ones.
@@ -10,7 +10,7 @@ import { usePreviousProps } from '@mui/utils';
10
10
  import { unstable_composeClasses as composeClasses } from '@mui/base/composeClasses';
11
11
  import { useBadge } from '@mui/base/useBadge';
12
12
  import { useSlotProps } from '@mui/base';
13
- import styled from '../styles/styled';
13
+ import { styled } from '../zero-styled';
14
14
  import useThemeProps from '../styles/useThemeProps';
15
15
  import capitalize from '../utils/capitalize';
16
16
  import badgeClasses, { getBadgeUtilityClass } from './badgeClasses';
@@ -221,6 +221,7 @@ process.env.NODE_ENV !== "production" ? Divider.propTypes /* remove-proptypes */
221
221
  /**
222
222
  * If `true`, the divider will have a lighter color.
223
223
  * @default false
224
+ * @deprecated Use <Divider sx={{ bgcolor: '#eee' }} /> (or any color) instead.
224
225
  */
225
226
  light: PropTypes.bool,
226
227
  /**
@@ -7,7 +7,7 @@ const _excluded = ["value"],
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import clsx from 'clsx';
10
- import { chainPropTypes, visuallyHidden } from '@mui/utils';
10
+ import { chainPropTypes, visuallyHidden, clamp } from '@mui/utils';
11
11
  import { unstable_composeClasses as composeClasses } from '@mui/base/composeClasses';
12
12
  import useTheme from '../styles/useTheme';
13
13
  import { capitalize, useForkRef, useIsFocusVisible, useControlled, unstable_useId as useId } from '../utils';
@@ -18,15 +18,6 @@ import styled, { slotShouldForwardProp } from '../styles/styled';
18
18
  import ratingClasses, { getRatingUtilityClass } from './ratingClasses';
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
- function clamp(value, min, max) {
22
- if (value < min) {
23
- return min;
24
- }
25
- if (value > max) {
26
- return max;
27
- }
28
- return value;
29
- }
30
21
  function getDecimalPrecision(num) {
31
22
  const decimalPart = num.toString().split('.')[1];
32
23
  return decimalPart ? decimalPart.length : 0;
@@ -10,6 +10,7 @@ import { isFragment } from 'react-is';
10
10
  import PropTypes from 'prop-types';
11
11
  import clsx from 'clsx';
12
12
  import { unstable_composeClasses as composeClasses } from '@mui/base/composeClasses';
13
+ import { clamp } from '@mui/utils';
13
14
  import styled from '../styles/styled';
14
15
  import useThemeProps from '../styles/useThemeProps';
15
16
  import useTheme from '../styles/useTheme';
@@ -44,15 +45,6 @@ function getOrientation(direction) {
44
45
  }
45
46
  return undefined;
46
47
  }
47
- function clamp(value, min, max) {
48
- if (value < min) {
49
- return min;
50
- }
51
- if (value > max) {
52
- return max;
53
- }
54
- return value;
55
- }
56
48
  const dialRadius = 32;
57
49
  const spacingActions = 16;
58
50
  const SpeedDialRoot = styled('div', {
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.15.4
2
+ * @mui/material v5.15.5
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,82 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
+ const _excluded = ["className", "elementType", "ownerState", "externalForwardedProps", "getSlotOwnerState", "internalForwardedProps"],
6
+ _excluded2 = ["component", "slots", "slotProps"],
7
+ _excluded3 = ["component"];
8
+ import { unstable_useForkRef as useForkRef } from '@mui/utils';
9
+ import { appendOwnerState, resolveComponentProps, mergeSlotProps } from '@mui/base/utils';
10
+ /**
11
+ * An internal function to create a Material UI slot.
12
+ *
13
+ * This is an advanced version of Base UI `useSlotProps` because Material UI allows leaf component to be customized via `component` prop
14
+ * while Base UI does not need to support leaf component customization.
15
+ *
16
+ * @param {string} name: name of the slot
17
+ * @param {object} parameters
18
+ * @returns {[Slot, slotProps]} The slot's React component and the slot's props
19
+ *
20
+ * Note: the returned slot's props
21
+ * - will never contain `component` prop.
22
+ * - might contain `as` prop.
23
+ */
24
+ export default function useSlot(
25
+ /**
26
+ * The slot's name. All Material UI components should have `root` slot.
27
+ *
28
+ * If the name is `root`, the logic behaves differently from other slots,
29
+ * e.g. the `externalForwardedProps` are spread to `root` slot but not other slots.
30
+ */
31
+ name, parameters) {
32
+ const {
33
+ className,
34
+ elementType: initialElementType,
35
+ ownerState,
36
+ externalForwardedProps,
37
+ getSlotOwnerState,
38
+ internalForwardedProps
39
+ } = parameters,
40
+ useSlotPropsParams = _objectWithoutPropertiesLoose(parameters, _excluded);
41
+ const {
42
+ component: rootComponent,
43
+ slots = {
44
+ [name]: undefined
45
+ },
46
+ slotProps = {
47
+ [name]: undefined
48
+ }
49
+ } = externalForwardedProps,
50
+ other = _objectWithoutPropertiesLoose(externalForwardedProps, _excluded2);
51
+ const elementType = slots[name] || initialElementType;
52
+
53
+ // `slotProps[name]` can be a callback that receives the component's ownerState.
54
+ // `resolvedComponentsProps` is always a plain object.
55
+ const resolvedComponentsProps = resolveComponentProps(slotProps[name], ownerState);
56
+ const _mergeSlotProps = mergeSlotProps(_extends({
57
+ className
58
+ }, useSlotPropsParams, {
59
+ externalForwardedProps: name === 'root' ? other : undefined,
60
+ externalSlotProps: resolvedComponentsProps
61
+ })),
62
+ {
63
+ props: {
64
+ component: slotComponent
65
+ },
66
+ internalRef
67
+ } = _mergeSlotProps,
68
+ mergedProps = _objectWithoutPropertiesLoose(_mergeSlotProps.props, _excluded3);
69
+ const ref = useForkRef(internalRef, resolvedComponentsProps?.ref, parameters.ref);
70
+ const slotOwnerState = getSlotOwnerState ? getSlotOwnerState(mergedProps) : {};
71
+ const finalOwnerState = _extends({}, ownerState, slotOwnerState);
72
+ const LeafComponent = name === 'root' ? slotComponent || rootComponent : slotComponent;
73
+ const props = appendOwnerState(elementType, _extends({}, name === 'root' && !rootComponent && !slots[name] && internalForwardedProps, name !== 'root' && !slots[name] && internalForwardedProps, mergedProps, LeafComponent && {
74
+ as: LeafComponent
75
+ }, {
76
+ ref
77
+ }), finalOwnerState);
78
+ Object.keys(slotOwnerState).forEach(propName => {
79
+ delete props[propName];
80
+ });
81
+ return [elementType, props];
82
+ }
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line import/prefer-default-export
2
+ export { default as styled } from '../styles/styled';
@@ -20,9 +20,10 @@ var _Collapse = _interopRequireDefault(require("../Collapse"));
20
20
  var _Paper = _interopRequireDefault(require("../Paper"));
21
21
  var _AccordionContext = _interopRequireDefault(require("./AccordionContext"));
22
22
  var _useControlled = _interopRequireDefault(require("../utils/useControlled"));
23
+ var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
23
24
  var _accordionClasses = _interopRequireWildcard(require("./accordionClasses"));
24
25
  var _jsxRuntime = require("react/jsx-runtime");
25
- const _excluded = ["children", "className", "defaultExpanded", "disabled", "disableGutters", "expanded", "onChange", "square", "TransitionComponent", "TransitionProps"];
26
+ const _excluded = ["children", "className", "defaultExpanded", "disabled", "disableGutters", "expanded", "onChange", "square", "slots", "slotProps", "TransitionComponent", "TransitionProps"];
26
27
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
28
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
29
  const useUtilityClasses = ownerState => {
@@ -134,8 +135,10 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
134
135
  expanded: expandedProp,
135
136
  onChange,
136
137
  square = false,
137
- TransitionComponent = _Collapse.default,
138
- TransitionProps
138
+ slots = {},
139
+ slotProps = {},
140
+ TransitionComponent: TransitionComponentProp,
141
+ TransitionProps: TransitionPropsProp
139
142
  } = props,
140
143
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
141
144
  const [expanded, setExpandedState] = (0, _useControlled.default)({
@@ -164,6 +167,21 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
164
167
  expanded
165
168
  });
166
169
  const classes = useUtilityClasses(ownerState);
170
+ const backwardCompatibleSlots = (0, _extends2.default)({
171
+ transition: TransitionComponentProp
172
+ }, slots);
173
+ const backwardCompatibleSlotProps = (0, _extends2.default)({
174
+ transition: TransitionPropsProp
175
+ }, slotProps);
176
+ const [TransitionSlot, transitionProps] = (0, _useSlot.default)('transition', {
177
+ elementType: _Collapse.default,
178
+ externalForwardedProps: {
179
+ slots: backwardCompatibleSlots,
180
+ slotProps: backwardCompatibleSlotProps
181
+ },
182
+ ownerState
183
+ });
184
+ delete transitionProps.ownerState;
167
185
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(AccordionRoot, (0, _extends2.default)({
168
186
  className: (0, _clsx.default)(classes.root, className),
169
187
  ref: ref,
@@ -173,10 +191,10 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
173
191
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AccordionContext.default.Provider, {
174
192
  value: contextValue,
175
193
  children: summary
176
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionComponent, (0, _extends2.default)({
194
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionSlot, (0, _extends2.default)({
177
195
  in: expanded,
178
196
  timeout: "auto"
179
- }, TransitionProps, {
197
+ }, transitionProps, {
180
198
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
181
199
  "aria-labelledby": summary.props.id,
182
200
  id: summary.props['aria-controls'],
@@ -240,6 +258,20 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
240
258
  * @param {boolean} expanded The `expanded` state of the accordion.
241
259
  */
242
260
  onChange: _propTypes.default.func,
261
+ /**
262
+ * The props used for each slot inside.
263
+ * @default {}
264
+ */
265
+ slotProps: _propTypes.default.shape({
266
+ transition: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
267
+ }),
268
+ /**
269
+ * The components used for each slot inside.
270
+ * @default {}
271
+ */
272
+ slots: _propTypes.default.shape({
273
+ transition: _propTypes.default.elementType
274
+ }),
243
275
  /**
244
276
  * If `true`, rounded corners are disabled.
245
277
  * @default false
@@ -252,12 +284,13 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
252
284
  /**
253
285
  * The component used for the transition.
254
286
  * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
255
- * @default Collapse
287
+ * @deprecated Use `slots.transition` instead. This prop will be removed in v7.
256
288
  */
257
289
  TransitionComponent: _propTypes.default.elementType,
258
290
  /**
259
291
  * Props applied to the transition element.
260
292
  * By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component.
293
+ * @deprecated Use `slotProps.transition` instead. This prop will be removed in v7.
261
294
  */
262
295
  TransitionProps: _propTypes.default.object
263
296
  } : void 0;
@@ -296,7 +296,7 @@ process.env.NODE_ENV !== "production" ? Alert.propTypes /* remove-proptypes */ =
296
296
  * The severity of the alert. This defines the color and icon used.
297
297
  * @default 'success'
298
298
  */
299
- severity: _propTypes.default.oneOf(['error', 'info', 'success', 'warning']),
299
+ severity: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['error', 'info', 'success', 'warning']), _propTypes.default.string]),
300
300
  /**
301
301
  * The extra props for the slot components.
302
302
  * You can override the existing props or add new ones.
@@ -15,7 +15,7 @@ var _utils = require("@mui/utils");
15
15
  var _composeClasses = require("@mui/base/composeClasses");
16
16
  var _useBadge = require("@mui/base/useBadge");
17
17
  var _base = require("@mui/base");
18
- var _styled = _interopRequireDefault(require("../styles/styled"));
18
+ var _zeroStyled = require("../zero-styled");
19
19
  var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
20
20
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
21
21
  var _badgeClasses = _interopRequireWildcard(require("./badgeClasses"));
@@ -40,7 +40,7 @@ const useUtilityClasses = ownerState => {
40
40
  };
41
41
  return (0, _composeClasses.unstable_composeClasses)(slots, _badgeClasses.getBadgeUtilityClass, classes);
42
42
  };
43
- const BadgeRoot = (0, _styled.default)('span', {
43
+ const BadgeRoot = (0, _zeroStyled.styled)('span', {
44
44
  name: 'MuiBadge',
45
45
  slot: 'Root',
46
46
  overridesResolver: (props, styles) => styles.root
@@ -51,7 +51,7 @@ const BadgeRoot = (0, _styled.default)('span', {
51
51
  verticalAlign: 'middle',
52
52
  flexShrink: 0
53
53
  });
54
- const BadgeBadge = (0, _styled.default)('span', {
54
+ const BadgeBadge = (0, _zeroStyled.styled)('span', {
55
55
  name: 'MuiBadge',
56
56
  slot: 'Badge',
57
57
  overridesResolver: (props, styles) => {
@@ -229,6 +229,7 @@ process.env.NODE_ENV !== "production" ? Divider.propTypes /* remove-proptypes */
229
229
  /**
230
230
  * If `true`, the divider will have a lighter color.
231
231
  * @default false
232
+ * @deprecated Use <Divider sx={{ bgcolor: '#eee' }} /> (or any color) instead.
232
233
  */
233
234
  light: _propTypes.default.bool,
234
235
  /**
@@ -25,15 +25,6 @@ const _excluded = ["value"],
25
25
  _excluded2 = ["className", "defaultValue", "disabled", "emptyIcon", "emptyLabelText", "getLabelText", "highlightSelectedOnly", "icon", "IconContainerComponent", "max", "name", "onChange", "onChangeActive", "onMouseLeave", "onMouseMove", "precision", "readOnly", "size", "value"];
26
26
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
27
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
28
- function clamp(value, min, max) {
29
- if (value < min) {
30
- return min;
31
- }
32
- if (value > max) {
33
- return max;
34
- }
35
- return value;
36
- }
37
28
  function getDecimalPrecision(num) {
38
29
  const decimalPart = num.toString().split('.')[1];
39
30
  return decimalPart ? decimalPart.length : 0;
@@ -354,7 +345,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
354
345
  percent = (event.clientX - left) / containerWidth;
355
346
  }
356
347
  let newHover = roundValueToPrecision(max * percent + precision / 2, precision);
357
- newHover = clamp(newHover, precision, max);
348
+ newHover = (0, _utils.clamp)(newHover, precision, max);
358
349
  setState(prev => prev.hover === newHover && prev.focus === newHover ? prev : {
359
350
  hover: newHover,
360
351
  focus: newHover
@@ -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.5
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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
+ }