Comparing version 5.43.0 to 5.43.1
import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
import { isValidElement, version } from 'react'; | ||
import { isValidElement } from 'react'; | ||
import { ForwardRef, isFragment, isMemo } from 'react-is'; | ||
@@ -69,16 +69,11 @@ import useMemo from "./hooks/useMemo"; | ||
*/ | ||
export var getNodeRef = Number(version.split('.')[0]) >= 19 ? | ||
// >= React 19 | ||
function (node) { | ||
if (isReactElement(node)) { | ||
return node.props.ref; | ||
export var getNodeRef = function getNodeRef(node) { | ||
if (node && isReactElement(node)) { | ||
var ele = node; | ||
// Source from: | ||
// https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/getReactNodeRef/getReactNodeRef.ts | ||
return ele.props.propertyIsEnumerable('ref') ? ele.props.ref : ele.ref; | ||
} | ||
return null; | ||
} : | ||
// < React 19 | ||
function (node) { | ||
if (isReactElement(node)) { | ||
return node.ref; | ||
} | ||
return null; | ||
}; |
@@ -76,16 +76,11 @@ "use strict"; | ||
*/ | ||
var getNodeRef = exports.getNodeRef = Number(_react.version.split('.')[0]) >= 19 ? | ||
// >= React 19 | ||
function (node) { | ||
if (isReactElement(node)) { | ||
return node.props.ref; | ||
var getNodeRef = exports.getNodeRef = function getNodeRef(node) { | ||
if (node && isReactElement(node)) { | ||
var ele = node; | ||
// Source from: | ||
// https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/getReactNodeRef/getReactNodeRef.ts | ||
return ele.props.propertyIsEnumerable('ref') ? ele.props.ref : ele.ref; | ||
} | ||
return null; | ||
} : | ||
// < React 19 | ||
function (node) { | ||
if (isReactElement(node)) { | ||
return node.ref; | ||
} | ||
return null; | ||
}; |
{ | ||
"name": "rc-util", | ||
"version": "5.43.0", | ||
"version": "5.43.1", | ||
"description": "Common Utils For React Component", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"prepare": "husky install", | ||
"prepublishOnly": "npm run compile && np --yolo --no-publish", | ||
"prepublishOnly": "npm run compile ", | ||
"start": "dumi dev", | ||
@@ -71,2 +71,4 @@ "test": "rc-test" | ||
"react-dom": "^18.0.0", | ||
"react-19": "npm:react@19.0.0-rc-de68d2f4-20241204", | ||
"react-dom-19": "npm:react-dom@19.0.0-rc-de68d2f4-20241204", | ||
"typescript": "^5.3.2" | ||
@@ -73,0 +75,0 @@ }, |
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
240743
28
7296