@@ -99,7 +99,7 @@ return /******/ (function(modules) { // webpackBootstrap
9999
100100 var _ModalPortal2 = _interopRequireDefault ( _ModalPortal ) ;
101101
102- var _ariaAppHider = __webpack_require__ ( 17 ) ;
102+ var _ariaAppHider = __webpack_require__ ( 16 ) ;
103103
104104 var ariaAppHider = _interopRequireWildcard ( _ariaAppHider ) ;
105105
@@ -1205,26 +1205,26 @@ return /******/ (function(modules) { // webpackBootstrap
12051205
12061206 var _propTypes = __webpack_require__ ( 4 ) ;
12071207
1208- var _elementClass = __webpack_require__ ( 13 ) ;
1209-
1210- var _elementClass2 = _interopRequireDefault ( _elementClass ) ;
1211-
1212- var _focusManager = __webpack_require__ ( 14 ) ;
1208+ var _focusManager = __webpack_require__ ( 13 ) ;
12131209
12141210 var focusManager = _interopRequireWildcard ( _focusManager ) ;
12151211
1216- var _scopeTab = __webpack_require__ ( 16 ) ;
1212+ var _scopeTab = __webpack_require__ ( 15 ) ;
12171213
12181214 var _scopeTab2 = _interopRequireDefault ( _scopeTab ) ;
12191215
1220- var _ariaAppHider = __webpack_require__ ( 17 ) ;
1216+ var _ariaAppHider = __webpack_require__ ( 16 ) ;
12211217
12221218 var ariaAppHider = _interopRequireWildcard ( _ariaAppHider ) ;
12231219
1224- var _refCount = __webpack_require__ ( 18 ) ;
1220+ var _refCount = __webpack_require__ ( 17 ) ;
12251221
12261222 var refCount = _interopRequireWildcard ( _refCount ) ;
12271223
1224+ var _bodyClassList = __webpack_require__ ( 18 ) ;
1225+
1226+ var bodyClassList = _interopRequireWildcard ( _bodyClassList ) ;
1227+
12281228 var _safeHTMLElement = __webpack_require__ ( 19 ) ;
12291229
12301230 var _safeHTMLElement2 = _interopRequireDefault ( _safeHTMLElement ) ;
@@ -1444,10 +1444,9 @@ return /******/ (function(modules) { // webpackBootstrap
14441444 appElement = _props . appElement ,
14451445 ariaHideApp = _props . ariaHideApp ,
14461446 bodyOpenClassName = _props . bodyOpenClassName ;
1447-
1448- refCount . add ( bodyOpenClassName ) ;
14491447 // Add body class
1450- ( 0 , _elementClass2 . default ) ( document . body ) . add ( bodyOpenClassName ) ;
1448+
1449+ bodyClassList . add ( bodyOpenClassName ) ;
14511450 // Add aria-hidden to appElement
14521451 if ( ariaHideApp ) {
14531452 ariaAppHider . hide ( appElement ) ;
@@ -1460,12 +1459,9 @@ return /******/ (function(modules) { // webpackBootstrap
14601459 appElement = _props2 . appElement ,
14611460 ariaHideApp = _props2 . ariaHideApp ,
14621461 bodyOpenClassName = _props2 . bodyOpenClassName ;
1463-
1464- refCount . remove ( bodyOpenClassName ) ;
14651462 // Remove class if no more modals are open
1466- if ( refCount . count ( bodyOpenClassName ) === 0 ) {
1467- ( 0 , _elementClass2 . default ) ( document . body ) . remove ( bodyOpenClassName ) ;
1468- }
1463+
1464+ bodyClassList . remove ( bodyOpenClassName ) ;
14691465 // Reset aria-hidden attribute if all modals have been removed
14701466 if ( ariaHideApp && refCount . totalCount ( ) < 1 ) {
14711467 ariaAppHider . show ( appElement ) ;
@@ -1485,7 +1481,7 @@ return /******/ (function(modules) { // webpackBootstrap
14851481 var contentStyles = className ? { } : defaultStyles . content ;
14861482 var overlayStyles = overlayClassName ? { } : defaultStyles . overlay ;
14871483
1488- return this . shouldBeClosed ( ) ? _react2 . default . createElement ( 'div' , null ) : _react2 . default . createElement (
1484+ return this . shouldBeClosed ( ) ? null : _react2 . default . createElement (
14891485 'div' ,
14901486 {
14911487 ref : this . setOverlayRef ,
@@ -1547,71 +1543,6 @@ return /******/ (function(modules) { // webpackBootstrap
15471543
15481544/***/ } ) ,
15491545/* 13 */
1550- /***/ ( function ( module , exports ) {
1551-
1552- module . exports = function ( opts ) {
1553- return new ElementClass ( opts )
1554- }
1555-
1556- function indexOf ( arr , prop ) {
1557- if ( arr . indexOf ) return arr . indexOf ( prop )
1558- for ( var i = 0 , len = arr . length ; i < len ; i ++ )
1559- if ( arr [ i ] === prop ) return i
1560- return - 1
1561- }
1562-
1563- function ElementClass ( opts ) {
1564- if ( ! ( this instanceof ElementClass ) ) return new ElementClass ( opts )
1565- var self = this
1566- if ( ! opts ) opts = { }
1567-
1568- // similar doing instanceof HTMLElement but works in IE8
1569- if ( opts . nodeType ) opts = { el : opts }
1570-
1571- this . opts = opts
1572- this . el = opts . el || document . body
1573- if ( typeof this . el !== 'object' ) this . el = document . querySelector ( this . el )
1574- }
1575-
1576- ElementClass . prototype . add = function ( className ) {
1577- var el = this . el
1578- if ( ! el ) return
1579- if ( el . className === "" ) return el . className = className
1580- var classes = el . className . split ( ' ' )
1581- if ( indexOf ( classes , className ) > - 1 ) return classes
1582- classes . push ( className )
1583- el . className = classes . join ( ' ' )
1584- return classes
1585- }
1586-
1587- ElementClass . prototype . remove = function ( className ) {
1588- var el = this . el
1589- if ( ! el ) return
1590- if ( el . className === "" ) return
1591- var classes = el . className . split ( ' ' )
1592- var idx = indexOf ( classes , className )
1593- if ( idx > - 1 ) classes . splice ( idx , 1 )
1594- el . className = classes . join ( ' ' )
1595- return classes
1596- }
1597-
1598- ElementClass . prototype . has = function ( className ) {
1599- var el = this . el
1600- if ( ! el ) return
1601- var classes = el . className . split ( ' ' )
1602- return indexOf ( classes , className ) > - 1
1603- }
1604-
1605- ElementClass . prototype . toggle = function ( className ) {
1606- var el = this . el
1607- if ( ! el ) return
1608- if ( this . has ( className ) ) this . remove ( className )
1609- else this . add ( className )
1610- }
1611-
1612-
1613- /***/ } ) ,
1614- /* 14 */
16151546/***/ ( function ( module , exports , __webpack_require__ ) {
16161547
16171548 'use strict' ;
@@ -1626,7 +1557,7 @@ return /******/ (function(modules) { // webpackBootstrap
16261557 exports . setupScopedFocus = setupScopedFocus ;
16271558 exports . teardownScopedFocus = teardownScopedFocus ;
16281559
1629- var _tabbable = __webpack_require__ ( 15 ) ;
1560+ var _tabbable = __webpack_require__ ( 14 ) ;
16301561
16311562 var _tabbable2 = _interopRequireDefault ( _tabbable ) ;
16321563
@@ -1703,7 +1634,7 @@ return /******/ (function(modules) { // webpackBootstrap
17031634 }
17041635
17051636/***/ } ) ,
1706- /* 15 */
1637+ /* 14 */
17071638/***/ ( function ( module , exports ) {
17081639
17091640 'use strict' ;
@@ -1758,7 +1689,7 @@ return /******/ (function(modules) { // webpackBootstrap
17581689 }
17591690
17601691/***/ } ) ,
1761- /* 16 */
1692+ /* 15 */
17621693/***/ ( function ( module , exports , __webpack_require__ ) {
17631694
17641695 'use strict' ;
@@ -1768,7 +1699,7 @@ return /******/ (function(modules) { // webpackBootstrap
17681699 } ) ;
17691700 exports . default = scopeTab ;
17701701
1771- var _tabbable = __webpack_require__ ( 15 ) ;
1702+ var _tabbable = __webpack_require__ ( 14 ) ;
17721703
17731704 var _tabbable2 = _interopRequireDefault ( _tabbable ) ;
17741705
@@ -1791,7 +1722,7 @@ return /******/ (function(modules) { // webpackBootstrap
17911722 }
17921723
17931724/***/ } ) ,
1794- /* 17 */
1725+ /* 16 */
17951726/***/ ( function ( module , exports ) {
17961727
17971728 'use strict' ;
@@ -1860,44 +1791,82 @@ return /******/ (function(modules) { // webpackBootstrap
18601791 }
18611792
18621793/***/ } ) ,
1863- /* 18 */
1794+ /* 17 */
18641795/***/ ( function ( module , exports ) {
18651796
18661797 "use strict" ;
18671798
18681799 Object . defineProperty ( exports , "__esModule" , {
18691800 value : true
18701801 } ) ;
1802+ exports . get = get ;
18711803 exports . add = add ;
18721804 exports . remove = remove ;
1873- exports . count = count ;
18741805 exports . totalCount = totalCount ;
1875- var modals = { } ;
1806+ var classListMap = { } ;
1807+
1808+ function get ( ) {
1809+ return classListMap ;
1810+ }
18761811
18771812 function add ( bodyClass ) {
18781813 // Set variable and default if none
1879- if ( ! modals [ bodyClass ] ) {
1880- modals [ bodyClass ] = 0 ;
1814+ if ( ! classListMap [ bodyClass ] ) {
1815+ classListMap [ bodyClass ] = 0 ;
18811816 }
1882- modals [ bodyClass ] += 1 ;
1817+ classListMap [ bodyClass ] += 1 ;
1818+ return bodyClass ;
18831819 }
18841820
18851821 function remove ( bodyClass ) {
1886- if ( modals [ bodyClass ] ) {
1887- modals [ bodyClass ] -= 1 ;
1822+ if ( classListMap [ bodyClass ] ) {
1823+ classListMap [ bodyClass ] -= 1 ;
18881824 }
1889- }
1890-
1891- function count ( bodyClass ) {
1892- return modals [ bodyClass ] ;
1825+ return bodyClass ;
18931826 }
18941827
18951828 function totalCount ( ) {
1896- return Object . keys ( modals ) . reduce ( function ( acc , curr ) {
1897- return acc + modals [ curr ] ;
1829+ return Object . keys ( classListMap ) . reduce ( function ( acc , curr ) {
1830+ return acc + classListMap [ curr ] ;
18981831 } , 0 ) ;
18991832 }
19001833
1834+ /***/ } ) ,
1835+ /* 18 */
1836+ /***/ ( function ( module , exports , __webpack_require__ ) {
1837+
1838+ 'use strict' ;
1839+
1840+ Object . defineProperty ( exports , "__esModule" , {
1841+ value : true
1842+ } ) ;
1843+ exports . add = add ;
1844+ exports . remove = remove ;
1845+
1846+ var _refCount = __webpack_require__ ( 17 ) ;
1847+
1848+ var refCount = _interopRequireWildcard ( _refCount ) ;
1849+
1850+ 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 ; } }
1851+
1852+ function add ( bodyClass ) {
1853+ // Increment class(es) on refCount tracker and add class(es) to body
1854+ bodyClass . split ( ' ' ) . map ( refCount . add ) . forEach ( function ( className ) {
1855+ return document . body . classList . add ( className ) ;
1856+ } ) ;
1857+ }
1858+
1859+ function remove ( bodyClass ) {
1860+ var classListMap = refCount . get ( ) ;
1861+ // Decrement class(es) from the refCount tracker
1862+ // and remove unused class(es) from body
1863+ bodyClass . split ( ' ' ) . map ( refCount . remove ) . filter ( function ( className ) {
1864+ return classListMap [ className ] === 0 ;
1865+ } ) . forEach ( function ( className ) {
1866+ return document . body . classList . remove ( className ) ;
1867+ } ) ;
1868+ }
1869+
19011870/***/ } ) ,
19021871/* 19 */
19031872/***/ ( function ( module , exports , __webpack_require__ ) {
0 commit comments