react-click-away-listener
Advanced tools
Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.1
@@ -1,2 +0,2 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import React from 'react'; | ||
declare type MouseEvents = 'click' | 'mousedown' | 'mouseup'; | ||
@@ -10,3 +10,3 @@ declare type TouchEvents = 'touchstart' | 'touchend'; | ||
} | ||
declare const ClickAwayListener: FunctionComponent<Props>; | ||
declare const ClickAwayListener: React.ForwardRefExoticComponent<Props & React.RefAttributes<unknown>>; | ||
export default ClickAwayListener; |
@@ -1,2 +0,2 @@ | ||
import n,{useRef as e,useEffect as t}from"react";export default function(r){var c=r.children,o=r.onClickAway,u=r.mouseEvent,i=void 0===u?"click":u,d=r.touchEvent,v=void 0===d?"touchend":d,a=e(null),l=e(null),m=function(n){l.current=n};return t((function(){var n=function(n){a.current&&a.current.contains(n.target)||l.current&&l.current.target===n.target||o(n)};return document.addEventListener(i,n),document.addEventListener(v,n),function(){document.removeEventListener(i,n),document.removeEventListener(v,n)}}),[i,o,v]),n.cloneElement(c,{ref:a,onClick:m,onTouchEnd:m})} | ||
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; | ||
//# sourceMappingURL=react-click-away-listener.es.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;module.exports=function(e){var r=e.children,u=e.onClickAway,c=e.mouseEvent,o=void 0===c?"click":c,i=e.touchEvent,d=void 0===i?"touchend":i,a=t.useRef(null),f=t.useRef(null),l=function(e){f.current=e};return t.useEffect((function(){var e=function(e){a.current&&a.current.contains(e.target)||f.current&&f.current.target===e.target||u(e)};return document.addEventListener(o,e),document.addEventListener(d,e),function(){document.removeEventListener(o,e),document.removeEventListener(d,e)}}),[o,u,d]),n.cloneElement(r,{ref:a,onClick:l,onTouchEnd:l})}; | ||
"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; | ||
//# 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=e||self)["react-click-away-listener"]=n(e.react)}(this,(function(e){"use strict";var n="default"in e?e.default:e;return function(t){var r=t.children,c=t.onClickAway,u=t.mouseEvent,o=void 0===u?"click":u,i=t.touchEvent,d=void 0===i?"touchend":i,f=e.useRef(null),a=e.useRef(null),l=function(e){a.current=e};return e.useEffect((function(){var e=function(e){f.current&&f.current.contains(e.target)||a.current&&a.current.target===e.target||c(e)};return document.addEventListener(o,e),document.addEventListener(d,e),function(){document.removeEventListener(o,e),document.removeEventListener(d,e)}}),[o,c,d]),n.cloneElement(r,{ref:f,onClick:l,onTouchEnd:l})}})); | ||
!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})); | ||
//# sourceMappingURL=react-click-away-listener.umd.js.map |
{ | ||
"name": "react-click-away-listener", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0-alpha.1", | ||
"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-typescript": "^8.1.0", | ||
"@testing-library/react": "^9.3.1", | ||
@@ -55,3 +56,3 @@ "@types/jest": "^24.0.21", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^1.26.3", | ||
"rollup": "^2.38.0", | ||
"rollup-plugin-terser": "^7.0.0", | ||
@@ -58,0 +59,0 @@ "typescript": "^3.6.4" |
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
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
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
17404
11
28
27
5