@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
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
|
}
|
|
@@ -99,12 +99,8 @@ const FilledInputRoot = (0, _styled.default)(_InputBase2.InputBaseRoot, {
|
|
|
99
99
|
[`&.${_filledInputClasses.default.error}`]: {
|
|
100
100
|
'&:before, &:after': {
|
|
101
101
|
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
102
|
-
},
|
|
103
|
-
'&:focus-within:after': {
|
|
104
|
-
transform: 'scaleX(1)' // error is always underlined in red
|
|
105
102
|
}
|
|
106
103
|
},
|
|
107
|
-
|
|
108
104
|
'&:before': {
|
|
109
105
|
borderBottom: `1px solid ${theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})` : bottomLineColor}`,
|
|
110
106
|
left: 0,
|
package/node/Input/Input.js
CHANGED
|
@@ -82,12 +82,8 @@ const InputRoot = (0, _styled.default)(_InputBase2.InputBaseRoot, {
|
|
|
82
82
|
[`&.${_inputClasses.default.error}`]: {
|
|
83
83
|
'&:before, &:after': {
|
|
84
84
|
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
85
|
-
},
|
|
86
|
-
'&:focus-within:after': {
|
|
87
|
-
transform: 'scaleX(1)' // error is always underlined in red
|
|
88
85
|
}
|
|
89
86
|
},
|
|
90
|
-
|
|
91
87
|
'&:before': {
|
|
92
88
|
borderBottom: `1px solid ${bottomLineColor}`,
|
|
93
89
|
left: 0,
|
|
@@ -103,7 +99,7 @@ const InputRoot = (0, _styled.default)(_InputBase2.InputBaseRoot, {
|
|
|
103
99
|
},
|
|
104
100
|
|
|
105
101
|
[`&:hover:not(.${_inputClasses.default.disabled}, .${_inputClasses.default.error}):before`]: {
|
|
106
|
-
borderBottom: `
|
|
102
|
+
borderBottom: `2px solid ${(theme.vars || theme).palette.text.primary}`,
|
|
107
103
|
// Reset on touch devices, it doesn't add specificity
|
|
108
104
|
'@media (hover: none)': {
|
|
109
105
|
borderBottom: `1px solid ${bottomLineColor}`
|
|
@@ -252,7 +252,8 @@ process.env.NODE_ENV !== "production" ? MenuItem.propTypes /* remove-proptypes *
|
|
|
252
252
|
*/
|
|
253
253
|
role: _propTypes.default /* @typescript-to-proptypes-ignore */.string,
|
|
254
254
|
/**
|
|
255
|
-
*
|
|
255
|
+
* If `true`, the component is selected.
|
|
256
|
+
* @default false
|
|
256
257
|
*/
|
|
257
258
|
selected: _propTypes.default.bool,
|
|
258
259
|
/**
|
package/node/Slider/Slider.js
CHANGED
|
@@ -4,26 +4,31 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.default = exports.SliderValueLabel = exports.SliderTrack = exports.SliderThumb = exports.SliderRoot = exports.SliderRail = exports.SliderMarkLabel = exports.SliderMark = void 0;
|
|
8
8
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
|
-
var
|
|
14
|
+
var _base = require("@mui/base");
|
|
15
|
+
var _SliderUnstyled = require("@mui/base/SliderUnstyled");
|
|
15
16
|
var _system = require("@mui/system");
|
|
16
17
|
var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
|
|
17
18
|
var _styled = _interopRequireWildcard(require("../styles/styled"));
|
|
18
19
|
var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
|
|
19
20
|
var _shouldSpreadAdditionalProps = _interopRequireDefault(require("../utils/shouldSpreadAdditionalProps"));
|
|
20
21
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
22
|
+
var _SliderValueLabel = _interopRequireDefault(require("./SliderValueLabel"));
|
|
23
|
+
var _sliderClasses = _interopRequireDefault(require("./sliderClasses"));
|
|
21
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _excluded = ["component", "components", "componentsProps", "color", "size", "slotProps", "slots"];
|
|
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"];
|
|
23
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); }
|
|
24
27
|
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; }
|
|
25
|
-
const
|
|
26
|
-
|
|
28
|
+
const valueToPercent = (value, min, max) => (value - min) * 100 / (max - min);
|
|
29
|
+
function Identity(x) {
|
|
30
|
+
return x;
|
|
31
|
+
}
|
|
27
32
|
const SliderRoot = (0, _styled.default)('span', {
|
|
28
33
|
name: 'MuiSlider',
|
|
29
34
|
slot: 'Root',
|
|
@@ -75,13 +80,13 @@ const SliderRoot = (0, _styled.default)('span', {
|
|
|
75
80
|
'@media print': {
|
|
76
81
|
colorAdjust: 'exact'
|
|
77
82
|
},
|
|
78
|
-
[`&.${
|
|
83
|
+
[`&.${_sliderClasses.default.disabled}`]: {
|
|
79
84
|
pointerEvents: 'none',
|
|
80
85
|
cursor: 'default',
|
|
81
86
|
color: (theme.vars || theme).palette.grey[400]
|
|
82
87
|
},
|
|
83
|
-
[`&.${
|
|
84
|
-
[`& .${
|
|
88
|
+
[`&.${_sliderClasses.default.dragging}`]: {
|
|
89
|
+
[`& .${_sliderClasses.default.thumb}, & .${_sliderClasses.default.track}`]: {
|
|
85
90
|
transition: 'none'
|
|
86
91
|
}
|
|
87
92
|
}
|
|
@@ -238,16 +243,16 @@ const SliderThumb = (0, _styled.default)('span', {
|
|
|
238
243
|
left: '50%',
|
|
239
244
|
transform: 'translate(-50%, -50%)'
|
|
240
245
|
},
|
|
241
|
-
[`&:hover, &.${
|
|
246
|
+
[`&:hover, &.${_sliderClasses.default.focusVisible}`]: {
|
|
242
247
|
boxShadow: `0px 0px 0px 8px ${theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.16)` : (0, _system.alpha)(theme.palette[ownerState.color].main, 0.16)}`,
|
|
243
248
|
'@media (hover: none)': {
|
|
244
249
|
boxShadow: 'none'
|
|
245
250
|
}
|
|
246
251
|
},
|
|
247
|
-
[`&.${
|
|
252
|
+
[`&.${_sliderClasses.default.active}`]: {
|
|
248
253
|
boxShadow: `0px 0px 0px 14px ${theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.16)` : (0, _system.alpha)(theme.palette[ownerState.color].main, 0.16)}`
|
|
249
254
|
},
|
|
250
|
-
[`&.${
|
|
255
|
+
[`&.${_sliderClasses.default.disabled}`]: {
|
|
251
256
|
'&:hover': {
|
|
252
257
|
boxShadow: 'none'
|
|
253
258
|
}
|
|
@@ -264,7 +269,7 @@ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes /* remove-proptype
|
|
|
264
269
|
*/
|
|
265
270
|
children: _propTypes.default.node
|
|
266
271
|
} : void 0;
|
|
267
|
-
const SliderValueLabel = (0, _styled.default)(
|
|
272
|
+
const SliderValueLabel = (0, _styled.default)(_SliderValueLabel.default, {
|
|
268
273
|
name: 'MuiSlider',
|
|
269
274
|
slot: 'ValueLabel',
|
|
270
275
|
overridesResolver: (props, styles) => styles.valueLabel
|
|
@@ -272,7 +277,7 @@ const SliderValueLabel = (0, _styled.default)(_SliderUnstyled.SliderValueLabelUn
|
|
|
272
277
|
theme,
|
|
273
278
|
ownerState
|
|
274
279
|
}) => (0, _extends2.default)({
|
|
275
|
-
[`&.${
|
|
280
|
+
[`&.${_sliderClasses.default.valueLabelOpen}`]: {
|
|
276
281
|
transform: 'translateY(-100%) scale(1)'
|
|
277
282
|
},
|
|
278
283
|
zIndex: 1,
|
|
@@ -413,19 +418,38 @@ process.env.NODE_ENV !== "production" ? SliderMarkLabel.propTypes /* remove-prop
|
|
|
413
418
|
*/
|
|
414
419
|
children: _propTypes.default.node
|
|
415
420
|
} : void 0;
|
|
416
|
-
const
|
|
421
|
+
const useUtilityClasses = ownerState => {
|
|
417
422
|
const {
|
|
423
|
+
disabled,
|
|
424
|
+
dragging,
|
|
425
|
+
marked,
|
|
426
|
+
orientation,
|
|
427
|
+
track,
|
|
428
|
+
classes,
|
|
418
429
|
color,
|
|
419
|
-
size
|
|
420
|
-
classes = {}
|
|
430
|
+
size
|
|
421
431
|
} = ownerState;
|
|
422
|
-
|
|
423
|
-
root:
|
|
424
|
-
|
|
425
|
-
|
|
432
|
+
const slots = {
|
|
433
|
+
root: ['root', disabled && 'disabled', dragging && 'dragging', marked && 'marked', orientation === 'vertical' && 'vertical', track === 'inverted' && 'trackInverted', track === false && 'trackFalse', color && `color${(0, _capitalize.default)(color)}`, size && `size${(0, _capitalize.default)(size)}`],
|
|
434
|
+
rail: ['rail'],
|
|
435
|
+
track: ['track'],
|
|
436
|
+
mark: ['mark'],
|
|
437
|
+
markActive: ['markActive'],
|
|
438
|
+
markLabel: ['markLabel'],
|
|
439
|
+
markLabelActive: ['markLabelActive'],
|
|
440
|
+
valueLabel: ['valueLabel'],
|
|
441
|
+
thumb: ['thumb', disabled && 'disabled', size && `thumbSize${(0, _capitalize.default)(size)}`, color && `thumbColor${(0, _capitalize.default)(color)}`],
|
|
442
|
+
active: ['active'],
|
|
443
|
+
disabled: ['disabled'],
|
|
444
|
+
focusVisible: ['focusVisible']
|
|
445
|
+
};
|
|
446
|
+
return (0, _base.unstable_composeClasses)(slots, _SliderUnstyled.getSliderUtilityClass, classes);
|
|
426
447
|
};
|
|
448
|
+
const Forward = ({
|
|
449
|
+
children
|
|
450
|
+
}) => children;
|
|
427
451
|
const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
428
|
-
var _ref, _slots$root, _ref2, _slots$rail, _ref3, _slots$track, _ref4, _slots$thumb, _ref5, _slots$valueLabel, _ref6, _slots$mark, _ref7, _slots$markLabel, _slots$input, _slotProps$root, _slotProps$rail, _slotProps$track, _slotProps$thumb, _slotProps$valueLabel, _slotProps$mark, _slotProps$markLabel, _slotProps$input;
|
|
452
|
+
var _ref, _slots$root, _ref2, _slots$rail, _ref3, _slots$track, _ref4, _slots$thumb, _ref5, _slots$valueLabel, _ref6, _slots$mark, _ref7, _slots$markLabel, _ref8, _slots$input, _slotProps$root, _slotProps$rail, _slotProps$track, _slotProps$thumb, _slotProps$valueLabel, _slotProps$mark, _slotProps$markLabel, _slotProps$input;
|
|
429
453
|
const props = (0, _useThemeProps.default)({
|
|
430
454
|
props: inputProps,
|
|
431
455
|
name: 'MuiSlider'
|
|
@@ -433,21 +457,74 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
433
457
|
const theme = (0, _useTheme.default)();
|
|
434
458
|
const isRtl = theme.direction === 'rtl';
|
|
435
459
|
const {
|
|
460
|
+
'aria-label': ariaLabel,
|
|
461
|
+
'aria-valuetext': ariaValuetext,
|
|
462
|
+
'aria-labelledby': ariaLabelledby,
|
|
436
463
|
// eslint-disable-next-line react/prop-types
|
|
437
464
|
component = 'span',
|
|
438
465
|
components = {},
|
|
439
466
|
componentsProps = {},
|
|
440
467
|
color = 'primary',
|
|
468
|
+
classes: classesProp,
|
|
469
|
+
// eslint-disable-next-line react/prop-types
|
|
470
|
+
className,
|
|
471
|
+
disableSwap = false,
|
|
472
|
+
disabled = false,
|
|
473
|
+
getAriaLabel,
|
|
474
|
+
getAriaValueText,
|
|
475
|
+
marks: marksProp = false,
|
|
476
|
+
max = 100,
|
|
477
|
+
min = 0,
|
|
478
|
+
orientation = 'horizontal',
|
|
441
479
|
size = 'medium',
|
|
480
|
+
step = 1,
|
|
481
|
+
scale = Identity,
|
|
442
482
|
slotProps,
|
|
443
|
-
slots
|
|
483
|
+
slots,
|
|
484
|
+
track = 'normal',
|
|
485
|
+
valueLabelDisplay = 'off',
|
|
486
|
+
valueLabelFormat = Identity
|
|
444
487
|
} = props,
|
|
445
488
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
446
489
|
const ownerState = (0, _extends2.default)({}, props, {
|
|
490
|
+
isRtl,
|
|
491
|
+
max,
|
|
492
|
+
min,
|
|
493
|
+
classes: classesProp,
|
|
494
|
+
disabled,
|
|
495
|
+
disableSwap,
|
|
496
|
+
orientation,
|
|
497
|
+
marks: marksProp,
|
|
447
498
|
color,
|
|
448
|
-
size
|
|
499
|
+
size,
|
|
500
|
+
step,
|
|
501
|
+
scale,
|
|
502
|
+
track,
|
|
503
|
+
valueLabelDisplay,
|
|
504
|
+
valueLabelFormat
|
|
449
505
|
});
|
|
450
|
-
const
|
|
506
|
+
const {
|
|
507
|
+
axisProps,
|
|
508
|
+
getRootProps,
|
|
509
|
+
getHiddenInputProps,
|
|
510
|
+
getThumbProps,
|
|
511
|
+
open,
|
|
512
|
+
active,
|
|
513
|
+
axis,
|
|
514
|
+
focusedThumbIndex,
|
|
515
|
+
range,
|
|
516
|
+
dragging,
|
|
517
|
+
marks,
|
|
518
|
+
values,
|
|
519
|
+
trackOffset,
|
|
520
|
+
trackLeap
|
|
521
|
+
} = (0, _SliderUnstyled.useSlider)((0, _extends2.default)({}, ownerState, {
|
|
522
|
+
ref
|
|
523
|
+
}));
|
|
524
|
+
ownerState.marked = marks.length > 0 && marks.some(mark => mark.label);
|
|
525
|
+
ownerState.dragging = dragging;
|
|
526
|
+
ownerState.focusedThumbIndex = focusedThumbIndex;
|
|
527
|
+
const classes = useUtilityClasses(ownerState);
|
|
451
528
|
|
|
452
529
|
// support both `slots` and `components` for backward compatibility
|
|
453
530
|
const RootSlot = (_ref = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components.Root) != null ? _ref : SliderRoot;
|
|
@@ -457,7 +534,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
457
534
|
const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : SliderValueLabel;
|
|
458
535
|
const MarkSlot = (_ref6 = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : components.Mark) != null ? _ref6 : SliderMark;
|
|
459
536
|
const MarkLabelSlot = (_ref7 = (_slots$markLabel = slots == null ? void 0 : slots.markLabel) != null ? _slots$markLabel : components.MarkLabel) != null ? _ref7 : SliderMarkLabel;
|
|
460
|
-
const InputSlot = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input;
|
|
537
|
+
const InputSlot = (_ref8 = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input) != null ? _ref8 : 'input';
|
|
461
538
|
const rootSlotProps = (_slotProps$root = slotProps == null ? void 0 : slotProps.root) != null ? _slotProps$root : componentsProps.root;
|
|
462
539
|
const railSlotProps = (_slotProps$rail = slotProps == null ? void 0 : slotProps.rail) != null ? _slotProps$rail : componentsProps.rail;
|
|
463
540
|
const trackSlotProps = (_slotProps$track = slotProps == null ? void 0 : slotProps.track) != null ? _slotProps$track : componentsProps.track;
|
|
@@ -466,51 +543,123 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
466
543
|
const markSlotProps = (_slotProps$mark = slotProps == null ? void 0 : slotProps.mark) != null ? _slotProps$mark : componentsProps.mark;
|
|
467
544
|
const markLabelSlotProps = (_slotProps$markLabel = slotProps == null ? void 0 : slotProps.markLabel) != null ? _slotProps$markLabel : componentsProps.markLabel;
|
|
468
545
|
const inputSlotProps = (_slotProps$input = slotProps == null ? void 0 : slotProps.input) != null ? _slotProps$input : componentsProps.input;
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
valueLabel: ValueLabelSlot,
|
|
477
|
-
mark: MarkSlot,
|
|
478
|
-
markLabel: MarkLabelSlot,
|
|
479
|
-
input: InputSlot
|
|
480
|
-
},
|
|
481
|
-
slotProps: (0, _extends2.default)({}, componentsProps, {
|
|
482
|
-
root: (0, _extends2.default)({}, rootSlotProps, (0, _shouldSpreadAdditionalProps.default)(RootSlot) && {
|
|
483
|
-
as: component,
|
|
484
|
-
ownerState: (0, _extends2.default)({}, rootSlotProps == null ? void 0 : rootSlotProps.ownerState, {
|
|
485
|
-
color,
|
|
486
|
-
size
|
|
487
|
-
})
|
|
488
|
-
}),
|
|
489
|
-
rail: railSlotProps,
|
|
490
|
-
thumb: (0, _extends2.default)({}, thumbSlotProps, (0, _shouldSpreadAdditionalProps.default)(ThumbSlot) && {
|
|
491
|
-
ownerState: (0, _extends2.default)({}, thumbSlotProps == null ? void 0 : thumbSlotProps.ownerState, {
|
|
492
|
-
color,
|
|
493
|
-
size
|
|
494
|
-
})
|
|
495
|
-
}),
|
|
496
|
-
track: (0, _extends2.default)({}, trackSlotProps, (0, _shouldSpreadAdditionalProps.default)(TrackSlot) && {
|
|
497
|
-
ownerState: (0, _extends2.default)({}, trackSlotProps == null ? void 0 : trackSlotProps.ownerState, {
|
|
498
|
-
color,
|
|
499
|
-
size
|
|
500
|
-
})
|
|
501
|
-
}),
|
|
502
|
-
valueLabel: (0, _extends2.default)({}, valueLabelSlotProps, (0, _shouldSpreadAdditionalProps.default)(ValueLabelSlot) && {
|
|
503
|
-
ownerState: (0, _extends2.default)({}, valueLabelSlotProps == null ? void 0 : valueLabelSlotProps.ownerState, {
|
|
504
|
-
color,
|
|
505
|
-
size
|
|
506
|
-
})
|
|
507
|
-
}),
|
|
508
|
-
mark: markSlotProps,
|
|
509
|
-
markLabel: markLabelSlotProps,
|
|
510
|
-
input: inputSlotProps
|
|
546
|
+
const rootProps = (0, _base.useSlotProps)({
|
|
547
|
+
elementType: RootSlot,
|
|
548
|
+
getSlotProps: getRootProps,
|
|
549
|
+
externalSlotProps: rootSlotProps,
|
|
550
|
+
externalForwardedProps: other,
|
|
551
|
+
additionalProps: (0, _extends2.default)({}, (0, _shouldSpreadAdditionalProps.default)(RootSlot) && {
|
|
552
|
+
as: component
|
|
511
553
|
}),
|
|
512
|
-
|
|
513
|
-
|
|
554
|
+
ownerState: (0, _extends2.default)({}, ownerState, rootSlotProps == null ? void 0 : rootSlotProps.ownerState),
|
|
555
|
+
className: [classes.root, className]
|
|
556
|
+
});
|
|
557
|
+
const railProps = (0, _base.useSlotProps)({
|
|
558
|
+
elementType: RailSlot,
|
|
559
|
+
externalSlotProps: railSlotProps,
|
|
560
|
+
ownerState,
|
|
561
|
+
className: classes.rail
|
|
562
|
+
});
|
|
563
|
+
const trackProps = (0, _base.useSlotProps)({
|
|
564
|
+
elementType: TrackSlot,
|
|
565
|
+
externalSlotProps: trackSlotProps,
|
|
566
|
+
additionalProps: {
|
|
567
|
+
style: (0, _extends2.default)({}, axisProps[axis].offset(trackOffset), axisProps[axis].leap(trackLeap))
|
|
568
|
+
},
|
|
569
|
+
ownerState: (0, _extends2.default)({}, ownerState, trackSlotProps == null ? void 0 : trackSlotProps.ownerState),
|
|
570
|
+
className: classes.track
|
|
571
|
+
});
|
|
572
|
+
const thumbProps = (0, _base.useSlotProps)({
|
|
573
|
+
elementType: ThumbSlot,
|
|
574
|
+
getSlotProps: getThumbProps,
|
|
575
|
+
externalSlotProps: thumbSlotProps,
|
|
576
|
+
ownerState: (0, _extends2.default)({}, ownerState, thumbSlotProps == null ? void 0 : thumbSlotProps.ownerState)
|
|
577
|
+
});
|
|
578
|
+
const valueLabelProps = (0, _base.useSlotProps)({
|
|
579
|
+
elementType: ValueLabelSlot,
|
|
580
|
+
externalSlotProps: valueLabelSlotProps,
|
|
581
|
+
ownerState: (0, _extends2.default)({}, ownerState, valueLabelSlotProps == null ? void 0 : valueLabelSlotProps.ownerState),
|
|
582
|
+
className: classes.valueLabel
|
|
583
|
+
});
|
|
584
|
+
const markProps = (0, _base.useSlotProps)({
|
|
585
|
+
elementType: MarkSlot,
|
|
586
|
+
externalSlotProps: markSlotProps,
|
|
587
|
+
ownerState,
|
|
588
|
+
className: classes.mark
|
|
589
|
+
});
|
|
590
|
+
const markLabelProps = (0, _base.useSlotProps)({
|
|
591
|
+
elementType: MarkLabelSlot,
|
|
592
|
+
externalSlotProps: markLabelSlotProps,
|
|
593
|
+
ownerState
|
|
594
|
+
});
|
|
595
|
+
const inputSliderProps = (0, _base.useSlotProps)({
|
|
596
|
+
elementType: InputSlot,
|
|
597
|
+
getSlotProps: getHiddenInputProps,
|
|
598
|
+
externalSlotProps: inputSlotProps,
|
|
599
|
+
ownerState
|
|
600
|
+
});
|
|
601
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, (0, _extends2.default)({}, rootProps, {
|
|
602
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(RailSlot, (0, _extends2.default)({}, railProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(TrackSlot, (0, _extends2.default)({}, trackProps)), marks.filter(mark => mark.value >= min && mark.value <= max).map((mark, index) => {
|
|
603
|
+
const percent = valueToPercent(mark.value, min, max);
|
|
604
|
+
const style = axisProps[axis].offset(percent);
|
|
605
|
+
let markActive;
|
|
606
|
+
if (track === false) {
|
|
607
|
+
markActive = values.indexOf(mark.value) !== -1;
|
|
608
|
+
} else {
|
|
609
|
+
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]);
|
|
610
|
+
}
|
|
611
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
612
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(MarkSlot, (0, _extends2.default)({
|
|
613
|
+
"data-index": index
|
|
614
|
+
}, markProps, !(0, _base.isHostComponent)(MarkSlot) && {
|
|
615
|
+
markActive
|
|
616
|
+
}, {
|
|
617
|
+
style: (0, _extends2.default)({}, style, markProps.style),
|
|
618
|
+
className: (0, _clsx.default)(markProps.className, markActive && classes.markActive)
|
|
619
|
+
})), mark.label != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(MarkLabelSlot, (0, _extends2.default)({
|
|
620
|
+
"aria-hidden": true,
|
|
621
|
+
"data-index": index
|
|
622
|
+
}, markLabelProps, !(0, _base.isHostComponent)(MarkLabelSlot) && {
|
|
623
|
+
markLabelActive: markActive
|
|
624
|
+
}, {
|
|
625
|
+
style: (0, _extends2.default)({}, style, markLabelProps.style),
|
|
626
|
+
className: (0, _clsx.default)(classes.markLabel, markLabelProps.className, markActive && classes.markLabelActive),
|
|
627
|
+
children: mark.label
|
|
628
|
+
})) : null]
|
|
629
|
+
}, index);
|
|
630
|
+
}), values.map((value, index) => {
|
|
631
|
+
const percent = valueToPercent(value, min, max);
|
|
632
|
+
const style = axisProps[axis].offset(percent);
|
|
633
|
+
const ValueLabelComponent = valueLabelDisplay === 'off' ? Forward : ValueLabelSlot;
|
|
634
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
635
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ValueLabelComponent, (0, _extends2.default)({}, !(0, _base.isHostComponent)(ValueLabelComponent) && {
|
|
636
|
+
valueLabelFormat,
|
|
637
|
+
valueLabelDisplay,
|
|
638
|
+
value: typeof valueLabelFormat === 'function' ? valueLabelFormat(scale(value), index) : valueLabelFormat,
|
|
639
|
+
index,
|
|
640
|
+
open: open === index || active === index || valueLabelDisplay === 'on',
|
|
641
|
+
disabled
|
|
642
|
+
}, valueLabelProps, {
|
|
643
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ThumbSlot, (0, _extends2.default)({
|
|
644
|
+
"data-index": index,
|
|
645
|
+
"data-focusvisible": focusedThumbIndex === index
|
|
646
|
+
}, thumbProps, {
|
|
647
|
+
className: (0, _clsx.default)(classes.thumb, thumbProps.className, active === index && classes.active, focusedThumbIndex === index && classes.focusVisible),
|
|
648
|
+
style: (0, _extends2.default)({}, style, {
|
|
649
|
+
pointerEvents: disableSwap && active !== index ? 'none' : undefined
|
|
650
|
+
}, thumbProps.style),
|
|
651
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InputSlot, (0, _extends2.default)({
|
|
652
|
+
"data-index": index,
|
|
653
|
+
"aria-label": getAriaLabel ? getAriaLabel(index) : ariaLabel,
|
|
654
|
+
"aria-valuenow": scale(value),
|
|
655
|
+
"aria-labelledby": ariaLabelledby,
|
|
656
|
+
"aria-valuetext": getAriaValueText ? getAriaValueText(scale(value), index) : ariaValuetext,
|
|
657
|
+
value: values[index]
|
|
658
|
+
}, inputSliderProps))
|
|
659
|
+
}))
|
|
660
|
+
}))
|
|
661
|
+
}, index);
|
|
662
|
+
})]
|
|
514
663
|
}));
|
|
515
664
|
});
|
|
516
665
|
process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */ = {
|
|
@@ -680,7 +829,11 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
680
829
|
orientation: _propTypes.default.oneOf(['horizontal', 'vertical']),
|
|
681
830
|
/**
|
|
682
831
|
* A transformation function, to change the scale of the slider.
|
|
683
|
-
* @
|
|
832
|
+
* @param {any} x
|
|
833
|
+
* @returns {any}
|
|
834
|
+
* @default function Identity(x) {
|
|
835
|
+
* return x;
|
|
836
|
+
* }
|
|
684
837
|
*/
|
|
685
838
|
scale: _propTypes.default.func,
|
|
686
839
|
/**
|
|
@@ -771,7 +924,11 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
771
924
|
*
|
|
772
925
|
* - {number} value The value label's value to format
|
|
773
926
|
* - {number} index The value label's index to format
|
|
774
|
-
* @
|
|
927
|
+
* @param {any} x
|
|
928
|
+
* @returns {any}
|
|
929
|
+
* @default function Identity(x) {
|
|
930
|
+
* return x;
|
|
931
|
+
* }
|
|
775
932
|
*/
|
|
776
933
|
valueLabelFormat: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string])
|
|
777
934
|
} : void 0;
|