react-portal-stateless
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],n):"object"==typeof exports?exports.portal=n(require("React"),require("ReactDOM")):e.portal=n(e.React,e.ReactDOM)}(this,function(e,n){return function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="/Users/vitor/projetos/globocom/react-portal/dist",n(n.s=5)}([function(e,n){function t(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===t||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(n){try{return l.call(null,e,0)}catch(n){return l.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(n){try{return f.call(null,e)}catch(n){return f.call(this,e)}}}function u(){h&&d&&(h=!1,d.length?y=d.concat(y):v=-1,y.length&&a())}function a(){if(!h){var e=o(u);h=!0;for(var n=y.length;n;){for(d=y,y=[];++v<n;)d&&d[v].run();v=-1,n=y.length}d=null,h=!1,i(e)}}function s(e,n){this.fun=e,this.array=n}function c(){}var l,f,p=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:t}catch(e){l=t}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var d,y=[],h=!1,v=-1;p.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];y.push(new s(e,n)),1!==y.length||h||o(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,n,t){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,n,t){"use strict";(function(n){function t(e,n,t,o,i,u,a,s){if(r(n),!e){var c;if(void 0===n)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[t,o,i,u,a,s],f=0;c=new Error(n.replace(/%s/g,function(){return l[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var r=function(e){};"production"!==n.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=t}).call(n,t(0))},function(e,n,t){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,n,t){"use strict";(function(n){var r=t(1),o=r;if("production"!==n.env.NODE_ENV){var i=function(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return t[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(e,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!e){for(var t=arguments.length,r=Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];i.apply(void 0,[n].concat(r))}}}e.exports=o}).call(n,t(0))},function(e,n,t){e.exports=t(6)},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function i(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}function u(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),s=t(7),c=r(s),l=t(8),f=r(l),p=t(9),d=r(p),y={ESCAPE:27},h=function(e){function n(e){o(this,n);var t=i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.closePortal=t.closePortal.bind(t),t.handleOutsideMouseClick=t.handleOutsideMouseClick.bind(t),t.handleKeydown=t.handleKeydown.bind(t),t.portal=null,t.node=null,t}return u(n,e),a(n,[{key:"componentDidMount",value:function(){this.props.closeOnEsc&&document.addEventListener("keydown",this.handleKeydown),this.props.closeOnOutsideClick&&(document.addEventListener("mouseup",this.handleOutsideMouseClick),document.addEventListener("touchstart",this.handleOutsideMouseClick))}},{key:"componentDidUpdate",value:function(e){this.props.isOpen?this.renderPortal():e.isOpen&&this.closePortal()}},{key:"componentWillUnmount",value:function(){this.props.closeOnEsc&&document.removeEventListener("keydown",this.handleKeydown),this.props.closeOnOutsideClick&&(document.removeEventListener("mouseup",this.handleOutsideMouseClick),document.removeEventListener("touchstart",this.handleOutsideMouseClick)),this.closePortal(!0)}},{key:"handleOutsideMouseClick",value:function(e){if(this.props.isOpen){(0,l.findDOMNode)(this.portal).contains(e.target)||e.button&&0!==e.button||(e.stopPropagation(),this.props.onClose())}}},{key:"handleKeydown",value:function(e){e.keyCode===y.ESCAPE&&this.props.isOpen&&this.props.onClose()}},{key:"closePortal",value:function(){this.node&&(f.default.unmountComponentAtNode(this.node),document.body.removeChild(this.node)),this.portal=null,this.node=null}},{key:"renderPortal",value:function(){this.node||(this.node=document.createElement("div"),document.body.appendChild(this.node));var e=this.props.children;"function"==typeof e.type&&(e=c.default.cloneElement(e,{closePortal:this.props.onClose})),this.portal=f.default.unstable_renderSubtreeIntoContainer(this,e,this.node,this.props.onUpdate)}},{key:"render",value:function(){return null}}]),n}(c.default.Component);n.default=h,h.propTypes={children:d.default.element.isRequired,closeOnEsc:d.default.bool,closeOnOutsideClick:d.default.bool,isOpen:d.default.bool,onClose:d.default.func,onUpdate:d.default.func},h.defaultProps={onClose:function(){},onUpdate:function(){}}},function(n,t){n.exports=e},function(e,t){e.exports=n},function(e,n,t){(function(n){if("production"!==n.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=t(10)(o,!0)}else e.exports=t(12)()}).call(n,t(0))},function(e,n,t){"use strict";(function(n){var r=t(1),o=t(2),i=t(4),u=t(3),a=t(11);e.exports=function(e,t){function s(e){var n=e&&(P&&e[P]||e[k]);if("function"==typeof n)return n}function c(e,n){return e===n?0!==e||1/e==1/n:e!==e&&n!==n}function l(e){this.message=e,this.stack=""}function f(e){function r(r,c,f,p,d,y,h){if(p=p||R,y=y||f,h!==u)if(t)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==n.env.NODE_ENV&&"undefined"!=typeof console){var v=p+":"+f;!a[v]&&s<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",y,p),a[v]=!0,s++)}return null==c[f]?r?new l(null===c[f]?"The "+d+" `"+y+"` is marked as required in `"+p+"`, but its value is `null`.":"The "+d+" `"+y+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(c,f,p,d,y)}if("production"!==n.env.NODE_ENV)var a={},s=0;var c=r.bind(null,!1);return c.isRequired=r.bind(null,!0),c}function p(e){function n(n,t,r,o,i,u){var a=n[t];if(w(a)!==e)return new l("Invalid "+o+" `"+i+"` of type `"+E(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return f(n)}function d(e){function n(n,t,r,o,i){if("function"!=typeof e)return new l("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=n[t];if(!Array.isArray(a)){return new l("Invalid "+o+" `"+i+"` of type `"+w(a)+"` supplied to `"+r+"`, expected an array.")}for(var s=0;s<a.length;s++){var c=e(a,s,r,o,i+"["+s+"]",u);if(c instanceof Error)return c}return null}return f(n)}function y(e){function n(n,t,r,o,i){if(!(n[t]instanceof e)){var u=e.name||R;return new l("Invalid "+o+" `"+i+"` of type `"+x(n[t])+"` supplied to `"+r+"`, expected instance of `"+u+"`.")}return null}return f(n)}function h(e){function t(n,t,r,o,i){for(var u=n[t],a=0;a<e.length;a++)if(c(u,e[a]))return null;return new l("Invalid "+o+" `"+i+"` of value `"+u+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?f(t):("production"!==n.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)}function v(e){function n(n,t,r,o,i){if("function"!=typeof e)return new l("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=n[t],s=w(a);if("object"!==s)return new l("Invalid "+o+" `"+i+"` of type `"+s+"` supplied to `"+r+"`, expected an object.");for(var c in a)if(a.hasOwnProperty(c)){var f=e(a,c,r,o,i+"."+c,u);if(f instanceof Error)return f}return null}return f(n)}function m(e){function t(n,t,r,o,i){for(var a=0;a<e.length;a++){if(null==(0,e[a])(n,t,r,o,i,u))return null}return new l("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}if(!Array.isArray(e))return"production"!==n.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull;for(var o=0;o<e.length;o++){var a=e[o];if("function"!=typeof a)return i(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",T(a),o),r.thatReturnsNull}return f(t)}function b(e){function n(n,t,r,o,i){var a=n[t],s=w(a);if("object"!==s)return new l("Invalid "+o+" `"+i+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");for(var c in e){var f=e[c];if(f){var p=f(a,c,r,o,i+"."+c,u);if(p)return p}}return null}return f(n)}function O(n){switch(typeof n){case"number":case"string":case"undefined":return!0;case"boolean":return!n;case"object":if(Array.isArray(n))return n.every(O);if(null===n||e(n))return!0;var t=s(n);if(!t)return!1;var r,o=t.call(n);if(t!==n.entries){for(;!(r=o.next()).done;)if(!O(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!O(i[1]))return!1}return!0;default:return!1}}function g(e,n){return"symbol"===e||("Symbol"===n["@@toStringTag"]||"function"==typeof Symbol&&n instanceof Symbol)}function w(e){var n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":g(n,e)?"symbol":n}function E(e){if(void 0===e||null===e)return""+e;var n=w(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function T(e){var n=E(e);switch(n){case"array":case"object":return"an "+n;case"boolean":case"date":case"regexp":return"a "+n;default:return n}}function x(e){return e.constructor&&e.constructor.name?e.constructor.name:R}var P="function"==typeof Symbol&&Symbol.iterator,k="@@iterator",R="<<anonymous>>",_={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:function(){return f(r.thatReturnsNull)}(),arrayOf:d,element:function(){function n(n,t,r,o,i){var u=n[t];if(!e(u)){return new l("Invalid "+o+" `"+i+"` of type `"+w(u)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return f(n)}(),instanceOf:y,node:function(){function e(e,n,t,r,o){return O(e[n])?null:new l("Invalid "+r+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}return f(e)}(),objectOf:v,oneOf:h,oneOfType:m,shape:b};return l.prototype=Error.prototype,_.checkPropTypes=a,_.PropTypes=_,_}}).call(n,t(0))},function(e,n,t){"use strict";(function(n){function r(e,t,r,s,c){if("production"!==n.env.NODE_ENV)for(var l in e)if(e.hasOwnProperty(l)){var f;try{o("function"==typeof e[l],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",s||"React class",r,l),f=e[l](t,l,s,r,null,u)}catch(e){f=e}if(i(!f||f instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",s||"React class",r,l,typeof f),f instanceof Error&&!(f.message in a)){a[f.message]=!0;var p=c?c():"";i(!1,"Failed %s type: %s%s",r,f.message,null!=p?p:"")}}}if("production"!==n.env.NODE_ENV)var o=t(2),i=t(4),u=t(3),a={};e.exports=r}).call(n,t(0))},function(e,n,t){"use strict";var r=t(1),o=t(2),i=t(3);e.exports=function(){function e(e,n,t,r,u,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function n(){return e}e.isRequired=e;var t={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n};return t.checkPropTypes=r,t.PropTypes=t,t}}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],n):"object"==typeof exports?exports.portal=n(require("React"),require("ReactDOM")):e.portal=n(e.React,e.ReactDOM)}(this,function(e,n){return function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="/Users/vitor/projetos/globocom/react-portal/dist",n(n.s=5)}([function(e,n){function t(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===t||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(n){try{return l.call(null,e,0)}catch(n){return l.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(n){try{return f.call(null,e)}catch(n){return f.call(this,e)}}}function u(){h&&d&&(h=!1,d.length?y=d.concat(y):v=-1,y.length&&a())}function a(){if(!h){var e=o(u);h=!0;for(var n=y.length;n;){for(d=y,y=[];++v<n;)d&&d[v].run();v=-1,n=y.length}d=null,h=!1,i(e)}}function s(e,n){this.fun=e,this.array=n}function c(){}var l,f,p=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:t}catch(e){l=t}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var d,y=[],h=!1,v=-1;p.nextTick=function(e){var n=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)n[t-1]=arguments[t];y.push(new s(e,n)),1!==y.length||h||o(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,n,t){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,n,t){"use strict";(function(n){function t(e,n,t,o,i,u,a,s){if(r(n),!e){var c;if(void 0===n)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[t,o,i,u,a,s],f=0;c=new Error(n.replace(/%s/g,function(){return l[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var r=function(e){};"production"!==n.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=t}).call(n,t(0))},function(e,n,t){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,n,t){"use strict";(function(n){var r=t(1),o=r;if("production"!==n.env.NODE_ENV){var i=function(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return t[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(e,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!e){for(var t=arguments.length,r=Array(t>2?t-2:0),o=2;o<t;o++)r[o-2]=arguments[o];i.apply(void 0,[n].concat(r))}}}e.exports=o}).call(n,t(0))},function(e,n,t){e.exports=t(6)},function(e,n,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function i(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n}function u(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var a=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),s=t(7),c=r(s),l=t(8),f=r(l),p=t(9),d=r(p),y={ESCAPE:27},h=function(e){function n(e){o(this,n);var t=i(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return t.closePortal=t.closePortal.bind(t),t.handleOutsideMouseClick=t.handleOutsideMouseClick.bind(t),t.handleKeydown=t.handleKeydown.bind(t),t.portal=null,t.node=null,t}return u(n,e),a(n,[{key:"componentDidMount",value:function(){this.props.closeOnEsc&&document.addEventListener("keydown",this.handleKeydown),this.props.closeOnOutsideClick&&(document.addEventListener("mouseup",this.handleOutsideMouseClick),document.addEventListener("touchstart",this.handleOutsideMouseClick)),this.componentShouldRenderPortal()}},{key:"componentDidUpdate",value:function(e){this.componentShouldRenderPortal(e)}},{key:"componentShouldRenderPortal",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.props.isOpen?this.renderPortal():e.isOpen&&this.closePortal()}},{key:"componentWillUnmount",value:function(){this.props.closeOnEsc&&document.removeEventListener("keydown",this.handleKeydown),this.props.closeOnOutsideClick&&(document.removeEventListener("mouseup",this.handleOutsideMouseClick),document.removeEventListener("touchstart",this.handleOutsideMouseClick)),this.closePortal(!0)}},{key:"handleOutsideMouseClick",value:function(e){if(this.props.isOpen){(0,l.findDOMNode)(this.portal).contains(e.target)||e.button&&0!==e.button||(e.stopPropagation(),this.props.onClose())}}},{key:"handleKeydown",value:function(e){e.keyCode===y.ESCAPE&&this.props.isOpen&&this.props.onClose()}},{key:"closePortal",value:function(){this.node&&(f.default.unmountComponentAtNode(this.node),document.body.removeChild(this.node)),this.portal=null,this.node=null}},{key:"renderPortal",value:function(){this.node||(this.node=document.createElement("div"),document.body.appendChild(this.node));var e=this.props.children;"function"==typeof e.type&&(e=c.default.cloneElement(e,{closePortal:this.props.onClose})),this.portal=f.default.unstable_renderSubtreeIntoContainer(this,e,this.node,this.props.onUpdate)}},{key:"render",value:function(){return null}}]),n}(c.default.Component);n.default=h,h.propTypes={children:d.default.element.isRequired,closeOnEsc:d.default.bool,closeOnOutsideClick:d.default.bool,isOpen:d.default.bool,onClose:d.default.func,onUpdate:d.default.func},h.defaultProps={onClose:function(){},onUpdate:function(){}}},function(n,t){n.exports=e},function(e,t){e.exports=n},function(e,n,t){(function(n){if("production"!==n.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=t(10)(o,!0)}else e.exports=t(12)()}).call(n,t(0))},function(e,n,t){"use strict";(function(n){var r=t(1),o=t(2),i=t(4),u=t(3),a=t(11);e.exports=function(e,t){function s(e){var n=e&&(P&&e[P]||e[k]);if("function"==typeof n)return n}function c(e,n){return e===n?0!==e||1/e==1/n:e!==e&&n!==n}function l(e){this.message=e,this.stack=""}function f(e){function r(r,c,f,p,d,y,h){if(p=p||R,y=y||f,h!==u)if(t)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==n.env.NODE_ENV&&"undefined"!=typeof console){var v=p+":"+f;!a[v]&&s<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",y,p),a[v]=!0,s++)}return null==c[f]?r?new l(null===c[f]?"The "+d+" `"+y+"` is marked as required in `"+p+"`, but its value is `null`.":"The "+d+" `"+y+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(c,f,p,d,y)}if("production"!==n.env.NODE_ENV)var a={},s=0;var c=r.bind(null,!1);return c.isRequired=r.bind(null,!0),c}function p(e){function n(n,t,r,o,i,u){var a=n[t];if(w(a)!==e)return new l("Invalid "+o+" `"+i+"` of type `"+E(a)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return f(n)}function d(e){function n(n,t,r,o,i){if("function"!=typeof e)return new l("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=n[t];if(!Array.isArray(a)){return new l("Invalid "+o+" `"+i+"` of type `"+w(a)+"` supplied to `"+r+"`, expected an array.")}for(var s=0;s<a.length;s++){var c=e(a,s,r,o,i+"["+s+"]",u);if(c instanceof Error)return c}return null}return f(n)}function y(e){function n(n,t,r,o,i){if(!(n[t]instanceof e)){var u=e.name||R;return new l("Invalid "+o+" `"+i+"` of type `"+x(n[t])+"` supplied to `"+r+"`, expected instance of `"+u+"`.")}return null}return f(n)}function h(e){function t(n,t,r,o,i){for(var u=n[t],a=0;a<e.length;a++)if(c(u,e[a]))return null;return new l("Invalid "+o+" `"+i+"` of value `"+u+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?f(t):("production"!==n.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)}function v(e){function n(n,t,r,o,i){if("function"!=typeof e)return new l("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=n[t],s=w(a);if("object"!==s)return new l("Invalid "+o+" `"+i+"` of type `"+s+"` supplied to `"+r+"`, expected an object.");for(var c in a)if(a.hasOwnProperty(c)){var f=e(a,c,r,o,i+"."+c,u);if(f instanceof Error)return f}return null}return f(n)}function m(e){function t(n,t,r,o,i){for(var a=0;a<e.length;a++){if(null==(0,e[a])(n,t,r,o,i,u))return null}return new l("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}if(!Array.isArray(e))return"production"!==n.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull;for(var o=0;o<e.length;o++){var a=e[o];if("function"!=typeof a)return i(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",T(a),o),r.thatReturnsNull}return f(t)}function b(e){function n(n,t,r,o,i){var a=n[t],s=w(a);if("object"!==s)return new l("Invalid "+o+" `"+i+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");for(var c in e){var f=e[c];if(f){var p=f(a,c,r,o,i+"."+c,u);if(p)return p}}return null}return f(n)}function O(n){switch(typeof n){case"number":case"string":case"undefined":return!0;case"boolean":return!n;case"object":if(Array.isArray(n))return n.every(O);if(null===n||e(n))return!0;var t=s(n);if(!t)return!1;var r,o=t.call(n);if(t!==n.entries){for(;!(r=o.next()).done;)if(!O(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!O(i[1]))return!1}return!0;default:return!1}}function g(e,n){return"symbol"===e||("Symbol"===n["@@toStringTag"]||"function"==typeof Symbol&&n instanceof Symbol)}function w(e){var n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":g(n,e)?"symbol":n}function E(e){if(void 0===e||null===e)return""+e;var n=w(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function T(e){var n=E(e);switch(n){case"array":case"object":return"an "+n;case"boolean":case"date":case"regexp":return"a "+n;default:return n}}function x(e){return e.constructor&&e.constructor.name?e.constructor.name:R}var P="function"==typeof Symbol&&Symbol.iterator,k="@@iterator",R="<<anonymous>>",_={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:function(){return f(r.thatReturnsNull)}(),arrayOf:d,element:function(){function n(n,t,r,o,i){var u=n[t];if(!e(u)){return new l("Invalid "+o+" `"+i+"` of type `"+w(u)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return f(n)}(),instanceOf:y,node:function(){function e(e,n,t,r,o){return O(e[n])?null:new l("Invalid "+r+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}return f(e)}(),objectOf:v,oneOf:h,oneOfType:m,shape:b};return l.prototype=Error.prototype,_.checkPropTypes=a,_.PropTypes=_,_}}).call(n,t(0))},function(e,n,t){"use strict";(function(n){function r(e,t,r,s,c){if("production"!==n.env.NODE_ENV)for(var l in e)if(e.hasOwnProperty(l)){var f;try{o("function"==typeof e[l],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",s||"React class",r,l),f=e[l](t,l,s,r,null,u)}catch(e){f=e}if(i(!f||f instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",s||"React class",r,l,typeof f),f instanceof Error&&!(f.message in a)){a[f.message]=!0;var p=c?c():"";i(!1,"Failed %s type: %s%s",r,f.message,null!=p?p:"")}}}if("production"!==n.env.NODE_ENV)var o=t(2),i=t(4),u=t(3),a={};e.exports=r}).call(n,t(0))},function(e,n,t){"use strict";var r=t(1),o=t(2),i=t(3);e.exports=function(){function e(e,n,t,r,u,a){a!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function n(){return e}e.isRequired=e;var t={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n};return t.checkPropTypes=r,t.PropTypes=t,t}}])}); | ||
//# sourceMappingURL=portal.js.map |
@@ -62,2 +62,4 @@ 'use strict'; | ||
} | ||
this.componentShouldRenderPortal(); | ||
} | ||
@@ -67,2 +69,9 @@ }, { | ||
value: function componentDidUpdate(prevProps) { | ||
this.componentShouldRenderPortal(prevProps); | ||
} | ||
}, { | ||
key: 'componentShouldRenderPortal', | ||
value: function componentShouldRenderPortal() { | ||
var prevProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
if (this.props.isOpen) { | ||
@@ -69,0 +78,0 @@ this.renderPortal(); |
{ | ||
"name": "react-portal-stateless", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "React component for transportation of modals, lightboxes, loading bars... to document.body", | ||
@@ -5,0 +5,0 @@ "main": "lib/portal.js", |
React-portal-stateless | ||
============ | ||
[![npm version](https://img.shields.io/npm/v/react-portal.svg?style=flat-square)](https://www.npmjs.com/package/react-portal-stateless) | ||
[![npm downloads](https://img.shields.io/npm/dm/react-portal.svg?style=flat-square)](https://www.npmjs.com/package/react-portal-stateless) | ||
[![npm version](https://img.shields.io/npm/v/react-portal-stateless.svg?style=flat-square)](https://www.npmjs.com/package/react-portal-stateless) | ||
[![npm downloads](https://img.shields.io/npm/dm/react-portal-stateless.svg?style=flat-square)](https://www.npmjs.com/package/react-portal-stateless) | ||
@@ -6,0 +6,0 @@ This Project is a fork of [React Portal](https://github.com/tajo/react-portal) that implement Stateless version of it. |
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
137174
211