Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-util

Package Overview
Dependencies
Maintainers
9
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-util - npm Package Compare versions

Comparing version 5.41.0 to 5.42.0

6

es/ref.d.ts

@@ -13,2 +13,8 @@ import type * as React from 'react';

export declare const supportNodeRef: <T = any>(node: React.ReactNode) => node is React.ReactElement<any, string | React.JSXElementConstructor<any>> & RefAttributes<T>;
/**
* In React 19. `ref` is not a property from node.
* But a property from `props.ref`.
* To check if `props.ref` exist or fallback to `ref`.
*/
export declare const getNodeRef: <T = any>(node: React.ReactNode) => React.Ref<T> | null;
export {};

30

es/ref.js
import _typeof from "@babel/runtime/helpers/esm/typeof";
import { isValidElement } from 'react';
import { isValidElement, version } from 'react';
import { ForwardRef, isFragment, isMemo } from 'react-is';

@@ -57,10 +57,28 @@ import useMemo from "./hooks/useMemo";

};
function isReactElement(node) {
return /*#__PURE__*/isValidElement(node) && !isFragment(node);
}
export var supportNodeRef = function supportNodeRef(node) {
if (! /*#__PURE__*/isValidElement(node)) {
return false;
return isReactElement(node) && supportRef(node);
};
/**
* In React 19. `ref` is not a property from node.
* But a property from `props.ref`.
* To check if `props.ref` exist or fallback to `ref`.
*/
export var getNodeRef = Number(version.split('.')[0]) >= 19 ?
// >= React 19
function (node) {
if (isReactElement(node)) {
return node.props.ref;
}
if (isFragment(node)) {
return false;
return null;
} :
// < React 19
function (node) {
if (isReactElement(node)) {
return node.ref;
}
return supportRef(node);
return null;
};

@@ -13,2 +13,8 @@ import type * as React from 'react';

export declare const supportNodeRef: <T = any>(node: React.ReactNode) => node is React.ReactElement<any, string | React.JSXElementConstructor<any>> & RefAttributes<T>;
/**
* In React 19. `ref` is not a property from node.
* But a property from `props.ref`.
* To check if `props.ref` exist or fallback to `ref`.
*/
export declare const getNodeRef: <T = any>(node: React.ReactNode) => React.Ref<T> | null;
export {};

@@ -7,3 +7,3 @@ "use strict";

});
exports.useComposeRef = exports.supportRef = exports.supportNodeRef = exports.fillRef = exports.composeRef = void 0;
exports.useComposeRef = exports.supportRef = exports.supportNodeRef = exports.getNodeRef = exports.fillRef = exports.composeRef = void 0;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));

@@ -65,10 +65,28 @@ var _react = require("react");

};
function isReactElement(node) {
return /*#__PURE__*/(0, _react.isValidElement)(node) && !(0, _reactIs.isFragment)(node);
}
var supportNodeRef = exports.supportNodeRef = function supportNodeRef(node) {
if (! /*#__PURE__*/(0, _react.isValidElement)(node)) {
return false;
return isReactElement(node) && supportRef(node);
};
/**
* In React 19. `ref` is not a property from node.
* But a property from `props.ref`.
* To check if `props.ref` exist or fallback to `ref`.
*/
var getNodeRef = exports.getNodeRef = Number(_react.version.split('.')[0]) >= 19 ?
// >= React 19
function (node) {
if (isReactElement(node)) {
return node.props.ref;
}
if ((0, _reactIs.isFragment)(node)) {
return false;
return null;
} :
// < React 19
function (node) {
if (isReactElement(node)) {
return node.ref;
}
return supportRef(node);
return null;
};

2

package.json
{
"name": "rc-util",
"version": "5.41.0",
"version": "5.42.0",
"description": "Common Utils For React Component",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc