@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.
- package/Box/Box.d.ts +3 -2
- package/Button/Button.js +0 -2
- package/CHANGELOG.md +160 -0
- package/Checkbox/Checkbox.d.ts +3 -0
- package/Checkbox/Checkbox.js +3 -0
- package/FormLabel/FormLabel.d.ts +51 -45
- package/InputLabel/InputLabel.d.ts +70 -57
- package/Radio/Radio.js +2 -0
- package/Slider/Slider.d.ts +215 -35
- package/Slider/Slider.js +7 -7
- package/Slider/SliderValueLabel.d.ts +1 -1
- package/Slider/SliderValueLabel.js +3 -0
- package/Slider/SliderValueLabel.types.d.ts +1 -1
- package/Slider/index.d.ts +2 -0
- package/Slider/index.js +2 -1
- package/Slider/sliderClasses.d.ts +40 -11
- package/Slider/sliderClasses.js +5 -3
- package/SwipeableDrawer/SwipeableDrawer.d.ts +15 -0
- package/SwipeableDrawer/SwipeableDrawer.js +48 -17
- package/Switch/Switch.js +2 -0
- package/TabScrollButton/TabScrollButton.d.ts +1 -0
- package/TabScrollButton/TabScrollButton.js +1 -0
- package/Tooltip/Tooltip.js +9 -9
- package/index.js +1 -1
- package/internal/SwitchBase.d.ts +5 -0
- package/internal/SwitchBase.js +1 -1
- package/legacy/Button/Button.js +0 -2
- package/legacy/Checkbox/Checkbox.js +3 -0
- package/legacy/Radio/Radio.js +2 -0
- package/legacy/Slider/Slider.js +7 -7
- package/legacy/Slider/SliderValueLabel.js +3 -0
- package/legacy/Slider/index.js +2 -1
- package/legacy/Slider/sliderClasses.js +5 -3
- package/legacy/SwipeableDrawer/SwipeableDrawer.js +50 -17
- package/legacy/Switch/Switch.js +2 -0
- package/legacy/TabScrollButton/TabScrollButton.js +1 -0
- package/legacy/Tooltip/Tooltip.js +9 -9
- package/legacy/index.js +1 -1
- package/legacy/internal/SwitchBase.js +2 -1
- package/legacy/styles/CssVarsProvider.js +3 -1
- package/modern/Button/Button.js +0 -2
- package/modern/Checkbox/Checkbox.js +3 -0
- package/modern/Radio/Radio.js +2 -0
- package/modern/Slider/Slider.js +7 -7
- package/modern/Slider/SliderValueLabel.js +3 -0
- package/modern/Slider/index.js +2 -1
- package/modern/Slider/sliderClasses.js +5 -3
- package/modern/SwipeableDrawer/SwipeableDrawer.js +47 -17
- package/modern/Switch/Switch.js +2 -0
- package/modern/TabScrollButton/TabScrollButton.js +1 -0
- package/modern/Tooltip/Tooltip.js +9 -9
- package/modern/index.js +1 -1
- package/modern/internal/SwitchBase.js +1 -1
- package/modern/styles/CssVarsProvider.js +3 -1
- package/node/Button/Button.js +0 -2
- package/node/Checkbox/Checkbox.js +3 -0
- package/node/Radio/Radio.js +2 -0
- package/node/Slider/Slider.js +6 -6
- package/node/Slider/SliderValueLabel.js +3 -0
- package/node/Slider/index.js +12 -2
- package/node/Slider/sliderClasses.js +6 -3
- package/node/SwipeableDrawer/SwipeableDrawer.js +48 -17
- package/node/Switch/Switch.js +2 -0
- package/node/TabScrollButton/TabScrollButton.js +1 -0
- package/node/Tooltip/Tooltip.js +9 -9
- package/node/index.js +1 -1
- package/node/internal/SwitchBase.js +1 -1
- package/node/styles/CssVarsProvider.js +3 -1
- package/package.json +5 -5
- package/styles/CssVarsProvider.js +3 -1
- package/umd/material-ui.development.js +121 -58
- package/umd/material-ui.production.min.js +20 -20
package/Tooltip/Tooltip.js
CHANGED
|
@@ -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);
|
|
@@ -434,17 +438,13 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
434
438
|
if (!title && title !== 0) {
|
|
435
439
|
open = false;
|
|
436
440
|
}
|
|
437
|
-
const positionRef = React.useRef({
|
|
438
|
-
x: 0,
|
|
439
|
-
y: 0
|
|
440
|
-
});
|
|
441
441
|
const popperRef = React.useRef();
|
|
442
442
|
const handleMouseMove = event => {
|
|
443
443
|
const childrenProps = children.props;
|
|
444
444
|
if (childrenProps.onMouseMove) {
|
|
445
445
|
childrenProps.onMouseMove(event);
|
|
446
446
|
}
|
|
447
|
-
|
|
447
|
+
cursorPosition = {
|
|
448
448
|
x: event.clientX,
|
|
449
449
|
y: event.clientY
|
|
450
450
|
};
|
|
@@ -550,10 +550,10 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
550
550
|
placement: placement,
|
|
551
551
|
anchorEl: followCursor ? {
|
|
552
552
|
getBoundingClientRect: () => ({
|
|
553
|
-
top:
|
|
554
|
-
left:
|
|
555
|
-
right:
|
|
556
|
-
bottom:
|
|
553
|
+
top: cursorPosition.y,
|
|
554
|
+
left: cursorPosition.x,
|
|
555
|
+
right: cursorPosition.x,
|
|
556
|
+
bottom: cursorPosition.y,
|
|
557
557
|
width: 0,
|
|
558
558
|
height: 0
|
|
559
559
|
})
|
package/index.js
CHANGED
package/internal/SwitchBase.d.ts
CHANGED
|
@@ -19,9 +19,13 @@ export interface SwitchBaseProps
|
|
|
19
19
|
* The default checked state. Use when the component is not controlled.
|
|
20
20
|
*/
|
|
21
21
|
defaultChecked?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* If `true`, the component is disabled.
|
|
24
|
+
*/
|
|
22
25
|
disabled?: boolean;
|
|
23
26
|
/**
|
|
24
27
|
* If `true`, the ripple effect is disabled.
|
|
28
|
+
* @default false
|
|
25
29
|
*/
|
|
26
30
|
disableRipple?: boolean;
|
|
27
31
|
/**
|
|
@@ -65,6 +69,7 @@ export interface SwitchBaseProps
|
|
|
65
69
|
readOnly?: boolean;
|
|
66
70
|
/**
|
|
67
71
|
* If `true`, the `input` element is required.
|
|
72
|
+
* @default false
|
|
68
73
|
*/
|
|
69
74
|
required?: boolean;
|
|
70
75
|
tabIndex?: number;
|
package/internal/SwitchBase.js
CHANGED
package/legacy/Button/Button.js
CHANGED
|
@@ -111,8 +111,6 @@ var ButtonRoot = styled(ButtonBase, {
|
|
|
111
111
|
color: (theme.vars || theme).palette.action.disabled
|
|
112
112
|
}, ownerState.variant === 'outlined' && {
|
|
113
113
|
border: "1px solid ".concat((theme.vars || theme).palette.action.disabledBackground)
|
|
114
|
-
}, ownerState.variant === 'outlined' && ownerState.color === 'secondary' && {
|
|
115
|
-
border: "1px solid ".concat((theme.vars || theme).palette.action.disabled)
|
|
116
114
|
}, ownerState.variant === 'contained' && {
|
|
117
115
|
color: (theme.vars || theme).palette.action.disabled,
|
|
118
116
|
boxShadow: (theme.vars || theme).shadows[0],
|
|
@@ -141,10 +141,12 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
|
|
|
141
141
|
defaultChecked: PropTypes.bool,
|
|
142
142
|
/**
|
|
143
143
|
* If `true`, the component is disabled.
|
|
144
|
+
* @default false
|
|
144
145
|
*/
|
|
145
146
|
disabled: PropTypes.bool,
|
|
146
147
|
/**
|
|
147
148
|
* If `true`, the ripple effect is disabled.
|
|
149
|
+
* @default false
|
|
148
150
|
*/
|
|
149
151
|
disableRipple: PropTypes.bool,
|
|
150
152
|
/**
|
|
@@ -186,6 +188,7 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
|
|
|
186
188
|
onChange: PropTypes.func,
|
|
187
189
|
/**
|
|
188
190
|
* If `true`, the `input` element is required.
|
|
191
|
+
* @default false
|
|
189
192
|
*/
|
|
190
193
|
required: PropTypes.bool,
|
|
191
194
|
/**
|
package/legacy/Radio/Radio.js
CHANGED
|
@@ -154,6 +154,7 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
|
|
|
154
154
|
disabled: PropTypes.bool,
|
|
155
155
|
/**
|
|
156
156
|
* If `true`, the ripple effect is disabled.
|
|
157
|
+
* @default false
|
|
157
158
|
*/
|
|
158
159
|
disableRipple: PropTypes.bool,
|
|
159
160
|
/**
|
|
@@ -187,6 +188,7 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
|
|
|
187
188
|
onChange: PropTypes.func,
|
|
188
189
|
/**
|
|
189
190
|
* If `true`, the `input` element is required.
|
|
191
|
+
* @default false
|
|
190
192
|
*/
|
|
191
193
|
required: PropTypes.bool,
|
|
192
194
|
/**
|
package/legacy/Slider/Slider.js
CHANGED
|
@@ -6,15 +6,15 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { chainPropTypes } from '@mui/utils';
|
|
8
8
|
import { isHostComponent, useSlotProps, unstable_composeClasses as composeClasses } from '@mui/base';
|
|
9
|
-
import { useSlider
|
|
9
|
+
import { useSlider } from '@mui/base/SliderUnstyled';
|
|
10
10
|
import { alpha, lighten, darken } from '@mui/system';
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
12
|
import styled, { slotShouldForwardProp } from '../styles/styled';
|
|
13
13
|
import useTheme from '../styles/useTheme';
|
|
14
14
|
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
15
15
|
import capitalize from '../utils/capitalize';
|
|
16
|
-
import
|
|
17
|
-
import sliderClasses from './sliderClasses';
|
|
16
|
+
import SliderValueLabel from './SliderValueLabel';
|
|
17
|
+
import sliderClasses, { getSliderUtilityClass } from './sliderClasses';
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
var valueToPercent = function valueToPercent(value, min, max) {
|
|
@@ -260,7 +260,7 @@ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes /* remove-proptype
|
|
|
260
260
|
children: PropTypes.node
|
|
261
261
|
} : void 0;
|
|
262
262
|
export { SliderThumb };
|
|
263
|
-
var
|
|
263
|
+
var StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
264
264
|
name: 'MuiSlider',
|
|
265
265
|
slot: 'ValueLabel',
|
|
266
266
|
overridesResolver: function overridesResolver(props, styles) {
|
|
@@ -318,7 +318,7 @@ var SliderValueLabel = styled(SliderValueLabelComponent, {
|
|
|
318
318
|
padding: '0.25rem 0.5rem'
|
|
319
319
|
});
|
|
320
320
|
});
|
|
321
|
-
process.env.NODE_ENV !== "production" ?
|
|
321
|
+
process.env.NODE_ENV !== "production" ? StyledSliderValueLabel.propTypes /* remove-proptypes */ = {
|
|
322
322
|
// ----------------------------- Warning --------------------------------
|
|
323
323
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
324
324
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
@@ -328,7 +328,7 @@ process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes /* remove-pro
|
|
|
328
328
|
*/
|
|
329
329
|
children: PropTypes.node
|
|
330
330
|
} : void 0;
|
|
331
|
-
export { SliderValueLabel };
|
|
331
|
+
export { StyledSliderValueLabel as SliderValueLabel };
|
|
332
332
|
var SliderMark = styled('span', {
|
|
333
333
|
name: 'MuiSlider',
|
|
334
334
|
slot: 'Mark',
|
|
@@ -545,7 +545,7 @@ var Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
545
545
|
var RailSlot = (_ref10 = (_slots$rail = slots == null ? void 0 : slots.rail) != null ? _slots$rail : components.Rail) != null ? _ref10 : SliderRail;
|
|
546
546
|
var TrackSlot = (_ref11 = (_slots$track = slots == null ? void 0 : slots.track) != null ? _slots$track : components.Track) != null ? _ref11 : SliderTrack;
|
|
547
547
|
var ThumbSlot = (_ref12 = (_slots$thumb = slots == null ? void 0 : slots.thumb) != null ? _slots$thumb : components.Thumb) != null ? _ref12 : SliderThumb;
|
|
548
|
-
var ValueLabelSlot = (_ref13 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref13 :
|
|
548
|
+
var ValueLabelSlot = (_ref13 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref13 : StyledSliderValueLabel;
|
|
549
549
|
var MarkSlot = (_ref14 = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : components.Mark) != null ? _ref14 : SliderMark;
|
|
550
550
|
var MarkLabelSlot = (_ref15 = (_slots$markLabel = slots == null ? void 0 : slots.markLabel) != null ? _slots$markLabel : components.MarkLabel) != null ? _ref15 : SliderMarkLabel;
|
|
551
551
|
var InputSlot = (_ref16 = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input) != null ? _ref16 : 'input';
|
|
@@ -22,6 +22,9 @@ export default function SliderValueLabel(props) {
|
|
|
22
22
|
className = props.className,
|
|
23
23
|
value = props.value;
|
|
24
24
|
var classes = useValueLabelClasses(props);
|
|
25
|
+
if (!children) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
25
28
|
return /*#__PURE__*/React.cloneElement(children, {
|
|
26
29
|
className: clsx(children.props.className)
|
|
27
30
|
}, /*#__PURE__*/_jsxs(React.Fragment, {
|
package/legacy/Slider/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import generateUtilityClass from '../generateUtilityClass';
|
|
3
|
+
export function getSliderUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiSlider', slot);
|
|
5
|
+
}
|
|
6
|
+
var sliderClasses = 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']);
|
|
5
7
|
export default sliderClasses;
|
|
@@ -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/Switch/Switch.js
CHANGED
|
@@ -251,6 +251,7 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
|
|
|
251
251
|
disabled: PropTypes.bool,
|
|
252
252
|
/**
|
|
253
253
|
* If `true`, the ripple effect is disabled.
|
|
254
|
+
* @default false
|
|
254
255
|
*/
|
|
255
256
|
disableRipple: PropTypes.bool,
|
|
256
257
|
/**
|
|
@@ -287,6 +288,7 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
|
|
|
287
288
|
onChange: PropTypes.func,
|
|
288
289
|
/**
|
|
289
290
|
* If `true`, the `input` element is required.
|
|
291
|
+
* @default false
|
|
290
292
|
*/
|
|
291
293
|
required: PropTypes.bool,
|
|
292
294
|
/**
|
|
@@ -101,6 +101,7 @@ process.env.NODE_ENV !== "production" ? TabScrollButton.propTypes /* remove-prop
|
|
|
101
101
|
direction: PropTypes.oneOf(['left', 'right']).isRequired,
|
|
102
102
|
/**
|
|
103
103
|
* If `true`, the component is disabled.
|
|
104
|
+
* @default false
|
|
104
105
|
*/
|
|
105
106
|
disabled: PropTypes.bool,
|
|
106
107
|
/**
|
|
@@ -185,6 +185,10 @@ var TooltipArrow = styled('span', {
|
|
|
185
185
|
});
|
|
186
186
|
var hystersisOpen = false;
|
|
187
187
|
var hystersisTimer = null;
|
|
188
|
+
var cursorPosition = {
|
|
189
|
+
x: 0,
|
|
190
|
+
y: 0
|
|
191
|
+
};
|
|
188
192
|
export function testReset() {
|
|
189
193
|
hystersisOpen = false;
|
|
190
194
|
clearTimeout(hystersisTimer);
|
|
@@ -447,17 +451,13 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
447
451
|
if (!title && title !== 0) {
|
|
448
452
|
open = false;
|
|
449
453
|
}
|
|
450
|
-
var positionRef = React.useRef({
|
|
451
|
-
x: 0,
|
|
452
|
-
y: 0
|
|
453
|
-
});
|
|
454
454
|
var popperRef = React.useRef();
|
|
455
455
|
var handleMouseMove = function handleMouseMove(event) {
|
|
456
456
|
var childrenProps = children.props;
|
|
457
457
|
if (childrenProps.onMouseMove) {
|
|
458
458
|
childrenProps.onMouseMove(event);
|
|
459
459
|
}
|
|
460
|
-
|
|
460
|
+
cursorPosition = {
|
|
461
461
|
x: event.clientX,
|
|
462
462
|
y: event.clientY
|
|
463
463
|
};
|
|
@@ -564,10 +564,10 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
564
564
|
anchorEl: followCursor ? {
|
|
565
565
|
getBoundingClientRect: function getBoundingClientRect() {
|
|
566
566
|
return {
|
|
567
|
-
top:
|
|
568
|
-
left:
|
|
569
|
-
right:
|
|
570
|
-
bottom:
|
|
567
|
+
top: cursorPosition.y,
|
|
568
|
+
left: cursorPosition.x,
|
|
569
|
+
right: cursorPosition.x,
|
|
570
|
+
bottom: cursorPosition.y,
|
|
571
571
|
width: 0,
|
|
572
572
|
height: 0
|
|
573
573
|
};
|
package/legacy/index.js
CHANGED
|
@@ -72,7 +72,8 @@ var SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref) {
|
|
|
72
72
|
onChange = props.onChange,
|
|
73
73
|
onFocus = props.onFocus,
|
|
74
74
|
readOnly = props.readOnly,
|
|
75
|
-
required = props.required,
|
|
75
|
+
_props$required = props.required,
|
|
76
|
+
required = _props$required === void 0 ? false : _props$required,
|
|
76
77
|
tabIndex = props.tabIndex,
|
|
77
78
|
type = props.type,
|
|
78
79
|
value = props.value,
|
|
@@ -5,7 +5,9 @@ import createTypography from './createTypography';
|
|
|
5
5
|
import excludeVariablesFromRoot from './excludeVariablesFromRoot';
|
|
6
6
|
var shouldSkipGeneratingVar = function shouldSkipGeneratingVar(keys) {
|
|
7
7
|
var _keys$;
|
|
8
|
-
return !!keys[0].match(/(typography|mixins|breakpoints|direction|transitions)/) || keys[0]
|
|
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
|
var defaultTheme = experimental_extendTheme();
|
|
11
13
|
var _createCssVarsProvide = createCssVarsProvider({
|
package/modern/Button/Button.js
CHANGED
|
@@ -111,8 +111,6 @@ const ButtonRoot = styled(ButtonBase, {
|
|
|
111
111
|
color: (theme.vars || theme).palette.action.disabled
|
|
112
112
|
}, ownerState.variant === 'outlined' && {
|
|
113
113
|
border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
|
|
114
|
-
}, ownerState.variant === 'outlined' && ownerState.color === 'secondary' && {
|
|
115
|
-
border: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
116
114
|
}, ownerState.variant === 'contained' && {
|
|
117
115
|
color: (theme.vars || theme).palette.action.disabled,
|
|
118
116
|
boxShadow: (theme.vars || theme).shadows[0],
|
|
@@ -139,10 +139,12 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
|
|
|
139
139
|
defaultChecked: PropTypes.bool,
|
|
140
140
|
/**
|
|
141
141
|
* If `true`, the component is disabled.
|
|
142
|
+
* @default false
|
|
142
143
|
*/
|
|
143
144
|
disabled: PropTypes.bool,
|
|
144
145
|
/**
|
|
145
146
|
* If `true`, the ripple effect is disabled.
|
|
147
|
+
* @default false
|
|
146
148
|
*/
|
|
147
149
|
disableRipple: PropTypes.bool,
|
|
148
150
|
/**
|
|
@@ -184,6 +186,7 @@ process.env.NODE_ENV !== "production" ? Checkbox.propTypes /* remove-proptypes *
|
|
|
184
186
|
onChange: PropTypes.func,
|
|
185
187
|
/**
|
|
186
188
|
* If `true`, the `input` element is required.
|
|
189
|
+
* @default false
|
|
187
190
|
*/
|
|
188
191
|
required: PropTypes.bool,
|
|
189
192
|
/**
|
package/modern/Radio/Radio.js
CHANGED
|
@@ -155,6 +155,7 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
|
|
|
155
155
|
disabled: PropTypes.bool,
|
|
156
156
|
/**
|
|
157
157
|
* If `true`, the ripple effect is disabled.
|
|
158
|
+
* @default false
|
|
158
159
|
*/
|
|
159
160
|
disableRipple: PropTypes.bool,
|
|
160
161
|
/**
|
|
@@ -188,6 +189,7 @@ process.env.NODE_ENV !== "production" ? Radio.propTypes /* remove-proptypes */ =
|
|
|
188
189
|
onChange: PropTypes.func,
|
|
189
190
|
/**
|
|
190
191
|
* If `true`, the `input` element is required.
|
|
192
|
+
* @default false
|
|
191
193
|
*/
|
|
192
194
|
required: PropTypes.bool,
|
|
193
195
|
/**
|
package/modern/Slider/Slider.js
CHANGED
|
@@ -6,15 +6,15 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { chainPropTypes } from '@mui/utils';
|
|
8
8
|
import { isHostComponent, useSlotProps, unstable_composeClasses as composeClasses } from '@mui/base';
|
|
9
|
-
import { useSlider
|
|
9
|
+
import { useSlider } from '@mui/base/SliderUnstyled';
|
|
10
10
|
import { alpha, lighten, darken } from '@mui/system';
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
12
|
import styled, { slotShouldForwardProp } from '../styles/styled';
|
|
13
13
|
import useTheme from '../styles/useTheme';
|
|
14
14
|
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
15
15
|
import capitalize from '../utils/capitalize';
|
|
16
|
-
import
|
|
17
|
-
import sliderClasses from './sliderClasses';
|
|
16
|
+
import SliderValueLabel from './SliderValueLabel';
|
|
17
|
+
import sliderClasses, { getSliderUtilityClass } from './sliderClasses';
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
const valueToPercent = (value, min, max) => (value - min) * 100 / (max - min);
|
|
@@ -261,7 +261,7 @@ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes /* remove-proptype
|
|
|
261
261
|
children: PropTypes.node
|
|
262
262
|
} : void 0;
|
|
263
263
|
export { SliderThumb };
|
|
264
|
-
const
|
|
264
|
+
const StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
265
265
|
name: 'MuiSlider',
|
|
266
266
|
slot: 'ValueLabel',
|
|
267
267
|
overridesResolver: (props, styles) => styles.valueLabel
|
|
@@ -319,7 +319,7 @@ const SliderValueLabel = styled(SliderValueLabelComponent, {
|
|
|
319
319
|
fontSize: theme.typography.pxToRem(12),
|
|
320
320
|
padding: '0.25rem 0.5rem'
|
|
321
321
|
}));
|
|
322
|
-
process.env.NODE_ENV !== "production" ?
|
|
322
|
+
process.env.NODE_ENV !== "production" ? StyledSliderValueLabel.propTypes /* remove-proptypes */ = {
|
|
323
323
|
// ----------------------------- Warning --------------------------------
|
|
324
324
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
325
325
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
@@ -329,7 +329,7 @@ process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes /* remove-pro
|
|
|
329
329
|
*/
|
|
330
330
|
children: PropTypes.node
|
|
331
331
|
} : void 0;
|
|
332
|
-
export { SliderValueLabel };
|
|
332
|
+
export { StyledSliderValueLabel as SliderValueLabel };
|
|
333
333
|
const SliderMark = styled('span', {
|
|
334
334
|
name: 'MuiSlider',
|
|
335
335
|
slot: 'Mark',
|
|
@@ -522,7 +522,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
522
522
|
const RailSlot = slots?.rail ?? components.Rail ?? SliderRail;
|
|
523
523
|
const TrackSlot = slots?.track ?? components.Track ?? SliderTrack;
|
|
524
524
|
const ThumbSlot = slots?.thumb ?? components.Thumb ?? SliderThumb;
|
|
525
|
-
const ValueLabelSlot = slots?.valueLabel ?? components.ValueLabel ??
|
|
525
|
+
const ValueLabelSlot = slots?.valueLabel ?? components.ValueLabel ?? StyledSliderValueLabel;
|
|
526
526
|
const MarkSlot = slots?.mark ?? components.Mark ?? SliderMark;
|
|
527
527
|
const MarkLabelSlot = slots?.markLabel ?? components.MarkLabel ?? SliderMarkLabel;
|
|
528
528
|
const InputSlot = slots?.input ?? components.Input ?? 'input';
|
|
@@ -26,6 +26,9 @@ export default function SliderValueLabel(props) {
|
|
|
26
26
|
value
|
|
27
27
|
} = props;
|
|
28
28
|
const classes = useValueLabelClasses(props);
|
|
29
|
+
if (!children) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
29
32
|
return /*#__PURE__*/React.cloneElement(children, {
|
|
30
33
|
className: clsx(children.props.className)
|
|
31
34
|
}, /*#__PURE__*/_jsxs(React.Fragment, {
|
package/modern/Slider/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import generateUtilityClass from '../generateUtilityClass';
|
|
3
|
+
export function getSliderUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiSlider', slot);
|
|
5
|
+
}
|
|
6
|
+
const sliderClasses = 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']);
|
|
5
7
|
export default sliderClasses;
|