react-click-away-listener
Advanced tools
Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import React, { FunctionComponent } from 'react'; | ||
declare type MouseEvents = 'click' | 'mousedown' | 'mouseup'; | ||
@@ -10,3 +10,3 @@ declare type TouchEvents = 'touchstart' | 'touchend'; | ||
} | ||
declare const ClickAwayListener: React.ForwardRefExoticComponent<Props & React.RefAttributes<unknown>>; | ||
declare const ClickAwayListener: FunctionComponent<Props>; | ||
export default ClickAwayListener; |
@@ -1,2 +0,2 @@ | ||
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; | ||
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})} | ||
//# 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),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; | ||
"use strict";var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);module.exports=function(t){var r=t.children,u=t.onClickAway,c=t.mouseEvent,o=void 0===c?"click":c,i=t.touchEvent,d=void 0===i?"touchend":i,a=e.useRef(null),f=e.useRef(null),l=function(e){f.current=e};return e.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.default.cloneElement(r,{ref:a,onClick:l,onTouchEnd:l})}; | ||
//# 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),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})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["react-click-away-listener"]=t(e.react)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);return function(t){var r=t.children,u=t.onClickAway,o=t.mouseEvent,c=void 0===o?"click":o,i=t.touchEvent,f=void 0===i?"touchend":i,d=e.useRef(null),a=e.useRef(null),l=function(e){a.current=e};return e.useEffect((function(){var e=function(e){d.current&&d.current.contains(e.target)||a.current&&a.current.target===e.target||u(e)};return document.addEventListener(c,e),document.addEventListener(f,e),function(){document.removeEventListener(c,e),document.removeEventListener(f,e)}}),[c,u,f]),n.default.cloneElement(r,{ref:d,onClick:l,onTouchEnd:l})}})); | ||
//# sourceMappingURL=react-click-away-listener.umd.js.map |
{ | ||
"name": "react-click-away-listener", | ||
"version": "2.0.0-alpha.2", | ||
"version": "2.0.0-alpha.3", | ||
"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
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
16271
27