@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.
Files changed (53) hide show
  1. package/Autocomplete/Autocomplete.d.ts +3 -3
  2. package/Box/Box.d.ts +6 -22
  3. package/Button/Button.js +0 -2
  4. package/CHANGELOG.md +132 -0
  5. package/Slider/Slider.d.ts +215 -36
  6. package/Slider/Slider.js +225 -66
  7. package/Slider/SliderValueLabel.d.ts +15 -0
  8. package/Slider/SliderValueLabel.js +52 -0
  9. package/Slider/SliderValueLabel.types.d.ts +24 -0
  10. package/Slider/SliderValueLabel.types.js +1 -0
  11. package/Slider/index.d.ts +3 -0
  12. package/Slider/index.js +3 -1
  13. package/Slider/sliderClasses.d.ts +58 -0
  14. package/Slider/sliderClasses.js +7 -0
  15. package/SwipeableDrawer/SwipeableDrawer.d.ts +15 -0
  16. package/SwipeableDrawer/SwipeableDrawer.js +48 -17
  17. package/index.js +1 -1
  18. package/legacy/Button/Button.js +0 -2
  19. package/legacy/Slider/Slider.js +253 -74
  20. package/legacy/Slider/SliderValueLabel.js +48 -0
  21. package/legacy/Slider/SliderValueLabel.types.js +1 -0
  22. package/legacy/Slider/index.js +3 -1
  23. package/legacy/Slider/sliderClasses.js +7 -0
  24. package/legacy/SwipeableDrawer/SwipeableDrawer.js +50 -17
  25. package/legacy/index.js +1 -1
  26. package/legacy/locale/index.js +230 -144
  27. package/legacy/styles/experimental_extendTheme.js +16 -8
  28. package/locale/index.d.ts +1 -0
  29. package/locale/index.js +85 -0
  30. package/modern/Button/Button.js +0 -2
  31. package/modern/Slider/Slider.js +224 -65
  32. package/modern/Slider/SliderValueLabel.js +52 -0
  33. package/modern/Slider/SliderValueLabel.types.js +1 -0
  34. package/modern/Slider/index.js +3 -1
  35. package/modern/Slider/sliderClasses.js +7 -0
  36. package/modern/SwipeableDrawer/SwipeableDrawer.js +47 -17
  37. package/modern/index.js +1 -1
  38. package/modern/locale/index.js +85 -0
  39. package/modern/styles/experimental_extendTheme.js +16 -8
  40. package/node/Button/Button.js +0 -2
  41. package/node/Slider/Slider.js +231 -74
  42. package/node/Slider/SliderValueLabel.js +60 -0
  43. package/node/Slider/SliderValueLabel.types.js +5 -0
  44. package/node/Slider/index.js +21 -1
  45. package/node/Slider/sliderClasses.js +16 -0
  46. package/node/SwipeableDrawer/SwipeableDrawer.js +48 -17
  47. package/node/index.js +1 -1
  48. package/node/locale/index.js +87 -1
  49. package/node/styles/experimental_extendTheme.js +16 -8
  50. package/package.json +4 -4
  51. package/styles/experimental_extendTheme.js +16 -8
  52. package/umd/material-ui.development.js +556 -799
  53. package/umd/material-ui.production.min.js +21 -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, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
8
- import SliderUnstyled, { SliderValueLabelUnstyled, sliderUnstyledClasses, getSliderUtilityClass } from '@mui/base/SliderUnstyled';
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
- export const sliderClasses = _extends({}, sliderUnstyledClasses, generateUtilityClasses('MuiSlider', ['colorPrimary', 'colorSecondary', 'thumbColorPrimary', 'thumbColorSecondary', 'sizeSmall', 'thumbSizeSmall']));
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(SliderValueLabelUnstyled, {
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" ? SliderValueLabel.propTypes /* remove-proptypes */ = {
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,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 extendUtilityClasses = ownerState => {
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
- return _extends({}, classes, {
413
- root: clsx(classes.root, getSliderUtilityClass(`color${capitalize(color)}`), classes[`color${capitalize(color)}`], size && [getSliderUtilityClass(`size${capitalize(size)}`), classes[`size${capitalize(size)}`]]),
414
- thumb: clsx(classes.thumb, getSliderUtilityClass(`thumbColor${capitalize(color)}`), classes[`thumbColor${capitalize(color)}`], size && [getSliderUtilityClass(`thumbSize${capitalize(size)}`), classes[`thumbSize${capitalize(size)}`]])
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,31 +449,84 @@ 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 classes = extendUtilityClasses(ownerState);
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;
444
523
  const RailSlot = (_ref2 = (_slots$rail = slots == null ? void 0 : slots.rail) != null ? _slots$rail : components.Rail) != null ? _ref2 : SliderRail;
445
524
  const TrackSlot = (_ref3 = (_slots$track = slots == null ? void 0 : slots.track) != null ? _slots$track : components.Track) != null ? _ref3 : SliderTrack;
446
525
  const ThumbSlot = (_ref4 = (_slots$thumb = slots == null ? void 0 : slots.thumb) != null ? _slots$thumb : components.Thumb) != null ? _ref4 : SliderThumb;
447
- const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : SliderValueLabel;
526
+ const ValueLabelSlot = (_ref5 = (_slots$valueLabel = slots == null ? void 0 : slots.valueLabel) != null ? _slots$valueLabel : components.ValueLabel) != null ? _ref5 : StyledSliderValueLabel;
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
- return /*#__PURE__*/_jsx(SliderUnstyled, _extends({}, other, {
460
- isRtl: isRtl,
461
- slots: {
462
- root: RootSlot,
463
- rail: RailSlot,
464
- track: TrackSlot,
465
- thumb: ThumbSlot,
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
- classes: classes,
503
- ref: ref
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
- * @default (x) => x
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
- * @default (x) => x
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>> | null;
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,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,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
@@ -1,2 +1,5 @@
1
1
  export { default } from './Slider';
2
2
  export * from './Slider';
3
+
4
+ export { default as sliderClasses } from './sliderClasses';
5
+ export * from './sliderClasses';
package/Slider/index.js CHANGED
@@ -1,2 +1,4 @@
1
1
  export { default } from './Slider';
2
- export * from './Slider';
2
+ export * from './Slider';
3
+ export { default as sliderClasses } from './sliderClasses';
4
+ export * from './sliderClasses';
@@ -0,0 +1,58 @@
1
+ export interface SliderClasses {
2
+ /** Class name applied to the root element. */
3
+ root: string;
4
+ /** Class name applied to the root element if `color="primary"`. */
5
+ colorPrimary: string;
6
+ /** Class name applied to the root element if `color="secondary"`. */
7
+ colorSecondary: string;
8
+ /** Class name applied to the root element if `marks` is provided with at least one label. */
9
+ marked: string;
10
+ /** Class name applied to the root element if `orientation="vertical"`. */
11
+ vertical: string;
12
+ /** State class applied to the root and thumb element if `disabled={true}`. */
13
+ disabled: string;
14
+ /** State class applied to the root if a thumb is being dragged. */
15
+ dragging: string;
16
+ /** Class name applied to the rail element. */
17
+ rail: string;
18
+ /** Class name applied to the track element. */
19
+ track: string;
20
+ /** Class name applied to the root element if `track={false}`. */
21
+ trackFalse: string;
22
+ /** Class name applied to the root element if `track="inverted"`. */
23
+ trackInverted: string;
24
+ /** Class name applied to the thumb element. */
25
+ thumb: string;
26
+ /** State class applied to the thumb element if it's active. */
27
+ active: string;
28
+ /** State class applied to the thumb element if keyboard focused. */
29
+ focusVisible: string;
30
+ /** Class name applied to the mark element. */
31
+ mark: string;
32
+ /** Class name applied to the mark element if active (depending on the value). */
33
+ markActive: string;
34
+ /** Class name applied to the mark label element. */
35
+ markLabel: string;
36
+ /** Class name applied to the mark label element if active (depending on the value). */
37
+ markLabelActive: string;
38
+ /** Class name applied to the root element if `size="small"`. */
39
+ sizeSmall: string;
40
+ /** Class name applied to the thumb element if `color="primary"`. */
41
+ thumbColorPrimary: string;
42
+ /** Class name applied to the thumb element if `color="secondary"`. */
43
+ thumbColorSecondary: string;
44
+ /** Class name applied to the thumb element if `size="small"`. */
45
+ thumbSizeSmall: string;
46
+ /** Class name applied to the thumb label element. */
47
+ valueLabel: string;
48
+ /** Class name applied to the thumb label element if it's open. */
49
+ valueLabelOpen: string;
50
+ /** Class name applied to the thumb label's circle element. */
51
+ valueLabelCircle: string;
52
+ /** Class name applied to the thumb label's label element. */
53
+ valueLabelLabel: string;
54
+ }
55
+ export type SliderClassKey = keyof SliderClasses;
56
+ export declare function getSliderUtilityClass(slot: string): string;
57
+ declare const sliderClasses: SliderClasses;
58
+ export default sliderClasses;
@@ -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;
@@ -2,6 +2,21 @@ import * as React from 'react';
2
2
  import { DrawerProps } from '../Drawer';
3
3
 
4
4
  export interface SwipeableDrawerProps extends Omit<DrawerProps, 'onClose' | 'open'> {
5
+ /**
6
+ * If set to true, the swipe event will open the drawer even if the user begins the swipe on one of the drawer's children.
7
+ * This can be useful in scenarios where the drawer is partially visible.
8
+ * You can customize it further with a callback that determines which children the user can drag over to open the drawer
9
+ * (for example, to ignore other elements that handle touch move events, like sliders).
10
+ *
11
+ * @param {TouchEvent} event The 'touchstart' event
12
+ * @param {HTMLDivElement} swipeArea The swipe area element
13
+ * @param {HTMLDivElement} paper The drawer's paper element
14
+ *
15
+ * @default false
16
+ */
17
+ allowSwipeInChildren?:
18
+ | boolean
19
+ | ((e: TouchEvent, swipeArea: HTMLDivElement, paper: HTMLDivElement) => boolean);
5
20
  /**
6
21
  * Disable the backdrop transition.
7
22
  * This can improve the FPS on low-end devices.