@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
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 = _interopRequireWildcard(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
|
|
272
|
+
const StyledSliderValueLabel = (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,
|
|
@@ -322,8 +327,8 @@ const SliderValueLabel = (0, _styled.default)(_SliderUnstyled.SliderValueLabelUn
|
|
|
322
327
|
fontSize: theme.typography.pxToRem(12),
|
|
323
328
|
padding: '0.25rem 0.5rem'
|
|
324
329
|
}));
|
|
325
|
-
exports.SliderValueLabel =
|
|
326
|
-
process.env.NODE_ENV !== "production" ?
|
|
330
|
+
exports.SliderValueLabel = StyledSliderValueLabel;
|
|
331
|
+
process.env.NODE_ENV !== "production" ? StyledSliderValueLabel.propTypes /* remove-proptypes */ = {
|
|
327
332
|
// ----------------------------- Warning --------------------------------
|
|
328
333
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
329
334
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
@@ -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, _sliderClasses.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,31 +457,84 @@ 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;
|
|
454
531
|
const RailSlot = (_ref2 = (_slots$rail = slots == null ? void 0 : slots.rail) != null ? _slots$rail : components.Rail) != null ? _ref2 : SliderRail;
|
|
455
532
|
const TrackSlot = (_ref3 = (_slots$track = slots == null ? void 0 : slots.track) != null ? _slots$track : components.Track) != null ? _ref3 : SliderTrack;
|
|
456
533
|
const ThumbSlot = (_ref4 = (_slots$thumb = slots == null ? void 0 : slots.thumb) != null ? _slots$thumb : components.Thumb) != null ? _ref4 : SliderThumb;
|
|
457
|
-
const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 :
|
|
534
|
+
const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : StyledSliderValueLabel;
|
|
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;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = SliderValueLabel;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
+
var _sliderClasses = _interopRequireDefault(require("./sliderClasses"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
const useValueLabelClasses = props => {
|
|
16
|
+
const {
|
|
17
|
+
open
|
|
18
|
+
} = props;
|
|
19
|
+
const utilityClasses = {
|
|
20
|
+
offset: (0, _clsx.default)(open && _sliderClasses.default.valueLabelOpen),
|
|
21
|
+
circle: _sliderClasses.default.valueLabelCircle,
|
|
22
|
+
label: _sliderClasses.default.valueLabelLabel
|
|
23
|
+
};
|
|
24
|
+
return utilityClasses;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @ignore - internal component.
|
|
29
|
+
*/
|
|
30
|
+
function SliderValueLabel(props) {
|
|
31
|
+
const {
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
value
|
|
35
|
+
} = props;
|
|
36
|
+
const classes = useValueLabelClasses(props);
|
|
37
|
+
if (!children) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
41
|
+
className: (0, _clsx.default)(children.props.className)
|
|
42
|
+
}, /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
43
|
+
children: [children.props.children, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
44
|
+
className: (0, _clsx.default)(classes.offset, className),
|
|
45
|
+
"aria-hidden": true,
|
|
46
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
47
|
+
className: classes.circle,
|
|
48
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
49
|
+
className: classes.label,
|
|
50
|
+
children: value
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes = {
|
|
57
|
+
children: _propTypes.default.element.isRequired,
|
|
58
|
+
className: _propTypes.default.string,
|
|
59
|
+
value: _propTypes.default.node
|
|
60
|
+
} : void 0;
|
package/node/Slider/index.js
CHANGED
|
@@ -3,13 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _exportNames = {
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
sliderClasses: true
|
|
8
|
+
};
|
|
7
9
|
Object.defineProperty(exports, "default", {
|
|
8
10
|
enumerable: true,
|
|
9
11
|
get: function () {
|
|
10
12
|
return _Slider.default;
|
|
11
13
|
}
|
|
12
14
|
});
|
|
15
|
+
Object.defineProperty(exports, "sliderClasses", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return _sliderClasses.default;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
13
21
|
var _Slider = _interopRequireWildcard(require("./Slider"));
|
|
14
22
|
Object.keys(_Slider).forEach(function (key) {
|
|
15
23
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -22,5 +30,17 @@ Object.keys(_Slider).forEach(function (key) {
|
|
|
22
30
|
}
|
|
23
31
|
});
|
|
24
32
|
});
|
|
33
|
+
var _sliderClasses = _interopRequireWildcard(require("./sliderClasses"));
|
|
34
|
+
Object.keys(_sliderClasses).forEach(function (key) {
|
|
35
|
+
if (key === "default" || key === "__esModule") return;
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
37
|
+
if (key in exports && exports[key] === _sliderClasses[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _sliderClasses[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
25
45
|
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); }
|
|
26
46
|
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; }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
exports.getSliderUtilityClass = getSliderUtilityClass;
|
|
9
|
+
var _utils = require("@mui/utils");
|
|
10
|
+
var _generateUtilityClass = _interopRequireDefault(require("../generateUtilityClass"));
|
|
11
|
+
function getSliderUtilityClass(slot) {
|
|
12
|
+
return (0, _generateUtilityClass.default)('MuiSlider', slot);
|
|
13
|
+
}
|
|
14
|
+
const sliderClasses = (0, _utils.unstable_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']);
|
|
15
|
+
var _default = sliderClasses;
|
|
16
|
+
exports.default = _default;
|