From bf5e28820090e8660b9dad7b81fa205ccc019dfd Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Mon, 12 Jun 2017 12:37:12 -0300 Subject: [PATCH] Release v1.8.1. --- bower.json | 2 +- dist/react-modal.js | 9 ++++++--- dist/react-modal.min.js | 4 ++-- package.json | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index b4dbc2d3..c2ca7adb 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.7.13", + "version": "1.8.1", "homepage": "https://github.com/reactjs/react-modal", "authors": [ "Ryan Florence", diff --git a/dist/react-modal.js b/dist/react-modal.js index 48c80ac9..52d13201 100644 --- a/dist/react-modal.js +++ b/dist/react-modal.js @@ -102,6 +102,7 @@ return /******/ (function(modules) { // webpackBootstrap overlay: PropTypes.object }), portalClassName: PropTypes.string, + bodyOpenClassName: React.PropTypes.string, appElement: PropTypes.instanceOf(SafeHTMLElement), onAfterOpen: PropTypes.func, onRequestClose: PropTypes.func, @@ -117,6 +118,7 @@ return /******/ (function(modules) { // webpackBootstrap return { isOpen: false, portalClassName: 'ReactModalPortal', + bodyOpenClassName: 'ReactModal__Body--open', ariaHideApp: true, closeTimeoutMS: 0, shouldCloseOnOverlayClick: true, @@ -180,16 +182,17 @@ return /******/ (function(modules) { // webpackBootstrap ReactDOM.unmountComponentAtNode(this.node); var parent = getParentElement(this.props.parentSelector); parent.removeChild(this.node); + if (refCount.count() === 0) { - elementClass(document.body).remove('ReactModal__Body--open'); + elementClass(document.body).remove(this.props.bodyOpenClassName); } }, renderPortal: function renderPortal(props) { if (props.isOpen || refCount.count() > 0) { - elementClass(document.body).add('ReactModal__Body--open'); + elementClass(document.body).add(this.props.bodyOpenClassName); } else { - elementClass(document.body).remove('ReactModal__Body--open'); + elementClass(document.body).remove(this.props.bodyOpenClassName); } if (props.ariaHideApp) { diff --git a/dist/react-modal.min.js b/dist/react-modal.min.js index fc07a728..145d1f87 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,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",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("ReactModal__Body--open")},renderPortal:function(e){e.isOpen||l.count()>0?p(document.body).add("ReactModal__Body--open"):p(document.body).remove("ReactModal__Body--open"),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&&(_&&e[_]||e[R]);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||A,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=C(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=C(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&&(_&&e[_]||e[R]);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||A,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=0)&&n(e,!o)}function s(e){return[].slice.call(e.querySelectorAll("*"),0).filter(function(e){return i(e)})}e.exports=s},function(e,t,n){"use strict";var o=n(15);e.exports=function(e,t){var n=o(e);if(!n.length)return void t.preventDefault();var r=n[t.shiftKey?0:n.length-1],i=r===document.activeElement||e===document.activeElement;if(i){t.preventDefault();var s=n[t.shiftKey?n.length-1:0];s.focus()}}},function(e,t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function o(e,t){for(var n=-1,o=Array(e);++n1?n[r-1]:void 0,s=r>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(r--,i):void 0,s&&f(n[0],n[1],s)&&(i=r<3?void 0:i,r=1),t=Object(t);++o-1&&e%1==0&&e-1&&e%1==0&&e<=C}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function E(e){return!!e&&"object"==typeof e}function w(e){return y(e)?i(e):a(e)}var C=9007199254740991,x="[object Arguments]",N="[object Function]",_="[object GeneratorFunction]",R=/^(?:0|[1-9]\d*)$/,A=Object.prototype,S=A.hasOwnProperty,D=A.toString,M=A.propertyIsEnumerable,T=r(Object.keys,Object),P=Math.max,j=!M.call({valueOf:1},"valueOf"),I=Array.isArray,F=l(function(e,t){if(j||d(t)||y(t))return void c(t,w(t),e);for(var n in t)S.call(t,n)&&s(e,n,t[n])});e.exports=F},function(e,t,n){"use strict";var o=n(2),r=n(19),i=(new o.Component).updater;e.exports=r(o.Component,o.isValidElement,i)},function(e,t,n){"use strict";function o(e){return e}function r(e,t,n){function r(e,t,n){for(var o in t)t.hasOwnProperty(o)&&c("function"==typeof t[o],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",i[n],o)}function p(e,t){var n=E.hasOwnProperty(t)?E[t]:null;x.hasOwnProperty(t)&&u("OVERRIDE_BASE"===n,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",t),e&&u("DEFINE_MANY"===n||"DEFINE_MANY_MERGED"===n,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",t)}function f(e,n){if(!n){var o=typeof n,r="object"===o&&null!==n;return void c(r,"%s: You're attempting to include a mixin that is either null or not an object. Check the mixins included by the component, as well as any mixins they include themselves. Expected object but got %s.",e.displayName||"ReactClass",null===n?null:o)}u("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),u(!t(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var i=e.prototype,s=i.__reactAutoBindPairs;n.hasOwnProperty(l)&&w.mixins(e,n.mixins);for(var a in n)if(n.hasOwnProperty(a)&&a!==l){var f=n[a],d=i.hasOwnProperty(a);if(p(d,a),w.hasOwnProperty(a))w[a](e,f);else{var h=E.hasOwnProperty(a),v="function"==typeof f,b=v&&!h&&!d&&n.autobind!==!1;if(b)s.push(a,f),i[a]=f;else if(d){var g=E[a];u(h&&("DEFINE_MANY_MERGED"===g||"DEFINE_MANY"===g),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",g,a),"DEFINE_MANY_MERGED"===g?i[a]=m(i[a],f):"DEFINE_MANY"===g&&(i[a]=y(i[a],f))}else i[a]=f,"function"==typeof f&&n.displayName&&(i[a].displayName=n.displayName+"_"+a)}}}function d(e,t){if(t)for(var n in t){var o=t[n];if(t.hasOwnProperty(n)){var r=n in w;u(!r,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',n);var i=n in e;u(!i,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n),e[n]=o}}}function h(e,t){u(e&&t&&"object"==typeof e&&"object"==typeof t,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var n in t)t.hasOwnProperty(n)&&(u(void 0===e[n],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",n),e[n]=t[n]);return e}function m(e,t){return function(){var n=e.apply(this,arguments),o=t.apply(this,arguments);if(null==n)return o;if(null==o)return n;var r={};return h(r,n),h(r,o),r}}function y(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function v(e,t){var n=t.bind(e);n.__reactBoundContext=e,n.__reactBoundMethod=t,n.__reactBoundArguments=null;var o=e.constructor.displayName,r=n.bind;return n.bind=function(i){for(var s=arguments.length,a=Array(s>1?s-1:0),u=1;u=0)&&n(e,!o)}function s(e){return[].slice.call(e.querySelectorAll("*"),0).filter(function(e){return i(e)})}e.exports=s},function(e,t,n){"use strict";var o=n(15);e.exports=function(e,t){var n=o(e);if(!n.length)return void t.preventDefault();var r=n[t.shiftKey?0:n.length-1],i=r===document.activeElement||e===document.activeElement;if(i){t.preventDefault();var s=n[t.shiftKey?n.length-1:0];s.focus()}}},function(e,t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function o(e,t){for(var n=-1,o=Array(e);++n1?n[r-1]:void 0,s=r>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(r--,i):void 0,s&&f(n[0],n[1],s)&&(i=r<3?void 0:i,r=1),t=Object(t);++o-1&&e%1==0&&e-1&&e%1==0&&e<=w}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function E(e){return!!e&&"object"==typeof e}function C(e){return y(e)?i(e):a(e)}var w=9007199254740991,x="[object Arguments]",N="[object Function]",_="[object GeneratorFunction]",R=/^(?:0|[1-9]\d*)$/,A=Object.prototype,S=A.hasOwnProperty,T=A.toString,D=A.propertyIsEnumerable,M=r(Object.keys,Object),P=Math.max,j=!D.call({valueOf:1},"valueOf"),I=Array.isArray,F=l(function(e,t){if(j||d(t)||y(t))return void c(t,C(t),e);for(var n in t)S.call(t,n)&&s(e,n,t[n])});e.exports=F},function(e,t,n){"use strict";var o=n(2),r=n(19),i=(new o.Component).updater;e.exports=r(o.Component,o.isValidElement,i)},function(e,t,n){"use strict";function o(e){return e}function r(e,t,n){function r(e,t,n){for(var o in t)t.hasOwnProperty(o)&&c("function"==typeof t[o],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",i[n],o)}function p(e,t){var n=E.hasOwnProperty(t)?E[t]:null;x.hasOwnProperty(t)&&u("OVERRIDE_BASE"===n,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",t),e&&u("DEFINE_MANY"===n||"DEFINE_MANY_MERGED"===n,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",t)}function f(e,n){if(!n){var o=typeof n,r="object"===o&&null!==n;return void c(r,"%s: You're attempting to include a mixin that is either null or not an object. Check the mixins included by the component, as well as any mixins they include themselves. Expected object but got %s.",e.displayName||"ReactClass",null===n?null:o)}u("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),u(!t(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var i=e.prototype,s=i.__reactAutoBindPairs;n.hasOwnProperty(l)&&C.mixins(e,n.mixins);for(var a in n)if(n.hasOwnProperty(a)&&a!==l){var f=n[a],d=i.hasOwnProperty(a);if(p(d,a),C.hasOwnProperty(a))C[a](e,f);else{var h=E.hasOwnProperty(a),v="function"==typeof f,b=v&&!h&&!d&&n.autobind!==!1;if(b)s.push(a,f),i[a]=f;else if(d){var g=E[a];u(h&&("DEFINE_MANY_MERGED"===g||"DEFINE_MANY"===g),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",g,a),"DEFINE_MANY_MERGED"===g?i[a]=m(i[a],f):"DEFINE_MANY"===g&&(i[a]=y(i[a],f))}else i[a]=f,"function"==typeof f&&n.displayName&&(i[a].displayName=n.displayName+"_"+a)}}}function d(e,t){if(t)for(var n in t){var o=t[n];if(t.hasOwnProperty(n)){var r=n in C;u(!r,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',n);var i=n in e;u(!i,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n),e[n]=o}}}function h(e,t){u(e&&t&&"object"==typeof e&&"object"==typeof t,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var n in t)t.hasOwnProperty(n)&&(u(void 0===e[n],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",n),e[n]=t[n]);return e}function m(e,t){return function(){var n=e.apply(this,arguments),o=t.apply(this,arguments);if(null==n)return o;if(null==o)return n;var r={};return h(r,n),h(r,o),r}}function y(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function v(e,t){var n=t.bind(e);n.__reactBoundContext=e,n.__reactBoundMethod=t,n.__reactBoundArguments=null;var o=e.constructor.displayName,r=n.bind;return n.bind=function(i){for(var s=arguments.length,a=Array(s>1?s-1:0),u=1;u