react-click-away-listener
Advanced tools
Comparing version 2.0.0-alpha.1 to 2.0.0-alpha.2
@@ -1,2 +0,2 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib").__importStar(require("react")),t=require("./useMultiRefs"),n=e.forwardRef((function(n,r){var u=n.children,c=n.onClickAway,o=n.mouseEvent,i=void 0===o?"click":o,a=n.touchEvent,d=void 0===a?"touchend":a,l=e.useRef(null),s=e.useRef(null),f=function(e){s.current=e};return e.useEffect((function(){var e=function(e){l.current&&l.current.contains(e.target)||s.current&&s.current.target===e.target||c(e)};return document.addEventListener(i,e),document.addEventListener(d,e),function(){document.removeEventListener(i,e),document.removeEventListener(d,e)}}),[i,c,d]),e.default.cloneElement(u,{ref:t.useMultiRefs([r,l]),onClick:f,onTouchEnd:f})}));n.displayName="ClickawayListener",exports.default=n; | ||
import n,{forwardRef as e,useRef as t,useEffect as r}from"react";var c=e((function(e,c){var o,u=e.children,i=e.onClickAway,a=e.mouseEvent,d=void 0===a?"click":a,l=e.touchEvent,f=void 0===l?"touchend":l,v=t(null),m=t(null),E=function(n){m.current=n};return r((function(){var n=function(n){v.current&&v.current.contains(n.target)||m.current&&m.current.target===n.target||i(n)};return document.addEventListener(d,n),document.addEventListener(f,n),function(){document.removeEventListener(d,n),document.removeEventListener(f,n)}}),[d,i,f]),n.cloneElement(u,{ref:(o=[c,v],function(n){o.forEach((function(e){"function"==typeof e?e(n):null!=e&&(e.current=n)}))}),onClick:E,onTouchEnd:E})}));c.displayName="ClickawayListener";export default c; | ||
//# sourceMappingURL=react-click-away-listener.es.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib").__importStar(require("react")),t=require("./useMultiRefs"),n=e.forwardRef((function(n,r){var u=n.children,c=n.onClickAway,i=n.mouseEvent,o=void 0===i?"click":i,s=n.touchEvent,a=void 0===s?"touchend":s,d=e.useRef(null),l=e.useRef(null),f=function(e){l.current=e};return e.useEffect((function(){var e=function(e){d.current&&d.current.contains(e.target)||l.current&&l.current.target===e.target||c(e)};return document.addEventListener(o,e),document.addEventListener(a,e),function(){document.removeEventListener(o,e),document.removeEventListener(a,e)}}),[o,c,a]),e.default.cloneElement(u,{ref:t.useMultiRefs([r,d]),onClick:f,onTouchEnd:f})}));n.displayName="ClickawayListener",exports.default=n; | ||
"use strict";var e=require("react");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=n(e),r=e.forwardRef((function(n,r){var u,c=n.children,o=n.onClickAway,i=n.mouseEvent,f=void 0===i?"click":i,a=n.touchEvent,d=void 0===a?"touchend":a,l=e.useRef(null),s=e.useRef(null),v=function(e){s.current=e};return e.useEffect((function(){var e=function(e){l.current&&l.current.contains(e.target)||s.current&&s.current.target===e.target||o(e)};return document.addEventListener(f,e),document.addEventListener(d,e),function(){document.removeEventListener(f,e),document.removeEventListener(d,e)}}),[f,o,d]),t.default.cloneElement(c,{ref:(u=[r,l],function(e){u.forEach((function(n){"function"==typeof n?n(e):null!=n&&(n.current=e)}))}),onClick:v,onTouchEnd:v})}));r.displayName="ClickawayListener",module.exports=r; | ||
//# sourceMappingURL=react-click-away-listener.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib").__importStar(require("react")),t=require("./useMultiRefs"),n=e.forwardRef((function(n,r){var u=n.children,i=n.onClickAway,c=n.mouseEvent,o=void 0===c?"click":c,f=n.touchEvent,d=void 0===f?"touchend":f,a=e.useRef(null),s=e.useRef(null),l=function(e){s.current=e};return e.useEffect((function(){var e=function(e){a.current&&a.current.contains(e.target)||s.current&&s.current.target===e.target||i(e)};return document.addEventListener(o,e),document.addEventListener(d,e),function(){document.removeEventListener(o,e),document.removeEventListener(d,e)}}),[o,i,d]),e.default.cloneElement(u,{ref:t.useMultiRefs([r,a]),onClick:l,onTouchEnd:l})}));n.displayName="ClickawayListener",exports.default=n})); | ||
!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),r=e.forwardRef((function(n,r){var o,u=n.children,c=n.onClickAway,i=n.mouseEvent,f=void 0===i?"click":i,a=n.touchEvent,d=void 0===a?"touchend":a,l=e.useRef(null),s=e.useRef(null),v=function(e){s.current=e};return e.useEffect((function(){var e=function(e){l.current&&l.current.contains(e.target)||s.current&&s.current.target===e.target||c(e)};return document.addEventListener(f,e),document.addEventListener(d,e),function(){document.removeEventListener(f,e),document.removeEventListener(d,e)}}),[f,c,d]),t.default.cloneElement(u,{ref:(o=[r,l],function(e){o.forEach((function(n){"function"==typeof n?n(e):null!=n&&(n.current=e)}))}),onClick:v,onTouchEnd:v})}));return r.displayName="ClickawayListener",r})); | ||
//# sourceMappingURL=react-click-away-listener.umd.js.map |
{ | ||
"name": "react-click-away-listener", | ||
"version": "2.0.0-alpha.1", | ||
"version": "2.0.0-alpha.2", | ||
"description": "A simple click away listener built with React Hooks", | ||
@@ -35,2 +35,3 @@ "main": "dist/react-click-away-listener.js", | ||
"@rollup/plugin-babel": "^5.2.0", | ||
"@rollup/plugin-node-resolve": "^11.1.0", | ||
"@rollup/plugin-typescript": "^8.1.0", | ||
@@ -37,0 +38,0 @@ "@testing-library/react": "^9.3.1", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
19344
29
4
28