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.1.0 to 1.1.1

2

dist/index.esm.js

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

import{useRef as e,useCallback as n,useEffect as t}from"react";var o=function(e){return document.documentElement.clientWidth<=e.clientX||document.documentElement.clientHeight<=e.clientY},i=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}};export default function(r){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},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&&document.createElement){var l=e([]),m=n((function(e){e&&l.current.push(e)}),[]),p=n((function(e){var n=l.current;n.length&&r&&(s&&o(e)||n.every((function(n){return!n.contains(e.target)}))&&r(e))}),[s,r]);return t((function(){if(r){var e=function(){a.forEach((function(e){document.removeEventListener(e,p,i(e))}))};if(!d)return a.forEach((function(e){document.addEventListener(e,p,i(e))})),function(){e()};e()}}),[r,d,a,p]),m}}
import{useRef as e,useCallback as n,useEffect as t}from"react";var o=function(e){return document.documentElement.clientWidth<=e.clientX||document.documentElement.clientHeight<=e.clientY},i=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}};export default function(r){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},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&&document.createElement){var l=e([]),m=n((function(e){e&&l.current.push(e)}),[]);return t((function(){if(r){var e=function(e){var n=l.current;n.length&&(!e.touches&&s&&o(e)||n.every((function(n){return!n.contains(e.target)}))&&r(e))},n=function(){a.forEach((function(n){document.removeEventListener(n,e,i(n))}))};if(!d)return a.forEach((function(n){document.addEventListener(n,e,i(n))})),function(){n()};n()}}),[r,s,d,a]),m}}

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

"use strict";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}};module.exports=function(u){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.disabled,o=void 0!==r&&r,c=i.eventTypes,d=void 0===c?["mousedown","touchstart"]:c,f=i.excludeScrollbar,s=void 0!==f&&f;if("undefined"!=typeof document&&document.createElement){var a=e.useRef([]),l=e.useCallback((function(e){e&&a.current.push(e)}),[]),v=e.useCallback((function(e){var t=a.current;t.length&&u&&(s&&n(e)||t.every((function(n){return!n.contains(e.target)}))&&u(e))}),[s,u]);return e.useEffect((function(){if(u){var e=function(){d.forEach((function(e){document.removeEventListener(e,v,t(e))}))};if(!o)return d.forEach((function(e){document.addEventListener(e,v,t(e))})),function(){e()};e()}}),[u,o,d,v]),l}};
"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){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=u.disabled,i=void 0!==o&&o,c=u.eventTypes,d=void 0===c?["mousedown","touchstart"]:c,f=u.excludeScrollbar,s=void 0!==f&&f;if("undefined"!=typeof document&&document.createElement){var a=e.useRef([]),v=e.useCallback((function(e){e&&a.current.push(e)}),[]);return e.useEffect((function(){if(r){var e=function(e){var t=a.current;t.length&&(!e.touches&&s&&n(e)||t.every((function(n){return!n.contains(e.target)}))&&r(e))},u=function(){d.forEach((function(n){document.removeEventListener(n,e,t(n))}))};if(!i)return d.forEach((function(n){document.addEventListener(n,e,t(n))})),function(){u()};u()}}),[r,s,i,d]),v}};
{
"name": "react-cool-onclickoutside",
"version": "1.1.0",
"version": "1.1.1",
"description": "React hook to listen for clicks outside of the component(s).",

@@ -47,4 +47,4 @@ "license": "MIT",

"test": "jest",
"test:watch": "yarn test --watch",
"test:cov": "yarn clean:cov && yarn test --coverage",
"test:watch": "yarn test --watch",
"build:demo": "yarn clean:dev && yarn clean:demo && rollup -c rollup/config.js --environment BUILD:demo",

@@ -55,4 +55,4 @@ "build:dist": "yarn clean:dist && BABEL_ENV=dist rollup -c rollup/config.js --environment BUILD:dist",

"postversion": "git push --follow-tags --no-verify && npm publish && yarn clean:dist",
"clean:dev": "rimraf src/.dev",
"clean:demo": "rimraf demo",
"clean:dev": "rimraf demo/.dev",
"clean:demo": "rimraf public",
"clean:dist": "rimraf dist .size-snapshot.json",

@@ -156,7 +156,8 @@ "clean:cov": "rimraf coverage",

],
"@typescript-eslint/ban-ts-ignore": "off"
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/no-explicit-any": "off"
}
},
"eslintIgnore": [
"demo",
"public",
"dist"

@@ -177,3 +178,3 @@ ],

"ignoreFiles": [
"demo/**/*.css",
"public/**/*.css",
"coverage/**/*.css"

@@ -188,3 +189,4 @@ ]

"collectCoverageFrom": [
"src/useOnclickOutside/*.(ts|tsx)"
"src/*.(ts|tsx)",
"!src/*.d.ts"
]

@@ -191,0 +193,0 @@ },

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