From 857a30321c593cb22f16762c93dff7f7ac4e4e28 Mon Sep 17 00:00:00 2001
From: Bruno Dias
Date: Wed, 21 Feb 2018 09:54:52 -0300
Subject: [PATCH] Release v3.3.1.
---
CHANGELOG.md | 10 +++
bower.json | 2 +-
dist/react-modal.js | 137 ++++++++++++++++++++++++++++++++--------
dist/react-modal.min.js | 4 +-
package.json | 2 +-
5 files changed, 123 insertions(+), 32 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eee749a6..b4749835 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+v3.3.1 - Wed, 21 Feb 2018 09:53:44 UTC
+--------------------------------------
+
+- [0c6d966](../../commit/0c6d966) [added] htmlOpenClassName will follow the same rules like... bodyOpenClassName.
+- [088e68e](../../commit/088e68e) [added] add class to html when modal is open
+- [e6159b6](../../commit/e6159b6) [chore] Fix README table of contents
+- [241b8a6](../../commit/241b8a6) [chore] Move API documentation from README to gitbook
+- [4c1e590](../../commit/4c1e590) Expand documentation
+
+
v3.2.1 - Thu, 15 Feb 2018 09:07:28 UTC
--------------------------------------
diff --git a/bower.json b/bower.json
index b2499691..c31cbbbc 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "react-modal",
- "version": "3.2.1",
+ "version": "3.3.1",
"homepage": "https://github.com/reactjs/react-modal",
"authors": [
"Ryan Florence",
diff --git a/dist/react-modal.js b/dist/react-modal.js
index e143282c..4be5b39e 100644
--- a/dist/react-modal.js
+++ b/dist/react-modal.js
@@ -682,6 +682,7 @@ Modal.propTypes = {
}),
portalClassName: _propTypes2.default.string,
bodyOpenClassName: _propTypes2.default.string,
+ htmlOpenClassName: _propTypes2.default.string,
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({
base: _propTypes2.default.string.isRequired,
afterOpen: _propTypes2.default.string.isRequired,
@@ -1444,9 +1445,9 @@ var _ariaAppHider = __webpack_require__(7);
var ariaAppHider = _interopRequireWildcard(_ariaAppHider);
-var _bodyClassList = __webpack_require__(19);
+var _classList = __webpack_require__(19);
-var bodyClassList = _interopRequireWildcard(_bodyClassList);
+var classList = _interopRequireWildcard(_classList);
var _safeHTMLElement = __webpack_require__(8);
@@ -1498,11 +1499,15 @@ var ModalPortal = function (_Component) {
_this.afterClose = function () {
var _this$props = _this.props,
appElement = _this$props.appElement,
- ariaHideApp = _this$props.ariaHideApp;
+ ariaHideApp = _this$props.ariaHideApp,
+ htmlOpenClassName = _this$props.htmlOpenClassName,
+ bodyOpenClassName = _this$props.bodyOpenClassName;
- // Remove body class
+ // Remove classes.
- bodyClassList.remove(_this.props.bodyOpenClassName);
+ classList.remove(document.body, bodyOpenClassName);
+
+ htmlOpenClassName && classList.remove(document.getElementsByTagName("html")[0], htmlOpenClassName);
// Reset aria-hidden attribute if all modals have been removed
if (ariaHideApp && ariaHiddenInstances > 0) {
@@ -1694,6 +1699,10 @@ var ModalPortal = function (_Component) {
// eslint-disable-next-line no-console
console.warn('React-Modal: "bodyOpenClassName" prop has been modified. ' + "This may cause unexpected behavior when multiple modals are open.");
}
+ if (newProps.htmlOpenClassName !== this.props.htmlOpenClassName) {
+ // eslint-disable-next-line no-console
+ console.warn('React-Modal: "htmlOpenClassName" prop has been modified. ' + "This may cause unexpected behavior when multiple modals are open.");
+ }
}
// Focus only needs to be set once when the modal is being opened
if (!this.props.isOpen && newProps.isOpen) {
@@ -1723,11 +1732,15 @@ var ModalPortal = function (_Component) {
var _props = this.props,
appElement = _props.appElement,
ariaHideApp = _props.ariaHideApp,
+ htmlOpenClassName = _props.htmlOpenClassName,
bodyOpenClassName = _props.bodyOpenClassName;
- // Add body class
- bodyClassList.add(bodyOpenClassName);
- // Add aria-hidden to appElement
+ // Add classes.
+
+ classList.add(document.body, bodyOpenClassName);
+
+ htmlOpenClassName && classList.add(document.getElementsByTagName("html")[0], htmlOpenClassName);
+
if (ariaHideApp) {
ariaHiddenInstances += 1;
ariaAppHider.hide(appElement);
@@ -1800,6 +1813,7 @@ ModalPortal.propTypes = {
className: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.object]),
bodyOpenClassName: _propTypes2.default.string,
+ htmlOpenClassName: _propTypes2.default.string,
ariaHideApp: _propTypes2.default.bool,
appElement: _propTypes2.default.instanceOf(_safeHTMLElement2.default),
onAfterOpen: _propTypes2.default.func,
@@ -2079,41 +2093,108 @@ module.exports = warning;
Object.defineProperty(exports, "__esModule", {
value: true
});
-var classListMap = {};
+exports.dumpClassLists = dumpClassLists;
+var htmlClassList = {};
+var docBodyClassList = {};
+
+function dumpClassLists() {
+ if (undefined !== "production") {
+ var classes = document.getElementsByTagName("html")[0].className;
+ var buffer = "Show tracked classes:\n\n";
+
+ buffer += " (" + classes + "):\n";
+ for (var x in htmlClassList) {
+ buffer += " " + x + " " + htmlClassList[x] + "\n";
+ }
+
+ classes = document.body.className;
-var addClassToMap = function addClassToMap(className) {
- // Set variable and default if none
- if (!classListMap[className]) {
- classListMap[className] = 0;
+ // eslint-disable-next-line max-len
+ buffer += "\n\ndoc.body (" + classes + "):\n";
+ for (var _x in docBodyClassList) {
+ buffer += " " + _x + " " + docBodyClassList[_x] + "\n";
+ }
+
+ buffer += "\n";
+
+ // eslint-disable-next-line no-console
+ console.log(buffer);
}
- classListMap[className] += 1;
+}
+
+/**
+ * Track the number of reference of a class.
+ * @param {object} poll The poll to receive the reference.
+ * @param {string} className The class name.
+ * @return {string}
+ */
+var incrementReference = function incrementReference(poll, className) {
+ if (!poll[className]) {
+ poll[className] = 0;
+ }
+ poll[className] += 1;
return className;
};
-var removeClassFromMap = function removeClassFromMap(className) {
- if (classListMap[className]) {
- classListMap[className] -= 1;
+/**
+ * Drop the reference of a class.
+ * @param {object} poll The poll to receive the reference.
+ * @param {string} className The class name.
+ * @return {string}
+ */
+var decrementReference = function decrementReference(poll, className) {
+ if (poll[className]) {
+ poll[className] -= 1;
}
return className;
};
-var add = function add(bodyClass) {
- bodyClass.split(" ").map(addClassToMap).forEach(function (className) {
- return document.body.classList.add(className);
+/**
+ * Track a class and add to the given class list.
+ * @param {Object} classListRef A class list of an element.
+ * @param {Object} poll The poll to be used.
+ * @param {Array} classes The list of classes to be tracked.
+ */
+var trackClass = function trackClass(classListRef, poll, classes) {
+ classes.forEach(function (className) {
+ incrementReference(poll, className);
+ classListRef.add(className);
});
};
-var remove = function remove(bodyClass) {
- // Remove unused class(es) from body
- bodyClass.split(" ").map(removeClassFromMap).filter(function (className) {
- return classListMap[className] === 0;
- }).forEach(function (className) {
- return document.body.classList.remove(className);
+/**
+ * Untrack a class and remove from the given class list if the reference
+ * reaches 0.
+ * @param {Object} classListRef A class list of an element.
+ * @param {Object} poll The poll to be used.
+ * @param {Array} classes The list of classes to be untracked.
+ */
+var untrackClass = function untrackClass(classListRef, poll, classes) {
+ classes.forEach(function (className) {
+ decrementReference(poll, className);
+ poll[className] === 0 && classListRef.remove(className);
});
};
-exports.add = add;
-exports.remove = remove;
+/**
+ * Public inferface to add classes to the document.body.
+ * @param {string} bodyClass The class string to be added.
+ * It may contain more then one class
+ * with ' ' as separator.
+ */
+var add = exports.add = function add(element, classString) {
+ return trackClass(element.classList, element.nodeName.toLowerCase() == "html" ? htmlClassList : docBodyClassList, classString.split(" "));
+};
+
+/**
+ * Public inferface to remove classes from the document.body.
+ * @param {string} bodyClass The class string to be added.
+ * It may contain more then one class
+ * with ' ' as separator.
+ */
+var remove = exports.remove = function remove(element, classString) {
+ return untrackClass(element.classList, element.nodeName.toLowerCase() == "html" ? htmlClassList : docBodyClassList, classString.split(" "));
+};
/***/ }),
/* 20 */
diff --git a/dist/react-modal.min.js b/dist/react-modal.min.js
index d906c679..8533a1d4 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]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=9)}([function(e,t,n){"use strict";function o(e){return function(){return e}}var r=function(){};r.thatReturns=o,r.thatReturnsFalse=o(!1),r.thatReturnsTrue=o(!0),r.thatReturnsNull=o(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";function o(e,t,n,o,a,u,s,i){if(r(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,a,u,s,i],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var r=function(e){};r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")},e.exports=o},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n){t.exports=e},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};e.exports=n(12)(r,!0)},function(e,t,n){"use strict";var o=n(0),r=o;!function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o2?o-2:0),a=2;a=0)&&a(e,!n)}function s(e){return[].slice.call(e.querySelectorAll("*"),0).filter(u)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;/*!
+!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]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=9)}([function(e,t,n){"use strict";function o(e){return function(){return e}}var r=function(){};r.thatReturns=o,r.thatReturnsFalse=o(!1),r.thatReturnsTrue=o(!0),r.thatReturnsNull=o(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";function o(e,t,n,o,a,u,s,l){if(r(t),!e){var i;if(void 0===t)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,a,u,s,l],f=0;i=new Error(t.replace(/%s/g,function(){return c[f++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}var r=function(e){};r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")},e.exports=o},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n){t.exports=e},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};e.exports=n(12)(r,!0)},function(e,t,n){"use strict";var o=n(0),r=o;!function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o2?o-2:0),a=2;a=0)&&a(e,!n)}function s(e){return[].slice.call(e.querySelectorAll("*"),0).filter(u)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;/*!
* Adapted from jQuery UI core
*
* http://jqueryui.com
@@ -9,7 +9,7 @@
*
* http://api.jqueryui.com/category/ui-core/
*/
-var i=/input|select|textarea|button|object/;e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function r(e){var t=e;if("string"==typeof t){var n=document.querySelectorAll(t);o(n,t),t="length"in n?n[0]:n}return p=t||p}function a(e){return!(!e&&!p)||((0,f.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),!1)}function u(e){a(e)&&(e||p).setAttribute("aria-hidden","true")}function s(e){a(e)&&(e||p).removeAttribute("aria-hidden")}function i(){p=null}function l(){p=null}Object.defineProperty(t,"__esModule",{value:!0}),t.assertNodeList=o,t.setElement=r,t.validateElement=a,t.hide=u,t.show=s,t.documentNotReadyOrSSRTesting=i,t.resetForTesting=l;var c=n(18),f=function(e){return e&&e.__esModule?e:{default:e}}(c),p=null},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canUseDOM=void 0;var o=n(20),r=function(e){return e&&e.__esModule?e:{default:e}}(o),a=r.default,u=a.canUseDOM?window.HTMLElement:{};t.canUseDOM=a.canUseDOM;t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(10),r=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=r.default,e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e()}Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var i=Object.assign||function(e){for(var t=1;t>",P={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(o.thatReturnsNull)}(),arrayOf:p,element:function(){function t(t,n,o,r,a){var u=t[n];if(!e(u)){return new l("Invalid "+r+" `"+a+"` of type `"+C(u)+"` supplied to `"+o+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:d,node:function(){function e(e,t,n,o,r){return b(e[t])?null:new l("Invalid "+o+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")}return c(e)}(),objectOf:h,oneOf:y,oneOfType:v,shape:m};return l.prototype=Error.prototype,P.checkPropTypes=s,P.PropTypes=P,P}},function(e,t,n){"use strict";function o(e,t,n,o,i){for(var l in e)if(e.hasOwnProperty(l)){var c;try{r("function"==typeof e[l],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",o||"React class",n,l),c=e[l](t,l,o,n,null,u)}catch(e){c=e}if(a(!c||c 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).",o||"React class",n,l,typeof c),c instanceof Error&&!(c.message in s)){s[c.message]=!0;var f=i?i():"";a(!1,"Failed %s type: %s%s",n,c.message,null!=f?f:"")}}}var r=n(1),a=n(5),u=n(2),s={};e.exports=o},function(e,t,n){"use strict";var o=n(0),r=n(1),a=n(2);e.exports=function(){function e(e,t,n,o,u,s){s!==a&&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")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=o,n.PropTypes=n,n}},function(e,t,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t0&&0===(j-=1)&&C.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(v.returnFocus(),v.teardownScopedFocus()):v.popWithoutFocus())},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(v.setupScopedFocus(n.node),v.markForFocusLater()),n.setState({isOpen:!0},function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen()}))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus()},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())})},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){e.keyCode===_&&(0,b.default)(n.content,e),n.props.shouldCloseOnEsc&&e.keyCode===P&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null,n.moveFromContentToOverlay=null},n.handleOverlayOnMouseUp=function(){null===n.moveFromContentToOverlay&&(n.shouldClose=!1),n.props.shouldCloseOnOverlayClick&&(n.shouldClose=!0)},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault(),n.moveFromContentToOverlay=!1},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1,n.moveFromContentToOverlay=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var o="object"===(void 0===t?"undefined":l(t))?t:{base:T[e],afterOpen:T[e]+"--after-open",beforeClose:T[e]+"--before-close"},r=o.base;return n.state.afterOpen&&(r=r+" "+o.afterOpen),n.state.beforeClose&&(r=r+" "+o.beforeClose),"string"==typeof t&&t?r+" "+t:r},n.ariaAttributes=function(e){return Object.keys(e).reduce(function(t,n){return t["aria-"+n]=e[n],t},{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return s(t,e),c(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&(this.setFocusAfterRender(!0),this.open())}},{key:"componentWillReceiveProps",value:function(e){e.bodyOpenClassName!==this.props.bodyOpenClassName&&console.warn('React-Modal: "bodyOpenClassName" prop has been modified. This may cause unexpected behavior when multiple modals are open.'),!this.props.isOpen&&e.isOpen?(this.setFocusAfterRender(!0),this.open()):this.props.isOpen&&!e.isOpen&&this.close()}},{key:"componentDidUpdate",value:function(){this.focusAfterRender&&(this.focusContent(),this.setFocusAfterRender(!1))}},{key:"componentWillUnmount",value:function(){this.afterClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.bodyOpenClassName;w.add(o),n&&(j+=1,C.hide(t))}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.overlayClassName,o=e.defaultStyles,r=t?{}:o.content,a=n?{}:o.overlay;return this.shouldBeClosed()?null:p.default.createElement("div",{ref:this.setOverlayRef,className:this.buildClassName("overlay",n),style:i({},a,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown,onMouseUp:this.handleOverlayOnMouseUp,"aria-modal":"true"},p.default.createElement("div",i({ref:this.setContentRef,style:i({},r,this.props.style.content),className:this.buildClassName("content",t),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.ariaAttributes(this.props.aria||{})),this.props.children))}}]),t}(f.Component);M.defaultProps={style:{overlay:{},content:{}}},M.propTypes={isOpen:y.default.bool.isRequired,defaultStyles:y.default.shape({content:y.default.object,overlay:y.default.object}),style:y.default.shape({content:y.default.object,overlay:y.default.object}),className:y.default.oneOfType([y.default.string,y.default.object]),overlayClassName:y.default.oneOfType([y.default.string,y.default.object]),bodyOpenClassName:y.default.string,ariaHideApp:y.default.bool,appElement:y.default.instanceOf(E.default),onAfterOpen:y.default.func,onRequestClose:y.default.func,closeTimeoutMS:y.default.number,shouldFocusAfterRender:y.default.bool,shouldCloseOnOverlayClick:y.default.bool,shouldReturnFocusAfterClose:y.default.bool,role:y.default.string,contentLabel:y.default.string,aria:y.default.object,children:y.default.node,shouldCloseOnEsc:y.default.bool,overlayRef:y.default.func,contentRef:y.default.func},t.default=M,e.exports=t.default},function(e,t,n){"use strict";function o(){y=!0}function r(){if(y){if(y=!1,!d)return;setTimeout(function(){if(!d.contains(document.activeElement)){((0,f.default)(d)[0]||d).focus()}},0)}}function a(){p.push(document.activeElement)}function u(){var e=null;try{return void(0!==p.length&&(e=p.pop(),e.focus()))}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}}function s(){p.length>0&&p.pop()}function i(e){d=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",r,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",r))}function l(){d=null,window.addEventListener?(window.removeEventListener("blur",o),document.removeEventListener("focus",r)):(window.detachEvent("onBlur",o),document.detachEvent("onFocus",r))}Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=o,t.handleFocus=r,t.markForFocusLater=a,t.returnFocus=u,t.popWithoutFocus=s,t.setupScopedFocus=i,t.teardownScopedFocus=l;var c=n(6),f=function(e){return e&&e.__esModule?e:{default:e}}(c),p=[],d=null,y=!1},function(e,t,n){"use strict";function o(e,t){var n=(0,a.default)(e);if(!n.length)return void t.preventDefault();var o=t.shiftKey,r=n[0],u=n[n.length-1];if(e===document.activeElement){if(!o)return;s=u}var s;if(u!==document.activeElement||o||(s=r),r===document.activeElement&&o&&(s=u),s)return t.preventDefault(),void s.focus();var i=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null!=i&&"Chrome"!=i[1]&&null==/\biPod\b|\biPad\b/g.exec(navigator.userAgent)){var l=n.indexOf(document.activeElement);l>-1&&(l+=o?-1:1),t.preventDefault(),n[l].focus()}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var r=n(6),a=function(e){return e&&e.__esModule?e:{default:e}}(r);e.exports=t.default},function(e,t,n){"use strict";var o=function(){};o=function(e,t,n){var o=arguments.length;n=new Array(o>2?o-2:0);for(var r=2;r>",M={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(o.thatReturnsNull)}(),arrayOf:d,element:function(){function t(t,n,o,r,a){var u=t[n];if(!e(u)){return new i("Invalid "+r+" `"+a+"` of type `"+C(u)+"` supplied to `"+o+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:p,node:function(){function e(e,t,n,o,r){return b(e[t])?null:new i("Invalid "+o+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")}return c(e)}(),objectOf:h,oneOf:y,oneOfType:m,shape:v};return i.prototype=Error.prototype,M.checkPropTypes=s,M.PropTypes=M,M}},function(e,t,n){"use strict";function o(e,t,n,o,l){for(var i in e)if(e.hasOwnProperty(i)){var c;try{r("function"==typeof e[i],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",o||"React class",n,i),c=e[i](t,i,o,n,null,u)}catch(e){c=e}if(a(!c||c 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).",o||"React class",n,i,typeof c),c instanceof Error&&!(c.message in s)){s[c.message]=!0;var f=l?l():"";a(!1,"Failed %s type: %s%s",n,c.message,null!=f?f:"")}}}var r=n(1),a=n(5),u=n(2),s={};e.exports=o},function(e,t,n){"use strict";var o=n(0),r=n(1),a=n(2);e.exports=function(){function e(e,t,n,o,u,s){s!==a&&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")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=o,n.PropTypes=n,n}},function(e,t,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&0===(P-=1)&&C.show(t),n.props.shouldFocusAfterRender&&(n.props.shouldReturnFocusAfterClose?(m.returnFocus(),m.teardownScopedFocus()):m.popWithoutFocus())},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(n.props.shouldFocusAfterRender&&(m.setupScopedFocus(n.node),m.markForFocusLater()),n.setState({isOpen:!0},function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen()}))},n.close=function(){n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus()},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())})},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){e.keyCode===_&&(0,b.default)(n.content,e),n.props.shouldCloseOnEsc&&e.keyCode===M&&(e.stopPropagation(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null,n.moveFromContentToOverlay=null},n.handleOverlayOnMouseUp=function(){null===n.moveFromContentToOverlay&&(n.shouldClose=!1),n.props.shouldCloseOnOverlayClick&&(n.shouldClose=!0)},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(e){n.props.shouldCloseOnOverlayClick||e.target!=n.overlay||e.preventDefault(),n.moveFromContentToOverlay=!1},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1,n.moveFromContentToOverlay=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var o="object"===(void 0===t?"undefined":i(t))?t:{base:E[e],afterOpen:E[e]+"--after-open",beforeClose:E[e]+"--before-close"},r=o.base;return n.state.afterOpen&&(r=r+" "+o.afterOpen),n.state.beforeClose&&(r=r+" "+o.beforeClose),"string"==typeof t&&t?r+" "+t:r},n.ariaAttributes=function(e){return Object.keys(e).reduce(function(t,n){return t["aria-"+n]=e[n],t},{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return s(t,e),c(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&(this.setFocusAfterRender(!0),this.open())}},{key:"componentWillReceiveProps",value:function(e){e.bodyOpenClassName!==this.props.bodyOpenClassName&&console.warn('React-Modal: "bodyOpenClassName" prop has been modified. This may cause unexpected behavior when multiple modals are open.'),e.htmlOpenClassName!==this.props.htmlOpenClassName&&console.warn('React-Modal: "htmlOpenClassName" prop has been modified. This may cause unexpected behavior when multiple modals are open.'),!this.props.isOpen&&e.isOpen?(this.setFocusAfterRender(!0),this.open()):this.props.isOpen&&!e.isOpen&&this.close()}},{key:"componentDidUpdate",value:function(){this.focusAfterRender&&(this.focusContent(),this.setFocusAfterRender(!1))}},{key:"componentWillUnmount",value:function(){this.afterClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.htmlOpenClassName,r=e.bodyOpenClassName;w.add(document.body,r),o&&w.add(document.getElementsByTagName("html")[0],o),n&&(P+=1,C.hide(t))}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.overlayClassName,o=e.defaultStyles,r=t?{}:o.content,a=n?{}:o.overlay;return this.shouldBeClosed()?null:d.default.createElement("div",{ref:this.setOverlayRef,className:this.buildClassName("overlay",n),style:l({},a,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown,onMouseUp:this.handleOverlayOnMouseUp,"aria-modal":"true"},d.default.createElement("div",l({ref:this.setContentRef,style:l({},r,this.props.style.content),className:this.buildClassName("content",t),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.ariaAttributes(this.props.aria||{})),this.props.children))}}]),t}(f.Component);j.defaultProps={style:{overlay:{},content:{}}},j.propTypes={isOpen:y.default.bool.isRequired,defaultStyles:y.default.shape({content:y.default.object,overlay:y.default.object}),style:y.default.shape({content:y.default.object,overlay:y.default.object}),className:y.default.oneOfType([y.default.string,y.default.object]),overlayClassName:y.default.oneOfType([y.default.string,y.default.object]),bodyOpenClassName:y.default.string,htmlOpenClassName:y.default.string,ariaHideApp:y.default.bool,appElement:y.default.instanceOf(T.default),onAfterOpen:y.default.func,onRequestClose:y.default.func,closeTimeoutMS:y.default.number,shouldFocusAfterRender:y.default.bool,shouldCloseOnOverlayClick:y.default.bool,shouldReturnFocusAfterClose:y.default.bool,role:y.default.string,contentLabel:y.default.string,aria:y.default.object,children:y.default.node,shouldCloseOnEsc:y.default.bool,overlayRef:y.default.func,contentRef:y.default.func},t.default=j,e.exports=t.default},function(e,t,n){"use strict";function o(){y=!0}function r(){if(y){if(y=!1,!p)return;setTimeout(function(){if(!p.contains(document.activeElement)){((0,f.default)(p)[0]||p).focus()}},0)}}function a(){d.push(document.activeElement)}function u(){var e=null;try{return void(0!==d.length&&(e=d.pop(),e.focus()))}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}}function s(){d.length>0&&d.pop()}function l(e){p=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",r,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",r))}function i(){p=null,window.addEventListener?(window.removeEventListener("blur",o),document.removeEventListener("focus",r)):(window.detachEvent("onBlur",o),document.detachEvent("onFocus",r))}Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=o,t.handleFocus=r,t.markForFocusLater=a,t.returnFocus=u,t.popWithoutFocus=s,t.setupScopedFocus=l,t.teardownScopedFocus=i;var c=n(6),f=function(e){return e&&e.__esModule?e:{default:e}}(c),d=[],p=null,y=!1},function(e,t,n){"use strict";function o(e,t){var n=(0,a.default)(e);if(!n.length)return void t.preventDefault();var o=t.shiftKey,r=n[0],u=n[n.length-1];if(e===document.activeElement){if(!o)return;s=u}var s;if(u!==document.activeElement||o||(s=r),r===document.activeElement&&o&&(s=u),s)return t.preventDefault(),void s.focus();var l=/(\bChrome\b|\bSafari\b)\//.exec(navigator.userAgent);if(null!=l&&"Chrome"!=l[1]&&null==/\biPod\b|\biPad\b/g.exec(navigator.userAgent)){var i=n.indexOf(document.activeElement);i>-1&&(i+=o?-1:1),t.preventDefault(),n[i].focus()}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var r=n(6),a=function(e){return e&&e.__esModule?e:{default:e}}(r);e.exports=t.default},function(e,t,n){"use strict";var o=function(){};o=function(e,t,n){var o=arguments.length;n=new Array(o>2?o-2:0);for(var r=2;r ("+e+"):\n";for(var n in r)t+=" "+n+" "+r[n]+"\n";e=document.body.className,t+="\n\ndoc.body ("+e+"):\n";for(var o in a)t+=" "+o+" "+a[o]+"\n";t+="\n",console.log(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.dumpClassLists=o;var r={},a={},u=function(e,t){return e[t]||(e[t]=0),e[t]+=1,t},s=function(e,t){return e[t]&&(e[t]-=1),t},l=function(e,t,n){n.forEach(function(n){u(t,n),e.add(n)})},i=function(e,t,n){n.forEach(function(n){s(t,n),0===t[n]&&e.remove(n)})};t.add=function(e,t){return l(e.classList,"html"==e.nodeName.toLowerCase()?r:a,t.split(" "))},t.remove=function(e,t){return i(e.classList,"html"==e.nodeName.toLowerCase()?r:a,t.split(" "))}},function(e,t,n){var o;/*!
Copyright (c) 2015 Jed Watson.
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
diff --git a/package.json b/package.json
index 9467697f..f7448fd7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-modal",
- "version": "3.2.1",
+ "version": "3.3.1",
"description": "Accessible modal dialog component for React.JS",
"main": "./lib/index.js",
"repository": {