Socket
Socket
Sign inDemoInstall

react-onclickoutside

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-onclickoutside - npm Package Compare versions

Comparing version 6.9.0 to 6.9.1

2

dist/react-onclickoutside.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t(e.onClickOutside={},e.React,e.ReactDOM)}(this,function(e,t,n){"use strict";function o(e,t,n){return e===t||(e.correspondingElement?e.correspondingElement.classList.contains(n):e.classList.contains(n))}function i(e,t){var n=null;return-1!==l.indexOf(t)&&r&&(n={passive:!e.props.preventDefault}),n}var r,c=function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),n=function(){};return window.addEventListener("testPassiveEventSupport",n,t),window.removeEventListener("testPassiveEventSupport",n,t),e}},s=function(e){return void 0===e&&(e=0),function(){return++e}}(),u={},d={},l=["touchstart","touchmove"],a="ignore-react-onclickoutside";e.IGNORE_CLASS_NAME=a,e.default=function(e,l){var p,f,O=e.displayName||e.name||"Component";return f=p=function(a){function p(e){var t;return t=a.call(this,e)||this,t.__outsideClickHandler=function(e){if("function"!=typeof t.__clickOutsideHandlerProp){var n=t.getInstance();if("function"!=typeof n.props.handleClickOutside){if("function"!=typeof n.handleClickOutside)throw Error("WrappedComponent: "+O+" lacks a handleClickOutside(event) function for processing outside click events.");n.handleClickOutside(e)}else n.props.handleClickOutside(e)}else t.__clickOutsideHandlerProp(e)},t.__getComponentNode=function(){var e=t.getInstance();return l&&"function"==typeof l.setClickOutsideRef?l.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():n.findDOMNode(e)},t.enableOnClickOutside=function(){if("undefined"!=typeof document&&!d[t._uid]){void 0===r&&(r=c()),d[t._uid]=!0;var e=t.props.eventTypes;e.forEach||(e=[e]),u[t._uid]=function(e){null===t.componentNode||(t.props.preventDefault&&e.preventDefault(),t.props.stopPropagation&&e.stopPropagation(),t.props.excludeScrollbar&&function(e){return document.documentElement.clientWidth<=e.clientX||document.documentElement.clientHeight<=e.clientY}(e))||function(e,t,n){if(e===t)return!0;for(;e.parentNode;){if(o(e,t,n))return!0;e=e.parentNode}return e}(e.target,t.componentNode,t.props.outsideClickIgnoreClass)===document&&t.__outsideClickHandler(e)},e.forEach(function(e){document.addEventListener(e,u[t._uid],i(t,e))})}},t.disableOnClickOutside=function(){delete d[t._uid];var e=u[t._uid];if(e&&"undefined"!=typeof document){var n=t.props.eventTypes;n.forEach||(n=[n]),n.forEach(function(n){return document.removeEventListener(n,e,i(t,n))}),delete u[t._uid]}},t.getRef=function(e){return t.instanceRef=e},t._uid=s(),t}!function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}(p,a);var f=p.prototype;return f.getInstance=function(){if(!e.prototype.isReactComponent)return this;var t=this.instanceRef;return t.getInstance?t.getInstance():t},f.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(l&&"function"==typeof l.handleClickOutside&&(this.__clickOutsideHandlerProp=l.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw Error("WrappedComponent: "+O+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},f.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},f.componentWillUnmount=function(){this.disableOnClickOutside()},f.render=function(){var n=this.props,o=function(e,t){if(null==e)return{};var n,o,i={},r=Object.keys(e);for(o=0;r.length>o;o++)0>t.indexOf(n=r[o])&&(i[n]=e[n]);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;c.length>o;o++)0>t.indexOf(n=c[o])&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(n,["excludeScrollbar"]);return e.prototype.isReactComponent?o.ref=this.getRef:o.wrappedRef=this.getRef,o.disableOnClickOutside=this.disableOnClickOutside,o.enableOnClickOutside=this.enableOnClickOutside,t.createElement(e,o)},p}(t.Component),p.displayName="OnClickOutside("+O+")",p.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:l&&l.excludeScrollbar||!1,outsideClickIgnoreClass:a,preventDefault:!1,stopPropagation:!1},p.getClass=function(){return e.getClass?e.getClass():e},f},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t(e.onClickOutside={},e.React,e.ReactDOM)}(this,function(e,s,u){"use strict";var t,d,a=(void 0===t&&(t=0),function(){return++t}),l={},p={},o=["touchstart","touchmove"],n="ignore-react-onclickoutside";function f(e,t){var n=null;return!!~o.indexOf(t)&&d&&(n={passive:!e.props.preventDefault}),n}e.IGNORE_CLASS_NAME=n,e.default=function(i,r){var e,c=i.displayName||i.name||"Component",t=e=function(t){var e;function n(e){var n=t.call(this,e)||this;return n.__outsideClickHandler=function(e){if("function"!=typeof n.__clickOutsideHandlerProp){var t=n.getInstance();if("function"!=typeof t.props.handleClickOutside){if("function"!=typeof t.handleClickOutside)throw Error("WrappedComponent: "+c+" lacks a handleClickOutside(event) function for processing outside click events.");t.handleClickOutside(e)}else t.props.handleClickOutside(e)}else n.__clickOutsideHandlerProp(e)},n.__getComponentNode=function(){var e=n.getInstance();return r&&"function"==typeof r.setClickOutsideRef?r.setClickOutsideRef()(e):"function"==typeof e.setClickOutsideRef?e.setClickOutsideRef():u.findDOMNode(e)},n.enableOnClickOutside=function(){var e;"undefined"==typeof document||p[n._uid]||(void 0===d&&(d=function(){if("undefined"!=typeof window&&"function"==typeof window.addEventListener){var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}}),n=function(){};return window.addEventListener("testPassiveEventSupport",n,t),window.removeEventListener("testPassiveEventSupport",n,t),e}}()),p[n._uid]=!0,(e=n.props.eventTypes).forEach||(e=[e]),l[n._uid]=function(e){var t;null!==n.componentNode&&(n.props.preventDefault&&e.preventDefault(),n.props.stopPropagation&&e.stopPropagation(),n.props.excludeScrollbar&&(t=e,document.documentElement.clientWidth<=t.clientX||document.documentElement.clientHeight<=t.clientY)||function(e,t,n){if(e===t)return!0;for(;e.parentNode;){if(i=n,(o=e)===t||(o.correspondingElement||o).classList.contains(i))return!0;e=e.parentNode}var o,i;return e}(e.target,n.componentNode,n.props.outsideClickIgnoreClass)!==document||n.__outsideClickHandler(e))},e.forEach(function(e){document.addEventListener(e,l[n._uid],f(n,e))}))},n.disableOnClickOutside=function(){delete p[n._uid];var e,t=l[n._uid];t&&"undefined"!=typeof document&&((e=n.props.eventTypes).forEach||(e=[e]),e.forEach(function(e){return document.removeEventListener(e,t,f(n,e))}),delete l[n._uid])},n.getRef=function(e){return n.instanceRef=e},n._uid=a(),n}(e=n).prototype=Object.create((o=t).prototype),(e.prototype.constructor=e).__proto__=o;var o=n.prototype;return o.getInstance=function(){if(!i.prototype.isReactComponent)return this;var e=this.instanceRef;return e.getInstance?e.getInstance():e},o.componentDidMount=function(){if("undefined"!=typeof document&&document.createElement){var e=this.getInstance();if(r&&"function"==typeof r.handleClickOutside&&(this.__clickOutsideHandlerProp=r.handleClickOutside(e),"function"!=typeof this.__clickOutsideHandlerProp))throw Error("WrappedComponent: "+c+" lacks a function for processing outside click events specified by the handleClickOutside config option.");this.componentNode=this.__getComponentNode(),this.props.disableOnClickOutside||this.enableOnClickOutside()}},o.componentDidUpdate=function(){this.componentNode=this.__getComponentNode()},o.componentWillUnmount=function(){this.disableOnClickOutside()},o.render=function(){var e=this.props,e=function(e,t){if(null==e)return{};var n,o={},i=Object.keys(e);for(c=0;c<i.length;c++)~t.indexOf(n=i[c])||(o[n]=e[n]);if(Object.getOwnPropertySymbols)for(var r=Object.getOwnPropertySymbols(e),c=0;c<r.length;c++)~t.indexOf(n=r[c])||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,["excludeScrollbar"]);return i.prototype.isReactComponent?e.ref=this.getRef:e.wrappedRef=this.getRef,e.disableOnClickOutside=this.disableOnClickOutside,e.enableOnClickOutside=this.enableOnClickOutside,s.createElement(i,e)},n}(s.Component);return e.displayName="OnClickOutside("+c+")",e.defaultProps={eventTypes:["mousedown","touchstart"],excludeScrollbar:r&&r.excludeScrollbar||!1,outsideClickIgnoreClass:n,preventDefault:!1,stopPropagation:!1},e.getClass=function(){return i.getClass?i.getClass():i},t},Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "react-onclickoutside",
"version": "6.9.0",
"version": "6.9.1",
"description": "An onClickOutside wrapper for React components",

@@ -17,2 +17,6 @@ "main": "dist/react-onclickoutside.cjs.js",

],
"funding": {
"type": "individual",
"url": "https://www.paypal.com/donate/?cmd=_s-xclick&hosted_button_id=QPRDLNGDANJSW"
},
"keywords": [

@@ -19,0 +23,0 @@ "react",

@@ -7,2 +7,11 @@ [![npm version](https://img.shields.io/npm/v/react-onclickoutside.svg)](https://www.npmjs.com/package/react-onclickoutside)

:warning:
This package needs your support to stay maintained. If you work for an organization
whose website is better off using react-onclickoutside than rolling its own code
solution, please consider talking to your manager to help
[fund this project](https://www.paypal.com/donate/?cmd=_s-xclick&hosted_button_id=QPRDLNGDANJSW).
Open Source is free to use, but certainly not free to develop. If you have the
means to reward those whose work you rely on, please consider doing so.
:warning:
This is a React Higher Order Component (HOC) that you can use with your own

@@ -9,0 +18,0 @@ React components if you want to have them listen for clicks that occur somewhere

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