@mui/material 6.0.0-beta.4 → 6.0.0-beta.4-dev.20240802-144226-85a3b55d22

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.
@@ -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 getReactNodeRef from '@mui/utils/getReactNodeRef';
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(getReactNodeRef(children), nodeRef);
53
52
 
54
53
  // The handler doesn't take event.defaultPrevented into account:
55
54
  //
package/Fade/Fade.js CHANGED
@@ -4,10 +4,10 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Transition } from 'react-transition-group';
6
6
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
7
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
7
8
  import { useTheme } from '../zero-styled';
8
9
  import { reflow, getTransitionProps } from '../transitions/utils';
9
10
  import useForkRef from '../utils/useForkRef';
10
- import getChildRef from '../utils/getChildRef';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const styles = {
13
13
  entering: {
@@ -48,7 +48,7 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
48
48
  } = props;
49
49
  const enableStrictModeCompat = true;
50
50
  const nodeRef = React.useRef(null);
51
- const handleRef = useForkRef(nodeRef, getChildRef(children), ref);
51
+ const handleRef = useForkRef(nodeRef, getReactNodeRef(children), ref);
52
52
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
53
53
  if (callback) {
54
54
  const node = nodeRef.current;
package/Grow/Grow.js CHANGED
@@ -4,11 +4,11 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import useTimeout from '@mui/utils/useTimeout';
6
6
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
7
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
7
8
  import { Transition } from 'react-transition-group';
8
9
  import { useTheme } from '../zero-styled';
9
10
  import { getTransitionProps, reflow } from '../transitions/utils';
10
11
  import useForkRef from '../utils/useForkRef';
11
- import getChildRef from '../utils/getChildRef';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  function getScale(value) {
14
14
  return `scale(${value}, ${value ** 2})`;
@@ -58,7 +58,7 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
58
58
  const autoTimeout = React.useRef();
59
59
  const theme = useTheme();
60
60
  const nodeRef = React.useRef(null);
61
- const handleRef = useForkRef(nodeRef, getChildRef(children), ref);
61
+ const handleRef = useForkRef(nodeRef, getReactNodeRef(children), ref);
62
62
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
63
63
  if (callback) {
64
64
  const node = nodeRef.current;
package/Portal/Portal.js CHANGED
@@ -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_getReactNodeRef as getReactNodeRef } 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(getReactNodeRef(children), forwardedRef);
33
32
  useEnhancedEffect(() => {
34
33
  if (!disablePortal) {
35
34
  setMountNode(getContainer(container) || document.body);
package/Select/Select.js CHANGED
@@ -4,6 +4,7 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
6
  import deepmerge from '@mui/utils/deepmerge';
7
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
7
8
  import SelectInput from './SelectInput';
8
9
  import formControlState from '../FormControl/formControlState';
9
10
  import useFormControl from '../FormControl/useFormControl';
@@ -91,7 +92,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
91
92
  ownerState: ownerState
92
93
  })
93
94
  }[variant];
94
- const inputComponentRef = useForkRef(ref, InputComponent.ref);
95
+ const inputComponentRef = useForkRef(ref, getReactNodeRef(InputComponent));
95
96
  return /*#__PURE__*/_jsx(React.Fragment, {
96
97
  children: /*#__PURE__*/React.cloneElement(InputComponent, {
97
98
  // Most of the logic is implemented in `SelectInput`.
package/Slide/Slide.js CHANGED
@@ -6,12 +6,12 @@ import { Transition } from 'react-transition-group';
6
6
  import chainPropTypes from '@mui/utils/chainPropTypes';
7
7
  import HTMLElementType from '@mui/utils/HTMLElementType';
8
8
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
9
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
9
10
  import debounce from '../utils/debounce';
10
11
  import useForkRef from '../utils/useForkRef';
11
12
  import { useTheme } from '../zero-styled';
12
13
  import { reflow, getTransitionProps } from '../transitions/utils';
13
14
  import { ownerWindow } from '../utils';
14
- import getChildRef from '../utils/getChildRef';
15
15
 
16
16
  // Translate the node so it can't be seen on the screen.
17
17
  // Later, we're going to translate the node back to its original location with `none`.
@@ -106,7 +106,7 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
106
106
  ...other
107
107
  } = props;
108
108
  const childrenRef = React.useRef(null);
109
- const handleRef = useForkRef(getChildRef(children), childrenRef, ref);
109
+ const handleRef = useForkRef(getReactNodeRef(children), childrenRef, ref);
110
110
  const normalizedTransitionCallback = callback => isAppearing => {
111
111
  if (callback) {
112
112
  // onEnterXxx and onExitXxx callbacks have a different arguments.length value.
@@ -10,6 +10,7 @@ import { alpha } from '@mui/system/colorManipulator';
10
10
  import { useRtl } from '@mui/system/RtlProvider';
11
11
  import isFocusVisible from '@mui/utils/isFocusVisible';
12
12
  import appendOwnerState from '@mui/utils/appendOwnerState';
13
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
13
14
  import { styled, useTheme } from '../zero-styled';
14
15
  import { useDefaultProps } from '../DefaultPropsProvider';
15
16
  import capitalize from '../utils/capitalize';
@@ -20,7 +21,6 @@ import useForkRef from '../utils/useForkRef';
20
21
  import useId from '../utils/useId';
21
22
  import useControlled from '../utils/useControlled';
22
23
  import tooltipClasses, { getTooltipUtilityClass } from './tooltipClasses';
23
- import getChildRef from '../utils/getChildRef';
24
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  function round(value) {
26
26
  return Math.round(value * 1e5) / 1e5;
@@ -511,7 +511,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
511
511
  document.removeEventListener('keydown', handleKeyDown);
512
512
  };
513
513
  }, [handleClose, open]);
514
- const handleRef = useForkRef(getChildRef(children), setChildNode, ref);
514
+ const handleRef = useForkRef(getReactNodeRef(children), setChildNode, ref);
515
515
 
516
516
  // There is no point in displaying an empty tooltip.
517
517
  // 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_getReactNodeRef as getReactNodeRef } from '@mui/utils';
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  // Inspired by https://github.com/focus-trap/tabbable
9
9
  const candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
@@ -92,8 +92,7 @@ function FocusTrap(props) {
92
92
  // It waits for the active element to move into the component to activate.
93
93
  const activated = React.useRef(false);
94
94
  const rootRef = React.useRef(null);
95
- // @ts-expect-error TODO upstream fix
96
- const handleRef = useForkRef(children.ref, rootRef);
95
+ const handleRef = useForkRef(getReactNodeRef(children), rootRef);
97
96
  const lastKeydown = React.useRef(null);
98
97
  React.useEffect(() => {
99
98
  // We might render an empty child.
package/Zoom/Zoom.js CHANGED
@@ -4,10 +4,10 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Transition } from 'react-transition-group';
6
6
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
7
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
7
8
  import { useTheme } from '../zero-styled';
8
9
  import { reflow, getTransitionProps } from '../transitions/utils';
9
10
  import useForkRef from '../utils/useForkRef';
10
- import getChildRef from '../utils/getChildRef';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const styles = {
13
13
  entering: {
@@ -48,7 +48,7 @@ const Zoom = /*#__PURE__*/React.forwardRef(function Zoom(props, ref) {
48
48
  ...other
49
49
  } = props;
50
50
  const nodeRef = React.useRef(null);
51
- const handleRef = useForkRef(nodeRef, getChildRef(children), ref);
51
+ const handleRef = useForkRef(nodeRef, getReactNodeRef(children), ref);
52
52
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
53
53
  if (callback) {
54
54
  const node = nodeRef.current;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.0.0-beta.4
2
+ * @mui/material v6.0.0-beta.4-dev.20240802-144226-85a3b55d22
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 getReactNodeRef from '@mui/utils/getReactNodeRef';
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(getReactNodeRef(children), nodeRef);
53
52
 
54
53
  // The handler doesn't take event.defaultPrevented into account:
55
54
  //
@@ -4,10 +4,10 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Transition } from 'react-transition-group';
6
6
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
7
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
7
8
  import { useTheme } from '../zero-styled';
8
9
  import { reflow, getTransitionProps } from '../transitions/utils';
9
10
  import useForkRef from '../utils/useForkRef';
10
- import getChildRef from '../utils/getChildRef';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const styles = {
13
13
  entering: {
@@ -48,7 +48,7 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
48
48
  } = props;
49
49
  const enableStrictModeCompat = true;
50
50
  const nodeRef = React.useRef(null);
51
- const handleRef = useForkRef(nodeRef, getChildRef(children), ref);
51
+ const handleRef = useForkRef(nodeRef, getReactNodeRef(children), ref);
52
52
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
53
53
  if (callback) {
54
54
  const node = nodeRef.current;
@@ -4,11 +4,11 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import useTimeout from '@mui/utils/useTimeout';
6
6
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
7
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
7
8
  import { Transition } from 'react-transition-group';
8
9
  import { useTheme } from '../zero-styled';
9
10
  import { getTransitionProps, reflow } from '../transitions/utils';
10
11
  import useForkRef from '../utils/useForkRef';
11
- import getChildRef from '../utils/getChildRef';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  function getScale(value) {
14
14
  return `scale(${value}, ${value ** 2})`;
@@ -58,7 +58,7 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
58
58
  const autoTimeout = React.useRef();
59
59
  const theme = useTheme();
60
60
  const nodeRef = React.useRef(null);
61
- const handleRef = useForkRef(nodeRef, getChildRef(children), ref);
61
+ const handleRef = useForkRef(nodeRef, getReactNodeRef(children), ref);
62
62
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
63
63
  if (callback) {
64
64
  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_getReactNodeRef as getReactNodeRef } 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(getReactNodeRef(children), forwardedRef);
33
32
  useEnhancedEffect(() => {
34
33
  if (!disablePortal) {
35
34
  setMountNode(getContainer(container) || document.body);
@@ -4,6 +4,7 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
6
  import deepmerge from '@mui/utils/deepmerge';
7
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
7
8
  import SelectInput from './SelectInput';
8
9
  import formControlState from '../FormControl/formControlState';
9
10
  import useFormControl from '../FormControl/useFormControl';
@@ -91,7 +92,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
91
92
  ownerState: ownerState
92
93
  })
93
94
  }[variant];
94
- const inputComponentRef = useForkRef(ref, InputComponent.ref);
95
+ const inputComponentRef = useForkRef(ref, getReactNodeRef(InputComponent));
95
96
  return /*#__PURE__*/_jsx(React.Fragment, {
96
97
  children: /*#__PURE__*/React.cloneElement(InputComponent, {
97
98
  // Most of the logic is implemented in `SelectInput`.
@@ -6,12 +6,12 @@ import { Transition } from 'react-transition-group';
6
6
  import chainPropTypes from '@mui/utils/chainPropTypes';
7
7
  import HTMLElementType from '@mui/utils/HTMLElementType';
8
8
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
9
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
9
10
  import debounce from '../utils/debounce';
10
11
  import useForkRef from '../utils/useForkRef';
11
12
  import { useTheme } from '../zero-styled';
12
13
  import { reflow, getTransitionProps } from '../transitions/utils';
13
14
  import { ownerWindow } from '../utils';
14
- import getChildRef from '../utils/getChildRef';
15
15
 
16
16
  // Translate the node so it can't be seen on the screen.
17
17
  // Later, we're going to translate the node back to its original location with `none`.
@@ -106,7 +106,7 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
106
106
  ...other
107
107
  } = props;
108
108
  const childrenRef = React.useRef(null);
109
- const handleRef = useForkRef(getChildRef(children), childrenRef, ref);
109
+ const handleRef = useForkRef(getReactNodeRef(children), childrenRef, ref);
110
110
  const normalizedTransitionCallback = callback => isAppearing => {
111
111
  if (callback) {
112
112
  // onEnterXxx and onExitXxx callbacks have a different arguments.length value.
@@ -10,6 +10,7 @@ import { alpha } from '@mui/system/colorManipulator';
10
10
  import { useRtl } from '@mui/system/RtlProvider';
11
11
  import isFocusVisible from '@mui/utils/isFocusVisible';
12
12
  import appendOwnerState from '@mui/utils/appendOwnerState';
13
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
13
14
  import { styled, useTheme } from '../zero-styled';
14
15
  import { useDefaultProps } from '../DefaultPropsProvider';
15
16
  import capitalize from '../utils/capitalize';
@@ -20,7 +21,6 @@ import useForkRef from '../utils/useForkRef';
20
21
  import useId from '../utils/useId';
21
22
  import useControlled from '../utils/useControlled';
22
23
  import tooltipClasses, { getTooltipUtilityClass } from './tooltipClasses';
23
- import getChildRef from '../utils/getChildRef';
24
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  function round(value) {
26
26
  return Math.round(value * 1e5) / 1e5;
@@ -511,7 +511,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
511
511
  document.removeEventListener('keydown', handleKeyDown);
512
512
  };
513
513
  }, [handleClose, open]);
514
- const handleRef = useForkRef(getChildRef(children), setChildNode, ref);
514
+ const handleRef = useForkRef(getReactNodeRef(children), setChildNode, ref);
515
515
 
516
516
  // There is no point in displaying an empty tooltip.
517
517
  // 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_getReactNodeRef as getReactNodeRef } from '@mui/utils';
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  // Inspired by https://github.com/focus-trap/tabbable
9
9
  const candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])'].join(',');
@@ -92,8 +92,7 @@ function FocusTrap(props) {
92
92
  // It waits for the active element to move into the component to activate.
93
93
  const activated = React.useRef(false);
94
94
  const rootRef = React.useRef(null);
95
- // @ts-expect-error TODO upstream fix
96
- const handleRef = useForkRef(children.ref, rootRef);
95
+ const handleRef = useForkRef(getReactNodeRef(children), rootRef);
97
96
  const lastKeydown = React.useRef(null);
98
97
  React.useEffect(() => {
99
98
  // We might render an empty child.
@@ -4,10 +4,10 @@ import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Transition } from 'react-transition-group';
6
6
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
7
+ import getReactNodeRef from '@mui/utils/getReactNodeRef';
7
8
  import { useTheme } from '../zero-styled';
8
9
  import { reflow, getTransitionProps } from '../transitions/utils';
9
10
  import useForkRef from '../utils/useForkRef';
10
- import getChildRef from '../utils/getChildRef';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const styles = {
13
13
  entering: {
@@ -48,7 +48,7 @@ const Zoom = /*#__PURE__*/React.forwardRef(function Zoom(props, ref) {
48
48
  ...other
49
49
  } = props;
50
50
  const nodeRef = React.useRef(null);
51
- const handleRef = useForkRef(nodeRef, getChildRef(children), ref);
51
+ const handleRef = useForkRef(nodeRef, getReactNodeRef(children), ref);
52
52
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
53
53
  if (callback) {
54
54
  const node = nodeRef.current;
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.0.0-beta.4
2
+ * @mui/material v6.0.0-beta.4-dev.20240802-144226-85a3b55d22
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -9,6 +9,7 @@ exports.ClickAwayListener = ClickAwayListener;
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _utils = require("@mui/utils");
12
+ var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -54,9 +55,7 @@ function ClickAwayListener(props) {
54
55
  activatedRef.current = false;
55
56
  };
56
57
  }, []);
57
- const handleRef = (0, _utils.unstable_useForkRef)(
58
- // @ts-expect-error TODO upstream fix
59
- children.ref, nodeRef);
58
+ const handleRef = (0, _utils.unstable_useForkRef)((0, _getReactNodeRef.default)(children), nodeRef);
60
59
 
61
60
  // The handler doesn't take event.defaultPrevented into account:
62
61
  //
package/node/Fade/Fade.js CHANGED
@@ -10,10 +10,10 @@ var React = _interopRequireWildcard(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _reactTransitionGroup = require("react-transition-group");
12
12
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
13
+ var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
13
14
  var _zeroStyled = require("../zero-styled");
14
15
  var _utils = require("../transitions/utils");
15
16
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
16
- var _getChildRef = _interopRequireDefault(require("../utils/getChildRef"));
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -56,7 +56,7 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
56
56
  } = props;
57
57
  const enableStrictModeCompat = true;
58
58
  const nodeRef = React.useRef(null);
59
- const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getChildRef.default)(children), ref);
59
+ const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactNodeRef.default)(children), ref);
60
60
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
61
61
  if (callback) {
62
62
  const node = nodeRef.current;
package/node/Grow/Grow.js CHANGED
@@ -10,11 +10,11 @@ var React = _interopRequireWildcard(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
12
12
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
13
+ var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
13
14
  var _reactTransitionGroup = require("react-transition-group");
14
15
  var _zeroStyled = require("../zero-styled");
15
16
  var _utils = require("../transitions/utils");
16
17
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
17
- var _getChildRef = _interopRequireDefault(require("../utils/getChildRef"));
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -66,7 +66,7 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
66
66
  const autoTimeout = React.useRef();
67
67
  const theme = (0, _zeroStyled.useTheme)();
68
68
  const nodeRef = React.useRef(null);
69
- const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getChildRef.default)(children), ref);
69
+ const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactNodeRef.default)(children), ref);
70
70
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
71
71
  if (callback) {
72
72
  const node = nodeRef.current;
@@ -36,8 +36,7 @@ const Portal = /*#__PURE__*/React.forwardRef(function Portal(props, forwardedRef
36
36
  disablePortal = false
37
37
  } = props;
38
38
  const [mountNode, setMountNode] = React.useState(null);
39
- // @ts-expect-error TODO upstream fix
40
- const handleRef = (0, _utils.unstable_useForkRef)( /*#__PURE__*/React.isValidElement(children) ? children.ref : null, forwardedRef);
39
+ const handleRef = (0, _utils.unstable_useForkRef)((0, _utils.unstable_getReactNodeRef)(children), forwardedRef);
41
40
  (0, _utils.unstable_useEnhancedEffect)(() => {
42
41
  if (!disablePortal) {
43
42
  setMountNode(getContainer(container) || document.body);
@@ -10,6 +10,7 @@ var React = _interopRequireWildcard(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _clsx = _interopRequireDefault(require("clsx"));
12
12
  var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
13
+ var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
13
14
  var _SelectInput = _interopRequireDefault(require("./SelectInput"));
14
15
  var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
15
16
  var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
@@ -99,7 +100,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
99
100
  ownerState: ownerState
100
101
  })
101
102
  }[variant];
102
- const inputComponentRef = (0, _useForkRef.default)(ref, InputComponent.ref);
103
+ const inputComponentRef = (0, _useForkRef.default)(ref, (0, _getReactNodeRef.default)(InputComponent));
103
104
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
104
105
  children: /*#__PURE__*/React.cloneElement(InputComponent, {
105
106
  // Most of the logic is implemented in `SelectInput`.
@@ -13,12 +13,12 @@ var _reactTransitionGroup = require("react-transition-group");
13
13
  var _chainPropTypes = _interopRequireDefault(require("@mui/utils/chainPropTypes"));
14
14
  var _HTMLElementType = _interopRequireDefault(require("@mui/utils/HTMLElementType"));
15
15
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
16
+ var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
16
17
  var _debounce = _interopRequireDefault(require("../utils/debounce"));
17
18
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
18
19
  var _zeroStyled = require("../zero-styled");
19
20
  var _utils = require("../transitions/utils");
20
21
  var _utils2 = require("../utils");
21
- var _getChildRef = _interopRequireDefault(require("../utils/getChildRef"));
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
23
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
24
24
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -114,7 +114,7 @@ const Slide = /*#__PURE__*/React.forwardRef(function Slide(props, ref) {
114
114
  ...other
115
115
  } = props;
116
116
  const childrenRef = React.useRef(null);
117
- const handleRef = (0, _useForkRef.default)((0, _getChildRef.default)(children), childrenRef, ref);
117
+ const handleRef = (0, _useForkRef.default)((0, _getReactNodeRef.default)(children), childrenRef, ref);
118
118
  const normalizedTransitionCallback = callback => isAppearing => {
119
119
  if (callback) {
120
120
  // onEnterXxx and onExitXxx callbacks have a different arguments.length value.
@@ -17,6 +17,7 @@ var _colorManipulator = require("@mui/system/colorManipulator");
17
17
  var _RtlProvider = require("@mui/system/RtlProvider");
18
18
  var _isFocusVisible = _interopRequireDefault(require("@mui/utils/isFocusVisible"));
19
19
  var _appendOwnerState = _interopRequireDefault(require("@mui/utils/appendOwnerState"));
20
+ var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
20
21
  var _zeroStyled = require("../zero-styled");
21
22
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
22
23
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
@@ -27,7 +28,6 @@ var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
27
28
  var _useId = _interopRequireDefault(require("../utils/useId"));
28
29
  var _useControlled = _interopRequireDefault(require("../utils/useControlled"));
29
30
  var _tooltipClasses = _interopRequireWildcard(require("./tooltipClasses"));
30
- var _getChildRef = _interopRequireDefault(require("../utils/getChildRef"));
31
31
  var _jsxRuntime = require("react/jsx-runtime");
32
32
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
33
33
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -521,7 +521,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(inProps, ref) {
521
521
  document.removeEventListener('keydown', handleKeyDown);
522
522
  };
523
523
  }, [handleClose, open]);
524
- const handleRef = (0, _useForkRef.default)((0, _getChildRef.default)(children), setChildNode, ref);
524
+ const handleRef = (0, _useForkRef.default)((0, _getReactNodeRef.default)(children), setChildNode, ref);
525
525
 
526
526
  // There is no point in displaying an empty tooltip.
527
527
  // So we exclude all falsy values, except 0, which is valid.
@@ -100,8 +100,7 @@ function FocusTrap(props) {
100
100
  // It waits for the active element to move into the component to activate.
101
101
  const activated = React.useRef(false);
102
102
  const rootRef = React.useRef(null);
103
- // @ts-expect-error TODO upstream fix
104
- const handleRef = (0, _utils.unstable_useForkRef)(children.ref, rootRef);
103
+ const handleRef = (0, _utils.unstable_useForkRef)((0, _utils.unstable_getReactNodeRef)(children), rootRef);
105
104
  const lastKeydown = React.useRef(null);
106
105
  React.useEffect(() => {
107
106
  // We might render an empty child.
package/node/Zoom/Zoom.js CHANGED
@@ -10,10 +10,10 @@ var React = _interopRequireWildcard(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
  var _reactTransitionGroup = require("react-transition-group");
12
12
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
13
+ var _getReactNodeRef = _interopRequireDefault(require("@mui/utils/getReactNodeRef"));
13
14
  var _zeroStyled = require("../zero-styled");
14
15
  var _utils = require("../transitions/utils");
15
16
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
16
- var _getChildRef = _interopRequireDefault(require("../utils/getChildRef"));
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -56,7 +56,7 @@ const Zoom = /*#__PURE__*/React.forwardRef(function Zoom(props, ref) {
56
56
  ...other
57
57
  } = props;
58
58
  const nodeRef = React.useRef(null);
59
- const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getChildRef.default)(children), ref);
59
+ const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactNodeRef.default)(children), ref);
60
60
  const normalizedTransitionCallback = callback => maybeIsAppearing => {
61
61
  if (callback) {
62
62
  const node = nodeRef.current;
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v6.0.0-beta.4
2
+ * @mui/material v6.0.0-beta.4-dev.20240802-144226-85a3b55d22
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "6.0.0-beta.4",
3
+ "version": "6.0.0-beta.4-dev.20240802-144226-85a3b55d22",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
@@ -36,9 +36,9 @@
36
36
  "react-is": "^18.3.1",
37
37
  "react-transition-group": "^4.4.5",
38
38
  "@mui/core-downloads-tracker": "^6.0.0-beta.4",
39
- "@mui/system": "6.0.0-beta.4",
39
+ "@mui/system": "6.0.0-beta.4-dev.20240802-144226-85a3b55d22",
40
40
  "@mui/types": "^7.2.14",
41
- "@mui/utils": "6.0.0-beta.4"
41
+ "@mui/utils": "6.0.0-beta.4-dev.20240802-144226-85a3b55d22"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.5.0",
@@ -46,7 +46,7 @@
46
46
  "@types/react": "^17.0.0 || ^18.0.0",
47
47
  "react": "^17.0.0 || ^18.0.0",
48
48
  "react-dom": "^17.0.0 || ^18.0.0",
49
- "@mui/material-pigment-css": "^6.0.0-beta.4"
49
+ "@mui/material-pigment-css": "^6.0.0-beta.4-dev.20240802-144226-85a3b55d22"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@types/react": {
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- export default function getChildRef(child) {
3
- if (!child || ! /*#__PURE__*/React.isValidElement(child)) {
4
- return null;
5
- }
6
- // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in React 18
7
- // below check is to ensure 'ref' is accessible in both cases
8
- return child.props.propertyIsEnumerable('ref') ? child.props.ref : child.ref;
9
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = getChildRef;
7
- var React = _interopRequireWildcard(require("react"));
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
- function getChildRef(child) {
11
- if (!child || ! /*#__PURE__*/React.isValidElement(child)) {
12
- return null;
13
- }
14
- // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in React 18
15
- // below check is to ensure 'ref' is accessible in both cases
16
- return child.props.propertyIsEnumerable('ref') ? child.props.ref : child.ref;
17
- }
@@ -1 +0,0 @@
1
- export default function getChildRef(child: React.ReactElement): React.Ref<any> | null;
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- export default function getChildRef(child) {
3
- if (!child || ! /*#__PURE__*/React.isValidElement(child)) {
4
- return null;
5
- }
6
- // 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in React 18
7
- // below check is to ensure 'ref' is accessible in both cases
8
- return child.props.propertyIsEnumerable('ref') ? child.props.ref : child.ref;
9
- }