11! function ( e ) { if ( "object" == typeof exports && "undefined" != typeof module ) module . exports = e ( ) ; else if ( "function" == typeof define && define . amd ) define ( [ ] , e ) ; else { var f ; "undefined" != typeof window ?f = window :"undefined" != typeof global ?f = global :"undefined" != typeof self && ( f = self ) , f . ReactModal = e ( ) } } ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; throw new Error ( "Cannot find module '" + o + "'" ) } var f = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( f . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , f , f . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( _dereq_ , module , exports ) {
22var React = ( typeof window !== "undefined" ? window . React : typeof global !== "undefined" ? global . React : null ) ;
3+ var ExecutionEnvironment = _dereq_ ( 'react/lib/ExecutionEnvironment' ) ;
34var ModalPortal = React . createFactory ( _dereq_ ( './ModalPortal' ) ) ;
45var ariaAppHider = _dereq_ ( '../helpers/ariaAppHider' ) ;
56var injectCSS = _dereq_ ( '../helpers/injectCSS' ) ;
67
8+ var SafeHTMLElement = ExecutionEnvironment . canUseDOM ? window . HTMLElement : { } ;
9+
710var Modal = module . exports = React . createClass ( {
811
912 displayName : 'Modal' ,
@@ -16,7 +19,7 @@ var Modal = module.exports = React.createClass({
1619 propTypes : {
1720 isOpen : React . PropTypes . bool . isRequired ,
1821 onRequestClose : React . PropTypes . func ,
19- appElement : React . PropTypes . instanceOf ( HTMLElement ) ,
22+ appElement : React . PropTypes . instanceOf ( SafeHTMLElement ) ,
2023 closeTimeoutMS : React . PropTypes . number ,
2124 ariaHideApp : React . PropTypes . bool
2225 } ,
@@ -65,12 +68,12 @@ function sanitizeProps(props) {
6568 delete props . ref ;
6669}
6770
68- } , { "../helpers/ariaAppHider" :3 , "../helpers/injectCSS" :5 , "./ModalPortal" :2 } ] , 2 :[ function ( _dereq_ , module , exports ) {
71+ } , { "../helpers/ariaAppHider" :3 , "../helpers/injectCSS" :5 , "./ModalPortal" :2 , "react/lib/ExecutionEnvironment" : 10 } ] , 2 :[ function ( _dereq_ , module , exports ) {
6972var React = ( typeof window !== "undefined" ? window . React : typeof global !== "undefined" ? global . React : null ) ;
7073var div = React . DOM . div ;
7174var focusManager = _dereq_ ( '../helpers/focusManager' ) ;
7275var scopeTab = _dereq_ ( '../helpers/scopeTab' ) ;
73- var cx = _dereq_ ( 'react/lib/cx ' ) ;
76+ var cx = _dereq_ ( 'classnames ' ) ;
7477
7578// so that our CSS is statically analyzable
7679var CLASS_NAMES = {
@@ -215,6 +218,7 @@ var ModalPortal = module.exports = React.createClass({
215218 } ,
216219 div ( {
217220 ref : "content" ,
221+ style : this . props . style ,
218222 className : cx ( this . buildClassName ( 'content' ) , this . props . className ) ,
219223 tabIndex : "-1" ,
220224 onClick : stopPropagation ,
@@ -227,7 +231,7 @@ var ModalPortal = module.exports = React.createClass({
227231 }
228232} ) ;
229233
230- } , { "../helpers/focusManager" :4 , "../helpers/scopeTab" :6 , "react/lib/cx " :9 } ] , 3 :[ function ( _dereq_ , module , exports ) {
234+ } , { "../helpers/focusManager" :4 , "../helpers/scopeTab" :6 , "classnames " :9 } ] , 3 :[ function ( _dereq_ , module , exports ) {
231235var _element = null ;
232236
233237function setElement ( element ) {
@@ -280,6 +284,9 @@ function handleBlur(event) {
280284function handleFocus ( event ) {
281285 if ( needToFocus ) {
282286 needToFocus = false ;
287+ if ( ! modalElement ) {
288+ return ;
289+ }
283290 // need to see how jQuery shims document.on('focusin') so we don't need the
284291 // setTimeout, firefox doesn't support focusin, if it did, we could focus
285292 // the the element outisde of a setTimeout. Side-effect of this
@@ -452,154 +459,95 @@ module.exports = _dereq_('./components/Modal');
452459
453460
454461} , { "./components/Modal" :1 } ] , 9 :[ function ( _dereq_ , module , exports ) {
455- /**
456- * Copyright 2013-2015, Facebook, Inc.
457- * All rights reserved.
458- *
459- * This source code is licensed under the BSD-style license found in the
460- * LICENSE file in the root directory of this source tree. An additional grant
461- * of patent rights can be found in the PATENTS file in the same directory.
462- *
463- * @providesModule cx
464- */
465-
466- /**
467- * This function is used to mark string literals representing CSS class names
468- * so that they can be transformed statically. This allows for modularization
469- * and minification of CSS class names.
470- *
471- * In static_upstream, this function is actually implemented, but it should
472- * eventually be replaced with something more descriptive, and the transform
473- * that is used in the main stack should be ported for use elsewhere.
474- *
475- * @param string|object className to modularize, or an object of key/values.
476- * In the object case, the values are conditions that
477- * determine if the className keys should be included.
478- * @param [string ...] Variable list of classNames in the string case.
479- * @return string Renderable space-separated CSS className.
480- */
481-
482- 'use strict' ;
483- var warning = _dereq_ ( "./warning" ) ;
484-
485- var warned = false ;
486-
487- function cx ( classNames ) {
488- if ( "production" !== "production" ) {
489- ( "production" !== "production" ? warning (
490- warned ,
491- 'React.addons.classSet will be deprecated in a future version. See ' +
492- 'http://fb.me/react-addons-classset'
493- ) : null ) ;
494- warned = true ;
495- }
496-
497- if ( typeof classNames == 'object' ) {
498- return Object . keys ( classNames ) . filter ( function ( className ) {
499- return classNames [ className ] ;
500- } ) . join ( ' ' ) ;
501- } else {
502- return Array . prototype . join . call ( arguments , ' ' ) ;
503- }
462+ /*!
463+ Copyright (c) 2015 Jed Watson.
464+ Licensed under the MIT License (MIT), see
465+ http://jedwatson.github.io/classnames
466+ */
467+
468+ function classNames ( ) {
469+ var classes = '' ;
470+ var arg ;
471+
472+ for ( var i = 0 ; i < arguments . length ; i ++ ) {
473+ arg = arguments [ i ] ;
474+ if ( ! arg ) {
475+ continue ;
476+ }
477+
478+ if ( 'string' === typeof arg || 'number' === typeof arg ) {
479+ classes += ' ' + arg ;
480+ } else if ( Object . prototype . toString . call ( arg ) === '[object Array]' ) {
481+ classes += ' ' + classNames . apply ( null , arg ) ;
482+ } else if ( 'object' === typeof arg ) {
483+ for ( var key in arg ) {
484+ if ( ! arg . hasOwnProperty ( key ) || ! arg [ key ] ) {
485+ continue ;
486+ }
487+ classes += ' ' + key ;
488+ }
489+ }
490+ }
491+ return classes . substr ( 1 ) ;
504492}
505493
506- module . exports = cx ;
507-
508- } , { "./warning" :11 } ] , 10 :[ function ( _dereq_ , module , exports ) {
509- /**
510- * Copyright 2013-2015, Facebook, Inc.
511- * All rights reserved.
512- *
513- * This source code is licensed under the BSD-style license found in the
514- * LICENSE file in the root directory of this source tree. An additional grant
515- * of patent rights can be found in the PATENTS file in the same directory.
516- *
517- * @providesModule emptyFunction
518- */
519-
520- function makeEmptyFunction ( arg ) {
521- return function ( ) {
522- return arg ;
523- } ;
494+ // safely export classNames for node / browserify
495+ if ( typeof module !== 'undefined' && module . exports ) {
496+ module . exports = classNames ;
524497}
525498
526- /**
527- * This function accepts and discards inputs; it has no side effects. This is
528- * primarily useful idiomatically for overridable function endpoints which
529- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
530- */
531- function emptyFunction ( ) { }
532-
533- emptyFunction . thatReturns = makeEmptyFunction ;
534- emptyFunction . thatReturnsFalse = makeEmptyFunction ( false ) ;
535- emptyFunction . thatReturnsTrue = makeEmptyFunction ( true ) ;
536- emptyFunction . thatReturnsNull = makeEmptyFunction ( null ) ;
537- emptyFunction . thatReturnsThis = function ( ) { return this ; } ;
538- emptyFunction . thatReturnsArgument = function ( arg ) { return arg ; } ;
539-
540- module . exports = emptyFunction ;
499+ // safely export classNames for RequireJS
500+ if ( typeof define !== 'undefined' && define . amd ) {
501+ define ( 'classnames' , [ ] , function ( ) {
502+ return classNames ;
503+ } ) ;
504+ }
541505
542- } , { } ] , 11 :[ function ( _dereq_ , module , exports ) {
506+ } , { } ] , 10 :[ function ( _dereq_ , module , exports ) {
543507/**
544- * Copyright 2014-2015 , Facebook, Inc.
508+ * Copyright 2013-2014 , Facebook, Inc.
545509 * All rights reserved.
546510 *
547511 * This source code is licensed under the BSD-style license found in the
548512 * LICENSE file in the root directory of this source tree. An additional grant
549513 * of patent rights can be found in the PATENTS file in the same directory.
550514 *
551- * @providesModule warning
515+ * @providesModule ExecutionEnvironment
552516 */
553517
518+ /*jslint evil: true */
519+
554520"use strict" ;
555521
556- var emptyFunction = _dereq_ ( "./emptyFunction" ) ;
522+ var canUseDOM = ! ! (
523+ typeof window !== 'undefined' &&
524+ window . document &&
525+ window . document . createElement
526+ ) ;
557527
558528/**
559- * Similar to invariant but only logs a warning if the condition is not met.
560- * This can be used to log issues in development environments in critical
561- * paths. Removing the logging code for production environments will keep the
562- * same logic and follow the same code paths .
529+ * Simple, lightweight module assisting with the detection and context of
530+ * Worker. Helps avoid circular dependencies and allows code to reason about
531+ * whether or not they are in a Worker, even if they never include the main
532+ * `ReactWorker` dependency .
563533 */
534+ var ExecutionEnvironment = {
564535
565- var warning = emptyFunction ;
536+ canUseDOM : canUseDOM ,
566537
567- if ( "production" !== "production" ) {
568- warning = function ( condition , format ) { for ( var args = [ ] , $__0 = 2 , $__1 = arguments . length ; $__0 < $__1 ; $__0 ++ ) args . push ( arguments [ $__0 ] ) ;
569- if ( format === undefined ) {
570- throw new Error (
571- '`warning(condition, format, ...args)` requires a warning ' +
572- 'message argument'
573- ) ;
574- }
538+ canUseWorkers : typeof Worker !== 'undefined' ,
575539
576- if ( format . length < 10 || / ^ [ s \W ] * $ / . test ( format ) ) {
577- throw new Error (
578- 'The warning format should be able to uniquely identify this ' +
579- 'warning. Please, use a more descriptive format than: ' + format
580- ) ;
581- }
540+ canUseEventListeners :
541+ canUseDOM && ! ! ( window . addEventListener || window . attachEvent ) ,
582542
583- if ( format . indexOf ( 'Failed Composite propType: ' ) === 0 ) {
584- return ; // Ignore CompositeComponent proptype check.
585- }
543+ canUseViewport : canUseDOM && ! ! window . screen ,
586544
587- if ( ! condition ) {
588- var argIndex = 0 ;
589- var message = 'Warning: ' + format . replace ( / % s / g, function ( ) { return args [ argIndex ++ ] ; } ) ;
590- console . warn ( message ) ;
591- try {
592- // --- Welcome to debugging React ---
593- // This error was thrown as a convenience so that you can use this stack
594- // to find the callsite that caused this warning to fire.
595- throw new Error ( message ) ;
596- } catch ( x ) { }
597- }
598- } ;
599- }
545+ isInWorker : ! canUseDOM // For now, this is true - might change in the future.
546+
547+ } ;
600548
601- module . exports = warning ;
549+ module . exports = ExecutionEnvironment ;
602550
603- } , { "./emptyFunction" : 10 } ] } , { } , [ 8 ] )
551+ } , { } ] } , { } , [ 8 ] )
604552( 8 )
605553} ) ;
0 commit comments