@mui/material 5.13.3 → 5.13.4

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.
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.default = exports.PopoverRoot = exports.PopoverPaper = void 0;
8
8
  exports.getOffsetLeft = getOffsetLeft;
9
9
  exports.getOffsetTop = getOffsetTop;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -26,7 +26,8 @@ var _Paper = _interopRequireDefault(require("../Paper"));
26
26
  var _popoverClasses = require("./popoverClasses");
27
27
  var _jsxRuntime = require("react/jsx-runtime");
28
28
  const _excluded = ["onEntering"],
29
- _excluded2 = ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps"];
29
+ _excluded2 = ["action", "anchorEl", "anchorOrigin", "anchorPosition", "anchorReference", "children", "className", "container", "elevation", "marginThreshold", "open", "PaperProps", "slots", "slotProps", "transformOrigin", "TransitionComponent", "transitionDuration", "TransitionProps"],
30
+ _excluded3 = ["slotProps"];
30
31
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
32
33
  function getOffsetTop(rect, vertical) {
@@ -72,6 +73,7 @@ const PopoverRoot = (0, _styled.default)(_Modal.default, {
72
73
  slot: 'Root',
73
74
  overridesResolver: (props, styles) => styles.root
74
75
  })({});
76
+ exports.PopoverRoot = PopoverRoot;
75
77
  const PopoverPaper = (0, _styled.default)(_Paper.default, {
76
78
  name: 'MuiPopover',
77
79
  slot: 'Paper',
@@ -89,7 +91,9 @@ const PopoverPaper = (0, _styled.default)(_Paper.default, {
89
91
  // We disable the focus ring for mouse, touch and keyboard users.
90
92
  outline: 0
91
93
  });
94
+ exports.PopoverPaper = PopoverPaper;
92
95
  const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
96
+ var _slotProps$paper, _slots$root, _slots$paper;
93
97
  const props = (0, _useThemeProps.default)({
94
98
  props: inProps,
95
99
  name: 'MuiPopover'
@@ -109,7 +113,9 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
109
113
  elevation = 8,
110
114
  marginThreshold = 16,
111
115
  open,
112
- PaperProps = {},
116
+ PaperProps: PaperPropsProp = {},
117
+ slots,
118
+ slotProps,
113
119
  transformOrigin = {
114
120
  vertical: 'top',
115
121
  horizontal: 'left'
@@ -122,14 +128,15 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
122
128
  } = props,
123
129
  TransitionProps = (0, _objectWithoutPropertiesLoose2.default)(props.TransitionProps, _excluded),
124
130
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded2);
131
+ const externalPaperSlotProps = (_slotProps$paper = slotProps == null ? void 0 : slotProps.paper) != null ? _slotProps$paper : PaperPropsProp;
125
132
  const paperRef = React.useRef();
126
- const handlePaperRef = (0, _useForkRef.default)(paperRef, PaperProps.ref);
133
+ const handlePaperRef = (0, _useForkRef.default)(paperRef, externalPaperSlotProps.ref);
127
134
  const ownerState = (0, _extends2.default)({}, props, {
128
135
  anchorOrigin,
129
136
  anchorReference,
130
137
  elevation,
131
138
  marginThreshold,
132
- PaperProps,
139
+ externalPaperSlotProps,
133
140
  transformOrigin,
134
141
  TransitionComponent,
135
142
  transitionDuration: transitionDurationProp,
@@ -294,16 +301,46 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
294
301
  // If the anchorEl prop is provided, use its parent body element as the container
295
302
  // If neither are provided let the Modal take care of choosing the container
296
303
  const container = containerProp || (anchorEl ? (0, _ownerDocument.default)(resolveAnchorEl(anchorEl)).body : undefined);
297
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverRoot, (0, _extends2.default)({
298
- BackdropProps: {
299
- invisible: true
304
+ const RootSlot = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : PopoverRoot;
305
+ const PaperSlot = (_slots$paper = slots == null ? void 0 : slots.paper) != null ? _slots$paper : PopoverPaper;
306
+ const paperProps = (0, _base.useSlotProps)({
307
+ elementType: PaperSlot,
308
+ externalSlotProps: (0, _extends2.default)({}, externalPaperSlotProps, {
309
+ style: isPositioned ? externalPaperSlotProps.style : (0, _extends2.default)({}, externalPaperSlotProps.style, {
310
+ opacity: 0
311
+ })
312
+ }),
313
+ additionalProps: {
314
+ elevation,
315
+ ref: handlePaperRef
300
316
  },
301
- className: (0, _clsx.default)(classes.root, className),
302
- container: container,
303
- open: open,
304
- ref: ref,
305
- ownerState: ownerState
306
- }, other, {
317
+ ownerState,
318
+ className: (0, _clsx.default)(classes.paper, externalPaperSlotProps == null ? void 0 : externalPaperSlotProps.className)
319
+ });
320
+ const _useSlotProps = (0, _base.useSlotProps)({
321
+ elementType: RootSlot,
322
+ externalSlotProps: (slotProps == null ? void 0 : slotProps.root) || {},
323
+ externalForwardedProps: other,
324
+ additionalProps: {
325
+ ref,
326
+ slotProps: {
327
+ backdrop: {
328
+ invisible: true
329
+ }
330
+ },
331
+ container,
332
+ open
333
+ },
334
+ ownerState,
335
+ className: (0, _clsx.default)(classes.root, className)
336
+ }),
337
+ {
338
+ slotProps: rootSlotPropsProp
339
+ } = _useSlotProps,
340
+ rootProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded3);
341
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootSlot, (0, _extends2.default)({}, rootProps, !(0, _base.isHostComponent)(RootSlot) && {
342
+ slotProps: rootSlotPropsProp
343
+ }, {
307
344
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionComponent, (0, _extends2.default)({
308
345
  appear: true,
309
346
  in: open,
@@ -311,17 +348,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
311
348
  onExited: handleExited,
312
349
  timeout: transitionDuration
313
350
  }, TransitionProps, {
314
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PopoverPaper, (0, _extends2.default)({
315
- elevation: elevation
316
- }, PaperProps, {
317
- ref: handlePaperRef,
318
- className: (0, _clsx.default)(classes.paper, PaperProps.className)
319
- }, isPositioned ? undefined : {
320
- style: (0, _extends2.default)({}, PaperProps.style, {
321
- opacity: 0
322
- })
323
- }, {
324
- ownerState: ownerState,
351
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PaperSlot, (0, _extends2.default)({}, paperProps, {
325
352
  children: children
326
353
  }))
327
354
  }))
@@ -427,11 +454,34 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
427
454
  open: _propTypes.default.bool.isRequired,
428
455
  /**
429
456
  * Props applied to the [`Paper`](/material-ui/api/paper/) element.
457
+ *
458
+ * This prop is an alias for `slotProps.paper` and will be overriden by it if both are used.
459
+ * @deprecated Use `slotProps.paper` instead.
460
+ *
430
461
  * @default {}
431
462
  */
432
463
  PaperProps: _propTypes.default /* @typescript-to-proptypes-ignore */.shape({
433
464
  component: _utils.elementTypeAcceptingRef
434
465
  }),
466
+ /**
467
+ * The extra props for the slot components.
468
+ * You can override the existing props or add new ones.
469
+ *
470
+ * @default {}
471
+ */
472
+ slotProps: _propTypes.default.shape({
473
+ paper: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
474
+ root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
475
+ }),
476
+ /**
477
+ * The components used for each slot inside.
478
+ *
479
+ * @default {}
480
+ */
481
+ slots: _propTypes.default.shape({
482
+ paper: _propTypes.default.elementType,
483
+ root: _propTypes.default.elementType
484
+ }),
435
485
  /**
436
486
  * The system prop that allows defining system overrides as well as additional CSS styles.
437
487
  */
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.13.3
2
+ * @mui/material v5.13.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "5.13.3",
3
+ "version": "5.13.4",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "React components that implement Google's Material Design.",
@@ -46,8 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.21.0",
49
- "@mui/base": "5.0.0-beta.3",
50
- "@mui/core-downloads-tracker": "^5.13.3",
49
+ "@mui/base": "5.0.0-beta.4",
50
+ "@mui/core-downloads-tracker": "^5.13.4",
51
51
  "@mui/system": "^5.13.2",
52
52
  "@mui/types": "^7.2.4",
53
53
  "@mui/utils": "^5.13.1",