@quid/react-mouse-outside
Advanced tools
Comparing version 1.26.0 to 1.31.2
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.31.2](https://github.com/quid/refraction/tree/master/packages/react-mouse-outside/compare/v1.31.1...v1.31.2) (2019-02-08) | ||
### Bug Fixes | ||
* react-mouse-outside type improvements ([d7907ad](https://github.com/quid/refraction/tree/master/packages/react-mouse-outside/commit/d7907ad)) | ||
# 1.26.0 (2019-01-31) | ||
@@ -8,0 +19,0 @@ |
@@ -1,2 +0,2 @@ | ||
import{createRef as t,Component as e}from"react";var n=function(t,e){return e>0?function(t,e,n){return void 0===e&&(e=250),function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];return clearTimeout(n,n=setTimeout.apply(void 0,[t,e].concat(o)))}}(t,e):t},o=function(e){function o(){for(var o=this,i=[],r=arguments.length;r--;)i[r]=arguments[r];e.apply(this,i),this.container=t(),this.isTargetOutside=function(t){return(t instanceof HTMLElement||t instanceof HTMLDocument)&&o.container.current instanceof HTMLElement&&!o.container.current.contains(t)&&document.contains(t)},this.handleClickOutside=function(t){o.props.onClickOutside&&o.isTargetOutside(t.target)&&o.props.onClickOutside(t)},this.handleMoveOutside=n(function(t){o.props.onMoveOutside&&o.isTargetOutside(t.target)&&o.props.onMoveOutside(t)},this.props.delay)}return e&&(o.__proto__=e),(o.prototype=Object.create(e&&e.prototype)).constructor=o,o.prototype.componentDidMount=function(){this.props.onClickOutside&&document.addEventListener("click",this.handleClickOutside,!0),this.props.onMoveOutside&&document.addEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.componentWillUnmount=function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.render=function(){return this.props.children(this.container)},o}(e);o.defaultProps={delay:0,tag:"div"};export default o; | ||
import{createRef as t,Component as e}from"react";var n=function(t,e){return e>0?function(t,e,n){return void 0===e&&(e=250),function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];return clearTimeout(n,n=setTimeout.apply(void 0,[t,e].concat(o)))}}(t,e):t},o=function(e){function o(){for(var o=this,i=[],r=arguments.length;r--;)i[r]=arguments[r];e.apply(this,i),this.container=t(),this.isTargetOutside=function(t){return(t instanceof HTMLElement||t instanceof HTMLDocument)&&o.container.current instanceof HTMLElement&&!o.container.current.contains(t)&&document.contains(t)},this.handleClickOutside=function(t){o.props.onClickOutside&&o.isTargetOutside(t.target)&&o.props.onClickOutside(t)},this.handleMoveOutside=n(function(t){o.props.onMoveOutside&&o.isTargetOutside(t.target)&&o.props.onMoveOutside(t)},this.props.delay)}return e&&(o.__proto__=e),(o.prototype=Object.create(e&&e.prototype)).constructor=o,o.prototype.componentDidMount=function(){this.props.onClickOutside&&document.addEventListener("click",this.handleClickOutside,!0),this.props.onMoveOutside&&document.addEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.componentWillUnmount=function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.render=function(){return this.props.children(this.container)},o}(e);o.defaultProps={delay:0};export default o; | ||
//# sourceMappingURL=index.es.js.map |
@@ -1,2 +0,2 @@ | ||
var t=require("react"),e=function(t,e){return e>0?function(t,e,n){return void 0===e&&(e=250),function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];return clearTimeout(n,n=setTimeout.apply(void 0,[t,e].concat(o)))}}(t,e):t},n=function(n){function o(){for(var o=this,i=[],r=arguments.length;r--;)i[r]=arguments[r];n.apply(this,i),this.container=t.createRef(),this.isTargetOutside=function(t){return(t instanceof HTMLElement||t instanceof HTMLDocument)&&o.container.current instanceof HTMLElement&&!o.container.current.contains(t)&&document.contains(t)},this.handleClickOutside=function(t){o.props.onClickOutside&&o.isTargetOutside(t.target)&&o.props.onClickOutside(t)},this.handleMoveOutside=e(function(t){o.props.onMoveOutside&&o.isTargetOutside(t.target)&&o.props.onMoveOutside(t)},this.props.delay)}return n&&(o.__proto__=n),(o.prototype=Object.create(n&&n.prototype)).constructor=o,o.prototype.componentDidMount=function(){this.props.onClickOutside&&document.addEventListener("click",this.handleClickOutside,!0),this.props.onMoveOutside&&document.addEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.componentWillUnmount=function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.render=function(){return this.props.children(this.container)},o}(t.Component);n.defaultProps={delay:0,tag:"div"},module.exports=n; | ||
var t=require("react"),e=function(t,e){return e>0?function(t,e,n){return void 0===e&&(e=250),function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];return clearTimeout(n,n=setTimeout.apply(void 0,[t,e].concat(o)))}}(t,e):t},n=function(n){function o(){for(var o=this,i=[],r=arguments.length;r--;)i[r]=arguments[r];n.apply(this,i),this.container=t.createRef(),this.isTargetOutside=function(t){return(t instanceof HTMLElement||t instanceof HTMLDocument)&&o.container.current instanceof HTMLElement&&!o.container.current.contains(t)&&document.contains(t)},this.handleClickOutside=function(t){o.props.onClickOutside&&o.isTargetOutside(t.target)&&o.props.onClickOutside(t)},this.handleMoveOutside=e(function(t){o.props.onMoveOutside&&o.isTargetOutside(t.target)&&o.props.onMoveOutside(t)},this.props.delay)}return n&&(o.__proto__=n),(o.prototype=Object.create(n&&n.prototype)).constructor=o,o.prototype.componentDidMount=function(){this.props.onClickOutside&&document.addEventListener("click",this.handleClickOutside,!0),this.props.onMoveOutside&&document.addEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.componentWillUnmount=function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.render=function(){return this.props.children(this.container)},o}(t.Component);n.defaultProps={delay:0},module.exports=n; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.reactMouseOutside=t(e.react)}(this,function(e){var t=function(e,t){return t>0?function(e,t,n){return void 0===t&&(t=250),function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];return clearTimeout(n,n=setTimeout.apply(void 0,[e,t].concat(o)))}}(e,t):e},n=function(n){function o(){for(var o=this,i=[],r=arguments.length;r--;)i[r]=arguments[r];n.apply(this,i),this.container=e.createRef(),this.isTargetOutside=function(e){return(e instanceof HTMLElement||e instanceof HTMLDocument)&&o.container.current instanceof HTMLElement&&!o.container.current.contains(e)&&document.contains(e)},this.handleClickOutside=function(e){o.props.onClickOutside&&o.isTargetOutside(e.target)&&o.props.onClickOutside(e)},this.handleMoveOutside=t(function(e){o.props.onMoveOutside&&o.isTargetOutside(e.target)&&o.props.onMoveOutside(e)},this.props.delay)}return n&&(o.__proto__=n),(o.prototype=Object.create(n&&n.prototype)).constructor=o,o.prototype.componentDidMount=function(){this.props.onClickOutside&&document.addEventListener("click",this.handleClickOutside,!0),this.props.onMoveOutside&&document.addEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.componentWillUnmount=function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.render=function(){return this.props.children(this.container)},o}(e.Component);return n.defaultProps={delay:0,tag:"div"},n}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):e.reactMouseOutside=t(e.react)}(this,function(e){var t=function(e,t){return t>0?function(e,t,n){return void 0===t&&(t=250),function(){for(var o=[],i=arguments.length;i--;)o[i]=arguments[i];return clearTimeout(n,n=setTimeout.apply(void 0,[e,t].concat(o)))}}(e,t):e},n=function(n){function o(){for(var o=this,i=[],r=arguments.length;r--;)i[r]=arguments[r];n.apply(this,i),this.container=e.createRef(),this.isTargetOutside=function(e){return(e instanceof HTMLElement||e instanceof HTMLDocument)&&o.container.current instanceof HTMLElement&&!o.container.current.contains(e)&&document.contains(e)},this.handleClickOutside=function(e){o.props.onClickOutside&&o.isTargetOutside(e.target)&&o.props.onClickOutside(e)},this.handleMoveOutside=t(function(e){o.props.onMoveOutside&&o.isTargetOutside(e.target)&&o.props.onMoveOutside(e)},this.props.delay)}return n&&(o.__proto__=n),(o.prototype=Object.create(n&&n.prototype)).constructor=o,o.prototype.componentDidMount=function(){this.props.onClickOutside&&document.addEventListener("click",this.handleClickOutside,!0),this.props.onMoveOutside&&document.addEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.componentWillUnmount=function(){document.removeEventListener("click",this.handleClickOutside,!0),document.removeEventListener("mousemove",this.handleMoveOutside,!0)},o.prototype.render=function(){return this.props.children(this.container)},o}(e.Component);return n.defaultProps={delay:0},n}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@quid/react-mouse-outside", | ||
"version": "1.26.0", | ||
"version": "1.31.2", | ||
"description": "Detect clicks and other mouse events outside of a React element", | ||
@@ -25,3 +25,4 @@ "main": "dist/index.js", | ||
"react": "15||16" | ||
} | ||
}, | ||
"gitHead": "3faa32f6c5b2266908fcb384b54c65f5c9a60dba" | ||
} |
@@ -14,4 +14,4 @@ /** | ||
type Props = { | ||
onClickOutside?: Function, | ||
onMoveOutside?: Function, | ||
onClickOutside?: Event => void, | ||
onMoveOutside?: Event => void, | ||
delay: number, | ||
@@ -25,3 +25,2 @@ children: RenderProp<React.ElementRef<any>>, | ||
delay: 0, | ||
tag: 'div', | ||
}; | ||
@@ -28,0 +27,0 @@ |
@@ -12,3 +12,2 @@ /** | ||
// $FlowFixMe(fzivolo): forwardRef not yet supported | ||
const Child = React.forwardRef((props, ref) => <div ref={ref} />); | ||
@@ -18,3 +17,3 @@ | ||
const wrapper = shallow( | ||
<MouseOutside onClickOutside={f => f}> | ||
<MouseOutside onClickOutside={f => void f}> | ||
{ref => <div ref={ref} />} | ||
@@ -21,0 +20,0 @@ </MouseOutside> |
Sorry, the diff of this file is not supported yet
19910
18
247