Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-modal

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-modal - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

lib/helpers/bodyClassList.js

7

CHANGELOG.md

@@ -0,1 +1,8 @@

v2.2.2 - Tue, 11 Jul 2017 14:20:05 UTC
--------------------------------------
- [581be77](../../commit/581be77) [chore] added test for default parentSelector.
- [e56c414](../../commit/e56c414) [chore] Return null for portal when modal is closed
v2.2.1 - Fri, 30 Jun 2017 09:21:36 UTC

@@ -2,0 +9,0 @@ --------------------------------------

4

dist/react-modal.min.js

@@ -1,2 +0,2 @@

!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";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),a=o(r);t.default=a.default},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 i(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)}function u(e){return e()}Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(2),p=r(f),d=n(3),y=r(d),v=n(4),m=r(v),h=n(12),b=r(h),O=n(17),w=o(O),C=n(19),g=r(C),T=t.portalClassName="ReactModalPortal",P=t.bodyOpenClassName="ReactModal__Body--open",j=y.default.unstable_renderSubtreeIntoContainer,_=function(e){function t(){var e,n,o,r;a(this,t);for(var s=arguments.length,c=Array(s),f=0;f<s;f++)c[f]=arguments[f];return n=o=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.removePortal=function(){y.default.unmountComponentAtNode(o.node);var e=u(o.props.parentSelector);e.removeChild(o.node)},o.renderPortal=function(e){o.portal=j(o,p.default.createElement(b.default,l({defaultStyles:t.defaultStyles},e)),o.node)},r=n,i(o,r)}return s(t,e),c(t,[{key:"componentDidMount",value:function(){this.node=document.createElement("div"),this.node.className=this.props.portalClassName;var e=u(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)}},{key:"componentWillReceiveProps",value:function(e){var t=e.isOpen;if(this.props.isOpen||t){var n=u(this.props.parentSelector),o=u(e.parentSelector);o!==n&&(n.removeChild(this.node),o.appendChild(this.node)),this.renderPortal(e)}}},{key:"componentWillUpdate",value:function(e){e.portalClassName!==this.props.portalClassName&&(this.node.className=e.portalClassName)}},{key:"componentWillUnmount",value:function(){if(this.node){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return null}}],[{key:"setAppElement",value:function(e){w.setElement(e)}},{key:"injectCSS",value:function(){console.warn("React-Modal: injectCSS has been deprecated and no longer has any effect. It will be removed in a later version")}}]),t}(f.Component);_.propTypes={isOpen:m.default.bool.isRequired,style:m.default.shape({content:m.default.object,overlay:m.default.object}),portalClassName:m.default.string,bodyOpenClassName:m.default.string,className:m.default.oneOfType([m.default.string,m.default.object]),overlayClassName:m.default.oneOfType([m.default.string,m.default.object]),appElement:m.default.instanceOf(g.default),onAfterOpen:m.default.func,onRequestClose:m.default.func,closeTimeoutMS:m.default.number,ariaHideApp:m.default.bool,shouldCloseOnOverlayClick:m.default.bool,parentSelector:m.default.func,aria:m.default.object,role:m.default.string,contentLabel:m.default.string.isRequired},_.defaultProps={isOpen:!1,portalClassName:T,bodyOpenClassName:P,ariaHideApp:!0,closeTimeoutMS:0,shouldCloseOnOverlayClick:!0,parentSelector:function(){return document.body}},_.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"}},t.default=_},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},a=!0;e.exports=n(5)(r,a)},function(e,t,n){"use strict";var o=n(6),r=n(7),a=n(8),i=n(9),s=n(10);e.exports=function(e,t){function n(e){var t=e&&(E&&e[E]||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 l(e){this.message=e,this.stack=""}function c(e){function n(n,u,c,f,p,d,y){if(f=f||R,d=d||c,y!==i)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 v=f+":"+c;!o[v]&&s<3&&(a(!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.",d,f),o[v]=!0,s++)}return null==u[c]?n?new l(null===u[c]?"The "+p+" `"+d+"` is marked as required "+("in `"+f+"`, but its value is `null`."):"The "+p+" `"+d+"` is marked as required in "+("`"+f+"`, but its value is `undefined`.")):null:e(u,c,f,p,d)}var o={},s=0,u=n.bind(null,!1);return u.isRequired=n.bind(null,!0),u}function f(e){function t(t,n,o,r,a,i){var s=t[n],u=T(s);if(u!==e){var c=P(s);return new l("Invalid "+r+" `"+a+"` of type "+("`"+c+"` supplied to `"+o+"`, expected ")+("`"+e+"`."))}return null}return c(t)}function p(){return c(o.thatReturnsNull)}function d(e){function t(t,n,o,r,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var u=T(s);return new l("Invalid "+r+" `"+a+"` of type "+("`"+u+"` supplied to `"+o+"`, expected an array."))}for(var c=0;c<s.length;c++){var f=e(s,c,o,r,a+"["+c+"]",i);if(f instanceof Error)return f}return null}return c(t)}function y(){function t(t,n,o,r,a){var i=t[n];if(!e(i)){var s=T(i);return new l("Invalid "+r+" `"+a+"` of type "+("`"+s+"` supplied to `"+o+"`, expected a single ReactElement."))}return null}return c(t)}function v(e){function t(t,n,o,r,a){if(!(t[n]instanceof e)){var i=e.name||R,s=_(t[n]);return new l("Invalid "+r+" `"+a+"` of type "+("`"+s+"` supplied to `"+o+"`, expected ")+("instance of `"+i+"`."))}return null}return c(t)}function m(e){function t(t,n,o,r,a){for(var i=t[n],s=0;s<e.length;s++)if(u(i,e[s]))return null;var c=JSON.stringify(e);return new l("Invalid "+r+" `"+a+"` of value `"+i+"` "+("supplied to `"+o+"`, expected one of "+c+"."))}return Array.isArray(e)?c(t):(a(!1,"Invalid argument supplied to oneOf, expected an instance of array."),o.thatReturnsNull)}function h(e){function t(t,n,o,r,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside objectOf.");var s=t[n],u=T(s);if("object"!==u)return new l("Invalid "+r+" `"+a+"` of type "+("`"+u+"` supplied to `"+o+"`, expected an object."));for(var c in s)if(s.hasOwnProperty(c)){var f=e(s,c,o,r,a+"."+c,i);if(f instanceof Error)return f}return null}return c(t)}function b(e){function t(t,n,o,r,a){for(var s=0;s<e.length;s++){var u=e[s];if(null==u(t,n,o,r,a,i))return null}return new l("Invalid "+r+" `"+a+"` supplied to "+("`"+o+"`."))}if(!Array.isArray(e))return a(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),o.thatReturnsNull;for(var n=0;n<e.length;n++){var r=e[n];if("function"!=typeof r)return a(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",j(r),n),o.thatReturnsNull}return c(t)}function O(){function e(e,t,n,o,r){return C(e[t])?null:new l("Invalid "+o+" `"+r+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return c(e)}function w(e){function t(t,n,o,r,a){var s=t[n],u=T(s);if("object"!==u)return new l("Invalid "+r+" `"+a+"` of type `"+u+"` "+("supplied to `"+o+"`, expected `object`."));for(var c in e){var f=e[c];if(f){var p=f(s,c,o,r,a+"."+c,i);if(p)return p}}return null}return c(t)}function C(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(C);if(null===t||e(t))return!0;var o=n(t);if(!o)return!1;var r,a=o.call(t);if(o!==t.entries){for(;!(r=a.next()).done;)if(!C(r.value))return!1}else for(;!(r=a.next()).done;){var i=r.value;if(i&&!C(i[1]))return!1}return!0;default:return!1}}function g(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function T(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":g(t,e)?"symbol":t}function P(e){if("undefined"==typeof e||null===e)return""+e;var t=T(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function j(e){var t=P(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function _(e){return e.constructor&&e.constructor.name?e.constructor.name:R}var E="function"==typeof Symbol&&Symbol.iterator,S="@@iterator",R="<<anonymous>>",x={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:p(),arrayOf:d,element:y(),instanceOf:v,node:O(),objectOf:h,oneOf:m,oneOfType:b,shape:w};return l.prototype=Error.prototype,x.checkPropTypes=s,x.PropTypes=x,x}},function(e,t){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function o(e,t,n,o,a,i,s,u){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,i,s,u],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";var o=n(6),r=o;!function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var r=0,a="Warning: "+e.replace(/%s/g,function(){return n[r++]});"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}};r=function(t,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!t){for(var o=arguments.length,r=Array(o>2?o-2:0),a=2;a<o;a++)r[a-2]=arguments[a];e.apply(void 0,[n].concat(r))}}}(),e.exports=r},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t,n){"use strict";function o(e,t,n,o,u){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,i)}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=u?u():"";a(!1,"Failed %s type: %s%s",n,c.message,null!=f?f:"")}}}var r=n(7),a=n(8),i=n(9),s={};e.exports=o},function(e,t,n){"use strict";var o=n(6),r=n(7),a=n(9);e.exports=function(){function e(e,t,n,o,i,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 i(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 u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(2),p=r(f),d=n(4),y=n(13),v=r(y),m=n(14),h=o(m),b=n(16),O=r(b),w=n(17),C=o(w),g=n(18),T=o(g),P=n(19),j=r(P),_={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},E=9,S=27,R=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setFocusAfterRender=function(e){n.focusAfterRender=e},n.setOverlayRef=function(e){n.overlay=e},n.setContentRef=function(e){n.content=e},n.afterClose=function(){h.returnFocus(),h.teardownScopedFocus()},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(h.setupScopedFocus(n.node),h.markForFocusLater(),n.setState({isOpen:!0},function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen()}))},n.close=function(){n.beforeClose(),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===E&&(0,O.default)(n.content,e),e.keyCode===S&&(e.preventDefault(),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.handleContentOnClick=function(){n.shouldClose=!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"===("undefined"==typeof t?"undefined":l(t))?t:{base:_[e],afterOpen:_[e]+"--after-open",beforeClose:_[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}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.beforeClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.bodyOpenClassName;T.add(o),(0,v.default)(document.body).add(o),n&&C.hide(t)}},{key:"beforeClose",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.bodyOpenClassName;T.remove(o),0===T.count(o)&&(0,v.default)(document.body).remove(o),n&&T.totalCount()<1&&C.show(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()?p.default.createElement("div",null):p.default.createElement("div",{ref:this.setOverlayRef,className:this.buildClassName("overlay",n),style:u({},a,this.props.style.overlay),onClick:this.handleOverlayOnClick},p.default.createElement("div",u({ref:this.setContentRef,style:u({},r,this.props.style.content),className:this.buildClassName("content",t),tabIndex:"-1",onKeyDown:this.handleKeyDown,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.ariaAttributes(this.props.aria||{})),this.props.children))}}]),t}(f.Component);R.defaultProps={style:{overlay:{},content:{}}},R.propTypes={isOpen:d.PropTypes.bool.isRequired,defaultStyles:d.PropTypes.shape({content:d.PropTypes.object,overlay:d.PropTypes.object}),style:d.PropTypes.shape({content:d.PropTypes.object,overlay:d.PropTypes.object}),className:d.PropTypes.oneOfType([d.PropTypes.string,d.PropTypes.object]),overlayClassName:d.PropTypes.oneOfType([d.PropTypes.string,d.PropTypes.object]),bodyOpenClassName:d.PropTypes.string,ariaHideApp:d.PropTypes.bool,appElement:d.PropTypes.instanceOf(j.default),onAfterOpen:d.PropTypes.func,onRequestClose:d.PropTypes.func,closeTimeoutMS:d.PropTypes.number,shouldCloseOnOverlayClick:d.PropTypes.bool,role:d.PropTypes.string,contentLabel:d.PropTypes.string,aria:d.PropTypes.object,children:d.PropTypes.node},t.default=R},function(e,t){function n(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,o=e.length;n<o;n++)if(e[n]===t)return n;return-1}function o(e){if(!(this instanceof o))return new o(e);e||(e={}),e.nodeType&&(e={el:e}),this.opts=e,this.el=e.el||document.body,"object"!=typeof this.el&&(this.el=document.querySelector(this.el))}e.exports=function(e){return new o(e)},o.prototype.add=function(e){var t=this.el;if(t){if(""===t.className)return t.className=e;var o=t.className.split(" ");return n(o,e)>-1?o:(o.push(e),t.className=o.join(" "),o)}},o.prototype.remove=function(e){var t=this.el;if(t&&""!==t.className){var o=t.className.split(" "),r=n(o,e);return r>-1&&o.splice(r,1),t.className=o.join(" "),o}},o.prototype.has=function(e){var t=this.el;if(t){var o=t.className.split(" ");return n(o,e)>-1}},o.prototype.toggle=function(e){var t=this.el;t&&(this.has(e)?this.remove(e):this.add(e))}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(){y=!0}function a(){if(y){if(y=!1,!d)return;setTimeout(function(){if(!d.contains(document.activeElement)){var e=(0,f.default)(d)[0]||d;e.focus()}},0)}}function i(){p.push(document.activeElement)}function s(){var e=null;try{return e=p.pop(),void e.focus()}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}}function u(e){d=e,window.addEventListener?(window.addEventListener("blur",r,!1),document.addEventListener("focus",a,!0)):(window.attachEvent("onBlur",r),document.attachEvent("onFocus",a))}function l(){d=null,window.addEventListener?(window.removeEventListener("blur",r),document.removeEventListener("focus",a)):(window.detachEvent("onBlur",r),document.detachEvent("onFocus",a))}Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=r,t.handleFocus=a,t.markForFocusLater=i,t.returnFocus=s,t.setupScopedFocus=u,t.teardownScopedFocus=l;var c=n(15),f=o(c),p=[],d=null,y=!1},function(e,t){"use strict";function n(e){return e.offsetWidth<=0&&e.offsetHeight<=0||"none"===e.style.display}function o(e){for(var t=e;t&&t!==document.body;){if(n(t))return!1;t=t.parentNode}return!0}function r(e,t){var n=e.nodeName.toLowerCase(),r=s.test(n)&&!e.disabled||("a"===n?e.href||t:t);return r&&o(e)}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&r(e,!n)}function i(e){return[].slice.call(e.querySelectorAll("*"),0).filter(a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;/*!
!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";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),a=o(r);t.default=a.default},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 i(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 l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(2),p=r(f),d=n(3),y=r(d),v=n(4),m=r(v),h=n(12),b=r(h),O=n(16),w=o(O),C=n(19),g=r(C),T=t.portalClassName="ReactModalPortal",P=t.bodyOpenClassName="ReactModal__Body--open",_=y.default.unstable_renderSubtreeIntoContainer,j=function(e){function t(){var e,n,o,r;a(this,t);for(var u=arguments.length,c=Array(u),f=0;f<u;f++)c[f]=arguments[f];return n=o=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.removePortal=function(){y.default.unmountComponentAtNode(o.node);var e=s(o.props.parentSelector);e.removeChild(o.node)},o.renderPortal=function(e){o.portal=_(o,p.default.createElement(b.default,l({defaultStyles:t.defaultStyles},e)),o.node)},r=n,i(o,r)}return u(t,e),c(t,[{key:"componentDidMount",value:function(){this.node=document.createElement("div"),this.node.className=this.props.portalClassName;var e=s(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)}},{key:"componentWillReceiveProps",value:function(e){var t=e.isOpen;if(this.props.isOpen||t){var n=s(this.props.parentSelector),o=s(e.parentSelector);o!==n&&(n.removeChild(this.node),o.appendChild(this.node)),this.renderPortal(e)}}},{key:"componentWillUpdate",value:function(e){e.portalClassName!==this.props.portalClassName&&(this.node.className=e.portalClassName)}},{key:"componentWillUnmount",value:function(){if(this.node){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return null}}],[{key:"setAppElement",value:function(e){w.setElement(e)}},{key:"injectCSS",value:function(){console.warn("React-Modal: injectCSS has been deprecated and no longer has any effect. It will be removed in a later version")}}]),t}(f.Component);j.propTypes={isOpen:m.default.bool.isRequired,style:m.default.shape({content:m.default.object,overlay:m.default.object}),portalClassName:m.default.string,bodyOpenClassName:m.default.string,className:m.default.oneOfType([m.default.string,m.default.object]),overlayClassName:m.default.oneOfType([m.default.string,m.default.object]),appElement:m.default.instanceOf(g.default),onAfterOpen:m.default.func,onRequestClose:m.default.func,closeTimeoutMS:m.default.number,ariaHideApp:m.default.bool,shouldCloseOnOverlayClick:m.default.bool,parentSelector:m.default.func,aria:m.default.object,role:m.default.string,contentLabel:m.default.string.isRequired},j.defaultProps={isOpen:!1,portalClassName:T,bodyOpenClassName:P,ariaHideApp:!0,closeTimeoutMS:0,shouldCloseOnOverlayClick:!0,parentSelector:function(){return document.body}},j.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"}},t.default=j},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},a=!0;e.exports=n(5)(r,a)},function(e,t,n){"use strict";var o=n(6),r=n(7),a=n(8),i=n(9),u=n(10);e.exports=function(e,t){function n(e){var t=e&&(E&&e[E]||e[R]);if("function"==typeof t)return t}function s(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function l(e){this.message=e,this.stack=""}function c(e){function n(n,s,c,f,p,d,y){if(f=f||S,d=d||c,y!==i)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 v=f+":"+c;!o[v]&&u<3&&(a(!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.",d,f),o[v]=!0,u++)}return null==s[c]?n?new l(null===s[c]?"The "+p+" `"+d+"` is marked as required "+("in `"+f+"`, but its value is `null`."):"The "+p+" `"+d+"` is marked as required in "+("`"+f+"`, but its value is `undefined`.")):null:e(s,c,f,p,d)}var o={},u=0,s=n.bind(null,!1);return s.isRequired=n.bind(null,!0),s}function f(e){function t(t,n,o,r,a,i){var u=t[n],s=T(u);if(s!==e){var c=P(u);return new l("Invalid "+r+" `"+a+"` of type "+("`"+c+"` supplied to `"+o+"`, expected ")+("`"+e+"`."))}return null}return c(t)}function p(){return c(o.thatReturnsNull)}function d(e){function t(t,n,o,r,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var u=t[n];if(!Array.isArray(u)){var s=T(u);return new l("Invalid "+r+" `"+a+"` of type "+("`"+s+"` supplied to `"+o+"`, expected an array."))}for(var c=0;c<u.length;c++){var f=e(u,c,o,r,a+"["+c+"]",i);if(f instanceof Error)return f}return null}return c(t)}function y(){function t(t,n,o,r,a){var i=t[n];if(!e(i)){var u=T(i);return new l("Invalid "+r+" `"+a+"` of type "+("`"+u+"` supplied to `"+o+"`, expected a single ReactElement."))}return null}return c(t)}function v(e){function t(t,n,o,r,a){if(!(t[n]instanceof e)){var i=e.name||S,u=j(t[n]);return new l("Invalid "+r+" `"+a+"` of type "+("`"+u+"` supplied to `"+o+"`, expected ")+("instance of `"+i+"`."))}return null}return c(t)}function m(e){function t(t,n,o,r,a){for(var i=t[n],u=0;u<e.length;u++)if(s(i,e[u]))return null;var c=JSON.stringify(e);return new l("Invalid "+r+" `"+a+"` of value `"+i+"` "+("supplied to `"+o+"`, expected one of "+c+"."))}return Array.isArray(e)?c(t):(a(!1,"Invalid argument supplied to oneOf, expected an instance of array."),o.thatReturnsNull)}function h(e){function t(t,n,o,r,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside objectOf.");var u=t[n],s=T(u);if("object"!==s)return new l("Invalid "+r+" `"+a+"` of type "+("`"+s+"` supplied to `"+o+"`, expected an object."));for(var c in u)if(u.hasOwnProperty(c)){var f=e(u,c,o,r,a+"."+c,i);if(f instanceof Error)return f}return null}return c(t)}function b(e){function t(t,n,o,r,a){for(var u=0;u<e.length;u++){var s=e[u];if(null==s(t,n,o,r,a,i))return null}return new l("Invalid "+r+" `"+a+"` supplied to "+("`"+o+"`."))}if(!Array.isArray(e))return a(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),o.thatReturnsNull;for(var n=0;n<e.length;n++){var r=e[n];if("function"!=typeof r)return a(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",_(r),n),o.thatReturnsNull}return c(t)}function O(){function e(e,t,n,o,r){return C(e[t])?null:new l("Invalid "+o+" `"+r+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return c(e)}function w(e){function t(t,n,o,r,a){var u=t[n],s=T(u);if("object"!==s)return new l("Invalid "+r+" `"+a+"` of type `"+s+"` "+("supplied to `"+o+"`, expected `object`."));for(var c in e){var f=e[c];if(f){var p=f(u,c,o,r,a+"."+c,i);if(p)return p}}return null}return c(t)}function C(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(C);if(null===t||e(t))return!0;var o=n(t);if(!o)return!1;var r,a=o.call(t);if(o!==t.entries){for(;!(r=a.next()).done;)if(!C(r.value))return!1}else for(;!(r=a.next()).done;){var i=r.value;if(i&&!C(i[1]))return!1}return!0;default:return!1}}function g(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function T(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":g(t,e)?"symbol":t}function P(e){if("undefined"==typeof e||null===e)return""+e;var t=T(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function _(e){var t=P(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function j(e){return e.constructor&&e.constructor.name?e.constructor.name:S}var E="function"==typeof Symbol&&Symbol.iterator,R="@@iterator",S="<<anonymous>>",k={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:p(),arrayOf:d,element:y(),instanceOf:v,node:O(),objectOf:h,oneOf:m,oneOfType:b,shape:w};return l.prototype=Error.prototype,k.checkPropTypes=u,k.PropTypes=k,k}},function(e,t){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";function o(e,t,n,o,a,i,u,s){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,i,u,s],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";var o=n(6),r=o;!function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var r=0,a="Warning: "+e.replace(/%s/g,function(){return n[r++]});"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}};r=function(t,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!t){for(var o=arguments.length,r=Array(o>2?o-2:0),a=2;a<o;a++)r[a-2]=arguments[a];e.apply(void 0,[n].concat(r))}}}(),e.exports=r},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t,n){"use strict";function o(e,t,n,o,s){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,i)}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 u)){u[c.message]=!0;var f=s?s():"";a(!1,"Failed %s type: %s%s",n,c.message,null!=f?f:"")}}}var r=n(7),a=n(8),i=n(9),u={};e.exports=o},function(e,t,n){"use strict";var o=n(6),r=n(7),a=n(9);e.exports=function(){function e(e,t,n,o,i,u){u!==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 i(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)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(2),p=r(f),d=n(4),y=n(13),v=o(y),m=n(15),h=r(m),b=n(16),O=o(b),w=n(17),C=o(w),g=n(18),T=o(g),P=n(19),_=r(P),j={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},E=9,R=27,S=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setFocusAfterRender=function(e){n.focusAfterRender=e},n.setOverlayRef=function(e){n.overlay=e},n.setContentRef=function(e){n.content=e},n.afterClose=function(){v.returnFocus(),v.teardownScopedFocus()},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(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.beforeClose(),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===E&&(0,h.default)(n.content,e),e.keyCode===R&&(e.preventDefault(),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.handleContentOnClick=function(){n.shouldClose=!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"===("undefined"==typeof t?"undefined":l(t))?t:{base:j[e],afterOpen:j[e]+"--after-open",beforeClose:j[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}return u(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.beforeClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.bodyOpenClassName;T.add(o),n&&O.hide(t)}},{key:"beforeClose",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.bodyOpenClassName;T.remove(o),n&&C.totalCount()<1&&O.show(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:s({},a,this.props.style.overlay),onClick:this.handleOverlayOnClick},p.default.createElement("div",s({ref:this.setContentRef,style:s({},r,this.props.style.content),className:this.buildClassName("content",t),tabIndex:"-1",onKeyDown:this.handleKeyDown,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.ariaAttributes(this.props.aria||{})),this.props.children))}}]),t}(f.Component);S.defaultProps={style:{overlay:{},content:{}}},S.propTypes={isOpen:d.PropTypes.bool.isRequired,defaultStyles:d.PropTypes.shape({content:d.PropTypes.object,overlay:d.PropTypes.object}),style:d.PropTypes.shape({content:d.PropTypes.object,overlay:d.PropTypes.object}),className:d.PropTypes.oneOfType([d.PropTypes.string,d.PropTypes.object]),overlayClassName:d.PropTypes.oneOfType([d.PropTypes.string,d.PropTypes.object]),bodyOpenClassName:d.PropTypes.string,ariaHideApp:d.PropTypes.bool,appElement:d.PropTypes.instanceOf(_.default),onAfterOpen:d.PropTypes.func,onRequestClose:d.PropTypes.func,closeTimeoutMS:d.PropTypes.number,shouldCloseOnOverlayClick:d.PropTypes.bool,role:d.PropTypes.string,contentLabel:d.PropTypes.string,aria:d.PropTypes.object,children:d.PropTypes.node},t.default=S},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(){y=!0}function a(){if(y){if(y=!1,!d)return;setTimeout(function(){if(!d.contains(document.activeElement)){var e=(0,f.default)(d)[0]||d;e.focus()}},0)}}function i(){p.push(document.activeElement)}function u(){var e=null;try{return e=p.pop(),void e.focus()}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}}function s(e){d=e,window.addEventListener?(window.addEventListener("blur",r,!1),document.addEventListener("focus",a,!0)):(window.attachEvent("onBlur",r),document.attachEvent("onFocus",a))}function l(){d=null,window.addEventListener?(window.removeEventListener("blur",r),document.removeEventListener("focus",a)):(window.detachEvent("onBlur",r),document.detachEvent("onFocus",a))}Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=r,t.handleFocus=a,t.markForFocusLater=i,t.returnFocus=u,t.setupScopedFocus=s,t.teardownScopedFocus=l;var c=n(14),f=o(c),p=[],d=null,y=!1},function(e,t){"use strict";function n(e){return e.offsetWidth<=0&&e.offsetHeight<=0||"none"===e.style.display}function o(e){for(var t=e;t&&t!==document.body;){if(n(t))return!1;t=t.parentNode}return!0}function r(e,t){var n=e.nodeName.toLowerCase(),r=u.test(n)&&!e.disabled||("a"===n?e.href||t:t);return r&&o(e)}function a(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&r(e,!n)}function i(e){return[].slice.call(e.querySelectorAll("*"),0).filter(a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;/*!
* Adapted from jQuery UI core

@@ -12,3 +12,3 @@ *

*/
var s=/input|select|textarea|button|object/},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n=(0,i.default)(e);if(!n.length)return void t.preventDefault();var o=n[t.shiftKey?0:n.length-1],r=o===document.activeElement||e===document.activeElement;if(r){t.preventDefault();var a=n[t.shiftKey?n.length-1:0];a.focus()}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var a=n(15),i=o(a)},function(e,t){"use strict";function n(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function o(e){var t=e;if("string"==typeof t){var o=document.querySelectorAll(t);n(o,t),t="length"in o?o[0]:o}return c=t||c}function r(){return!(!document||!document.body)&&(o(document.body),!0)}function a(e){if(!e&&!c&&!r())throw new Error(["react-modal: Cannot fallback to `document.body`, because it's not ready or available.","If you are doing server-side rendering, use this function to defined an element.","`Modal.setAppElement(el)` to make this accessible"])}function i(e){a(e),(e||c).setAttribute("aria-hidden","true")}function s(e){a(e),(e||c).removeAttribute("aria-hidden")}function u(){c=null}function l(){c=document.body}Object.defineProperty(t,"__esModule",{value:!0}),t.assertNodeList=n,t.setElement=o,t.tryForceFallback=r,t.validateElement=a,t.hide=i,t.show=s,t.documentNotReadyOrSSRTesting=u,t.resetForTesting=l;var c=null},function(e,t){"use strict";function n(e){i[e]||(i[e]=0),i[e]+=1}function o(e){i[e]&&(i[e]-=1)}function r(e){return i[e]}function a(){return Object.keys(i).reduce(function(e,t){return e+i[t]},0)}Object.defineProperty(t,"__esModule",{value:!0}),t.add=n,t.remove=o,t.count=r,t.totalCount=a;var i={}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(20),a=o(r),i=a.default,s=i.canUseDOM?window.HTMLElement:{};t.default=s},function(e,t,n){var o;/*!
var u=/input|select|textarea|button|object/},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n=(0,i.default)(e);if(!n.length)return void t.preventDefault();var o=n[t.shiftKey?0:n.length-1],r=o===document.activeElement||e===document.activeElement;if(r){t.preventDefault();var a=n[t.shiftKey?n.length-1:0];a.focus()}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var a=n(14),i=o(a)},function(e,t){"use strict";function n(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function o(e){var t=e;if("string"==typeof t){var o=document.querySelectorAll(t);n(o,t),t="length"in o?o[0]:o}return c=t||c}function r(){return!(!document||!document.body)&&(o(document.body),!0)}function a(e){if(!e&&!c&&!r())throw new Error(["react-modal: Cannot fallback to `document.body`, because it's not ready or available.","If you are doing server-side rendering, use this function to defined an element.","`Modal.setAppElement(el)` to make this accessible"])}function i(e){a(e),(e||c).setAttribute("aria-hidden","true")}function u(e){a(e),(e||c).removeAttribute("aria-hidden")}function s(){c=null}function l(){c=document.body}Object.defineProperty(t,"__esModule",{value:!0}),t.assertNodeList=n,t.setElement=o,t.tryForceFallback=r,t.validateElement=a,t.hide=i,t.show=u,t.documentNotReadyOrSSRTesting=s,t.resetForTesting=l;var c=null},function(e,t){"use strict";function n(){return i}function o(e){return i[e]||(i[e]=0),i[e]+=1,e}function r(e){return i[e]&&(i[e]-=1),e}function a(){return Object.keys(i).reduce(function(e,t){return e+i[t]},0)}Object.defineProperty(t,"__esModule",{value:!0}),t.get=n,t.add=o,t.remove=r,t.totalCount=a;var i={}},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){e.split(" ").map(u.add).forEach(function(e){return document.body.classList.add(e)})}function a(e){var t=u.get();e.split(" ").map(u.remove).filter(function(e){return 0===t[e]}).forEach(function(e){return document.body.classList.remove(e)})}Object.defineProperty(t,"__esModule",{value:!0}),t.add=r,t.remove=a;var i=n(17),u=o(i)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(20),a=o(r),i=a.default,u=i.canUseDOM?window.HTMLElement:{};t.default=u},function(e,t,n){var o;/*!
Copyright (c) 2015 Jed Watson.

@@ -15,0 +15,0 @@ Based on code that is Copyright 2013-2015, Facebook, Inc.

### CSS Classes
Sometimes it may be preferable to use CSS classes rather than inline styles. You can use the `className` and `overlayClassName` props to specify a given CSS class for each of those.
You can override the default class that is added to `document.body` when the modal is open by defining a property `bodyOpenClassName`.
Sometimes it may be preferable to use CSS classes rather than inline styles.
It's required that `bodyOpenClassName` must be `constant string`, otherwise we would end up with a complex system to manage which class name
should appear or be removed from `document.body` from which modal (if using multiple modals simultaneously).
You can use the `className` and `overlayClassName` props to specify a given CSS
class for each of those.
Note: If you provide those props all default styles will not be applied, leaving all styles under control of the CSS class.
You can override the default class that is added to `document.body` when the
modal is open by defining a property `bodyOpenClassName`.
It's required that `bodyOpenClassName` must be `constant string`, otherwise we
would end up with a complex system to manage which class name should appear or
be removed from `document.body` from which modal (if using multiple modals
simultaneously).
`bodyOpenClassName` can support adding multiple classes to `document.body` when
the modal is open. Add as many class names as you desire, delineated by spaces.
Note: If you provide those props all default styles will not be applied, leaving
all styles under control of the CSS class.
The `portalClassName` can also be used however there are no styles by default applied

@@ -19,6 +19,2 @@ 'use strict';

var _elementClass = require('element-class');
var _elementClass2 = _interopRequireDefault(_elementClass);
var _focusManager = require('../helpers/focusManager');

@@ -40,2 +36,6 @@

var _bodyClassList = require('../helpers/bodyClassList');
var bodyClassList = _interopRequireWildcard(_bodyClassList);
var _safeHTMLElement = require('../helpers/safeHTMLElement');

@@ -260,6 +260,5 @@

bodyOpenClassName = _props.bodyOpenClassName;
// Add body class
refCount.add(bodyOpenClassName);
// Add body class
(0, _elementClass2.default)(document.body).add(bodyOpenClassName);
bodyClassList.add(bodyOpenClassName);
// Add aria-hidden to appElement

@@ -277,8 +276,5 @@ if (ariaHideApp) {

bodyOpenClassName = _props2.bodyOpenClassName;
// Remove class if no more modals are open
refCount.remove(bodyOpenClassName);
// Remove class if no more modals are open
if (refCount.count(bodyOpenClassName) === 0) {
(0, _elementClass2.default)(document.body).remove(bodyOpenClassName);
}
bodyClassList.remove(bodyOpenClassName);
// Reset aria-hidden attribute if all modals have been removed

@@ -303,3 +299,3 @@ if (ariaHideApp && refCount.totalCount() < 1) {

return this.shouldBeClosed() ? _react2.default.createElement('div', null) : _react2.default.createElement(
return this.shouldBeClosed() ? null : _react2.default.createElement(
'div',

@@ -306,0 +302,0 @@ {

@@ -6,30 +6,32 @@ "use strict";

});
exports.get = get;
exports.add = add;
exports.remove = remove;
exports.count = count;
exports.totalCount = totalCount;
var modals = {};
var classListMap = {};
function get() {
return classListMap;
}
function add(bodyClass) {
// Set variable and default if none
if (!modals[bodyClass]) {
modals[bodyClass] = 0;
if (!classListMap[bodyClass]) {
classListMap[bodyClass] = 0;
}
modals[bodyClass] += 1;
classListMap[bodyClass] += 1;
return bodyClass;
}
function remove(bodyClass) {
if (modals[bodyClass]) {
modals[bodyClass] -= 1;
if (classListMap[bodyClass]) {
classListMap[bodyClass] -= 1;
}
return bodyClass;
}
function count(bodyClass) {
return modals[bodyClass];
}
function totalCount() {
return Object.keys(modals).reduce(function (acc, curr) {
return acc + modals[curr];
return Object.keys(classListMap).reduce(function (acc, curr) {
return acc + classListMap[curr];
}, 0);
}
{
"name": "react-modal",
"version": "2.2.1",
"version": "2.2.2",
"description": "Accessible modal dialog component for React.JS",

@@ -64,3 +64,2 @@ "main": "./lib/index.js",

"dependencies": {
"element-class": "^0.2.0",
"exenv": "1.2.0",

@@ -67,0 +66,0 @@ "prop-types": "^15.5.10",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc