react-portal
Advanced tools
Comparing version 4.0.0-beta.2 to 4.0.0-beta.3
@@ -43,4 +43,3 @@ 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; }; }(); | ||
if (this.props.closeOnOutsideClick) { | ||
document.addEventListener('mouseup', this.handleOutsideMouseClick); | ||
document.addEventListener('touchstart', this.handleOutsideMouseClick); | ||
document.addEventListener('click', this.handleOutsideMouseClick); | ||
} | ||
@@ -55,4 +54,3 @@ } | ||
if (this.props.closeOnOutsideClick) { | ||
document.removeEventListener('mouseup', this.handleOutsideMouseClick); | ||
document.removeEventListener('touchstart', this.handleOutsideMouseClick); | ||
document.removeEventListener('click', this.handleOutsideMouseClick); | ||
} | ||
@@ -62,3 +60,7 @@ } | ||
key: 'openPortal', | ||
value: function openPortal() { | ||
value: function openPortal(e) { | ||
if (this.state.active) { | ||
return; | ||
} | ||
e.nativeEvent.stopImmediatePropagation(); | ||
this.setState({ active: true }, this.props.onOpen); | ||
@@ -69,2 +71,5 @@ } | ||
value: function closePortal() { | ||
if (!this.state.active) { | ||
return; | ||
} | ||
this.setState({ active: false }, this.props.onClose); | ||
@@ -83,3 +88,3 @@ } | ||
{ | ||
node: this.node, | ||
node: this.props.node, | ||
key: 'react-portal', | ||
@@ -86,0 +91,0 @@ ref: function ref(portalNode) { |
@@ -60,4 +60,3 @@ 'use strict'; | ||
if (this.props.closeOnOutsideClick) { | ||
document.addEventListener('mouseup', this.handleOutsideMouseClick); | ||
document.addEventListener('touchstart', this.handleOutsideMouseClick); | ||
document.addEventListener('click', this.handleOutsideMouseClick); | ||
} | ||
@@ -72,4 +71,3 @@ } | ||
if (this.props.closeOnOutsideClick) { | ||
document.removeEventListener('mouseup', this.handleOutsideMouseClick); | ||
document.removeEventListener('touchstart', this.handleOutsideMouseClick); | ||
document.removeEventListener('click', this.handleOutsideMouseClick); | ||
} | ||
@@ -79,3 +77,7 @@ } | ||
key: 'openPortal', | ||
value: function openPortal() { | ||
value: function openPortal(e) { | ||
if (this.state.active) { | ||
return; | ||
} | ||
e.nativeEvent.stopImmediatePropagation(); | ||
this.setState({ active: true }, this.props.onOpen); | ||
@@ -86,2 +88,5 @@ } | ||
value: function closePortal() { | ||
if (!this.state.active) { | ||
return; | ||
} | ||
this.setState({ active: false }, this.props.onClose); | ||
@@ -100,3 +105,3 @@ } | ||
{ | ||
node: this.node, | ||
node: this.props.node, | ||
key: 'react-portal', | ||
@@ -103,0 +108,0 @@ ref: function ref(portalNode) { |
{ | ||
"name": "react-portal", | ||
"version": "4.0.0-beta.2", | ||
"version": "4.0.0-beta.3", | ||
"description": "To make your life with React Portals easier.", | ||
@@ -8,2 +8,3 @@ "main": "lib/index.js", | ||
"jsnext:main": "es/index.js", | ||
"browserslist": "last 2 versions, ie 11", | ||
"files": [ | ||
@@ -22,6 +23,7 @@ "*.md", | ||
"scripts": { | ||
"build": "npm run build-es && npm run build-cjs", | ||
"build": "npm run clean && npm run build-es && npm run build-cjs", | ||
"build-es": "babel ./src --out-dir ./es", | ||
"build-cjs": "BABEL_ENV=commonjs babel ./src --out-dir ./lib", | ||
"build:examples": "cross-env webpack", | ||
"clean": "rimraf es lib build", | ||
"prepublish": "cross-env NODE_ENV=production npm run build", | ||
@@ -50,13 +52,11 @@ "lint": "eslint webpack.config.js src/**/*.js", | ||
"babel-core": "^6.8.0", | ||
"babel-eslint": "^7.2.3", | ||
"babel-eslint": "^8.0.1", | ||
"babel-loader": "^7.1.1", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-react": "^6.3.13", | ||
"cross-env": "^5.0.1", | ||
"enzyme": "^2.3.0", | ||
"enzyme": "^3.1.0", | ||
"eslint": "^4.3.0", | ||
"eslint-plugin-prettier": "^2.1.2", | ||
"jest": "^20.0.4", | ||
"jest": "^21.2.1", | ||
"prettier": "^1.5.3", | ||
@@ -63,0 +63,0 @@ "react": "^16.0.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
16
372
24230