diff --git a/CHANGELOG.md b/CHANGELOG.md index f8f2d0d9..5af45a8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +v1.6.2 - Sun, 11 Dec 2016 17:32:03 GMT +-------------------------------------- + +- + + v1.6.1 - Tue, 06 Dec 2016 17:16:10 GMT -------------------------------------- diff --git a/bower.json b/bower.json index 41599548..2d5db351 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.6.1", + "version": "1.6.2", "homepage": "https://github.com/rackt/react-modal", "authors": [ "Ryan Florence", diff --git a/dist/react-modal.js b/dist/react-modal.js index 299764f8..77ccdcb8 100644 --- a/dist/react-modal.js +++ b/dist/react-modal.js @@ -76,6 +76,10 @@ return /******/ (function(modules) { // webpackBootstrap var SafeHTMLElement = ExecutionEnvironment.canUseDOM ? window.HTMLElement : {}; var AppElement = ExecutionEnvironment.canUseDOM ? document.body : { appendChild: function appendChild() {} }; + function getParentElement(parentSelector) { + return parentSelector(); + } + var Modal = React.createClass({ displayName: 'Modal', @@ -101,7 +105,9 @@ return /******/ (function(modules) { // webpackBootstrap closeTimeoutMS: React.PropTypes.number, ariaHideApp: React.PropTypes.bool, shouldCloseOnOverlayClick: React.PropTypes.bool, - role: React.PropTypes.string + parentSelector: React.PropTypes.func, + role: React.PropTypes.string, + contentLabel: React.PropTypes.string.isRequired }, getDefaultProps: function getDefaultProps() { @@ -110,24 +116,42 @@ return /******/ (function(modules) { // webpackBootstrap portalClassName: 'ReactModalPortal', ariaHideApp: true, closeTimeoutMS: 0, - shouldCloseOnOverlayClick: true + shouldCloseOnOverlayClick: true, + parentSelector: function parentSelector() { + return document.body; + } }; }, componentDidMount: function componentDidMount() { this.node = document.createElement('div'); this.node.className = this.props.portalClassName; - document.body.appendChild(this.node); + + var parent = getParentElement(this.props.parentSelector); + parent.appendChild(this.node); this.renderPortal(this.props); }, componentWillReceiveProps: function componentWillReceiveProps(newProps) { + var currentParent = getParentElement(this.props.parentSelector); + var newParent = getParentElement(newProps.parentSelector); + + if (newParent !== currentParent) { + currentParent.removeChild(this.node); + newParent.appendChild(this.node); + } + this.renderPortal(newProps); }, componentWillUnmount: function componentWillUnmount() { + if (this.props.ariaHideApp) { + ariaAppHider.show(this.props.appElement); + } + ReactDOM.unmountComponentAtNode(this.node); - document.body.removeChild(this.node); + var parent = getParentElement(this.props.parentSelector); + parent.removeChild(this.node); elementClass(document.body).remove('ReactModal__Body--open'); }, @@ -432,7 +456,8 @@ return /******/ (function(modules) { // webpackBootstrap onKeyDown: this.handleKeyDown, onMouseDown: this.handleContentMouseDown, onMouseUp: this.handleContentMouseUp, - role: this.props.role + role: this.props.role, + "aria-label": this.props.contentLabel }, this.props.children)); } }); diff --git a/dist/react-modal.min.js b/dist/react-modal.min.js index 08a19e40..8e5268d5 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";var o=n(2),r=n(3),s=n(4),i=o.createFactory(n(5)),u=n(20),c=n(21),l=n(3).unstable_renderSubtreeIntoContainer,a=n(9),f=s.canUseDOM?window.HTMLElement:{},p=s.canUseDOM?document.body:{appendChild:function(){}},d=o.createClass({displayName:"Modal",statics:{setAppElement:function(e){p=u.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:o.PropTypes.bool.isRequired,style:o.PropTypes.shape({content:o.PropTypes.object,overlay:o.PropTypes.object}),portalClassName:o.PropTypes.string,appElement:o.PropTypes.instanceOf(f),onAfterOpen:o.PropTypes.func,onRequestClose:o.PropTypes.func,closeTimeoutMS:o.PropTypes.number,ariaHideApp:o.PropTypes.bool,shouldCloseOnOverlayClick:o.PropTypes.bool,role:o.PropTypes.string},getDefaultProps:function(){return{isOpen:!1,portalClassName:"ReactModalPortal",ariaHideApp:!0,closeTimeoutMS:0,shouldCloseOnOverlayClick:!0}},componentDidMount:function(){this.node=document.createElement("div"),this.node.className=this.props.portalClassName,document.body.appendChild(this.node),this.renderPortal(this.props)},componentWillReceiveProps:function(e){this.renderPortal(e)},componentWillUnmount:function(){r.unmountComponentAtNode(this.node),document.body.removeChild(this.node),c(document.body).remove("ReactModal__Body--open")},renderPortal:function(e){e.isOpen?c(document.body).add("ReactModal__Body--open"):c(document.body).remove("ReactModal__Body--open"),e.ariaHideApp&&u.toggle(e.isOpen,e.appElement),this.portal=l(this,i(a({},e,{defaultStyles:d.defaultStyles})),this.node)},render:function(){return o.DOM.noscript()}});d.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=d},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var o;/*! +!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),s=n(3),i=n(4),u=r.createFactory(n(5)),c=n(20),a=n(21),l=n(3).unstable_renderSubtreeIntoContainer,p=n(9),f=i.canUseDOM?window.HTMLElement:{},d=i.canUseDOM?document.body:{appendChild:function(){}},h=r.createClass({displayName:"Modal",statics:{setAppElement:function(e){d=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:r.PropTypes.bool.isRequired,style:r.PropTypes.shape({content:r.PropTypes.object,overlay:r.PropTypes.object}),portalClassName:r.PropTypes.string,appElement:r.PropTypes.instanceOf(f),onAfterOpen:r.PropTypes.func,onRequestClose:r.PropTypes.func,closeTimeoutMS:r.PropTypes.number,ariaHideApp:r.PropTypes.bool,shouldCloseOnOverlayClick:r.PropTypes.bool,parentSelector:r.PropTypes.func,role:r.PropTypes.string,contentLabel:r.PropTypes.string.isRequired},getDefaultProps:function(){return{isOpen:!1,portalClassName:"ReactModalPortal",ariaHideApp:!0,closeTimeoutMS:0,shouldCloseOnOverlayClick:!0,parentSelector:function(){return document.body}}},componentDidMount:function(){this.node=document.createElement("div"),this.node.className=this.props.portalClassName;var e=o(this.props.parentSelector);e.appendChild(this.node),this.renderPortal(this.props)},componentWillReceiveProps:function(e){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(){this.props.ariaHideApp&&c.show(this.props.appElement),s.unmountComponentAtNode(this.node);var e=o(this.props.parentSelector);e.removeChild(this.node),a(document.body).remove("ReactModal__Body--open")},renderPortal:function(e){e.isOpen?a(document.body).add("ReactModal__Body--open"):a(document.body).remove("ReactModal__Body--open"),e.ariaHideApp&&c.toggle(e.isOpen,e.appElement),this.portal=l(this,u(p({},e,{defaultStyles:h.defaultStyles})),this.node)},render:function(){return r.DOM.noscript()}});h.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=h},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var o;/*! Copyright (c) 2015 Jed Watson. Based on code that is Copyright 2013-2015, Facebook, Inc. All rights reserved. */ -!function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),s={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};o=function(){return s}.call(t,n,t,e),!(void 0!==o&&(e.exports=o))}()},function(e,t,n){"use strict";var o=n(2),r=o.DOM.div,s=n(6),i=n(8),u=n(9),c={overlay:{base:"ReactModal__Overlay",afterOpen:"ReactModal__Overlay--after-open",beforeClose:"ReactModal__Overlay--before-close"},content:{base:"ReactModal__Content",afterOpen:"ReactModal__Content--after-open",beforeClose:"ReactModal__Content--before-close"}};e.exports=o.createClass({displayName:"ModalPortal",shouldClose:null,getDefaultProps:function(){return{style:{overlay:{},content:{}}}},getInitialState:function(){return{afterOpen:!1,beforeClose:!1}},componentDidMount:function(){this.props.isOpen&&(this.setFocusAfterRender(!0),this.open())},componentWillUnmount:function(){clearTimeout(this.closeTimer)},componentWillReceiveProps:function(e){!this.props.isOpen&&e.isOpen?(this.setFocusAfterRender(!0),this.open()):this.props.isOpen&&!e.isOpen&&this.close()},componentDidUpdate:function(){this.focusAfterRender&&(this.focusContent(),this.setFocusAfterRender(!1))},setFocusAfterRender:function(e){this.focusAfterRender=e},open:function(){this.state.afterOpen&&this.state.beforeClose?(clearTimeout(this.closeTimer),this.setState({beforeClose:!1})):(s.setupScopedFocus(this.node),s.markForFocusLater(),this.setState({isOpen:!0},function(){this.setState({afterOpen:!0}),this.props.isOpen&&this.props.onAfterOpen&&this.props.onAfterOpen()}.bind(this)))},close:function(){this.ownerHandlesClose()&&(this.props.closeTimeoutMS>0?this.closeWithTimeout():this.closeWithoutTimeout())},focusContent:function(){this.contentHasFocus()||this.refs.content.focus()},closeWithTimeout:function(){this.setState({beforeClose:!0},function(){this.closeTimer=setTimeout(this.closeWithoutTimeout,this.props.closeTimeoutMS)}.bind(this))},closeWithoutTimeout:function(){this.setState({beforeClose:!1,isOpen:!1,afterOpen:!1},this.afterClose)},afterClose:function(){s.returnFocus(),s.teardownScopedFocus()},handleKeyDown:function(e){9==e.keyCode&&i(this.refs.content,e),27==e.keyCode&&(e.preventDefault(),this.requestClose(e))},handleOverlayMouseDown:function(e){null===this.shouldClose&&(this.shouldClose=!0)},handleOverlayMouseUp:function(e){this.shouldClose&&this.props.shouldCloseOnOverlayClick&&(this.ownerHandlesClose()?this.requestClose(e):this.focusContent()),this.shouldClose=null},handleContentMouseDown:function(e){this.shouldClose=!1},handleContentMouseUp:function(e){this.shouldClose=!1},requestClose:function(e){this.ownerHandlesClose()&&this.props.onRequestClose(e)},ownerHandlesClose:function(){return this.props.onRequestClose},shouldBeClosed:function(){return!this.props.isOpen&&!this.state.beforeClose},contentHasFocus:function(){return document.activeElement===this.refs.content||this.refs.content.contains(document.activeElement)},buildClassName:function(e,t){var n=c[e].base;return this.state.afterOpen&&(n+=" "+c[e].afterOpen),this.state.beforeClose&&(n+=" "+c[e].beforeClose),t?n+" "+t:n},render:function(){var e=this.props.className?{}:this.props.defaultStyles.content,t=this.props.overlayClassName?{}:this.props.defaultStyles.overlay;return this.shouldBeClosed()?r():r({ref:"overlay",className:this.buildClassName("overlay",this.props.overlayClassName),style:u({},t,this.props.style.overlay||{}),onMouseDown:this.handleOverlayMouseDown,onMouseUp:this.handleOverlayMouseUp},r({ref:"content",style:u({},e,this.props.style.content||{}),className:this.buildClassName("content",this.props.className),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentMouseDown,onMouseUp:this.handleContentMouseUp,role:this.props.role},this.props.children))}})},function(e,t,n){"use strict";function o(e){c=!0}function r(e){if(c){if(c=!1,!i)return;setTimeout(function(){if(!i.contains(document.activeElement)){var e=s(i)[0]||i;e.focus()}},0)}}var s=n(7),i=null,u=null,c=!1;t.markForFocusLater=function(){u=document.activeElement},t.returnFocus=function(){try{u.focus()}catch(e){console.warn("You tried to return focus to "+u+" but it is not in the DOM anymore")}u=null},t.setupScopedFocus=function(e){i=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",r,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",r))},t.teardownScopedFocus=function(){i=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),s={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};o=function(){return s}.call(t,n,t,e),!(void 0!==o&&(e.exports=o))}()},function(e,t,n){"use strict";var o=n(2),r=o.DOM.div,s=n(6),i=n(8),u=n(9),c={overlay:{base:"ReactModal__Overlay",afterOpen:"ReactModal__Overlay--after-open",beforeClose:"ReactModal__Overlay--before-close"},content:{base:"ReactModal__Content",afterOpen:"ReactModal__Content--after-open",beforeClose:"ReactModal__Content--before-close"}};e.exports=o.createClass({displayName:"ModalPortal",shouldClose:null,getDefaultProps:function(){return{style:{overlay:{},content:{}}}},getInitialState:function(){return{afterOpen:!1,beforeClose:!1}},componentDidMount:function(){this.props.isOpen&&(this.setFocusAfterRender(!0),this.open())},componentWillUnmount:function(){clearTimeout(this.closeTimer)},componentWillReceiveProps:function(e){!this.props.isOpen&&e.isOpen?(this.setFocusAfterRender(!0),this.open()):this.props.isOpen&&!e.isOpen&&this.close()},componentDidUpdate:function(){this.focusAfterRender&&(this.focusContent(),this.setFocusAfterRender(!1))},setFocusAfterRender:function(e){this.focusAfterRender=e},open:function(){this.state.afterOpen&&this.state.beforeClose?(clearTimeout(this.closeTimer),this.setState({beforeClose:!1})):(s.setupScopedFocus(this.node),s.markForFocusLater(),this.setState({isOpen:!0},function(){this.setState({afterOpen:!0}),this.props.isOpen&&this.props.onAfterOpen&&this.props.onAfterOpen()}.bind(this)))},close:function(){this.ownerHandlesClose()&&(this.props.closeTimeoutMS>0?this.closeWithTimeout():this.closeWithoutTimeout())},focusContent:function(){this.contentHasFocus()||this.refs.content.focus()},closeWithTimeout:function(){this.setState({beforeClose:!0},function(){this.closeTimer=setTimeout(this.closeWithoutTimeout,this.props.closeTimeoutMS)}.bind(this))},closeWithoutTimeout:function(){this.setState({beforeClose:!1,isOpen:!1,afterOpen:!1},this.afterClose)},afterClose:function(){s.returnFocus(),s.teardownScopedFocus()},handleKeyDown:function(e){9==e.keyCode&&i(this.refs.content,e),27==e.keyCode&&(e.preventDefault(),this.requestClose(e))},handleOverlayMouseDown:function(e){null===this.shouldClose&&(this.shouldClose=!0)},handleOverlayMouseUp:function(e){this.shouldClose&&this.props.shouldCloseOnOverlayClick&&(this.ownerHandlesClose()?this.requestClose(e):this.focusContent()),this.shouldClose=null},handleContentMouseDown:function(e){this.shouldClose=!1},handleContentMouseUp:function(e){this.shouldClose=!1},requestClose:function(e){this.ownerHandlesClose()&&this.props.onRequestClose(e)},ownerHandlesClose:function(){return this.props.onRequestClose},shouldBeClosed:function(){return!this.props.isOpen&&!this.state.beforeClose},contentHasFocus:function(){return document.activeElement===this.refs.content||this.refs.content.contains(document.activeElement)},buildClassName:function(e,t){var n=c[e].base;return this.state.afterOpen&&(n+=" "+c[e].afterOpen),this.state.beforeClose&&(n+=" "+c[e].beforeClose),t?n+" "+t:n},render:function(){var e=this.props.className?{}:this.props.defaultStyles.content,t=this.props.overlayClassName?{}:this.props.defaultStyles.overlay;return this.shouldBeClosed()?r():r({ref:"overlay",className:this.buildClassName("overlay",this.props.overlayClassName),style:u({},t,this.props.style.overlay||{}),onMouseDown:this.handleOverlayMouseDown,onMouseUp:this.handleOverlayMouseUp},r({ref:"content",style:u({},e,this.props.style.content||{}),className:this.buildClassName("content",this.props.className),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentMouseDown,onMouseUp:this.handleContentMouseUp,role:this.props.role,"aria-label":this.props.contentLabel},this.props.children))}})},function(e,t,n){"use strict";function o(e){c=!0}function r(e){if(c){if(c=!1,!i)return;setTimeout(function(){if(!i.contains(document.activeElement)){var e=s(i)[0]||i;e.focus()}},0)}}var s=n(7),i=null,u=null,c=!1;t.markForFocusLater=function(){u=document.activeElement},t.returnFocus=function(){try{u.focus()}catch(e){console.warn("You tried to return focus to "+u+" but it is not in the DOM anymore")}u=null},t.setupScopedFocus=function(e){i=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",r,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",r))},t.teardownScopedFocus=function(){i=null,window.addEventListener?(window.removeEventListener("blur",o),document.removeEventListener("focus",r)):(window.detachEvent("onBlur",o),document.detachEvent("onFocus",r))}},function(e,t){"use strict";/*! * Adapted from jQuery UI core * * http://jqueryui.com @@ -14,4 +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 s(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var o=isNaN(t);return(o||t>=0)&&n(e,!o)}function i(e){return[].slice.call(e.querySelectorAll("*"),0).filter(function(e){return s(e)})}e.exports=i},function(e,t,n){"use strict";var o=n(7);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],s=r===document.activeElement||e===document.activeElement;if(s){t.preventDefault();var i=n[t.shiftKey?n.length-1:0];i.focus()}}},function(e,t,n){function o(e,t,n){for(var o=-1,r=i(t),s=r.length;++o-1&&e%1==0&&e-1&&e%1==0&&e<=m}function u(e){for(var t=l(e),n=t.length,o=n&&e.length,r=!!o&&i(o)&&(p(e)||f(e)),u=-1,c=[];++u0;++o-1&&e%1==0&&e<=l}function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function c(e){return!!e&&"object"==typeof e}var l=9007199254740991,a="[object Arguments]",f="[object Function]",p="[object GeneratorFunction]",d=Object.prototype,h=d.hasOwnProperty,v=d.toString,y=d.propertyIsEnumerable;e.exports=n},function(e,t){function n(e){return!!e&&"object"==typeof e}function o(e,t){var n=null==e?void 0:e[t];return u(n)?n:void 0}function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=m}function s(e){return i(e)&&h.call(e)==l}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function u(e){return null!=e&&(s(e)?v.test(p.call(e)):n(e)&&a.test(e))}var c="[object Array]",l="[object Function]",a=/^\[object .+?Constructor\]$/,f=Object.prototype,p=Function.prototype.toString,d=f.hasOwnProperty,h=f.toString,v=RegExp("^"+p.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),y=o(Array,"isArray"),m=9007199254740991,b=y||function(e){return n(e)&&r(e.length)&&h.call(e)==c};e.exports=b},function(e,t,n){function o(e){return i(function(t,n){var o=-1,i=null==t?0:n.length,u=i>2?n[i-2]:void 0,c=i>2?n[2]:void 0,l=i>1?n[i-1]:void 0;for("function"==typeof u?(u=r(u,l,5),i-=2):(u="function"==typeof l?l:void 0,i-=u?1:0),c&&s(n[0],n[1],c)&&(u=i<3?void 0:u,i=1);++o-1&&e%1==0&&e-1&&e%1==0&&e<=l}function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var c=/^\d+$/,l=9007199254740991,a=n("length");e.exports=s},function(e,t){function n(e,t){if("function"!=typeof e)throw new TypeError(o);return t=r(void 0===t?e.length-1:+t||0,0),function(){for(var n=arguments,o=-1,s=r(n.length-t,0),i=Array(s);++o-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 +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 s(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var o=isNaN(t);return(o||t>=0)&&n(e,!o)}function i(e){return[].slice.call(e.querySelectorAll("*"),0).filter(function(e){return s(e)})}e.exports=i},function(e,t,n){"use strict";var o=n(7);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],s=r===document.activeElement||e===document.activeElement;if(s){t.preventDefault();var i=n[t.shiftKey?n.length-1:0];i.focus()}}},function(e,t,n){function o(e,t,n){for(var o=-1,r=i(t),s=r.length;++o-1&&e%1==0&&e-1&&e%1==0&&e<=m}function u(e){for(var t=a(e),n=t.length,o=n&&e.length,r=!!o&&i(o)&&(f(e)||p(e)),u=-1,c=[];++u0;++o-1&&e%1==0&&e<=a}function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function c(e){return!!e&&"object"==typeof e}var a=9007199254740991,l="[object Arguments]",p="[object Function]",f="[object GeneratorFunction]",d=Object.prototype,h=d.hasOwnProperty,v=d.toString,y=d.propertyIsEnumerable;e.exports=n},function(e,t){function n(e){return!!e&&"object"==typeof e}function o(e,t){var n=null==e?void 0:e[t];return u(n)?n:void 0}function r(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=m}function s(e){return i(e)&&h.call(e)==a}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function u(e){return null!=e&&(s(e)?v.test(f.call(e)):n(e)&&l.test(e))}var c="[object Array]",a="[object Function]",l=/^\[object .+?Constructor\]$/,p=Object.prototype,f=Function.prototype.toString,d=p.hasOwnProperty,h=p.toString,v=RegExp("^"+f.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),y=o(Array,"isArray"),m=9007199254740991,b=y||function(e){return n(e)&&r(e.length)&&h.call(e)==c};e.exports=b},function(e,t,n){function o(e){return i(function(t,n){var o=-1,i=null==t?0:n.length,u=i>2?n[i-2]:void 0,c=i>2?n[2]:void 0,a=i>1?n[i-1]:void 0;for("function"==typeof u?(u=r(u,a,5),i-=2):(u="function"==typeof a?a:void 0,i-=u?1:0),c&&s(n[0],n[1],c)&&(u=i<3?void 0:u,i=1);++o-1&&e%1==0&&e-1&&e%1==0&&e<=a}function u(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var c=/^\d+$/,a=9007199254740991,l=n("length");e.exports=s},function(e,t){function n(e,t){if("function"!=typeof e)throw new TypeError(o);return t=r(void 0===t?e.length-1:+t||0,0),function(){for(var n=arguments,o=-1,s=r(n.length-t,0),i=Array(s);++o-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 diff --git a/package.json b/package.json index f6b76806..f4d9e1ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-modal", - "version": "1.6.1", + "version": "1.6.2", "description": "Accessible modal dialog component for React.JS", "main": "./lib/index", "repository": {