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

react-disposable-modal

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-disposable-modal - npm Package Compare versions

Comparing version 0.3.1 to 0.3.5

91

lib/disposable-modal.js

@@ -6,41 +6,42 @@ "use strict";

});
exports.Modal = undefined;
exports.createCancelableModal = createCancelableModal;
exports.createDisposableModal = createDisposableModal;
exports.Modal = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = _interopRequireDefault(require("react"));
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; }; }();
var _reactDom = _interopRequireDefault(require("react-dom"));
exports.createCancelableModal = createCancelableModal;
exports.createDisposableModal = createDisposableModal;
var _reactDisposableDecorator = _interopRequireDefault(require("react-disposable-decorator"));
var _react = require("react");
var _disposableComponent = _interopRequireDefault(require("disposable-component"));
var _react2 = _interopRequireDefault(_react);
var _rx = _interopRequireDefault(require("disposable-component/lib/rx6"));
var _reactDom = require("react-dom");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _reactDom2 = _interopRequireDefault(_reactDom);
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _reactDisposableDecorator = require("react-disposable-decorator");
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _reactDisposableDecorator2 = _interopRequireDefault(_reactDisposableDecorator);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _disposableComponent = require("disposable-component");
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); } }
var _disposableComponent2 = _interopRequireDefault(_disposableComponent);
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var _rx = require("disposable-component/lib/rx6");
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
var _rx2 = _interopRequireDefault(_rx);
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
// stateless functional components were not working correctly, so I had to make a very thin component to get state/prop changes to propagate correctly to children components
var _Portal = function (_React$Component) {
var _Portal =
/*#__PURE__*/
function (_React$Component) {
_inherits(_Portal, _React$Component);

@@ -51,3 +52,3 @@

return _possibleConstructorReturn(this, (_Portal.__proto__ || Object.getPrototypeOf(_Portal)).apply(this, arguments));
return _possibleConstructorReturn(this, _getPrototypeOf(_Portal).apply(this, arguments));
}

@@ -58,7 +59,3 @@

value: function render() {
return _react2.default.createElement(
"span",
null,
this.props.children
);
return _react.default.createElement("span", null, this.props.children);
}

@@ -68,5 +65,7 @@ }]);

return _Portal;
}(_react2.default.Component);
}(_react.default.Component);
var _Modal = function (_React$Component2) {
var _Modal =
/*#__PURE__*/
function (_React$Component2) {
_inherits(_Modal, _React$Component2);

@@ -77,3 +76,3 @@

return _possibleConstructorReturn(this, (_Modal.__proto__ || Object.getPrototypeOf(_Modal)).apply(this, arguments));
return _possibleConstructorReturn(this, _getPrototypeOf(_Modal).apply(this, arguments));
}

@@ -85,3 +84,3 @@

// renderPortal() if < React16 for inital render
if (!_reactDom2.default.createPortal) this.renderPortal();
if (!_reactDom.default.createPortal) this.renderPortal();
}

@@ -92,3 +91,3 @@ }, {

// renderPortal() if < React16 so that state/prop changes are reflected in the DOM
if (!_reactDom2.default.createPortal) this.renderPortal();
if (!_reactDom.default.createPortal) this.renderPortal();
}

@@ -109,3 +108,3 @@ }, {

value: function render() {
if (!_reactDom2.default.createPortal) return null;
if (!_reactDom.default.createPortal) return null;

@@ -117,3 +116,4 @@ if (!this.parentContainer) {

}
return _reactDom2.default.createPortal(this.props.children, this.parentContainer);
return _reactDom.default.createPortal(this.props.children, this.parentContainer);
}

@@ -131,5 +131,6 @@ }, {

return _Modal;
}(_react2.default.Component);
}(_react.default.Component);
var Modal = exports.Modal = (0, _reactDisposableDecorator2.default)(_Modal);
var Modal = (0, _reactDisposableDecorator.default)(_Modal);
exports.Modal = Modal;

@@ -139,4 +140,3 @@ function createCancelableModal(El) {

var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
return (0, _disposableComponent2.default)(function (onNext, onCompleted, onError) {
return (0, _disposableComponent.default)(function (onNext, onCompleted, onError) {
if (!parent) {

@@ -146,3 +146,4 @@ parent = document.createElement("div");

}
_reactDom2.default.render(_react2.default.createElement(El, _extends({}, props, {
_reactDom.default.render(_react.default.createElement(El, _extends({}, props, {
onCompleted: onCompleted,

@@ -153,5 +154,5 @@ onNext: onNext,

}, function () {
_reactDom2.default.unmountComponentAtNode(parent);
_reactDom.default.unmountComponentAtNode(parent); // React15 calls this multiple times, so while it's safe to do the above function, we have to check parent.parentNode or it crashes
// React15 calls this multiple times, so while it's safe to do the above function, we have to check parent.parentNode or it crashes
if (parent.parentNode) parent.parentNode.removeChild(parent);

@@ -164,4 +165,3 @@ });

var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
return (0, _rx2.default)(function (next, complete, error) {
return (0, _rx.default)(function (next, complete, error) {
if (!parent) {

@@ -171,3 +171,4 @@ parent = document.createElement("div");

}
_reactDom2.default.render(_react2.default.createElement(El, _extends({}, props, {
_reactDom.default.render(_react.default.createElement(El, _extends({}, props, {
onCompleted: complete,

@@ -178,3 +179,3 @@ onNext: next,

}, function () {
_reactDom2.default.unmountComponentAtNode(parent);
_reactDom.default.unmountComponentAtNode(parent);

@@ -181,0 +182,0 @@ if (parent.parentNode) parent.parentNode.removeChild(parent);

{
"name": "react-disposable-modal",
"version": "0.3.1",
"version": "0.3.5",
"description": "React-disposable-modal is a reactive API for building modal components in React.",

@@ -11,16 +11,15 @@ "main": "lib/disposable-modal.js",

"prepublish": "npm run build",
"build": "babel src --out-dir lib --source-maps",
"test": "jest --coverage --config ./jest.json",
"test-watch": "jest --watch --config ./jest.json"
"build": "babel src --out-dir lib --source-maps"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1"
"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.5",
"@babel/preset-env": "^7.1.5",
"@babel/preset-react": "^7.0.0"
},
"dependencies": {
"disposable-component": "^0.3.1",
"react": "^16.2.0",
"react-disposable-decorator": "^2.1.0",
"react-dom": "^16.2.0",
"react": "^16.6.3",
"react-disposable-decorator": "^4.0.0",
"react-dom": "^16.6.3",
"rx": "^4.1.0"

@@ -27,0 +26,0 @@ },

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