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

react-portal

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-portal - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

es/LegacyPortal.js

2

es/index.js

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

import Portal from './Portal';
import Portal from './PortalCompat';
import PortalWithState from './PortalWithState';
export { Portal, PortalWithState };

@@ -12,5 +12,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import { createPortal } from 'react-dom';
import { canUseDOM } from './utils';
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
var Portal = function (_React$Component) {

@@ -17,0 +16,0 @@ _inherits(Portal, _React$Component);

@@ -10,5 +10,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import React from 'react';
import { findDOMNode } from 'react-dom';
import PropTypes from 'prop-types';
import Portal from './Portal';
import Portal from './PortalCompat';

@@ -63,3 +62,5 @@ var KEYCODES = {

}
e.nativeEvent.stopImmediatePropagation();
if (e && e.nativeEvent) {
e.nativeEvent.stopImmediatePropagation();
}
this.setState({ active: true }, this.props.onOpen);

@@ -101,3 +102,3 @@ }

}
var root = findDOMNode(this.portalNode);
var root = this.portalNode.defaultNode;
if (!root || root.contains(e.target) || e.button && e.button !== 0) {

@@ -104,0 +105,0 @@ return;

@@ -8,5 +8,5 @@ 'use strict';

var _Portal = require('./Portal');
var _PortalCompat = require('./PortalCompat');
var _Portal2 = _interopRequireDefault(_Portal);
var _PortalCompat2 = _interopRequireDefault(_PortalCompat);

@@ -19,3 +19,3 @@ var _PortalWithState = require('./PortalWithState');

exports.Portal = _Portal2.default;
exports.Portal = _PortalCompat2.default;
exports.PortalWithState = _PortalWithState2.default;

@@ -19,2 +19,4 @@ 'use strict';

var _utils = require('./utils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -28,4 +30,2 @@

var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
var Portal = function (_React$Component) {

@@ -51,3 +51,3 @@ _inherits(Portal, _React$Component);

value: function render() {
if (!canUseDOM) {
if (!_utils.canUseDOM) {
return null;

@@ -54,0 +54,0 @@ }

@@ -13,4 +13,2 @@ 'use strict';

var _reactDom = require('react-dom');
var _propTypes = require('prop-types');

@@ -20,5 +18,5 @@

var _Portal = require('./Portal');
var _PortalCompat = require('./PortalCompat');
var _Portal2 = _interopRequireDefault(_Portal);
var _PortalCompat2 = _interopRequireDefault(_PortalCompat);

@@ -81,3 +79,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

}
e.nativeEvent.stopImmediatePropagation();
if (e && e.nativeEvent) {
e.nativeEvent.stopImmediatePropagation();
}
this.setState({ active: true }, this.props.onOpen);

@@ -102,3 +102,3 @@ }

return _react2.default.createElement(
_Portal2.default,
_PortalCompat2.default,
{

@@ -120,3 +120,3 @@ node: this.props.node,

}
var root = (0, _reactDom.findDOMNode)(this.portalNode);
var root = this.portalNode.defaultNode;
if (!root || root.contains(e.target) || e.button && e.button !== 0) {

@@ -123,0 +123,0 @@ return;

{
"name": "react-portal",
"version": "4.0.0",
"version": "4.1.0",
"description": "To make your life with React Portals easier.",

@@ -30,3 +30,4 @@ "main": "lib/index.js",

"format": "prettier --write \"**/*.js\"",
"test": "cross-env BABEL_ENV=commonjs jest --no-cache"
"test": "cross-env BABEL_ENV=commonjs jest --no-cache",
"react": "enzyme-adapter-react-install 16"
},

@@ -63,3 +64,3 @@ "tags": [

"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.2",
"enzyme-adapter-react-helper": "^1.2.2",
"eslint": "^4.3.0",

@@ -70,5 +71,4 @@ "eslint-plugin-prettier": "^2.1.2",

"raf": "^3.4.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-test-renderer": "^16.0.0",
"react": "^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0",
"react-dom": "^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0",
"rimraf": "^2.5.0",

@@ -78,4 +78,4 @@ "webpack": "^3.4.1"

"peerDependencies": {
"react": "^16.0.0-0 || ^17.0.0-0"
"react": "^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"
}
}

@@ -9,10 +9,11 @@ React-portal

⚠️️ **V4+ works only with React v16+**. For V3 documentation, go [here](READMEv3.MD). ️⚠️
*Looking for v3 documentation? Go [here](READMEv3.MD).*
## Features
- **uses React v16 and its official API for creating portals**
- **has a fallback for React v15**
- transports its children into a new React Portal which is appended by default to **document.body**
- can target user specified DOM element
- supports server-side rendering
- **uses React v16 and its official API for creating portals**
- supports returning arrays (no wrapper divs needed)

@@ -19,0 +20,0 @@ - `<Portal />` and `<PortalWithState />` so there is no compromise between flexibility and convenience

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