@mui/material 5.11.5 → 5.11.7

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 (72) hide show
  1. package/Box/Box.d.ts +3 -2
  2. package/Button/Button.js +0 -2
  3. package/CHANGELOG.md +160 -0
  4. package/Checkbox/Checkbox.d.ts +3 -0
  5. package/Checkbox/Checkbox.js +3 -0
  6. package/FormLabel/FormLabel.d.ts +51 -45
  7. package/InputLabel/InputLabel.d.ts +70 -57
  8. package/Radio/Radio.js +2 -0
  9. package/Slider/Slider.d.ts +215 -35
  10. package/Slider/Slider.js +7 -7
  11. package/Slider/SliderValueLabel.d.ts +1 -1
  12. package/Slider/SliderValueLabel.js +3 -0
  13. package/Slider/SliderValueLabel.types.d.ts +1 -1
  14. package/Slider/index.d.ts +2 -0
  15. package/Slider/index.js +2 -1
  16. package/Slider/sliderClasses.d.ts +40 -11
  17. package/Slider/sliderClasses.js +5 -3
  18. package/SwipeableDrawer/SwipeableDrawer.d.ts +15 -0
  19. package/SwipeableDrawer/SwipeableDrawer.js +48 -17
  20. package/Switch/Switch.js +2 -0
  21. package/TabScrollButton/TabScrollButton.d.ts +1 -0
  22. package/TabScrollButton/TabScrollButton.js +1 -0
  23. package/Tooltip/Tooltip.js +9 -9
  24. package/index.js +1 -1
  25. package/internal/SwitchBase.d.ts +5 -0
  26. package/internal/SwitchBase.js +1 -1
  27. package/legacy/Button/Button.js +0 -2
  28. package/legacy/Checkbox/Checkbox.js +3 -0
  29. package/legacy/Radio/Radio.js +2 -0
  30. package/legacy/Slider/Slider.js +7 -7
  31. package/legacy/Slider/SliderValueLabel.js +3 -0
  32. package/legacy/Slider/index.js +2 -1
  33. package/legacy/Slider/sliderClasses.js +5 -3
  34. package/legacy/SwipeableDrawer/SwipeableDrawer.js +50 -17
  35. package/legacy/Switch/Switch.js +2 -0
  36. package/legacy/TabScrollButton/TabScrollButton.js +1 -0
  37. package/legacy/Tooltip/Tooltip.js +9 -9
  38. package/legacy/index.js +1 -1
  39. package/legacy/internal/SwitchBase.js +2 -1
  40. package/legacy/styles/CssVarsProvider.js +3 -1
  41. package/modern/Button/Button.js +0 -2
  42. package/modern/Checkbox/Checkbox.js +3 -0
  43. package/modern/Radio/Radio.js +2 -0
  44. package/modern/Slider/Slider.js +7 -7
  45. package/modern/Slider/SliderValueLabel.js +3 -0
  46. package/modern/Slider/index.js +2 -1
  47. package/modern/Slider/sliderClasses.js +5 -3
  48. package/modern/SwipeableDrawer/SwipeableDrawer.js +47 -17
  49. package/modern/Switch/Switch.js +2 -0
  50. package/modern/TabScrollButton/TabScrollButton.js +1 -0
  51. package/modern/Tooltip/Tooltip.js +9 -9
  52. package/modern/index.js +1 -1
  53. package/modern/internal/SwitchBase.js +1 -1
  54. package/modern/styles/CssVarsProvider.js +3 -1
  55. package/node/Button/Button.js +0 -2
  56. package/node/Checkbox/Checkbox.js +3 -0
  57. package/node/Radio/Radio.js +2 -0
  58. package/node/Slider/Slider.js +6 -6
  59. package/node/Slider/SliderValueLabel.js +3 -0
  60. package/node/Slider/index.js +12 -2
  61. package/node/Slider/sliderClasses.js +6 -3
  62. package/node/SwipeableDrawer/SwipeableDrawer.js +48 -17
  63. package/node/Switch/Switch.js +2 -0
  64. package/node/TabScrollButton/TabScrollButton.js +1 -0
  65. package/node/Tooltip/Tooltip.js +9 -9
  66. package/node/index.js +1 -1
  67. package/node/internal/SwitchBase.js +1 -1
  68. package/node/styles/CssVarsProvider.js +3 -1
  69. package/package.json +5 -5
  70. package/styles/CssVarsProvider.js +3 -1
  71. package/umd/material-ui.development.js +121 -58
  72. package/umd/material-ui.production.min.js +20 -20
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["BackdropProps"],
4
- _excluded2 = ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"];
4
+ _excluded2 = ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "allowSwipeInChildren", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"];
5
5
  import * as React from 'react';
6
6
  import { flushSync } from 'react-dom';
7
7
  import PropTypes from 'prop-types';
@@ -133,6 +133,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
133
133
  disableSwipeToOpen = iOS,
134
134
  hideBackdrop,
135
135
  hysteresis = 0.52,
136
+ allowSwipeInChildren = false,
136
137
  minFlingVelocity = 450,
137
138
  ModalProps: {
138
139
  BackdropProps
@@ -252,6 +253,30 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
252
253
  });
253
254
  }
254
255
  });
256
+ const startMaybeSwiping = (force = false) => {
257
+ if (!maybeSwiping) {
258
+ // on Safari Mobile, if you want to be able to have the 'click' event fired on child elements, nothing in the DOM can be changed.
259
+ // this is because Safari Mobile will not fire any mouse events (still fires touch though) if the DOM changes during mousemove.
260
+ // so do this change on first touchmove instead of touchstart
261
+ if (force || !(disableDiscovery && allowSwipeInChildren)) {
262
+ flushSync(() => {
263
+ setMaybeSwiping(true);
264
+ });
265
+ }
266
+ const horizontalSwipe = isHorizontal(anchor);
267
+ if (!open && paperRef.current) {
268
+ // The ref may be null when a parent component updates while swiping.
269
+ setPosition(getMaxTranslate(horizontalSwipe, paperRef.current) + (disableDiscovery ? 15 : -DRAG_STARTED_SIGNAL), {
270
+ changeTransition: false
271
+ });
272
+ }
273
+ swipeInstance.current.velocity = 0;
274
+ swipeInstance.current.lastTime = null;
275
+ swipeInstance.current.lastTranslate = null;
276
+ swipeInstance.current.paperHit = false;
277
+ touchDetected.current = true;
278
+ }
279
+ };
255
280
  const handleBodyTouchMove = useEventCallback(nativeEvent => {
256
281
  // the ref may be null when a parent component updates while swiping
257
282
  if (!paperRef.current || !touchDetected.current) {
@@ -262,6 +287,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
262
287
  if (claimedSwipeInstance !== null && claimedSwipeInstance !== swipeInstance.current) {
263
288
  return;
264
289
  }
290
+ startMaybeSwiping(true);
265
291
  const anchorRtl = getAnchor(theme, anchor);
266
292
  const horizontalSwipe = isHorizontal(anchor);
267
293
  const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, ownerDocument(nativeEvent.currentTarget));
@@ -372,7 +398,11 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
372
398
  const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, ownerDocument(nativeEvent.currentTarget));
373
399
  const currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, ownerWindow(nativeEvent.currentTarget));
374
400
  if (!open) {
375
- if (disableSwipeToOpen || nativeEvent.target !== swipeAreaRef.current) {
401
+ // logic for if swipe should be ignored:
402
+ // if disableSwipeToOpen
403
+ // if target != swipeArea, and target is not a child of paper ref
404
+ // if is a child of paper ref, and `allowSwipeInChildren` does not allow it
405
+ if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || paperRef.current?.contains(nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
376
406
  return;
377
407
  }
378
408
  if (horizontalSwipe) {
@@ -387,20 +417,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
387
417
  claimedSwipeInstance = null;
388
418
  swipeInstance.current.startX = currentX;
389
419
  swipeInstance.current.startY = currentY;
390
- flushSync(() => {
391
- setMaybeSwiping(true);
392
- });
393
- if (!open && paperRef.current) {
394
- // The ref may be null when a parent component updates while swiping.
395
- setPosition(getMaxTranslate(horizontalSwipe, paperRef.current) + (disableDiscovery ? 15 : -DRAG_STARTED_SIGNAL), {
396
- changeTransition: false
397
- });
398
- }
399
- swipeInstance.current.velocity = 0;
400
- swipeInstance.current.lastTime = null;
401
- swipeInstance.current.lastTranslate = null;
402
- swipeInstance.current.paperHit = false;
403
- touchDetected.current = true;
420
+ startMaybeSwiping();
404
421
  });
405
422
  React.useEffect(() => {
406
423
  if (variant === 'temporary') {
@@ -448,7 +465,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
448
465
  hideBackdrop: hideBackdrop,
449
466
  PaperProps: _extends({}, PaperProps, {
450
467
  style: _extends({
451
- pointerEvents: variant === 'temporary' && !open ? 'none' : ''
468
+ pointerEvents: variant === 'temporary' && !open && !allowSwipeInChildren ? 'none' : ''
452
469
  }, PaperProps.style),
453
470
  ref: handleRef
454
471
  }),
@@ -470,6 +487,19 @@ process.env.NODE_ENV !== "production" ? SwipeableDrawer.propTypes /* remove-prop
470
487
  // | These PropTypes are generated from the TypeScript type definitions |
471
488
  // | To update them edit the d.ts file and run "yarn proptypes" |
472
489
  // ----------------------------------------------------------------------
490
+ /**
491
+ * If set to true, the swipe event will open the drawer even if the user begins the swipe on one of the drawer's children.
492
+ * This can be useful in scenarios where the drawer is partially visible.
493
+ * You can customize it further with a callback that determines which children the user can drag over to open the drawer
494
+ * (for example, to ignore other elements that handle touch move events, like sliders).
495
+ *
496
+ * @param {TouchEvent} event The 'touchstart' event
497
+ * @param {HTMLDivElement} swipeArea The swipe area element
498
+ * @param {HTMLDivElement} paper The drawer's paper element
499
+ *
500
+ * @default false
501
+ */
502
+ allowSwipeInChildren: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
473
503
  /**
474
504
  * @ignore
475
505
  */
@@ -258,6 +258,7 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
258
258
  disabled: PropTypes.bool,
259
259
  /**
260
260
  * If `true`, the ripple effect is disabled.
261
+ * @default false
261
262
  */
262
263
  disableRipple: PropTypes.bool,
263
264
  /**
@@ -294,6 +295,7 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
294
295
  onChange: PropTypes.func,
295
296
  /**
296
297
  * If `true`, the `input` element is required.
298
+ * @default false
297
299
  */
298
300
  required: PropTypes.bool,
299
301
  /**
@@ -105,6 +105,7 @@ process.env.NODE_ENV !== "production" ? TabScrollButton.propTypes /* remove-prop
105
105
  direction: PropTypes.oneOf(['left', 'right']).isRequired,
106
106
  /**
107
107
  * If `true`, the component is disabled.
108
+ * @default false
108
109
  */
109
110
  disabled: PropTypes.bool,
110
111
  /**
@@ -193,6 +193,10 @@ const TooltipArrow = styled('span', {
193
193
  }));
194
194
  let hystersisOpen = false;
195
195
  let hystersisTimer = null;
196
+ let cursorPosition = {
197
+ x: 0,
198
+ y: 0
199
+ };
196
200
  export function testReset() {
197
201
  hystersisOpen = false;
198
202
  clearTimeout(hystersisTimer);
@@ -433,17 +437,13 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
433
437
  if (!title && title !== 0) {
434
438
  open = false;
435
439
  }
436
- const positionRef = React.useRef({
437
- x: 0,
438
- y: 0
439
- });
440
440
  const popperRef = React.useRef();
441
441
  const handleMouseMove = event => {
442
442
  const childrenProps = children.props;
443
443
  if (childrenProps.onMouseMove) {
444
444
  childrenProps.onMouseMove(event);
445
445
  }
446
- positionRef.current = {
446
+ cursorPosition = {
447
447
  x: event.clientX,
448
448
  y: event.clientY
449
449
  };
@@ -548,10 +548,10 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
548
548
  placement: placement,
549
549
  anchorEl: followCursor ? {
550
550
  getBoundingClientRect: () => ({
551
- top: positionRef.current.y,
552
- left: positionRef.current.x,
553
- right: positionRef.current.x,
554
- bottom: positionRef.current.y,
551
+ top: cursorPosition.y,
552
+ left: cursorPosition.x,
553
+ right: cursorPosition.x,
554
+ bottom: cursorPosition.y,
555
555
  width: 0,
556
556
  height: 0
557
557
  })
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.11.5
2
+ * @mui/material v5.11.7
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -72,7 +72,7 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
72
72
  onChange,
73
73
  onFocus,
74
74
  readOnly,
75
- required,
75
+ required = false,
76
76
  tabIndex,
77
77
  type,
78
78
  value
@@ -3,7 +3,9 @@ import { unstable_createCssVarsProvider as createCssVarsProvider, unstable_style
3
3
  import experimental_extendTheme from './experimental_extendTheme';
4
4
  import createTypography from './createTypography';
5
5
  import excludeVariablesFromRoot from './excludeVariablesFromRoot';
6
- const shouldSkipGeneratingVar = keys => !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || keys[0] === 'palette' && !!keys[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
6
+ const shouldSkipGeneratingVar = keys => !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
7
+ // ends with sxConfig
8
+ keys[0] === 'palette' && !!keys[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
7
9
  const defaultTheme = experimental_extendTheme();
8
10
  const {
9
11
  CssVarsProvider,
@@ -121,8 +121,6 @@ const ButtonRoot = (0, _styled.default)(_ButtonBase.default, {
121
121
  color: (theme.vars || theme).palette.action.disabled
122
122
  }, ownerState.variant === 'outlined' && {
123
123
  border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
124
- }, ownerState.variant === 'outlined' && ownerState.color === 'secondary' && {
125
- border: `1px solid ${(theme.vars || theme).palette.action.disabled}`
126
124
  }, ownerState.variant === 'contained' && {
127
125
  color: (theme.vars || theme).palette.action.disabled,
128
126
  boxShadow: (theme.vars || theme).shadows[0],
@@ -149,10 +149,12 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
149
149
  defaultChecked: _propTypes.default.bool,
150
150
  /**
151
151
  * If `true`, the component is disabled.
152
+ * @default false
152
153
  */
153
154
  disabled: _propTypes.default.bool,
154
155
  /**
155
156
  * If `true`, the ripple effect is disabled.
157
+ * @default false
156
158
  */
157
159
  disableRipple: _propTypes.default.bool,
158
160
  /**
@@ -194,6 +196,7 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
194
196
  onChange: _propTypes.default.func,
195
197
  /**
196
198
  * If `true`, the `input` element is required.
199
+ * @default false
197
200
  */
198
201
  required: _propTypes.default.bool,
199
202
  /**
@@ -165,6 +165,7 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
165
165
  disabled: _propTypes.default.bool,
166
166
  /**
167
167
  * If `true`, the ripple effect is disabled.
168
+ * @default false
168
169
  */
169
170
  disableRipple: _propTypes.default.bool,
170
171
  /**
@@ -198,6 +199,7 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
198
199
  onChange: _propTypes.default.func,
199
200
  /**
200
201
  * If `true`, the `input` element is required.
202
+ * @default false
201
203
  */
202
204
  required: _propTypes.default.bool,
203
205
  /**
@@ -20,7 +20,7 @@ var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
20
20
  var _shouldSpreadAdditionalProps = _interopRequireDefault(require("../utils/shouldSpreadAdditionalProps"));
21
21
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
22
22
  var _SliderValueLabel = _interopRequireDefault(require("./SliderValueLabel"));
23
- var _sliderClasses = _interopRequireDefault(require("./sliderClasses"));
23
+ var _sliderClasses = _interopRequireWildcard(require("./sliderClasses"));
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
25
  const _excluded = ["aria-label", "aria-valuetext", "aria-labelledby", "component", "components", "componentsProps", "color", "classes", "className", "disableSwap", "disabled", "getAriaLabel", "getAriaValueText", "marks", "max", "min", "name", "onChange", "onChangeCommitted", "orientation", "size", "step", "scale", "slotProps", "slots", "tabIndex", "track", "value", "valueLabelDisplay", "valueLabelFormat"];
26
26
  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); }
@@ -269,7 +269,7 @@ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes /* remove-proptype
269
269
  */
270
270
  children: _propTypes.default.node
271
271
  } : void 0;
272
- const SliderValueLabel = (0, _styled.default)(_SliderValueLabel.default, {
272
+ const StyledSliderValueLabel = (0, _styled.default)(_SliderValueLabel.default, {
273
273
  name: 'MuiSlider',
274
274
  slot: 'ValueLabel',
275
275
  overridesResolver: (props, styles) => styles.valueLabel
@@ -327,8 +327,8 @@ const SliderValueLabel = (0, _styled.default)(_SliderValueLabel.default, {
327
327
  fontSize: theme.typography.pxToRem(12),
328
328
  padding: '0.25rem 0.5rem'
329
329
  }));
330
- exports.SliderValueLabel = SliderValueLabel;
331
- process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes /* remove-proptypes */ = {
330
+ exports.SliderValueLabel = StyledSliderValueLabel;
331
+ process.env.NODE_ENV !== "production" ? StyledSliderValueLabel.propTypes /* remove-proptypes */ = {
332
332
  // ----------------------------- Warning --------------------------------
333
333
  // | These PropTypes are generated from the TypeScript type definitions |
334
334
  // | To update them edit the d.ts file and run "yarn proptypes" |
@@ -443,7 +443,7 @@ const useUtilityClasses = ownerState => {
443
443
  disabled: ['disabled'],
444
444
  focusVisible: ['focusVisible']
445
445
  };
446
- return (0, _base.unstable_composeClasses)(slots, _SliderUnstyled.getSliderUtilityClass, classes);
446
+ return (0, _base.unstable_composeClasses)(slots, _sliderClasses.getSliderUtilityClass, classes);
447
447
  };
448
448
  const Forward = ({
449
449
  children
@@ -531,7 +531,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
531
531
  const RailSlot = (_ref2 = (_slots$rail = slots == null ? void 0 : slots.rail) != null ? _slots$rail : components.Rail) != null ? _ref2 : SliderRail;
532
532
  const TrackSlot = (_ref3 = (_slots$track = slots == null ? void 0 : slots.track) != null ? _slots$track : components.Track) != null ? _ref3 : SliderTrack;
533
533
  const ThumbSlot = (_ref4 = (_slots$thumb = slots == null ? void 0 : slots.thumb) != null ? _slots$thumb : components.Thumb) != null ? _ref4 : SliderThumb;
534
- const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : SliderValueLabel;
534
+ const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : StyledSliderValueLabel;
535
535
  const MarkSlot = (_ref6 = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : components.Mark) != null ? _ref6 : SliderMark;
536
536
  const MarkLabelSlot = (_ref7 = (_slots$markLabel = slots == null ? void 0 : slots.markLabel) != null ? _slots$markLabel : components.MarkLabel) != null ? _ref7 : SliderMarkLabel;
537
537
  const InputSlot = (_ref8 = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input) != null ? _ref8 : 'input';
@@ -34,6 +34,9 @@ function SliderValueLabel(props) {
34
34
  value
35
35
  } = props;
36
36
  const classes = useValueLabelClasses(props);
37
+ if (!children) {
38
+ return null;
39
+ }
37
40
  return /*#__PURE__*/React.cloneElement(children, {
38
41
  className: (0, _clsx.default)(children.props.className)
39
42
  }, /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -31,6 +30,17 @@ Object.keys(_Slider).forEach(function (key) {
31
30
  }
32
31
  });
33
32
  });
34
- var _sliderClasses = _interopRequireDefault(require("./sliderClasses"));
33
+ var _sliderClasses = _interopRequireWildcard(require("./sliderClasses"));
34
+ Object.keys(_sliderClasses).forEach(function (key) {
35
+ if (key === "default" || key === "__esModule") return;
36
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
37
+ if (key in exports && exports[key] === _sliderClasses[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _sliderClasses[key];
42
+ }
43
+ });
44
+ });
35
45
  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); }
36
46
  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; }
@@ -5,9 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
+ exports.getSliderUtilityClass = getSliderUtilityClass;
9
9
  var _utils = require("@mui/utils");
10
- var _SliderUnstyled = require("@mui/base/SliderUnstyled");
11
- const sliderClasses = (0, _extends2.default)({}, _SliderUnstyled.sliderUnstyledClasses, (0, _utils.unstable_generateUtilityClasses)('MuiSlider', ['colorPrimary', 'colorSecondary', 'thumbColorPrimary', 'thumbColorSecondary', 'sizeSmall', 'thumbSizeSmall']));
10
+ var _generateUtilityClass = _interopRequireDefault(require("../generateUtilityClass"));
11
+ function getSliderUtilityClass(slot) {
12
+ return (0, _generateUtilityClass.default)('MuiSlider', slot);
13
+ }
14
+ const sliderClasses = (0, _utils.unstable_generateUtilityClasses)('MuiSlider', ['root', 'active', 'colorPrimary', 'colorSecondary', 'disabled', 'dragging', 'focusVisible', 'mark', 'markActive', 'marked', 'markLabel', 'markLabelActive', 'rail', 'sizeSmall', 'thumb', 'thumbColorPrimary', 'thumbColorSecondary', 'track', 'trackInverted', 'trackFalse', 'thumbSizeSmall', 'valueLabel', 'valueLabelOpen', 'valueLabelCircle', 'valueLabelLabel', 'vertical']);
12
15
  var _default = sliderClasses;
13
16
  exports.default = _default;
@@ -25,7 +25,7 @@ var _utils2 = require("../transitions/utils");
25
25
  var _SwipeArea = _interopRequireDefault(require("./SwipeArea"));
26
26
  var _jsxRuntime = require("react/jsx-runtime");
27
27
  const _excluded = ["BackdropProps"],
28
- _excluded2 = ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"];
28
+ _excluded2 = ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "allowSwipeInChildren", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"];
29
29
  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); }
30
30
  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; }
31
31
  // This value is closed to what browsers are using internally to
@@ -141,6 +141,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
141
141
  disableSwipeToOpen = iOS,
142
142
  hideBackdrop,
143
143
  hysteresis = 0.52,
144
+ allowSwipeInChildren = false,
144
145
  minFlingVelocity = 450,
145
146
  ModalProps: {
146
147
  BackdropProps
@@ -260,6 +261,30 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
260
261
  });
261
262
  }
262
263
  });
264
+ const startMaybeSwiping = (force = false) => {
265
+ if (!maybeSwiping) {
266
+ // on Safari Mobile, if you want to be able to have the 'click' event fired on child elements, nothing in the DOM can be changed.
267
+ // this is because Safari Mobile will not fire any mouse events (still fires touch though) if the DOM changes during mousemove.
268
+ // so do this change on first touchmove instead of touchstart
269
+ if (force || !(disableDiscovery && allowSwipeInChildren)) {
270
+ (0, _reactDom.flushSync)(() => {
271
+ setMaybeSwiping(true);
272
+ });
273
+ }
274
+ const horizontalSwipe = (0, _Drawer.isHorizontal)(anchor);
275
+ if (!open && paperRef.current) {
276
+ // The ref may be null when a parent component updates while swiping.
277
+ setPosition(getMaxTranslate(horizontalSwipe, paperRef.current) + (disableDiscovery ? 15 : -DRAG_STARTED_SIGNAL), {
278
+ changeTransition: false
279
+ });
280
+ }
281
+ swipeInstance.current.velocity = 0;
282
+ swipeInstance.current.lastTime = null;
283
+ swipeInstance.current.lastTranslate = null;
284
+ swipeInstance.current.paperHit = false;
285
+ touchDetected.current = true;
286
+ }
287
+ };
263
288
  const handleBodyTouchMove = (0, _useEventCallback.default)(nativeEvent => {
264
289
  // the ref may be null when a parent component updates while swiping
265
290
  if (!paperRef.current || !touchDetected.current) {
@@ -270,6 +295,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
270
295
  if (claimedSwipeInstance !== null && claimedSwipeInstance !== swipeInstance.current) {
271
296
  return;
272
297
  }
298
+ startMaybeSwiping(true);
273
299
  const anchorRtl = (0, _Drawer.getAnchor)(theme, anchor);
274
300
  const horizontalSwipe = (0, _Drawer.isHorizontal)(anchor);
275
301
  const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, (0, _ownerDocument.default)(nativeEvent.currentTarget));
@@ -380,7 +406,12 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
380
406
  const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, (0, _ownerDocument.default)(nativeEvent.currentTarget));
381
407
  const currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, (0, _ownerWindow.default)(nativeEvent.currentTarget));
382
408
  if (!open) {
383
- if (disableSwipeToOpen || nativeEvent.target !== swipeAreaRef.current) {
409
+ var _paperRef$current;
410
+ // logic for if swipe should be ignored:
411
+ // if disableSwipeToOpen
412
+ // if target != swipeArea, and target is not a child of paper ref
413
+ // if is a child of paper ref, and `allowSwipeInChildren` does not allow it
414
+ if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || (_paperRef$current = paperRef.current) != null && _paperRef$current.contains(nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
384
415
  return;
385
416
  }
386
417
  if (horizontalSwipe) {
@@ -395,20 +426,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
395
426
  claimedSwipeInstance = null;
396
427
  swipeInstance.current.startX = currentX;
397
428
  swipeInstance.current.startY = currentY;
398
- (0, _reactDom.flushSync)(() => {
399
- setMaybeSwiping(true);
400
- });
401
- if (!open && paperRef.current) {
402
- // The ref may be null when a parent component updates while swiping.
403
- setPosition(getMaxTranslate(horizontalSwipe, paperRef.current) + (disableDiscovery ? 15 : -DRAG_STARTED_SIGNAL), {
404
- changeTransition: false
405
- });
406
- }
407
- swipeInstance.current.velocity = 0;
408
- swipeInstance.current.lastTime = null;
409
- swipeInstance.current.lastTranslate = null;
410
- swipeInstance.current.paperHit = false;
411
- touchDetected.current = true;
429
+ startMaybeSwiping();
412
430
  });
413
431
  React.useEffect(() => {
414
432
  if (variant === 'temporary') {
@@ -456,7 +474,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
456
474
  hideBackdrop: hideBackdrop,
457
475
  PaperProps: (0, _extends2.default)({}, PaperProps, {
458
476
  style: (0, _extends2.default)({
459
- pointerEvents: variant === 'temporary' && !open ? 'none' : ''
477
+ pointerEvents: variant === 'temporary' && !open && !allowSwipeInChildren ? 'none' : ''
460
478
  }, PaperProps.style),
461
479
  ref: handleRef
462
480
  }),
@@ -478,6 +496,19 @@ process.env.NODE_ENV !== "production" ? SwipeableDrawer.propTypes /* remove-prop
478
496
  // | These PropTypes are generated from the TypeScript type definitions |
479
497
  // | To update them edit the d.ts file and run "yarn proptypes" |
480
498
  // ----------------------------------------------------------------------
499
+ /**
500
+ * If set to true, the swipe event will open the drawer even if the user begins the swipe on one of the drawer's children.
501
+ * This can be useful in scenarios where the drawer is partially visible.
502
+ * You can customize it further with a callback that determines which children the user can drag over to open the drawer
503
+ * (for example, to ignore other elements that handle touch move events, like sliders).
504
+ *
505
+ * @param {TouchEvent} event The 'touchstart' event
506
+ * @param {HTMLDivElement} swipeArea The swipe area element
507
+ * @param {HTMLDivElement} paper The drawer's paper element
508
+ *
509
+ * @default false
510
+ */
511
+ allowSwipeInChildren: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.func]),
481
512
  /**
482
513
  * @ignore
483
514
  */
@@ -265,6 +265,7 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
265
265
  disabled: _propTypes.default.bool,
266
266
  /**
267
267
  * If `true`, the ripple effect is disabled.
268
+ * @default false
268
269
  */
269
270
  disableRipple: _propTypes.default.bool,
270
271
  /**
@@ -301,6 +302,7 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
301
302
  onChange: _propTypes.default.func,
302
303
  /**
303
304
  * If `true`, the `input` element is required.
305
+ * @default false
304
306
  */
305
307
  required: _propTypes.default.bool,
306
308
  /**
@@ -113,6 +113,7 @@ process.env.NODE_ENV !== "production" ? TabScrollButton.propTypes /* remove-prop
113
113
  direction: _propTypes.default.oneOf(['left', 'right']).isRequired,
114
114
  /**
115
115
  * If `true`, the component is disabled.
116
+ * @default false
116
117
  */
117
118
  disabled: _propTypes.default.bool,
118
119
  /**
@@ -202,6 +202,10 @@ const TooltipArrow = (0, _styled.default)('span', {
202
202
  }));
203
203
  let hystersisOpen = false;
204
204
  let hystersisTimer = null;
205
+ let cursorPosition = {
206
+ x: 0,
207
+ y: 0
208
+ };
205
209
  function testReset() {
206
210
  hystersisOpen = false;
207
211
  clearTimeout(hystersisTimer);
@@ -443,17 +447,13 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
443
447
  if (!title && title !== 0) {
444
448
  open = false;
445
449
  }
446
- const positionRef = React.useRef({
447
- x: 0,
448
- y: 0
449
- });
450
450
  const popperRef = React.useRef();
451
451
  const handleMouseMove = event => {
452
452
  const childrenProps = children.props;
453
453
  if (childrenProps.onMouseMove) {
454
454
  childrenProps.onMouseMove(event);
455
455
  }
456
- positionRef.current = {
456
+ cursorPosition = {
457
457
  x: event.clientX,
458
458
  y: event.clientY
459
459
  };
@@ -559,10 +559,10 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
559
559
  placement: placement,
560
560
  anchorEl: followCursor ? {
561
561
  getBoundingClientRect: () => ({
562
- top: positionRef.current.y,
563
- left: positionRef.current.x,
564
- right: positionRef.current.x,
565
- bottom: positionRef.current.y,
562
+ top: cursorPosition.y,
563
+ left: cursorPosition.x,
564
+ right: cursorPosition.x,
565
+ bottom: cursorPosition.y,
566
566
  width: 0,
567
567
  height: 0
568
568
  })
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.11.5
2
+ * @mui/material v5.11.7
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -80,7 +80,7 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
80
80
  onChange,
81
81
  onFocus,
82
82
  readOnly,
83
- required,
83
+ required = false,
84
84
  tabIndex,
85
85
  type,
86
86
  value
@@ -12,7 +12,9 @@ var _createTypography = _interopRequireDefault(require("./createTypography"));
12
12
  var _excludeVariablesFromRoot = _interopRequireDefault(require("./excludeVariablesFromRoot"));
13
13
  const shouldSkipGeneratingVar = keys => {
14
14
  var _keys$;
15
- return !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || keys[0] === 'palette' && !!((_keys$ = keys[1]) != null && _keys$.match(/(mode|contrastThreshold|tonalOffset)/));
15
+ return !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
16
+ // ends with sxConfig
17
+ keys[0] === 'palette' && !!((_keys$ = keys[1]) != null && _keys$.match(/(mode|contrastThreshold|tonalOffset)/));
16
18
  };
17
19
  exports.shouldSkipGeneratingVar = shouldSkipGeneratingVar;
18
20
  const defaultTheme = (0, _experimental_extendTheme.default)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "5.11.5",
3
+ "version": "5.11.7",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "React components that implement Google's Material Design.",
@@ -46,11 +46,11 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/runtime": "^7.20.7",
49
- "@mui/base": "5.0.0-alpha.114",
50
- "@mui/core-downloads-tracker": "^5.11.5",
51
- "@mui/system": "^5.11.5",
49
+ "@mui/base": "5.0.0-alpha.116",
50
+ "@mui/core-downloads-tracker": "^5.11.7",
51
+ "@mui/system": "^5.11.7",
52
52
  "@mui/types": "^7.2.3",
53
- "@mui/utils": "^5.11.2",
53
+ "@mui/utils": "^5.11.7",
54
54
  "@types/react-transition-group": "^4.4.5",
55
55
  "clsx": "^1.2.1",
56
56
  "csstype": "^3.1.1",
@@ -5,7 +5,9 @@ import createTypography from './createTypography';
5
5
  import excludeVariablesFromRoot from './excludeVariablesFromRoot';
6
6
  const shouldSkipGeneratingVar = keys => {
7
7
  var _keys$;
8
- return !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || keys[0] === 'palette' && !!((_keys$ = keys[1]) != null && _keys$.match(/(mode|contrastThreshold|tonalOffset)/));
8
+ return !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
9
+ // ends with sxConfig
10
+ keys[0] === 'palette' && !!((_keys$ = keys[1]) != null && _keys$.match(/(mode|contrastThreshold|tonalOffset)/));
9
11
  };
10
12
  const defaultTheme = experimental_extendTheme();
11
13
  const {