diff --git a/bower.json b/bower.json index 2efc8923..634f37f3 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.9.4", + "version": "1.9.5", "homepage": "https://github.com/reactjs/react-modal", "authors": [ "Ryan Florence", diff --git a/commits.txt b/commits.txt new file mode 100644 index 00000000..19b298c5 --- /dev/null +++ b/commits.txt @@ -0,0 +1,23 @@ +c184ddf Add gzip size badge +38dfc8d Use callback ref in readme +ea3e536 Add changelog entries from the v1 branch +baa1751 [changed] Replace appElement with getAppElement +9cb8441 Update bundling scheme (#347) +37a6ceb Update README for issue close modal when user click on overlay (#352) +a8b7aa0 [chore] use afterEach to cleanup modals automatically. +ba2fe90 (v2.0) [fixed] respect closeTimeoutMS during unmount +ebec638 [change] improve reliability on focus management. +6ba1c8d (restrry/master) [fixed] Enable click to close in iOS (#301) (#304) (#313) +75a1aa3 [fixed] Infinite loop in tab scoping +0dc486a Add sauce labs reporter for better SL statuses +a1287bc Add cross browser testing via SauceLabs (#298) +ad9e115 Updates License (#303) +8108173 Modify the sample code to es2015 syntax in README.md (#295) +a776118 Get rid of CommonJS module (#299) +b261459 Add sauce labs support +d50918c [fixed] Fix `this` scope (#296) +e10181d Add badges to readme +3d6142c Setup coveralls and fix some code climate stuff +721cc1e Add language for CC duplication engine +a09ff8d Add code climate and code coverage +596f423 Add Linting (#293) diff --git a/dist/react-modal.js b/dist/react-modal.js index 8128484c..8c0b5110 100644 --- a/dist/react-modal.js +++ b/dist/react-modal.js @@ -139,6 +139,12 @@ return /******/ (function(modules) { // webpackBootstrap this.renderPortal(this.props); }, + componentWillUpdate: function componentWillUpdate(newProps) { + if (newProps.portalClassName !== this.props.portalClassName) { + this.node.className = newProps.portalClassName; + } + }, + componentWillReceiveProps: function componentWillReceiveProps(newProps) { if (newProps.isOpen) refCount.add(this); if (!newProps.isOpen) refCount.remove(this); diff --git a/dist/react-modal.min.js b/dist/react-modal.min.js index 597bfb20..84320320 100644 --- a/dist/react-modal.min.js +++ b/dist/react-modal.min.js @@ -1,4 +1,4 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactModal=t(require("react"),require("react-dom")):e.ReactModal=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){"use strict";e.exports=n(1)},function(e,t,n){"use strict";function o(e){return e()}var r=n(2),i=n(3),s=n(4),a=n(12),u=r.createFactory(n(13)),c=n(22),l=n(23),p=n(24),f=n(3).unstable_renderSubtreeIntoContainer,d=n(17),h=n(18),m=a.canUseDOM?window.HTMLElement:{},y=a.canUseDOM?document.body:{appendChild:function(){}},v=h({displayName:"Modal",statics:{setAppElement:function(e){y=c.setElement(e)},injectCSS:function(){console.warn("React-Modal: injectCSS has been deprecated and no longer has any effect. It will be removed in a later version")}},propTypes:{isOpen:s.bool.isRequired,style:s.shape({content:s.object,overlay:s.object}),portalClassName:s.string,bodyOpenClassName:s.string,appElement:s.instanceOf(m),onAfterOpen:s.func,onRequestClose:s.func,closeTimeoutMS:s.number,ariaHideApp:s.bool,shouldCloseOnOverlayClick:s.bool,parentSelector:s.func,role:s.string,contentLabel:s.string.isRequired},getDefaultProps:function(){return{isOpen:!1,portalClassName:"ReactModalPortal",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&&l.add(this);var e=o(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)},componentWillReceiveProps:function(e){e.isOpen&&l.add(this),e.isOpen||l.remove(this);var t=o(this.props.parentSelector),n=o(e.parentSelector);n!==t&&(t.removeChild(this.node),n.appendChild(this.node)),this.renderPortal(e)},componentWillUnmount:function(){if(this.node){l.remove(this),this.props.ariaHideApp&&c.show(this.props.appElement);var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);if(n){e.beforeClose||this.portal.closeWithTimeout();var o=this;setTimeout(function(){o.removePortal()},n-t)}else this.removePortal()}},removePortal:function(){i.unmountComponentAtNode(this.node);var e=o(this.props.parentSelector);e.removeChild(this.node),0===l.count()&&p(document.body).remove(this.props.bodyOpenClassName)},renderPortal:function(e){e.isOpen||l.count()>0?p(document.body).add(this.props.bodyOpenClassName):p(document.body).remove(this.props.bodyOpenClassName),e.ariaHideApp&&c.toggle(e.isOpen,e.appElement),this.portal=f(this,u(d({},e,{defaultStyles:v.defaultStyles})),this.node)},render:function(){return r.DOM.noscript()}});v.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},e.exports=v},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,r=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},i=!0;e.exports=n(5)(r,i)},function(e,t,n){"use strict";var o=n(6),r=n(7),i=n(8),s=n(9),a=n(10);e.exports=function(e,t){function n(e){var t=e&&(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?p(document.body).add(this.props.bodyOpenClassName):p(document.body).remove(this.props.bodyOpenClassName),e.ariaHideApp&&c.toggle(e.isOpen,e.appElement),this.portal=f(this,u(d({},e,{defaultStyles:v.defaultStyles})),this.node)},render:function(){return r.DOM.noscript()}});v.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},e.exports=v},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,r=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},i=!0;e.exports=n(5)(r,i)},function(e,t,n){"use strict";var o=n(6),r=n(7),i=n(8),s=n(9),a=n(10);e.exports=function(e,t){function n(e){var t=e&&(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=N(a);return new c("Invalid "+r+" `"+i+"` of type "+("`"+l+"` supplied to `"+o+"`, expected ")+("`"+e+"`."))}return null}return l(t)}function f(){return l(o.thatReturnsNull)}function d(e){function t(t,n,o,r,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var u=w(a);return new c("Invalid "+r+" `"+i+"` of type "+("`"+u+"` supplied to `"+o+"`, expected an array."))}for(var l=0;l1?t-1:0),o=1;o2?o-2:0),i=2;i=0)&&n(e,!o)}function s(e){return[].slice.call(e.querySelectorAll("*"),0).filter(function(e){return i(e)})}e.exports=s},function(e,t,n){"use strict";var o=n(15);e.exports=function(e,t){var n=o(e);if(!n.length)return void t.preventDefault();var r=n[t.shiftKey?0:n.length-1],i=r===document.activeElement||e===document.activeElement;if(i){t.preventDefault();var s=n[t.shiftKey?n.length-1:0];s.focus()}}},function(e,t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function o(e,t){for(var n=-1,o=Array(e);++n1?n[r-1]:void 0,s=r>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(r--,i):void 0,s&&f(n[0],n[1],s)&&(i=r<3?void 0:i,r=1),t=Object(t);++o-1&&e%1==0&&e-1&&e%1==0&&e<=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,D=R.toString,T=R.propertyIsEnumerable,j=r(Object.keys,Object),P=Math.max,M=!T.call({valueOf:1},"valueOf"),I=Array.isArray,F=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=F},function(e,t,n){"use strict";var o=n(2),r=n(19),i=(new o.Component).updater;e.exports=r(o.Component,o.isValidElement,i)},function(e,t,n){"use strict";function o(e){return e}function r(e,t,n){function r(e,t,n){for(var o in t)t.hasOwnProperty(o)&&c("function"==typeof t[o],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",i[n],o)}function p(e,t){var n=E.hasOwnProperty(t)?E[t]:null;x.hasOwnProperty(t)&&u("OVERRIDE_BASE"===n,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",t),e&&u("DEFINE_MANY"===n||"DEFINE_MANY_MERGED"===n,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",t)}function f(e,n){if(!n){var o=typeof n,r="object"===o&&null!==n;return void c(r,"%s: You're attempting to include a mixin that is either null or not an object. Check the mixins included by the component, as well as any mixins they include themselves. Expected object but got %s.",e.displayName||"ReactClass",null===n?null:o)}u("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),u(!t(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var i=e.prototype,s=i.__reactAutoBindPairs;n.hasOwnProperty(l)&&C.mixins(e,n.mixins);for(var a in n)if(n.hasOwnProperty(a)&&a!==l){var f=n[a],d=i.hasOwnProperty(a);if(p(d,a),C.hasOwnProperty(a))C[a](e,f);else{var h=E.hasOwnProperty(a),v="function"==typeof f,b=v&&!h&&!d&&n.autobind!==!1;if(b)s.push(a,f),i[a]=f;else if(d){var g=E[a];u(h&&("DEFINE_MANY_MERGED"===g||"DEFINE_MANY"===g),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",g,a),"DEFINE_MANY_MERGED"===g?i[a]=m(i[a],f):"DEFINE_MANY"===g&&(i[a]=y(i[a],f))}else i[a]=f,"function"==typeof f&&n.displayName&&(i[a].displayName=n.displayName+"_"+a)}}}function d(e,t){if(t)for(var n in t){var o=t[n];if(t.hasOwnProperty(n)){var r=n in C;u(!r,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',n);var i=n in e;u(!i,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n),e[n]=o}}}function h(e,t){u(e&&t&&"object"==typeof e&&"object"==typeof t,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var n in t)t.hasOwnProperty(n)&&(u(void 0===e[n],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",n),e[n]=t[n]);return e}function m(e,t){return function(){var n=e.apply(this,arguments),o=t.apply(this,arguments);if(null==n)return o;if(null==o)return n;var r={};return h(r,n),h(r,o),r}}function y(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function v(e,t){var n=t.bind(e);n.__reactBoundContext=e,n.__reactBoundMethod=t,n.__reactBoundArguments=null;var o=e.constructor.displayName,r=n.bind;return n.bind=function(i){for(var s=arguments.length,a=Array(s>1?s-1:0),u=1;u=0)&&n(e,!o)}function s(e){return[].slice.call(e.querySelectorAll("*"),0).filter(function(e){return i(e)})}e.exports=s},function(e,t,n){"use strict";var o=n(15);e.exports=function(e,t){var n=o(e);if(!n.length)return void t.preventDefault();var r=n[t.shiftKey?0:n.length-1],i=r===document.activeElement||e===document.activeElement;if(i){t.preventDefault();var s=n[t.shiftKey?n.length-1:0];s.focus()}}},function(e,t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function o(e,t){for(var n=-1,o=Array(e);++n1?n[r-1]:void 0,s=r>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(r--,i):void 0,s&&f(n[0],n[1],s)&&(i=r<3?void 0:i,r=1),t=Object(t);++o-1&&e%1==0&&e-1&&e%1==0&&e<=w}function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function E(e){return!!e&&"object"==typeof e}function C(e){return y(e)?i(e):a(e)}var w=9007199254740991,N="[object Arguments]",x="[object Function]",A="[object GeneratorFunction]",S=/^(?:0|[1-9]\d*)$/,R=Object.prototype,_=R.hasOwnProperty,D=R.toString,T=R.propertyIsEnumerable,j=r(Object.keys,Object),P=Math.max,M=!T.call({valueOf:1},"valueOf"),I=Array.isArray,F=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=F},function(e,t,n){"use strict";var o=n(2),r=n(19),i=(new o.Component).updater;e.exports=r(o.Component,o.isValidElement,i)},function(e,t,n){"use strict";function o(e){return e}function r(e,t,n){function r(e,t,n){for(var o in t)t.hasOwnProperty(o)&&c("function"==typeof t[o],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",e.displayName||"ReactClass",i[n],o)}function p(e,t){var n=E.hasOwnProperty(t)?E[t]:null;N.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