From af3d1469eba5d510e3f03765cbd684a18fcd97e5 Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Fri, 16 Jun 2017 11:30:58 -0300 Subject: [PATCH] Release v2.0.1. --- bower.json | 2 +- dist/react-modal.js | 145 +++++++++++++++++++++++++++------------- dist/react-modal.min.js | 2 +- package.json | 2 +- 4 files changed, 103 insertions(+), 48 deletions(-) diff --git a/bower.json b/bower.json index 2e969fbf..d717ae8a 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "2.0.0", + "version": "2.0.1", "homepage": "https://github.com/reactjs/react-modal", "authors": [ "Ryan Florence", diff --git a/dist/react-modal.js b/dist/react-modal.js index 90d98c41..9faff160 100644 --- a/dist/react-modal.js +++ b/dist/react-modal.js @@ -52,15 +52,25 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; - module.exports = __webpack_require__(1); + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _Modal = __webpack_require__(1); + + var _Modal2 = _interopRequireDefault(_Modal); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/***/ }, + exports.default = _Modal2.default; + +/***/ }), /* 1 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -312,21 +322,21 @@ return /******/ (function(modules) { // webpackBootstrap }; exports.default = Modal; -/***/ }, +/***/ }), /* 2 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_2__; -/***/ }, +/***/ }), /* 3 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; -/***/ }, +/***/ }), /* 4 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. @@ -360,9 +370,9 @@ return /******/ (function(modules) { // webpackBootstrap } -/***/ }, +/***/ }), /* 5 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. @@ -514,6 +524,7 @@ return /******/ (function(modules) { // webpackBootstrap function createChainableTypeChecker(validate) { if ((undefined) !== 'production') { var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; } function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; @@ -531,7 +542,11 @@ return /******/ (function(modules) { // webpackBootstrap } else if ((undefined) !== 'production' && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; - if (!manualPropTypeCallCache[cacheKey]) { + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { warning( false, 'You are manually calling a React.PropTypes validation ' + @@ -543,6 +558,7 @@ return /******/ (function(modules) { // webpackBootstrap componentName ); manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; } } } @@ -680,6 +696,20 @@ return /******/ (function(modules) { // webpackBootstrap return emptyFunction.thatReturnsNull; } + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + warning( + false, + 'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + + 'received %s at index %s.', + getPostfixForTypeWarning(checker), + i + ); + return emptyFunction.thatReturnsNull; + } + } + function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; @@ -812,6 +842,9 @@ return /******/ (function(modules) { // webpackBootstrap // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { @@ -823,6 +856,23 @@ return /******/ (function(modules) { // webpackBootstrap return propType; } + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { @@ -838,9 +888,9 @@ return /******/ (function(modules) { // webpackBootstrap }; -/***/ }, +/***/ }), /* 6 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { "use strict"; @@ -881,9 +931,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = emptyFunction; -/***/ }, +/***/ }), /* 7 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. @@ -941,9 +991,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = invariant; -/***/ }, +/***/ }), /* 8 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /** * Copyright 2014-2015, Facebook, Inc. @@ -1012,9 +1062,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = warning; -/***/ }, +/***/ }), /* 9 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { /** * Copyright 2013-present, Facebook, Inc. @@ -1032,9 +1082,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = ReactPropTypesSecret; -/***/ }, +/***/ }), /* 10 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. @@ -1099,9 +1149,9 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = checkPropTypes; -/***/ }, +/***/ }), /* 11 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. @@ -1116,11 +1166,14 @@ return /******/ (function(modules) { // webpackBootstrap var emptyFunction = __webpack_require__(6); var invariant = __webpack_require__(7); + var ReactPropTypesSecret = __webpack_require__(9); module.exports = function() { - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - function shim() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } invariant( false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + @@ -1132,6 +1185,8 @@ return /******/ (function(modules) { // webpackBootstrap function getShim() { return shim; }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bool: shim, @@ -1159,9 +1214,9 @@ return /******/ (function(modules) { // webpackBootstrap }; -/***/ }, +/***/ }), /* 12 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2015 Jed Watson. @@ -1204,9 +1259,9 @@ return /******/ (function(modules) { // webpackBootstrap }()); -/***/ }, +/***/ }), /* 13 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { module.exports = function(opts) { return new ElementClass(opts) @@ -1269,9 +1324,9 @@ return /******/ (function(modules) { // webpackBootstrap } -/***/ }, +/***/ }), /* 14 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1558,9 +1613,9 @@ return /******/ (function(modules) { // webpackBootstrap }; exports.default = ModalPortal; -/***/ }, +/***/ }), /* 15 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1650,9 +1705,9 @@ return /******/ (function(modules) { // webpackBootstrap } } -/***/ }, +/***/ }), /* 16 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -1705,9 +1760,9 @@ return /******/ (function(modules) { // webpackBootstrap return [].slice.call(element.querySelectorAll('*'), 0).filter(tabbable); } -/***/ }, +/***/ }), /* 17 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -1738,9 +1793,9 @@ return /******/ (function(modules) { // webpackBootstrap target.focus(); } -/***/ }, +/***/ }), /* 18 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -1790,9 +1845,9 @@ return /******/ (function(modules) { // webpackBootstrap globalElement = document.body; } -/***/ }, +/***/ }), /* 19 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { "use strict"; @@ -1822,7 +1877,7 @@ return /******/ (function(modules) { // webpackBootstrap return modals.length; } -/***/ } +/***/ }) /******/ ]) }); ; \ No newline at end of file diff --git a/dist/react-modal.min.js b/dist/react-modal.min.js index b59da2ee..319bcf45 100644 --- a/dist/react-modal.min.js +++ b/dist/react-modal.min.js @@ -1,4 +1,4 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactModal=t(require("react"),require("react-dom")):e.ReactModal=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){"use strict";e.exports=n(1)},function(e,t,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return e()}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0?(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?(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=E(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&&S.add(this);var e=u(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)}},{key:"componentWillReceiveProps",value:function(e){e.isOpen&&S.add(this),e.isOpen||S.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){S.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&&(_&&e[_]||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,u,c,f,p,d,y){if(f=f||x,d=d||c,y!==i)if(t)r(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("undefined"!=typeof console){var v=f+":"+c;!o[v]&&s<3&&(a(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,f),o[v]=!0,s++)}return null==u[c]?n?new l(null===u[c]?"The "+p+" `"+d+"` is marked as required "+("in `"+f+"`, but its value is `null`."):"The "+p+" `"+d+"` is marked as required in "+("`"+f+"`, but its value is `undefined`.")):null:e(u,c,f,p,d)}var o={},s=0,u=n.bind(null,!1);return u.isRequired=n.bind(null,!0),u}function f(e){function t(t,n,o,r,a,i){var s=t[n],u=T(s);if(u!==e){var c=P(s);return new l("Invalid "+r+" `"+a+"` of type "+("`"+c+"` supplied to `"+o+"`, expected ")+("`"+e+"`."))}return null}return c(t)}function p(){return c(o.thatReturnsNull)}function d(e){function t(t,n,o,r,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){var u=T(s);return new l("Invalid "+r+" `"+a+"` of type "+("`"+u+"` supplied to `"+o+"`, expected an array."))}for(var c=0;c1?t-1:0),o=1;o2?o-2:0),a=2;a