bootstrap 5.0.0.alpha1 → 5.0.0.alpha2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/README.md +1 -1
  4. data/assets/javascripts/bootstrap-sprockets.js +6 -6
  5. data/assets/javascripts/bootstrap.js +142 -155
  6. data/assets/javascripts/bootstrap.min.js +2 -2
  7. data/assets/javascripts/bootstrap/alert.js +17 -19
  8. data/assets/javascripts/bootstrap/button.js +14 -12
  9. data/assets/javascripts/bootstrap/carousel.js +47 -49
  10. data/assets/javascripts/bootstrap/collapse.js +50 -55
  11. data/assets/javascripts/bootstrap/dom/data.js +11 -11
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +9 -5
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +5 -9
  14. data/assets/javascripts/bootstrap/dom/polyfill.js +3 -3
  15. data/assets/javascripts/bootstrap/dom/selector-engine.js +3 -3
  16. data/assets/javascripts/bootstrap/dropdown.js +46 -48
  17. data/assets/javascripts/bootstrap/modal.js +77 -65
  18. data/assets/javascripts/bootstrap/popover.js +21 -23
  19. data/assets/javascripts/bootstrap/scrollspy.js +33 -39
  20. data/assets/javascripts/bootstrap/tab.js +24 -22
  21. data/assets/javascripts/bootstrap/toast.js +32 -28
  22. data/assets/javascripts/bootstrap/tooltip.js +67 -66
  23. data/assets/stylesheets/_bootstrap-grid.scss +2 -2
  24. data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
  25. data/assets/stylesheets/_bootstrap.scss +1 -1
  26. data/assets/stylesheets/bootstrap/_alert.scss +3 -4
  27. data/assets/stylesheets/bootstrap/_card.scss +6 -4
  28. data/assets/stylesheets/bootstrap/_carousel.scss +17 -0
  29. data/assets/stylesheets/bootstrap/_close.scss +25 -20
  30. data/assets/stylesheets/bootstrap/_dropdown.scss +42 -1
  31. data/assets/stylesheets/bootstrap/_functions.scss +4 -1
  32. data/assets/stylesheets/bootstrap/_helpers.scss +2 -2
  33. data/assets/stylesheets/bootstrap/_list-group.scss +1 -1
  34. data/assets/stylesheets/bootstrap/_mixins.scss +1 -1
  35. data/assets/stylesheets/bootstrap/_modal.scss +7 -7
  36. data/assets/stylesheets/bootstrap/_nav.scss +4 -0
  37. data/assets/stylesheets/bootstrap/_navbar.scss +1 -0
  38. data/assets/stylesheets/bootstrap/_pagination.scss +3 -0
  39. data/assets/stylesheets/bootstrap/_reboot.scss +7 -6
  40. data/assets/stylesheets/bootstrap/_spinners.scss +2 -2
  41. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  42. data/assets/stylesheets/bootstrap/_toasts.scss +6 -2
  43. data/assets/stylesheets/bootstrap/_utilities.scss +29 -1
  44. data/assets/stylesheets/bootstrap/_variables.scss +92 -44
  45. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
  46. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
  47. data/assets/stylesheets/bootstrap/forms/_input-group.scss +2 -2
  48. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +1 -1
  49. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  50. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  51. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +9 -9
  52. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  53. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +4 -3
  54. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +11 -8
  55. data/assets/stylesheets/bootstrap/mixins/_container.scss +5 -3
  56. data/assets/stylesheets/bootstrap/mixins/_grid.scss +6 -7
  57. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  58. data/assets/stylesheets/bootstrap/mixins/{_screen-reader.scss → _visually-hidden.scss} +5 -5
  59. data/lib/bootstrap/version.rb +2 -2
  60. metadata +5 -5
  61. data/assets/stylesheets/bootstrap/helpers/_embed.scss +0 -31
  62. data/assets/stylesheets/bootstrap/helpers/_screenreaders.scss +0 -8
@@ -1,17 +1,17 @@
1
1
  /*!
2
- * Bootstrap selector-engine.js v5.0.0-alpha1 (https://getbootstrap.com/)
2
+ * Bootstrap selector-engine.js v5.0.0-alpha2 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
7
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./polyfill.js')) :
8
8
  typeof define === 'function' && define.amd ? define(['./polyfill.js'], factory) :
9
- (global = global || self, global.SelectorEngine = factory(global.Polyfill));
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.SelectorEngine = factory(global.Polyfill));
10
10
  }(this, (function (polyfill_js) { 'use strict';
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0-alpha1): dom/selector-engine.js
14
+ * Bootstrap (v5.0.0-alpha2): dom/selector-engine.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -1,23 +1,25 @@
1
1
  /*!
2
- * Bootstrap dropdown.js v5.0.0-alpha1 (https://getbootstrap.com/)
2
+ * Bootstrap dropdown.js v5.0.0-alpha2 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
7
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
8
8
  typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
9
- (global = global || self, global.Dropdown = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
10
10
  }(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
11
11
 
12
- Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
13
- EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
14
- Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
15
- Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
16
- SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
+ var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
+ var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
17
+ var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
18
+ var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
17
19
 
18
20
  /**
19
21
  * --------------------------------------------------------------------------
20
- * Bootstrap (v5.0.0-alpha1): util/index.js
22
+ * Bootstrap (v5.0.0-alpha2): util/index.js
21
23
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
22
24
  * --------------------------------------------------------------------------
23
25
  */
@@ -91,11 +93,7 @@
91
93
  return null;
92
94
  };
93
95
 
94
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
95
-
96
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
97
-
98
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
96
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
99
97
 
100
98
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
101
99
 
@@ -107,7 +105,7 @@
107
105
  */
108
106
 
109
107
  var NAME = 'dropdown';
110
- var VERSION = '5.0.0-alpha1';
108
+ var VERSION = '5.0.0-alpha2';
111
109
  var DATA_KEY = 'bs.dropdown';
112
110
  var EVENT_KEY = "." + DATA_KEY;
113
111
  var DATA_API_KEY = '.data-api';
@@ -178,7 +176,7 @@
178
176
 
179
177
  this._addEventListeners();
180
178
 
181
- Data.setData(element, DATA_KEY, this);
179
+ Data__default['default'].setData(element, DATA_KEY, this);
182
180
  } // Getters
183
181
 
184
182
 
@@ -210,7 +208,7 @@
210
208
  var relatedTarget = {
211
209
  relatedTarget: this._element
212
210
  };
213
- var showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget);
211
+ var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, relatedTarget);
214
212
 
215
213
  if (showEvent.defaultPrevented) {
216
214
  return;
@@ -218,7 +216,7 @@
218
216
 
219
217
 
220
218
  if (!this._inNavbar) {
221
- if (typeof Popper === 'undefined') {
219
+ if (typeof Popper__default['default'] === 'undefined') {
222
220
  throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)');
223
221
  }
224
222
 
@@ -241,7 +239,7 @@
241
239
  parent.classList.add(CLASS_NAME_POSITION_STATIC);
242
240
  }
243
241
 
244
- this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
242
+ this._popper = new Popper__default['default'](referenceElement, this._menu, this._getPopperConfig());
245
243
  } // If this is a touch-enabled device we add extra
246
244
  // empty mouseover listeners to the body's immediate children;
247
245
  // only needed because of broken event delegation on iOS
@@ -252,7 +250,7 @@
252
250
  var _ref;
253
251
 
254
252
  (_ref = []).concat.apply(_ref, document.body.children).forEach(function (elem) {
255
- return EventHandler.on(elem, 'mouseover', null, noop());
253
+ return EventHandler__default['default'].on(elem, 'mouseover', null, noop());
256
254
  });
257
255
  }
258
256
 
@@ -260,9 +258,9 @@
260
258
 
261
259
  this._element.setAttribute('aria-expanded', true);
262
260
 
263
- Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW);
264
- Manipulator.toggleClass(this._element, CLASS_NAME_SHOW);
265
- EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget);
261
+ Manipulator__default['default'].toggleClass(this._menu, CLASS_NAME_SHOW);
262
+ Manipulator__default['default'].toggleClass(this._element, CLASS_NAME_SHOW);
263
+ EventHandler__default['default'].trigger(parent, EVENT_SHOWN, relatedTarget);
266
264
  };
267
265
 
268
266
  _proto.hide = function hide() {
@@ -274,7 +272,7 @@
274
272
  var relatedTarget = {
275
273
  relatedTarget: this._element
276
274
  };
277
- var hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget);
275
+ var hideEvent = EventHandler__default['default'].trigger(parent, EVENT_HIDE, relatedTarget);
278
276
 
279
277
  if (hideEvent.defaultPrevented) {
280
278
  return;
@@ -284,14 +282,14 @@
284
282
  this._popper.destroy();
285
283
  }
286
284
 
287
- Manipulator.toggleClass(this._menu, CLASS_NAME_SHOW);
288
- Manipulator.toggleClass(this._element, CLASS_NAME_SHOW);
289
- EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget);
285
+ Manipulator__default['default'].toggleClass(this._menu, CLASS_NAME_SHOW);
286
+ Manipulator__default['default'].toggleClass(this._element, CLASS_NAME_SHOW);
287
+ EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget);
290
288
  };
291
289
 
292
290
  _proto.dispose = function dispose() {
293
- Data.removeData(this._element, DATA_KEY);
294
- EventHandler.off(this._element, EVENT_KEY);
291
+ Data__default['default'].removeData(this._element, DATA_KEY);
292
+ EventHandler__default['default'].off(this._element, EVENT_KEY);
295
293
  this._element = null;
296
294
  this._menu = null;
297
295
 
@@ -314,7 +312,7 @@
314
312
  _proto._addEventListeners = function _addEventListeners() {
315
313
  var _this = this;
316
314
 
317
- EventHandler.on(this._element, EVENT_CLICK, function (event) {
315
+ EventHandler__default['default'].on(this._element, EVENT_CLICK, function (event) {
318
316
  event.preventDefault();
319
317
  event.stopPropagation();
320
318
 
@@ -323,13 +321,13 @@
323
321
  };
324
322
 
325
323
  _proto._getConfig = function _getConfig(config) {
326
- config = _objectSpread(_objectSpread(_objectSpread({}, this.constructor.Default), Manipulator.getDataAttributes(this._element)), config);
324
+ config = _extends({}, this.constructor.Default, Manipulator__default['default'].getDataAttributes(this._element), config);
327
325
  typeCheckConfig(NAME, config, this.constructor.DefaultType);
328
326
  return config;
329
327
  };
330
328
 
331
329
  _proto._getMenuElement = function _getMenuElement() {
332
- return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
330
+ return SelectorEngine__default['default'].next(this._element, SELECTOR_MENU)[0];
333
331
  };
334
332
 
335
333
  _proto._getPlacement = function _getPlacement() {
@@ -364,7 +362,7 @@
364
362
 
365
363
  if (typeof this._config.offset === 'function') {
366
364
  offset.fn = function (data) {
367
- data.offsets = _objectSpread(_objectSpread({}, data.offsets), _this2._config.offset(data.offsets, _this2._element) || {});
365
+ data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
368
366
  return data;
369
367
  };
370
368
  } else {
@@ -394,12 +392,12 @@
394
392
  };
395
393
  }
396
394
 
397
- return _objectSpread(_objectSpread({}, popperConfig), this._config.popperConfig);
395
+ return _extends({}, popperConfig, this._config.popperConfig);
398
396
  } // Static
399
397
  ;
400
398
 
401
399
  Dropdown.dropdownInterface = function dropdownInterface(element, config) {
402
- var data = Data.getData(element, DATA_KEY);
400
+ var data = Data__default['default'].getData(element, DATA_KEY);
403
401
 
404
402
  var _config = typeof config === 'object' ? config : null;
405
403
 
@@ -427,11 +425,11 @@
427
425
  return;
428
426
  }
429
427
 
430
- var toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
428
+ var toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
431
429
 
432
430
  for (var i = 0, len = toggles.length; i < len; i++) {
433
431
  var parent = Dropdown.getParentFromElement(toggles[i]);
434
- var context = Data.getData(toggles[i], DATA_KEY);
432
+ var context = Data__default['default'].getData(toggles[i], DATA_KEY);
435
433
  var relatedTarget = {
436
434
  relatedTarget: toggles[i]
437
435
  };
@@ -454,7 +452,7 @@
454
452
  continue;
455
453
  }
456
454
 
457
- var hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget);
455
+ var hideEvent = EventHandler__default['default'].trigger(parent, EVENT_HIDE, relatedTarget);
458
456
 
459
457
  if (hideEvent.defaultPrevented) {
460
458
  continue;
@@ -466,7 +464,7 @@
466
464
  var _ref2;
467
465
 
468
466
  (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) {
469
- return EventHandler.off(elem, 'mouseover', null, noop());
467
+ return EventHandler__default['default'].off(elem, 'mouseover', null, noop());
470
468
  });
471
469
  }
472
470
 
@@ -478,7 +476,7 @@
478
476
 
479
477
  dropdownMenu.classList.remove(CLASS_NAME_SHOW);
480
478
  toggles[i].classList.remove(CLASS_NAME_SHOW);
481
- EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget);
479
+ EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget);
482
480
  }
483
481
  };
484
482
 
@@ -509,7 +507,7 @@
509
507
  var isActive = this.classList.contains(CLASS_NAME_SHOW);
510
508
 
511
509
  if (event.key === ESCAPE_KEY) {
512
- var button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0];
510
+ var button = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
513
511
  button.focus();
514
512
  Dropdown.clearMenus();
515
513
  return;
@@ -520,7 +518,7 @@
520
518
  return;
521
519
  }
522
520
 
523
- var items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
521
+ var items = SelectorEngine__default['default'].find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible);
524
522
 
525
523
  if (!items.length) {
526
524
  return;
@@ -544,7 +542,7 @@
544
542
  };
545
543
 
546
544
  Dropdown.getInstance = function getInstance(element) {
547
- return Data.getData(element, DATA_KEY);
545
+ return Data__default['default'].getData(element, DATA_KEY);
548
546
  };
549
547
 
550
548
  _createClass(Dropdown, null, [{
@@ -573,16 +571,16 @@
573
571
  */
574
572
 
575
573
 
576
- EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler);
577
- EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
578
- EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
579
- EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
580
- EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
574
+ EventHandler__default['default'].on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler);
575
+ EventHandler__default['default'].on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
576
+ EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
577
+ EventHandler__default['default'].on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
578
+ EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
581
579
  event.preventDefault();
582
580
  event.stopPropagation();
583
581
  Dropdown.dropdownInterface(this, 'toggle');
584
582
  });
585
- EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, function (e) {
583
+ EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, function (e) {
586
584
  return e.stopPropagation();
587
585
  });
588
586
  var $ = getjQuery();
@@ -1,22 +1,24 @@
1
1
  /*!
2
- * Bootstrap modal.js v5.0.0-alpha1 (https://getbootstrap.com/)
2
+ * Bootstrap modal.js v5.0.0-alpha2 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
7
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
8
8
  typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
9
- (global = global || self, global.Modal = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
10
10
  }(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
11
11
 
12
- Data = Data && Object.prototype.hasOwnProperty.call(Data, 'default') ? Data['default'] : Data;
13
- EventHandler = EventHandler && Object.prototype.hasOwnProperty.call(EventHandler, 'default') ? EventHandler['default'] : EventHandler;
14
- Manipulator = Manipulator && Object.prototype.hasOwnProperty.call(Manipulator, 'default') ? Manipulator['default'] : Manipulator;
15
- SelectorEngine = SelectorEngine && Object.prototype.hasOwnProperty.call(SelectorEngine, 'default') ? SelectorEngine['default'] : SelectorEngine;
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
+
14
+ var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
+ var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
+ var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
17
+ var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
16
18
 
17
19
  /**
18
20
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.0.0-alpha1): util/index.js
21
+ * Bootstrap (v5.0.0-alpha2): util/index.js
20
22
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
23
  * --------------------------------------------------------------------------
22
24
  */
@@ -137,11 +139,7 @@
137
139
  return null;
138
140
  };
139
141
 
140
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
141
-
142
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
143
-
144
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
142
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
145
143
 
146
144
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
147
145
 
@@ -153,7 +151,7 @@
153
151
  */
154
152
 
155
153
  var NAME = 'modal';
156
- var VERSION = '5.0.0-alpha1';
154
+ var VERSION = '5.0.0-alpha2';
157
155
  var DATA_KEY = 'bs.modal';
158
156
  var EVENT_KEY = "." + DATA_KEY;
159
157
  var DATA_API_KEY = '.data-api';
@@ -204,14 +202,14 @@
204
202
  function Modal(element, config) {
205
203
  this._config = this._getConfig(config);
206
204
  this._element = element;
207
- this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element);
205
+ this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, element);
208
206
  this._backdrop = null;
209
207
  this._isShown = false;
210
208
  this._isBodyOverflowing = false;
211
209
  this._ignoreBackdropClick = false;
212
210
  this._isTransitioning = false;
213
211
  this._scrollbarWidth = 0;
214
- Data.setData(element, DATA_KEY, this);
212
+ Data__default['default'].setData(element, DATA_KEY, this);
215
213
  } // Getters
216
214
 
217
215
 
@@ -233,7 +231,7 @@
233
231
  this._isTransitioning = true;
234
232
  }
235
233
 
236
- var showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
234
+ var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
237
235
  relatedTarget: relatedTarget
238
236
  });
239
237
 
@@ -253,11 +251,11 @@
253
251
 
254
252
  this._setResizeEvent();
255
253
 
256
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
254
+ EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
257
255
  return _this.hide(event);
258
256
  });
259
- EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
260
- EventHandler.one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
257
+ EventHandler__default['default'].on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
258
+ EventHandler__default['default'].one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
261
259
  if (event.target === _this._element) {
262
260
  _this._ignoreBackdropClick = true;
263
261
  }
@@ -280,7 +278,7 @@
280
278
  return;
281
279
  }
282
280
 
283
- var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
281
+ var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE);
284
282
 
285
283
  if (hideEvent.defaultPrevented) {
286
284
  return;
@@ -298,16 +296,16 @@
298
296
 
299
297
  this._setResizeEvent();
300
298
 
301
- EventHandler.off(document, EVENT_FOCUSIN);
299
+ EventHandler__default['default'].off(document, EVENT_FOCUSIN);
302
300
 
303
301
  this._element.classList.remove(CLASS_NAME_SHOW);
304
302
 
305
- EventHandler.off(this._element, EVENT_CLICK_DISMISS);
306
- EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
303
+ EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
304
+ EventHandler__default['default'].off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
307
305
 
308
306
  if (transition) {
309
307
  var transitionDuration = getTransitionDurationFromElement(this._element);
310
- EventHandler.one(this._element, TRANSITION_END, function (event) {
308
+ EventHandler__default['default'].one(this._element, TRANSITION_END, function (event) {
311
309
  return _this2._hideModal(event);
312
310
  });
313
311
  emulateTransitionEnd(this._element, transitionDuration);
@@ -318,7 +316,7 @@
318
316
 
319
317
  _proto.dispose = function dispose() {
320
318
  [window, this._element, this._dialog].forEach(function (htmlElement) {
321
- return EventHandler.off(htmlElement, EVENT_KEY);
319
+ return EventHandler__default['default'].off(htmlElement, EVENT_KEY);
322
320
  });
323
321
  /**
324
322
  * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
@@ -326,8 +324,8 @@
326
324
  * It will remove `EVENT_CLICK_DATA_API` event that should remain
327
325
  */
328
326
 
329
- EventHandler.off(document, EVENT_FOCUSIN);
330
- Data.removeData(this._element, DATA_KEY);
327
+ EventHandler__default['default'].off(document, EVENT_FOCUSIN);
328
+ Data__default['default'].removeData(this._element, DATA_KEY);
331
329
  this._config = null;
332
330
  this._element = null;
333
331
  this._dialog = null;
@@ -345,7 +343,7 @@
345
343
  ;
346
344
 
347
345
  _proto._getConfig = function _getConfig(config) {
348
- config = _objectSpread(_objectSpread({}, Default), config);
346
+ config = _extends({}, Default, config);
349
347
  typeCheckConfig(NAME, config, DefaultType);
350
348
  return config;
351
349
  };
@@ -355,7 +353,7 @@
355
353
 
356
354
  var transition = this._element.classList.contains(CLASS_NAME_FADE);
357
355
 
358
- var modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
356
+ var modalBody = SelectorEngine__default['default'].findOne(SELECTOR_MODAL_BODY, this._dialog);
359
357
 
360
358
  if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
361
359
  // Don't move modal's DOM position
@@ -392,14 +390,14 @@
392
390
  }
393
391
 
394
392
  _this3._isTransitioning = false;
395
- EventHandler.trigger(_this3._element, EVENT_SHOWN, {
393
+ EventHandler__default['default'].trigger(_this3._element, EVENT_SHOWN, {
396
394
  relatedTarget: relatedTarget
397
395
  });
398
396
  };
399
397
 
400
398
  if (transition) {
401
399
  var transitionDuration = getTransitionDurationFromElement(this._dialog);
402
- EventHandler.one(this._dialog, TRANSITION_END, transitionComplete);
400
+ EventHandler__default['default'].one(this._dialog, TRANSITION_END, transitionComplete);
403
401
  emulateTransitionEnd(this._dialog, transitionDuration);
404
402
  } else {
405
403
  transitionComplete();
@@ -409,9 +407,9 @@
409
407
  _proto._enforceFocus = function _enforceFocus() {
410
408
  var _this4 = this;
411
409
 
412
- EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop
410
+ EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
413
411
 
414
- EventHandler.on(document, EVENT_FOCUSIN, function (event) {
412
+ EventHandler__default['default'].on(document, EVENT_FOCUSIN, function (event) {
415
413
  if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) {
416
414
  _this4._element.focus();
417
415
  }
@@ -422,7 +420,7 @@
422
420
  var _this5 = this;
423
421
 
424
422
  if (this._isShown) {
425
- EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
423
+ EventHandler__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
426
424
  if (_this5._config.keyboard && event.key === ESCAPE_KEY) {
427
425
  event.preventDefault();
428
426
 
@@ -432,7 +430,7 @@
432
430
  }
433
431
  });
434
432
  } else {
435
- EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS);
433
+ EventHandler__default['default'].off(this._element, EVENT_KEYDOWN_DISMISS);
436
434
  }
437
435
  };
438
436
 
@@ -440,11 +438,11 @@
440
438
  var _this6 = this;
441
439
 
442
440
  if (this._isShown) {
443
- EventHandler.on(window, EVENT_RESIZE, function () {
441
+ EventHandler__default['default'].on(window, EVENT_RESIZE, function () {
444
442
  return _this6._adjustDialog();
445
443
  });
446
444
  } else {
447
- EventHandler.off(window, EVENT_RESIZE);
445
+ EventHandler__default['default'].off(window, EVENT_RESIZE);
448
446
  }
449
447
  };
450
448
 
@@ -468,7 +466,7 @@
468
466
 
469
467
  _this7._resetScrollbar();
470
468
 
471
- EventHandler.trigger(_this7._element, EVENT_HIDDEN);
469
+ EventHandler__default['default'].trigger(_this7._element, EVENT_HIDDEN);
472
470
  });
473
471
  };
474
472
 
@@ -492,7 +490,7 @@
492
490
  }
493
491
 
494
492
  document.body.appendChild(this._backdrop);
495
- EventHandler.on(this._element, EVENT_CLICK_DISMISS, function (event) {
493
+ EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, function (event) {
496
494
  if (_this8._ignoreBackdropClick) {
497
495
  _this8._ignoreBackdropClick = false;
498
496
  return;
@@ -517,7 +515,7 @@
517
515
  }
518
516
 
519
517
  var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
520
- EventHandler.one(this._backdrop, TRANSITION_END, callback);
518
+ EventHandler__default['default'].one(this._backdrop, TRANSITION_END, callback);
521
519
  emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
522
520
  } else if (!this._isShown && this._backdrop) {
523
521
  this._backdrop.classList.remove(CLASS_NAME_SHOW);
@@ -531,7 +529,7 @@
531
529
  if (this._element.classList.contains(CLASS_NAME_FADE)) {
532
530
  var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
533
531
 
534
- EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove);
532
+ EventHandler__default['default'].one(this._backdrop, TRANSITION_END, callbackRemove);
535
533
  emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
536
534
  } else {
537
535
  callbackRemove();
@@ -545,17 +543,31 @@
545
543
  var _this9 = this;
546
544
 
547
545
  if (this._config.backdrop === 'static') {
548
- var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
546
+ var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE_PREVENTED);
549
547
 
550
548
  if (hideEvent.defaultPrevented) {
551
549
  return;
552
550
  }
553
551
 
552
+ var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
553
+
554
+ if (!isModalOverflowing) {
555
+ this._element.style.overflowY = 'hidden';
556
+ }
557
+
554
558
  this._element.classList.add(CLASS_NAME_STATIC);
555
559
 
556
- var modalTransitionDuration = getTransitionDurationFromElement(this._element);
557
- EventHandler.one(this._element, TRANSITION_END, function () {
560
+ var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
561
+ EventHandler__default['default'].off(this._element, TRANSITION_END);
562
+ EventHandler__default['default'].one(this._element, TRANSITION_END, function () {
558
563
  _this9._element.classList.remove(CLASS_NAME_STATIC);
564
+
565
+ if (!isModalOverflowing) {
566
+ EventHandler__default['default'].one(_this9._element, TRANSITION_END, function () {
567
+ _this9._element.style.overflowY = '';
568
+ });
569
+ emulateTransitionEnd(_this9._element, modalTransitionDuration);
570
+ }
559
571
  });
560
572
  emulateTransitionEnd(this._element, modalTransitionDuration);
561
573
 
@@ -598,23 +610,23 @@
598
610
  // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
599
611
  // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
600
612
  // Adjust fixed content padding
601
- SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
613
+ SelectorEngine__default['default'].find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
602
614
  var actualPadding = element.style.paddingRight;
603
615
  var calculatedPadding = window.getComputedStyle(element)['padding-right'];
604
- Manipulator.setDataAttribute(element, 'padding-right', actualPadding);
616
+ Manipulator__default['default'].setDataAttribute(element, 'padding-right', actualPadding);
605
617
  element.style.paddingRight = parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px";
606
618
  }); // Adjust sticky content margin
607
619
 
608
- SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
620
+ SelectorEngine__default['default'].find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
609
621
  var actualMargin = element.style.marginRight;
610
622
  var calculatedMargin = window.getComputedStyle(element)['margin-right'];
611
- Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
623
+ Manipulator__default['default'].setDataAttribute(element, 'margin-right', actualMargin);
612
624
  element.style.marginRight = parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px";
613
625
  }); // Adjust body padding
614
626
 
615
627
  var actualPadding = document.body.style.paddingRight;
616
628
  var calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
617
- Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
629
+ Manipulator__default['default'].setDataAttribute(document.body, 'padding-right', actualPadding);
618
630
  document.body.style.paddingRight = parseFloat(calculatedPadding) + this._scrollbarWidth + "px";
619
631
  }
620
632
 
@@ -623,30 +635,30 @@
623
635
 
624
636
  _proto._resetScrollbar = function _resetScrollbar() {
625
637
  // Restore fixed content padding
626
- SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
627
- var padding = Manipulator.getDataAttribute(element, 'padding-right');
638
+ SelectorEngine__default['default'].find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
639
+ var padding = Manipulator__default['default'].getDataAttribute(element, 'padding-right');
628
640
 
629
641
  if (typeof padding !== 'undefined') {
630
- Manipulator.removeDataAttribute(element, 'padding-right');
642
+ Manipulator__default['default'].removeDataAttribute(element, 'padding-right');
631
643
  element.style.paddingRight = padding;
632
644
  }
633
645
  }); // Restore sticky content and navbar-toggler margin
634
646
 
635
- SelectorEngine.find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) {
636
- var margin = Manipulator.getDataAttribute(element, 'margin-right');
647
+ SelectorEngine__default['default'].find("" + SELECTOR_STICKY_CONTENT).forEach(function (element) {
648
+ var margin = Manipulator__default['default'].getDataAttribute(element, 'margin-right');
637
649
 
638
650
  if (typeof margin !== 'undefined') {
639
- Manipulator.removeDataAttribute(element, 'margin-right');
651
+ Manipulator__default['default'].removeDataAttribute(element, 'margin-right');
640
652
  element.style.marginRight = margin;
641
653
  }
642
654
  }); // Restore body padding
643
655
 
644
- var padding = Manipulator.getDataAttribute(document.body, 'padding-right');
656
+ var padding = Manipulator__default['default'].getDataAttribute(document.body, 'padding-right');
645
657
 
646
658
  if (typeof padding === 'undefined') {
647
659
  document.body.style.paddingRight = '';
648
660
  } else {
649
- Manipulator.removeDataAttribute(document.body, 'padding-right');
661
+ Manipulator__default['default'].removeDataAttribute(document.body, 'padding-right');
650
662
  document.body.style.paddingRight = padding;
651
663
  }
652
664
  };
@@ -664,9 +676,9 @@
664
676
 
665
677
  Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
666
678
  return this.each(function () {
667
- var data = Data.getData(this, DATA_KEY);
679
+ var data = Data__default['default'].getData(this, DATA_KEY);
668
680
 
669
- var _config = _objectSpread(_objectSpread(_objectSpread({}, Default), Manipulator.getDataAttributes(this)), typeof config === 'object' && config ? config : {});
681
+ var _config = _extends({}, Default, Manipulator__default['default'].getDataAttributes(this), typeof config === 'object' && config ? config : {});
670
682
 
671
683
  if (!data) {
672
684
  data = new Modal(this, _config);
@@ -685,7 +697,7 @@
685
697
  };
686
698
 
687
699
  Modal.getInstance = function getInstance(element) {
688
- return Data.getData(element, DATA_KEY);
700
+ return Data__default['default'].getData(element, DATA_KEY);
689
701
  };
690
702
 
691
703
  _createClass(Modal, null, [{
@@ -709,7 +721,7 @@
709
721
  */
710
722
 
711
723
 
712
- EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
724
+ EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
713
725
  var _this11 = this;
714
726
 
715
727
  var target = getElementFromSelector(this);
@@ -718,22 +730,22 @@
718
730
  event.preventDefault();
719
731
  }
720
732
 
721
- EventHandler.one(target, EVENT_SHOW, function (showEvent) {
733
+ EventHandler__default['default'].one(target, EVENT_SHOW, function (showEvent) {
722
734
  if (showEvent.defaultPrevented) {
723
735
  // only register focus restorer if modal will actually get shown
724
736
  return;
725
737
  }
726
738
 
727
- EventHandler.one(target, EVENT_HIDDEN, function () {
739
+ EventHandler__default['default'].one(target, EVENT_HIDDEN, function () {
728
740
  if (isVisible(_this11)) {
729
741
  _this11.focus();
730
742
  }
731
743
  });
732
744
  });
733
- var data = Data.getData(target, DATA_KEY);
745
+ var data = Data__default['default'].getData(target, DATA_KEY);
734
746
 
735
747
  if (!data) {
736
- var config = _objectSpread(_objectSpread({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this));
748
+ var config = _extends({}, Manipulator__default['default'].getDataAttributes(target), Manipulator__default['default'].getDataAttributes(this));
737
749
 
738
750
  data = new Modal(target, config);
739
751
  }