@mui/utils
Advanced tools
Comparing version 6.1.7 to 6.1.8
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -8,2 +9,3 @@ value: true | ||
exports.isPlainObject = isPlainObject; | ||
var React = _interopRequireWildcard(require("react")); | ||
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js | ||
@@ -18,3 +20,3 @@ function isPlainObject(item) { | ||
function deepClone(source) { | ||
if (!isPlainObject(source)) { | ||
if (/*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) { | ||
return source; | ||
@@ -36,3 +38,5 @@ } | ||
Object.keys(source).forEach(key => { | ||
if (isPlainObject(source[key]) && | ||
if (/*#__PURE__*/React.isValidElement(source[key])) { | ||
output[key] = source[key]; | ||
} else if (isPlainObject(source[key]) && | ||
// Avoid prototype pollution | ||
@@ -39,0 +43,0 @@ Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) { |
@@ -0,1 +1,3 @@ | ||
import * as React from 'react'; | ||
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js | ||
@@ -10,3 +12,3 @@ export function isPlainObject(item) { | ||
function deepClone(source) { | ||
if (!isPlainObject(source)) { | ||
if (/*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) { | ||
return source; | ||
@@ -28,3 +30,5 @@ } | ||
Object.keys(source).forEach(key => { | ||
if (isPlainObject(source[key]) && | ||
if (/*#__PURE__*/React.isValidElement(source[key])) { | ||
output[key] = source[key]; | ||
} else if (isPlainObject(source[key]) && | ||
// Avoid prototype pollution | ||
@@ -31,0 +35,0 @@ Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) { |
@@ -5,2 +5,19 @@ 'use client'; | ||
import setRef from "../setRef/index.js"; | ||
/** | ||
* Takes an array of refs and returns a new ref which will apply any modification to all of the refs. | ||
* This is useful when you want to have the ref used in multiple places. | ||
* | ||
* ```tsx | ||
* const rootRef = React.useRef<Instance>(null); | ||
* const refFork = useForkRef(rootRef, props.ref); | ||
* | ||
* return ( | ||
* <Root {...props} ref={refFork} /> | ||
* ); | ||
* ``` | ||
* | ||
* @param {Array<React.Ref<Instance> | undefined>} refs The ref array. | ||
* @returns {React.RefCallback<Instance> | null} The new ref callback. | ||
*/ | ||
export default function useForkRef(...refs) { | ||
@@ -7,0 +24,0 @@ /** |
/** | ||
* @mui/utils v6.1.7 | ||
* @mui/utils v6.1.8 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MIT |
@@ -0,1 +1,3 @@ | ||
import * as React from 'react'; | ||
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js | ||
@@ -10,3 +12,3 @@ export function isPlainObject(item) { | ||
function deepClone(source) { | ||
if (!isPlainObject(source)) { | ||
if (/*#__PURE__*/React.isValidElement(source) || !isPlainObject(source)) { | ||
return source; | ||
@@ -28,3 +30,5 @@ } | ||
Object.keys(source).forEach(key => { | ||
if (isPlainObject(source[key]) && | ||
if (/*#__PURE__*/React.isValidElement(source[key])) { | ||
output[key] = source[key]; | ||
} else if (isPlainObject(source[key]) && | ||
// Avoid prototype pollution | ||
@@ -31,0 +35,0 @@ Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) { |
/** | ||
* @mui/utils v6.1.7 | ||
* @mui/utils v6.1.8 | ||
* | ||
@@ -4,0 +4,0 @@ * @license MIT |
@@ -5,2 +5,19 @@ 'use client'; | ||
import setRef from "../setRef/index.js"; | ||
/** | ||
* Takes an array of refs and returns a new ref which will apply any modification to all of the refs. | ||
* This is useful when you want to have the ref used in multiple places. | ||
* | ||
* ```tsx | ||
* const rootRef = React.useRef<Instance>(null); | ||
* const refFork = useForkRef(rootRef, props.ref); | ||
* | ||
* return ( | ||
* <Root {...props} ref={refFork} /> | ||
* ); | ||
* ``` | ||
* | ||
* @param {Array<React.Ref<Instance> | undefined>} refs The ref array. | ||
* @returns {React.RefCallback<Instance> | null} The new ref callback. | ||
*/ | ||
export default function useForkRef(...refs) { | ||
@@ -7,0 +24,0 @@ /** |
{ | ||
"name": "@mui/utils", | ||
"version": "6.1.7", | ||
"version": "6.1.8", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "author": "MUI Team", |
import * as React from 'react'; | ||
/** | ||
* Takes an array of refs and returns a new ref which will apply any modification to all of the refs. | ||
* This is useful when you want to have the ref used in multiple places. | ||
* | ||
* ```tsx | ||
* const rootRef = React.useRef<Instance>(null); | ||
* const refFork = useForkRef(rootRef, props.ref); | ||
* | ||
* return ( | ||
* <Root {...props} ref={refFork} /> | ||
* ); | ||
* ``` | ||
* | ||
* @param {Array<React.Ref<Instance> | undefined>} refs The ref array. | ||
* @returns {React.RefCallback<Instance> | null} The new ref callback. | ||
*/ | ||
export default function useForkRef<Instance>(...refs: Array<React.Ref<Instance> | undefined>): React.RefCallback<Instance> | null; |
@@ -12,2 +12,18 @@ "use strict"; | ||
var _setRef = _interopRequireDefault(require("../setRef")); | ||
/** | ||
* Takes an array of refs and returns a new ref which will apply any modification to all of the refs. | ||
* This is useful when you want to have the ref used in multiple places. | ||
* | ||
* ```tsx | ||
* const rootRef = React.useRef<Instance>(null); | ||
* const refFork = useForkRef(rootRef, props.ref); | ||
* | ||
* return ( | ||
* <Root {...props} ref={refFork} /> | ||
* ); | ||
* ``` | ||
* | ||
* @param {Array<React.Ref<Instance> | undefined>} refs The ref array. | ||
* @returns {React.RefCallback<Instance> | null} The new ref callback. | ||
*/ | ||
function useForkRef(...refs) { | ||
@@ -14,0 +30,0 @@ /** |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
321648
5696