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

react-cool-onclickoutside

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cool-onclickoutside - npm Package Compare versions

Comparing version 1.3.3 to 1.3.4

2

dist/index.esm.js

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

import{useRef as n,useEffect as e}from"react";var t=function(n){return document.documentElement.clientWidth<=n.clientX||document.documentElement.clientHeight<=n.clientY},r=function(n){return!(!n.includes("touch")||!function(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return!1;var n=!1,e=Object.defineProperty({},"passive",{get:function(){n=!0}}),t=function(){return null};return window.addEventListener("test",t,e),window.removeEventListener("test",t,e),n}())&&{passive:!0}};export default function(i,o){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=u.disabled,d=void 0!==c&&c,f=u.eventTypes,a=void 0===f?["mousedown","touchstart"]:f,v=u.excludeScrollbar,s=void 0!==v&&v;if("undefined"!=typeof document){var l=n(null);e((function(){l.current=o}),[o]),e((function(){if(i&&l.current){var n=function(n){var e=Array.isArray(i)?i:[i],r=[];e.forEach((function(n){var e=n.current;e&&r.push(e)})),r.length&&(s&&t(n)||r.every((function(e){return!e.contains(n.target)}))&&l.current(n))},e=function(){a.forEach((function(e){document.removeEventListener(e,n,r(e))}))};if(!d)return a.forEach((function(e){document.addEventListener(e,n,r(e))})),function(){e()};e()}}),[i,s,d,a])}}
import{useRef as n,useEffect as e}from"react";var t=function(n){return document.documentElement.clientWidth<=n.clientX||document.documentElement.clientHeight<=n.clientY},r=function(n){return!(!n.includes("touch")||!function(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return!1;var n=!1,e=Object.defineProperty({},"passive",{get:function(){n=!0}}),t=function(){return null};return window.addEventListener("test",t,e),window.removeEventListener("test",t,e),n}())&&{passive:!0}};export default function(i,o){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=u.disabled,d=void 0!==c&&c,f=u.eventTypes,a=void 0===f?["mousedown","touchstart"]:f,v=u.excludeScrollbar,s=void 0!==v&&v,l=n(null);e((function(){l.current=o}),[o]),e((function(){if(i&&l.current){var n=function(n){var e=Array.isArray(i)?i:[i],r=[];e.forEach((function(n){var e=n.current;e&&r.push(e)})),r.length&&(s&&t(n)||r.every((function(e){return!e.contains(n.target)}))&&l.current(n))},e=function(){a.forEach((function(e){document.removeEventListener(e,n,r(e))}))};if(!d)return a.forEach((function(e){document.addEventListener(e,n,r(e))})),function(){e()};e()}}),[i,s,d,a])}

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=function(e){return document.documentElement.clientWidth<=e.clientX||document.documentElement.clientHeight<=e.clientY},t=function(e){return!(!e.includes("touch")||!function(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return!1;var e=!1,n=Object.defineProperty({},"passive",{get:function(){e=!0}}),t=function(){return null};return window.addEventListener("test",t,n),window.removeEventListener("test",t,n),e}())&&{passive:!0}};exports.default=function(r,u){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.disabled,c=void 0!==o&&o,f=i.eventTypes,d=void 0===f?["mousedown","touchstart"]:f,s=i.excludeScrollbar,a=void 0!==s&&s;if("undefined"!=typeof document){var v=e.useRef(null);e.useEffect((function(){v.current=u}),[u]),e.useEffect((function(){if(r&&v.current){var e=function(e){var t=Array.isArray(r)?r:[r],u=[];t.forEach((function(e){var n=e.current;n&&u.push(n)})),u.length&&(a&&n(e)||u.every((function(n){return!n.contains(e.target)}))&&v.current(e))},u=function(){d.forEach((function(n){document.removeEventListener(n,e,t(n))}))};if(!c)return d.forEach((function(n){document.addEventListener(n,e,t(n))})),function(){u()};u()}}),[r,a,c,d])}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=function(e){return document.documentElement.clientWidth<=e.clientX||document.documentElement.clientHeight<=e.clientY},t=function(e){return!(!e.includes("touch")||!function(){if("undefined"==typeof window||"function"!=typeof window.addEventListener)return!1;var e=!1,n=Object.defineProperty({},"passive",{get:function(){e=!0}}),t=function(){return null};return window.addEventListener("test",t,n),window.removeEventListener("test",t,n),e}())&&{passive:!0}};exports.default=function(r,u){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=i.disabled,c=void 0!==o&&o,f=i.eventTypes,d=void 0===f?["mousedown","touchstart"]:f,s=i.excludeScrollbar,a=void 0!==s&&s,v=e.useRef(null);e.useEffect((function(){v.current=u}),[u]),e.useEffect((function(){if(r&&v.current){var e=function(e){var t=Array.isArray(r)?r:[r],u=[];t.forEach((function(e){var n=e.current;n&&u.push(n)})),u.length&&(a&&n(e)||u.every((function(n){return!n.contains(e.target)}))&&v.current(e))},u=function(){d.forEach((function(n){document.removeEventListener(n,e,t(n))}))};if(!c)return d.forEach((function(n){document.addEventListener(n,e,t(n))})),function(){u()};u()}}),[r,a,c,d])};
{
"name": "react-cool-onclickoutside",
"version": "1.3.3",
"version": "1.3.4",
"description": "React hook to listen for clicks outside of the component(s).",

@@ -104,2 +104,3 @@ "license": "MIT",

"plugin:@typescript-eslint/recommended",
"plugin:testing-library/recommended",
"plugin:prettier/recommended",

@@ -225,3 +226,3 @@ "prettier/@typescript-eslint",

"eslint-plugin-react-hooks": "^2.5.0",
"eslint-plugin-testing-library": "^2.2.3",
"eslint-plugin-testing-library": "^3.0.0",
"husky": "^4.2.3",

@@ -232,3 +233,3 @@ "jest": "^25.1.0",

"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"prettier": "^2.0.1",
"react": "^16.13.1",

@@ -235,0 +236,0 @@ "react-dom": "^16.13.1",

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