@mui/material 5.16.7 → 5.16.9

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 (129) hide show
  1. package/AccordionActions/AccordionActions.d.ts +1 -1
  2. package/AccordionDetails/AccordionDetails.d.ts +1 -1
  3. package/Alert/Alert.d.ts +1 -1
  4. package/AlertTitle/AlertTitle.d.ts +1 -1
  5. package/Autocomplete/Autocomplete.d.ts +1 -1
  6. package/AvatarGroup/AvatarGroup.d.ts +1 -1
  7. package/Button/Button.d.ts +1 -1
  8. package/ButtonBase/ButtonBase.d.ts +1 -1
  9. package/CHANGELOG.md +65 -0
  10. package/CardActions/CardActions.d.ts +1 -1
  11. package/CardHeader/CardHeader.d.ts +1 -1
  12. package/Checkbox/Checkbox.d.ts +1 -1
  13. package/Chip/Chip.d.ts +3 -3
  14. package/CircularProgress/CircularProgress.d.ts +1 -1
  15. package/ClickAwayListener/ClickAwayListener.js +2 -3
  16. package/Collapse/Collapse.d.ts +1 -1
  17. package/CssBaseline/CssBaseline.d.ts +1 -1
  18. package/Dialog/Dialog.d.ts +1 -1
  19. package/DialogActions/DialogActions.d.ts +1 -1
  20. package/DialogContent/DialogContent.d.ts +1 -1
  21. package/Drawer/Drawer.d.ts +1 -1
  22. package/Fade/Fade.d.ts +1 -1
  23. package/Fade/Fade.js +2 -1
  24. package/FilledInput/FilledInput.d.ts +1 -1
  25. package/FormControlLabel/FormControlLabel.d.ts +1 -1
  26. package/FormGroup/FormGroup.d.ts +1 -1
  27. package/GlobalStyles/GlobalStyles.d.ts +1 -1
  28. package/Grow/Grow.d.ts +1 -1
  29. package/Grow/Grow.js +2 -1
  30. package/ImageListItemBar/ImageListItemBar.d.ts +1 -1
  31. package/Input/Input.d.ts +1 -1
  32. package/InputBase/InputBase.d.ts +1 -1
  33. package/LinearProgress/LinearProgress.d.ts +1 -1
  34. package/ListItemAvatar/ListItemAvatar.d.ts +1 -1
  35. package/ListItemIcon/ListItemIcon.d.ts +1 -1
  36. package/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +3 -1
  37. package/ListItemText/ListItemText.d.ts +3 -1
  38. package/Menu/Menu.d.ts +1 -1
  39. package/MobileStepper/MobileStepper.d.ts +1 -1
  40. package/Modal/Modal.d.ts +1 -1
  41. package/NativeSelect/NativeSelect.d.ts +1 -1
  42. package/OutlinedInput/OutlinedInput.d.ts +3 -1
  43. package/OverridableComponent.d.ts +2 -2
  44. package/Pagination/Pagination.d.ts +1 -1
  45. package/Popover/Popover.d.ts +1 -1
  46. package/Portal/Portal.js +2 -3
  47. package/README.md +5 -5
  48. package/Radio/Radio.d.ts +1 -1
  49. package/RadioGroup/RadioGroup.d.ts +1 -1
  50. package/Rating/Rating.d.ts +1 -1
  51. package/Select/Select.d.ts +1 -1
  52. package/Select/Select.js +2 -1
  53. package/Slide/Slide.d.ts +1 -1
  54. package/Slide/Slide.js +2 -1
  55. package/Slider/Slider.d.ts +1 -1
  56. package/Slider/SliderValueLabel.types.d.ts +1 -1
  57. package/Slider/useSlider.js +3 -3
  58. package/Snackbar/Snackbar.d.ts +1 -1
  59. package/SnackbarContent/SnackbarContent.d.ts +1 -1
  60. package/SpeedDial/SpeedDial.d.ts +1 -1
  61. package/SpeedDialAction/SpeedDialAction.d.ts +1 -1
  62. package/SpeedDialIcon/SpeedDialIcon.d.ts +3 -1
  63. package/StepConnector/StepConnector.d.ts +2 -2
  64. package/StepContent/StepContent.d.ts +1 -1
  65. package/StepIcon/StepIcon.d.ts +1 -1
  66. package/StepLabel/StepLabel.d.ts +3 -1
  67. package/Switch/Switch.d.ts +1 -1
  68. package/Tab/Tab.d.ts +1 -1
  69. package/TabScrollButton/TabScrollButton.d.ts +1 -1
  70. package/TableCell/TableCell.d.ts +1 -1
  71. package/Tabs/ScrollbarSize.js +3 -2
  72. package/TextField/TextField.d.ts +1 -1
  73. package/ToggleButtonGroup/ToggleButtonGroup.d.ts +1 -1
  74. package/Tooltip/Tooltip.d.ts +1 -1
  75. package/Tooltip/Tooltip.js +2 -1
  76. package/Unstable_TrapFocus/FocusTrap.js +2 -3
  77. package/Zoom/Zoom.d.ts +1 -1
  78. package/Zoom/Zoom.js +2 -1
  79. package/index.js +1 -1
  80. package/legacy/ClickAwayListener/ClickAwayListener.js +2 -3
  81. package/legacy/Fade/Fade.js +2 -1
  82. package/legacy/Grow/Grow.js +2 -1
  83. package/legacy/Portal/Portal.js +3 -3
  84. package/legacy/Select/Select.js +2 -1
  85. package/legacy/Slide/Slide.js +2 -1
  86. package/legacy/Slider/useSlider.js +3 -3
  87. package/legacy/Tabs/ScrollbarSize.js +3 -2
  88. package/legacy/Tooltip/Tooltip.js +2 -1
  89. package/legacy/Unstable_TrapFocus/FocusTrap.js +2 -3
  90. package/legacy/Zoom/Zoom.js +2 -1
  91. package/legacy/index.js +1 -1
  92. package/legacy/useAutocomplete/useAutocomplete.js +2 -1
  93. package/legacy/version/index.js +2 -2
  94. package/modern/ClickAwayListener/ClickAwayListener.js +2 -3
  95. package/modern/Fade/Fade.js +2 -1
  96. package/modern/Grow/Grow.js +2 -1
  97. package/modern/Portal/Portal.js +2 -3
  98. package/modern/Select/Select.js +2 -1
  99. package/modern/Slide/Slide.js +2 -1
  100. package/modern/Slider/useSlider.js +3 -3
  101. package/modern/Tabs/ScrollbarSize.js +3 -2
  102. package/modern/Tooltip/Tooltip.js +2 -1
  103. package/modern/Unstable_TrapFocus/FocusTrap.js +2 -3
  104. package/modern/Zoom/Zoom.js +2 -1
  105. package/modern/index.js +1 -1
  106. package/modern/useAutocomplete/useAutocomplete.js +2 -1
  107. package/modern/version/index.js +2 -2
  108. package/node/ClickAwayListener/ClickAwayListener.js +2 -3
  109. package/node/Fade/Fade.js +2 -1
  110. package/node/Grow/Grow.js +2 -1
  111. package/node/Portal/Portal.js +1 -2
  112. package/node/Select/Select.js +2 -1
  113. package/node/Slide/Slide.js +2 -1
  114. package/node/Slider/useSlider.js +3 -3
  115. package/node/Tabs/ScrollbarSize.js +3 -2
  116. package/node/Tooltip/Tooltip.js +2 -1
  117. package/node/Unstable_TrapFocus/FocusTrap.js +1 -2
  118. package/node/Zoom/Zoom.js +2 -1
  119. package/node/index.js +1 -1
  120. package/node/useAutocomplete/useAutocomplete.js +2 -1
  121. package/node/version/index.js +2 -2
  122. package/package.json +8 -8
  123. package/styles/CssVarsProvider.d.ts +1 -1
  124. package/types/OverridableComponentAugmentation.d.ts +2 -2
  125. package/umd/material-ui.development.js +43 -24
  126. package/umd/material-ui.production.min.js +4 -4
  127. package/useAutocomplete/useAutocomplete.d.ts +1 -1
  128. package/useAutocomplete/useAutocomplete.js +2 -1
  129. package/version/index.js +2 -2
@@ -281,7 +281,7 @@ export interface SliderTypeMap<
281
281
  }
282
282
 
283
283
  export interface SliderValueLabelProps extends React.HTMLAttributes<HTMLSpanElement> {
284
- children: React.ReactElement;
284
+ children: React.ReactElement<any>;
285
285
  index: number;
286
286
  open: boolean;
287
287
  value: number;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  export interface SliderValueLabelProps {
3
- children?: React.ReactElement;
3
+ children?: React.ReactElement<any>;
4
4
  className?: string;
5
5
  style?: React.CSSProperties;
6
6
  /**
@@ -181,7 +181,7 @@ export function useSlider(parameters) {
181
181
  tabIndex,
182
182
  value: valueProp
183
183
  } = parameters;
184
- const touchId = React.useRef();
184
+ const touchId = React.useRef(undefined);
185
185
  // We can't use the :active browser pseudo-classes.
186
186
  // - The active state isn't triggered when clicking on the rail.
187
187
  // - The active state isn't transferred when inversing a range slider.
@@ -225,7 +225,7 @@ export function useSlider(parameters) {
225
225
  ref: focusVisibleRef
226
226
  } = useIsFocusVisible();
227
227
  const [focusedThumbIndex, setFocusedThumbIndex] = React.useState(-1);
228
- const sliderRef = React.useRef();
228
+ const sliderRef = React.useRef(null);
229
229
  const handleFocusRef = useForkRef(focusVisibleRef, sliderRef);
230
230
  const handleRef = useForkRef(ref, handleFocusRef);
231
231
  const createHandleHiddenInputFocus = otherHandlers => event => {
@@ -336,7 +336,7 @@ export function useSlider(parameters) {
336
336
  // @ts-ignore
337
337
  changeValue(event, event.target.valueAsNumber);
338
338
  };
339
- const previousIndex = React.useRef();
339
+ const previousIndex = React.useRef(undefined);
340
340
  let axis = orientation;
341
341
  if (isRtl && orientation === 'horizontal') {
342
342
  axis += '-reverse';
@@ -127,4 +127,4 @@ export interface SnackbarProps extends StandardProps<React.HTMLAttributes<HTMLDi
127
127
  *
128
128
  * - [Snackbar API](https://mui.com/material-ui/api/snackbar/)
129
129
  */
130
- export default function Snackbar(props: SnackbarProps): JSX.Element;
130
+ export default function Snackbar(props: SnackbarProps): React.JSX.Element;
@@ -40,4 +40,4 @@ export interface SnackbarContentProps extends StandardProps<PaperProps, 'childre
40
40
  * - [SnackbarContent API](https://mui.com/material-ui/api/snackbar-content/)
41
41
  * - inherits [Paper API](https://mui.com/material-ui/api/paper/)
42
42
  */
43
- export default function SnackbarContent(props: SnackbarContentProps): JSX.Element;
43
+ export default function SnackbarContent(props: SnackbarContentProps): React.JSX.Element;
@@ -102,4 +102,4 @@ export interface SpeedDialProps
102
102
  *
103
103
  * - [SpeedDial API](https://mui.com/material-ui/api/speed-dial/)
104
104
  */
105
- export default function SpeedDial(props: SpeedDialProps): JSX.Element;
105
+ export default function SpeedDial(props: SpeedDialProps): React.JSX.Element;
@@ -60,4 +60,4 @@ export interface SpeedDialActionProps extends StandardProps<Partial<TooltipProps
60
60
  * - [SpeedDialAction API](https://mui.com/material-ui/api/speed-dial-action/)
61
61
  * - inherits [Tooltip API](https://mui.com/material-ui/api/tooltip/)
62
62
  */
63
- export default function SpeedDialAction(props: SpeedDialActionProps): JSX.Element;
63
+ export default function SpeedDialAction(props: SpeedDialActionProps): React.JSX.Element;
@@ -39,6 +39,8 @@ export interface SpeedDialIconProps
39
39
  *
40
40
  * - [SpeedDialIcon API](https://mui.com/material-ui/api/speed-dial-icon/)
41
41
  */
42
- declare const SpeedDialIcon: ((props: SpeedDialIconProps) => JSX.Element) & { muiName: string };
42
+ declare const SpeedDialIcon: ((props: SpeedDialIconProps) => React.JSX.Element) & {
43
+ muiName: string;
44
+ };
43
45
 
44
46
  export default SpeedDialIcon;
@@ -4,7 +4,7 @@ import { InternalStandardProps as StandardProps } from '..';
4
4
  import { Theme } from '../styles';
5
5
  import { StepConnectorClasses } from './stepConnectorClasses';
6
6
 
7
- export type StepConnectorIcon = React.ReactElement | string | number;
7
+ export type StepConnectorIcon = React.ReactElement<any> | string | number;
8
8
 
9
9
  export interface StepConnectorProps
10
10
  extends StandardProps<React.HTMLAttributes<HTMLDivElement>, 'children'> {
@@ -30,4 +30,4 @@ export type StepConnectorClasskey = keyof NonNullable<StepConnectorProps['classe
30
30
  *
31
31
  * - [StepConnector API](https://mui.com/material-ui/api/step-connector/)
32
32
  */
33
- export default function StepConnector(props: StepConnectorProps): JSX.Element;
33
+ export default function StepConnector(props: StepConnectorProps): React.JSX.Element;
@@ -53,4 +53,4 @@ export type StepContentClasskey = keyof NonNullable<StepContentProps['classes']>
53
53
  *
54
54
  * - [StepContent API](https://mui.com/material-ui/api/step-content/)
55
55
  */
56
- export default function StepContent(props: StepContentProps): JSX.Element;
56
+ export default function StepContent(props: StepContentProps): React.JSX.Element;
@@ -47,4 +47,4 @@ export type StepIconClasskey = keyof NonNullable<StepIconProps['classes']>;
47
47
  *
48
48
  * - [StepIcon API](https://mui.com/material-ui/api/step-icon/)
49
49
  */
50
- export default function StepIcon(props: StepIconProps): JSX.Element;
50
+ export default function StepIcon(props: StepIconProps): React.JSX.Element;
@@ -75,6 +75,8 @@ export type StepLabelClasskey = keyof NonNullable<StepLabelProps['classes']>;
75
75
  *
76
76
  * - [StepLabel API](https://mui.com/material-ui/api/step-label/)
77
77
  */
78
- declare const StepLabel: ((props: StepLabelProps) => JSX.Element) & { muiName: string };
78
+ declare const StepLabel: ((props: StepLabelProps) => React.JSX.Element) & {
79
+ muiName: string;
80
+ };
79
81
 
80
82
  export default StepLabel;
@@ -66,4 +66,4 @@ export interface SwitchProps
66
66
  * - [Switch API](https://mui.com/material-ui/api/switch/)
67
67
  * - inherits [IconButton API](https://mui.com/material-ui/api/icon-button/)
68
68
  */
69
- export default function Switch(props: SwitchProps): JSX.Element;
69
+ export default function Switch(props: SwitchProps): React.JSX.Element;
package/Tab/Tab.d.ts CHANGED
@@ -28,7 +28,7 @@ export interface TabOwnProps {
28
28
  /**
29
29
  * The icon to display.
30
30
  */
31
- icon?: string | React.ReactElement;
31
+ icon?: string | React.ReactElement<any>;
32
32
  /**
33
33
  * The position of the icon relative to the label.
34
34
  * @default 'top'
@@ -75,4 +75,4 @@ export interface TabScrollButtonProps extends ButtonBaseProps {
75
75
  *
76
76
  * - [TabScrollButton API](https://mui.com/material-ui/api/tab-scroll-button/)
77
77
  */
78
- export default function TabScrollButton(props: TabScrollButtonProps): JSX.Element;
78
+ export default function TabScrollButton(props: TabScrollButtonProps): React.JSX.Element;
@@ -83,4 +83,4 @@ export type SortDirection = 'asc' | 'desc' | false;
83
83
  *
84
84
  * - [TableCell API](https://mui.com/material-ui/api/table-cell/)
85
85
  */
86
- export default function TableCell(props: TableCellProps): JSX.Element;
86
+ export default function TableCell(props: TableCellProps): React.JSX.Element;
@@ -51,9 +51,10 @@ export default function ScrollbarSize(props) {
51
51
  onChange(scrollbarHeight.current);
52
52
  }, [onChange]);
53
53
  return /*#__PURE__*/_jsx("div", _extends({
54
- style: styles,
54
+ style: styles
55
+ }, other, {
55
56
  ref: nodeRef
56
- }, other));
57
+ }));
57
58
  }
58
59
  process.env.NODE_ENV !== "production" ? ScrollbarSize.propTypes = {
59
60
  onChange: PropTypes.func.isRequired
@@ -285,4 +285,4 @@ export default function TextField<Variant extends TextFieldVariants>(
285
285
  */
286
286
  variant?: Variant;
287
287
  } & Omit<TextFieldProps, 'variant'>,
288
- ): JSX.Element;
288
+ ): React.JSX.Element;
@@ -86,4 +86,4 @@ export interface ToggleButtonGroupProps
86
86
  *
87
87
  * - [ToggleButtonGroup API](https://mui.com/material-ui/api/toggle-button-group/)
88
88
  */
89
- export default function ToggleButtonGroup(props: ToggleButtonGroupProps): JSX.Element;
89
+ export default function ToggleButtonGroup(props: ToggleButtonGroupProps): React.JSX.Element;
@@ -225,4 +225,4 @@ export interface TooltipProps extends StandardProps<React.HTMLAttributes<HTMLDiv
225
225
  *
226
226
  * - [Tooltip API](https://mui.com/material-ui/api/tooltip/)
227
227
  */
228
- export default function Tooltip(props: TooltipProps): JSX.Element;
228
+ export default function Tooltip(props: TooltipProps): React.JSX.Element;
@@ -12,6 +12,7 @@ import composeClasses from '@mui/utils/composeClasses';
12
12
  import { alpha } from '@mui/system/colorManipulator';
13
13
  import { useRtl } from '@mui/system/RtlProvider';
14
14
  import appendOwnerState from '@mui/utils/appendOwnerState';
15
+ import getReactElementRef from '@mui/utils/getReactElementRef';
15
16
  import { styled, useTheme } from '../styles';
16
17
  import { useDefaultProps } from '../DefaultPropsProvider';
17
18
  import capitalize from '../utils/capitalize';
@@ -428,7 +429,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
428
429
  document.removeEventListener('keydown', handleKeyDown);
429
430
  };
430
431
  }, [handleClose, open]);
431
- const handleRef = useForkRef(children.ref, focusVisibleRef, setChildNode, ref);
432
+ const handleRef = useForkRef(getReactElementRef(children), focusVisibleRef, setChildNode, ref);
432
433
 
433
434
  // There is no point in displaying an empty tooltip.
434
435
  // So we exclude all falsy values, except 0, which is valid.
@@ -3,7 +3,7 @@
3
3
  /* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex */
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { exactProp, elementAcceptingRef, unstable_useForkRef as useForkRef, unstable_ownerDocument as ownerDocument } from '@mui/utils';
6
+ import { exactProp, elementAcceptingRef, unstable_useForkRef as useForkRef, unstable_ownerDocument as ownerDocument, unstable_getReactElementRef as getReactElementRef } from '@mui/utils';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
9
  // Inspired by https://github.com/focus-trap/tabbable
@@ -93,8 +93,7 @@ function FocusTrap(props) {
93
93
  // It waits for the active element to move into the component to activate.
94
94
  const activated = React.useRef(false);
95
95
  const rootRef = React.useRef(null);
96
- // @ts-expect-error TODO upstream fix
97
- const handleRef = useForkRef(children.ref, rootRef);
96
+ const handleRef = useForkRef(getReactElementRef(children), rootRef);
98
97
  const lastKeydown = React.useRef(null);
99
98
  React.useEffect(() => {
100
99
  // We might render an empty child.
package/Zoom/Zoom.d.ts CHANGED
@@ -47,4 +47,4 @@ export interface ZoomProps extends TransitionProps {
47
47
  * - [Zoom API](https://mui.com/material-ui/api/zoom/)
48
48
  * - inherits [Transition API](https://reactcommunity.org/react-transition-group/transition/#Transition-props)
49
49
  */
50
- export default function Zoom(props: ZoomProps): JSX.Element;
50
+ export default function Zoom(props: ZoomProps): React.JSX.Element;
package/Zoom/Zoom.js CHANGED
@@ -7,6 +7,7 @@ import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { Transition } from 'react-transition-group';
9
9
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
10
+ import getReactElementRef from '@mui/utils/getReactElementRef';
10
11
  import useTheme from '../styles/useTheme';
11
12
  import { reflow, getTransitionProps } from '../transitions/utils';
12
13
  import useForkRef from '../utils/useForkRef';
@@ -50,7 +51,7 @@ const Zoom = /*#__PURE__*/React.forwardRef(function Zoom(props, ref) {
50
51
  } = props,
51
52
  other = _objectWithoutPropertiesLoose(props, _excluded);
52
53
  const nodeRef = React.useRef(null);
53
- const handleRef = useForkRef(nodeRef, children.ref, ref);
54
+ const handleRef = useForkRef(nodeRef, getReactElementRef(children), ref);
54
55
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
55
56
  if (callback) {
56
57
  const node = nodeRef.current;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.16.7
2
+ * @mui/material v5.16.9
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { elementAcceptingRef, exactProp, unstable_ownerDocument as ownerDocument, unstable_useForkRef as useForkRef, unstable_useEventCallback as useEventCallback } from '@mui/utils';
6
+ import getReactElementRef from '@mui/utils/getReactElementRef';
6
7
 
7
8
  // TODO: return `EventHandlerName extends `on${infer EventName}` ? Lowercase<EventName> : never` once generatePropTypes runs with TS 4.1
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -48,9 +49,7 @@ function ClickAwayListener(props) {
48
49
  activatedRef.current = false;
49
50
  };
50
51
  }, []);
51
- var handleRef = useForkRef(
52
- // @ts-expect-error TODO upstream fix
53
- children.ref, nodeRef);
52
+ var handleRef = useForkRef(getReactElementRef(children), nodeRef);
54
53
 
55
54
  // The handler doesn't take event.defaultPrevented into account:
56
55
  //
@@ -6,6 +6,7 @@ import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { Transition } from 'react-transition-group';
8
8
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
9
+ import getReactElementRef from '@mui/utils/getReactElementRef';
9
10
  import useTheme from '../styles/useTheme';
10
11
  import { reflow, getTransitionProps } from '../transitions/utils';
11
12
  import useForkRef from '../utils/useForkRef';
@@ -49,7 +50,7 @@ var Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
49
50
  other = _objectWithoutProperties(props, ["addEndListener", "appear", "children", "easing", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "style", "timeout", "TransitionComponent"]);
50
51
  var enableStrictModeCompat = true;
51
52
  var nodeRef = React.useRef(null);
52
- var handleRef = useForkRef(nodeRef, _children.ref, ref);
53
+ var handleRef = useForkRef(nodeRef, getReactElementRef(_children), ref);
53
54
  var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
54
55
  return function (maybeIsAppearing) {
55
56
  if (callback) {
@@ -6,6 +6,7 @@ import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import useTimeout from '@mui/utils/useTimeout';
8
8
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
9
+ import getReactElementRef from '@mui/utils/getReactElementRef';
9
10
  import { Transition } from 'react-transition-group';
10
11
  import useTheme from '../styles/useTheme';
11
12
  import { getTransitionProps, reflow } from '../transitions/utils';
@@ -59,7 +60,7 @@ var Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
59
60
  var autoTimeout = React.useRef();
60
61
  var theme = useTheme();
61
62
  var nodeRef = React.useRef(null);
62
- var handleRef = useForkRef(nodeRef, _children.ref, ref);
63
+ var handleRef = useForkRef(nodeRef, getReactElementRef(_children), ref);
63
64
  var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
64
65
  return function (maybeIsAppearing) {
65
66
  if (callback) {
@@ -3,7 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import * as ReactDOM from 'react-dom';
5
5
  import PropTypes from 'prop-types';
6
- import { exactProp, HTMLElementType, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useForkRef as useForkRef, unstable_setRef as setRef } from '@mui/utils';
6
+ import { exactProp, HTMLElementType, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useForkRef as useForkRef, unstable_setRef as setRef, unstable_getReactElementRef as getReactElementRef } from '@mui/utils';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  function getContainer(container) {
9
9
  return typeof container === 'function' ? container() : container;
@@ -28,8 +28,8 @@ var Portal = /*#__PURE__*/React.forwardRef(function Portal(props, forwardedRef)
28
28
  disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal;
29
29
  var _React$useState = React.useState(null),
30
30
  mountNode = _React$useState[0],
31
- setMountNode = _React$useState[1]; // @ts-expect-error TODO upstream fix
32
- var handleRef = useForkRef( /*#__PURE__*/React.isValidElement(children) ? children.ref : null, forwardedRef);
31
+ setMountNode = _React$useState[1];
32
+ var handleRef = useForkRef( /*#__PURE__*/React.isValidElement(children) ? getReactElementRef(children) : null, forwardedRef);
33
33
  useEnhancedEffect(function () {
34
34
  if (!disablePortal) {
35
35
  setMountNode(getContainer(container) || document.body);
@@ -6,6 +6,7 @@ import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import clsx from 'clsx';
8
8
  import deepmerge from '@mui/utils/deepmerge';
9
+ import getReactElementRef from '@mui/utils/getReactElementRef';
9
10
  import SelectInput from './SelectInput';
10
11
  import formControlState from '../FormControl/formControlState';
11
12
  import useFormControl from '../FormControl/useFormControl';
@@ -97,7 +98,7 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
97
98
  ownerState: ownerState
98
99
  })
99
100
  }[variant];
100
- var inputComponentRef = useForkRef(ref, InputComponent.ref);
101
+ var inputComponentRef = useForkRef(ref, getReactElementRef(InputComponent));
101
102
  return /*#__PURE__*/_jsx(React.Fragment, {
102
103
  children: /*#__PURE__*/React.cloneElement(InputComponent, _extends({
103
104
  // Most of the logic is implemented in `SelectInput`.
@@ -8,6 +8,7 @@ import { Transition } from 'react-transition-group';
8
8
  import chainPropTypes from '@mui/utils/chainPropTypes';
9
9
  import HTMLElementType from '@mui/utils/HTMLElementType';
10
10
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
11
+ import getReactElementRef from '@mui/utils/getReactElementRef';
11
12
  import debounce from '../utils/debounce';
12
13
  import useForkRef from '../utils/useForkRef';
13
14
  import useTheme from '../styles/useTheme';
@@ -109,7 +110,7 @@ var Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
109
110
  TransitionComponent = _props$TransitionComp === void 0 ? Transition : _props$TransitionComp,
110
111
  other = _objectWithoutProperties(props, ["addEndListener", "appear", "children", "container", "direction", "easing", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "style", "timeout", "TransitionComponent"]);
111
112
  var childrenRef = React.useRef(null);
112
- var handleRef = useForkRef(_children.ref, childrenRef, ref);
113
+ var handleRef = useForkRef(getReactElementRef(_children), childrenRef, ref);
113
114
  var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
114
115
  return function (isAppearing) {
115
116
  if (callback) {
@@ -203,7 +203,7 @@ export function useSlider(parameters) {
203
203
  shiftStep = _parameters$shiftStep === void 0 ? 10 : _parameters$shiftStep,
204
204
  tabIndex = parameters.tabIndex,
205
205
  valueProp = parameters.value;
206
- var touchId = React.useRef();
206
+ var touchId = React.useRef(undefined);
207
207
  // We can't use the :active browser pseudo-classes.
208
208
  // - The active state isn't triggered when clicking on the rail.
209
209
  // - The active state isn't transferred when inversing a range slider.
@@ -263,7 +263,7 @@ export function useSlider(parameters) {
263
263
  var _React$useState4 = React.useState(-1),
264
264
  focusedThumbIndex = _React$useState4[0],
265
265
  setFocusedThumbIndex = _React$useState4[1];
266
- var sliderRef = React.useRef();
266
+ var sliderRef = React.useRef(null);
267
267
  var handleFocusRef = useForkRef(focusVisibleRef, sliderRef);
268
268
  var handleRef = useForkRef(ref, handleFocusRef);
269
269
  var createHandleHiddenInputFocus = function createHandleHiddenInputFocus(otherHandlers) {
@@ -382,7 +382,7 @@ export function useSlider(parameters) {
382
382
  changeValue(event, event.target.valueAsNumber);
383
383
  };
384
384
  };
385
- var previousIndex = React.useRef();
385
+ var previousIndex = React.useRef(undefined);
386
386
  var axis = orientation;
387
387
  if (isRtl && orientation === 'horizontal') {
388
388
  axis += '-reverse';
@@ -48,9 +48,10 @@ export default function ScrollbarSize(props) {
48
48
  onChange(scrollbarHeight.current);
49
49
  }, [onChange]);
50
50
  return /*#__PURE__*/_jsx("div", _extends({
51
- style: styles,
51
+ style: styles
52
+ }, other, {
52
53
  ref: nodeRef
53
- }, other));
54
+ }));
54
55
  }
55
56
  process.env.NODE_ENV !== "production" ? ScrollbarSize.propTypes = {
56
57
  onChange: PropTypes.func.isRequired
@@ -13,6 +13,7 @@ import composeClasses from '@mui/utils/composeClasses';
13
13
  import { alpha } from '@mui/system/colorManipulator';
14
14
  import { useRtl } from '@mui/system/RtlProvider';
15
15
  import appendOwnerState from '@mui/utils/appendOwnerState';
16
+ import getReactElementRef from '@mui/utils/getReactElementRef';
16
17
  import { styled, useTheme } from '../styles';
17
18
  import { useDefaultProps } from '../DefaultPropsProvider';
18
19
  import capitalize from '../utils/capitalize';
@@ -442,7 +443,7 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
442
443
  document.removeEventListener('keydown', handleKeyDown);
443
444
  };
444
445
  }, [handleClose, open]);
445
- var handleRef = useForkRef(children.ref, focusVisibleRef, setChildNode, ref);
446
+ var handleRef = useForkRef(getReactElementRef(children), focusVisibleRef, setChildNode, ref);
446
447
 
447
448
  // There is no point in displaying an empty tooltip.
448
449
  // So we exclude all falsy values, except 0, which is valid.
@@ -3,7 +3,7 @@
3
3
  /* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex */
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import { exactProp, elementAcceptingRef, unstable_useForkRef as useForkRef, unstable_ownerDocument as ownerDocument } from '@mui/utils';
6
+ import { exactProp, elementAcceptingRef, unstable_useForkRef as useForkRef, unstable_ownerDocument as ownerDocument, unstable_getReactElementRef as getReactElementRef } from '@mui/utils';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
9
  // Inspired by https://github.com/focus-trap/tabbable
@@ -102,8 +102,7 @@ function FocusTrap(props) {
102
102
  // It waits for the active element to move into the component to activate.
103
103
  var activated = React.useRef(false);
104
104
  var rootRef = React.useRef(null);
105
- // @ts-expect-error TODO upstream fix
106
- var handleRef = useForkRef(children.ref, rootRef);
105
+ var handleRef = useForkRef(getReactElementRef(children), rootRef);
107
106
  var lastKeydown = React.useRef(null);
108
107
  React.useEffect(function () {
109
108
  // We might render an empty child.
@@ -6,6 +6,7 @@ import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { Transition } from 'react-transition-group';
8
8
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
9
+ import getReactElementRef from '@mui/utils/getReactElementRef';
9
10
  import useTheme from '../styles/useTheme';
10
11
  import { reflow, getTransitionProps } from '../transitions/utils';
11
12
  import useForkRef from '../utils/useForkRef';
@@ -49,7 +50,7 @@ var Zoom = /*#__PURE__*/React.forwardRef(function Zoom(props, ref) {
49
50
  TransitionComponent = _props$TransitionComp === void 0 ? Transition : _props$TransitionComp,
50
51
  other = _objectWithoutProperties(props, ["addEndListener", "appear", "children", "easing", "in", "onEnter", "onEntered", "onEntering", "onExit", "onExited", "onExiting", "style", "timeout", "TransitionComponent"]);
51
52
  var nodeRef = React.useRef(null);
52
- var handleRef = useForkRef(nodeRef, _children.ref, ref);
53
+ var handleRef = useForkRef(nodeRef, getReactElementRef(_children), ref);
53
54
  var normalizedTransitionCallback = function normalizedTransitionCallback(callback) {
54
55
  return function (maybeIsAppearing) {
55
56
  if (callback) {
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v5.16.7
2
+ * @mui/material v5.16.9
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -65,6 +65,7 @@ var defaultIsActiveElementInListbox = function defaultIsActiveElementInListbox(l
65
65
  var _listboxRef$current$p;
66
66
  return listboxRef.current !== null && ((_listboxRef$current$p = listboxRef.current.parentElement) == null ? void 0 : _listboxRef$current$p.contains(document.activeElement));
67
67
  };
68
+ var MULTIPLE_DEFAULT_VALUE = [];
68
69
  function useAutocomplete(props) {
69
70
  var _props$unstable_isAct = props.unstable_isActiveElementInListbox,
70
71
  unstable_isActiveElementInListbox = _props$unstable_isAct === void 0 ? defaultIsActiveElementInListbox : _props$unstable_isAct,
@@ -85,7 +86,7 @@ function useAutocomplete(props) {
85
86
  _props$componentName = props.componentName,
86
87
  componentName = _props$componentName === void 0 ? 'useAutocomplete' : _props$componentName,
87
88
  _props$defaultValue = props.defaultValue,
88
- defaultValue = _props$defaultValue === void 0 ? props.multiple ? [] : null : _props$defaultValue,
89
+ defaultValue = _props$defaultValue === void 0 ? props.multiple ? MULTIPLE_DEFAULT_VALUE : null : _props$defaultValue,
89
90
  _props$disableClearab = props.disableClearable,
90
91
  disableClearable = _props$disableClearab === void 0 ? false : _props$disableClearab,
91
92
  _props$disableCloseOn = props.disableCloseOnSelect,
@@ -1,7 +1,7 @@
1
- export var version = "5.16.7";
1
+ export var version = "5.16.9";
2
2
  export var major = Number("5");
3
3
  export var minor = Number("16");
4
- export var patch = Number("7");
4
+ export var patch = Number("9");
5
5
  export var preReleaseLabel = undefined || null;
6
6
  export var preReleaseNumber = Number(undefined) || null;
7
7
  export default version;
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { elementAcceptingRef, exactProp, unstable_ownerDocument as ownerDocument, unstable_useForkRef as useForkRef, unstable_useEventCallback as useEventCallback } from '@mui/utils';
6
+ import getReactElementRef from '@mui/utils/getReactElementRef';
6
7
 
7
8
  // TODO: return `EventHandlerName extends `on${infer EventName}` ? Lowercase<EventName> : never` once generatePropTypes runs with TS 4.1
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -47,9 +48,7 @@ function ClickAwayListener(props) {
47
48
  activatedRef.current = false;
48
49
  };
49
50
  }, []);
50
- const handleRef = useForkRef(
51
- // @ts-expect-error TODO upstream fix
52
- children.ref, nodeRef);
51
+ const handleRef = useForkRef(getReactElementRef(children), nodeRef);
53
52
 
54
53
  // The handler doesn't take event.defaultPrevented into account:
55
54
  //
@@ -7,6 +7,7 @@ import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { Transition } from 'react-transition-group';
9
9
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
10
+ import getReactElementRef from '@mui/utils/getReactElementRef';
10
11
  import useTheme from '../styles/useTheme';
11
12
  import { reflow, getTransitionProps } from '../transitions/utils';
12
13
  import useForkRef from '../utils/useForkRef';
@@ -50,7 +51,7 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
50
51
  other = _objectWithoutPropertiesLoose(props, _excluded);
51
52
  const enableStrictModeCompat = true;
52
53
  const nodeRef = React.useRef(null);
53
- const handleRef = useForkRef(nodeRef, children.ref, ref);
54
+ const handleRef = useForkRef(nodeRef, getReactElementRef(children), ref);
54
55
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
55
56
  if (callback) {
56
57
  const node = nodeRef.current;
@@ -7,6 +7,7 @@ import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import useTimeout from '@mui/utils/useTimeout';
9
9
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
10
+ import getReactElementRef from '@mui/utils/getReactElementRef';
10
11
  import { Transition } from 'react-transition-group';
11
12
  import useTheme from '../styles/useTheme';
12
13
  import { getTransitionProps, reflow } from '../transitions/utils';
@@ -60,7 +61,7 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
60
61
  const autoTimeout = React.useRef();
61
62
  const theme = useTheme();
62
63
  const nodeRef = React.useRef(null);
63
- const handleRef = useForkRef(nodeRef, children.ref, ref);
64
+ const handleRef = useForkRef(nodeRef, getReactElementRef(children), ref);
64
65
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
65
66
  if (callback) {
66
67
  const node = nodeRef.current;
@@ -3,7 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import * as ReactDOM from 'react-dom';
5
5
  import PropTypes from 'prop-types';
6
- import { exactProp, HTMLElementType, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useForkRef as useForkRef, unstable_setRef as setRef } from '@mui/utils';
6
+ import { exactProp, HTMLElementType, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useForkRef as useForkRef, unstable_setRef as setRef, unstable_getReactElementRef as getReactElementRef } from '@mui/utils';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  function getContainer(container) {
9
9
  return typeof container === 'function' ? container() : container;
@@ -28,8 +28,7 @@ const Portal = /*#__PURE__*/React.forwardRef(function Portal(props, forwardedRef
28
28
  disablePortal = false
29
29
  } = props;
30
30
  const [mountNode, setMountNode] = React.useState(null);
31
- // @ts-expect-error TODO upstream fix
32
- const handleRef = useForkRef( /*#__PURE__*/React.isValidElement(children) ? children.ref : null, forwardedRef);
31
+ const handleRef = useForkRef( /*#__PURE__*/React.isValidElement(children) ? getReactElementRef(children) : null, forwardedRef);
33
32
  useEnhancedEffect(() => {
34
33
  if (!disablePortal) {
35
34
  setMountNode(getContainer(container) || document.body);
@@ -8,6 +8,7 @@ import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import clsx from 'clsx';
10
10
  import deepmerge from '@mui/utils/deepmerge';
11
+ import getReactElementRef from '@mui/utils/getReactElementRef';
11
12
  import SelectInput from './SelectInput';
12
13
  import formControlState from '../FormControl/formControlState';
13
14
  import useFormControl from '../FormControl/useFormControl';
@@ -90,7 +91,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
90
91
  ownerState: ownerState
91
92
  })
92
93
  }[variant];
93
- const inputComponentRef = useForkRef(ref, InputComponent.ref);
94
+ const inputComponentRef = useForkRef(ref, getReactElementRef(InputComponent));
94
95
  return /*#__PURE__*/_jsx(React.Fragment, {
95
96
  children: /*#__PURE__*/React.cloneElement(InputComponent, _extends({
96
97
  // Most of the logic is implemented in `SelectInput`.