diff --git a/bower.json b/bower.json index 5ed0c9b7..b37e36ab 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.9.2", + "version": "1.9.3", "homepage": "https://github.com/reactjs/react-modal", "authors": [ "Ryan Florence", diff --git a/dist/react-modal.js b/dist/react-modal.js index 22f4a8c9..8128484c 100644 --- a/dist/react-modal.js +++ b/dist/react-modal.js @@ -154,6 +154,8 @@ return /******/ (function(modules) { // webpackBootstrap }, componentWillUnmount: function componentWillUnmount() { + if (!this.node) return; + refCount.remove(this); if (this.props.ariaHideApp) { diff --git a/dist/react-modal.min.js b/dist/react-modal.min.js index bca97195..597bfb20 100644 --- a/dist/react-modal.min.js +++ b/dist/react-modal.min.js @@ -1,4 +1,4 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactModal=t(require("react"),require("react-dom")):e.ReactModal=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){"use strict";e.exports=n(1)},function(e,t,n){"use strict";function o(e){return e()}var r=n(2),i=n(3),s=n(4),a=n(12),u=r.createFactory(n(13)),c=n(22),l=n(23),p=n(24),f=n(3).unstable_renderSubtreeIntoContainer,d=n(17),h=n(18),m=a.canUseDOM?window.HTMLElement:{},y=a.canUseDOM?document.body:{appendChild:function(){}},v=h({displayName:"Modal",statics:{setAppElement:function(e){y=c.setElement(e)},injectCSS:function(){console.warn("React-Modal: injectCSS has been deprecated and no longer has any effect. It will be removed in a later version")}},propTypes:{isOpen:s.bool.isRequired,style:s.shape({content:s.object,overlay:s.object}),portalClassName:s.string,bodyOpenClassName:s.string,appElement:s.instanceOf(m),onAfterOpen:s.func,onRequestClose:s.func,closeTimeoutMS:s.number,ariaHideApp:s.bool,shouldCloseOnOverlayClick:s.bool,parentSelector:s.func,role:s.string,contentLabel:s.string.isRequired},getDefaultProps:function(){return{isOpen:!1,portalClassName:"ReactModalPortal",bodyOpenClassName:"ReactModal__Body--open",ariaHideApp:!0,closeTimeoutMS:0,shouldCloseOnOverlayClick:!0,parentSelector:function(){return document.body}}},componentDidMount:function(){this.node=document.createElement("div"),this.node.className=this.props.portalClassName,this.props.isOpen&&l.add(this);var e=o(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)},componentWillReceiveProps:function(e){e.isOpen&&l.add(this),e.isOpen||l.remove(this);var t=o(this.props.parentSelector),n=o(e.parentSelector);n!==t&&(t.removeChild(this.node),n.appendChild(this.node)),this.renderPortal(e)},componentWillUnmount:function(){l.remove(this),this.props.ariaHideApp&&c.show(this.props.appElement);var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);if(n){e.beforeClose||this.portal.closeWithTimeout();var o=this;setTimeout(function(){o.removePortal()},n-t)}else this.removePortal()},removePortal:function(){i.unmountComponentAtNode(this.node);var e=o(this.props.parentSelector);e.removeChild(this.node),0===l.count()&&p(document.body).remove(this.props.bodyOpenClassName)},renderPortal:function(e){e.isOpen||l.count()>0?p(document.body).add(this.props.bodyOpenClassName):p(document.body).remove(this.props.bodyOpenClassName),e.ariaHideApp&&c.toggle(e.isOpen,e.appElement),this.portal=f(this,u(d({},e,{defaultStyles:v.defaultStyles})),this.node)},render:function(){return r.DOM.noscript()}});v.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},e.exports=v},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,r=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},i=!0;e.exports=n(5)(r,i)},function(e,t,n){"use strict";var o=n(6),r=n(7),i=n(8),s=n(9),a=n(10);e.exports=function(e,t){function n(e){var t=e&&(A&&e[A]||e[S]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function c(e){this.message=e,this.stack=""}function l(e){function n(n,a,u,l,p,f,d){if(l=l||R,f=f||u,d!==s)if(t)r(!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("undefined"!=typeof console){var h=l+":"+u;o[h]||(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.",f,l),o[h]=!0)}return null==a[u]?n?new c(null===a[u]?"The "+p+" `"+f+"` is marked as required "+("in `"+l+"`, but its value is `null`."):"The "+p+" `"+f+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(a,u,l,p,f)}var o={},a=n.bind(null,!1);return a.isRequired=n.bind(null,!0),a}function p(e){function t(t,n,o,r,i,s){var a=t[n],u=w(a);if(u!==e){var l=x(a);return new c("Invalid "+r+" `"+i+"` of type "+("`"+l+"` supplied to `"+o+"`, expected ")+("`"+e+"`."))}return null}return l(t)}function f(){return l(o.thatReturnsNull)}function d(e){function t(t,n,o,r,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var u=w(a);return new c("Invalid "+r+" `"+i+"` of type "+("`"+u+"` supplied to `"+o+"`, expected an array."))}for(var l=0;l1?t-1:0),o=1;o2?o-2:0),i=2;i0?p(document.body).add(this.props.bodyOpenClassName):p(document.body).remove(this.props.bodyOpenClassName),e.ariaHideApp&&c.toggle(e.isOpen,e.appElement),this.portal=f(this,u(d({},e,{defaultStyles:v.defaultStyles})),this.node)},render:function(){return r.DOM.noscript()}});v.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},e.exports=v},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,r=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},i=!0;e.exports=n(5)(r,i)},function(e,t,n){"use strict";var o=n(6),r=n(7),i=n(8),s=n(9),a=n(10);e.exports=function(e,t){function n(e){var t=e&&(A&&e[A]||e[S]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function c(e){this.message=e,this.stack=""}function l(e){function n(n,a,u,l,p,f,d){if(l=l||R,f=f||u,d!==s)if(t)r(!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("undefined"!=typeof console){var h=l+":"+u;o[h]||(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.",f,l),o[h]=!0)}return null==a[u]?n?new c(null===a[u]?"The "+p+" `"+f+"` is marked as required "+("in `"+l+"`, but its value is `null`."):"The "+p+" `"+f+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(a,u,l,p,f)}var o={},a=n.bind(null,!1);return a.isRequired=n.bind(null,!0),a}function p(e){function t(t,n,o,r,i,s){var a=t[n],u=w(a);if(u!==e){var l=x(a);return new c("Invalid "+r+" `"+i+"` of type "+("`"+l+"` supplied to `"+o+"`, expected ")+("`"+e+"`."))}return null}return l(t)}function f(){return l(o.thatReturnsNull)}function d(e){function t(t,n,o,r,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var u=w(a);return new c("Invalid "+r+" `"+i+"` of type "+("`"+u+"` supplied to `"+o+"`, expected an array."))}for(var l=0;l1?t-1:0),o=1;o2?o-2:0),i=2;i