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

@fluentui/react-component-ref

Package Overview
Dependencies
Maintainers
8
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluentui/react-component-ref - npm Package Compare versions

Comparing version 0.50.0 to 0.51.0

dist/commonjs/utils.js

32

dist/commonjs/index.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
var _exportNames = {
handleRef: true,
isRefObject: true,
Ref: true,

@@ -13,31 +9,23 @@ RefFindNode: true,

};
exports.RefForward = exports.RefFindNode = exports.Ref = exports.isRefObject = exports.handleRef = void 0;
exports.RefForward = exports.RefFindNode = exports.Ref = void 0;
var _handleRef = _interopRequireDefault(require("./handleRef"));
var _Ref = require("./Ref");
exports.handleRef = _handleRef.default;
exports.Ref = _Ref.Ref;
var _isRefObject = _interopRequireDefault(require("./isRefObject"));
var _RefFindNode = require("./RefFindNode");
exports.isRefObject = _isRefObject.default;
exports.RefFindNode = _RefFindNode.RefFindNode;
var _Ref = _interopRequireDefault(require("./Ref"));
var _RefForward = require("./RefForward");
exports.Ref = _Ref.default;
exports.RefForward = _RefForward.RefForward;
var _RefFindNode = _interopRequireDefault(require("./RefFindNode"));
var _utils = require("./utils");
exports.RefFindNode = _RefFindNode.default;
var _RefForward = _interopRequireDefault(require("./RefForward"));
exports.RefForward = _RefForward.default;
var _types = require("./types");
Object.keys(_types).forEach(function (key) {
Object.keys(_utils).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
exports[key] = _types[key];
exports[key] = _utils[key];
});
//# sourceMappingURL=index.js.map

@@ -8,8 +8,6 @@ "use strict";

exports.__esModule = true;
exports.default = void 0;
exports.Ref = void 0;
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var PropTypes = _interopRequireWildcard(require("prop-types"));
var React = _interopRequireWildcard(require("react"));

@@ -19,8 +17,6 @@

var _RefFindNode = _interopRequireDefault(require("./RefFindNode"));
var _RefFindNode = require("./RefFindNode");
var _RefForward = _interopRequireDefault(require("./RefForward"));
var _RefForward = require("./RefForward");
var _types = require("./types");
var Ref = function Ref(props) {

@@ -31,5 +27,5 @@ var children = props.children,

var child = React.Children.only(children);
var ElementType = ReactIs.isForwardRef(child) ? _RefForward.default : _RefFindNode.default;
var childWithProps = child && rest && Object.keys(rest).length > 0 ? React.cloneElement(child, rest) : child;
return React.createElement(ElementType, {
var ElementType = ReactIs.isForwardRef(child) ? _RefForward.RefForward : _RefFindNode.RefFindNode;
var childWithProps = child && rest && Object.keys(rest).length > 0 ? /*#__PURE__*/React.cloneElement(child, rest) : child;
return /*#__PURE__*/React.createElement(ElementType, {
innerRef: innerRef

@@ -39,13 +35,3 @@ }, childWithProps);

Ref.displayName = 'Ref'; // TODO: use Babel plugin for this
if (process.env.NODE_ENV !== 'production') {
Ref.propTypes = {
children: PropTypes.element.isRequired,
innerRef: _types.refPropType.isRequired
};
}
var _default = Ref;
exports.default = _default;
exports.Ref = Ref;
//# sourceMappingURL=Ref.js.map

@@ -8,8 +8,6 @@ "use strict";

exports.__esModule = true;
exports.default = void 0;
exports.RefFindNode = void 0;
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var PropTypes = _interopRequireWildcard(require("prop-types"));
var React = _interopRequireWildcard(require("react"));

@@ -19,9 +17,5 @@

var _handleRef = _interopRequireDefault(require("./handleRef"));
var _utils = require("./utils");
var _types = require("./types");
var RefFindNode =
/*#__PURE__*/
function (_React$Component) {
var RefFindNode = /*#__PURE__*/function (_React$Component) {
(0, _inheritsLoose2.default)(RefFindNode, _React$Component);

@@ -45,3 +39,3 @@

this.prevNode = ReactDOM.findDOMNode(this);
(0, _handleRef.default)(this.props.innerRef, this.prevNode);
(0, _utils.handleRef)(this.props.innerRef, this.prevNode);
};

@@ -54,7 +48,7 @@

this.prevNode = currentNode;
(0, _handleRef.default)(this.props.innerRef, currentNode);
(0, _utils.handleRef)(this.props.innerRef, currentNode);
}
if (prevProps.innerRef !== this.props.innerRef) {
(0, _handleRef.default)(this.props.innerRef, currentNode);
(0, _utils.handleRef)(this.props.innerRef, currentNode);
}

@@ -64,3 +58,3 @@ };

_proto.componentWillUnmount = function componentWillUnmount() {
(0, _handleRef.default)(this.props.innerRef, null);
(0, _utils.handleRef)(this.props.innerRef, null);
delete this.prevNode;

@@ -77,8 +71,3 @@ };

exports.default = RefFindNode;
RefFindNode.displayName = 'RefFindNode';
RefFindNode.propTypes = process.env.NODE_ENV !== 'production' ? {
children: PropTypes.element.isRequired,
innerRef: _types.refPropType.isRequired
} : {};
exports.RefFindNode = RefFindNode;
//# sourceMappingURL=RefFindNode.js.map

@@ -8,17 +8,11 @@ "use strict";

exports.__esModule = true;
exports.default = void 0;
exports.RefForward = void 0;
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var PropTypes = _interopRequireWildcard(require("prop-types"));
var React = _interopRequireWildcard(require("react"));
var _handleRef = _interopRequireDefault(require("./handleRef"));
var _utils = require("./utils");
var _types = require("./types");
var RefForward =
/*#__PURE__*/
function (_React$Component) {
var RefForward = /*#__PURE__*/function (_React$Component) {
(0, _inheritsLoose2.default)(RefForward, _React$Component);

@@ -40,4 +34,4 @@

innerRef = _this$props.innerRef;
(0, _handleRef.default)(children.ref, node);
(0, _handleRef.default)(innerRef, node);
(0, _utils.handleRef)(children.ref, node);
(0, _utils.handleRef)(innerRef, node);
_this.currentNode = node;

@@ -53,3 +47,3 @@ };

if (prevProps.innerRef !== this.props.innerRef) {
(0, _handleRef.default)(this.props.innerRef, this.currentNode);
(0, _utils.handleRef)(this.props.innerRef, this.currentNode);
}

@@ -64,3 +58,3 @@ };

var children = this.props.children;
return React.cloneElement(children, {
return /*#__PURE__*/React.cloneElement(children, {
ref: this.handleRefOverride

@@ -73,8 +67,3 @@ });

exports.default = RefForward;
RefForward.displayName = 'RefForward';
RefForward.propTypes = process.env.NODE_ENV !== 'production' ? {
children: PropTypes.element.isRequired,
innerRef: _types.refPropType.isRequired
} : {};
exports.RefForward = RefForward;
//# sourceMappingURL=RefForward.js.map

@@ -1,6 +0,4 @@

export { default as handleRef } from './handleRef';
export { default as isRefObject } from './isRefObject';
export { default as Ref } from './Ref';
export { default as RefFindNode } from './RefFindNode';
export { default as RefForward } from './RefForward';
export * from './types';
export { Ref } from './Ref';
export { RefFindNode } from './RefFindNode';
export { RefForward } from './RefForward';
export * from './utils';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var handleRef_1 = require("./handleRef");
exports.handleRef = handleRef_1.default;
var isRefObject_1 = require("./isRefObject");
exports.isRefObject = isRefObject_1.default;
var Ref_1 = require("./Ref");
exports.Ref = Ref_1.default;
exports.Ref = Ref_1.Ref;
var RefFindNode_1 = require("./RefFindNode");
exports.RefFindNode = RefFindNode_1.default;
exports.RefFindNode = RefFindNode_1.RefFindNode;
var RefForward_1 = require("./RefForward");
exports.RefForward = RefForward_1.default;
tslib_1.__exportStar(require("./types"), exports);
exports.RefForward = RefForward_1.RefForward;
tslib_1.__exportStar(require("./utils"), exports);
import * as React from 'react';
import { RefProps } from './types';
declare const Ref: React.FunctionComponent<RefProps>;
export default Ref;
import { RefProps } from './utils';
export declare const Ref: React.FunctionComponent<RefProps>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var PropTypes = require("prop-types");
var React = require("react");

@@ -9,18 +8,8 @@ var ReactIs = require("react-is");

var RefForward_1 = require("./RefForward");
var types_1 = require("./types");
var Ref = function (props) {
exports.Ref = function (props) {
var children = props.children, innerRef = props.innerRef, rest = tslib_1.__rest(props, ["children", "innerRef"]);
var child = React.Children.only(children);
var ElementType = ReactIs.isForwardRef(child) ? RefForward_1.default : RefFindNode_1.default;
var ElementType = ReactIs.isForwardRef(child) ? RefForward_1.RefForward : RefFindNode_1.RefFindNode;
var childWithProps = child && rest && Object.keys(rest).length > 0 ? React.cloneElement(child, rest) : child;
return React.createElement(ElementType, { innerRef: innerRef }, childWithProps);
};
Ref.displayName = 'Ref';
// TODO: use Babel plugin for this
if (process.env.NODE_ENV !== 'production') {
Ref.propTypes = {
children: PropTypes.element.isRequired,
innerRef: types_1.refPropType.isRequired,
};
}
exports.default = Ref;

@@ -1,13 +0,4 @@

import * as PropTypes from 'prop-types';
import * as React from 'react';
import { RefProps } from './types';
export default class RefFindNode extends React.Component<RefProps> {
static displayName: string;
static propTypes: {
children: PropTypes.Validator<PropTypes.ReactElementLike>;
innerRef: PropTypes.Validator<((instance: any) => void) | React.RefObject<any>>;
} | {
children?: undefined;
innerRef?: undefined;
};
import { RefProps } from './utils';
export declare class RefFindNode extends React.Component<RefProps> {
prevNode: Node | null;

@@ -14,0 +5,0 @@ componentDidMount(): void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var PropTypes = require("prop-types");
var React = require("react");
var ReactDOM = require("react-dom");
var handleRef_1 = require("./handleRef");
var types_1 = require("./types");
var utils_1 = require("./utils");
var RefFindNode = /** @class */ (function (_super) {

@@ -18,3 +16,3 @@ tslib_1.__extends(RefFindNode, _super);

this.prevNode = ReactDOM.findDOMNode(this);
handleRef_1.default(this.props.innerRef, this.prevNode);
utils_1.handleRef(this.props.innerRef, this.prevNode);
};

@@ -25,10 +23,10 @@ RefFindNode.prototype.componentDidUpdate = function (prevProps) {

this.prevNode = currentNode;
handleRef_1.default(this.props.innerRef, currentNode);
utils_1.handleRef(this.props.innerRef, currentNode);
}
if (prevProps.innerRef !== this.props.innerRef) {
handleRef_1.default(this.props.innerRef, currentNode);
utils_1.handleRef(this.props.innerRef, currentNode);
}
};
RefFindNode.prototype.componentWillUnmount = function () {
handleRef_1.default(this.props.innerRef, null);
utils_1.handleRef(this.props.innerRef, null);
delete this.prevNode;

@@ -40,12 +38,4 @@ };

};
RefFindNode.displayName = 'RefFindNode';
// TODO: use Babel plugin for this
RefFindNode.propTypes = process.env.NODE_ENV !== 'production'
? {
children: PropTypes.element.isRequired,
innerRef: types_1.refPropType.isRequired,
}
: {};
return RefFindNode;
}(React.Component));
exports.default = RefFindNode;
exports.RefFindNode = RefFindNode;

@@ -1,13 +0,4 @@

import * as PropTypes from 'prop-types';
import * as React from 'react';
import { RefProps } from './types';
export default class RefForward extends React.Component<RefProps> {
static displayName: string;
static propTypes: {
children: PropTypes.Validator<PropTypes.ReactElementLike>;
innerRef: PropTypes.Validator<((instance: any) => void) | React.RefObject<any>>;
} | {
children?: undefined;
innerRef?: undefined;
};
import { RefProps } from './utils';
export declare class RefForward extends React.Component<RefProps> {
currentNode: Node | null;

@@ -14,0 +5,0 @@ handleRefOverride: (node: HTMLElement) => void;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var PropTypes = require("prop-types");
var React = require("react");
var handleRef_1 = require("./handleRef");
var types_1 = require("./types");
var utils_1 = require("./utils");
var RefForward = /** @class */ (function (_super) {

@@ -15,4 +13,4 @@ tslib_1.__extends(RefForward, _super);

var _a = _this.props, children = _a.children, innerRef = _a.innerRef;
handleRef_1.default(children.ref, node);
handleRef_1.default(innerRef, node);
utils_1.handleRef(children.ref, node);
utils_1.handleRef(innerRef, node);
_this.currentNode = node;

@@ -24,3 +22,3 @@ };

if (prevProps.innerRef !== this.props.innerRef) {
handleRef_1.default(this.props.innerRef, this.currentNode);
utils_1.handleRef(this.props.innerRef, this.currentNode);
}

@@ -37,12 +35,4 @@ };

};
RefForward.displayName = 'RefForward';
// TODO: use Babel plugin for this
RefForward.propTypes = process.env.NODE_ENV !== 'production'
? {
children: PropTypes.element.isRequired,
innerRef: types_1.refPropType.isRequired,
}
: {};
return RefForward;
}(React.Component));
exports.default = RefForward;
exports.RefForward = RefForward;

@@ -1,6 +0,4 @@

export { default as handleRef } from './handleRef';
export { default as isRefObject } from './isRefObject';
export { default as Ref } from './Ref';
export { default as RefFindNode } from './RefFindNode';
export { default as RefForward } from './RefForward';
export * from './types';
export { Ref } from './Ref';
export { RefFindNode } from './RefFindNode';
export { RefForward } from './RefForward';
export * from './utils';

@@ -1,7 +0,5 @@

export { default as handleRef } from './handleRef';
export { default as isRefObject } from './isRefObject';
export { default as Ref } from './Ref';
export { default as RefFindNode } from './RefFindNode';
export { default as RefForward } from './RefForward';
export * from './types';
export { Ref } from './Ref';
export { RefFindNode } from './RefFindNode';
export { RefForward } from './RefForward';
export * from './utils';
//# sourceMappingURL=index.js.map
import * as React from 'react';
import { RefProps } from './types';
declare const Ref: React.FunctionComponent<RefProps>;
export default Ref;
import { RefProps } from './utils';
export declare const Ref: React.FunctionComponent<RefProps>;
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as ReactIs from 'react-is';
import RefFindNode from './RefFindNode';
import RefForward from './RefForward';
import { refPropType } from './types';
var Ref = function Ref(props) {
import { RefFindNode } from './RefFindNode';
import { RefForward } from './RefForward';
export var Ref = function Ref(props) {
var children = props.children,

@@ -16,18 +13,7 @@ innerRef = props.innerRef,

var ElementType = ReactIs.isForwardRef(child) ? RefForward : RefFindNode;
var childWithProps = child && rest && Object.keys(rest).length > 0 ? React.cloneElement(child, rest) : child;
return React.createElement(ElementType, {
var childWithProps = child && rest && Object.keys(rest).length > 0 ? /*#__PURE__*/React.cloneElement(child, rest) : child;
return /*#__PURE__*/React.createElement(ElementType, {
innerRef: innerRef
}, childWithProps);
};
Ref.displayName = 'Ref'; // TODO: use Babel plugin for this
if (process.env.NODE_ENV !== 'production') {
Ref.propTypes = {
children: PropTypes.element.isRequired,
innerRef: refPropType.isRequired
};
}
export default Ref;
//# sourceMappingURL=Ref.js.map

@@ -1,13 +0,4 @@

import * as PropTypes from 'prop-types';
import * as React from 'react';
import { RefProps } from './types';
export default class RefFindNode extends React.Component<RefProps> {
static displayName: string;
static propTypes: {
children: PropTypes.Validator<PropTypes.ReactElementLike>;
innerRef: PropTypes.Validator<((instance: any) => void) | React.RefObject<any>>;
} | {
children?: undefined;
innerRef?: undefined;
};
import { RefProps } from './utils';
export declare class RefFindNode extends React.Component<RefProps> {
prevNode: Node | null;

@@ -14,0 +5,0 @@ componentDidMount(): void;

import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
import * as PropTypes from 'prop-types';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import handleRef from './handleRef';
import { refPropType } from './types';
var RefFindNode =
/*#__PURE__*/
function (_React$Component) {
import { handleRef } from './utils';
export var RefFindNode = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(RefFindNode, _React$Component);

@@ -57,9 +52,2 @@

}(React.Component);
RefFindNode.displayName = 'RefFindNode';
RefFindNode.propTypes = process.env.NODE_ENV !== 'production' ? {
children: PropTypes.element.isRequired,
innerRef: refPropType.isRequired
} : {};
export { RefFindNode as default };
//# sourceMappingURL=RefFindNode.js.map

@@ -1,13 +0,4 @@

import * as PropTypes from 'prop-types';
import * as React from 'react';
import { RefProps } from './types';
export default class RefForward extends React.Component<RefProps> {
static displayName: string;
static propTypes: {
children: PropTypes.Validator<PropTypes.ReactElementLike>;
innerRef: PropTypes.Validator<((instance: any) => void) | React.RefObject<any>>;
} | {
children?: undefined;
innerRef?: undefined;
};
import { RefProps } from './utils';
export declare class RefForward extends React.Component<RefProps> {
currentNode: Node | null;

@@ -14,0 +5,0 @@ handleRefOverride: (node: HTMLElement) => void;

import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
import * as PropTypes from 'prop-types';
import * as React from 'react';
import handleRef from './handleRef';
import { refPropType } from './types';
var RefForward =
/*#__PURE__*/
function (_React$Component) {
import { handleRef } from './utils';
export var RefForward = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(RefForward, _React$Component);

@@ -48,3 +43,3 @@

var children = this.props.children;
return React.cloneElement(children, {
return /*#__PURE__*/React.cloneElement(children, {
ref: this.handleRefOverride

@@ -56,9 +51,2 @@ });

}(React.Component);
RefForward.displayName = 'RefForward';
RefForward.propTypes = process.env.NODE_ENV !== 'production' ? {
children: PropTypes.element.isRequired,
innerRef: refPropType.isRequired
} : {};
export { RefForward as default };
//# sourceMappingURL=RefForward.js.map
{
"name": "@fluentui/react-component-ref",
"description": "A set of components and utils to deal with React refs.",
"version": "0.50.0",
"version": "0.51.0",
"author": "Oleksandr Fediashov <olfedias@microsoft.com>",
"bugs": "https://github.com/microsoft/fluentui/issues",
"dependencies": {
"@babel/runtime": "^7.7.6",
"prop-types": "^15.7.2",
"@babel/runtime": "^7.10.4",
"react-is": "^16.6.3"
},
"devDependencies": {
"@fluentui/eslint-plugin": "^0.53.1",
"@types/react": "16.8.25",

@@ -47,3 +47,3 @@ "@types/react-dom": "16.8.4",

"types": "dist/es/index.d.ts",
"gitHead": "f986757f9fccfef210e85163dfe9d795cf54f8af"
"gitHead": "215aed1574db0b0db7d5fe130d19072178855423"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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