react-click-away-listener
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -1,2 +0,2 @@ | ||
var e=function(){return(e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(exports,"__esModule",{value:!0});var r=n(require("react"));exports.default=function(n){var o=n.onClickAway,c=n.mouseEvent,u=void 0===c?"click":c,i=n.touchEvent,a=void 0===i?"touchend":i,l=n.children,f=t(n,["onClickAway","mouseEvent","touchEvent","children"]),v=r.useRef(null);return r.useEffect((function(){var e=function(e){v.current&&v.current.contains(e.target)||o(e)};return document.addEventListener(u,e),document.addEventListener(a,e),function(){document.removeEventListener(u,e),document.removeEventListener(a,e)}}),[u,o,a]),r.default.createElement("div",e({ref:v},f),l)}; | ||
import e,{useRef as t,useEffect as n}from"react";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}export default function(c){var u=c.onClickAway,i=c.mouseEvent,l=void 0===i?"click":i,a=c.touchEvent,v=void 0===a?"touchend":a,f=c.children,d=o(c,["onClickAway","mouseEvent","touchEvent","children"]),s=t(null);return n((function(){var e=function(e){s.current&&s.current.contains(e.target)||u(e)};return document.addEventListener(l,e),document.addEventListener(v,e),function(){document.removeEventListener(l,e),document.removeEventListener(v,e)}}),[l,u,v]),e.createElement("div",r({ref:s},d),f)} | ||
//# sourceMappingURL=react-click-away-listener.es.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var __assign=function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},__importStar=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(exports,"__esModule",{value:!0});var react_1=__importStar(require("react")),ClickAwayListener=function(e){var t=e.onClickAway,r=e.mouseEvent,n=void 0===r?"click":r,o=e.touchEvent,c=void 0===o?"touchend":o,a=e.children,i=__rest(e,["onClickAway","mouseEvent","touchEvent","children"]),u=react_1.useRef(null);return react_1.useEffect((function(){var e=function(e){u.current&&u.current.contains(e.target)||t(e)};return document.addEventListener(n,e),document.addEventListener(c,e),function(){document.removeEventListener(n,e),document.removeEventListener(c,e)}}),[n,t,c]),react_1.default.createElement("div",__assign({ref:u},i),a)};exports.default=ClickAwayListener; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var React=require("react"),React__default=_interopDefault(React);function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}function _objectWithoutProperties(e,t){if(null==e)return{};var n,r,o=_objectWithoutPropertiesLoose(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var ClickAwayListener=function(e){var t=e.onClickAway,n=e.mouseEvent,r=void 0===n?"click":n,o=e.touchEvent,c=void 0===o?"touchend":o,u=e.children,i=_objectWithoutProperties(e,["onClickAway","mouseEvent","touchEvent","children"]),a=React.useRef(null);return React.useEffect((function(){var e=function(e){a.current&&a.current.contains(e.target)||t(e)};return document.addEventListener(r,e),document.addEventListener(c,e),function(){document.removeEventListener(r,e),document.removeEventListener(c,e)}}),[r,t,c]),React__default.createElement("div",_extends({ref:a},i),u)};module.exports=ClickAwayListener; | ||
//# sourceMappingURL=react-click-away-listener.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(exports,"__esModule",{value:!0});var r=n(require("react"));exports.default=function(n){var o=n.onClickAway,c=n.mouseEvent,u=void 0===c?"click":c,i=n.touchEvent,f=void 0===i?"touchend":i,a=n.children,l=t(n,["onClickAway","mouseEvent","touchEvent","children"]),d=r.useRef(null);return r.useEffect((function(){var e=function(e){d.current&&d.current.contains(e.target)||o(e)};return document.addEventListener(u,e),document.addEventListener(f,e),function(){document.removeEventListener(u,e),document.removeEventListener(f,e)}}),[u,o,f]),r.default.createElement("div",e({ref:d},l),a)}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self)["react-click-away-listener"]=t(e.react)}(this,(function(e){"use strict";var t="default"in e?e.default:e;function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function r(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}return function(o){var c=o.onClickAway,u=o.mouseEvent,i=void 0===u?"click":u,f=o.touchEvent,a=void 0===f?"touchend":f,l=o.children,d=r(o,["onClickAway","mouseEvent","touchEvent","children"]),s=e.useRef(null);return e.useEffect((function(){var e=function(e){s.current&&s.current.contains(e.target)||c(e)};return document.addEventListener(i,e),document.addEventListener(a,e),function(){document.removeEventListener(i,e),document.removeEventListener(a,e)}}),[i,c,a]),t.createElement("div",n({ref:s},d),l)}})); | ||
//# sourceMappingURL=react-click-away-listener.umd.js.map |
{ | ||
"name": "react-click-away-listener", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A simple click away listener built with React Hooks", | ||
"main": "dist/react-click-away-listener.js", | ||
"module": "dist/react-click-away-listener.es.js", | ||
"types": "build/index.d.ts", | ||
"types": "dist/index.d.ts", | ||
"umd": "dist/react-click-away-listener.umd.js", | ||
@@ -13,11 +13,13 @@ "scripts": { | ||
"coverage": "jest --coverage", | ||
"build-tsc": "tsc -w", | ||
"prepublish": "npm run build", | ||
"build": "tsc && rollup -c rollup.config.js", | ||
"build:rollup": "rollup -c rollup.config.js", | ||
"build:declaration": "tsc", | ||
"cleanup": "rimraf dist", | ||
"build": "npm run cleanup && npm-run-all build:*", | ||
"report-coverage": "cat ./coverage/lcov.info | codecov", | ||
"prettier": "prettier --write '{src,__tests__}/*.tsx'" | ||
"prettier": "prettier --write '{src,__tests__}/*.tsx'", | ||
"print-file-size": "cat dist/react-click-away-listener.js | gzip | wc -c" | ||
}, | ||
"files": [ | ||
"dist", | ||
"build/index.d.ts", | ||
"README.md" | ||
@@ -30,2 +32,3 @@ ], | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/preset-typescript": "^7.10.4", | ||
"@testing-library/react": "^9.3.1", | ||
@@ -38,4 +41,6 @@ "@types/jest": "^24.0.21", | ||
"eslint": "^5.13.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jsx-a11y": "^6.2.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"eslint-plugin-react": "^7.12.4", | ||
@@ -45,9 +50,10 @@ "eslint-plugin-react-hooks": "^1.6.0", | ||
"jest": "^24.9.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.0.5", | ||
"react": "^16.11.0", | ||
"react-dom": "^16.11.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^1.26.3", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-terser": "^5.1.2", | ||
"ts-jest": "^24.1.0", | ||
"typescript": "^3.6.4" | ||
@@ -62,6 +68,3 @@ }, | ||
"<rootDir>/src/**.tsx" | ||
], | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
} | ||
] | ||
}, | ||
@@ -68,0 +71,0 @@ "config": { |
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
3
15345
27