bootstrap 5.0.0.beta1 → 5.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +3 -3
- data/assets/javascripts/bootstrap-global-this-define.js +6 -0
- data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
- data/assets/javascripts/bootstrap-sprockets.js +3 -0
- data/assets/javascripts/bootstrap.js +429 -486
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/javascripts/bootstrap/alert.js +81 -80
- data/assets/javascripts/bootstrap/base-component.js +75 -0
- data/assets/javascripts/bootstrap/button.js +60 -72
- data/assets/javascripts/bootstrap/carousel.js +131 -110
- data/assets/javascripts/bootstrap/collapse.js +94 -77
- data/assets/javascripts/bootstrap/dom/data.js +3 -3
- data/assets/javascripts/bootstrap/dom/event-handler.js +6 -5
- data/assets/javascripts/bootstrap/dom/manipulator.js +3 -3
- data/assets/javascripts/bootstrap/dom/selector-engine.js +6 -11
- data/assets/javascripts/bootstrap/dropdown.js +159 -90
- data/assets/javascripts/bootstrap/modal.js +132 -125
- data/assets/javascripts/bootstrap/popover.js +73 -25
- data/assets/javascripts/bootstrap/scrollspy.js +93 -76
- data/assets/javascripts/bootstrap/tab.js +78 -82
- data/assets/javascripts/bootstrap/toast.js +79 -75
- data/assets/javascripts/bootstrap/tooltip.js +207 -185
- data/assets/stylesheets/_bootstrap-grid.scss +3 -3
- data/assets/stylesheets/_bootstrap-reboot.scss +3 -3
- data/assets/stylesheets/_bootstrap.scss +3 -3
- data/assets/stylesheets/bootstrap/_accordion.scss +1 -0
- data/assets/stylesheets/bootstrap/_alert.scss +6 -6
- data/assets/stylesheets/bootstrap/_carousel.scss +12 -6
- data/assets/stylesheets/bootstrap/_close.scss +1 -1
- data/assets/stylesheets/bootstrap/_dropdown.scss +29 -15
- data/assets/stylesheets/bootstrap/_list-group.scss +5 -5
- data/assets/stylesheets/bootstrap/_nav.scss +5 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +12 -1
- data/assets/stylesheets/bootstrap/_pagination.scss +2 -2
- data/assets/stylesheets/bootstrap/_popover.scss +0 -15
- data/assets/stylesheets/bootstrap/_reboot.scss +6 -6
- data/assets/stylesheets/bootstrap/_tables.scss +1 -1
- data/assets/stylesheets/bootstrap/_toasts.scss +1 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +6 -0
- data/assets/stylesheets/bootstrap/_variables.scss +30 -7
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +5 -5
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +1 -2
- data/assets/stylesheets/bootstrap/forms/_validation.scss +1 -1
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +2 -2
- data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +13 -6
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +4 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +3 -2
- data/assets/stylesheets/bootstrap/utilities/_api.scss +1 -1
- data/bootstrap.gemspec +1 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +15 -2
- data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
- data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
- data/test/dummy_rails/app/views/pages/root.html +89 -0
- data/test/dummy_rails/config/application.rb +0 -3
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- metadata +13 -36
- data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
@@ -1,13 +1,13 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap carousel.js v5.0.0-
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap carousel.js v5.0.0-beta2 (https://getbootstrap.com/)
|
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('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
|
8
|
-
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
|
10
|
-
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
|
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'), require('./base-component.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
10
|
+
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
|
11
11
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
13
13
|
|
@@ -15,10 +15,61 @@
|
|
15
15
|
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
16
16
|
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
17
17
|
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
18
|
+
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
19
|
+
|
20
|
+
function _defineProperties(target, props) {
|
21
|
+
for (var i = 0; i < props.length; i++) {
|
22
|
+
var descriptor = props[i];
|
23
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
24
|
+
descriptor.configurable = true;
|
25
|
+
if ("value" in descriptor) descriptor.writable = true;
|
26
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
31
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
32
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
33
|
+
return Constructor;
|
34
|
+
}
|
35
|
+
|
36
|
+
function _extends() {
|
37
|
+
_extends = Object.assign || function (target) {
|
38
|
+
for (var i = 1; i < arguments.length; i++) {
|
39
|
+
var source = arguments[i];
|
40
|
+
|
41
|
+
for (var key in source) {
|
42
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
43
|
+
target[key] = source[key];
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
return target;
|
49
|
+
};
|
50
|
+
|
51
|
+
return _extends.apply(this, arguments);
|
52
|
+
}
|
53
|
+
|
54
|
+
function _inheritsLoose(subClass, superClass) {
|
55
|
+
subClass.prototype = Object.create(superClass.prototype);
|
56
|
+
subClass.prototype.constructor = subClass;
|
57
|
+
|
58
|
+
_setPrototypeOf(subClass, superClass);
|
59
|
+
}
|
60
|
+
|
61
|
+
function _setPrototypeOf(o, p) {
|
62
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
63
|
+
o.__proto__ = p;
|
64
|
+
return o;
|
65
|
+
};
|
66
|
+
|
67
|
+
return _setPrototypeOf(o, p);
|
68
|
+
}
|
18
69
|
|
19
70
|
/**
|
20
71
|
* --------------------------------------------------------------------------
|
21
|
-
* Bootstrap (v5.0.0-
|
72
|
+
* Bootstrap (v5.0.0-beta2): util/index.js
|
22
73
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
23
74
|
* --------------------------------------------------------------------------
|
24
75
|
*/
|
@@ -37,7 +88,20 @@
|
|
37
88
|
var selector = element.getAttribute('data-bs-target');
|
38
89
|
|
39
90
|
if (!selector || selector === '#') {
|
40
|
-
var hrefAttr = element.getAttribute('href');
|
91
|
+
var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
92
|
+
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
93
|
+
// `document.querySelector` will rightfully complain it is invalid.
|
94
|
+
// See https://github.com/twbs/bootstrap/issues/32273
|
95
|
+
|
96
|
+
if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
|
97
|
+
return null;
|
98
|
+
} // Just in case some CMS puts out a full URL with the anchor appended
|
99
|
+
|
100
|
+
|
101
|
+
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
|
102
|
+
hrefAttr = '#' + hrefAttr.split('#')[1];
|
103
|
+
}
|
104
|
+
|
41
105
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
42
106
|
}
|
43
107
|
|
@@ -105,7 +169,7 @@
|
|
105
169
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
106
170
|
|
107
171
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
108
|
-
throw new
|
172
|
+
throw new TypeError(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
109
173
|
}
|
110
174
|
});
|
111
175
|
};
|
@@ -149,57 +213,24 @@
|
|
149
213
|
|
150
214
|
var isRTL = document.documentElement.dir === 'rtl';
|
151
215
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
* ------------------------------------------------------------------------
|
157
|
-
* Constants
|
158
|
-
* ------------------------------------------------------------------------
|
159
|
-
*/
|
160
|
-
|
161
|
-
var VERSION = '5.0.0-beta1';
|
162
|
-
|
163
|
-
var BaseComponent = /*#__PURE__*/function () {
|
164
|
-
function BaseComponent(element) {
|
165
|
-
if (!element) {
|
166
|
-
return;
|
167
|
-
}
|
168
|
-
|
169
|
-
this._element = element;
|
170
|
-
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
171
|
-
}
|
216
|
+
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
217
|
+
onDOMContentLoaded(function () {
|
218
|
+
var $ = getjQuery();
|
219
|
+
/* istanbul ignore if */
|
172
220
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
this._element = null;
|
178
|
-
}
|
179
|
-
/** Static */
|
180
|
-
;
|
181
|
-
|
182
|
-
BaseComponent.getInstance = function getInstance(element) {
|
183
|
-
return Data__default['default'].getData(element, this.DATA_KEY);
|
184
|
-
};
|
221
|
+
if ($) {
|
222
|
+
var JQUERY_NO_CONFLICT = $.fn[name];
|
223
|
+
$.fn[name] = plugin.jQueryInterface;
|
224
|
+
$.fn[name].Constructor = plugin;
|
185
225
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
226
|
+
$.fn[name].noConflict = function () {
|
227
|
+
$.fn[name] = JQUERY_NO_CONFLICT;
|
228
|
+
return plugin.jQueryInterface;
|
229
|
+
};
|
190
230
|
}
|
191
|
-
}
|
192
|
-
|
193
|
-
return BaseComponent;
|
194
|
-
}();
|
195
|
-
|
196
|
-
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); }
|
197
|
-
|
198
|
-
function _defineProperties$1(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); } }
|
199
|
-
|
200
|
-
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
|
231
|
+
});
|
232
|
+
};
|
201
233
|
|
202
|
-
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
203
234
|
/**
|
204
235
|
* ------------------------------------------------------------------------
|
205
236
|
* Constants
|
@@ -262,12 +293,11 @@
|
|
262
293
|
var SELECTOR_ITEM_IMG = '.carousel-item img';
|
263
294
|
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
|
264
295
|
var SELECTOR_INDICATORS = '.carousel-indicators';
|
296
|
+
var SELECTOR_INDICATOR = '[data-bs-target]';
|
265
297
|
var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
|
266
298
|
var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
|
267
|
-
var
|
268
|
-
|
269
|
-
PEN: 'pen'
|
270
|
-
};
|
299
|
+
var POINTER_TYPE_TOUCH = 'touch';
|
300
|
+
var POINTER_TYPE_PEN = 'pen';
|
271
301
|
/**
|
272
302
|
* ------------------------------------------------------------------------
|
273
303
|
* Class Definition
|
@@ -414,12 +444,20 @@
|
|
414
444
|
this.touchDeltaX = 0; // swipe left
|
415
445
|
|
416
446
|
if (direction > 0) {
|
417
|
-
|
447
|
+
if (isRTL) {
|
448
|
+
this.next();
|
449
|
+
} else {
|
450
|
+
this.prev();
|
451
|
+
}
|
418
452
|
} // swipe right
|
419
453
|
|
420
454
|
|
421
455
|
if (direction < 0) {
|
422
|
-
|
456
|
+
if (isRTL) {
|
457
|
+
this.prev();
|
458
|
+
} else {
|
459
|
+
this.next();
|
460
|
+
}
|
423
461
|
}
|
424
462
|
};
|
425
463
|
|
@@ -450,7 +488,7 @@
|
|
450
488
|
var _this4 = this;
|
451
489
|
|
452
490
|
var start = function start(event) {
|
453
|
-
if (_this4._pointerEvent &&
|
491
|
+
if (_this4._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
|
454
492
|
_this4.touchStartX = event.clientX;
|
455
493
|
} else if (!_this4._pointerEvent) {
|
456
494
|
_this4.touchStartX = event.touches[0].clientX;
|
@@ -467,7 +505,7 @@
|
|
467
505
|
};
|
468
506
|
|
469
507
|
var end = function end(event) {
|
470
|
-
if (_this4._pointerEvent &&
|
508
|
+
if (_this4._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
|
471
509
|
_this4.touchDeltaX = event.clientX - _this4.touchStartX;
|
472
510
|
}
|
473
511
|
|
@@ -526,16 +564,22 @@
|
|
526
564
|
return;
|
527
565
|
}
|
528
566
|
|
529
|
-
|
530
|
-
|
531
|
-
|
567
|
+
if (event.key === ARROW_LEFT_KEY) {
|
568
|
+
event.preventDefault();
|
569
|
+
|
570
|
+
if (isRTL) {
|
571
|
+
this.next();
|
572
|
+
} else {
|
532
573
|
this.prev();
|
533
|
-
|
574
|
+
}
|
575
|
+
} else if (event.key === ARROW_RIGHT_KEY) {
|
576
|
+
event.preventDefault();
|
534
577
|
|
535
|
-
|
536
|
-
|
578
|
+
if (isRTL) {
|
579
|
+
this.prev();
|
580
|
+
} else {
|
537
581
|
this.next();
|
538
|
-
|
582
|
+
}
|
539
583
|
}
|
540
584
|
};
|
541
585
|
|
@@ -577,16 +621,17 @@
|
|
577
621
|
|
578
622
|
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
|
579
623
|
if (this._indicatorsElement) {
|
580
|
-
var
|
624
|
+
var activeIndicator = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE, this._indicatorsElement);
|
625
|
+
activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
|
626
|
+
activeIndicator.removeAttribute('aria-current');
|
627
|
+
var indicators = SelectorEngine__default['default'].find(SELECTOR_INDICATOR, this._indicatorsElement);
|
581
628
|
|
582
629
|
for (var i = 0; i < indicators.length; i++) {
|
583
|
-
indicators[i].
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
if (nextIndicator) {
|
589
|
-
nextIndicator.classList.add(CLASS_NAME_ACTIVE);
|
630
|
+
if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
|
631
|
+
indicators[i].classList.add(CLASS_NAME_ACTIVE);
|
632
|
+
indicators[i].setAttribute('aria-current', 'true');
|
633
|
+
break;
|
634
|
+
}
|
590
635
|
}
|
591
636
|
}
|
592
637
|
};
|
@@ -620,19 +665,9 @@
|
|
620
665
|
var nextElementIndex = this._getItemIndex(nextElement);
|
621
666
|
|
622
667
|
var isCycling = Boolean(this._interval);
|
623
|
-
var directionalClassName;
|
624
|
-
var orderClassName;
|
625
|
-
var eventDirectionName;
|
626
|
-
|
627
|
-
if (direction === DIRECTION_NEXT) {
|
628
|
-
directionalClassName = CLASS_NAME_START;
|
629
|
-
orderClassName = CLASS_NAME_NEXT;
|
630
|
-
eventDirectionName = DIRECTION_LEFT;
|
631
|
-
} else {
|
632
|
-
directionalClassName = CLASS_NAME_END;
|
633
|
-
orderClassName = CLASS_NAME_PREV;
|
634
|
-
eventDirectionName = DIRECTION_RIGHT;
|
635
|
-
}
|
668
|
+
var directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END;
|
669
|
+
var orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
|
670
|
+
var eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
636
671
|
|
637
672
|
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
|
638
673
|
this._isSliding = false;
|
@@ -666,7 +701,7 @@
|
|
666
701
|
activeElement.classList.add(directionalClassName);
|
667
702
|
nextElement.classList.add(directionalClassName);
|
668
703
|
var transitionDuration = getTransitionDurationFromElement(activeElement);
|
669
|
-
EventHandler__default['default'].one(activeElement,
|
704
|
+
EventHandler__default['default'].one(activeElement, 'transitionend', function () {
|
670
705
|
nextElement.classList.remove(directionalClassName, orderClassName);
|
671
706
|
nextElement.classList.add(CLASS_NAME_ACTIVE);
|
672
707
|
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
|
@@ -758,7 +793,7 @@
|
|
758
793
|
event.preventDefault();
|
759
794
|
};
|
760
795
|
|
761
|
-
_createClass
|
796
|
+
_createClass(Carousel, null, [{
|
762
797
|
key: "Default",
|
763
798
|
get: function get() {
|
764
799
|
return Default;
|
@@ -771,7 +806,7 @@
|
|
771
806
|
}]);
|
772
807
|
|
773
808
|
return Carousel;
|
774
|
-
}(
|
809
|
+
}(BaseComponent__default['default']);
|
775
810
|
/**
|
776
811
|
* ------------------------------------------------------------------------
|
777
812
|
* Data Api implementation
|
@@ -794,21 +829,7 @@
|
|
794
829
|
* add .Carousel to jQuery only if jQuery is present
|
795
830
|
*/
|
796
831
|
|
797
|
-
|
798
|
-
var $ = getjQuery();
|
799
|
-
/* istanbul ignore if */
|
800
|
-
|
801
|
-
if ($) {
|
802
|
-
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
803
|
-
$.fn[NAME] = Carousel.jQueryInterface;
|
804
|
-
$.fn[NAME].Constructor = Carousel;
|
805
|
-
|
806
|
-
$.fn[NAME].noConflict = function () {
|
807
|
-
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
808
|
-
return Carousel.jQueryInterface;
|
809
|
-
};
|
810
|
-
}
|
811
|
-
});
|
832
|
+
defineJQueryPlugin(NAME, Carousel);
|
812
833
|
|
813
834
|
return Carousel;
|
814
835
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap collapse.js v5.0.0-
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap collapse.js v5.0.0-beta2 (https://getbootstrap.com/)
|
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('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
|
8
|
-
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
|
10
|
-
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
|
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'), require('./base-component.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
10
|
+
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
|
11
11
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
13
13
|
|
@@ -15,10 +15,61 @@
|
|
15
15
|
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
16
16
|
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
17
17
|
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
18
|
+
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
19
|
+
|
20
|
+
function _defineProperties(target, props) {
|
21
|
+
for (var i = 0; i < props.length; i++) {
|
22
|
+
var descriptor = props[i];
|
23
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
24
|
+
descriptor.configurable = true;
|
25
|
+
if ("value" in descriptor) descriptor.writable = true;
|
26
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
31
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
32
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
33
|
+
return Constructor;
|
34
|
+
}
|
35
|
+
|
36
|
+
function _extends() {
|
37
|
+
_extends = Object.assign || function (target) {
|
38
|
+
for (var i = 1; i < arguments.length; i++) {
|
39
|
+
var source = arguments[i];
|
40
|
+
|
41
|
+
for (var key in source) {
|
42
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
43
|
+
target[key] = source[key];
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
return target;
|
49
|
+
};
|
50
|
+
|
51
|
+
return _extends.apply(this, arguments);
|
52
|
+
}
|
53
|
+
|
54
|
+
function _inheritsLoose(subClass, superClass) {
|
55
|
+
subClass.prototype = Object.create(superClass.prototype);
|
56
|
+
subClass.prototype.constructor = subClass;
|
57
|
+
|
58
|
+
_setPrototypeOf(subClass, superClass);
|
59
|
+
}
|
60
|
+
|
61
|
+
function _setPrototypeOf(o, p) {
|
62
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
63
|
+
o.__proto__ = p;
|
64
|
+
return o;
|
65
|
+
};
|
66
|
+
|
67
|
+
return _setPrototypeOf(o, p);
|
68
|
+
}
|
18
69
|
|
19
70
|
/**
|
20
71
|
* --------------------------------------------------------------------------
|
21
|
-
* Bootstrap (v5.0.0-
|
72
|
+
* Bootstrap (v5.0.0-beta2): util/index.js
|
22
73
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
23
74
|
* --------------------------------------------------------------------------
|
24
75
|
*/
|
@@ -37,7 +88,20 @@
|
|
37
88
|
var selector = element.getAttribute('data-bs-target');
|
38
89
|
|
39
90
|
if (!selector || selector === '#') {
|
40
|
-
var hrefAttr = element.getAttribute('href');
|
91
|
+
var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
92
|
+
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
93
|
+
// `document.querySelector` will rightfully complain it is invalid.
|
94
|
+
// See https://github.com/twbs/bootstrap/issues/32273
|
95
|
+
|
96
|
+
if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
|
97
|
+
return null;
|
98
|
+
} // Just in case some CMS puts out a full URL with the anchor appended
|
99
|
+
|
100
|
+
|
101
|
+
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
|
102
|
+
hrefAttr = '#' + hrefAttr.split('#')[1];
|
103
|
+
}
|
104
|
+
|
41
105
|
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
42
106
|
}
|
43
107
|
|
@@ -115,7 +179,7 @@
|
|
115
179
|
var valueType = value && isElement(value) ? 'element' : toType(value);
|
116
180
|
|
117
181
|
if (!new RegExp(expectedTypes).test(valueType)) {
|
118
|
-
throw new
|
182
|
+
throw new TypeError(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
119
183
|
}
|
120
184
|
});
|
121
185
|
};
|
@@ -143,59 +207,26 @@
|
|
143
207
|
}
|
144
208
|
};
|
145
209
|
|
146
|
-
|
147
|
-
|
148
|
-
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); } }
|
149
|
-
|
150
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
151
|
-
/**
|
152
|
-
* ------------------------------------------------------------------------
|
153
|
-
* Constants
|
154
|
-
* ------------------------------------------------------------------------
|
155
|
-
*/
|
156
|
-
|
157
|
-
var VERSION = '5.0.0-beta1';
|
158
|
-
|
159
|
-
var BaseComponent = /*#__PURE__*/function () {
|
160
|
-
function BaseComponent(element) {
|
161
|
-
if (!element) {
|
162
|
-
return;
|
163
|
-
}
|
164
|
-
|
165
|
-
this._element = element;
|
166
|
-
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
|
167
|
-
}
|
168
|
-
|
169
|
-
var _proto = BaseComponent.prototype;
|
210
|
+
document.documentElement.dir === 'rtl';
|
170
211
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
/** Static */
|
176
|
-
;
|
212
|
+
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
|
213
|
+
onDOMContentLoaded(function () {
|
214
|
+
var $ = getjQuery();
|
215
|
+
/* istanbul ignore if */
|
177
216
|
|
178
|
-
|
179
|
-
|
180
|
-
|
217
|
+
if ($) {
|
218
|
+
var JQUERY_NO_CONFLICT = $.fn[name];
|
219
|
+
$.fn[name] = plugin.jQueryInterface;
|
220
|
+
$.fn[name].Constructor = plugin;
|
181
221
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
222
|
+
$.fn[name].noConflict = function () {
|
223
|
+
$.fn[name] = JQUERY_NO_CONFLICT;
|
224
|
+
return plugin.jQueryInterface;
|
225
|
+
};
|
186
226
|
}
|
187
|
-
}
|
188
|
-
|
189
|
-
return BaseComponent;
|
190
|
-
}();
|
191
|
-
|
192
|
-
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); }
|
193
|
-
|
194
|
-
function _defineProperties$1(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); } }
|
195
|
-
|
196
|
-
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
|
227
|
+
});
|
228
|
+
};
|
197
229
|
|
198
|
-
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
199
230
|
/**
|
200
231
|
* ------------------------------------------------------------------------
|
201
232
|
* Constants
|
@@ -371,7 +402,7 @@
|
|
371
402
|
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
372
403
|
var scrollSize = "scroll" + capitalizedDimension;
|
373
404
|
var transitionDuration = getTransitionDurationFromElement(this._element);
|
374
|
-
EventHandler__default['default'].one(this._element,
|
405
|
+
EventHandler__default['default'].one(this._element, 'transitionend', complete);
|
375
406
|
emulateTransitionEnd(this._element, transitionDuration);
|
376
407
|
this._element.style[dimension] = this._element[scrollSize] + "px";
|
377
408
|
};
|
@@ -426,7 +457,7 @@
|
|
426
457
|
|
427
458
|
this._element.style[dimension] = '';
|
428
459
|
var transitionDuration = getTransitionDurationFromElement(this._element);
|
429
|
-
EventHandler__default['default'].one(this._element,
|
460
|
+
EventHandler__default['default'].one(this._element, 'transitionend', complete);
|
430
461
|
emulateTransitionEnd(this._element, transitionDuration);
|
431
462
|
};
|
432
463
|
|
@@ -525,7 +556,7 @@
|
|
525
556
|
});
|
526
557
|
};
|
527
558
|
|
528
|
-
_createClass
|
559
|
+
_createClass(Collapse, null, [{
|
529
560
|
key: "Default",
|
530
561
|
get: function get() {
|
531
562
|
return Default;
|
@@ -538,7 +569,7 @@
|
|
538
569
|
}]);
|
539
570
|
|
540
571
|
return Collapse;
|
541
|
-
}(
|
572
|
+
}(BaseComponent__default['default']);
|
542
573
|
/**
|
543
574
|
* ------------------------------------------------------------------------
|
544
575
|
* Data Api implementation
|
@@ -548,7 +579,7 @@
|
|
548
579
|
|
549
580
|
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
550
581
|
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
551
|
-
if (event.target.tagName === 'A') {
|
582
|
+
if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
|
552
583
|
event.preventDefault();
|
553
584
|
}
|
554
585
|
|
@@ -581,21 +612,7 @@
|
|
581
612
|
* add .Collapse to jQuery only if jQuery is present
|
582
613
|
*/
|
583
614
|
|
584
|
-
|
585
|
-
var $ = getjQuery();
|
586
|
-
/* istanbul ignore if */
|
587
|
-
|
588
|
-
if ($) {
|
589
|
-
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
590
|
-
$.fn[NAME] = Collapse.jQueryInterface;
|
591
|
-
$.fn[NAME].Constructor = Collapse;
|
592
|
-
|
593
|
-
$.fn[NAME].noConflict = function () {
|
594
|
-
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
595
|
-
return Collapse.jQueryInterface;
|
596
|
-
};
|
597
|
-
}
|
598
|
-
});
|
615
|
+
defineJQueryPlugin(NAME, Collapse);
|
599
616
|
|
600
617
|
return Collapse;
|
601
618
|
|