@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/Slider/Slider.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["component", "components", "componentsProps", "color", "size", "slotProps", "slots"];
|
|
3
|
+
const _excluded = ["aria-label", "aria-valuetext", "aria-labelledby", "component", "components", "componentsProps", "color", "classes", "className", "disableSwap", "disabled", "getAriaLabel", "getAriaValueText", "marks", "max", "min", "name", "onChange", "onChangeCommitted", "orientation", "size", "step", "scale", "slotProps", "slots", "tabIndex", "track", "value", "valueLabelDisplay", "valueLabelFormat"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { chainPropTypes
|
|
8
|
-
import
|
|
7
|
+
import { chainPropTypes } from '@mui/utils';
|
|
8
|
+
import { isHostComponent, useSlotProps, unstable_composeClasses as composeClasses } from '@mui/base';
|
|
9
|
+
import { useSlider, getSliderUtilityClass } from '@mui/base/SliderUnstyled';
|
|
9
10
|
import { alpha, lighten, darken } from '@mui/system';
|
|
10
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
11
12
|
import styled, { slotShouldForwardProp } from '../styles/styled';
|
|
12
13
|
import useTheme from '../styles/useTheme';
|
|
13
14
|
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
14
15
|
import capitalize from '../utils/capitalize';
|
|
16
|
+
import SliderValueLabelComponent from './SliderValueLabel';
|
|
17
|
+
import sliderClasses from './sliderClasses';
|
|
15
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
-
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
const valueToPercent = (value, min, max) => (value - min) * 100 / (max - min);
|
|
21
|
+
function Identity(x) {
|
|
22
|
+
return x;
|
|
23
|
+
}
|
|
17
24
|
const SliderRoot = styled('span', {
|
|
18
25
|
name: 'MuiSlider',
|
|
19
26
|
slot: 'Root',
|
|
@@ -254,7 +261,7 @@ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes /* remove-proptype
|
|
|
254
261
|
children: PropTypes.node
|
|
255
262
|
} : void 0;
|
|
256
263
|
export { SliderThumb };
|
|
257
|
-
const SliderValueLabel = styled(
|
|
264
|
+
const SliderValueLabel = styled(SliderValueLabelComponent, {
|
|
258
265
|
name: 'MuiSlider',
|
|
259
266
|
slot: 'ValueLabel',
|
|
260
267
|
overridesResolver: (props, styles) => styles.valueLabel
|
|
@@ -403,19 +410,38 @@ 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
|
-
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;
|
|
444
|
+
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;
|
|
419
445
|
const props = useThemeProps({
|
|
420
446
|
props: inputProps,
|
|
421
447
|
name: 'MuiSlider'
|
|
@@ -423,21 +449,74 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
423
449
|
const theme = useTheme();
|
|
424
450
|
const isRtl = theme.direction === 'rtl';
|
|
425
451
|
const {
|
|
452
|
+
'aria-label': ariaLabel,
|
|
453
|
+
'aria-valuetext': ariaValuetext,
|
|
454
|
+
'aria-labelledby': ariaLabelledby,
|
|
426
455
|
// eslint-disable-next-line react/prop-types
|
|
427
456
|
component = 'span',
|
|
428
457
|
components = {},
|
|
429
458
|
componentsProps = {},
|
|
430
459
|
color = 'primary',
|
|
460
|
+
classes: classesProp,
|
|
461
|
+
// eslint-disable-next-line react/prop-types
|
|
462
|
+
className,
|
|
463
|
+
disableSwap = false,
|
|
464
|
+
disabled = false,
|
|
465
|
+
getAriaLabel,
|
|
466
|
+
getAriaValueText,
|
|
467
|
+
marks: marksProp = false,
|
|
468
|
+
max = 100,
|
|
469
|
+
min = 0,
|
|
470
|
+
orientation = 'horizontal',
|
|
431
471
|
size = 'medium',
|
|
472
|
+
step = 1,
|
|
473
|
+
scale = Identity,
|
|
432
474
|
slotProps,
|
|
433
|
-
slots
|
|
475
|
+
slots,
|
|
476
|
+
track = 'normal',
|
|
477
|
+
valueLabelDisplay = 'off',
|
|
478
|
+
valueLabelFormat = Identity
|
|
434
479
|
} = props,
|
|
435
480
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
436
481
|
const ownerState = _extends({}, props, {
|
|
482
|
+
isRtl,
|
|
483
|
+
max,
|
|
484
|
+
min,
|
|
485
|
+
classes: classesProp,
|
|
486
|
+
disabled,
|
|
487
|
+
disableSwap,
|
|
488
|
+
orientation,
|
|
489
|
+
marks: marksProp,
|
|
437
490
|
color,
|
|
438
|
-
size
|
|
491
|
+
size,
|
|
492
|
+
step,
|
|
493
|
+
scale,
|
|
494
|
+
track,
|
|
495
|
+
valueLabelDisplay,
|
|
496
|
+
valueLabelFormat
|
|
439
497
|
});
|
|
440
|
-
const
|
|
498
|
+
const {
|
|
499
|
+
axisProps,
|
|
500
|
+
getRootProps,
|
|
501
|
+
getHiddenInputProps,
|
|
502
|
+
getThumbProps,
|
|
503
|
+
open,
|
|
504
|
+
active,
|
|
505
|
+
axis,
|
|
506
|
+
focusedThumbIndex,
|
|
507
|
+
range,
|
|
508
|
+
dragging,
|
|
509
|
+
marks,
|
|
510
|
+
values,
|
|
511
|
+
trackOffset,
|
|
512
|
+
trackLeap
|
|
513
|
+
} = useSlider(_extends({}, ownerState, {
|
|
514
|
+
ref
|
|
515
|
+
}));
|
|
516
|
+
ownerState.marked = marks.length > 0 && marks.some(mark => mark.label);
|
|
517
|
+
ownerState.dragging = dragging;
|
|
518
|
+
ownerState.focusedThumbIndex = focusedThumbIndex;
|
|
519
|
+
const classes = useUtilityClasses(ownerState);
|
|
441
520
|
|
|
442
521
|
// support both `slots` and `components` for backward compatibility
|
|
443
522
|
const RootSlot = (_ref = (_slots$root = slots == null ? void 0 : slots.root) != null ? _slots$root : components.Root) != null ? _ref : SliderRoot;
|
|
@@ -447,7 +526,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
447
526
|
const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : SliderValueLabel;
|
|
448
527
|
const MarkSlot = (_ref6 = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : components.Mark) != null ? _ref6 : SliderMark;
|
|
449
528
|
const MarkLabelSlot = (_ref7 = (_slots$markLabel = slots == null ? void 0 : slots.markLabel) != null ? _slots$markLabel : components.MarkLabel) != null ? _ref7 : SliderMarkLabel;
|
|
450
|
-
const InputSlot = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input;
|
|
529
|
+
const InputSlot = (_ref8 = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input) != null ? _ref8 : 'input';
|
|
451
530
|
const rootSlotProps = (_slotProps$root = slotProps == null ? void 0 : slotProps.root) != null ? _slotProps$root : componentsProps.root;
|
|
452
531
|
const railSlotProps = (_slotProps$rail = slotProps == null ? void 0 : slotProps.rail) != null ? _slotProps$rail : componentsProps.rail;
|
|
453
532
|
const trackSlotProps = (_slotProps$track = slotProps == null ? void 0 : slotProps.track) != null ? _slotProps$track : componentsProps.track;
|
|
@@ -456,51 +535,123 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
|
456
535
|
const markSlotProps = (_slotProps$mark = slotProps == null ? void 0 : slotProps.mark) != null ? _slotProps$mark : componentsProps.mark;
|
|
457
536
|
const markLabelSlotProps = (_slotProps$markLabel = slotProps == null ? void 0 : slotProps.markLabel) != null ? _slotProps$markLabel : componentsProps.markLabel;
|
|
458
537
|
const inputSlotProps = (_slotProps$input = slotProps == null ? void 0 : slotProps.input) != null ? _slotProps$input : componentsProps.input;
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
valueLabel: ValueLabelSlot,
|
|
467
|
-
mark: MarkSlot,
|
|
468
|
-
markLabel: MarkLabelSlot,
|
|
469
|
-
input: InputSlot
|
|
470
|
-
},
|
|
471
|
-
slotProps: _extends({}, componentsProps, {
|
|
472
|
-
root: _extends({}, rootSlotProps, shouldSpreadAdditionalProps(RootSlot) && {
|
|
473
|
-
as: component,
|
|
474
|
-
ownerState: _extends({}, rootSlotProps == null ? void 0 : rootSlotProps.ownerState, {
|
|
475
|
-
color,
|
|
476
|
-
size
|
|
477
|
-
})
|
|
478
|
-
}),
|
|
479
|
-
rail: railSlotProps,
|
|
480
|
-
thumb: _extends({}, thumbSlotProps, shouldSpreadAdditionalProps(ThumbSlot) && {
|
|
481
|
-
ownerState: _extends({}, thumbSlotProps == null ? void 0 : thumbSlotProps.ownerState, {
|
|
482
|
-
color,
|
|
483
|
-
size
|
|
484
|
-
})
|
|
485
|
-
}),
|
|
486
|
-
track: _extends({}, trackSlotProps, shouldSpreadAdditionalProps(TrackSlot) && {
|
|
487
|
-
ownerState: _extends({}, trackSlotProps == null ? void 0 : trackSlotProps.ownerState, {
|
|
488
|
-
color,
|
|
489
|
-
size
|
|
490
|
-
})
|
|
491
|
-
}),
|
|
492
|
-
valueLabel: _extends({}, valueLabelSlotProps, shouldSpreadAdditionalProps(ValueLabelSlot) && {
|
|
493
|
-
ownerState: _extends({}, valueLabelSlotProps == null ? void 0 : valueLabelSlotProps.ownerState, {
|
|
494
|
-
color,
|
|
495
|
-
size
|
|
496
|
-
})
|
|
497
|
-
}),
|
|
498
|
-
mark: markSlotProps,
|
|
499
|
-
markLabel: markLabelSlotProps,
|
|
500
|
-
input: inputSlotProps
|
|
538
|
+
const rootProps = useSlotProps({
|
|
539
|
+
elementType: RootSlot,
|
|
540
|
+
getSlotProps: getRootProps,
|
|
541
|
+
externalSlotProps: rootSlotProps,
|
|
542
|
+
externalForwardedProps: other,
|
|
543
|
+
additionalProps: _extends({}, shouldSpreadAdditionalProps(RootSlot) && {
|
|
544
|
+
as: component
|
|
501
545
|
}),
|
|
502
|
-
|
|
503
|
-
|
|
546
|
+
ownerState: _extends({}, ownerState, rootSlotProps == null ? void 0 : rootSlotProps.ownerState),
|
|
547
|
+
className: [classes.root, className]
|
|
548
|
+
});
|
|
549
|
+
const railProps = useSlotProps({
|
|
550
|
+
elementType: RailSlot,
|
|
551
|
+
externalSlotProps: railSlotProps,
|
|
552
|
+
ownerState,
|
|
553
|
+
className: classes.rail
|
|
554
|
+
});
|
|
555
|
+
const trackProps = useSlotProps({
|
|
556
|
+
elementType: TrackSlot,
|
|
557
|
+
externalSlotProps: trackSlotProps,
|
|
558
|
+
additionalProps: {
|
|
559
|
+
style: _extends({}, axisProps[axis].offset(trackOffset), axisProps[axis].leap(trackLeap))
|
|
560
|
+
},
|
|
561
|
+
ownerState: _extends({}, ownerState, trackSlotProps == null ? void 0 : trackSlotProps.ownerState),
|
|
562
|
+
className: classes.track
|
|
563
|
+
});
|
|
564
|
+
const thumbProps = useSlotProps({
|
|
565
|
+
elementType: ThumbSlot,
|
|
566
|
+
getSlotProps: getThumbProps,
|
|
567
|
+
externalSlotProps: thumbSlotProps,
|
|
568
|
+
ownerState: _extends({}, ownerState, thumbSlotProps == null ? void 0 : thumbSlotProps.ownerState)
|
|
569
|
+
});
|
|
570
|
+
const valueLabelProps = useSlotProps({
|
|
571
|
+
elementType: ValueLabelSlot,
|
|
572
|
+
externalSlotProps: valueLabelSlotProps,
|
|
573
|
+
ownerState: _extends({}, ownerState, valueLabelSlotProps == null ? void 0 : valueLabelSlotProps.ownerState),
|
|
574
|
+
className: classes.valueLabel
|
|
575
|
+
});
|
|
576
|
+
const markProps = useSlotProps({
|
|
577
|
+
elementType: MarkSlot,
|
|
578
|
+
externalSlotProps: markSlotProps,
|
|
579
|
+
ownerState,
|
|
580
|
+
className: classes.mark
|
|
581
|
+
});
|
|
582
|
+
const markLabelProps = useSlotProps({
|
|
583
|
+
elementType: MarkLabelSlot,
|
|
584
|
+
externalSlotProps: markLabelSlotProps,
|
|
585
|
+
ownerState
|
|
586
|
+
});
|
|
587
|
+
const inputSliderProps = useSlotProps({
|
|
588
|
+
elementType: InputSlot,
|
|
589
|
+
getSlotProps: getHiddenInputProps,
|
|
590
|
+
externalSlotProps: inputSlotProps,
|
|
591
|
+
ownerState
|
|
592
|
+
});
|
|
593
|
+
return /*#__PURE__*/_jsxs(RootSlot, _extends({}, rootProps, {
|
|
594
|
+
children: [/*#__PURE__*/_jsx(RailSlot, _extends({}, railProps)), /*#__PURE__*/_jsx(TrackSlot, _extends({}, trackProps)), marks.filter(mark => mark.value >= min && mark.value <= max).map((mark, index) => {
|
|
595
|
+
const percent = valueToPercent(mark.value, min, max);
|
|
596
|
+
const style = axisProps[axis].offset(percent);
|
|
597
|
+
let markActive;
|
|
598
|
+
if (track === false) {
|
|
599
|
+
markActive = values.indexOf(mark.value) !== -1;
|
|
600
|
+
} else {
|
|
601
|
+
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]);
|
|
602
|
+
}
|
|
603
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
604
|
+
children: [/*#__PURE__*/_jsx(MarkSlot, _extends({
|
|
605
|
+
"data-index": index
|
|
606
|
+
}, markProps, !isHostComponent(MarkSlot) && {
|
|
607
|
+
markActive
|
|
608
|
+
}, {
|
|
609
|
+
style: _extends({}, style, markProps.style),
|
|
610
|
+
className: clsx(markProps.className, markActive && classes.markActive)
|
|
611
|
+
})), mark.label != null ? /*#__PURE__*/_jsx(MarkLabelSlot, _extends({
|
|
612
|
+
"aria-hidden": true,
|
|
613
|
+
"data-index": index
|
|
614
|
+
}, markLabelProps, !isHostComponent(MarkLabelSlot) && {
|
|
615
|
+
markLabelActive: markActive
|
|
616
|
+
}, {
|
|
617
|
+
style: _extends({}, style, markLabelProps.style),
|
|
618
|
+
className: clsx(classes.markLabel, markLabelProps.className, markActive && classes.markLabelActive),
|
|
619
|
+
children: mark.label
|
|
620
|
+
})) : null]
|
|
621
|
+
}, index);
|
|
622
|
+
}), values.map((value, index) => {
|
|
623
|
+
const percent = valueToPercent(value, min, max);
|
|
624
|
+
const style = axisProps[axis].offset(percent);
|
|
625
|
+
const ValueLabelComponent = valueLabelDisplay === 'off' ? Forward : ValueLabelSlot;
|
|
626
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
627
|
+
children: /*#__PURE__*/_jsx(ValueLabelComponent, _extends({}, !isHostComponent(ValueLabelComponent) && {
|
|
628
|
+
valueLabelFormat,
|
|
629
|
+
valueLabelDisplay,
|
|
630
|
+
value: typeof valueLabelFormat === 'function' ? valueLabelFormat(scale(value), index) : valueLabelFormat,
|
|
631
|
+
index,
|
|
632
|
+
open: open === index || active === index || valueLabelDisplay === 'on',
|
|
633
|
+
disabled
|
|
634
|
+
}, valueLabelProps, {
|
|
635
|
+
children: /*#__PURE__*/_jsx(ThumbSlot, _extends({
|
|
636
|
+
"data-index": index,
|
|
637
|
+
"data-focusvisible": focusedThumbIndex === index
|
|
638
|
+
}, thumbProps, {
|
|
639
|
+
className: clsx(classes.thumb, thumbProps.className, active === index && classes.active, focusedThumbIndex === index && classes.focusVisible),
|
|
640
|
+
style: _extends({}, style, {
|
|
641
|
+
pointerEvents: disableSwap && active !== index ? 'none' : undefined
|
|
642
|
+
}, thumbProps.style),
|
|
643
|
+
children: /*#__PURE__*/_jsx(InputSlot, _extends({
|
|
644
|
+
"data-index": index,
|
|
645
|
+
"aria-label": getAriaLabel ? getAriaLabel(index) : ariaLabel,
|
|
646
|
+
"aria-valuenow": scale(value),
|
|
647
|
+
"aria-labelledby": ariaLabelledby,
|
|
648
|
+
"aria-valuetext": getAriaValueText ? getAriaValueText(scale(value), index) : ariaValuetext,
|
|
649
|
+
value: values[index]
|
|
650
|
+
}, inputSliderProps))
|
|
651
|
+
}))
|
|
652
|
+
}))
|
|
653
|
+
}, index);
|
|
654
|
+
})]
|
|
504
655
|
}));
|
|
505
656
|
});
|
|
506
657
|
process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */ = {
|
|
@@ -670,7 +821,11 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
670
821
|
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
671
822
|
/**
|
|
672
823
|
* A transformation function, to change the scale of the slider.
|
|
673
|
-
* @
|
|
824
|
+
* @param {any} x
|
|
825
|
+
* @returns {any}
|
|
826
|
+
* @default function Identity(x) {
|
|
827
|
+
* return x;
|
|
828
|
+
* }
|
|
674
829
|
*/
|
|
675
830
|
scale: PropTypes.func,
|
|
676
831
|
/**
|
|
@@ -761,7 +916,11 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes /* remove-proptypes */
|
|
|
761
916
|
*
|
|
762
917
|
* - {number} value The value label's value to format
|
|
763
918
|
* - {number} index The value label's index to format
|
|
764
|
-
* @
|
|
919
|
+
* @param {any} x
|
|
920
|
+
* @returns {any}
|
|
921
|
+
* @default function Identity(x) {
|
|
922
|
+
* return x;
|
|
923
|
+
* }
|
|
765
924
|
*/
|
|
766
925
|
valueLabelFormat: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
|
|
767
926
|
} : void 0;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { SliderValueLabelProps } from './SliderValueLabel.types';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore - internal component.
|
|
6
|
+
*/
|
|
7
|
+
declare function SliderValueLabel(props: SliderValueLabelProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
8
|
+
declare namespace SliderValueLabel {
|
|
9
|
+
var propTypes: {
|
|
10
|
+
children: PropTypes.Validator<PropTypes.ReactElementLike>;
|
|
11
|
+
className: PropTypes.Requireable<string>;
|
|
12
|
+
value: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export default SliderValueLabel;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import sliderClasses from './sliderClasses';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const useValueLabelClasses = props => {
|
|
8
|
+
const {
|
|
9
|
+
open
|
|
10
|
+
} = props;
|
|
11
|
+
const utilityClasses = {
|
|
12
|
+
offset: clsx(open && sliderClasses.valueLabelOpen),
|
|
13
|
+
circle: sliderClasses.valueLabelCircle,
|
|
14
|
+
label: sliderClasses.valueLabelLabel
|
|
15
|
+
};
|
|
16
|
+
return utilityClasses;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @ignore - internal component.
|
|
21
|
+
*/
|
|
22
|
+
export default function SliderValueLabel(props) {
|
|
23
|
+
const {
|
|
24
|
+
children,
|
|
25
|
+
className,
|
|
26
|
+
value
|
|
27
|
+
} = props;
|
|
28
|
+
const classes = useValueLabelClasses(props);
|
|
29
|
+
return /*#__PURE__*/React.cloneElement(children, {
|
|
30
|
+
className: clsx(children.props.className)
|
|
31
|
+
}, /*#__PURE__*/_jsxs(React.Fragment, {
|
|
32
|
+
children: [children.props.children, /*#__PURE__*/_jsx("span", {
|
|
33
|
+
className: clsx(classes.offset, className),
|
|
34
|
+
"aria-hidden": true,
|
|
35
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
36
|
+
className: classes.circle,
|
|
37
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
38
|
+
className: classes.label,
|
|
39
|
+
children: value
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
})]
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes = {
|
|
46
|
+
children: PropTypes.element.isRequired,
|
|
47
|
+
className: PropTypes.string,
|
|
48
|
+
value: PropTypes.node
|
|
49
|
+
} : void 0;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface SliderValueLabelProps {
|
|
3
|
+
children: React.ReactElement;
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
/**
|
|
7
|
+
* If `true`, the value label is visible.
|
|
8
|
+
*/
|
|
9
|
+
open: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The value of the slider.
|
|
12
|
+
* For ranged sliders, provide an array with two values.
|
|
13
|
+
*/
|
|
14
|
+
value: number;
|
|
15
|
+
/**
|
|
16
|
+
* Controls when the value label is displayed:
|
|
17
|
+
*
|
|
18
|
+
* - `auto` the value label will display when the thumb is hovered or focused.
|
|
19
|
+
* - `on` will display persistently.
|
|
20
|
+
* - `off` will never display.
|
|
21
|
+
* @default 'off'
|
|
22
|
+
*/
|
|
23
|
+
valueLabelDisplay?: 'on' | 'auto' | 'off';
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/Slider/index.d.ts
CHANGED
package/Slider/index.js
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const sliderClasses: {
|
|
2
|
+
colorPrimary: string;
|
|
3
|
+
colorSecondary: string;
|
|
4
|
+
sizeSmall: string;
|
|
5
|
+
thumbColorPrimary: string;
|
|
6
|
+
thumbColorSecondary: string;
|
|
7
|
+
thumbSizeSmall: string;
|
|
8
|
+
root: string;
|
|
9
|
+
marked: string;
|
|
10
|
+
vertical: string;
|
|
11
|
+
disabled: string;
|
|
12
|
+
dragging: string;
|
|
13
|
+
rail: string;
|
|
14
|
+
track: string;
|
|
15
|
+
trackFalse: string;
|
|
16
|
+
trackInverted: string;
|
|
17
|
+
thumb: string;
|
|
18
|
+
active: string;
|
|
19
|
+
focusVisible: string;
|
|
20
|
+
valueLabel: string;
|
|
21
|
+
valueLabelOpen: string;
|
|
22
|
+
valueLabelCircle: string;
|
|
23
|
+
valueLabelLabel: string;
|
|
24
|
+
mark: string;
|
|
25
|
+
markActive: string;
|
|
26
|
+
markLabel: string;
|
|
27
|
+
markLabelActive: string;
|
|
28
|
+
};
|
|
29
|
+
export default sliderClasses;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
3
|
+
import { sliderUnstyledClasses } from '@mui/base/SliderUnstyled';
|
|
4
|
+
const sliderClasses = _extends({}, sliderUnstyledClasses, generateUtilityClasses('MuiSlider', ['colorPrimary', 'colorSecondary', 'thumbColorPrimary', 'thumbColorSecondary', 'sizeSmall', 'thumbSizeSmall']));
|
|
5
|
+
export default sliderClasses;
|
package/Tabs/Tabs.js
CHANGED
|
@@ -307,7 +307,9 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
307
307
|
}
|
|
308
308
|
tabMeta = tab ? tab.getBoundingClientRect() : null;
|
|
309
309
|
if (process.env.NODE_ENV !== 'production') {
|
|
310
|
-
if (process.env.NODE_ENV !== 'test' && !warnedOnceTabPresent && tabMeta && tabMeta.width === 0 && tabMeta.height === 0
|
|
310
|
+
if (process.env.NODE_ENV !== 'test' && !warnedOnceTabPresent && tabMeta && tabMeta.width === 0 && tabMeta.height === 0 &&
|
|
311
|
+
// if the whole Tabs component is hidden, don't warn
|
|
312
|
+
tabsMeta.clientWidth !== 0) {
|
|
311
313
|
tabsMeta = null;
|
|
312
314
|
console.error(['MUI: The `value` provided to the Tabs component is invalid.', `The Tab with this \`value\` ("${value}") is not part of the document layout.`, "Make sure the tab item is present in the document or that it's not `display: none`."].join('\n'));
|
|
313
315
|
warnedOnceTabPresent = true;
|
package/Tooltip/Tooltip.js
CHANGED
|
@@ -569,7 +569,6 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
|
|
|
569
569
|
}) => /*#__PURE__*/_jsx(TransitionComponent, _extends({
|
|
570
570
|
timeout: theme.transitions.duration.shorter
|
|
571
571
|
}, TransitionPropsInner, transitionProps, {
|
|
572
|
-
"data-foo": "bar",
|
|
573
572
|
children: /*#__PURE__*/_jsxs(TooltipComponent, _extends({}, tooltipProps, {
|
|
574
573
|
children: [title, arrow ? /*#__PURE__*/_jsx(ArrowComponent, _extends({}, tooltipArrowProps, {
|
|
575
574
|
ref: setArrowRef
|
package/index.js
CHANGED
|
@@ -84,9 +84,6 @@ var FilledInputRoot = styled(InputBaseRoot, {
|
|
|
84
84
|
}), _defineProperty(_ref2, "&.".concat(filledInputClasses.error), {
|
|
85
85
|
'&:before, &:after': {
|
|
86
86
|
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
87
|
-
},
|
|
88
|
-
'&:focus-within:after': {
|
|
89
|
-
transform: 'scaleX(1)' // error is always underlined in red
|
|
90
87
|
}
|
|
91
88
|
}), _defineProperty(_ref2, '&:before', {
|
|
92
89
|
borderBottom: "1px solid ".concat(theme.vars ? "rgba(".concat(theme.vars.palette.common.onBackgroundChannel, " / ").concat(theme.vars.opacity.inputUnderline, ")") : bottomLineColor),
|
package/legacy/Input/Input.js
CHANGED
|
@@ -70,9 +70,6 @@ var InputRoot = styled(InputBaseRoot, {
|
|
|
70
70
|
}), _defineProperty(_ref2, "&.".concat(inputClasses.error), {
|
|
71
71
|
'&:before, &:after': {
|
|
72
72
|
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
73
|
-
},
|
|
74
|
-
'&:focus-within:after': {
|
|
75
|
-
transform: 'scaleX(1)' // error is always underlined in red
|
|
76
73
|
}
|
|
77
74
|
}), _defineProperty(_ref2, '&:before', {
|
|
78
75
|
borderBottom: "1px solid ".concat(bottomLineColor),
|
|
@@ -87,7 +84,7 @@ var InputRoot = styled(InputBaseRoot, {
|
|
|
87
84
|
}),
|
|
88
85
|
pointerEvents: 'none' // Transparent to the hover style.
|
|
89
86
|
}), _defineProperty(_ref2, "&:hover:not(.".concat(inputClasses.disabled, ", .").concat(inputClasses.error, "):before"), {
|
|
90
|
-
borderBottom: "
|
|
87
|
+
borderBottom: "2px solid ".concat((theme.vars || theme).palette.text.primary),
|
|
91
88
|
// Reset on touch devices, it doesn't add specificity
|
|
92
89
|
'@media (hover: none)': {
|
|
93
90
|
borderBottom: "1px solid ".concat(bottomLineColor)
|
|
@@ -234,7 +234,8 @@ process.env.NODE_ENV !== "production" ? MenuItem.propTypes /* remove-proptypes *
|
|
|
234
234
|
*/
|
|
235
235
|
role: PropTypes /* @typescript-to-proptypes-ignore */.string,
|
|
236
236
|
/**
|
|
237
|
-
*
|
|
237
|
+
* If `true`, the component is selected.
|
|
238
|
+
* @default false
|
|
238
239
|
*/
|
|
239
240
|
selected: PropTypes.bool,
|
|
240
241
|
/**
|