@mui/material 5.11.5 → 5.11.7

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 (72) hide show
  1. package/Box/Box.d.ts +3 -2
  2. package/Button/Button.js +0 -2
  3. package/CHANGELOG.md +160 -0
  4. package/Checkbox/Checkbox.d.ts +3 -0
  5. package/Checkbox/Checkbox.js +3 -0
  6. package/FormLabel/FormLabel.d.ts +51 -45
  7. package/InputLabel/InputLabel.d.ts +70 -57
  8. package/Radio/Radio.js +2 -0
  9. package/Slider/Slider.d.ts +215 -35
  10. package/Slider/Slider.js +7 -7
  11. package/Slider/SliderValueLabel.d.ts +1 -1
  12. package/Slider/SliderValueLabel.js +3 -0
  13. package/Slider/SliderValueLabel.types.d.ts +1 -1
  14. package/Slider/index.d.ts +2 -0
  15. package/Slider/index.js +2 -1
  16. package/Slider/sliderClasses.d.ts +40 -11
  17. package/Slider/sliderClasses.js +5 -3
  18. package/SwipeableDrawer/SwipeableDrawer.d.ts +15 -0
  19. package/SwipeableDrawer/SwipeableDrawer.js +48 -17
  20. package/Switch/Switch.js +2 -0
  21. package/TabScrollButton/TabScrollButton.d.ts +1 -0
  22. package/TabScrollButton/TabScrollButton.js +1 -0
  23. package/Tooltip/Tooltip.js +9 -9
  24. package/index.js +1 -1
  25. package/internal/SwitchBase.d.ts +5 -0
  26. package/internal/SwitchBase.js +1 -1
  27. package/legacy/Button/Button.js +0 -2
  28. package/legacy/Checkbox/Checkbox.js +3 -0
  29. package/legacy/Radio/Radio.js +2 -0
  30. package/legacy/Slider/Slider.js +7 -7
  31. package/legacy/Slider/SliderValueLabel.js +3 -0
  32. package/legacy/Slider/index.js +2 -1
  33. package/legacy/Slider/sliderClasses.js +5 -3
  34. package/legacy/SwipeableDrawer/SwipeableDrawer.js +50 -17
  35. package/legacy/Switch/Switch.js +2 -0
  36. package/legacy/TabScrollButton/TabScrollButton.js +1 -0
  37. package/legacy/Tooltip/Tooltip.js +9 -9
  38. package/legacy/index.js +1 -1
  39. package/legacy/internal/SwitchBase.js +2 -1
  40. package/legacy/styles/CssVarsProvider.js +3 -1
  41. package/modern/Button/Button.js +0 -2
  42. package/modern/Checkbox/Checkbox.js +3 -0
  43. package/modern/Radio/Radio.js +2 -0
  44. package/modern/Slider/Slider.js +7 -7
  45. package/modern/Slider/SliderValueLabel.js +3 -0
  46. package/modern/Slider/index.js +2 -1
  47. package/modern/Slider/sliderClasses.js +5 -3
  48. package/modern/SwipeableDrawer/SwipeableDrawer.js +47 -17
  49. package/modern/Switch/Switch.js +2 -0
  50. package/modern/TabScrollButton/TabScrollButton.js +1 -0
  51. package/modern/Tooltip/Tooltip.js +9 -9
  52. package/modern/index.js +1 -1
  53. package/modern/internal/SwitchBase.js +1 -1
  54. package/modern/styles/CssVarsProvider.js +3 -1
  55. package/node/Button/Button.js +0 -2
  56. package/node/Checkbox/Checkbox.js +3 -0
  57. package/node/Radio/Radio.js +2 -0
  58. package/node/Slider/Slider.js +6 -6
  59. package/node/Slider/SliderValueLabel.js +3 -0
  60. package/node/Slider/index.js +12 -2
  61. package/node/Slider/sliderClasses.js +6 -3
  62. package/node/SwipeableDrawer/SwipeableDrawer.js +48 -17
  63. package/node/Switch/Switch.js +2 -0
  64. package/node/TabScrollButton/TabScrollButton.js +1 -0
  65. package/node/Tooltip/Tooltip.js +9 -9
  66. package/node/index.js +1 -1
  67. package/node/internal/SwitchBase.js +1 -1
  68. package/node/styles/CssVarsProvider.js +3 -1
  69. package/package.json +5 -5
  70. package/styles/CssVarsProvider.js +3 -1
  71. package/umd/material-ui.development.js +121 -58
  72. package/umd/material-ui.production.min.js +20 -20
@@ -1,24 +1,39 @@
1
1
  import * as React from 'react';
2
- import {
3
- ExtendSliderUnstyledTypeMap,
4
- ExtendSliderUnstyled,
5
- SliderUnstyledTypeMap,
6
- SliderValueLabelProps,
7
- } from '@mui/base/SliderUnstyled';
2
+ import { SlotComponentProps } from '@mui/base';
3
+ import { Mark } from '@mui/base/SliderUnstyled';
8
4
  import { SxProps } from '@mui/system';
9
5
  import { OverridableStringUnion } from '@mui/types';
10
6
  import { Theme } from '../styles';
11
- import { OverrideProps } from '../OverridableComponent';
7
+ import { OverrideProps, OverridableComponent } from '../OverridableComponent';
8
+ import SliderValueLabelComponent from './SliderValueLabel';
9
+ import { SliderClasses } from './sliderClasses';
12
10
 
13
11
  export interface SliderPropsColorOverrides {}
14
12
 
15
13
  export interface SliderPropsSizeOverrides {}
16
14
 
17
- export type SliderTypeMap<
18
- D extends React.ElementType = 'span',
19
- P = {},
20
- > = ExtendSliderUnstyledTypeMap<{
15
+ export interface SliderComponentsPropsOverrides {}
16
+
17
+ export interface SliderOwnerState extends SliderProps {
18
+ dragging: boolean;
19
+ marked: boolean;
20
+ focusedThumbIndex: number;
21
+ }
22
+
23
+ export interface SliderTypeMap<D extends React.ElementType = 'span', P = {}> {
21
24
  props: P & {
25
+ /**
26
+ * The label of the slider.
27
+ */
28
+ 'aria-label'?: string;
29
+ /**
30
+ * The id of the element containing a label for the slider.
31
+ */
32
+ 'aria-labelledby'?: string;
33
+ /**
34
+ * A string value that provides a user-friendly name for the current value of the slider.
35
+ */
36
+ 'aria-valuetext'?: string;
22
37
  /**
23
38
  * The color of the component.
24
39
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -53,38 +68,209 @@ export type SliderTypeMap<
53
68
  *
54
69
  * @default {}
55
70
  */
56
- componentsProps?: SliderUnstyledTypeMap['props']['slotProps'];
71
+ componentsProps?: {
72
+ root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
73
+ track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
74
+ rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
75
+ thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
76
+ mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
77
+ markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
78
+ valueLabel?: SlotComponentProps<
79
+ typeof SliderValueLabelComponent,
80
+ SliderComponentsPropsOverrides,
81
+ SliderOwnerState
82
+ >;
83
+ input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
84
+ };
57
85
  /**
58
86
  * Override or extend the styles applied to the component.
59
87
  */
60
- classes?: SliderUnstyledTypeMap['props']['classes'] & {
61
- /** Class name applied to the root element if `color="primary"`. */
62
- colorPrimary?: string;
63
- /** Class name applied to the root element if `color="secondary"`. */
64
- colorSecondary?: string;
65
- /** Class name applied to the root element if `size="small"`. */
66
- sizeSmall?: string;
67
- /** Class name applied to the thumb element if `color="primary"`. */
68
- thumbColorPrimary?: string;
69
- /** Class name applied to the thumb element if `color="secondary"`. */
70
- thumbColorSecondary?: string;
71
- /** Class name applied to the thumb element if `size="small"`. */
72
- thumbSizeSmall?: string;
73
- };
88
+ classes?: Partial<SliderClasses>;
89
+ /**
90
+ * The default value. Use when the component is not controlled.
91
+ */
92
+ defaultValue?: number | number[];
93
+ /**
94
+ * If `true`, the component is disabled.
95
+ * @default false
96
+ */
97
+ disabled?: boolean;
98
+ /**
99
+ * If `true`, the active thumb doesn't swap when moving pointer over a thumb while dragging another thumb.
100
+ * @default false
101
+ */
102
+ disableSwap?: boolean;
103
+ /**
104
+ * Accepts a function which returns a string value that provides a user-friendly name for the thumb labels of the slider.
105
+ * This is important for screen reader users.
106
+ * @param {number} index The thumb label's index to format.
107
+ * @returns {string}
108
+ */
109
+ getAriaLabel?: (index: number) => string;
110
+ /**
111
+ * Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider.
112
+ * This is important for screen reader users.
113
+ * @param {number} value The thumb label's value to format.
114
+ * @param {number} index The thumb label's index to format.
115
+ * @returns {string}
116
+ */
117
+ getAriaValueText?: (value: number, index: number) => string;
118
+ /**
119
+ * Marks indicate predetermined values to which the user can move the slider.
120
+ * If `true` the marks are spaced according the value of the `step` prop.
121
+ * If an array, it should contain objects with `value` and an optional `label` keys.
122
+ * @default false
123
+ */
124
+ marks?: boolean | Mark[];
125
+ /**
126
+ * The maximum allowed value of the slider.
127
+ * Should not be equal to min.
128
+ * @default 100
129
+ */
130
+ max?: number;
131
+ /**
132
+ * The minimum allowed value of the slider.
133
+ * Should not be equal to max.
134
+ * @default 0
135
+ */
136
+ min?: number;
137
+ /**
138
+ * Name attribute of the hidden `input` element.
139
+ */
140
+ name?: string;
141
+ /**
142
+ * Callback function that is fired when the slider's value changed.
143
+ *
144
+ * @param {Event} event The event source of the callback.
145
+ * You can pull out the new value by accessing `event.target.value` (any).
146
+ * **Warning**: This is a generic event not a change event.
147
+ * @param {number | number[]} value The new value.
148
+ * @param {number} activeThumb Index of the currently moved thumb.
149
+ */
150
+ onChange?: (event: Event, value: number | number[], activeThumb: number) => void;
151
+ /**
152
+ * Callback function that is fired when the `mouseup` is triggered.
153
+ *
154
+ * @param {React.SyntheticEvent | Event} event The event source of the callback. **Warning**: This is a generic event not a change event.
155
+ * @param {number | number[]} value The new value.
156
+ */
157
+ onChangeCommitted?: (event: React.SyntheticEvent | Event, value: number | number[]) => void;
158
+ /**
159
+ * The component orientation.
160
+ * @default 'horizontal'
161
+ */
162
+ orientation?: 'horizontal' | 'vertical';
163
+ /**
164
+ * A transformation function, to change the scale of the slider.
165
+ * @param {any} x
166
+ * @returns {any}
167
+ * @default function Identity(x) {
168
+ * return x;
169
+ * }
170
+ */
171
+ scale?: (value: number) => number;
74
172
  /**
75
173
  * The size of the slider.
76
174
  * @default 'medium'
77
175
  */
78
176
  size?: OverridableStringUnion<'small' | 'medium', SliderPropsSizeOverrides>;
177
+ /**
178
+ * The props used for each slot inside the Slider.
179
+ * @default {}
180
+ */
181
+ slotProps?: {
182
+ root?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
183
+ track?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
184
+ rail?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
185
+ thumb?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
186
+ mark?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
187
+ markLabel?: SlotComponentProps<'span', SliderComponentsPropsOverrides, SliderOwnerState>;
188
+ valueLabel?: SlotComponentProps<
189
+ typeof SliderValueLabelComponent,
190
+ SliderComponentsPropsOverrides,
191
+ SliderOwnerState
192
+ >;
193
+ input?: SlotComponentProps<'input', SliderComponentsPropsOverrides, SliderOwnerState>;
194
+ };
195
+ /**
196
+ * The components used for each slot inside the Slider.
197
+ * Either a string to use a HTML element or a component.
198
+ * @default {}
199
+ */
200
+ slots?: {
201
+ root?: React.ElementType;
202
+ track?: React.ElementType;
203
+ rail?: React.ElementType;
204
+ thumb?: React.ElementType;
205
+ mark?: React.ElementType;
206
+ markLabel?: React.ElementType;
207
+ valueLabel?: React.ElementType;
208
+ input?: React.ElementType;
209
+ };
210
+ /**
211
+ * The granularity with which the slider can step through values. (A "discrete" slider.)
212
+ * The `min` prop serves as the origin for the valid values.
213
+ * We recommend (max - min) to be evenly divisible by the step.
214
+ *
215
+ * When step is `null`, the thumb can only be slid onto marks provided with the `marks` prop.
216
+ * @default 1
217
+ */
218
+ step?: number | null;
79
219
  /**
80
220
  * The system prop that allows defining system overrides as well as additional CSS styles.
81
221
  */
82
222
  sx?: SxProps<Theme>;
223
+ /**
224
+ * Tab index attribute of the hidden `input` element.
225
+ */
226
+ tabIndex?: number;
227
+ /**
228
+ * The track presentation:
229
+ *
230
+ * - `normal` the track will render a bar representing the slider value.
231
+ * - `inverted` the track will render a bar representing the remaining slider value.
232
+ * - `false` the track will render without a bar.
233
+ * @default 'normal'
234
+ */
235
+ track?: 'normal' | false | 'inverted';
236
+ /**
237
+ * The value of the slider.
238
+ * For ranged sliders, provide an array with two values.
239
+ */
240
+ value?: number | number[];
241
+ /**
242
+ * Controls when the value label is displayed:
243
+ *
244
+ * - `auto` the value label will display when the thumb is hovered or focused.
245
+ * - `on` will display persistently.
246
+ * - `off` will never display.
247
+ * @default 'off'
248
+ */
249
+ valueLabelDisplay?: 'on' | 'auto' | 'off';
250
+ /**
251
+ * The format function the value label's value.
252
+ *
253
+ * When a function is provided, it should have the following signature:
254
+ *
255
+ * - {number} value The value label's value to format
256
+ * - {number} index The value label's index to format
257
+ * @param {any} x
258
+ * @returns {any}
259
+ * @default function Identity(x) {
260
+ * return x;
261
+ * }
262
+ */
263
+ valueLabelFormat?: string | ((value: number, index: number) => React.ReactNode);
83
264
  };
84
265
  defaultComponent: D;
85
- }>;
266
+ }
86
267
 
87
- export { SliderValueLabelProps };
268
+ export interface SliderValueLabelProps extends React.HTMLAttributes<HTMLSpanElement> {
269
+ children: React.ReactElement;
270
+ index: number;
271
+ open: boolean;
272
+ value: number;
273
+ }
88
274
 
89
275
  type SliderRootProps = NonNullable<SliderTypeMap['props']['componentsProps']>['root'];
90
276
  type SliderMarkProps = NonNullable<SliderTypeMap['props']['componentsProps']>['mark'];
@@ -111,17 +297,11 @@ export declare const SliderValueLabel: React.FC<SliderValueLabelProps>;
111
297
  *
112
298
  * - [Slider API](https://mui.com/material-ui/api/slider/)
113
299
  */
114
- declare const Slider: ExtendSliderUnstyled<SliderTypeMap>;
115
-
116
- export type SliderClassKey = keyof NonNullable<SliderTypeMap['props']['classes']>;
300
+ declare const Slider: OverridableComponent<SliderTypeMap>;
117
301
 
118
302
  export type SliderProps<
119
303
  D extends React.ElementType = SliderTypeMap['defaultComponent'],
120
304
  P = {},
121
305
  > = OverrideProps<SliderTypeMap<D, P>, D>;
122
306
 
123
- export type SliderClasses = Record<SliderClassKey, string>;
124
-
125
- export declare const sliderClasses: SliderClasses;
126
-
127
307
  export default Slider;
package/Slider/Slider.js CHANGED
@@ -6,15 +6,15 @@ import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
7
  import { chainPropTypes } from '@mui/utils';
8
8
  import { isHostComponent, useSlotProps, unstable_composeClasses as composeClasses } from '@mui/base';
9
- import { useSlider, getSliderUtilityClass } from '@mui/base/SliderUnstyled';
9
+ import { useSlider } from '@mui/base/SliderUnstyled';
10
10
  import { alpha, lighten, darken } from '@mui/system';
11
11
  import useThemeProps from '../styles/useThemeProps';
12
12
  import styled, { slotShouldForwardProp } from '../styles/styled';
13
13
  import useTheme from '../styles/useTheme';
14
14
  import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
15
15
  import capitalize from '../utils/capitalize';
16
- import SliderValueLabelComponent from './SliderValueLabel';
17
- import sliderClasses from './sliderClasses';
16
+ import SliderValueLabel from './SliderValueLabel';
17
+ import sliderClasses, { getSliderUtilityClass } from './sliderClasses';
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
20
20
  const valueToPercent = (value, min, max) => (value - min) * 100 / (max - min);
@@ -261,7 +261,7 @@ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes /* remove-proptype
261
261
  children: PropTypes.node
262
262
  } : void 0;
263
263
  export { SliderThumb };
264
- const SliderValueLabel = styled(SliderValueLabelComponent, {
264
+ const StyledSliderValueLabel = styled(SliderValueLabel, {
265
265
  name: 'MuiSlider',
266
266
  slot: 'ValueLabel',
267
267
  overridesResolver: (props, styles) => styles.valueLabel
@@ -319,7 +319,7 @@ const SliderValueLabel = styled(SliderValueLabelComponent, {
319
319
  fontSize: theme.typography.pxToRem(12),
320
320
  padding: '0.25rem 0.5rem'
321
321
  }));
322
- process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes /* remove-proptypes */ = {
322
+ process.env.NODE_ENV !== "production" ? StyledSliderValueLabel.propTypes /* remove-proptypes */ = {
323
323
  // ----------------------------- Warning --------------------------------
324
324
  // | These PropTypes are generated from the TypeScript type definitions |
325
325
  // | To update them edit the d.ts file and run "yarn proptypes" |
@@ -329,7 +329,7 @@ process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes /* remove-pro
329
329
  */
330
330
  children: PropTypes.node
331
331
  } : void 0;
332
- export { SliderValueLabel };
332
+ export { StyledSliderValueLabel as SliderValueLabel };
333
333
  const SliderMark = styled('span', {
334
334
  name: 'MuiSlider',
335
335
  slot: 'Mark',
@@ -523,7 +523,7 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
523
523
  const RailSlot = (_ref2 = (_slots$rail = slots == null ? void 0 : slots.rail) != null ? _slots$rail : components.Rail) != null ? _ref2 : SliderRail;
524
524
  const TrackSlot = (_ref3 = (_slots$track = slots == null ? void 0 : slots.track) != null ? _slots$track : components.Track) != null ? _ref3 : SliderTrack;
525
525
  const ThumbSlot = (_ref4 = (_slots$thumb = slots == null ? void 0 : slots.thumb) != null ? _slots$thumb : components.Thumb) != null ? _ref4 : SliderThumb;
526
- 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;
527
527
  const MarkSlot = (_ref6 = (_slots$mark = slots == null ? void 0 : slots.mark) != null ? _slots$mark : components.Mark) != null ? _ref6 : SliderMark;
528
528
  const MarkLabelSlot = (_ref7 = (_slots$markLabel = slots == null ? void 0 : slots.markLabel) != null ? _slots$markLabel : components.MarkLabel) != null ? _ref7 : SliderMarkLabel;
529
529
  const InputSlot = (_ref8 = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components.Input) != null ? _ref8 : 'input';
@@ -4,7 +4,7 @@ import { SliderValueLabelProps } from './SliderValueLabel.types';
4
4
  /**
5
5
  * @ignore - internal component.
6
6
  */
7
- declare function SliderValueLabel(props: SliderValueLabelProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
7
+ declare function SliderValueLabel(props: SliderValueLabelProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
8
8
  declare namespace SliderValueLabel {
9
9
  var propTypes: {
10
10
  children: PropTypes.Validator<PropTypes.ReactElementLike>;
@@ -26,6 +26,9 @@ export default function SliderValueLabel(props) {
26
26
  value
27
27
  } = props;
28
28
  const classes = useValueLabelClasses(props);
29
+ if (!children) {
30
+ return null;
31
+ }
29
32
  return /*#__PURE__*/React.cloneElement(children, {
30
33
  className: clsx(children.props.className)
31
34
  }, /*#__PURE__*/_jsxs(React.Fragment, {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export interface SliderValueLabelProps {
3
- children: React.ReactElement;
3
+ children?: React.ReactElement;
4
4
  className?: string;
5
5
  style?: React.CSSProperties;
6
6
  /**
package/Slider/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { default } from './Slider';
2
2
  export * from './Slider';
3
+
3
4
  export { default as sliderClasses } from './sliderClasses';
5
+ export * from './sliderClasses';
package/Slider/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default } from './Slider';
2
2
  export * from './Slider';
3
- export { default as sliderClasses } from './sliderClasses';
3
+ export { default as sliderClasses } from './sliderClasses';
4
+ export * from './sliderClasses';
@@ -1,29 +1,58 @@
1
- declare const sliderClasses: {
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"`. */
2
5
  colorPrimary: string;
6
+ /** Class name applied to the root element if `color="secondary"`. */
3
7
  colorSecondary: string;
4
- sizeSmall: string;
5
- thumbColorPrimary: string;
6
- thumbColorSecondary: string;
7
- thumbSizeSmall: string;
8
- root: string;
8
+ /** Class name applied to the root element if `marks` is provided with at least one label. */
9
9
  marked: string;
10
+ /** Class name applied to the root element if `orientation="vertical"`. */
10
11
  vertical: string;
12
+ /** State class applied to the root and thumb element if `disabled={true}`. */
11
13
  disabled: string;
14
+ /** State class applied to the root if a thumb is being dragged. */
12
15
  dragging: string;
16
+ /** Class name applied to the rail element. */
13
17
  rail: string;
18
+ /** Class name applied to the track element. */
14
19
  track: string;
20
+ /** Class name applied to the root element if `track={false}`. */
15
21
  trackFalse: string;
22
+ /** Class name applied to the root element if `track="inverted"`. */
16
23
  trackInverted: string;
24
+ /** Class name applied to the thumb element. */
17
25
  thumb: string;
26
+ /** State class applied to the thumb element if it's active. */
18
27
  active: string;
28
+ /** State class applied to the thumb element if keyboard focused. */
19
29
  focusVisible: string;
20
- valueLabel: string;
21
- valueLabelOpen: string;
22
- valueLabelCircle: string;
23
- valueLabelLabel: string;
30
+ /** Class name applied to the mark element. */
24
31
  mark: string;
32
+ /** Class name applied to the mark element if active (depending on the value). */
25
33
  markActive: string;
34
+ /** Class name applied to the mark label element. */
26
35
  markLabel: string;
36
+ /** Class name applied to the mark label element if active (depending on the value). */
27
37
  markLabelActive: string;
28
- };
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;
29
58
  export default sliderClasses;
@@ -1,5 +1,7 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  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']));
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']);
5
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.
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["BackdropProps"],
4
- _excluded2 = ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"];
4
+ _excluded2 = ["anchor", "disableBackdropTransition", "disableDiscovery", "disableSwipeToOpen", "hideBackdrop", "hysteresis", "allowSwipeInChildren", "minFlingVelocity", "ModalProps", "onClose", "onOpen", "open", "PaperProps", "SwipeAreaProps", "swipeAreaWidth", "transitionDuration", "variant"];
5
5
  import * as React from 'react';
6
6
  import { flushSync } from 'react-dom';
7
7
  import PropTypes from 'prop-types';
@@ -133,6 +133,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
133
133
  disableSwipeToOpen = iOS,
134
134
  hideBackdrop,
135
135
  hysteresis = 0.52,
136
+ allowSwipeInChildren = false,
136
137
  minFlingVelocity = 450,
137
138
  ModalProps: {
138
139
  BackdropProps
@@ -252,6 +253,30 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
252
253
  });
253
254
  }
254
255
  });
256
+ const startMaybeSwiping = (force = false) => {
257
+ if (!maybeSwiping) {
258
+ // on Safari Mobile, if you want to be able to have the 'click' event fired on child elements, nothing in the DOM can be changed.
259
+ // this is because Safari Mobile will not fire any mouse events (still fires touch though) if the DOM changes during mousemove.
260
+ // so do this change on first touchmove instead of touchstart
261
+ if (force || !(disableDiscovery && allowSwipeInChildren)) {
262
+ flushSync(() => {
263
+ setMaybeSwiping(true);
264
+ });
265
+ }
266
+ const horizontalSwipe = isHorizontal(anchor);
267
+ if (!open && paperRef.current) {
268
+ // The ref may be null when a parent component updates while swiping.
269
+ setPosition(getMaxTranslate(horizontalSwipe, paperRef.current) + (disableDiscovery ? 15 : -DRAG_STARTED_SIGNAL), {
270
+ changeTransition: false
271
+ });
272
+ }
273
+ swipeInstance.current.velocity = 0;
274
+ swipeInstance.current.lastTime = null;
275
+ swipeInstance.current.lastTranslate = null;
276
+ swipeInstance.current.paperHit = false;
277
+ touchDetected.current = true;
278
+ }
279
+ };
255
280
  const handleBodyTouchMove = useEventCallback(nativeEvent => {
256
281
  // the ref may be null when a parent component updates while swiping
257
282
  if (!paperRef.current || !touchDetected.current) {
@@ -262,6 +287,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
262
287
  if (claimedSwipeInstance !== null && claimedSwipeInstance !== swipeInstance.current) {
263
288
  return;
264
289
  }
290
+ startMaybeSwiping(true);
265
291
  const anchorRtl = getAnchor(theme, anchor);
266
292
  const horizontalSwipe = isHorizontal(anchor);
267
293
  const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, ownerDocument(nativeEvent.currentTarget));
@@ -372,7 +398,12 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
372
398
  const currentX = calculateCurrentX(anchorRtl, nativeEvent.touches, ownerDocument(nativeEvent.currentTarget));
373
399
  const currentY = calculateCurrentY(anchorRtl, nativeEvent.touches, ownerWindow(nativeEvent.currentTarget));
374
400
  if (!open) {
375
- if (disableSwipeToOpen || nativeEvent.target !== swipeAreaRef.current) {
401
+ var _paperRef$current;
402
+ // logic for if swipe should be ignored:
403
+ // if disableSwipeToOpen
404
+ // if target != swipeArea, and target is not a child of paper ref
405
+ // if is a child of paper ref, and `allowSwipeInChildren` does not allow it
406
+ if (disableSwipeToOpen || !(nativeEvent.target === swipeAreaRef.current || (_paperRef$current = paperRef.current) != null && _paperRef$current.contains(nativeEvent.target) && (typeof allowSwipeInChildren === 'function' ? allowSwipeInChildren(nativeEvent, swipeAreaRef.current, paperRef.current) : allowSwipeInChildren))) {
376
407
  return;
377
408
  }
378
409
  if (horizontalSwipe) {
@@ -387,20 +418,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
387
418
  claimedSwipeInstance = null;
388
419
  swipeInstance.current.startX = currentX;
389
420
  swipeInstance.current.startY = currentY;
390
- flushSync(() => {
391
- setMaybeSwiping(true);
392
- });
393
- if (!open && paperRef.current) {
394
- // The ref may be null when a parent component updates while swiping.
395
- setPosition(getMaxTranslate(horizontalSwipe, paperRef.current) + (disableDiscovery ? 15 : -DRAG_STARTED_SIGNAL), {
396
- changeTransition: false
397
- });
398
- }
399
- swipeInstance.current.velocity = 0;
400
- swipeInstance.current.lastTime = null;
401
- swipeInstance.current.lastTranslate = null;
402
- swipeInstance.current.paperHit = false;
403
- touchDetected.current = true;
421
+ startMaybeSwiping();
404
422
  });
405
423
  React.useEffect(() => {
406
424
  if (variant === 'temporary') {
@@ -448,7 +466,7 @@ const SwipeableDrawer = /*#__PURE__*/React.forwardRef(function SwipeableDrawer(i
448
466
  hideBackdrop: hideBackdrop,
449
467
  PaperProps: _extends({}, PaperProps, {
450
468
  style: _extends({
451
- pointerEvents: variant === 'temporary' && !open ? 'none' : ''
469
+ pointerEvents: variant === 'temporary' && !open && !allowSwipeInChildren ? 'none' : ''
452
470
  }, PaperProps.style),
453
471
  ref: handleRef
454
472
  }),
@@ -470,6 +488,19 @@ process.env.NODE_ENV !== "production" ? SwipeableDrawer.propTypes /* remove-prop
470
488
  // | These PropTypes are generated from the TypeScript type definitions |
471
489
  // | To update them edit the d.ts file and run "yarn proptypes" |
472
490
  // ----------------------------------------------------------------------
491
+ /**
492
+ * 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.
493
+ * This can be useful in scenarios where the drawer is partially visible.
494
+ * You can customize it further with a callback that determines which children the user can drag over to open the drawer
495
+ * (for example, to ignore other elements that handle touch move events, like sliders).
496
+ *
497
+ * @param {TouchEvent} event The 'touchstart' event
498
+ * @param {HTMLDivElement} swipeArea The swipe area element
499
+ * @param {HTMLDivElement} paper The drawer's paper element
500
+ *
501
+ * @default false
502
+ */
503
+ allowSwipeInChildren: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
473
504
  /**
474
505
  * @ignore
475
506
  */
package/Switch/Switch.js CHANGED
@@ -258,6 +258,7 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
258
258
  disabled: PropTypes.bool,
259
259
  /**
260
260
  * If `true`, the ripple effect is disabled.
261
+ * @default false
261
262
  */
262
263
  disableRipple: PropTypes.bool,
263
264
  /**
@@ -294,6 +295,7 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
294
295
  onChange: PropTypes.func,
295
296
  /**
296
297
  * If `true`, the `input` element is required.
298
+ * @default false
297
299
  */
298
300
  required: PropTypes.bool,
299
301
  /**
@@ -18,6 +18,7 @@ export interface TabScrollButtonProps extends StandardProps<React.HTMLAttributes
18
18
  direction: 'left' | 'right';
19
19
  /**
20
20
  * If `true`, the component is disabled.
21
+ * @default false
21
22
  */
22
23
  disabled?: boolean;
23
24
  /**
@@ -105,6 +105,7 @@ process.env.NODE_ENV !== "production" ? TabScrollButton.propTypes /* remove-prop
105
105
  direction: PropTypes.oneOf(['left', 'right']).isRequired,
106
106
  /**
107
107
  * If `true`, the component is disabled.
108
+ * @default false
108
109
  */
109
110
  disabled: PropTypes.bool,
110
111
  /**