bootstrap 5.0.2 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/javascripts/bootstrap/alert.js +78 -48
- data/assets/javascripts/bootstrap/base-component.js +22 -17
- data/assets/javascripts/bootstrap/button.js +19 -12
- data/assets/javascripts/bootstrap/carousel.js +66 -44
- data/assets/javascripts/bootstrap/collapse.js +114 -131
- data/assets/javascripts/bootstrap/dom/data.js +5 -5
- data/assets/javascripts/bootstrap/dom/event-handler.js +11 -5
- data/assets/javascripts/bootstrap/dom/manipulator.js +6 -6
- data/assets/javascripts/bootstrap/dom/selector-engine.js +49 -7
- data/assets/javascripts/bootstrap/dropdown.js +96 -106
- data/assets/javascripts/bootstrap/modal.js +241 -87
- data/assets/javascripts/bootstrap/offcanvas.js +203 -57
- data/assets/javascripts/bootstrap/popover.js +25 -58
- data/assets/javascripts/bootstrap/scrollspy.js +47 -66
- data/assets/javascripts/bootstrap/tab.js +41 -22
- data/assets/javascripts/bootstrap/toast.js +124 -29
- data/assets/javascripts/bootstrap/tooltip.js +122 -104
- data/assets/javascripts/bootstrap-sprockets.js +7 -7
- data/assets/javascripts/bootstrap.js +660 -630
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/stylesheets/_bootstrap-grid.scss +3 -1
- data/assets/stylesheets/_bootstrap-reboot.scss +2 -4
- data/assets/stylesheets/_bootstrap.scss +2 -1
- data/assets/stylesheets/bootstrap/_card.scss +2 -1
- data/assets/stylesheets/bootstrap/_functions.scss +51 -12
- data/assets/stylesheets/bootstrap/_grid.scss +11 -0
- data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modal.scss +1 -11
- data/assets/stylesheets/bootstrap/_navbar.scss +30 -1
- data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -0
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_reboot.scss +12 -8
- data/assets/stylesheets/bootstrap/_root.scss +40 -2
- data/assets/stylesheets/bootstrap/_tables.scss +8 -4
- data/assets/stylesheets/bootstrap/_toasts.scss +2 -2
- data/assets/stylesheets/bootstrap/_transitions.scss +6 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +44 -8
- data/assets/stylesheets/bootstrap/_variables.scss +184 -11
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +2 -0
- data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +29 -10
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +27 -6
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +1 -1
- data/bootstrap.gemspec +3 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +6 -2
- metadata +12 -8
@@ -1,41 +1,46 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap dropdown.js v5.
|
2
|
+
* Bootstrap dropdown.js v5.1.3 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 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
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/
|
8
|
-
typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Popper, global.
|
10
|
-
}(this, (function (Popper,
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Popper, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
10
|
+
})(this, (function (Popper, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
|
11
11
|
|
12
|
-
|
12
|
+
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
13
13
|
|
14
14
|
function _interopNamespace(e) {
|
15
15
|
if (e && e.__esModule) return e;
|
16
|
-
|
16
|
+
const n = Object.create(null);
|
17
17
|
if (e) {
|
18
|
-
|
18
|
+
for (const k in e) {
|
19
19
|
if (k !== 'default') {
|
20
|
-
|
20
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
21
21
|
Object.defineProperty(n, k, d.get ? d : {
|
22
22
|
enumerable: true,
|
23
|
-
get:
|
24
|
-
return e[k];
|
25
|
-
}
|
23
|
+
get: () => e[k]
|
26
24
|
});
|
27
25
|
}
|
28
|
-
}
|
26
|
+
}
|
29
27
|
}
|
30
|
-
n
|
28
|
+
n.default = e;
|
31
29
|
return Object.freeze(n);
|
32
30
|
}
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
const Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
|
33
|
+
const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
34
|
+
const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
35
|
+
const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
36
|
+
const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
37
|
+
|
38
|
+
/**
|
39
|
+
* --------------------------------------------------------------------------
|
40
|
+
* Bootstrap (v5.1.3): util/index.js
|
41
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
42
|
+
* --------------------------------------------------------------------------
|
43
|
+
*/
|
39
44
|
|
40
45
|
const toType = obj => {
|
41
46
|
if (obj === null || obj === undefined) {
|
@@ -93,7 +98,7 @@
|
|
93
98
|
}
|
94
99
|
|
95
100
|
if (typeof obj === 'string' && obj.length > 0) {
|
96
|
-
return
|
101
|
+
return document.querySelector(obj);
|
97
102
|
}
|
98
103
|
|
99
104
|
return null;
|
@@ -216,7 +221,7 @@
|
|
216
221
|
|
217
222
|
/**
|
218
223
|
* --------------------------------------------------------------------------
|
219
|
-
* Bootstrap (v5.
|
224
|
+
* Bootstrap (v5.1.3): dropdown.js
|
220
225
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
221
226
|
* --------------------------------------------------------------------------
|
222
227
|
*/
|
@@ -242,7 +247,6 @@
|
|
242
247
|
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
243
248
|
const EVENT_SHOW = `show${EVENT_KEY}`;
|
244
249
|
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
245
|
-
const EVENT_CLICK = `click${EVENT_KEY}`;
|
246
250
|
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
247
251
|
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`;
|
248
252
|
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`;
|
@@ -283,15 +287,13 @@
|
|
283
287
|
* ------------------------------------------------------------------------
|
284
288
|
*/
|
285
289
|
|
286
|
-
class Dropdown extends BaseComponent__default
|
290
|
+
class Dropdown extends BaseComponent__default.default {
|
287
291
|
constructor(element, config) {
|
288
292
|
super(element);
|
289
293
|
this._popper = null;
|
290
294
|
this._config = this._getConfig(config);
|
291
295
|
this._menu = this._getMenuElement();
|
292
296
|
this._inNavbar = this._detectNavbar();
|
293
|
-
|
294
|
-
this._addEventListeners();
|
295
297
|
} // Getters
|
296
298
|
|
297
299
|
|
@@ -309,61 +311,29 @@
|
|
309
311
|
|
310
312
|
|
311
313
|
toggle() {
|
312
|
-
|
313
|
-
return;
|
314
|
-
}
|
315
|
-
|
316
|
-
const isActive = this._element.classList.contains(CLASS_NAME_SHOW);
|
317
|
-
|
318
|
-
if (isActive) {
|
319
|
-
this.hide();
|
320
|
-
return;
|
321
|
-
}
|
322
|
-
|
323
|
-
this.show();
|
314
|
+
return this._isShown() ? this.hide() : this.show();
|
324
315
|
}
|
325
316
|
|
326
317
|
show() {
|
327
|
-
if (isDisabled(this._element) || this._menu
|
318
|
+
if (isDisabled(this._element) || this._isShown(this._menu)) {
|
328
319
|
return;
|
329
320
|
}
|
330
321
|
|
331
|
-
const parent = Dropdown.getParentFromElement(this._element);
|
332
322
|
const relatedTarget = {
|
333
323
|
relatedTarget: this._element
|
334
324
|
};
|
335
|
-
const showEvent = EventHandler__default
|
325
|
+
const showEvent = EventHandler__default.default.trigger(this._element, EVENT_SHOW, relatedTarget);
|
336
326
|
|
337
327
|
if (showEvent.defaultPrevented) {
|
338
328
|
return;
|
339
|
-
}
|
329
|
+
}
|
340
330
|
|
331
|
+
const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
|
341
332
|
|
342
333
|
if (this._inNavbar) {
|
343
|
-
Manipulator__default
|
334
|
+
Manipulator__default.default.setDataAttribute(this._menu, 'popper', 'none');
|
344
335
|
} else {
|
345
|
-
|
346
|
-
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
347
|
-
}
|
348
|
-
|
349
|
-
let referenceElement = this._element;
|
350
|
-
|
351
|
-
if (this._config.reference === 'parent') {
|
352
|
-
referenceElement = parent;
|
353
|
-
} else if (isElement(this._config.reference)) {
|
354
|
-
referenceElement = getElement(this._config.reference);
|
355
|
-
} else if (typeof this._config.reference === 'object') {
|
356
|
-
referenceElement = this._config.reference;
|
357
|
-
}
|
358
|
-
|
359
|
-
const popperConfig = this._getPopperConfig();
|
360
|
-
|
361
|
-
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
362
|
-
this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
|
363
|
-
|
364
|
-
if (isDisplayStatic) {
|
365
|
-
Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'static');
|
366
|
-
}
|
336
|
+
this._createPopper(parent);
|
367
337
|
} // If this is a touch-enabled device we add extra
|
368
338
|
// empty mouseover listeners to the body's immediate children;
|
369
339
|
// only needed because of broken event delegation on iOS
|
@@ -371,22 +341,22 @@
|
|
371
341
|
|
372
342
|
|
373
343
|
if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
|
374
|
-
[].concat(...document.body.children).forEach(elem => EventHandler__default
|
344
|
+
[].concat(...document.body.children).forEach(elem => EventHandler__default.default.on(elem, 'mouseover', noop));
|
375
345
|
}
|
376
346
|
|
377
347
|
this._element.focus();
|
378
348
|
|
379
349
|
this._element.setAttribute('aria-expanded', true);
|
380
350
|
|
381
|
-
this._menu.classList.
|
351
|
+
this._menu.classList.add(CLASS_NAME_SHOW);
|
382
352
|
|
383
|
-
this._element.classList.
|
353
|
+
this._element.classList.add(CLASS_NAME_SHOW);
|
384
354
|
|
385
|
-
EventHandler__default
|
355
|
+
EventHandler__default.default.trigger(this._element, EVENT_SHOWN, relatedTarget);
|
386
356
|
}
|
387
357
|
|
388
358
|
hide() {
|
389
|
-
if (isDisabled(this._element) || !this._menu
|
359
|
+
if (isDisabled(this._element) || !this._isShown(this._menu)) {
|
390
360
|
return;
|
391
361
|
}
|
392
362
|
|
@@ -414,15 +384,8 @@
|
|
414
384
|
} // Private
|
415
385
|
|
416
386
|
|
417
|
-
_addEventListeners() {
|
418
|
-
EventHandler__default['default'].on(this._element, EVENT_CLICK, event => {
|
419
|
-
event.preventDefault();
|
420
|
-
this.toggle();
|
421
|
-
});
|
422
|
-
}
|
423
|
-
|
424
387
|
_completeHide(relatedTarget) {
|
425
|
-
const hideEvent = EventHandler__default
|
388
|
+
const hideEvent = EventHandler__default.default.trigger(this._element, EVENT_HIDE, relatedTarget);
|
426
389
|
|
427
390
|
if (hideEvent.defaultPrevented) {
|
428
391
|
return;
|
@@ -431,7 +394,7 @@
|
|
431
394
|
|
432
395
|
|
433
396
|
if ('ontouchstart' in document.documentElement) {
|
434
|
-
[].concat(...document.body.children).forEach(elem => EventHandler__default
|
397
|
+
[].concat(...document.body.children).forEach(elem => EventHandler__default.default.off(elem, 'mouseover', noop));
|
435
398
|
}
|
436
399
|
|
437
400
|
if (this._popper) {
|
@@ -444,13 +407,13 @@
|
|
444
407
|
|
445
408
|
this._element.setAttribute('aria-expanded', 'false');
|
446
409
|
|
447
|
-
Manipulator__default
|
448
|
-
EventHandler__default
|
410
|
+
Manipulator__default.default.removeDataAttribute(this._menu, 'popper');
|
411
|
+
EventHandler__default.default.trigger(this._element, EVENT_HIDDEN, relatedTarget);
|
449
412
|
}
|
450
413
|
|
451
414
|
_getConfig(config) {
|
452
415
|
config = { ...this.constructor.Default,
|
453
|
-
...Manipulator__default
|
416
|
+
...Manipulator__default.default.getDataAttributes(this._element),
|
454
417
|
...config
|
455
418
|
};
|
456
419
|
typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
@@ -463,8 +426,37 @@
|
|
463
426
|
return config;
|
464
427
|
}
|
465
428
|
|
429
|
+
_createPopper(parent) {
|
430
|
+
if (typeof Popper__namespace === 'undefined') {
|
431
|
+
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
432
|
+
}
|
433
|
+
|
434
|
+
let referenceElement = this._element;
|
435
|
+
|
436
|
+
if (this._config.reference === 'parent') {
|
437
|
+
referenceElement = parent;
|
438
|
+
} else if (isElement(this._config.reference)) {
|
439
|
+
referenceElement = getElement(this._config.reference);
|
440
|
+
} else if (typeof this._config.reference === 'object') {
|
441
|
+
referenceElement = this._config.reference;
|
442
|
+
}
|
443
|
+
|
444
|
+
const popperConfig = this._getPopperConfig();
|
445
|
+
|
446
|
+
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
447
|
+
this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
|
448
|
+
|
449
|
+
if (isDisplayStatic) {
|
450
|
+
Manipulator__default.default.setDataAttribute(this._menu, 'popper', 'static');
|
451
|
+
}
|
452
|
+
}
|
453
|
+
|
454
|
+
_isShown(element = this._element) {
|
455
|
+
return element.classList.contains(CLASS_NAME_SHOW);
|
456
|
+
}
|
457
|
+
|
466
458
|
_getMenuElement() {
|
467
|
-
return SelectorEngine__default
|
459
|
+
return SelectorEngine__default.default.next(this._element, SELECTOR_MENU)[0];
|
468
460
|
}
|
469
461
|
|
470
462
|
_getPlacement() {
|
@@ -540,7 +532,7 @@
|
|
540
532
|
key,
|
541
533
|
target
|
542
534
|
}) {
|
543
|
-
const items = SelectorEngine__default
|
535
|
+
const items = SelectorEngine__default.default.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
|
544
536
|
|
545
537
|
if (!items.length) {
|
546
538
|
return;
|
@@ -552,21 +544,19 @@
|
|
552
544
|
} // Static
|
553
545
|
|
554
546
|
|
555
|
-
static
|
556
|
-
|
547
|
+
static jQueryInterface(config) {
|
548
|
+
return this.each(function () {
|
549
|
+
const data = Dropdown.getOrCreateInstance(this, config);
|
550
|
+
|
551
|
+
if (typeof config !== 'string') {
|
552
|
+
return;
|
553
|
+
}
|
557
554
|
|
558
|
-
if (typeof config === 'string') {
|
559
555
|
if (typeof data[config] === 'undefined') {
|
560
556
|
throw new TypeError(`No method named "${config}"`);
|
561
557
|
}
|
562
558
|
|
563
559
|
data[config]();
|
564
|
-
}
|
565
|
-
}
|
566
|
-
|
567
|
-
static jQueryInterface(config) {
|
568
|
-
return this.each(function () {
|
569
|
-
Dropdown.dropdownInterface(this, config);
|
570
560
|
});
|
571
561
|
}
|
572
562
|
|
@@ -575,7 +565,7 @@
|
|
575
565
|
return;
|
576
566
|
}
|
577
567
|
|
578
|
-
const toggles = SelectorEngine__default
|
568
|
+
const toggles = SelectorEngine__default.default.find(SELECTOR_DATA_TOGGLE);
|
579
569
|
|
580
570
|
for (let i = 0, len = toggles.length; i < len; i++) {
|
581
571
|
const context = Dropdown.getInstance(toggles[i]);
|
@@ -584,7 +574,7 @@
|
|
584
574
|
continue;
|
585
575
|
}
|
586
576
|
|
587
|
-
if (!context.
|
577
|
+
if (!context._isShown()) {
|
588
578
|
continue;
|
589
579
|
}
|
590
580
|
|
@@ -643,20 +633,20 @@
|
|
643
633
|
return;
|
644
634
|
}
|
645
635
|
|
646
|
-
const getToggleButton =
|
636
|
+
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default.default.prev(this, SELECTOR_DATA_TOGGLE)[0];
|
637
|
+
const instance = Dropdown.getOrCreateInstance(getToggleButton);
|
647
638
|
|
648
639
|
if (event.key === ESCAPE_KEY) {
|
649
|
-
|
650
|
-
Dropdown.clearMenus();
|
640
|
+
instance.hide();
|
651
641
|
return;
|
652
642
|
}
|
653
643
|
|
654
644
|
if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
|
655
645
|
if (!isActive) {
|
656
|
-
|
646
|
+
instance.show();
|
657
647
|
}
|
658
648
|
|
659
|
-
|
649
|
+
instance._selectMenuItem(event);
|
660
650
|
|
661
651
|
return;
|
662
652
|
}
|
@@ -674,13 +664,13 @@
|
|
674
664
|
*/
|
675
665
|
|
676
666
|
|
677
|
-
EventHandler__default
|
678
|
-
EventHandler__default
|
679
|
-
EventHandler__default
|
680
|
-
EventHandler__default
|
681
|
-
EventHandler__default
|
667
|
+
EventHandler__default.default.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler);
|
668
|
+
EventHandler__default.default.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
|
669
|
+
EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
|
670
|
+
EventHandler__default.default.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
671
|
+
EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
682
672
|
event.preventDefault();
|
683
|
-
Dropdown.
|
673
|
+
Dropdown.getOrCreateInstance(this).toggle();
|
684
674
|
});
|
685
675
|
/**
|
686
676
|
* ------------------------------------------------------------------------
|
@@ -693,4 +683,4 @@
|
|
693
683
|
|
694
684
|
return Dropdown;
|
695
685
|
|
696
|
-
}))
|
686
|
+
}));
|