@mui/material 5.11.3 → 5.11.5
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 +4 -3
- package/Autocomplete/Autocomplete.js +1 -0
- package/Box/Box.d.ts +5 -22
- package/CHANGELOG.md +106 -0
- package/FilledInput/FilledInput.js +0 -4
- package/Input/Input.js +1 -5
- package/MenuItem/MenuItem.d.ts +1 -1
- package/MenuItem/MenuItem.js +2 -1
- package/Modal/Modal.d.ts +35 -12
- package/Select/Select.d.ts +25 -83
- package/Slider/Slider.d.ts +1 -2
- package/Slider/Slider.js +222 -63
- package/Slider/SliderValueLabel.d.ts +15 -0
- package/Slider/SliderValueLabel.js +49 -0
- package/Slider/SliderValueLabel.types.d.ts +24 -0
- package/Slider/SliderValueLabel.types.js +1 -0
- package/Slider/index.d.ts +1 -0
- package/Slider/index.js +2 -1
- package/Slider/sliderClasses.d.ts +29 -0
- package/Slider/sliderClasses.js +5 -0
- package/Tabs/Tabs.js +3 -1
- package/Tooltip/Tooltip.js +0 -1
- package/index.js +3 -1
- package/legacy/Autocomplete/Autocomplete.js +1 -0
- package/legacy/FilledInput/FilledInput.js +0 -3
- package/legacy/Input/Input.js +1 -4
- package/legacy/MenuItem/MenuItem.js +2 -1
- package/legacy/Slider/Slider.js +251 -72
- package/legacy/Slider/SliderValueLabel.js +45 -0
- package/legacy/Slider/SliderValueLabel.types.js +1 -0
- package/legacy/Slider/index.js +2 -1
- package/legacy/Slider/sliderClasses.js +5 -0
- package/legacy/Tabs/Tabs.js +3 -1
- package/legacy/Tooltip/Tooltip.js +0 -1
- package/legacy/index.js +3 -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/Autocomplete/Autocomplete.js +1 -0
- package/modern/FilledInput/FilledInput.js +0 -4
- package/modern/Input/Input.js +1 -5
- package/modern/MenuItem/MenuItem.js +2 -1
- package/modern/Slider/Slider.js +221 -62
- package/modern/Slider/SliderValueLabel.js +49 -0
- package/modern/Slider/SliderValueLabel.types.js +1 -0
- package/modern/Slider/index.js +2 -1
- package/modern/Slider/sliderClasses.js +5 -0
- package/modern/Tabs/Tabs.js +3 -1
- package/modern/Tooltip/Tooltip.js +0 -1
- package/modern/index.js +3 -1
- package/modern/locale/index.js +85 -0
- package/modern/styles/experimental_extendTheme.js +16 -8
- package/node/Autocomplete/Autocomplete.js +1 -0
- package/node/FilledInput/FilledInput.js +0 -4
- package/node/Input/Input.js +1 -5
- package/node/MenuItem/MenuItem.js +2 -1
- package/node/Slider/Slider.js +228 -71
- package/node/Slider/SliderValueLabel.js +57 -0
- package/node/Slider/SliderValueLabel.types.js +5 -0
- package/node/Slider/index.js +11 -1
- package/node/Slider/sliderClasses.js +13 -0
- package/node/Tabs/Tabs.js +3 -1
- package/node/Tooltip/Tooltip.js +0 -1
- package/node/index.js +3 -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 +523 -787
- package/umd/material-ui.production.min.js +23 -21
|
@@ -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 (!("".concat(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["".concat(key, "Channel")] = safeColorChannel(obj[key], "MUI: Can't create `palette.".concat(key, "Channel` because `palette.").concat(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.".concat(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
|
var silent = function silent(fn) {
|
|
29
36
|
try {
|
|
30
37
|
return fn();
|
|
@@ -236,11 +243,12 @@ export default function extendTheme() {
|
|
|
236
243
|
setColor(palette.TableCell, 'border', safeDarken(safeAlpha(palette.divider, 1), 0.68));
|
|
237
244
|
setColor(palette.Tooltip, 'bg', safeAlpha(palette.grey[700], 0.92));
|
|
238
245
|
}
|
|
239
|
-
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.
|
|
240
246
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
247
|
+
// MUI X - DataGrid needs this token.
|
|
248
|
+
setColorChannel(palette.background, 'default');
|
|
249
|
+
setColorChannel(palette.common, 'background');
|
|
250
|
+
setColorChannel(palette.common, 'onBackground');
|
|
251
|
+
setColorChannel(palette, 'divider');
|
|
244
252
|
Object.keys(palette).forEach(function (color) {
|
|
245
253
|
var colors = palette[color];
|
|
246
254
|
|
|
@@ -262,16 +270,16 @@ export default function extendTheme() {
|
|
|
262
270
|
}
|
|
263
271
|
if (color === 'text') {
|
|
264
272
|
// Text colors: text.primary, text.secondary
|
|
265
|
-
|
|
266
|
-
|
|
273
|
+
setColorChannel(palette[color], 'primary');
|
|
274
|
+
setColorChannel(palette[color], 'secondary');
|
|
267
275
|
}
|
|
268
276
|
if (color === 'action') {
|
|
269
277
|
// Action colors: action.active, action.selected
|
|
270
278
|
if (colors.active) {
|
|
271
|
-
|
|
279
|
+
setColorChannel(palette[color], 'active');
|
|
272
280
|
}
|
|
273
281
|
if (colors.selected) {
|
|
274
|
-
|
|
282
|
+
setColorChannel(palette[color], 'selected');
|
|
275
283
|
}
|
|
276
284
|
}
|
|
277
285
|
}
|
package/locale/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const arSA: Localization;
|
|
|
27
27
|
export declare const arSD: Localization;
|
|
28
28
|
export declare const azAZ: Localization;
|
|
29
29
|
export declare const bnBD: Localization;
|
|
30
|
+
export declare const beBY: Localization;
|
|
30
31
|
export declare const bgBG: Localization;
|
|
31
32
|
export declare const caES: Localization;
|
|
32
33
|
export declare const csCZ: Localization;
|
package/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: {
|
|
@@ -89,12 +89,8 @@ const FilledInputRoot = styled(InputBaseRoot, {
|
|
|
89
89
|
[`&.${filledInputClasses.error}`]: {
|
|
90
90
|
'&:before, &:after': {
|
|
91
91
|
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
92
|
-
},
|
|
93
|
-
'&:focus-within:after': {
|
|
94
|
-
transform: 'scaleX(1)' // error is always underlined in red
|
|
95
92
|
}
|
|
96
93
|
},
|
|
97
|
-
|
|
98
94
|
'&:before': {
|
|
99
95
|
borderBottom: `1px solid ${theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})` : bottomLineColor}`,
|
|
100
96
|
left: 0,
|
package/modern/Input/Input.js
CHANGED
|
@@ -73,12 +73,8 @@ const InputRoot = styled(InputBaseRoot, {
|
|
|
73
73
|
[`&.${inputClasses.error}`]: {
|
|
74
74
|
'&:before, &:after': {
|
|
75
75
|
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
76
|
-
},
|
|
77
|
-
'&:focus-within:after': {
|
|
78
|
-
transform: 'scaleX(1)' // error is always underlined in red
|
|
79
76
|
}
|
|
80
77
|
},
|
|
81
|
-
|
|
82
78
|
'&:before': {
|
|
83
79
|
borderBottom: `1px solid ${bottomLineColor}`,
|
|
84
80
|
left: 0,
|
|
@@ -94,7 +90,7 @@ const InputRoot = styled(InputBaseRoot, {
|
|
|
94
90
|
},
|
|
95
91
|
|
|
96
92
|
[`&:hover:not(.${inputClasses.disabled}, .${inputClasses.error}):before`]: {
|
|
97
|
-
borderBottom: `
|
|
93
|
+
borderBottom: `2px solid ${(theme.vars || theme).palette.text.primary}`,
|
|
98
94
|
// Reset on touch devices, it doesn't add specificity
|
|
99
95
|
'@media (hover: none)': {
|
|
100
96
|
borderBottom: `1px solid ${bottomLineColor}`
|
|
@@ -242,7 +242,8 @@ process.env.NODE_ENV !== "production" ? MenuItem.propTypes /* remove-proptypes *
|
|
|
242
242
|
*/
|
|
243
243
|
role: PropTypes /* @typescript-to-proptypes-ignore */.string,
|
|
244
244
|
/**
|
|
245
|
-
*
|
|
245
|
+
* If `true`, the component is selected.
|
|
246
|
+
* @default false
|
|
246
247
|
*/
|
|
247
248
|
selected: PropTypes.bool,
|
|
248
249
|
/**
|
package/modern/Slider/Slider.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["component", "components", "componentsProps", "color", "size", "slotProps", "slots"];
|
|
3
|
+
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"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { chainPropTypes
|
|
8
|
-
import
|
|
7
|
+
import { chainPropTypes } from '@mui/utils';
|
|
8
|
+
import { isHostComponent, useSlotProps, unstable_composeClasses as composeClasses } from '@mui/base';
|
|
9
|
+
import { useSlider, getSliderUtilityClass } from '@mui/base/SliderUnstyled';
|
|
9
10
|
import { alpha, lighten, darken } from '@mui/system';
|
|
10
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
11
12
|
import styled, { slotShouldForwardProp } from '../styles/styled';
|
|
12
13
|
import useTheme from '../styles/useTheme';
|
|
13
14
|
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
14
15
|
import capitalize from '../utils/capitalize';
|
|
16
|
+
import SliderValueLabelComponent from './SliderValueLabel';
|
|
17
|
+
import sliderClasses from './sliderClasses';
|
|
15
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
const valueToPercent = (value, min, max) => (value - min) * 100 / (max - min);
|
|
21
|
+
function Identity(x) {
|
|
22
|
+
return x;
|
|
23
|
+
}
|
|
17
24
|
const SliderRoot = styled('span', {
|
|
18
25
|
name: 'MuiSlider',
|
|
19
26
|
slot: 'Root',
|
|
@@ -254,7 +261,7 @@ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes /* remove-proptype
|
|
|
254
261
|
children: PropTypes.node
|
|
255
262
|
} : void 0;
|
|
256
263
|
export { SliderThumb };
|
|
257
|
-
const SliderValueLabel = styled(
|
|
264
|
+
const SliderValueLabel = styled(SliderValueLabelComponent, {
|
|
258
265
|
name: 'MuiSlider',
|
|
259
266
|
slot: 'ValueLabel',
|
|
260
267
|
overridesResolver: (props, styles) => styles.valueLabel
|
|
@@ -403,17 +410,36 @@ process.env.NODE_ENV !== "production" ? SliderMarkLabel.propTypes /* remove-prop
|
|
|
403
410
|
children: PropTypes.node
|
|
404
411
|
} : void 0;
|
|
405
412
|
export { SliderMarkLabel };
|
|
406
|
-
const
|
|
413
|
+
const useUtilityClasses = ownerState => {
|
|
407
414
|
const {
|
|
415
|
+
disabled,
|
|
416
|
+
dragging,
|
|
417
|
+
marked,
|
|
418
|
+
orientation,
|
|
419
|
+
track,
|
|
420
|
+
classes,
|
|
408
421
|
color,
|
|
409
|
-
size
|
|
410
|
-
classes = {}
|
|
422
|
+
size
|
|
411
423
|
} = ownerState;
|
|
412
|
-
|
|
413
|
-
root:
|
|
414
|
-
|
|
415
|
-
|
|
424
|
+
const slots = {
|
|
425
|
+
root: ['root', disabled && 'disabled', dragging && 'dragging', marked && 'marked', orientation === 'vertical' && 'vertical', track === 'inverted' && 'trackInverted', track === false && 'trackFalse', color && `color${capitalize(color)}`, size && `size${capitalize(size)}`],
|
|
426
|
+
rail: ['rail'],
|
|
427
|
+
track: ['track'],
|
|
428
|
+
mark: ['mark'],
|
|
429
|
+
markActive: ['markActive'],
|
|
430
|
+
markLabel: ['markLabel'],
|
|
431
|
+
markLabelActive: ['markLabelActive'],
|
|
432
|
+
valueLabel: ['valueLabel'],
|
|
433
|
+
thumb: ['thumb', disabled && 'disabled', size && `thumbSize${capitalize(size)}`, color && `thumbColor${capitalize(color)}`],
|
|
434
|
+
active: ['active'],
|
|
435
|
+
disabled: ['disabled'],
|
|
436
|
+
focusVisible: ['focusVisible']
|
|
437
|
+
};
|
|
438
|
+
return composeClasses(slots, getSliderUtilityClass, classes);
|
|
416
439
|
};
|
|
440
|
+
const Forward = ({
|
|
441
|
+
children
|
|
442
|
+
}) => children;
|
|
417
443
|
const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
418
444
|
const props = useThemeProps({
|
|
419
445
|
props: inputProps,
|
|
@@ -422,21 +448,74 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
422
448
|
const theme = useTheme();
|
|
423
449
|
const isRtl = theme.direction === 'rtl';
|
|
424
450
|
const {
|
|
451
|
+
'aria-label': ariaLabel,
|
|
452
|
+
'aria-valuetext': ariaValuetext,
|
|
453
|
+
'aria-labelledby': ariaLabelledby,
|
|
425
454
|
// eslint-disable-next-line react/prop-types
|
|
426
455
|
component = 'span',
|
|
427
456
|
components = {},
|
|
428
457
|
componentsProps = {},
|
|
429
458
|
color = 'primary',
|
|
459
|
+
classes: classesProp,
|
|
460
|
+
// eslint-disable-next-line react/prop-types
|
|
461
|
+
className,
|
|
462
|
+
disableSwap = false,
|
|
463
|
+
disabled = false,
|
|
464
|
+
getAriaLabel,
|
|
465
|
+
getAriaValueText,
|
|
466
|
+
marks: marksProp = false,
|
|
467
|
+
max = 100,
|
|
468
|
+
min = 0,
|
|
469
|
+
orientation = 'horizontal',
|
|
430
470
|
size = 'medium',
|
|
471
|
+
step = 1,
|
|
472
|
+
scale = Identity,
|
|
431
473
|
slotProps,
|
|
432
|
-
slots
|
|
474
|
+
slots,
|
|
475
|
+
track = 'normal',
|
|
476
|
+
valueLabelDisplay = 'off',
|
|
477
|
+
valueLabelFormat = Identity
|
|
433
478
|
} = props,
|
|
434
479
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
435
480
|
const ownerState = _extends({}, props, {
|
|
481
|
+
isRtl,
|
|
482
|
+
max,
|
|
483
|
+
min,
|
|
484
|
+
classes: classesProp,
|
|
485
|
+
disabled,
|
|
486
|
+
disableSwap,
|
|
487
|
+
orientation,
|
|
488
|
+
marks: marksProp,
|
|
436
489
|
color,
|
|
437
|
-
size
|
|
490
|
+
size,
|
|
491
|
+
step,
|
|
492
|
+
scale,
|
|
493
|
+
track,
|
|
494
|
+
valueLabelDisplay,
|
|
495
|
+
valueLabelFormat
|
|
438
496
|
});
|
|
439
|
-
const
|
|
497
|
+
const {
|
|
498
|
+
axisProps,
|
|
499
|
+
getRootProps,
|
|
500
|
+
getHiddenInputProps,
|
|
501
|
+
getThumbProps,
|
|
502
|
+
open,
|
|
503
|
+
active,
|
|
504
|
+
axis,
|
|
505
|
+
focusedThumbIndex,
|
|
506
|
+
range,
|
|
507
|
+
dragging,
|
|
508
|
+
marks,
|
|
509
|
+
values,
|
|
510
|
+
trackOffset,
|
|
511
|
+
trackLeap
|
|
512
|
+
} = useSlider(_extends({}, ownerState, {
|
|
513
|
+
ref
|
|
514
|
+
}));
|
|
515
|
+
ownerState.marked = marks.length > 0 && marks.some(mark => mark.label);
|
|
516
|
+
ownerState.dragging = dragging;
|
|
517
|
+
ownerState.focusedThumbIndex = focusedThumbIndex;
|
|
518
|
+
const classes = useUtilityClasses(ownerState);
|
|
440
519
|
|
|
441
520
|
// support both `slots` and `components` for backward compatibility
|
|
442
521
|
const RootSlot = slots?.root ?? components.Root ?? SliderRoot;
|
|
@@ -446,7 +525,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
446
525
|
const ValueLabelSlot = slots?.valueLabel ?? components.ValueLabel ?? SliderValueLabel;
|
|
447
526
|
const MarkSlot = slots?.mark ?? components.Mark ?? SliderMark;
|
|
448
527
|
const MarkLabelSlot = slots?.markLabel ?? components.MarkLabel ?? SliderMarkLabel;
|
|
449
|
-
const InputSlot = slots?.input ?? components.Input;
|
|
528
|
+
const InputSlot = slots?.input ?? components.Input ?? 'input';
|
|
450
529
|
const rootSlotProps = slotProps?.root ?? componentsProps.root;
|
|
451
530
|
const railSlotProps = slotProps?.rail ?? componentsProps.rail;
|
|
452
531
|
const trackSlotProps = slotProps?.track ?? componentsProps.track;
|
|
@@ -455,51 +534,123 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
455
534
|
const markSlotProps = slotProps?.mark ?? componentsProps.mark;
|
|
456
535
|
const markLabelSlotProps = slotProps?.markLabel ?? componentsProps.markLabel;
|
|
457
536
|
const inputSlotProps = slotProps?.input ?? componentsProps.input;
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
valueLabel: ValueLabelSlot,
|
|
466
|
-
mark: MarkSlot,
|
|
467
|
-
markLabel: MarkLabelSlot,
|
|
468
|
-
input: InputSlot
|
|
469
|
-
},
|
|
470
|
-
slotProps: _extends({}, componentsProps, {
|
|
471
|
-
root: _extends({}, rootSlotProps, shouldSpreadAdditionalProps(RootSlot) && {
|
|
472
|
-
as: component,
|
|
473
|
-
ownerState: _extends({}, rootSlotProps?.ownerState, {
|
|
474
|
-
color,
|
|
475
|
-
size
|
|
476
|
-
})
|
|
477
|
-
}),
|
|
478
|
-
rail: railSlotProps,
|
|
479
|
-
thumb: _extends({}, thumbSlotProps, shouldSpreadAdditionalProps(ThumbSlot) && {
|
|
480
|
-
ownerState: _extends({}, thumbSlotProps?.ownerState, {
|
|
481
|
-
color,
|
|
482
|
-
size
|
|
483
|
-
})
|
|
484
|
-
}),
|
|
485
|
-
track: _extends({}, trackSlotProps, shouldSpreadAdditionalProps(TrackSlot) && {
|
|
486
|
-
ownerState: _extends({}, trackSlotProps?.ownerState, {
|
|
487
|
-
color,
|
|
488
|
-
size
|
|
489
|
-
})
|
|
490
|
-
}),
|
|
491
|
-
valueLabel: _extends({}, valueLabelSlotProps, shouldSpreadAdditionalProps(ValueLabelSlot) && {
|
|
492
|
-
ownerState: _extends({}, valueLabelSlotProps?.ownerState, {
|
|
493
|
-
color,
|
|
494
|
-
size
|
|
495
|
-
})
|
|
496
|
-
}),
|
|
497
|
-
mark: markSlotProps,
|
|
498
|
-
markLabel: markLabelSlotProps,
|
|
499
|
-
input: inputSlotProps
|
|
537
|
+
const rootProps = useSlotProps({
|
|
538
|
+
elementType: RootSlot,
|
|
539
|
+
getSlotProps: getRootProps,
|
|
540
|
+
externalSlotProps: rootSlotProps,
|
|
541
|
+
externalForwardedProps: other,
|
|
542
|
+
additionalProps: _extends({}, shouldSpreadAdditionalProps(RootSlot) && {
|
|
543
|
+
as: component
|
|
500
544
|
}),
|
|
501
|
-
|
|
502
|
-
|
|
545
|
+
ownerState: _extends({}, ownerState, rootSlotProps?.ownerState),
|
|
546
|
+
className: [classes.root, className]
|
|
547
|
+
});
|
|
548
|
+
const railProps = useSlotProps({
|
|
549
|
+
elementType: RailSlot,
|
|
550
|
+
externalSlotProps: railSlotProps,
|
|
551
|
+
ownerState,
|
|
552
|
+
className: classes.rail
|
|
553
|
+
});
|
|
554
|
+
const trackProps = useSlotProps({
|
|
555
|
+
elementType: TrackSlot,
|
|
556
|
+
externalSlotProps: trackSlotProps,
|
|
557
|
+
additionalProps: {
|
|
558
|
+
style: _extends({}, axisProps[axis].offset(trackOffset), axisProps[axis].leap(trackLeap))
|
|
559
|
+
},
|
|
560
|
+
ownerState: _extends({}, ownerState, trackSlotProps?.ownerState),
|
|
561
|
+
className: classes.track
|
|
562
|
+
});
|
|
563
|
+
const thumbProps = useSlotProps({
|
|
564
|
+
elementType: ThumbSlot,
|
|
565
|
+
getSlotProps: getThumbProps,
|
|
566
|
+
externalSlotProps: thumbSlotProps,
|
|
567
|
+
ownerState: _extends({}, ownerState, thumbSlotProps?.ownerState)
|
|
568
|
+
});
|
|
569
|
+
const valueLabelProps = useSlotProps({
|
|
570
|
+
elementType: ValueLabelSlot,
|
|
571
|
+
externalSlotProps: valueLabelSlotProps,
|
|
572
|
+
ownerState: _extends({}, ownerState, valueLabelSlotProps?.ownerState),
|
|
573
|
+
className: classes.valueLabel
|
|
574
|
+
});
|
|
575
|
+
const markProps = useSlotProps({
|
|
576
|
+
elementType: MarkSlot,
|
|
577
|
+
externalSlotProps: markSlotProps,
|
|
578
|
+
ownerState,
|
|
579
|
+
className: classes.mark
|
|
580
|
+
});
|
|
581
|
+
const markLabelProps = useSlotProps({
|
|
582
|
+
elementType: MarkLabelSlot,
|
|
583
|
+
externalSlotProps: markLabelSlotProps,
|
|
584
|
+
ownerState
|
|
585
|
+
});
|
|
586
|
+
const inputSliderProps = useSlotProps({
|
|
587
|
+
elementType: InputSlot,
|
|
588
|
+
getSlotProps: getHiddenInputProps,
|
|
589
|
+
externalSlotProps: inputSlotProps,
|
|
590
|
+
ownerState
|
|
591
|
+
});
|
|
592
|
+
return /*#__PURE__*/_jsxs(RootSlot, _extends({}, rootProps, {
|
|
593
|
+
children: [/*#__PURE__*/_jsx(RailSlot, _extends({}, railProps)), /*#__PURE__*/_jsx(TrackSlot, _extends({}, trackProps)), marks.filter(mark => mark.value >= min && mark.value <= max).map((mark, index) => {
|
|
594
|
+
const percent = valueToPercent(mark.value, min, max);
|
|
595
|
+
const style = axisProps[axis].offset(percent);
|
|
596
|
+
let markActive;
|
|
597
|
+
if (track === false) {
|
|
598
|
+
markActive = values.indexOf(mark.value) !== -1;
|
|
599
|
+
} else {
|
|
600
|
+
markActive = track === 'normal' && (range ? mark.value >= values[0] && mark.value <= values[values.length - 1] : mark.value <= values[0]) || track === 'inverted' && (range ? mark.value <= values[0] || mark.value >= values[values.length - 1] : mark.value >= values[0]);
|
|
601
|
+
}
|
|
602
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
603
|
+
children: [/*#__PURE__*/_jsx(MarkSlot, _extends({
|
|
604
|
+
"data-index": index
|
|
605
|
+
}, markProps, !isHostComponent(MarkSlot) && {
|
|
606
|
+
markActive
|
|
607
|
+
}, {
|
|
608
|
+
style: _extends({}, style, markProps.style),
|
|
609
|
+
className: clsx(markProps.className, markActive && classes.markActive)
|
|
610
|
+
})), mark.label != null ? /*#__PURE__*/_jsx(MarkLabelSlot, _extends({
|
|
611
|
+
"aria-hidden": true,
|
|
612
|
+
"data-index": index
|
|
613
|
+
}, markLabelProps, !isHostComponent(MarkLabelSlot) && {
|
|
614
|
+
markLabelActive: markActive
|
|
615
|
+
}, {
|
|
616
|
+
style: _extends({}, style, markLabelProps.style),
|
|
617
|
+
className: clsx(classes.markLabel, markLabelProps.className, markActive && classes.markLabelActive),
|
|
618
|
+
children: mark.label
|
|
619
|
+
})) : null]
|
|
620
|
+
}, index);
|
|
621
|
+
}), values.map((value, index) => {
|
|
622
|
+
const percent = valueToPercent(value, min, max);
|
|
623
|
+
const style = axisProps[axis].offset(percent);
|
|
624
|
+
const ValueLabelComponent = valueLabelDisplay === 'off' ? Forward : ValueLabelSlot;
|
|
625
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
626
|
+
children: /*#__PURE__*/_jsx(ValueLabelComponent, _extends({}, !isHostComponent(ValueLabelComponent) && {
|
|
627
|
+
valueLabelFormat,
|
|
628
|
+
valueLabelDisplay,
|
|
629
|
+
value: typeof valueLabelFormat === 'function' ? valueLabelFormat(scale(value), index) : valueLabelFormat,
|
|
630
|
+
index,
|
|
631
|
+
open: open === index || active === index || valueLabelDisplay === 'on',
|
|
632
|
+
disabled
|
|
633
|
+
}, valueLabelProps, {
|
|
634
|
+
children: /*#__PURE__*/_jsx(ThumbSlot, _extends({
|
|
635
|
+
"data-index": index,
|
|
636
|
+
"data-focusvisible": focusedThumbIndex === index
|
|
637
|
+
}, thumbProps, {
|
|
638
|
+
className: clsx(classes.thumb, thumbProps.className, active === index && classes.active, focusedThumbIndex === index && classes.focusVisible),
|
|
639
|
+
style: _extends({}, style, {
|
|
640
|
+
pointerEvents: disableSwap && active !== index ? 'none' : undefined
|
|
641
|
+
}, thumbProps.style),
|
|
642
|
+
children: /*#__PURE__*/_jsx(InputSlot, _extends({
|
|
643
|
+
"data-index": index,
|
|
644
|
+
"aria-label": getAriaLabel ? getAriaLabel(index) : ariaLabel,
|
|
645
|
+
"aria-valuenow": scale(value),
|
|
646
|
+
"aria-labelledby": ariaLabelledby,
|
|
647
|
+
"aria-valuetext": getAriaValueText ? getAriaValueText(scale(value), index) : ariaValuetext,
|
|
648
|
+
value: values[index]
|
|
649
|
+
}, inputSliderProps))
|
|
650
|
+
}))
|
|
651
|
+
}))
|
|
652
|
+
}, index);
|
|
653
|
+
})]
|
|
503
654
|
}));
|
|
504
655
|
});
|
|
505
656
|
process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */ = {
|
|
@@ -669,7 +820,11 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
669
820
|
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
670
821
|
/**
|
|
671
822
|
* A transformation function, to change the scale of the slider.
|
|
672
|
-
* @
|
|
823
|
+
* @param {any} x
|
|
824
|
+
* @returns {any}
|
|
825
|
+
* @default function Identity(x) {
|
|
826
|
+
* return x;
|
|
827
|
+
* }
|
|
673
828
|
*/
|
|
674
829
|
scale: PropTypes.func,
|
|
675
830
|
/**
|
|
@@ -760,7 +915,11 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
760
915
|
*
|
|
761
916
|
* - {number} value The value label's value to format
|
|
762
917
|
* - {number} index The value label's index to format
|
|
763
|
-
* @
|
|
918
|
+
* @param {any} x
|
|
919
|
+
* @returns {any}
|
|
920
|
+
* @default function Identity(x) {
|
|
921
|
+
* return x;
|
|
922
|
+
* }
|
|
764
923
|
*/
|
|
765
924
|
valueLabelFormat: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
|
|
766
925
|
} : void 0;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import sliderClasses from './sliderClasses';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const useValueLabelClasses = props => {
|
|
8
|
+
const {
|
|
9
|
+
open
|
|
10
|
+
} = props;
|
|
11
|
+
const utilityClasses = {
|
|
12
|
+
offset: clsx(open && sliderClasses.valueLabelOpen),
|
|
13
|
+
circle: sliderClasses.valueLabelCircle,
|
|
14
|
+
label: sliderClasses.valueLabelLabel
|
|
15
|
+
};
|
|
16
|
+
return utilityClasses;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @ignore - internal component.
|
|
21
|
+
*/
|
|
22
|
+
export default function SliderValueLabel(props) {
|
|
23
|
+
const {
|
|
24
|
+
children,
|
|
25
|
+
className,
|
|
26
|
+
value
|
|
27
|
+
} = props;
|
|
28
|
+
const classes = useValueLabelClasses(props);
|
|
29
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
30
|
+
className: clsx(children.props.className)
|
|
31
|
+
}, /*#__PURE__*/_jsxs(React.Fragment, {
|
|
32
|
+
children: [children.props.children, /*#__PURE__*/_jsx("span", {
|
|
33
|
+
className: clsx(classes.offset, className),
|
|
34
|
+
"aria-hidden": true,
|
|
35
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
36
|
+
className: classes.circle,
|
|
37
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
38
|
+
className: classes.label,
|
|
39
|
+
children: value
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
})]
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes = {
|
|
46
|
+
children: PropTypes.element.isRequired,
|
|
47
|
+
className: PropTypes.string,
|
|
48
|
+
value: PropTypes.node
|
|
49
|
+
} : void 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/modern/Slider/index.js
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
3
|
+
import { sliderUnstyledClasses } from '@mui/base/SliderUnstyled';
|
|
4
|
+
const sliderClasses = _extends({}, sliderUnstyledClasses, generateUtilityClasses('MuiSlider', ['colorPrimary', 'colorSecondary', 'thumbColorPrimary', 'thumbColorSecondary', 'sizeSmall', 'thumbSizeSmall']));
|
|
5
|
+
export default sliderClasses;
|
package/modern/Tabs/Tabs.js
CHANGED
|
@@ -307,7 +307,9 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
307
307
|
}
|
|
308
308
|
tabMeta = tab ? tab.getBoundingClientRect() : null;
|
|
309
309
|
if (process.env.NODE_ENV !== 'production') {
|
|
310
|
-
if (process.env.NODE_ENV !== 'test' && !warnedOnceTabPresent && tabMeta && tabMeta.width === 0 && tabMeta.height === 0
|
|
310
|
+
if (process.env.NODE_ENV !== 'test' && !warnedOnceTabPresent && tabMeta && tabMeta.width === 0 && tabMeta.height === 0 &&
|
|
311
|
+
// if the whole Tabs component is hidden, don't warn
|
|
312
|
+
tabsMeta.clientWidth !== 0) {
|
|
311
313
|
tabsMeta = null;
|
|
312
314
|
console.error(['MUI: The `value` provided to the Tabs component is invalid.', `The Tab with this \`value\` ("${value}") is not part of the document layout.`, "Make sure the tab item is present in the document or that it's not `display: none`."].join('\n'));
|
|
313
315
|
warnedOnceTabPresent = true;
|
|
@@ -567,7 +567,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
567
567
|
}) => /*#__PURE__*/_jsx(TransitionComponent, _extends({
|
|
568
568
|
timeout: theme.transitions.duration.shorter
|
|
569
569
|
}, TransitionPropsInner, transitionProps, {
|
|
570
|
-
"data-foo": "bar",
|
|
571
570
|
children: /*#__PURE__*/_jsxs(TooltipComponent, _extends({}, tooltipProps, {
|
|
572
571
|
children: [title, arrow ? /*#__PURE__*/_jsx(ArrowComponent, _extends({}, tooltipArrowProps, {
|
|
573
572
|
ref: setArrowRef
|