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

react-click-away-listener

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-click-away-listener - npm Package Compare versions

Comparing version 2.0.3 to 2.0.5-beta.1

2

dist/react-click-away-listener.es.js

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

import n,{useRef as t,useEffect as e,cloneElement as r}from"react";function o(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}var u={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"};export default function(c){var i,a=c.children,d=c.onClickAway,f=c.mouseEvent,v=void 0===f?"click":f,l=c.touchEvent,m=void 0===l?"touchend":l,s=t(null),h=t(null),p=t(!1);e((function(){return setTimeout((function(){p.current=!0}),0),function(){p.current=!1}}),[]);var E=function(n){return function(t){h.current=t.target;var e=null==a?void 0:a.props[n];e&&e(t)}};e((function(){var n=function(n){p.current&&(s.current&&s.current.contains(n.target)||h.current===n.target||!document.contains(n.target)||d(n))};return document.addEventListener(v,n),document.addEventListener(m,n),function(){document.removeEventListener(v,n),document.removeEventListener(m,n)}}),[v,d,m]);var g=u[v],b=u[m];return n.Children.only(r(a,(o(i={ref:function(n){s.current=n;var t=a.ref;"function"==typeof t?t(n):t&&(t.current=n)}},g,E(g)),o(i,b,E(b)),i)))}
import n,{useRef as e,useEffect as t,cloneElement as r}from"react";function o(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}var u={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"},c=function(c){var i,a=c.children,d=c.onClickAway,l=c.mouseEvent,f=void 0===l?"click":l,v=c.touchEvent,s=void 0===v?"touchend":v,m=e(null),p=e(null),h=e(!1);t((function(){return setTimeout((function(){h.current=!0}),0),function(){h.current=!1}}),[]);var E=function(n){return function(e){p.current=e.target;var t=null==a?void 0:a.props[n];t&&t(e)}};t((function(){var n=function(n){h.current&&(m.current&&m.current.contains(n.target)||p.current===n.target||!document.contains(n.target)||d(n))};return document.addEventListener(f,n),document.addEventListener(s,n),function(){document.removeEventListener(f,n),document.removeEventListener(s,n)}}),[f,d,s]);var y=u[f],g=u[s];return n.Children.only(r(a,(o(i={ref:function(n){m.current=n;var e=a.ref;"function"==typeof e?e(n):e&&(e.current=n)}},y,E(y)),o(i,g,E(g)),i)))};c.displayName="ClickAwayListener";export default c;
//# sourceMappingURL=react-click-away-listener.es.js.map

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

"use strict";var e=require("react");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=n(e);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var u={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"};module.exports=function(n){var o,c=n.children,i=n.onClickAway,f=n.mouseEvent,a=void 0===f?"click":f,d=n.touchEvent,l=void 0===d?"touchend":d,s=e.useRef(null),v=e.useRef(null),m=e.useRef(!1);e.useEffect((function(){return setTimeout((function(){m.current=!0}),0),function(){m.current=!1}}),[]);var E=function(e){return function(n){v.current=n.target;var t=null==c?void 0:c.props[e];t&&t(n)}};e.useEffect((function(){var e=function(e){m.current&&(s.current&&s.current.contains(e.target)||v.current===e.target||!document.contains(e.target)||i(e))};return document.addEventListener(a,e),document.addEventListener(l,e),function(){document.removeEventListener(a,e),document.removeEventListener(l,e)}}),[a,i,l]);var h=u[a],p=u[l];return t.default.Children.only(e.cloneElement(c,(r(o={ref:function(e){s.current=e;var n=c.ref;"function"==typeof n?n(e):n&&(n.current=e)}},h,E(h)),r(o,p,E(p)),o)))};
"use strict";var e=require("react");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=n(e);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var u={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"},o=function(n){var o,c=n.children,i=n.onClickAway,a=n.mouseEvent,f=void 0===a?"click":a,l=n.touchEvent,d=void 0===l?"touchend":l,s=e.useRef(null),v=e.useRef(null),m=e.useRef(!1);e.useEffect((function(){return setTimeout((function(){m.current=!0}),0),function(){m.current=!1}}),[]);var E=function(e){return function(n){v.current=n.target;var t=null==c?void 0:c.props[e];t&&t(n)}};e.useEffect((function(){var e=function(e){m.current&&(s.current&&s.current.contains(e.target)||v.current===e.target||!document.contains(e.target)||i(e))};return document.addEventListener(f,e),document.addEventListener(d,e),function(){document.removeEventListener(f,e),document.removeEventListener(d,e)}}),[f,i,d]);var p=u[f],h=u[d];return t.default.Children.only(e.cloneElement(c,(r(o={ref:function(e){s.current=e;var n=c.ref;"function"==typeof n?n(e):n&&(n.current=e)}},p,E(p)),r(o,h,E(h)),o)))};o.displayName="ClickAwayListener",module.exports=o;
//# sourceMappingURL=react-click-away-listener.js.map

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):(e="undefined"!=typeof globalThis?globalThis:e||self)["react-click-away-listener"]=n(e.react)}(this,(function(e){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=n(e);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var u={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"};return function(n){var o,c=n.children,i=n.onClickAway,f=n.mouseEvent,a=void 0===f?"click":f,d=n.touchEvent,l=void 0===d?"touchend":d,s=e.useRef(null),v=e.useRef(null),m=e.useRef(!1);e.useEffect((function(){return setTimeout((function(){m.current=!0}),0),function(){m.current=!1}}),[]);var p=function(e){return function(n){v.current=n.target;var t=null==c?void 0:c.props[e];t&&t(n)}};e.useEffect((function(){var e=function(e){m.current&&(s.current&&s.current.contains(e.target)||v.current===e.target||!document.contains(e.target)||i(e))};return document.addEventListener(a,e),document.addEventListener(l,e),function(){document.removeEventListener(a,e),document.removeEventListener(l,e)}}),[a,i,l]);var h=u[a],y=u[l];return t.default.Children.only(e.cloneElement(c,(r(o={ref:function(e){s.current=e;var n=c.ref;"function"==typeof n?n(e):n&&(n.current=e)}},h,p(h)),r(o,y,p(y)),o)))}}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("react")):"function"==typeof define&&define.amd?define(["react"],n):(e="undefined"!=typeof globalThis?globalThis:e||self)["react-click-away-listener"]=n(e.react)}(this,(function(e){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=n(e);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var u={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",touchstart:"onTouchStart",touchend:"onTouchEnd"},o=function(n){var o,c=n.children,i=n.onClickAway,f=n.mouseEvent,a=void 0===f?"click":f,d=n.touchEvent,l=void 0===d?"touchend":d,s=e.useRef(null),v=e.useRef(null),m=e.useRef(!1);e.useEffect((function(){return setTimeout((function(){m.current=!0}),0),function(){m.current=!1}}),[]);var p=function(e){return function(n){v.current=n.target;var t=null==c?void 0:c.props[e];t&&t(n)}};e.useEffect((function(){var e=function(e){m.current&&(s.current&&s.current.contains(e.target)||v.current===e.target||!document.contains(e.target)||i(e))};return document.addEventListener(a,e),document.addEventListener(l,e),function(){document.removeEventListener(a,e),document.removeEventListener(l,e)}}),[a,i,l]);var y=u[a],h=u[l];return t.default.Children.only(e.cloneElement(c,(r(o={ref:function(e){s.current=e;var n=c.ref;"function"==typeof n?n(e):n&&(n.current=e)}},y,p(y)),r(o,h,p(h)),o)))};return o.displayName="ClickAwayListener",o}));
//# sourceMappingURL=react-click-away-listener.umd.js.map
{
"name": "react-click-away-listener",
"version": "2.0.3",
"version": "2.0.5-beta.1",
"description": "A simple click away listener built with React Hooks",

@@ -5,0 +5,0 @@ "main": "dist/react-click-away-listener.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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