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

react-outer-click

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-outer-click - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

129

lib/OuterClick.js

@@ -1,48 +0,120 @@

"use strict";
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
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 PropTypes = _interopDefault(require('prop-types'));
var React = _interopDefault(require('react'));
var reactDom = require('react-dom');
var _propTypes = require("prop-types");
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var _propTypes2 = _interopRequireDefault(_propTypes);
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 _react = require("react");
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _react2 = _interopRequireDefault(_react);
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
var _reactDom = require("react-dom");
return obj;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as 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 _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
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; }
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
var OuterClick = function (_React$Component) {
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
var OuterClick =
/*#__PURE__*/
function (_React$Component) {
_inherits(OuterClick, _React$Component);
function OuterClick() {
var _ref;
var _getPrototypeOf2;
var _temp, _this, _ret;
var _this;
_classCallCheck(this, OuterClick);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = OuterClick.__proto__ || Object.getPrototypeOf(OuterClick)).call.apply(_ref, [this].concat(args))), _this), _this.handleClickOutside = function (event) {
var node = (0, _reactDom.findDOMNode)(_this);
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(OuterClick)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_this), "handleClickOutside", function (event) {
var node = reactDom.findDOMNode(_assertThisInitialized(_this));
if (node && node !== event.target && !node.contains(event.target)) {
_this.props.onOuterClick(event);
}
}, _temp), _possibleConstructorReturn(_this, _ret);
});
return _this;
}

@@ -63,3 +135,3 @@

value: function render() {
return _react2.default.Children.only(this.props.children);
return React.Children.only(this.props.children);
}

@@ -69,8 +141,9 @@ }]);

return OuterClick;
}(_react2.default.Component);
}(React.Component);
OuterClick.propTypes = {
children: _propTypes2.default.element.isRequired,
onOuterClick: _propTypes2.default.func.isRequired
};
exports.default = OuterClick;
_defineProperty(OuterClick, "propTypes", {
children: PropTypes.element.isRequired,
onOuterClick: PropTypes.func.isRequired
});
module.exports = OuterClick;
{
"name": "react-outer-click",
"version": "1.0.1",
"version": "1.0.2",
"description": "React component which detect mouse clicks outside of itself.",

@@ -10,5 +10,5 @@ "main": "lib/OuterClick.js",

"scripts": {
"build": "babel --out-dir lib src",
"build": "rollup -c",
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "npm run build"
"prepare": "npm run build"
},

@@ -40,6 +40,17 @@ "repository": {

"devDependencies": {
"babel-cli": "^6.24.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-es2015": "^6.24.1"
"@babel/core": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"husky": "^2.3.0",
"lint-staged": "^8.1.7",
"prettier": "^1.17.1",
"rollup": "^1.13.1",
"rollup-plugin-babel": "^4.3.2"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}

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