@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
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
*/
|
package/modern/index.js
CHANGED
package/modern/locale/index.js
CHANGED
|
@@ -441,6 +441,91 @@ export const bnBD = {
|
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
};
|
|
444
|
+
export const beBY = {
|
|
445
|
+
components: {
|
|
446
|
+
MuiBreadcrumbs: {
|
|
447
|
+
defaultProps: {
|
|
448
|
+
expandText: 'Паказаць шлях'
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
MuiTablePagination: {
|
|
452
|
+
defaultProps: {
|
|
453
|
+
getItemAriaLabel: type => {
|
|
454
|
+
if (type === 'first') {
|
|
455
|
+
return 'Перайсці на першую старонку';
|
|
456
|
+
}
|
|
457
|
+
if (type === 'last') {
|
|
458
|
+
return 'Перайсці на апошнюю старонку';
|
|
459
|
+
}
|
|
460
|
+
if (type === 'next') {
|
|
461
|
+
return 'Перайсці на наступную старонку';
|
|
462
|
+
}
|
|
463
|
+
// if (type === 'previous') {
|
|
464
|
+
return 'Перайсці на папярэднюю старонку';
|
|
465
|
+
},
|
|
466
|
+
labelRowsPerPage: 'Радкоў на старонцы:',
|
|
467
|
+
labelDisplayedRows: ({
|
|
468
|
+
from,
|
|
469
|
+
to,
|
|
470
|
+
count
|
|
471
|
+
}) => `${from}–${to} з ${count !== -1 ? count : `больш чым ${to}`}`
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
MuiRating: {
|
|
475
|
+
defaultProps: {
|
|
476
|
+
getLabelText: value => {
|
|
477
|
+
let pluralForm = 'Зорак';
|
|
478
|
+
const lastDigit = value % 10;
|
|
479
|
+
if (lastDigit > 1 && lastDigit < 5 && (value < 10 || value > 20)) {
|
|
480
|
+
pluralForm = 'Зоркі';
|
|
481
|
+
} else if (lastDigit === 1 && value % 100 !== 11) {
|
|
482
|
+
pluralForm = 'Зорка';
|
|
483
|
+
}
|
|
484
|
+
return `${value} ${pluralForm}`;
|
|
485
|
+
},
|
|
486
|
+
emptyLabelText: 'Рэйтынг адсутнічае'
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
MuiAutocomplete: {
|
|
490
|
+
defaultProps: {
|
|
491
|
+
clearText: 'Ачысціць',
|
|
492
|
+
closeText: 'Закрыць',
|
|
493
|
+
loadingText: 'Загрузка…',
|
|
494
|
+
noOptionsText: 'Няма варыянтаў',
|
|
495
|
+
openText: 'Адкрыць'
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
MuiAlert: {
|
|
499
|
+
defaultProps: {
|
|
500
|
+
closeText: 'Закрыць'
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
MuiPagination: {
|
|
504
|
+
defaultProps: {
|
|
505
|
+
'aria-label': 'Навігацыя па старонкам',
|
|
506
|
+
getItemAriaLabel: (type, page, selected) => {
|
|
507
|
+
if (type === 'page') {
|
|
508
|
+
if (selected) {
|
|
509
|
+
return `${page} старонка`;
|
|
510
|
+
}
|
|
511
|
+
return `Перайсці на ${page} старонку`;
|
|
512
|
+
}
|
|
513
|
+
if (type === 'first') {
|
|
514
|
+
return 'Перайсці на першую старонку';
|
|
515
|
+
}
|
|
516
|
+
if (type === 'last') {
|
|
517
|
+
return 'Перайсці на апошнюю старонку';
|
|
518
|
+
}
|
|
519
|
+
if (type === 'next') {
|
|
520
|
+
return 'Перайсці на наступную старонку';
|
|
521
|
+
}
|
|
522
|
+
// if (type === 'previous') {
|
|
523
|
+
return 'Перайсці на папярэднюю старонку';
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
};
|
|
444
529
|
export const bgBG = {
|
|
445
530
|
components: {
|
|
446
531
|
MuiBreadcrumbs: {
|
|
@@ -25,6 +25,13 @@ function setColor(obj, key, defaultValue) {
|
|
|
25
25
|
obj[key] = defaultValue;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
function setColorChannel(obj, key) {
|
|
29
|
+
if (!(`${key}Channel` in obj)) {
|
|
30
|
+
// custom channel token is not provided, generate one.
|
|
31
|
+
// if channel token can't be generated, show a warning.
|
|
32
|
+
obj[`${key}Channel`] = safeColorChannel(obj[key], `MUI: Can't create \`palette.${key}Channel\` because \`palette.${key}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` + '\n' + `To suppress this warning, you need to explicitly provide the \`palette.${key}Channel\` as a string (in rgb format, e.g. "12 12 12") or undefined if you want to remove the channel token.`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
28
35
|
const silent = fn => {
|
|
29
36
|
try {
|
|
30
37
|
return fn();
|
|
@@ -214,11 +221,12 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
214
221
|
setColor(palette.TableCell, 'border', safeDarken(safeAlpha(palette.divider, 1), 0.68));
|
|
215
222
|
setColor(palette.Tooltip, 'bg', safeAlpha(palette.grey[700], 0.92));
|
|
216
223
|
}
|
|
217
|
-
setColor(palette.background, 'defaultChannel', safeColorChannel(palette.background.default, 'MUI: The value of `palette.background.default` should be one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().')); // MUI X - DataGrid needs this token.
|
|
218
224
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
225
|
+
// MUI X - DataGrid needs this token.
|
|
226
|
+
setColorChannel(palette.background, 'default');
|
|
227
|
+
setColorChannel(palette.common, 'background');
|
|
228
|
+
setColorChannel(palette.common, 'onBackground');
|
|
229
|
+
setColorChannel(palette, 'divider');
|
|
222
230
|
Object.keys(palette).forEach(color => {
|
|
223
231
|
const colors = palette[color];
|
|
224
232
|
|
|
@@ -240,16 +248,16 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
240
248
|
}
|
|
241
249
|
if (color === 'text') {
|
|
242
250
|
// Text colors: text.primary, text.secondary
|
|
243
|
-
|
|
244
|
-
|
|
251
|
+
setColorChannel(palette[color], 'primary');
|
|
252
|
+
setColorChannel(palette[color], 'secondary');
|
|
245
253
|
}
|
|
246
254
|
if (color === 'action') {
|
|
247
255
|
// Action colors: action.active, action.selected
|
|
248
256
|
if (colors.active) {
|
|
249
|
-
|
|
257
|
+
setColorChannel(palette[color], 'active');
|
|
250
258
|
}
|
|
251
259
|
if (colors.selected) {
|
|
252
|
-
|
|
260
|
+
setColorChannel(palette[color], 'selected');
|
|
253
261
|
}
|
|
254
262
|
}
|
|
255
263
|
}
|
package/node/Button/Button.js
CHANGED
|
@@ -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],
|