From ec6b8e55b1e99da243dac61ceec19d86eea85095 Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Thu, 15 Jun 2017 18:16:21 -0300 Subject: [PATCH] Release v2.0.0. --- README.md | 4 +- bower.json | 2 +- dist/react-modal.js | 2847 +++++++++------------------------------ dist/react-modal.min.js | 11 +- package.json | 2 +- yarn.lock | 31 +- 6 files changed, 698 insertions(+), 2199 deletions(-) diff --git a/README.md b/README.md index d98ab588..4d5d3c2c 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Accessible modal dialog component for React.JS ![gzip size](http://img.badgesize.io/https://unpkg.com/react-modal/dist/react-modal.min.js?compression=gzip) ## Active Development -The modal is currently undergoing significant development for a v2 release. The `master` branch contains that development work. -If you'd like to see the latest stable version please use the release tags (https://github.com/reactjs/react-modal/releases) +`v2.0.0` was released. If you have an old clone of `react-modal` for development, don't forget to update. +If you want to create a PR, please target the `v1` branch (It will be the master for now, until all commit are moved from `master > v1`. ### Installation diff --git a/bower.json b/bower.json index 2b406eb9..2e969fbf 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.9.7", + "version": "2.0.0", "homepage": "https://github.com/reactjs/react-modal", "authors": [ "Ryan Florence", diff --git a/dist/react-modal.js b/dist/react-modal.js index 0efeb43d..90d98c41 100644 --- a/dist/react-modal.js +++ b/dist/react-modal.js @@ -64,158 +64,228 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var React = __webpack_require__(2); - var ReactDOM = __webpack_require__(3); - var DOMFactories = __webpack_require__(4); - var PropTypes = __webpack_require__(5); - var ExecutionEnvironment = __webpack_require__(13); - var ModalPortal = React.createFactory(__webpack_require__(14)); - var ariaAppHider = __webpack_require__(23); - var refCount = __webpack_require__(24); - var elementClass = __webpack_require__(25); - var renderSubtreeIntoContainer = __webpack_require__(3).unstable_renderSubtreeIntoContainer; - var Assign = __webpack_require__(18); - var createReactClass = __webpack_require__(19); - - var SafeHTMLElement = ExecutionEnvironment.canUseDOM ? window.HTMLElement : {}; - var AppElement = ExecutionEnvironment.canUseDOM ? document.body : { appendChild: function appendChild() {} }; + Object.defineProperty(exports, "__esModule", { + value: true + }); - function getParentElement(parentSelector) { - return parentSelector(); - } + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - var Modal = createReactClass({ + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - displayName: 'Modal', - statics: { - setAppElement: function setAppElement(element) { - AppElement = ariaAppHider.setElement(element); - }, - injectCSS: function injectCSS() { - "production" !== (undefined) && console.warn('React-Modal: injectCSS has been deprecated ' + 'and no longer has any effect. It will be removed in a later version'); - } - }, + var _react = __webpack_require__(2); - propTypes: { - isOpen: PropTypes.bool.isRequired, - style: PropTypes.shape({ - content: PropTypes.object, - overlay: PropTypes.object - }), - portalClassName: PropTypes.string, - bodyOpenClassName: PropTypes.string, - appElement: PropTypes.instanceOf(SafeHTMLElement), - onAfterOpen: PropTypes.func, - onRequestClose: PropTypes.func, - closeTimeoutMS: PropTypes.number, - ariaHideApp: PropTypes.bool, - shouldCloseOnOverlayClick: PropTypes.bool, - parentSelector: PropTypes.func, - role: PropTypes.string, - contentLabel: PropTypes.string.isRequired - }, + var _react2 = _interopRequireDefault(_react); - getDefaultProps: function getDefaultProps() { - return { - isOpen: false, - portalClassName: 'ReactModalPortal', - bodyOpenClassName: 'ReactModal__Body--open', - ariaHideApp: true, - closeTimeoutMS: 0, - shouldCloseOnOverlayClick: true, - parentSelector: function parentSelector() { - return document.body; - } - }; - }, + var _reactDom = __webpack_require__(3); - componentDidMount: function componentDidMount() { - this.node = document.createElement('div'); - this.node.className = this.props.portalClassName; + var _reactDom2 = _interopRequireDefault(_reactDom); - if (this.props.isOpen) refCount.add(this); + var _propTypes = __webpack_require__(4); - var parent = getParentElement(this.props.parentSelector); - parent.appendChild(this.node); - this.renderPortal(this.props); - }, + var _propTypes2 = _interopRequireDefault(_propTypes); - componentWillUpdate: function componentWillUpdate(newProps) { - if (newProps.portalClassName !== this.props.portalClassName) { - this.node.className = newProps.portalClassName; - } - }, + var _exenv = __webpack_require__(12); - componentWillReceiveProps: function componentWillReceiveProps(newProps) { - if (newProps.isOpen) refCount.add(this); - if (!newProps.isOpen) refCount.remove(this); - var currentParent = getParentElement(this.props.parentSelector); - var newParent = getParentElement(newProps.parentSelector); + var _exenv2 = _interopRequireDefault(_exenv); - if (newParent !== currentParent) { - currentParent.removeChild(this.node); - newParent.appendChild(this.node); - } + var _elementClass = __webpack_require__(13); - this.renderPortal(newProps); - }, + var _elementClass2 = _interopRequireDefault(_elementClass); + + var _ModalPortal = __webpack_require__(14); + + var _ModalPortal2 = _interopRequireDefault(_ModalPortal); + + var _ariaAppHider = __webpack_require__(18); + + var ariaAppHider = _interopRequireWildcard(_ariaAppHider); + + var _refCount = __webpack_require__(19); + + var refCount = _interopRequireWildcard(_refCount); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var EE = _exenv2.default; + var renderSubtreeIntoContainer = _reactDom2.default.unstable_renderSubtreeIntoContainer; + + var SafeHTMLElement = EE.canUseDOM ? window.HTMLElement : {}; + var AppElement = EE.canUseDOM ? document.body : { + appendChild: function appendChild() {} + }; + + function getParentElement(parentSelector) { + return parentSelector(); + } + + var Modal = function (_Component) { + _inherits(Modal, _Component); - componentWillUnmount: function componentWillUnmount() { - if (!this.node) return; + function Modal() { + var _ref; - refCount.remove(this); + var _temp, _this, _ret; - if (this.props.ariaHideApp) { - ariaAppHider.show(this.props.appElement); + _classCallCheck(this, Modal); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - var state = this.portal.state; - var now = Date.now(); - var closesAt = state.isOpen && this.props.closeTimeoutMS && (state.closesAt || now + this.props.closeTimeoutMS); + return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Modal.__proto__ || Object.getPrototypeOf(Modal)).call.apply(_ref, [this].concat(args))), _this), _this.removePortal = function () { + _reactDom2.default.unmountComponentAtNode(_this.node); + var parent = getParentElement(_this.props.parentSelector); + parent.removeChild(_this.node); - if (closesAt) { - if (!state.beforeClose) { - this.portal.closeWithTimeout(); + if (refCount.count() === 0) { + (0, _elementClass2.default)(document.body).remove(_this.props.bodyOpenClassName); + } + }, _this.renderPortal = function (props) { + if (props.isOpen || refCount.count() > 0) { + (0, _elementClass2.default)(document.body).add(_this.props.bodyOpenClassName); + } else { + (0, _elementClass2.default)(document.body).remove(_this.props.bodyOpenClassName); } - var that = this; - setTimeout(function () { - that.removePortal(); - }, closesAt - now); - } else { - this.removePortal(); - } - }, + if (props.ariaHideApp) { + ariaAppHider.toggle(props.isOpen, props.appElement); + } - removePortal: function removePortal() { - ReactDOM.unmountComponentAtNode(this.node); - var parent = getParentElement(this.props.parentSelector); - parent.removeChild(this.node); + _this.portal = renderSubtreeIntoContainer(_this, _react2.default.createElement(_ModalPortal2.default, _extends({ defaultStyles: Modal.defaultStyles }, props)), _this.node); + }, _temp), _possibleConstructorReturn(_this, _ret); + } - if (refCount.count() === 0) { - elementClass(document.body).remove(this.props.bodyOpenClassName); - } - }, + _createClass(Modal, [{ + key: 'componentDidMount', + value: function componentDidMount() { + this.node = document.createElement('div'); + this.node.className = this.props.portalClassName; + + if (this.props.isOpen) refCount.add(this); + + var parent = getParentElement(this.props.parentSelector); + parent.appendChild(this.node); + this.renderPortal(this.props); + } + }, { + key: 'componentWillReceiveProps', + value: function componentWillReceiveProps(newProps) { + if (newProps.isOpen) refCount.add(this); + if (!newProps.isOpen) refCount.remove(this); + var currentParent = getParentElement(this.props.parentSelector); + var newParent = getParentElement(newProps.parentSelector); + + if (newParent !== currentParent) { + currentParent.removeChild(this.node); + newParent.appendChild(this.node); + } - renderPortal: function renderPortal(props) { - if (props.isOpen || refCount.count() > 0) { - elementClass(document.body).add(this.props.bodyOpenClassName); - } else { - elementClass(document.body).remove(this.props.bodyOpenClassName); + this.renderPortal(newProps); } - - if (props.ariaHideApp) { - ariaAppHider.toggle(props.isOpen, props.appElement); + }, { + key: 'componentWillUpdate', + value: function componentWillUpdate(newProps) { + if (newProps.portalClassName !== this.props.portalClassName) { + this.node.className = newProps.portalClassName; + } } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + var _this2 = this; - this.portal = renderSubtreeIntoContainer(this, ModalPortal(Assign({}, props, { defaultStyles: Modal.defaultStyles })), this.node); - }, + if (!this.node) return; - render: function render() { - return DOMFactories.noscript(); - } - }); + refCount.remove(this); + + if (this.props.ariaHideApp) { + ariaAppHider.show(this.props.appElement); + } + + var state = this.portal.state; + var now = Date.now(); + var closesAt = state.isOpen && this.props.closeTimeoutMS && (state.closesAt || now + this.props.closeTimeoutMS); + + if (closesAt) { + if (!state.beforeClose) { + this.portal.closeWithTimeout(); + } + setTimeout(function () { + return _this2.removePortal; + }, closesAt - now); + } else { + this.removePortal(); + } + } + }, { + key: 'render', + value: function render() { + return null; + } + }], [{ + key: 'setAppElement', + value: function setAppElement(element) { + ariaAppHider.setElement(element || AppElement); + } + + /* eslint-disable no-console */ + + }, { + key: 'injectCSS', + value: function injectCSS() { + (undefined) !== "production" && console.warn('React-Modal: injectCSS has been deprecated ' + 'and no longer has any effect. It will be removed in a later version'); + } + /* eslint-enable no-console */ + + /* eslint-disable react/no-unused-prop-types */ + + /* eslint-enable react/no-unused-prop-types */ + + }]); + + return Modal; + }(_react.Component); + + Modal.propTypes = { + isOpen: _propTypes2.default.bool.isRequired, + style: _propTypes2.default.shape({ + content: _propTypes2.default.object, + overlay: _propTypes2.default.object + }), + portalClassName: _propTypes2.default.string, + bodyOpenClassName: _propTypes2.default.string, + className: _propTypes2.default.oneOfType([_propTypes2.default.String, _propTypes2.default.object]), + overlayClassName: _propTypes2.default.oneOfType([_propTypes2.default.String, _propTypes2.default.object]), + appElement: _propTypes2.default.instanceOf(SafeHTMLElement), + onAfterOpen: _propTypes2.default.func, + onRequestClose: _propTypes2.default.func, + closeTimeoutMS: _propTypes2.default.number, + ariaHideApp: _propTypes2.default.bool, + shouldCloseOnOverlayClick: _propTypes2.default.bool, + parentSelector: _propTypes2.default.func, + role: _propTypes2.default.string, + contentLabel: _propTypes2.default.string.isRequired + }; + Modal.defaultProps = { + isOpen: false, + portalClassName: 'ReactModalPortal', + bodyOpenClassName: 'ReactModal__Body--open', + ariaHideApp: true, + closeTimeoutMS: 0, + shouldCloseOnOverlayClick: true, + parentSelector: function parentSelector() { + return document.body; + } + }; Modal.defaultStyles = { overlay: { position: 'fixed', @@ -240,8 +310,7 @@ return /******/ (function(modules) { // webpackBootstrap padding: '20px' } }; - - module.exports = Modal; + exports.default = Modal; /***/ }, /* 2 */ @@ -257,201 +326,6 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 4 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - /** - * Copyright 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - - (function(f) { - if (true) { - module.exports = f(__webpack_require__(2)); - /* global define */ - } else if (typeof define === 'function' && define.amd) { - define(['react'], f); - } else { - var g; - if (typeof window !== 'undefined') { - g = window; - } else if (typeof global !== 'undefined') { - g = global; - } else if (typeof self !== 'undefined') { - g = self; - } else { - g = this; - } - - if (typeof g.React === 'undefined') { - throw Error('React module should be required before ReactDOMFactories'); - } - - g.ReactDOMFactories = f(g.React); - } - })(function(React) { - /** - * Create a factory that creates HTML tag elements. - */ - var createDOMFactory = React.createFactory; - - /** - * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. - */ - var ReactDOMFactories = { - a: createDOMFactory('a'), - abbr: createDOMFactory('abbr'), - address: createDOMFactory('address'), - area: createDOMFactory('area'), - article: createDOMFactory('article'), - aside: createDOMFactory('aside'), - audio: createDOMFactory('audio'), - b: createDOMFactory('b'), - base: createDOMFactory('base'), - bdi: createDOMFactory('bdi'), - bdo: createDOMFactory('bdo'), - big: createDOMFactory('big'), - blockquote: createDOMFactory('blockquote'), - body: createDOMFactory('body'), - br: createDOMFactory('br'), - button: createDOMFactory('button'), - canvas: createDOMFactory('canvas'), - caption: createDOMFactory('caption'), - cite: createDOMFactory('cite'), - code: createDOMFactory('code'), - col: createDOMFactory('col'), - colgroup: createDOMFactory('colgroup'), - data: createDOMFactory('data'), - datalist: createDOMFactory('datalist'), - dd: createDOMFactory('dd'), - del: createDOMFactory('del'), - details: createDOMFactory('details'), - dfn: createDOMFactory('dfn'), - dialog: createDOMFactory('dialog'), - div: createDOMFactory('div'), - dl: createDOMFactory('dl'), - dt: createDOMFactory('dt'), - em: createDOMFactory('em'), - embed: createDOMFactory('embed'), - fieldset: createDOMFactory('fieldset'), - figcaption: createDOMFactory('figcaption'), - figure: createDOMFactory('figure'), - footer: createDOMFactory('footer'), - form: createDOMFactory('form'), - h1: createDOMFactory('h1'), - h2: createDOMFactory('h2'), - h3: createDOMFactory('h3'), - h4: createDOMFactory('h4'), - h5: createDOMFactory('h5'), - h6: createDOMFactory('h6'), - head: createDOMFactory('head'), - header: createDOMFactory('header'), - hgroup: createDOMFactory('hgroup'), - hr: createDOMFactory('hr'), - html: createDOMFactory('html'), - i: createDOMFactory('i'), - iframe: createDOMFactory('iframe'), - img: createDOMFactory('img'), - input: createDOMFactory('input'), - ins: createDOMFactory('ins'), - kbd: createDOMFactory('kbd'), - keygen: createDOMFactory('keygen'), - label: createDOMFactory('label'), - legend: createDOMFactory('legend'), - li: createDOMFactory('li'), - link: createDOMFactory('link'), - main: createDOMFactory('main'), - map: createDOMFactory('map'), - mark: createDOMFactory('mark'), - menu: createDOMFactory('menu'), - menuitem: createDOMFactory('menuitem'), - meta: createDOMFactory('meta'), - meter: createDOMFactory('meter'), - nav: createDOMFactory('nav'), - noscript: createDOMFactory('noscript'), - object: createDOMFactory('object'), - ol: createDOMFactory('ol'), - optgroup: createDOMFactory('optgroup'), - option: createDOMFactory('option'), - output: createDOMFactory('output'), - p: createDOMFactory('p'), - param: createDOMFactory('param'), - picture: createDOMFactory('picture'), - pre: createDOMFactory('pre'), - progress: createDOMFactory('progress'), - q: createDOMFactory('q'), - rp: createDOMFactory('rp'), - rt: createDOMFactory('rt'), - ruby: createDOMFactory('ruby'), - s: createDOMFactory('s'), - samp: createDOMFactory('samp'), - script: createDOMFactory('script'), - section: createDOMFactory('section'), - select: createDOMFactory('select'), - small: createDOMFactory('small'), - source: createDOMFactory('source'), - span: createDOMFactory('span'), - strong: createDOMFactory('strong'), - style: createDOMFactory('style'), - sub: createDOMFactory('sub'), - summary: createDOMFactory('summary'), - sup: createDOMFactory('sup'), - table: createDOMFactory('table'), - tbody: createDOMFactory('tbody'), - td: createDOMFactory('td'), - textarea: createDOMFactory('textarea'), - tfoot: createDOMFactory('tfoot'), - th: createDOMFactory('th'), - thead: createDOMFactory('thead'), - time: createDOMFactory('time'), - title: createDOMFactory('title'), - tr: createDOMFactory('tr'), - track: createDOMFactory('track'), - u: createDOMFactory('u'), - ul: createDOMFactory('ul'), - var: createDOMFactory('var'), - video: createDOMFactory('video'), - wbr: createDOMFactory('wbr'), - - // SVG - circle: createDOMFactory('circle'), - clipPath: createDOMFactory('clipPath'), - defs: createDOMFactory('defs'), - ellipse: createDOMFactory('ellipse'), - g: createDOMFactory('g'), - image: createDOMFactory('image'), - line: createDOMFactory('line'), - linearGradient: createDOMFactory('linearGradient'), - mask: createDOMFactory('mask'), - path: createDOMFactory('path'), - pattern: createDOMFactory('pattern'), - polygon: createDOMFactory('polygon'), - polyline: createDOMFactory('polyline'), - radialGradient: createDOMFactory('radialGradient'), - rect: createDOMFactory('rect'), - stop: createDOMFactory('stop'), - svg: createDOMFactory('svg'), - text: createDOMFactory('text'), - tspan: createDOMFactory('tspan'), - }; - - // due to wrapper and conditionals at the top, this will either become - // `module.exports ReactDOMFactories` if that is available, - // otherwise it will be defined via `define(['react'], ReactDOMFactories)` - // if that is available, - // otherwise it will be defined as global variable. - return ReactDOMFactories; - }); - - - -/***/ }, -/* 5 */ /***/ function(module, exports, __webpack_require__) { /** @@ -478,16 +352,16 @@ return /******/ (function(modules) { // webpackBootstrap // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; - module.exports = __webpack_require__(6)(isValidElement, throwOnDirectAccess); + module.exports = __webpack_require__(5)(isValidElement, throwOnDirectAccess); } else { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__(12)(); + module.exports = __webpack_require__(11)(); } /***/ }, -/* 6 */ +/* 5 */ /***/ function(module, exports, __webpack_require__) { /** @@ -501,12 +375,12 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var emptyFunction = __webpack_require__(7); - var invariant = __webpack_require__(8); - var warning = __webpack_require__(9); + var emptyFunction = __webpack_require__(6); + var invariant = __webpack_require__(7); + var warning = __webpack_require__(8); - var ReactPropTypesSecret = __webpack_require__(10); - var checkPropTypes = __webpack_require__(11); + var ReactPropTypesSecret = __webpack_require__(9); + var checkPropTypes = __webpack_require__(10); module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ @@ -965,7 +839,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 7 */ +/* 6 */ /***/ function(module, exports) { "use strict"; @@ -1008,7 +882,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = emptyFunction; /***/ }, -/* 8 */ +/* 7 */ /***/ function(module, exports, __webpack_require__) { /** @@ -1068,7 +942,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = invariant; /***/ }, -/* 9 */ +/* 8 */ /***/ function(module, exports, __webpack_require__) { /** @@ -1083,7 +957,7 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var emptyFunction = __webpack_require__(7); + var emptyFunction = __webpack_require__(6); /** * Similar to invariant but only logs a warning if the condition is not met. @@ -1139,7 +1013,7 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = warning; /***/ }, -/* 10 */ +/* 9 */ /***/ function(module, exports) { /** @@ -1159,7 +1033,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 11 */ +/* 10 */ /***/ function(module, exports, __webpack_require__) { /** @@ -1174,9 +1048,9 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; if ((undefined) !== 'production') { - var invariant = __webpack_require__(8); - var warning = __webpack_require__(9); - var ReactPropTypesSecret = __webpack_require__(10); + var invariant = __webpack_require__(7); + var warning = __webpack_require__(8); + var ReactPropTypesSecret = __webpack_require__(9); var loggedTypeFailures = {}; } @@ -1226,7 +1100,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 12 */ +/* 11 */ /***/ function(module, exports, __webpack_require__) { /** @@ -1240,8 +1114,8 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; - var emptyFunction = __webpack_require__(7); - var invariant = __webpack_require__(8); + var emptyFunction = __webpack_require__(6); + var invariant = __webpack_require__(7); module.exports = function() { // Important! @@ -1286,7 +1160,7 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 13 */ +/* 12 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! @@ -1331,228 +1205,394 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { +/* 13 */ +/***/ function(module, exports) { - 'use strict'; + module.exports = function(opts) { + return new ElementClass(opts) + } - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + function indexOf(arr, prop) { + if (arr.indexOf) return arr.indexOf(prop) + for (var i = 0, len = arr.length; i < len; i++) + if (arr[i] === prop) return i + return -1 + } - var React = __webpack_require__(2); - var DOMFactories = __webpack_require__(4); - var focusManager = __webpack_require__(15); - var scopeTab = __webpack_require__(17); - var Assign = __webpack_require__(18); - var createReactClass = __webpack_require__(19); + function ElementClass(opts) { + if (!(this instanceof ElementClass)) return new ElementClass(opts) + var self = this + if (!opts) opts = {} - var div = DOMFactories.div; + // similar doing instanceof HTMLElement but works in IE8 + if (opts.nodeType) opts = {el: opts} - // so that our CSS is statically analyzable - var CLASS_NAMES = { - overlay: 'ReactModal__Overlay', - content: 'ReactModal__Content' - }; + this.opts = opts + this.el = opts.el || document.body + if (typeof this.el !== 'object') this.el = document.querySelector(this.el) + } - var ModalPortal = module.exports = createReactClass({ + ElementClass.prototype.add = function(className) { + var el = this.el + if (!el) return + if (el.className === "") return el.className = className + var classes = el.className.split(' ') + if (indexOf(classes, className) > -1) return classes + classes.push(className) + el.className = classes.join(' ') + return classes + } - displayName: 'ModalPortal', - shouldClose: null, + ElementClass.prototype.remove = function(className) { + var el = this.el + if (!el) return + if (el.className === "") return + var classes = el.className.split(' ') + var idx = indexOf(classes, className) + if (idx > -1) classes.splice(idx, 1) + el.className = classes.join(' ') + return classes + } - getDefaultProps: function getDefaultProps() { - return { - style: { - overlay: {}, - content: {} - } - }; - }, + ElementClass.prototype.has = function(className) { + var el = this.el + if (!el) return + var classes = el.className.split(' ') + return indexOf(classes, className) > -1 + } - getInitialState: function getInitialState() { - return { - afterOpen: false, - beforeClose: false - }; - }, + ElementClass.prototype.toggle = function(className) { + var el = this.el + if (!el) return + if (this.has(className)) this.remove(className) + else this.add(className) + } - componentDidMount: function componentDidMount() { - // Focus needs to be set when mounting and already open - if (this.props.isOpen) { - this.setFocusAfterRender(true); - this.open(); - } - }, - componentWillUnmount: function componentWillUnmount() { - clearTimeout(this.closeTimer); - }, +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { - componentWillReceiveProps: function componentWillReceiveProps(newProps) { - // Focus only needs to be set once when the modal is being opened - if (!this.props.isOpen && newProps.isOpen) { - this.setFocusAfterRender(true); - this.open(); - } else if (this.props.isOpen && !newProps.isOpen) { - this.close(); - } - }, + 'use strict'; - componentDidUpdate: function componentDidUpdate() { - if (this.focusAfterRender) { - this.focusContent(); - this.setFocusAfterRender(false); - } - }, + Object.defineProperty(exports, "__esModule", { + value: true + }); - setFocusAfterRender: function setFocusAfterRender(focus) { - this.focusAfterRender = focus; - }, + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - afterClose: function afterClose() { - focusManager.returnFocus(); - focusManager.teardownScopedFocus(); - }, + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - open: function open() { - if (this.state.afterOpen && this.state.beforeClose) { - clearTimeout(this.closeTimer); - this.setState({ beforeClose: false }); - } else { - focusManager.setupScopedFocus(this.node); - focusManager.markForFocusLater(); - this.setState({ isOpen: true }, function () { - this.setState({ afterOpen: true }); + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - if (this.props.isOpen && this.props.onAfterOpen) { - this.props.onAfterOpen(); - } - }.bind(this)); - } - }, + var _react = __webpack_require__(2); - close: function close() { - if (this.props.closeTimeoutMS > 0) this.closeWithTimeout();else this.closeWithoutTimeout(); - }, + var _react2 = _interopRequireDefault(_react); - focusContent: function focusContent() { - // Don't steal focus from inner elements - if (!this.contentHasFocus()) { - this.refs.content.focus(); - } - }, + var _propTypes = __webpack_require__(4); - closeWithTimeout: function closeWithTimeout() { - var closesAt = Date.now() + this.props.closeTimeoutMS; - this.setState({ beforeClose: true, closesAt: closesAt }, function () { - this.closeTimer = setTimeout(this.closeWithoutTimeout, this.state.closesAt - Date.now()); - }.bind(this)); - }, + var _focusManager = __webpack_require__(15); - closeWithoutTimeout: function closeWithoutTimeout() { - this.setState({ - beforeClose: false, - isOpen: false, - afterOpen: false, - closesAt: null - }, this.afterClose); - }, + var focusManager = _interopRequireWildcard(_focusManager); - handleKeyDown: function handleKeyDown(event) { - if (event.keyCode == 9 /*tab*/) scopeTab(this.refs.content, event); - if (event.keyCode == 27 /*esc*/) { - event.preventDefault(); - this.requestClose(event); - } - }, + var _scopeTab = __webpack_require__(17); - handleOverlayOnClick: function handleOverlayOnClick(event) { - if (this.shouldClose === null) { - this.shouldClose = true; - } + var _scopeTab2 = _interopRequireDefault(_scopeTab); - if (this.shouldClose && this.props.shouldCloseOnOverlayClick) { - if (this.ownerHandlesClose()) this.requestClose(event);else this.focusContent(); - } - this.shouldClose = null; - }, + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - handleContentOnClick: function handleContentOnClick() { - this.shouldClose = false; - }, + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - requestClose: function requestClose(event) { - if (this.ownerHandlesClose()) this.props.onRequestClose(event); - }, + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - ownerHandlesClose: function ownerHandlesClose() { - return this.props.onRequestClose; - }, + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - shouldBeClosed: function shouldBeClosed() { - return !this.state.isOpen && !this.state.beforeClose; - }, + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - contentHasFocus: function contentHasFocus() { - return document.activeElement === this.refs.content || this.refs.content.contains(document.activeElement); - }, + // so that our CSS is statically analyzable + var CLASS_NAMES = { + overlay: 'ReactModal__Overlay', + content: 'ReactModal__Content' + }; + + var TAB_KEY = 9; + var ESC_KEY = 27; + + var ModalPortal = function (_Component) { + _inherits(ModalPortal, _Component); + + function ModalPortal(props) { + _classCallCheck(this, ModalPortal); - buildClassName: function buildClassName(which, additional) { - var classNames = (typeof additional === 'undefined' ? 'undefined' : _typeof(additional)) === 'object' ? additional : { - base: CLASS_NAMES[which], - afterOpen: CLASS_NAMES[which] + "--after-open", - beforeClose: CLASS_NAMES[which] + "--before-close" + var _this = _possibleConstructorReturn(this, (ModalPortal.__proto__ || Object.getPrototypeOf(ModalPortal)).call(this, props)); + + _this.setFocusAfterRender = function (focus) { + _this.focusAfterRender = focus; }; - var className = classNames.base; - if (this.state.afterOpen) { - className += " " + classNames.afterOpen; - } - if (this.state.beforeClose) { - className += " " + classNames.beforeClose; - } - return typeof additional === 'string' && additional ? [className, additional].join(" ") : className; - }, - render: function render() { - var contentStyles = this.props.className ? {} : this.props.defaultStyles.content; - var overlayStyles = this.props.overlayClassName ? {} : this.props.defaultStyles.overlay; - - return this.shouldBeClosed() ? div() : div({ - ref: "overlay", - className: this.buildClassName('overlay', this.props.overlayClassName), - style: Assign({}, overlayStyles, this.props.style.overlay || {}), - onClick: this.handleOverlayOnClick - }, div({ - ref: "content", - style: Assign({}, contentStyles, this.props.style.content || {}), - className: this.buildClassName('content', this.props.className), - tabIndex: "-1", - onKeyDown: this.handleKeyDown, - onClick: this.handleContentOnClick, - role: this.props.role, - "aria-label": this.props.contentLabel - }, this.props.children)); - } - }); + _this.afterClose = function () { + focusManager.returnFocus(); + focusManager.teardownScopedFocus(); + }; -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { + _this.open = function () { + if (_this.state.afterOpen && _this.state.beforeClose) { + clearTimeout(_this.closeTimer); + _this.setState({ beforeClose: false }); + } else { + focusManager.setupScopedFocus(_this.node); + focusManager.markForFocusLater(); + _this.setState({ isOpen: true }, function () { + _this.setState({ afterOpen: true }); - 'use strict'; + if (_this.props.isOpen && _this.props.onAfterOpen) { + _this.props.onAfterOpen(); + } + }); + } + }; - var findTabbable = __webpack_require__(16); - var focusLaterElements = []; - var modalElement = null; - var needToFocus = false; + _this.close = function () { + if (_this.props.closeTimeoutMS > 0) { + _this.closeWithTimeout(); + } else { + _this.closeWithoutTimeout(); + } + }; - function handleBlur(event) { - needToFocus = true; - } + _this.focusContent = function () { + return !_this.contentHasFocus() && _this.content.focus(); + }; - function handleFocus(event) { - if (needToFocus) { - needToFocus = false; - if (!modalElement) { - return; + _this.closeWithTimeout = function () { + var closesAt = Date.now() + _this.props.closeTimeoutMS; + _this.setState({ beforeClose: true, closesAt: closesAt }, function () { + _this.closeTimer = setTimeout(_this.closeWithoutTimeout, _this.state.closesAt - Date.now()); + }); + }; + + _this.closeWithoutTimeout = function () { + _this.setState({ + beforeClose: false, + isOpen: false, + afterOpen: false, + closesAt: null + }, _this.afterClose); + }; + + _this.handleKeyDown = function (event) { + if (event.keyCode === TAB_KEY) { + (0, _scopeTab2.default)(_this.content, event); + } + if (event.keyCode === ESC_KEY) { + event.preventDefault(); + _this.requestClose(event); + } + }; + + _this.handleOverlayOnClick = function (event) { + if (_this.shouldClose === null) { + _this.shouldClose = true; + } + + if (_this.shouldClose && _this.props.shouldCloseOnOverlayClick) { + if (_this.ownerHandlesClose()) { + _this.requestClose(event); + } else { + _this.focusContent(); + } + } + _this.shouldClose = null; + }; + + _this.handleContentOnClick = function () { + _this.shouldClose = false; + }; + + _this.requestClose = function (event) { + return _this.ownerHandlesClose() && _this.props.onRequestClose(event); + }; + + _this.ownerHandlesClose = function () { + return _this.props.onRequestClose; + }; + + _this.shouldBeClosed = function () { + return !_this.state.isOpen && !_this.state.beforeClose; + }; + + _this.contentHasFocus = function () { + return document.activeElement === _this.content || _this.content.contains(document.activeElement); + }; + + _this.buildClassName = function (which, additional) { + var classNames = (typeof additional === 'undefined' ? 'undefined' : _typeof(additional)) === 'object' ? additional : { + base: CLASS_NAMES[which], + afterOpen: CLASS_NAMES[which] + '--after-open', + beforeClose: CLASS_NAMES[which] + '--before-close' + }; + var className = classNames.base; + if (_this.state.afterOpen) { + className = className + ' ' + classNames.afterOpen; + } + if (_this.state.beforeClose) { + className = className + ' ' + classNames.beforeClose; + } + return typeof additional === 'string' && additional ? className + ' ' + additional : className; + }; + + _this.state = { + afterOpen: false, + beforeClose: false + }; + + _this.shouldClose = null; + return _this; + } + + _createClass(ModalPortal, [{ + key: 'componentDidMount', + value: function componentDidMount() { + // Focus needs to be set when mounting and already open + if (this.props.isOpen) { + this.setFocusAfterRender(true); + this.open(); + } + } + }, { + key: 'componentWillReceiveProps', + value: function componentWillReceiveProps(newProps) { + // Focus only needs to be set once when the modal is being opened + if (!this.props.isOpen && newProps.isOpen) { + this.setFocusAfterRender(true); + this.open(); + } else if (this.props.isOpen && !newProps.isOpen) { + this.close(); + } + } + }, { + key: 'componentDidUpdate', + value: function componentDidUpdate() { + if (this.focusAfterRender) { + this.focusContent(); + this.setFocusAfterRender(false); + } + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + clearTimeout(this.closeTimer); + } + + // Don't steal focus from inner elements + + }, { + key: 'render', + value: function render() { + var _this2 = this; + + var _props = this.props, + className = _props.className, + overlayClassName = _props.overlayClassName, + defaultStyles = _props.defaultStyles; + + var contentStyles = className ? {} : defaultStyles.content; + var overlayStyles = overlayClassName ? {} : defaultStyles.overlay; + + return this.shouldBeClosed() ? _react2.default.createElement('div', null) : _react2.default.createElement( + 'div', + { + ref: function ref(overlay) { + _this2.overlay = overlay; + }, + className: this.buildClassName('overlay', overlayClassName), + style: _extends({}, overlayStyles, this.props.style.overlay), + onClick: this.handleOverlayOnClick }, + _react2.default.createElement( + 'div', + { + ref: function ref(content) { + _this2.content = content; + }, + style: _extends({}, contentStyles, this.props.style.content), + className: this.buildClassName('content', className), + tabIndex: '-1', + onKeyDown: this.handleKeyDown, + onClick: this.handleContentOnClick, + role: this.props.role, + 'aria-label': this.props.contentLabel }, + this.props.children + ) + ); + } + }]); + + return ModalPortal; + }(_react.Component); + + ModalPortal.defaultProps = { + style: { + overlay: {}, + content: {} + } + }; + ModalPortal.propTypes = { + isOpen: _propTypes.PropTypes.bool.isRequired, + defaultStyles: _propTypes.PropTypes.shape({ + content: _propTypes.PropTypes.object, + overlay: _propTypes.PropTypes.object + }), + style: _propTypes.PropTypes.shape({ + content: _propTypes.PropTypes.object, + overlay: _propTypes.PropTypes.object + }), + className: _propTypes.PropTypes.oneOfType([_propTypes.PropTypes.String, _propTypes.PropTypes.object]), + overlayClassName: _propTypes.PropTypes.oneOfType([_propTypes.PropTypes.String, _propTypes.PropTypes.object]), + onAfterOpen: _propTypes.PropTypes.func, + onRequestClose: _propTypes.PropTypes.func, + closeTimeoutMS: _propTypes.PropTypes.number, + shouldCloseOnOverlayClick: _propTypes.PropTypes.bool, + role: _propTypes.PropTypes.string, + contentLabel: _propTypes.PropTypes.string, + children: _propTypes.PropTypes.node + }; + exports.default = ModalPortal; + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.handleBlur = handleBlur; + exports.handleFocus = handleFocus; + exports.markForFocusLater = markForFocusLater; + exports.returnFocus = returnFocus; + exports.setupScopedFocus = setupScopedFocus; + exports.teardownScopedFocus = teardownScopedFocus; + + var _tabbable = __webpack_require__(16); + + var _tabbable2 = _interopRequireDefault(_tabbable); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var focusLaterElements = []; + var modalElement = null; + var needToFocus = false; + + function handleBlur() { + needToFocus = true; + } + + function handleFocus() { + if (needToFocus) { + needToFocus = false; + if (!modalElement) { + return; } // need to see how jQuery shims document.on('focusin') so we don't need the // setTimeout, firefox doesn't support focusin, if it did, we could focus @@ -1560,29 +1600,33 @@ return /******/ (function(modules) { // webpackBootstrap // is that the document.body gets focus, and then we focus our element right // after, seems fine. setTimeout(function () { - if (modalElement.contains(document.activeElement)) return; - var el = findTabbable(modalElement)[0] || modalElement; + if (modalElement.contains(document.activeElement)) { + return; + } + var el = (0, _tabbable2.default)(modalElement)[0] || modalElement; el.focus(); }, 0); } } - exports.markForFocusLater = function () { + function markForFocusLater() { focusLaterElements.push(document.activeElement); - }; + } - exports.returnFocus = function () { + /* eslint-disable no-console */ + function returnFocus() { var toFocus = null; try { toFocus = focusLaterElements.pop(); toFocus.focus(); return; } catch (e) { - console.warn('You tried to return focus to ' + toFocus + ' but it is not in the DOM anymore'); + console.warn(['You tried to return focus to', toFocus, 'but it is not in the DOM anymore'].join(" ")); } - }; + } + /* eslint-enable no-console */ - exports.setupScopedFocus = function (element) { + function setupScopedFocus(element) { modalElement = element; if (window.addEventListener) { @@ -1592,9 +1636,9 @@ return /******/ (function(modules) { // webpackBootstrap window.attachEvent('onBlur', handleBlur); document.attachEvent('onFocus', handleFocus); } - }; + } - exports.teardownScopedFocus = function () { + function teardownScopedFocus() { modalElement = null; if (window.addEventListener) { @@ -1604,7 +1648,7 @@ return /******/ (function(modules) { // webpackBootstrap window.detachEvent('onBlur', handleBlur); document.detachEvent('onFocus', handleFocus); } - }; + } /***/ }, /* 16 */ @@ -1612,6 +1656,10 @@ return /******/ (function(modules) { // webpackBootstrap 'use strict'; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = findTabbableDescendants; /*! * Adapted from jQuery UI core * @@ -1624,24 +1672,28 @@ return /******/ (function(modules) { // webpackBootstrap * http://api.jqueryui.com/category/ui-core/ */ - function focusable(element, isTabIndexNotNaN) { - var nodeName = element.nodeName.toLowerCase(); - return (/input|select|textarea|button|object/.test(nodeName) ? !element.disabled : "a" === nodeName ? element.href || isTabIndexNotNaN : isTabIndexNotNaN) && visible(element); - } + var tabbableNode = /input|select|textarea|button|object/; function hidden(el) { return el.offsetWidth <= 0 && el.offsetHeight <= 0 || el.style.display === 'none'; } function visible(element) { - while (element) { - if (element === document.body) break; - if (hidden(element)) return false; - element = element.parentNode; + var parentElement = element; + while (parentElement) { + if (parentElement === document.body) break; + if (hidden(parentElement)) return false; + parentElement = parentElement.parentNode; } return true; } + function focusable(element, isTabIndexNotNaN) { + var nodeName = element.nodeName.toLowerCase(); + var res = tabbableNode.test(nodeName) && !element.disabled || (nodeName === "a" ? element.href || isTabIndexNotNaN : isTabIndexNotNaN); + return res && visible(element); + } + function tabbable(element) { var tabIndex = element.getAttribute('tabindex'); if (tabIndex === null) tabIndex = undefined; @@ -1650,23 +1702,28 @@ return /******/ (function(modules) { // webpackBootstrap } function findTabbableDescendants(element) { - return [].slice.call(element.querySelectorAll('*'), 0).filter(function (el) { - return tabbable(el); - }); + return [].slice.call(element.querySelectorAll('*'), 0).filter(tabbable); } - module.exports = findTabbableDescendants; - /***/ }, /* 17 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var findTabbable = __webpack_require__(16); + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = scopeTab; + + var _tabbable = __webpack_require__(16); + + var _tabbable2 = _interopRequireDefault(_tabbable); - module.exports = function (node, event) { - var tabbable = findTabbable(node); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function scopeTab(node, event) { + var tabbable = (0, _tabbable2.default)(node); if (!tabbable.length) { event.preventDefault(); return; @@ -1679,1666 +1736,92 @@ return /******/ (function(modules) { // webpackBootstrap event.preventDefault(); var target = tabbable[event.shiftKey ? tabbable.length - 1 : 0]; target.focus(); - }; + } /***/ }, /* 18 */ /***/ function(module, exports) { - /** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - - /** Used as references for various `Number` constants. */ - var MAX_SAFE_INTEGER = 9007199254740991; - - /** `Object#toString` result references. */ - var argsTag = '[object Arguments]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; + 'use strict'; - /** Used to detect unsigned integer values. */ - var reIsUint = /^(?:0|[1-9]\d*)$/; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.setElement = setElement; + exports.validateElement = validateElement; + exports.hide = hide; + exports.show = show; + exports.toggle = toggle; + exports.resetForTesting = resetForTesting; + var globalElement = typeof document !== 'undefined' ? document.body : null; - /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ - function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); + function setElement(element) { + var useElement = element; + if (typeof useElement === 'string') { + var el = document.querySelectorAll(useElement); + useElement = 'length' in el ? el[0] : el; } - return func.apply(thisArg, args); + globalElement = useElement || globalElement; + return globalElement; } - /** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ - function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); + function validateElement(appElement) { + if (!appElement && !globalElement) { + throw new Error(['react-modal: You must set an element with', '`Modal.setAppElement(el)` to make this accessible']); } - return result; - } - - /** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ - function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; } - /** Used for built-in method references. */ - var objectProto = Object.prototype; - - /** Used to check objects for own properties. */ - var hasOwnProperty = objectProto.hasOwnProperty; - - /** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ - var objectToString = objectProto.toString; - - /** Built-in value references. */ - var propertyIsEnumerable = objectProto.propertyIsEnumerable; - - /* Built-in method references for those with the same name as other `lodash` methods. */ - var nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max; - - /** Detect if properties shadowing those on `Object.prototype` are non-enumerable. */ - var nonEnumShadows = !propertyIsEnumerable.call({ 'valueOf': 1 }, 'valueOf'); - - /** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ - function arrayLikeKeys(value, inherited) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - // Safari 9 makes `arguments.length` enumerable in strict mode. - var result = (isArray(value) || isArguments(value)) - ? baseTimes(value.length, String) - : []; - - var length = result.length, - skipIndexes = !!length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && (key == 'length' || isIndex(key, length)))) { - result.push(key); - } - } - return result; + function hide(appElement) { + validateElement(appElement); + (appElement || globalElement).setAttribute('aria-hidden', 'true'); } - /** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ - function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - object[key] = value; - } + function show(appElement) { + validateElement(appElement); + (appElement || globalElement).removeAttribute('aria-hidden'); } - /** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ - function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; + function toggle(shouldHide, appElement) { + var apply = shouldHide ? hide : show; + apply(appElement); } - /** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ - function baseRest(func, start) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); - - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = array; - return apply(func, this, otherArgs); - }; + function resetForTesting() { + globalElement = document.body; } - /** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ - function copyObject(source, props, object, customizer) { - object || (object = {}); - - var index = -1, - length = props.length; +/***/ }, +/* 19 */ +/***/ function(module, exports) { - while (++index < length) { - var key = props[index]; + "use strict"; - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.add = add; + exports.remove = remove; + exports.count = count; + var modals = []; - assignValue(object, key, newValue === undefined ? source[key] : newValue); + function add(element) { + if (modals.indexOf(element) === -1) { + modals.push(element); } - return object; - } - - /** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ - function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; - } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } - } - return object; - }); - } - - /** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ - function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); } - /** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ - function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); + function remove(element) { + var index = modals.indexOf(element); + if (index === -1) { + return; } - return false; - } - - /** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ - function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; - } - - /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ - function eq(value, other) { - return value === other || (value !== value && other !== other); - } - - /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); - } - - /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ - var isArray = Array.isArray; - - /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ - function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); - } - - /** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ - function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); + modals.splice(index, 1); } - /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ - function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; + function count() { + return modals.length; } - /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ - function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; - } - - /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ - function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); - } - - /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ - function isObjectLike(value) { - return !!value && typeof value == 'object'; - } - - /** - * Assigns own enumerable string keyed properties of source objects to the - * destination object. Source objects are applied from left to right. - * Subsequent sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object` and is loosely based on - * [`Object.assign`](https://mdn.io/Object/assign). - * - * @static - * @memberOf _ - * @since 0.10.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @see _.assignIn - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * function Bar() { - * this.c = 3; - * } - * - * Foo.prototype.b = 2; - * Bar.prototype.d = 4; - * - * _.assign({ 'a': 0 }, new Foo, new Bar); - * // => { 'a': 1, 'c': 3 } - */ - var assign = createAssigner(function(object, source) { - if (nonEnumShadows || isPrototype(source) || isArrayLike(source)) { - copyObject(source, keys(source), object); - return; - } - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - assignValue(object, key, source[key]); - } - } - }); - - /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ - function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); - } - - module.exports = assign; - - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - - 'use strict'; - - var React = __webpack_require__(2); - var factory = __webpack_require__(20); - - // Hack to grab NoopUpdateQueue from isomorphic React - var ReactNoopUpdateQueue = new React.Component().updater; - - module.exports = factory( - React.Component, - React.isValidElement, - ReactNoopUpdateQueue - ); - - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - - 'use strict'; - - var _assign = __webpack_require__(21); - - var emptyObject = __webpack_require__(22); - var _invariant = __webpack_require__(8); - - if ((undefined) !== 'production') { - var warning = __webpack_require__(9); - } - - var MIXINS_KEY = 'mixins'; - - // Helper function to allow the creation of anonymous functions which do not - // have .name set to the name of the variable being assigned to. - function identity(fn) { - return fn; - } - - var ReactPropTypeLocationNames; - if ((undefined) !== 'production') { - ReactPropTypeLocationNames = { - prop: 'prop', - context: 'context', - childContext: 'child context', - }; - } else { - ReactPropTypeLocationNames = {}; - } - - function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { - /** - * Policies that describe methods in `ReactClassInterface`. - */ - - - var injectedMixins = []; - - /** - * Composite components are higher-level components that compose other composite - * or host components. - * - * To create a new type of `ReactClass`, pass a specification of - * your new class to `React.createClass`. The only requirement of your class - * specification is that you implement a `render` method. - * - * var MyComponent = React.createClass({ - * render: function() { - * return
Hello World
; - * } - * }); - * - * The class specification supports a specific protocol of methods that have - * special meaning (e.g. `render`). See `ReactClassInterface` for - * more the comprehensive protocol. Any other properties and methods in the - * class specification will be available on the prototype. - * - * @interface ReactClassInterface - * @internal - */ - var ReactClassInterface = { - - /** - * An array of Mixin objects to include when defining your component. - * - * @type {array} - * @optional - */ - mixins: 'DEFINE_MANY', - - /** - * An object containing properties and methods that should be defined on - * the component's constructor instead of its prototype (static methods). - * - * @type {object} - * @optional - */ - statics: 'DEFINE_MANY', - - /** - * Definition of prop types for this component. - * - * @type {object} - * @optional - */ - propTypes: 'DEFINE_MANY', - - /** - * Definition of context types for this component. - * - * @type {object} - * @optional - */ - contextTypes: 'DEFINE_MANY', - - /** - * Definition of context types this component sets for its children. - * - * @type {object} - * @optional - */ - childContextTypes: 'DEFINE_MANY', - - // ==== Definition methods ==== - - /** - * Invoked when the component is mounted. Values in the mapping will be set on - * `this.props` if that prop is not specified (i.e. using an `in` check). - * - * This method is invoked before `getInitialState` and therefore cannot rely - * on `this.state` or use `this.setState`. - * - * @return {object} - * @optional - */ - getDefaultProps: 'DEFINE_MANY_MERGED', - - /** - * Invoked once before the component is mounted. The return value will be used - * as the initial value of `this.state`. - * - * getInitialState: function() { - * return { - * isOn: false, - * fooBaz: new BazFoo() - * } - * } - * - * @return {object} - * @optional - */ - getInitialState: 'DEFINE_MANY_MERGED', - - /** - * @return {object} - * @optional - */ - getChildContext: 'DEFINE_MANY_MERGED', - - /** - * Uses props from `this.props` and state from `this.state` to render the - * structure of the component. - * - * No guarantees are made about when or how often this method is invoked, so - * it must not have side effects. - * - * render: function() { - * var name = this.props.name; - * return
Hello, {name}!
; - * } - * - * @return {ReactComponent} - * @nosideeffects - * @required - */ - render: 'DEFINE_ONCE', - - // ==== Delegate methods ==== - - /** - * Invoked when the component is initially created and about to be mounted. - * This may have side effects, but any external subscriptions or data created - * by this method must be cleaned up in `componentWillUnmount`. - * - * @optional - */ - componentWillMount: 'DEFINE_MANY', - - /** - * Invoked when the component has been mounted and has a DOM representation. - * However, there is no guarantee that the DOM node is in the document. - * - * Use this as an opportunity to operate on the DOM when the component has - * been mounted (initialized and rendered) for the first time. - * - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidMount: 'DEFINE_MANY', - - /** - * Invoked before the component receives new props. - * - * Use this as an opportunity to react to a prop transition by updating the - * state using `this.setState`. Current props are accessed via `this.props`. - * - * componentWillReceiveProps: function(nextProps, nextContext) { - * this.setState({ - * likesIncreasing: nextProps.likeCount > this.props.likeCount - * }); - * } - * - * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop - * transition may cause a state change, but the opposite is not true. If you - * need it, you are probably looking for `componentWillUpdate`. - * - * @param {object} nextProps - * @optional - */ - componentWillReceiveProps: 'DEFINE_MANY', - - /** - * Invoked while deciding if the component should be updated as a result of - * receiving new props, state and/or context. - * - * Use this as an opportunity to `return false` when you're certain that the - * transition to the new props/state/context will not require a component - * update. - * - * shouldComponentUpdate: function(nextProps, nextState, nextContext) { - * return !equal(nextProps, this.props) || - * !equal(nextState, this.state) || - * !equal(nextContext, this.context); - * } - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @return {boolean} True if the component should update. - * @optional - */ - shouldComponentUpdate: 'DEFINE_ONCE', - - /** - * Invoked when the component is about to update due to a transition from - * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` - * and `nextContext`. - * - * Use this as an opportunity to perform preparation before an update occurs. - * - * NOTE: You **cannot** use `this.setState()` in this method. - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @param {ReactReconcileTransaction} transaction - * @optional - */ - componentWillUpdate: 'DEFINE_MANY', - - /** - * Invoked when the component's DOM representation has been updated. - * - * Use this as an opportunity to operate on the DOM when the component has - * been updated. - * - * @param {object} prevProps - * @param {?object} prevState - * @param {?object} prevContext - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidUpdate: 'DEFINE_MANY', - - /** - * Invoked when the component is about to be removed from its parent and have - * its DOM representation destroyed. - * - * Use this as an opportunity to deallocate any external resources. - * - * NOTE: There is no `componentDidUnmount` since your component will have been - * destroyed by that point. - * - * @optional - */ - componentWillUnmount: 'DEFINE_MANY', - - // ==== Advanced methods ==== - - /** - * Updates the component's currently mounted DOM representation. - * - * By default, this implements React's rendering and reconciliation algorithm. - * Sophisticated clients may wish to override this. - * - * @param {ReactReconcileTransaction} transaction - * @internal - * @overridable - */ - updateComponent: 'OVERRIDE_BASE' - - }; - - /** - * Mapping from class specification keys to special processing functions. - * - * Although these are declared like instance properties in the specification - * when defining classes using `React.createClass`, they are actually static - * and are accessible on the constructor instead of the prototype. Despite - * being static, they must be defined outside of the "statics" key under - * which all other static methods are defined. - */ - var RESERVED_SPEC_KEYS = { - displayName: function (Constructor, displayName) { - Constructor.displayName = displayName; - }, - mixins: function (Constructor, mixins) { - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - mixSpecIntoComponent(Constructor, mixins[i]); - } - } - }, - childContextTypes: function (Constructor, childContextTypes) { - if ((undefined) !== 'production') { - validateTypeDef(Constructor, childContextTypes, 'childContext'); - } - Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); - }, - contextTypes: function (Constructor, contextTypes) { - if ((undefined) !== 'production') { - validateTypeDef(Constructor, contextTypes, 'context'); - } - Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); - }, - /** - * Special case getDefaultProps which should move into statics but requires - * automatic merging. - */ - getDefaultProps: function (Constructor, getDefaultProps) { - if (Constructor.getDefaultProps) { - Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); - } else { - Constructor.getDefaultProps = getDefaultProps; - } - }, - propTypes: function (Constructor, propTypes) { - if ((undefined) !== 'production') { - validateTypeDef(Constructor, propTypes, 'prop'); - } - Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); - }, - statics: function (Constructor, statics) { - mixStaticSpecIntoComponent(Constructor, statics); - }, - autobind: function () {} }; - - function validateTypeDef(Constructor, typeDef, location) { - for (var propName in typeDef) { - if (typeDef.hasOwnProperty(propName)) { - // use a warning instead of an _invariant so components - // don't show up in prod but only in __DEV__ - (undefined) !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0; - } - } - } - - function validateMethodOverride(isAlreadyDefined, name) { - var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; - - // Disallow overriding of base class methods unless explicitly allowed. - if (ReactClassMixin.hasOwnProperty(name)) { - _invariant(specPolicy === 'OVERRIDE_BASE', 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name); - } - - // Disallow defining methods more than once unless explicitly allowed. - if (isAlreadyDefined) { - _invariant(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name); - } - } - - /** - * Mixin helper which handles policy validation and reserved - * specification keys when building React classes. - */ - function mixSpecIntoComponent(Constructor, spec) { - if (!spec) { - if ((undefined) !== 'production') { - var typeofSpec = typeof spec; - var isMixinValid = typeofSpec === 'object' && spec !== null; - - (undefined) !== 'production' ? warning(isMixinValid, '%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.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; - } - - return; - } - - _invariant(typeof spec !== 'function', 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.'); - _invariant(!isValidElement(spec), 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.'); - - var proto = Constructor.prototype; - var autoBindPairs = proto.__reactAutoBindPairs; - - // By handling mixins before any other properties, we ensure the same - // chaining order is applied to methods with DEFINE_MANY policy, whether - // mixins are listed before or after these methods in the spec. - if (spec.hasOwnProperty(MIXINS_KEY)) { - RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); - } - - for (var name in spec) { - if (!spec.hasOwnProperty(name)) { - continue; - } - - if (name === MIXINS_KEY) { - // We have already handled mixins in a special case above. - continue; - } - - var property = spec[name]; - var isAlreadyDefined = proto.hasOwnProperty(name); - validateMethodOverride(isAlreadyDefined, name); - - if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { - RESERVED_SPEC_KEYS[name](Constructor, property); - } else { - // Setup methods on prototype: - // The following member methods should not be automatically bound: - // 1. Expected ReactClass methods (in the "interface"). - // 2. Overridden methods (that were mixed in). - var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); - var isFunction = typeof property === 'function'; - var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; - - if (shouldAutoBind) { - autoBindPairs.push(name, property); - proto[name] = property; - } else { - if (isAlreadyDefined) { - var specPolicy = ReactClassInterface[name]; - - // These cases should already be caught by validateMethodOverride. - _invariant(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name); - - // For methods which are defined more than once, call the existing - // methods before calling the new property, merging if appropriate. - if (specPolicy === 'DEFINE_MANY_MERGED') { - proto[name] = createMergedResultFunction(proto[name], property); - } else if (specPolicy === 'DEFINE_MANY') { - proto[name] = createChainedFunction(proto[name], property); - } - } else { - proto[name] = property; - if ((undefined) !== 'production') { - // Add verbose displayName to the function, which helps when looking - // at profiling tools. - if (typeof property === 'function' && spec.displayName) { - proto[name].displayName = spec.displayName + '_' + name; - } - } - } - } - } - } - } - - function mixStaticSpecIntoComponent(Constructor, statics) { - if (!statics) { - return; - } - for (var name in statics) { - var property = statics[name]; - if (!statics.hasOwnProperty(name)) { - continue; - } - - var isReserved = name in RESERVED_SPEC_KEYS; - _invariant(!isReserved, '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.', name); - - var isInherited = name in Constructor; - _invariant(!isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name); - Constructor[name] = property; - } - } - - /** - * Merge two objects, but throw if both contain the same key. - * - * @param {object} one The first object, which is mutated. - * @param {object} two The second object - * @return {object} one after it has been mutated to contain everything in two. - */ - function mergeIntoWithNoDuplicateKeys(one, two) { - _invariant(one && two && typeof one === 'object' && typeof two === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'); - - for (var key in two) { - if (two.hasOwnProperty(key)) { - _invariant(one[key] === undefined, '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.', key); - one[key] = two[key]; - } - } - return one; - } - - /** - * Creates a function that invokes two functions and merges their return values. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ - function createMergedResultFunction(one, two) { - return function mergedResult() { - var a = one.apply(this, arguments); - var b = two.apply(this, arguments); - if (a == null) { - return b; - } else if (b == null) { - return a; - } - var c = {}; - mergeIntoWithNoDuplicateKeys(c, a); - mergeIntoWithNoDuplicateKeys(c, b); - return c; - }; - } - - /** - * Creates a function that invokes two functions and ignores their return vales. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ - function createChainedFunction(one, two) { - return function chainedFunction() { - one.apply(this, arguments); - two.apply(this, arguments); - }; - } - - /** - * Binds a method to the component. - * - * @param {object} component Component whose method is going to be bound. - * @param {function} method Method to be bound. - * @return {function} The bound method. - */ - function bindAutoBindMethod(component, method) { - var boundMethod = method.bind(component); - if ((undefined) !== 'production') { - boundMethod.__reactBoundContext = component; - boundMethod.__reactBoundMethod = method; - boundMethod.__reactBoundArguments = null; - var componentName = component.constructor.displayName; - var _bind = boundMethod.bind; - boundMethod.bind = function (newThis) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - // User is trying to bind() an autobound method; we effectively will - // ignore the value of "this" that the user is trying to use, so - // let's warn. - if (newThis !== component && newThis !== null) { - (undefined) !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; - } else if (!args.length) { - (undefined) !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0; - return boundMethod; - } - var reboundMethod = _bind.apply(boundMethod, arguments); - reboundMethod.__reactBoundContext = component; - reboundMethod.__reactBoundMethod = method; - reboundMethod.__reactBoundArguments = args; - return reboundMethod; - }; - } - return boundMethod; - } - - /** - * Binds all auto-bound methods in a component. - * - * @param {object} component Component whose method is going to be bound. - */ - function bindAutoBindMethods(component) { - var pairs = component.__reactAutoBindPairs; - for (var i = 0; i < pairs.length; i += 2) { - var autoBindKey = pairs[i]; - var method = pairs[i + 1]; - component[autoBindKey] = bindAutoBindMethod(component, method); - } - } - - var IsMountedMixin = { - componentDidMount: function () { - this.__isMounted = true; - }, - componentWillUnmount: function () { - this.__isMounted = false; - } - }; - - /** - * Add more to the ReactClass base class. These are all legacy features and - * therefore not already part of the modern ReactComponent. - */ - var ReactClassMixin = { - - /** - * TODO: This will be deprecated because state should always keep a consistent - * type signature and the only use case for this, is to avoid that. - */ - replaceState: function (newState, callback) { - this.updater.enqueueReplaceState(this, newState, callback); - }, - - /** - * Checks whether or not this composite component is mounted. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function () { - if ((undefined) !== 'production') { - (undefined) !== 'production' ? warning(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component') : void 0; - this.__didWarnIsMounted = true; - } - return !!this.__isMounted; - } - }; - - var ReactClassComponent = function () {}; - _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); - - /** - * Creates a composite component class given a class specification. - * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass - * - * @param {object} spec Class specification (which must define `render`). - * @return {function} Component constructor function. - * @public - */ - function createClass(spec) { - // To keep our warnings more understandable, we'll use a little hack here to - // ensure that Constructor.name !== 'Constructor'. This makes sure we don't - // unnecessarily identify a class without displayName as 'Constructor'. - var Constructor = identity(function (props, context, updater) { - // This constructor gets overridden by mocks. The argument is used - // by mocks to assert on what gets mounted. - - if ((undefined) !== 'production') { - (undefined) !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; - } - - // Wire up auto-binding - if (this.__reactAutoBindPairs.length) { - bindAutoBindMethods(this); - } - - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - - this.state = null; - - // ReactClasses doesn't have constructors. Instead, they use the - // getInitialState and componentWillMount methods for initialization. - - var initialState = this.getInitialState ? this.getInitialState() : null; - if ((undefined) !== 'production') { - // We allow auto-mocks to proceed as if they're returning null. - if (initialState === undefined && this.getInitialState._isMockFunction) { - // This is probably bad practice. Consider warning here and - // deprecating this convenience. - initialState = null; - } - } - _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent'); - - this.state = initialState; - }); - Constructor.prototype = new ReactClassComponent(); - Constructor.prototype.constructor = Constructor; - Constructor.prototype.__reactAutoBindPairs = []; - - injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); - - mixSpecIntoComponent(Constructor, IsMountedMixin); - mixSpecIntoComponent(Constructor, spec); - - // Initialize the defaultProps property after all mixins have been merged. - if (Constructor.getDefaultProps) { - Constructor.defaultProps = Constructor.getDefaultProps(); - } - - if ((undefined) !== 'production') { - // This is a tag to indicate that the use of these method names is ok, - // since it's used with createClass. If it's not, then it's likely a - // mistake so we'll warn you to use the static property, property - // initializer or constructor respectively. - if (Constructor.getDefaultProps) { - Constructor.getDefaultProps.isReactClassApproved = {}; - } - if (Constructor.prototype.getInitialState) { - Constructor.prototype.getInitialState.isReactClassApproved = {}; - } - } - - _invariant(Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.'); - - if ((undefined) !== 'production') { - (undefined) !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0; - (undefined) !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; - } - - // Reduce time spent doing lookups by setting these on the prototype. - for (var methodName in ReactClassInterface) { - if (!Constructor.prototype[methodName]) { - Constructor.prototype[methodName] = null; - } - } - - return Constructor; - } - - return createClass; - } - - module.exports = factory; - - -/***/ }, -/* 21 */ -/***/ function(module, exports) { - - /* - object-assign - (c) Sindre Sorhus - @license MIT - */ - - 'use strict'; - /* eslint-disable no-unused-vars */ - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } - } - - module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; - }; - - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Copyright (c) 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - - 'use strict'; - - var emptyObject = {}; - - if ((undefined) !== 'production') { - Object.freeze(emptyObject); - } - - module.exports = emptyObject; - -/***/ }, -/* 23 */ -/***/ function(module, exports) { - - 'use strict'; - - var _element = typeof document !== 'undefined' ? document.body : null; - - function setElement(element) { - if (typeof element === 'string') { - var el = document.querySelectorAll(element); - element = 'length' in el ? el[0] : el; - } - _element = element || _element; - return _element; - } - - function hide(appElement) { - validateElement(appElement); - (appElement || _element).setAttribute('aria-hidden', 'true'); - } - - function show(appElement) { - validateElement(appElement); - (appElement || _element).removeAttribute('aria-hidden'); - } - - function toggle(shouldHide, appElement) { - if (shouldHide) hide(appElement);else show(appElement); - } - - function validateElement(appElement) { - if (!appElement && !_element) throw new Error('react-modal: You must set an element with `Modal.setAppElement(el)` to make this accessible'); - } - - function resetForTesting() { - _element = document.body; - } - - exports.toggle = toggle; - exports.setElement = setElement; - exports.show = show; - exports.hide = hide; - exports.resetForTesting = resetForTesting; - -/***/ }, -/* 24 */ -/***/ function(module, exports) { - - "use strict"; - - var modals = []; - - module.exports = { - add: function add(element) { - if (modals.indexOf(element) === -1) { - modals.push(element); - } - }, - remove: function remove(element) { - var index = modals.indexOf(element); - if (index === -1) { - return; - } - modals.splice(index, 1); - }, - count: function count() { - return modals.length; - } - }; - -/***/ }, -/* 25 */ -/***/ function(module, exports) { - - module.exports = function(opts) { - return new ElementClass(opts) - } - - function indexOf(arr, prop) { - if (arr.indexOf) return arr.indexOf(prop) - for (var i = 0, len = arr.length; i < len; i++) - if (arr[i] === prop) return i - return -1 - } - - function ElementClass(opts) { - if (!(this instanceof ElementClass)) return new ElementClass(opts) - var self = this - if (!opts) opts = {} - - // similar doing instanceof HTMLElement but works in IE8 - if (opts.nodeType) opts = {el: opts} - - this.opts = opts - this.el = opts.el || document.body - if (typeof this.el !== 'object') this.el = document.querySelector(this.el) - } - - ElementClass.prototype.add = function(className) { - var el = this.el - if (!el) return - if (el.className === "") return el.className = className - var classes = el.className.split(' ') - if (indexOf(classes, className) > -1) return classes - classes.push(className) - el.className = classes.join(' ') - return classes - } - - ElementClass.prototype.remove = function(className) { - var el = this.el - if (!el) return - if (el.className === "") return - var classes = el.className.split(' ') - var idx = indexOf(classes, className) - if (idx > -1) classes.splice(idx, 1) - el.className = classes.join(' ') - return classes - } - - ElementClass.prototype.has = function(className) { - var el = this.el - if (!el) return - var classes = el.className.split(' ') - return indexOf(classes, className) > -1 - } - - ElementClass.prototype.toggle = function(className) { - var el = this.el - if (!el) return - if (this.has(className)) this.remove(className) - else this.add(className) - } - - /***/ } /******/ ]) }); diff --git a/dist/react-modal.min.js b/dist/react-modal.min.js index 4659ae11..b59da2ee 100644 --- a/dist/react-modal.min.js +++ b/dist/react-modal.min.js @@ -1,9 +1,9 @@ -!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(5),u=n(13),c=r.createFactory(n(14)),l=n(23),p=n(24),f=n(25),d=n(3).unstable_renderSubtreeIntoContainer,h=n(18),m=n(19),y=u.canUseDOM?window.HTMLElement:{},v=u.canUseDOM?document.body:{appendChild:function(){}},b=m({displayName:"Modal",statics:{setAppElement:function(e){v=l.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:a.bool.isRequired,style:a.shape({content:a.object,overlay:a.object}),portalClassName:a.string,bodyOpenClassName:a.string,appElement:a.instanceOf(y),onAfterOpen:a.func,onRequestClose:a.func,closeTimeoutMS:a.number,ariaHideApp:a.bool,shouldCloseOnOverlayClick:a.bool,parentSelector:a.func,role:a.string,contentLabel:a.string.isRequired},getDefaultProps:function(){return{isOpen:!1,portalClassName:"ReactModalPortal",bodyOpenClassName:"ReactModal__Body--open",ariaHideApp:!0,closeTimeoutMS:0,shouldCloseOnOverlayClick:!0,parentSelector:function(){return document.body}}},componentDidMount:function(){this.node=document.createElement("div"),this.node.className=this.props.portalClassName,this.props.isOpen&&p.add(this);var e=o(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)},componentWillUpdate:function(e){e.portalClassName!==this.props.portalClassName&&(this.node.className=e.portalClassName)},componentWillReceiveProps:function(e){e.isOpen&&p.add(this),e.isOpen||p.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(){if(this.node){p.remove(this),this.props.ariaHideApp&&l.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===p.count()&&f(document.body).remove(this.props.bodyOpenClassName)},renderPortal:function(e){e.isOpen||p.count()>0?f(document.body).add(this.props.bodyOpenClassName):f(document.body).remove(this.props.bodyOpenClassName),e.ariaHideApp&&l.toggle(e.isOpen,e.appElement),this.portal=d(this,c(h({},e,{defaultStyles:b.defaultStyles})),this.node)},render:function(){return s.noscript()}});b.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=b},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";!function(t){e.exports=t(n(2))}(function(e){var t=e.createFactory,n={a:t("a"),abbr:t("abbr"),address:t("address"),area:t("area"),article:t("article"),aside:t("aside"),audio:t("audio"),b:t("b"),base:t("base"),bdi:t("bdi"),bdo:t("bdo"),big:t("big"),blockquote:t("blockquote"),body:t("body"),br:t("br"),button:t("button"),canvas:t("canvas"),caption:t("caption"),cite:t("cite"),code:t("code"),col:t("col"),colgroup:t("colgroup"),data:t("data"),datalist:t("datalist"),dd:t("dd"),del:t("del"),details:t("details"),dfn:t("dfn"),dialog:t("dialog"),div:t("div"),dl:t("dl"),dt:t("dt"),em:t("em"),embed:t("embed"),fieldset:t("fieldset"),figcaption:t("figcaption"),figure:t("figure"),footer:t("footer"),form:t("form"),h1:t("h1"),h2:t("h2"),h3:t("h3"),h4:t("h4"),h5:t("h5"),h6:t("h6"),head:t("head"),header:t("header"),hgroup:t("hgroup"),hr:t("hr"),html:t("html"),i:t("i"),iframe:t("iframe"),img:t("img"),input:t("input"),ins:t("ins"),kbd:t("kbd"),keygen:t("keygen"),label:t("label"),legend:t("legend"),li:t("li"),link:t("link"),main:t("main"),map:t("map"),mark:t("mark"),menu:t("menu"),menuitem:t("menuitem"),meta:t("meta"),meter:t("meter"),nav:t("nav"),noscript:t("noscript"),object:t("object"),ol:t("ol"),optgroup:t("optgroup"),option:t("option"),output:t("output"),p:t("p"),param:t("param"),picture:t("picture"),pre:t("pre"),progress:t("progress"),q:t("q"),rp:t("rp"),rt:t("rt"),ruby:t("ruby"),s:t("s"),samp:t("samp"),script:t("script"),section:t("section"),select:t("select"),small:t("small"),source:t("source"),span:t("span"),strong:t("strong"),style:t("style"),sub:t("sub"),summary:t("summary"),sup:t("sup"),table:t("table"),tbody:t("tbody"),td:t("td"),textarea:t("textarea"),tfoot:t("tfoot"),th:t("th"),thead:t("thead"),time:t("time"),title:t("title"),tr:t("tr"),track:t("track"),u:t("u"),ul:t("ul"),var:t("var"),video:t("video"),wbr:t("wbr"),circle:t("circle"),clipPath:t("clipPath"),defs:t("defs"),ellipse:t("ellipse"),g:t("g"),image:t("image"),line:t("line"),linearGradient:t("linearGradient"),mask:t("mask"),path:t("path"),pattern:t("pattern"),polygon:t("polygon"),polyline:t("polyline"),radialGradient:t("radialGradient"),rect:t("rect"),stop:t("stop"),svg:t("svg"),text:t("text"),tspan:t("tspan")};return n})},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(6)(r,i)},function(e,t,n){"use strict";var o=n(7),r=n(8),i=n(9),s=n(10),a=n(11);e.exports=function(e,t){function n(e){var t=e&&(A&&e[A]||e[S]);if("function"==typeof t)return t}function u(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function c(e){this.message=e,this.stack=""}function l(e){function n(n,a,u,l,p,f,d){if(l=l||R,f=f||u,d!==s)if(t)r(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("undefined"!=typeof console){var h=l+":"+u;o[h]||(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",f,l),o[h]=!0)}return null==a[u]?n?new c(null===a[u]?"The "+p+" `"+f+"` is marked as required "+("in `"+l+"`, but its value is `null`."):"The "+p+" `"+f+"` is marked as required in "+("`"+l+"`, but its value is `undefined`.")):null:e(a,u,l,p,f)}var o={},a=n.bind(null,!1);return a.isRequired=n.bind(null,!0),a}function p(e){function t(t,n,o,r,i,s){var a=t[n],u=w(a);if(u!==e){var l=x(a);return new c("Invalid "+r+" `"+i+"` of type "+("`"+l+"` supplied to `"+o+"`, expected ")+("`"+e+"`."))}return null}return l(t)}function f(){return l(o.thatReturnsNull)}function d(e){function t(t,n,o,r,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var u=w(a);return new c("Invalid "+r+" `"+i+"` of type "+("`"+u+"` supplied to `"+o+"`, expected an array."))}for(var l=0;l1?t-1:0),o=1;o2?o-2:0),i=2;i0?(0,w.default)(document.body).add(o.props.bodyOpenClassName):(0,w.default)(document.body).remove(o.props.bodyOpenClassName),e.ariaHideApp&&P.toggle(e.isOpen,e.appElement),o.portal=_(o,p.default.createElement(C.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,this.props.isOpen&&j.add(this);var e=u(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)}},{key:"componentWillReceiveProps",value:function(e){e.isOpen&&j.add(this),e.isOpen||j.remove(this);var t=u(this.props.parentSelector),n=u(e.parentSelector);n!==t&&(t.removeChild(this.node),n.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(){var e=this;if(this.node){j.remove(this),this.props.ariaHideApp&&P.show(this.props.appElement);var t=this.portal.state,n=Date.now(),o=t.isOpen&&this.props.closeTimeoutMS&&(t.closesAt||n+this.props.closeTimeoutMS);o?(t.beforeClose||this.portal.closeWithTimeout(),setTimeout(function(){return e.removePortal},o-n)):this.removePortal()}}},{key:"render",value:function(){return null}}],[{key:"setAppElement",value:function(e){P.setElement(e||R)}},{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);k.propTypes={isOpen:h.default.bool.isRequired,style:h.default.shape({content:h.default.object,overlay:h.default.object}),portalClassName:h.default.string,bodyOpenClassName:h.default.string,className:h.default.oneOfType([h.default.String,h.default.object]),overlayClassName:h.default.oneOfType([h.default.String,h.default.object]),appElement:h.default.instanceOf(x),onAfterOpen:h.default.func,onRequestClose:h.default.func,closeTimeoutMS:h.default.number,ariaHideApp:h.default.bool,shouldCloseOnOverlayClick:h.default.bool,parentSelector:h.default.func,role:h.default.string,contentLabel:h.default.string.isRequired},k.defaultProps={isOpen:!1,portalClassName:"ReactModalPortal",bodyOpenClassName:"ReactModal__Body--open",ariaHideApp:!0,closeTimeoutMS:0,shouldCloseOnOverlayClick:!0,parentSelector:function(){return document.body}},k.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=k},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&&(j&&e[j]||e[E]);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,s,u,c,f,p,d){if(c=c||_,p=p||u,d!==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 y=c+":"+u;o[y]||(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.",p,c),o[y]=!0)}return null==s[u]?n?new l(null===s[u]?"The "+f+" `"+p+"` is marked as required "+("in `"+c+"`, but its value is `null`."):"The "+f+" `"+p+"` is marked as required in "+("`"+c+"`, but its value is `undefined`.")):null:e(s,u,c,f,p)}var o={},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 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;c1?t-1:0),o=1;o2?o-2:0),a=2;a0?this.closeWithTimeout():this.closeWithoutTimeout()},focusContent:function(){this.contentHasFocus()||this.refs.content.focus()},closeWithTimeout:function(){var e=Date.now()+this.props.closeTimeoutMS;this.setState({beforeClose:!0,closesAt:e},function(){this.closeTimer=setTimeout(this.closeWithoutTimeout,this.state.closesAt-Date.now())}.bind(this))},closeWithoutTimeout:function(){this.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},this.afterClose)},handleKeyDown:function(e){9==e.keyCode&&s(this.refs.content,e),27==e.keyCode&&(e.preventDefault(),this.requestClose(e))},handleOverlayOnClick:function(e){null===this.shouldClose&&(this.shouldClose=!0),this.shouldClose&&this.props.shouldCloseOnOverlayClick&&(this.ownerHandlesClose()?this.requestClose(e):this.focusContent()),this.shouldClose=null},handleContentOnClick:function(){this.shouldClose=!1},requestClose:function(e){this.ownerHandlesClose()&&this.props.onRequestClose(e)},ownerHandlesClose:function(){return this.props.onRequestClose},shouldBeClosed:function(){return!this.state.isOpen&&!this.state.beforeClose},contentHasFocus:function(){return document.activeElement===this.refs.content||this.refs.content.contains(document.activeElement)},buildClassName:function(e,t){var n="object"===("undefined"==typeof t?"undefined":o(t))?t:{base:l[e],afterOpen:l[e]+"--after-open",beforeClose:l[e]+"--before-close"},r=n.base;return this.state.afterOpen&&(r+=" "+n.afterOpen),this.state.beforeClose&&(r+=" "+n.beforeClose),"string"==typeof t&&t?[r,t].join(" "):r},render:function(){var e=this.props.className?{}:this.props.defaultStyles.content,t=this.props.overlayClassName?{}:this.props.defaultStyles.overlay;return this.shouldBeClosed()?c():c({ref:"overlay",className:this.buildClassName("overlay",this.props.overlayClassName),style:a({},t,this.props.style.overlay||{}),onClick:this.handleOverlayOnClick},c({ref:"content",style:a({},e,this.props.style.content||{}),className:this.buildClassName("content",this.props.className),tabIndex:"-1",onKeyDown:this.handleKeyDown,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.props.children))}})},function(e,t,n){"use strict";function o(e){u=!0}function r(e){if(u){if(u=!1,!a)return;setTimeout(function(){if(!a.contains(document.activeElement)){var e=i(a)[0]||a;e.focus()}},0)}}var i=n(16),s=[],a=null,u=!1;t.markForFocusLater=function(){s.push(document.activeElement)},t.returnFocus=function(){var e=null;try{return e=s.pop(),void e.focus()}catch(t){console.warn("You tried to return focus to "+e+" but it is not in the DOM anymore")}},t.setupScopedFocus=function(e){a=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",r,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",r))},t.teardownScopedFocus=function(){a=null,window.addEventListener?(window.removeEventListener("blur",o),document.removeEventListener("focus",r)):(window.detachEvent("onBlur",o),document.detachEvent("onFocus",r))}},function(e,t){"use strict";/*! +!function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};o=function(){return a}.call(t,n,t,e),!(void 0!==o&&(e.exports=o))}()},function(e,t){function n(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,o=e.length;n-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){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;t0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return!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===O&&(0,m.default)(n.content,e),e.keyCode===w&&(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:b[e],afterOpen:b[e]+"--after-open",beforeClose:b[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.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){!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(){clearTimeout(this.closeTimer)}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,o=t.overlayClassName,r=t.defaultStyles,a=n?{}:r.content,i=o?{}:r.overlay;return this.shouldBeClosed()?p.default.createElement("div",null):p.default.createElement("div",{ref:function(t){e.overlay=t},className:this.buildClassName("overlay",o),style:u({},i,this.props.style.overlay),onClick:this.handleOverlayOnClick},p.default.createElement("div",{ref:function(t){e.content=t},style:u({},a,this.props.style.content),className:this.buildClassName("content",n),tabIndex:"-1",onKeyDown:this.handleKeyDown,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.props.children))}}]),t}(f.Component);g.defaultProps={style:{overlay:{},content:{}}},g.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]),onAfterOpen:d.PropTypes.func,onRequestClose:d.PropTypes.func,closeTimeoutMS:d.PropTypes.number,shouldCloseOnOverlayClick:d.PropTypes.bool,role:d.PropTypes.string,contentLabel:d.PropTypes.string,children:d.PropTypes.node},t.default=g},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(16),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;/*! * Adapted from jQuery UI core * * http://jqueryui.com @@ -14,9 +14,4 @@ * * http://api.jqueryui.com/category/ui-core/ */ -function n(e,t){var n=e.nodeName.toLowerCase();return(/input|select|textarea|button|object/.test(n)?!e.disabled:"a"===n?e.href||t:t)&&r(e)}function o(e){return e.offsetWidth<=0&&e.offsetHeight<=0||"none"===e.style.display}function r(e){for(;e&&e!==document.body;){if(o(e))return!1;e=e.parentNode}return!0}function i(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var o=isNaN(t);return(o||t>=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(16);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]",A="[object GeneratorFunction]",S=/^(?:0|[1-9]\d*)$/,R=Object.prototype,_=R.hasOwnProperty,T=R.toString,j=R.propertyIsEnumerable,D=r(Object.keys,Object),P=Math.max,M=!j.call({valueOf:1},"valueOf"),I=Array.isArray,k=l(function(e,t){if(M||d(t)||y(t))return void c(t,C(t),e);for(var n in t)_.call(t,n)&&s(e,n,t[n])});e.exports=k},function(e,t,n){"use strict";var o=n(2),r=n(20),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-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))}}])}); \ No newline at end of file +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(16),i=o(a)},function(e,t){"use strict";function n(e){var t=e;if("string"==typeof t){var n=document.querySelectorAll(t);t="length"in n?n[0]:n}return u=t||u}function o(e){if(!e&&!u)throw new Error(["react-modal: You must set an element with","`Modal.setAppElement(el)` to make this accessible"])}function r(e){o(e),(e||u).setAttribute("aria-hidden","true")}function a(e){o(e),(e||u).removeAttribute("aria-hidden")}function i(e,t){var n=e?r:a;n(t)}function s(){u=document.body}Object.defineProperty(t,"__esModule",{value:!0}),t.setElement=n,t.validateElement=o,t.hide=r,t.show=a,t.toggle=i,t.resetForTesting=s;var u="undefined"!=typeof document?document.body:null},function(e,t){"use strict";function n(e){a.indexOf(e)===-1&&a.push(e)}function o(e){var t=a.indexOf(e);t!==-1&&a.splice(t,1)}function r(){return a.length}Object.defineProperty(t,"__esModule",{value:!0}),t.add=n,t.remove=o,t.count=r;var a=[]}])}); \ No newline at end of file diff --git a/package.json b/package.json index df2eac89..da5e9ccf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.9.7", + "version": "2.0.0", "description": "Accessible modal dialog component for React.JS", "main": "./lib/index.js", "repository": { diff --git a/yarn.lock b/yarn.lock index 3f681e45..0424e419 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1411,6 +1411,16 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +coveralls@^2.13.1: + version "2.13.1" + resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-2.13.1.tgz#d70bb9acc1835ec4f063ff9dac5423c17b11f178" + dependencies: + js-yaml "3.6.1" + lcov-parse "0.0.10" + log-driver "1.2.5" + minimist "1.2.0" + request "2.79.0" + create-react-class@^15.5.2: version "15.5.2" resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.5.2.tgz#6a8758348df660b88326a0e764d569f274aad681" @@ -2986,6 +2996,13 @@ js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" +js-yaml@3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" + dependencies: + argparse "^1.0.7" + esprima "^2.6.0" + js-yaml@3.x, js-yaml@^3.5.1: version "3.7.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80" @@ -3374,6 +3391,10 @@ lodash@^4.0.0, lodash@^4.14.0, lodash@^4.2.0, lodash@^4.3.0, lodash@^4.5.0: version "4.17.3" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.3.tgz#557ed7d2a9438cac5fd5a43043ca60cb455e01f7" +log-driver@1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056" + log4js@^0.6.31: version "0.6.38" resolved "https://registry.yarnpkg.com/log4js/-/log4js-0.6.38.tgz#2c494116695d6fb25480943d3fc872e662a522fd" @@ -4650,11 +4671,7 @@ request@2, request@^2.47.0, request@^2.74.0, request@~2.74.0: tough-cookie "~2.3.0" tunnel-agent "~0.4.1" -request@2.9.x: - version "2.9.203" - resolved "https://registry.yarnpkg.com/request/-/request-2.9.203.tgz#6c1711a5407fb94a114219563e44145bcbf4723a" - -request@^2.79.0: +request@2.79.0, request@^2.79.0: version "2.79.0" resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" dependencies: @@ -4679,6 +4696,10 @@ request@^2.79.0: tunnel-agent "~0.4.1" uuid "^3.0.0" +request@2.9.x: + version "2.9.203" + resolved "https://registry.yarnpkg.com/request/-/request-2.9.203.tgz#6c1711a5407fb94a114219563e44145bcbf4723a" + request@~2.69.0: version "2.69.0" resolved "https://registry.yarnpkg.com/request/-/request-2.69.0.tgz#cf91d2e000752b1217155c005241911991a2346a"