@mui/material 5.15.12 → 5.15.14

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 (121) hide show
  1. package/Accordion/Accordion.js +30 -23
  2. package/AccordionActions/AccordionActions.js +14 -12
  3. package/AccordionDetails/AccordionDetails.js +2 -2
  4. package/AccordionSummary/AccordionSummary.js +29 -23
  5. package/Alert/Alert.d.ts +2 -2
  6. package/Autocomplete/Autocomplete.d.ts +1 -1
  7. package/Autocomplete/Autocomplete.js +117 -82
  8. package/Autocomplete/autocompleteClasses.d.ts +3 -3
  9. package/CHANGELOG.md +203 -51
  10. package/CircularProgress/CircularProgress.d.ts +1 -1
  11. package/CircularProgress/CircularProgress.js +1 -1
  12. package/Drawer/Drawer.js +9 -3
  13. package/Icon/Icon.d.ts +1 -1
  14. package/Icon/Icon.js +1 -1
  15. package/LinearProgress/LinearProgress.js +4 -4
  16. package/Menu/Menu.js +5 -4
  17. package/MenuList/MenuList.js +4 -2
  18. package/OverridableComponent.d.ts +1 -1
  19. package/PaginationItem/PaginationItem.js +3 -3
  20. package/Popper/Popper.d.ts +3 -26
  21. package/README.md +2 -2
  22. package/Rating/Rating.js +3 -3
  23. package/Select/Select.d.ts +8 -20
  24. package/Slider/Slider.js +406 -226
  25. package/SvgIcon/SvgIcon.js +1 -1
  26. package/Switch/Switch.js +61 -41
  27. package/TabScrollButton/TabScrollButton.js +2 -3
  28. package/TablePagination/TablePaginationActions.js +14 -14
  29. package/Tabs/Tabs.js +3 -2
  30. package/Tooltip/Tooltip.js +5 -4
  31. package/index.js +1 -1
  32. package/legacy/Accordion/Accordion.js +33 -22
  33. package/legacy/AccordionActions/AccordionActions.js +17 -14
  34. package/legacy/AccordionDetails/AccordionDetails.js +2 -2
  35. package/legacy/AccordionSummary/AccordionSummary.js +31 -22
  36. package/legacy/Autocomplete/Autocomplete.js +194 -164
  37. package/legacy/CircularProgress/CircularProgress.js +1 -1
  38. package/legacy/Drawer/Drawer.js +8 -3
  39. package/legacy/Icon/Icon.js +1 -1
  40. package/legacy/LinearProgress/LinearProgress.js +4 -4
  41. package/legacy/Menu/Menu.js +5 -4
  42. package/legacy/MenuList/MenuList.js +3 -2
  43. package/legacy/PaginationItem/PaginationItem.js +3 -3
  44. package/legacy/Rating/Rating.js +3 -3
  45. package/legacy/Slider/Slider.js +375 -194
  46. package/legacy/SvgIcon/SvgIcon.js +1 -1
  47. package/legacy/Switch/Switch.js +88 -59
  48. package/legacy/TabScrollButton/TabScrollButton.js +2 -3
  49. package/legacy/TablePagination/TablePaginationActions.js +14 -14
  50. package/legacy/Tabs/Tabs.js +3 -2
  51. package/legacy/Tooltip/Tooltip.js +7 -3
  52. package/legacy/index.js +1 -1
  53. package/legacy/styles/experimental_extendTheme.js +4 -1
  54. package/legacy/styles/rootShouldForwardProp.js +5 -0
  55. package/legacy/styles/slotShouldForwardProp.js +5 -0
  56. package/legacy/styles/styled.js +4 -5
  57. package/legacy/usePagination/usePagination.js +1 -1
  58. package/modern/Accordion/Accordion.js +30 -23
  59. package/modern/AccordionActions/AccordionActions.js +14 -12
  60. package/modern/AccordionDetails/AccordionDetails.js +2 -2
  61. package/modern/AccordionSummary/AccordionSummary.js +29 -23
  62. package/modern/Autocomplete/Autocomplete.js +117 -82
  63. package/modern/CircularProgress/CircularProgress.js +1 -1
  64. package/modern/Drawer/Drawer.js +9 -3
  65. package/modern/Icon/Icon.js +1 -1
  66. package/modern/LinearProgress/LinearProgress.js +4 -4
  67. package/modern/Menu/Menu.js +5 -4
  68. package/modern/MenuList/MenuList.js +4 -2
  69. package/modern/PaginationItem/PaginationItem.js +3 -3
  70. package/modern/Rating/Rating.js +3 -3
  71. package/modern/Slider/Slider.js +339 -175
  72. package/modern/SvgIcon/SvgIcon.js +1 -1
  73. package/modern/Switch/Switch.js +61 -41
  74. package/modern/TabScrollButton/TabScrollButton.js +2 -3
  75. package/modern/TablePagination/TablePaginationActions.js +14 -14
  76. package/modern/Tabs/Tabs.js +3 -2
  77. package/modern/Tooltip/Tooltip.js +5 -4
  78. package/modern/index.js +1 -1
  79. package/modern/styles/experimental_extendTheme.js +4 -1
  80. package/modern/styles/rootShouldForwardProp.js +3 -0
  81. package/modern/styles/slotShouldForwardProp.js +5 -0
  82. package/modern/styles/styled.js +4 -3
  83. package/modern/usePagination/usePagination.js +1 -1
  84. package/node/Accordion/Accordion.js +32 -25
  85. package/node/AccordionActions/AccordionActions.js +16 -14
  86. package/node/AccordionDetails/AccordionDetails.js +4 -4
  87. package/node/AccordionSummary/AccordionSummary.js +33 -27
  88. package/node/Autocomplete/Autocomplete.js +129 -94
  89. package/node/CircularProgress/CircularProgress.js +1 -1
  90. package/node/Drawer/Drawer.js +9 -3
  91. package/node/Icon/Icon.js +1 -1
  92. package/node/LinearProgress/LinearProgress.js +4 -4
  93. package/node/Menu/Menu.js +5 -4
  94. package/node/MenuList/MenuList.js +4 -2
  95. package/node/PaginationItem/PaginationItem.js +3 -3
  96. package/node/Rating/Rating.js +3 -3
  97. package/node/Slider/Slider.js +416 -236
  98. package/node/SvgIcon/SvgIcon.js +1 -1
  99. package/node/Switch/Switch.js +66 -46
  100. package/node/TabScrollButton/TabScrollButton.js +2 -3
  101. package/node/TablePagination/TablePaginationActions.js +14 -14
  102. package/node/Tabs/Tabs.js +3 -2
  103. package/node/Tooltip/Tooltip.js +5 -4
  104. package/node/index.js +1 -1
  105. package/node/styles/experimental_extendTheme.js +4 -1
  106. package/node/styles/rootShouldForwardProp.js +10 -0
  107. package/node/styles/slotShouldForwardProp.js +11 -0
  108. package/node/styles/styled.js +17 -8
  109. package/node/usePagination/usePagination.js +1 -1
  110. package/package.json +6 -6
  111. package/styles/experimental_extendTheme.d.ts +1 -0
  112. package/styles/experimental_extendTheme.js +4 -1
  113. package/styles/rootShouldForwardProp.d.ts +2 -0
  114. package/styles/rootShouldForwardProp.js +3 -0
  115. package/styles/slotShouldForwardProp.d.ts +2 -0
  116. package/styles/slotShouldForwardProp.js +5 -0
  117. package/styles/styled.d.ts +2 -3
  118. package/styles/styled.js +4 -3
  119. package/umd/material-ui.development.js +1048 -738
  120. package/umd/material-ui.production.min.js +2 -2
  121. package/usePagination/usePagination.js +1 -1
@@ -16,8 +16,8 @@ import clsx from 'clsx';
16
16
  import composeClasses from '@mui/utils/composeClasses';
17
17
  import { keyframes, css } from '@mui/system';
18
18
  import { darken, lighten } from '@mui/system/colorManipulator';
19
+ import { useRtl } from '@mui/system/RtlProvider';
19
20
  import capitalize from '../utils/capitalize';
20
- import useTheme from '../styles/useTheme';
21
21
  import styled from '../styles/styled';
22
22
  import useThemeProps from '../styles/useThemeProps';
23
23
  import { getLinearProgressUtilityClass } from './linearProgressClasses';
@@ -255,7 +255,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
255
255
  variant
256
256
  });
257
257
  const classes = useUtilityClasses(ownerState);
258
- const theme = useTheme();
258
+ const isRtl = useRtl();
259
259
  const rootProps = {};
260
260
  const inlineStyles = {
261
261
  bar1: {},
@@ -267,7 +267,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
267
267
  rootProps['aria-valuemin'] = 0;
268
268
  rootProps['aria-valuemax'] = 100;
269
269
  let transform = value - 100;
270
- if (theme.direction === 'rtl') {
270
+ if (isRtl) {
271
271
  transform = -transform;
272
272
  }
273
273
  inlineStyles.bar1.transform = `translateX(${transform}%)`;
@@ -278,7 +278,7 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
278
278
  if (variant === 'buffer') {
279
279
  if (valueBuffer !== undefined) {
280
280
  let transform = (valueBuffer || 0) - 100;
281
- if (theme.direction === 'rtl') {
281
+ if (isRtl) {
282
282
  transform = -transform;
283
283
  }
284
284
  inlineStyles.bar2.transform = `translateX(${transform}%)`;
package/Menu/Menu.js CHANGED
@@ -11,10 +11,10 @@ import clsx from 'clsx';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
12
  import { useSlotProps } from '@mui/base/utils';
13
13
  import HTMLElementType from '@mui/utils/HTMLElementType';
14
+ import { useRtl } from '@mui/system/RtlProvider';
14
15
  import MenuList from '../MenuList';
15
16
  import Popover, { PopoverPaper } from '../Popover';
16
17
  import styled, { rootShouldForwardProp } from '../styles/styled';
17
- import useTheme from '../styles/useTheme';
18
18
  import useThemeProps from '../styles/useThemeProps';
19
19
  import { getMenuUtilityClass } from './menuClasses';
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -89,8 +89,7 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
89
89
  } = props,
90
90
  TransitionProps = _objectWithoutPropertiesLoose(props.TransitionProps, _excluded),
91
91
  other = _objectWithoutPropertiesLoose(props, _excluded2);
92
- const theme = useTheme();
93
- const isRtl = theme.direction === 'rtl';
92
+ const isRtl = useRtl();
94
93
  const ownerState = _extends({}, props, {
95
94
  autoFocus,
96
95
  disableAutoFocusItem,
@@ -106,7 +105,9 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
106
105
  const menuListActionsRef = React.useRef(null);
107
106
  const handleEntering = (element, isAppearing) => {
108
107
  if (menuListActionsRef.current) {
109
- menuListActionsRef.current.adjustStyleForScrollbar(element, theme);
108
+ menuListActionsRef.current.adjustStyleForScrollbar(element, {
109
+ direction: isRtl ? 'rtl' : 'ltr'
110
+ });
110
111
  }
111
112
  if (onEntering) {
112
113
  onEntering(element, isAppearing);
@@ -107,13 +107,15 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
107
107
  }
108
108
  }, [autoFocus]);
109
109
  React.useImperativeHandle(actions, () => ({
110
- adjustStyleForScrollbar: (containerElement, theme) => {
110
+ adjustStyleForScrollbar: (containerElement, {
111
+ direction
112
+ }) => {
111
113
  // Let's ignore that piece of logic if users are already overriding the width
112
114
  // of the menu.
113
115
  const noExplicitWidth = !listRef.current.style.width;
114
116
  if (containerElement.clientHeight < listRef.current.clientHeight && noExplicitWidth) {
115
117
  const scrollbarSize = `${getScrollbarSize(ownerDocument(containerElement))}px`;
116
- listRef.current.style[theme.direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
118
+ listRef.current.style[direction === 'rtl' ? 'paddingLeft' : 'paddingRight'] = scrollbarSize;
117
119
  listRef.current.style.width = `calc(100% + ${scrollbarSize})`;
118
120
  }
119
121
  return listRef.current;
@@ -11,7 +11,7 @@ export interface OverridableComponent<TypeMap extends OverridableTypeMap> {
11
11
  // If you make any changes to this interface, please make sure to update the
12
12
  // `OverridableComponent` type in `mui-types/index.d.ts` as well.
13
13
  // Also, there are types in Base UI that have a similar shape to this interface
14
- // (e.g. SelectType, OptionType, etc.).
14
+ // (for example SelectType, OptionType, etc.).
15
15
  <RootComponent extends React.ElementType>(
16
16
  props: {
17
17
  /**
@@ -8,9 +8,9 @@ import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
9
9
  import composeClasses from '@mui/utils/composeClasses';
10
10
  import { alpha } from '@mui/system/colorManipulator';
11
+ import { useRtl } from '@mui/system/RtlProvider';
11
12
  import useThemeProps from '../styles/useThemeProps';
12
13
  import paginationItemClasses, { getPaginationItemUtilityClass } from './paginationItemClasses';
13
- import useTheme from '../styles/useTheme';
14
14
  import ButtonBase from '../ButtonBase';
15
15
  import capitalize from '../utils/capitalize';
16
16
  import FirstPageIcon from '../internal/svg-icons/FirstPage';
@@ -234,9 +234,9 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
234
234
  type,
235
235
  variant
236
236
  });
237
- const theme = useTheme();
237
+ const isRtl = useRtl();
238
238
  const classes = useUtilityClasses(ownerState);
239
- const normalizedIcons = theme.direction === 'rtl' ? {
239
+ const normalizedIcons = isRtl ? {
240
240
  previous: slots.next || components.next || NavigateNextIcon,
241
241
  next: slots.previous || components.previous || NavigateBeforeIcon,
242
242
  last: slots.first || components.first || FirstPageIcon,
@@ -2,7 +2,7 @@ import { PopperProps as BasePopperProps } from '@mui/base/Popper';
2
2
  import { SxProps } from '@mui/system';
3
3
  import * as React from 'react';
4
4
  import { Theme } from '../styles';
5
- export type PopperProps = Omit<BasePopperProps, 'direction'> & {
5
+ export interface PopperProps extends Omit<BasePopperProps, 'direction'> {
6
6
  /**
7
7
  * The component used for the root node.
8
8
  * Either a string to use a HTML element or a component.
@@ -25,7 +25,7 @@ export type PopperProps = Omit<BasePopperProps, 'direction'> & {
25
25
  * The system prop that allows defining system overrides as well as additional CSS styles.
26
26
  */
27
27
  sx?: SxProps<Theme>;
28
- };
28
+ }
29
29
  /**
30
30
  *
31
31
  * Demos:
@@ -38,28 +38,5 @@ export type PopperProps = Omit<BasePopperProps, 'direction'> & {
38
38
  *
39
39
  * - [Popper API](https://mui.com/material-ui/api/popper/)
40
40
  */
41
- declare const Popper: React.ForwardRefExoticComponent<Omit<BasePopperProps, "direction"> & {
42
- /**
43
- * The component used for the root node.
44
- * Either a string to use a HTML element or a component.
45
- */
46
- component?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
47
- /**
48
- * The components used for each slot inside the Popper.
49
- * Either a string to use a HTML element or a component.
50
- * @default {}
51
- */
52
- components?: {
53
- Root?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
54
- } | undefined;
55
- /**
56
- * The props used for each slot inside the Popper.
57
- * @default {}
58
- */
59
- componentsProps?: BasePopperProps['slotProps'];
60
- /**
61
- * The system prop that allows defining system overrides as well as additional CSS styles.
62
- */
63
- sx?: SxProps<Theme> | undefined;
64
- } & React.RefAttributes<HTMLDivElement>>;
41
+ declare const Popper: React.ForwardRefExoticComponent<PopperProps & React.RefAttributes<HTMLDivElement>>;
65
42
  export default Popper;
package/README.md CHANGED
@@ -33,7 +33,7 @@ Our documentation features [a collection of example projects using Material UI]
33
33
  Read the [contributing guide](/CONTRIBUTING.md) to learn about our development process, how to propose bug fixes and improvements, and how to build and test your changes.
34
34
 
35
35
  Contributing to Material UI is about more than just issues and pull requests!
36
- There are many other ways to [support MUI](https://mui.com/material-ui/getting-started/faq/#mui-is-awesome-how-can-i-support-the-project) beyond contributing to the code base.
36
+ There are many other ways to [support Material UI](https://mui.com/material-ui/getting-started/faq/#mui-is-awesome-how-can-i-support-the-project) beyond contributing to the code base.
37
37
 
38
38
  ## Changelog
39
39
 
@@ -41,7 +41,7 @@ The [changelog](https://github.com/mui/material-ui/releases) is regularly update
41
41
 
42
42
  ## Roadmap
43
43
 
44
- Future plans and high-priority features and enhancements can be found in our [roadmap](https://mui.com/material-ui/discover-more/roadmap/).
44
+ Future plans and high-priority features and enhancements can be found in the [roadmap](https://mui.com/material-ui/discover-more/roadmap/).
45
45
 
46
46
  ## License
47
47
 
package/Rating/Rating.js CHANGED
@@ -11,7 +11,7 @@ import clamp from '@mui/utils/clamp';
11
11
  import visuallyHidden from '@mui/utils/visuallyHidden';
12
12
  import chainPropTypes from '@mui/utils/chainPropTypes';
13
13
  import composeClasses from '@mui/utils/composeClasses';
14
- import useTheme from '../styles/useTheme';
14
+ import { useRtl } from '@mui/system/RtlProvider';
15
15
  import { capitalize, useForkRef, useIsFocusVisible, useControlled, unstable_useId as useId } from '../utils';
16
16
  import Star from '../internal/svg-icons/Star';
17
17
  import StarBorder from '../internal/svg-icons/StarBorder';
@@ -300,7 +300,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
300
300
  name: 'Rating'
301
301
  });
302
302
  const valueRounded = roundValueToPrecision(valueDerived, precision);
303
- const theme = useTheme();
303
+ const isRtl = useRtl();
304
304
  const [{
305
305
  hover,
306
306
  focus
@@ -335,7 +335,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
335
335
  width: containerWidth
336
336
  } = rootNode.getBoundingClientRect();
337
337
  let percent;
338
- if (theme.direction === 'rtl') {
338
+ if (isRtl) {
339
339
  percent = (right - event.clientX) / containerWidth;
340
340
  } else {
341
341
  percent = (event.clientX - left) / containerWidth;
@@ -148,7 +148,7 @@ export interface BaseSelectProps<Value = unknown>
148
148
  * The variant to use.
149
149
  * @default 'outlined'
150
150
  */
151
- variant?: 'filled' | 'standard' | 'outlined';
151
+ variant?: SelectVariants;
152
152
  }
153
153
 
154
154
  export interface FilledSelectProps extends Omit<FilledInputProps, 'value' | 'onChange'> {
@@ -172,20 +172,15 @@ export interface OutlinedSelectProps extends Omit<OutlinedInputProps, 'value' |
172
172
  * The variant to use.
173
173
  * @default 'outlined'
174
174
  */
175
- variant: 'outlined';
175
+ variant?: 'outlined';
176
176
  }
177
177
 
178
178
  export type SelectVariants = 'outlined' | 'standard' | 'filled';
179
179
 
180
- export type SelectProps<
181
- Value = unknown,
182
- Variant extends SelectVariants = SelectVariants,
183
- > = BaseSelectProps<Value> &
184
- (Variant extends 'filled'
185
- ? FilledSelectProps
186
- : Variant extends 'standard'
187
- ? StandardSelectProps
188
- : OutlinedSelectProps);
180
+ export type SelectProps<Value = unknown> =
181
+ | (FilledSelectProps & BaseSelectProps<Value>)
182
+ | (StandardSelectProps & BaseSelectProps<Value>)
183
+ | (OutlinedSelectProps & BaseSelectProps<Value>);
189
184
 
190
185
  /**
191
186
  *
@@ -198,15 +193,8 @@ export type SelectProps<
198
193
  * - [Select API](https://mui.com/material-ui/api/select/)
199
194
  * - inherits [OutlinedInput API](https://mui.com/material-ui/api/outlined-input/)
200
195
  */
201
-
202
- export default function Select<Value = unknown, Variant extends SelectVariants = 'outlined'>(
203
- props: {
204
- /**
205
- * The variant to use.
206
- * @default 'outlined'
207
- */
208
- variant?: Variant;
209
- } & Omit<SelectProps<Value, Variant>, 'variant'>,
196
+ export default function Select<Value = unknown>(
197
+ props: SelectProps<Value>,
210
198
  ): JSX.Element & {
211
199
  muiName: string;
212
200
  };