@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
|
@@ -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: {
|
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],
|
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 } 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 SliderValueLabel from './SliderValueLabel';
|
|
17
|
+
import sliderClasses, { getSliderUtilityClass } 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
|
|
264
|
+
const StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
258
265
|
name: 'MuiSlider',
|
|
259
266
|
slot: 'ValueLabel',
|
|
260
267
|
overridesResolver: (props, styles) => styles.valueLabel
|
|
@@ -312,7 +319,7 @@ const SliderValueLabel = styled(SliderValueLabelUnstyled, {
|
|
|
312
319
|
fontSize: theme.typography.pxToRem(12),
|
|
313
320
|
padding: '0.25rem 0.5rem'
|
|
314
321
|
}));
|
|
315
|
-
process.env.NODE_ENV !== "production" ?
|
|
322
|
+
process.env.NODE_ENV !== "production" ? StyledSliderValueLabel.propTypes /* remove-proptypes */ = {
|
|
316
323
|
// ----------------------------- Warning --------------------------------
|
|
317
324
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
318
325
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
@@ -322,7 +329,7 @@ process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes /* remove-pro
|
|
|
322
329
|
*/
|
|
323
330
|
children: PropTypes.node
|
|
324
331
|
} : void 0;
|
|
325
|
-
export { SliderValueLabel };
|
|
332
|
+
export { StyledSliderValueLabel as SliderValueLabel };
|
|
326
333
|
const SliderMark = styled('span', {
|
|
327
334
|
name: 'MuiSlider',
|
|
328
335
|
slot: 'Mark',
|
|
@@ -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,31 +448,84 @@ 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;
|
|
443
522
|
const RailSlot = slots?.rail ?? components.Rail ?? SliderRail;
|
|
444
523
|
const TrackSlot = slots?.track ?? components.Track ?? SliderTrack;
|
|
445
524
|
const ThumbSlot = slots?.thumb ?? components.Thumb ?? SliderThumb;
|
|
446
|
-
const ValueLabelSlot = slots?.valueLabel ?? components.ValueLabel ??
|
|
525
|
+
const ValueLabelSlot = slots?.valueLabel ?? components.ValueLabel ?? StyledSliderValueLabel;
|
|
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,52 @@
|
|
|
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
|
+
if (!children) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
33
|
+
className: clsx(children.props.className)
|
|
34
|
+
}, /*#__PURE__*/_jsxs(React.Fragment, {
|
|
35
|
+
children: [children.props.children, /*#__PURE__*/_jsx("span", {
|
|
36
|
+
className: clsx(classes.offset, className),
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
39
|
+
className: classes.circle,
|
|
40
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
41
|
+
className: classes.label,
|
|
42
|
+
children: value
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
})]
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes = {
|
|
49
|
+
children: PropTypes.element.isRequired,
|
|
50
|
+
className: PropTypes.string,
|
|
51
|
+
value: PropTypes.node
|
|
52
|
+
} : void 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/modern/Slider/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
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']);
|
|
7
|
+
export default sliderClasses;
|