@mui/material 5.11.4 → 5.11.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.
- package/Autocomplete/Autocomplete.d.ts +3 -3
- package/Box/Box.d.ts +6 -22
- package/Button/Button.js +0 -2
- package/CHANGELOG.md +132 -0
- package/Slider/Slider.d.ts +215 -36
- package/Slider/Slider.js +225 -66
- package/Slider/SliderValueLabel.d.ts +15 -0
- package/Slider/SliderValueLabel.js +52 -0
- package/Slider/SliderValueLabel.types.d.ts +24 -0
- package/Slider/SliderValueLabel.types.js +1 -0
- package/Slider/index.d.ts +3 -0
- package/Slider/index.js +3 -1
- package/Slider/sliderClasses.d.ts +58 -0
- package/Slider/sliderClasses.js +7 -0
- package/SwipeableDrawer/SwipeableDrawer.d.ts +15 -0
- package/SwipeableDrawer/SwipeableDrawer.js +48 -17
- package/index.js +1 -1
- package/legacy/Button/Button.js +0 -2
- package/legacy/Slider/Slider.js +253 -74
- package/legacy/Slider/SliderValueLabel.js +48 -0
- package/legacy/Slider/SliderValueLabel.types.js +1 -0
- package/legacy/Slider/index.js +3 -1
- package/legacy/Slider/sliderClasses.js +7 -0
- package/legacy/SwipeableDrawer/SwipeableDrawer.js +50 -17
- package/legacy/index.js +1 -1
- package/legacy/locale/index.js +230 -144
- package/legacy/styles/experimental_extendTheme.js +16 -8
- package/locale/index.d.ts +1 -0
- package/locale/index.js +85 -0
- package/modern/Button/Button.js +0 -2
- package/modern/Slider/Slider.js +224 -65
- package/modern/Slider/SliderValueLabel.js +52 -0
- package/modern/Slider/SliderValueLabel.types.js +1 -0
- package/modern/Slider/index.js +3 -1
- package/modern/Slider/sliderClasses.js +7 -0
- package/modern/SwipeableDrawer/SwipeableDrawer.js +47 -17
- package/modern/index.js +1 -1
- package/modern/locale/index.js +85 -0
- package/modern/styles/experimental_extendTheme.js +16 -8
- package/node/Button/Button.js +0 -2
- package/node/Slider/Slider.js +231 -74
- package/node/Slider/SliderValueLabel.js +60 -0
- package/node/Slider/SliderValueLabel.types.js +5 -0
- package/node/Slider/index.js +21 -1
- package/node/Slider/sliderClasses.js +16 -0
- package/node/SwipeableDrawer/SwipeableDrawer.js +48 -17
- package/node/index.js +1 -1
- package/node/locale/index.js +87 -1
- package/node/styles/experimental_extendTheme.js +16 -8
- package/package.json +4 -4
- package/styles/experimental_extendTheme.js +16 -8
- package/umd/material-ui.development.js +556 -799
- package/umd/material-ui.production.min.js +21 -21
|
@@ -134,6 +134,8 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
134
134
|
hideBackdrop = props.hideBackdrop,
|
|
135
135
|
_props$hysteresis = props.hysteresis,
|
|
136
136
|
hysteresis = _props$hysteresis === void 0 ? 0.52 : _props$hysteresis,
|
|
137
|
+
_props$allowSwipeInCh = props.allowSwipeInChildren,
|
|
138
|
+
allowSwipeInChildren = _props$allowSwipeInCh === void 0 ? false : _props$allowSwipeInCh,
|
|
137
139
|
_props$minFlingVeloci = props.minFlingVelocity,
|
|
138
140
|
minFlingVelocity = _props$minFlingVeloci === void 0 ? 450 : _props$minFlingVeloci,
|
|
139
141
|
_props$ModalProps = props.ModalProps;
|
|
@@ -153,7 +155,7 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
153
155
|
transitionDuration = _props$transitionDura === void 0 ? transitionDurationDefault : _props$transitionDura,
|
|
154
156
|
_props$variant = props.variant,
|
|
155
157
|
variant = _props$variant === void 0 ? 'temporary' : _props$variant,
|
|
156
|
-
other = _objectWithoutProperties(props, ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"]);
|
|
158
|
+
other = _objectWithoutProperties(props, ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "allowSwipeInChildren", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"]);
|
|
157
159
|
var _React$useState = React.useState(false),
|
|
158
160
|
maybeSwiping = _React$useState[0],
|
|
159
161
|
setMaybeSwiping = _React$useState[1];
|
|
@@ -261,6 +263,31 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
261
263
|
});
|
|
262
264
|
}
|
|
263
265
|
});
|
|
266
|
+
var startMaybeSwiping = function startMaybeSwiping() {
|
|
267
|
+
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
268
|
+
if (!maybeSwiping) {
|
|
269
|
+
// 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.
|
|
270
|
+
// this is because Safari Mobile will not fire any mouse events (still fires touch though) if the DOM changes during mousemove.
|
|
271
|
+
// so do this change on first touchmove instead of touchstart
|
|
272
|
+
if (force || !(disableDiscovery && allowSwipeInChildren)) {
|
|
273
|
+
flushSync(function () {
|
|
274
|
+
setMaybeSwiping(true);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
var horizontalSwipe = isHorizontal(anchor);
|
|
278
|
+
if (!open && paperRef.current) {
|
|
279
|
+
// The ref may be null when a parent component updates while swiping.
|
|
280
|
+
setPosition(getMaxTranslate(horizontalSwipe, paperRef.current) + (disableDiscovery ? 15 : -DRAG_STARTED_SIGNAL), {
|
|
281
|
+
changeTransition: false
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
swipeInstance.current.velocity = 0;
|
|
285
|
+
swipeInstance.current.lastTime = null;
|
|
286
|
+
swipeInstance.current.lastTranslate = null;
|
|
287
|
+
swipeInstance.current.paperHit = false;
|
|
288
|
+
touchDetected.current = true;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
264
291
|
var handleBodyTouchMove = useEventCallback(function (nativeEvent) {
|
|
265
292
|
// the ref may be null when a parent component updates while swiping
|
|
266
293
|
if (!paperRef.current || !touchDetected.current) {
|
|
@@ -271,6 +298,7 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
271
298
|
if (claimedSwipeInstance !== null && claimedSwipeInstance !== swipeInstance.current) {
|
|
272
299
|
return;
|
|
273
300
|
}
|
|
301
|
+
startMaybeSwiping(true);
|
|
274
302
|
var anchorRtl = getAnchor(theme, anchor);
|
|
275
303
|
var horizontalSwipe = isHorizontal(anchor);
|
|
276
304
|
var currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, ownerDocument(nativeEvent.currentTarget));
|
|
@@ -381,7 +409,12 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
381
409
|
var currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, ownerDocument(nativeEvent.currentTarget));
|
|
382
410
|
var currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, ownerWindow(nativeEvent.currentTarget));
|
|
383
411
|
if (!open) {
|
|
384
|
-
|
|
412
|
+
var _paperRef$current;
|
|
413
|
+
// logic for if swipe should be ignored:
|
|
414
|
+
// if disableSwipeToOpen
|
|
415
|
+
// if target != swipeArea, and target is not a child of paper ref
|
|
416
|
+
// if is a child of paper ref, and `allowSwipeInChildren` does not allow it
|
|
417
|
+
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))) {
|
|
385
418
|
return;
|
|
386
419
|
}
|
|
387
420
|
if (horizontalSwipe) {
|
|
@@ -396,20 +429,7 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
396
429
|
claimedSwipeInstance = null;
|
|
397
430
|
swipeInstance.current.startX = currentX;
|
|
398
431
|
swipeInstance.current.startY = currentY;
|
|
399
|
-
|
|
400
|
-
setMaybeSwiping(true);
|
|
401
|
-
});
|
|
402
|
-
if (!open && paperRef.current) {
|
|
403
|
-
// The ref may be null when a parent component updates while swiping.
|
|
404
|
-
setPosition(getMaxTranslate(horizontalSwipe, paperRef.current) + (disableDiscovery ? 15 : -DRAG_STARTED_SIGNAL), {
|
|
405
|
-
changeTransition: false
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
swipeInstance.current.velocity = 0;
|
|
409
|
-
swipeInstance.current.lastTime = null;
|
|
410
|
-
swipeInstance.current.lastTranslate = null;
|
|
411
|
-
swipeInstance.current.paperHit = false;
|
|
412
|
-
touchDetected.current = true;
|
|
432
|
+
startMaybeSwiping();
|
|
413
433
|
});
|
|
414
434
|
React.useEffect(function () {
|
|
415
435
|
if (variant === 'temporary') {
|
|
@@ -459,7 +479,7 @@ var SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(inP
|
|
|
459
479
|
hideBackdrop: hideBackdrop,
|
|
460
480
|
PaperProps: _extends({}, PaperProps, {
|
|
461
481
|
style: _extends({
|
|
462
|
-
pointerEvents: variant === 'temporary' && !open ? 'none' : ''
|
|
482
|
+
pointerEvents: variant === 'temporary' && !open && !allowSwipeInChildren ? 'none' : ''
|
|
463
483
|
}, PaperProps.style),
|
|
464
484
|
ref: handleRef
|
|
465
485
|
}),
|
|
@@ -481,6 +501,19 @@ process.env.NODE_ENV !== "production" ? SwipeableDrawer.propTypes /* remove-prop
|
|
|
481
501
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
482
502
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
483
503
|
// ----------------------------------------------------------------------
|
|
504
|
+
/**
|
|
505
|
+
* 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.
|
|
506
|
+
* This can be useful in scenarios where the drawer is partially visible.
|
|
507
|
+
* You can customize it further with a callback that determines which children the user can drag over to open the drawer
|
|
508
|
+
* (for example, to ignore other elements that handle touch move events, like sliders).
|
|
509
|
+
*
|
|
510
|
+
* @param {TouchEvent} event The 'touchstart' event
|
|
511
|
+
* @param {HTMLDivElement} swipeArea The swipe area element
|
|
512
|
+
* @param {HTMLDivElement} paper The drawer's paper element
|
|
513
|
+
*
|
|
514
|
+
* @default false
|
|
515
|
+
*/
|
|
516
|
+
allowSwipeInChildren: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
|
|
484
517
|
/**
|
|
485
518
|
* @ignore
|
|
486
519
|
*/
|
package/legacy/index.js
CHANGED