bootstrap 4.6.2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/README.md +7 -4
  4. data/assets/javascripts/bootstrap/alert.js +192 -115
  5. data/assets/javascripts/bootstrap/base-component.js +63 -0
  6. data/assets/javascripts/bootstrap/button.js +96 -179
  7. data/assets/javascripts/bootstrap/carousel.js +472 -359
  8. data/assets/javascripts/bootstrap/collapse.js +379 -225
  9. data/assets/javascripts/bootstrap/dom/data.js +68 -0
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
  12. data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
  13. data/assets/javascripts/bootstrap/dropdown.js +472 -355
  14. data/assets/javascripts/bootstrap/modal.js +612 -438
  15. data/assets/javascripts/bootstrap/offcanvas.js +671 -0
  16. data/assets/javascripts/bootstrap/popover.js +138 -167
  17. data/assets/javascripts/bootstrap/scrollspy.js +250 -192
  18. data/assets/javascripts/bootstrap/tab.js +241 -144
  19. data/assets/javascripts/bootstrap/toast.js +223 -157
  20. data/assets/javascripts/bootstrap/tooltip.js +651 -487
  21. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  22. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  23. data/assets/javascripts/bootstrap-sprockets.js +8 -1
  24. data/assets/javascripts/bootstrap.js +3277 -2590
  25. data/assets/javascripts/bootstrap.min.js +3 -3
  26. data/assets/stylesheets/_bootstrap-grid.scss +53 -18
  27. data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
  28. data/assets/stylesheets/_bootstrap.scss +18 -10
  29. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  30. data/assets/stylesheets/bootstrap/_alert.scss +15 -10
  31. data/assets/stylesheets/bootstrap/_badge.scss +2 -27
  32. data/assets/stylesheets/bootstrap/_breadcrumb.scss +3 -17
  33. data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
  34. data/assets/stylesheets/bootstrap/_buttons.scss +29 -60
  35. data/assets/stylesheets/bootstrap/_card.scss +20 -91
  36. data/assets/stylesheets/bootstrap/_carousel.scss +64 -35
  37. data/assets/stylesheets/bootstrap/_close.scss +30 -30
  38. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  39. data/assets/stylesheets/bootstrap/_dropdown.scss +84 -36
  40. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  41. data/assets/stylesheets/bootstrap/_functions.scss +84 -69
  42. data/assets/stylesheets/bootstrap/_grid.scss +3 -54
  43. data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
  44. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  45. data/assets/stylesheets/bootstrap/_list-group.scss +28 -8
  46. data/assets/stylesheets/bootstrap/_mixins.scss +8 -13
  47. data/assets/stylesheets/bootstrap/_modal.scss +45 -57
  48. data/assets/stylesheets/bootstrap/_nav.scss +20 -6
  49. data/assets/stylesheets/bootstrap/_navbar.scss +45 -71
  50. data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
  51. data/assets/stylesheets/bootstrap/_pagination.scss +10 -20
  52. data/assets/stylesheets/bootstrap/_popover.scss +24 -36
  53. data/assets/stylesheets/bootstrap/_progress.scss +5 -4
  54. data/assets/stylesheets/bootstrap/_reboot.scss +316 -179
  55. data/assets/stylesheets/bootstrap/_root.scss +5 -8
  56. data/assets/stylesheets/bootstrap/_spinners.scss +11 -7
  57. data/assets/stylesheets/bootstrap/_tables.scss +79 -114
  58. data/assets/stylesheets/bootstrap/_toasts.scss +20 -15
  59. data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
  60. data/assets/stylesheets/bootstrap/_transitions.scss +2 -7
  61. data/assets/stylesheets/bootstrap/_type.scss +38 -59
  62. data/assets/stylesheets/bootstrap/_utilities.scss +594 -18
  63. data/assets/stylesheets/bootstrap/_variables.scss +800 -485
  64. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  65. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
  66. data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
  67. data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
  68. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  69. data/assets/stylesheets/bootstrap/forms/_form-select.scss +67 -0
  70. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  71. data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
  72. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  73. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  74. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  75. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  76. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  77. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  78. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  79. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  80. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
  81. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
  82. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  83. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
  84. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +71 -48
  85. data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
  86. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  87. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  88. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  89. data/assets/stylesheets/bootstrap/mixins/_forms.scss +39 -97
  90. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  91. data/assets/stylesheets/bootstrap/mixins/_grid.scss +90 -34
  92. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  93. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
  94. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  95. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
  96. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
  97. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  98. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  99. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
  100. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
  101. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  102. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
  103. data/bootstrap.gemspec +1 -3
  104. data/lib/bootstrap/version.rb +2 -2
  105. data/tasks/updater/js.rb +19 -16
  106. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  107. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  108. data/test/dummy_rails/app/views/pages/root.html +89 -0
  109. data/test/dummy_rails/config/application.rb +0 -3
  110. data/test/gemfiles/rails_6_1.gemfile +7 -0
  111. metadata +45 -73
  112. data/assets/javascripts/bootstrap/util.js +0 -189
  113. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  114. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  115. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  116. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  117. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  118. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  119. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  120. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  121. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  122. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  123. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  124. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  125. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
  126. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  127. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  128. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  129. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  130. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  131. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  132. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  133. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  134. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  135. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  136. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  137. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  138. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  139. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  140. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  141. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  142. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  143. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  144. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  145. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  146. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  147. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  148. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  149. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,106 +1,205 @@
1
1
  /*!
2
- * Bootstrap carousel.js v4.6.2 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap carousel.js v5.0.0 (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('jquery'), require('./util.js')) :
8
- typeof define === 'function' && define.amd ? define(['jquery', './util'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.jQuery, global.Util));
10
- })(this, (function ($, Util) { '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
 
14
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
- var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
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);
18
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
16
19
 
17
- function _defineProperties(target, props) {
18
- for (var i = 0; i < props.length; i++) {
19
- var descriptor = props[i];
20
- descriptor.enumerable = descriptor.enumerable || false;
21
- descriptor.configurable = true;
22
- if ("value" in descriptor) descriptor.writable = true;
23
- Object.defineProperty(target, descriptor.key, descriptor);
20
+ /**
21
+ * --------------------------------------------------------------------------
22
+ * Bootstrap (v5.0.0): util/index.js
23
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
24
+ * --------------------------------------------------------------------------
25
+ */
26
+ const MILLISECONDS_MULTIPLIER = 1000;
27
+ const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
28
+
29
+ const toType = obj => {
30
+ if (obj === null || obj === undefined) {
31
+ return `${obj}`;
24
32
  }
25
- }
26
33
 
27
- function _createClass(Constructor, protoProps, staticProps) {
28
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29
- if (staticProps) _defineProperties(Constructor, staticProps);
30
- Object.defineProperty(Constructor, "prototype", {
31
- writable: false
32
- });
33
- return Constructor;
34
- }
34
+ return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
35
+ };
35
36
 
36
- function _extends() {
37
- _extends = Object.assign ? Object.assign.bind() : function (target) {
38
- for (var i = 1; i < arguments.length; i++) {
39
- var source = arguments[i];
37
+ const getSelector = element => {
38
+ let selector = element.getAttribute('data-bs-target');
40
39
 
41
- for (var key in source) {
42
- if (Object.prototype.hasOwnProperty.call(source, key)) {
43
- target[key] = source[key];
44
- }
45
- }
40
+ if (!selector || selector === '#') {
41
+ let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
42
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
43
+ // `document.querySelector` will rightfully complain it is invalid.
44
+ // See https://github.com/twbs/bootstrap/issues/32273
45
+
46
+ if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
47
+ return null;
48
+ } // Just in case some CMS puts out a full URL with the anchor appended
49
+
50
+
51
+ if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
52
+ hrefAttr = `#${hrefAttr.split('#')[1]}`;
46
53
  }
47
54
 
48
- return target;
49
- };
50
- return _extends.apply(this, arguments);
51
- }
55
+ selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
56
+ }
57
+
58
+ return selector;
59
+ };
60
+
61
+ const getElementFromSelector = element => {
62
+ const selector = getSelector(element);
63
+ return selector ? document.querySelector(selector) : null;
64
+ };
65
+
66
+ const getTransitionDurationFromElement = element => {
67
+ if (!element) {
68
+ return 0;
69
+ } // Get transition-duration of the element
70
+
71
+
72
+ let {
73
+ transitionDuration,
74
+ transitionDelay
75
+ } = window.getComputedStyle(element);
76
+ const floatTransitionDuration = Number.parseFloat(transitionDuration);
77
+ const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
78
+
79
+ if (!floatTransitionDuration && !floatTransitionDelay) {
80
+ return 0;
81
+ } // If multiple durations are defined, take the first
82
+
83
+
84
+ transitionDuration = transitionDuration.split(',')[0];
85
+ transitionDelay = transitionDelay.split(',')[0];
86
+ return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
87
+ };
88
+
89
+ const triggerTransitionEnd = element => {
90
+ element.dispatchEvent(new Event(TRANSITION_END));
91
+ };
92
+
93
+ const isElement = obj => (obj[0] || obj).nodeType;
94
+
95
+ const emulateTransitionEnd = (element, duration) => {
96
+ let called = false;
97
+ const durationPadding = 5;
98
+ const emulatedDuration = duration + durationPadding;
99
+
100
+ function listener() {
101
+ called = true;
102
+ element.removeEventListener(TRANSITION_END, listener);
103
+ }
104
+
105
+ element.addEventListener(TRANSITION_END, listener);
106
+ setTimeout(() => {
107
+ if (!called) {
108
+ triggerTransitionEnd(element);
109
+ }
110
+ }, emulatedDuration);
111
+ };
112
+
113
+ const typeCheckConfig = (componentName, config, configTypes) => {
114
+ Object.keys(configTypes).forEach(property => {
115
+ const expectedTypes = configTypes[property];
116
+ const value = config[property];
117
+ const valueType = value && isElement(value) ? 'element' : toType(value);
118
+
119
+ if (!new RegExp(expectedTypes).test(valueType)) {
120
+ throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
121
+ }
122
+ });
123
+ };
52
124
 
125
+ const isVisible = element => {
126
+ if (!element) {
127
+ return false;
128
+ }
129
+
130
+ if (element.style && element.parentNode && element.parentNode.style) {
131
+ const elementStyle = getComputedStyle(element);
132
+ const parentNodeStyle = getComputedStyle(element.parentNode);
133
+ return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
134
+ }
135
+
136
+ return false;
137
+ };
138
+
139
+ const reflow = element => element.offsetHeight;
140
+
141
+ const getjQuery = () => {
142
+ const {
143
+ jQuery
144
+ } = window;
145
+
146
+ if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
147
+ return jQuery;
148
+ }
149
+
150
+ return null;
151
+ };
152
+
153
+ const onDOMContentLoaded = callback => {
154
+ if (document.readyState === 'loading') {
155
+ document.addEventListener('DOMContentLoaded', callback);
156
+ } else {
157
+ callback();
158
+ }
159
+ };
160
+
161
+ const isRTL = () => document.documentElement.dir === 'rtl';
162
+
163
+ const defineJQueryPlugin = (name, plugin) => {
164
+ onDOMContentLoaded(() => {
165
+ const $ = getjQuery();
166
+ /* istanbul ignore if */
167
+
168
+ if ($) {
169
+ const JQUERY_NO_CONFLICT = $.fn[name];
170
+ $.fn[name] = plugin.jQueryInterface;
171
+ $.fn[name].Constructor = plugin;
172
+
173
+ $.fn[name].noConflict = () => {
174
+ $.fn[name] = JQUERY_NO_CONFLICT;
175
+ return plugin.jQueryInterface;
176
+ };
177
+ }
178
+ });
179
+ };
180
+
181
+ /**
182
+ * --------------------------------------------------------------------------
183
+ * Bootstrap (v5.0.0): carousel.js
184
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
185
+ * --------------------------------------------------------------------------
186
+ */
53
187
  /**
188
+ * ------------------------------------------------------------------------
54
189
  * Constants
190
+ * ------------------------------------------------------------------------
55
191
  */
56
192
 
57
- var NAME = 'carousel';
58
- var VERSION = '4.6.2';
59
- var DATA_KEY = 'bs.carousel';
60
- var EVENT_KEY = "." + DATA_KEY;
61
- var DATA_API_KEY = '.data-api';
62
- var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
63
- var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
64
-
65
- var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
66
-
67
- var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
68
-
69
- var SWIPE_THRESHOLD = 40;
70
- var CLASS_NAME_CAROUSEL = 'carousel';
71
- var CLASS_NAME_ACTIVE = 'active';
72
- var CLASS_NAME_SLIDE = 'slide';
73
- var CLASS_NAME_RIGHT = 'carousel-item-right';
74
- var CLASS_NAME_LEFT = 'carousel-item-left';
75
- var CLASS_NAME_NEXT = 'carousel-item-next';
76
- var CLASS_NAME_PREV = 'carousel-item-prev';
77
- var CLASS_NAME_POINTER_EVENT = 'pointer-event';
78
- var DIRECTION_NEXT = 'next';
79
- var DIRECTION_PREV = 'prev';
80
- var DIRECTION_LEFT = 'left';
81
- var DIRECTION_RIGHT = 'right';
82
- var EVENT_SLIDE = "slide" + EVENT_KEY;
83
- var EVENT_SLID = "slid" + EVENT_KEY;
84
- var EVENT_KEYDOWN = "keydown" + EVENT_KEY;
85
- var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY;
86
- var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY;
87
- var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY;
88
- var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY;
89
- var EVENT_TOUCHEND = "touchend" + EVENT_KEY;
90
- var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY;
91
- var EVENT_POINTERUP = "pointerup" + EVENT_KEY;
92
- var EVENT_DRAG_START = "dragstart" + EVENT_KEY;
93
- var EVENT_LOAD_DATA_API = "load" + EVENT_KEY + DATA_API_KEY;
94
- var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
95
- var SELECTOR_ACTIVE = '.active';
96
- var SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
97
- var SELECTOR_ITEM = '.carousel-item';
98
- var SELECTOR_ITEM_IMG = '.carousel-item img';
99
- var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
100
- var SELECTOR_INDICATORS = '.carousel-indicators';
101
- var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]';
102
- var SELECTOR_DATA_RIDE = '[data-ride="carousel"]';
103
- var Default = {
193
+ const NAME = 'carousel';
194
+ const DATA_KEY = 'bs.carousel';
195
+ const EVENT_KEY = `.${DATA_KEY}`;
196
+ const DATA_API_KEY = '.data-api';
197
+ const ARROW_LEFT_KEY = 'ArrowLeft';
198
+ const ARROW_RIGHT_KEY = 'ArrowRight';
199
+ const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
200
+
201
+ const SWIPE_THRESHOLD = 40;
202
+ const Default = {
104
203
  interval: 5000,
105
204
  keyboard: true,
106
205
  slide: false,
@@ -108,7 +207,7 @@
108
207
  wrap: true,
109
208
  touch: true
110
209
  };
111
- var DefaultType = {
210
+ const DefaultType = {
112
211
  interval: '(number|boolean)',
113
212
  keyboard: 'boolean',
114
213
  slide: '(boolean|string)',
@@ -116,16 +215,51 @@
116
215
  wrap: 'boolean',
117
216
  touch: 'boolean'
118
217
  };
119
- var PointerType = {
120
- TOUCH: 'touch',
121
- PEN: 'pen'
122
- };
218
+ const ORDER_NEXT = 'next';
219
+ const ORDER_PREV = 'prev';
220
+ const DIRECTION_LEFT = 'left';
221
+ const DIRECTION_RIGHT = 'right';
222
+ const EVENT_SLIDE = `slide${EVENT_KEY}`;
223
+ const EVENT_SLID = `slid${EVENT_KEY}`;
224
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY}`;
225
+ const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`;
226
+ const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`;
227
+ const EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`;
228
+ const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`;
229
+ const EVENT_TOUCHEND = `touchend${EVENT_KEY}`;
230
+ const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`;
231
+ const EVENT_POINTERUP = `pointerup${EVENT_KEY}`;
232
+ const EVENT_DRAG_START = `dragstart${EVENT_KEY}`;
233
+ const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
234
+ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
235
+ const CLASS_NAME_CAROUSEL = 'carousel';
236
+ const CLASS_NAME_ACTIVE = 'active';
237
+ const CLASS_NAME_SLIDE = 'slide';
238
+ const CLASS_NAME_END = 'carousel-item-end';
239
+ const CLASS_NAME_START = 'carousel-item-start';
240
+ const CLASS_NAME_NEXT = 'carousel-item-next';
241
+ const CLASS_NAME_PREV = 'carousel-item-prev';
242
+ const CLASS_NAME_POINTER_EVENT = 'pointer-event';
243
+ const SELECTOR_ACTIVE = '.active';
244
+ const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
245
+ const SELECTOR_ITEM = '.carousel-item';
246
+ const SELECTOR_ITEM_IMG = '.carousel-item img';
247
+ const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
248
+ const SELECTOR_INDICATORS = '.carousel-indicators';
249
+ const SELECTOR_INDICATOR = '[data-bs-target]';
250
+ const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
251
+ const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
252
+ const POINTER_TYPE_TOUCH = 'touch';
253
+ const POINTER_TYPE_PEN = 'pen';
123
254
  /**
124
- * Class definition
255
+ * ------------------------------------------------------------------------
256
+ * Class Definition
257
+ * ------------------------------------------------------------------------
125
258
  */
126
259
 
127
- var Carousel = /*#__PURE__*/function () {
128
- function Carousel(element, config) {
260
+ class Carousel extends BaseComponent__default['default'] {
261
+ constructor(element, config) {
262
+ super(element);
129
263
  this._items = null;
130
264
  this._interval = null;
131
265
  this._activeElement = null;
@@ -135,54 +269,58 @@
135
269
  this.touchStartX = 0;
136
270
  this.touchDeltaX = 0;
137
271
  this._config = this._getConfig(config);
138
- this._element = element;
139
- this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
272
+ this._indicatorsElement = SelectorEngine__default['default'].findOne(SELECTOR_INDICATORS, this._element);
140
273
  this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
141
- this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
274
+ this._pointerEvent = Boolean(window.PointerEvent);
142
275
 
143
276
  this._addEventListeners();
144
277
  } // Getters
145
278
 
146
279
 
147
- var _proto = Carousel.prototype;
280
+ static get Default() {
281
+ return Default;
282
+ }
283
+
284
+ static get DATA_KEY() {
285
+ return DATA_KEY;
286
+ } // Public
287
+
148
288
 
149
- // Public
150
- _proto.next = function next() {
289
+ next() {
151
290
  if (!this._isSliding) {
152
- this._slide(DIRECTION_NEXT);
291
+ this._slide(ORDER_NEXT);
153
292
  }
154
- };
293
+ }
155
294
 
156
- _proto.nextWhenVisible = function nextWhenVisible() {
157
- var $element = $__default["default"](this._element); // Don't call next when the page isn't visible
295
+ nextWhenVisible() {
296
+ // Don't call next when the page isn't visible
158
297
  // or the carousel or its parent isn't visible
159
-
160
- if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') {
298
+ if (!document.hidden && isVisible(this._element)) {
161
299
  this.next();
162
300
  }
163
- };
301
+ }
164
302
 
165
- _proto.prev = function prev() {
303
+ prev() {
166
304
  if (!this._isSliding) {
167
- this._slide(DIRECTION_PREV);
305
+ this._slide(ORDER_PREV);
168
306
  }
169
- };
307
+ }
170
308
 
171
- _proto.pause = function pause(event) {
309
+ pause(event) {
172
310
  if (!event) {
173
311
  this._isPaused = true;
174
312
  }
175
313
 
176
- if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
177
- Util__default["default"].triggerTransitionEnd(this._element);
314
+ if (SelectorEngine__default['default'].findOne(SELECTOR_NEXT_PREV, this._element)) {
315
+ triggerTransitionEnd(this._element);
178
316
  this.cycle(true);
179
317
  }
180
318
 
181
319
  clearInterval(this._interval);
182
320
  this._interval = null;
183
- };
321
+ }
184
322
 
185
- _proto.cycle = function cycle(event) {
323
+ cycle(event) {
186
324
  if (!event) {
187
325
  this._isPaused = false;
188
326
  }
@@ -192,28 +330,24 @@
192
330
  this._interval = null;
193
331
  }
194
332
 
195
- if (this._config.interval && !this._isPaused) {
333
+ if (this._config && this._config.interval && !this._isPaused) {
196
334
  this._updateInterval();
197
335
 
198
336
  this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
199
337
  }
200
- };
201
-
202
- _proto.to = function to(index) {
203
- var _this = this;
338
+ }
204
339
 
205
- this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
340
+ to(index) {
341
+ this._activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
206
342
 
207
- var activeIndex = this._getItemIndex(this._activeElement);
343
+ const activeIndex = this._getItemIndex(this._activeElement);
208
344
 
209
345
  if (index > this._items.length - 1 || index < 0) {
210
346
  return;
211
347
  }
212
348
 
213
349
  if (this._isSliding) {
214
- $__default["default"](this._element).one(EVENT_SLID, function () {
215
- return _this.to(index);
216
- });
350
+ EventHandler__default['default'].one(this._element, EVENT_SLID, () => this.to(index));
217
351
  return;
218
352
  }
219
353
 
@@ -223,101 +357,85 @@
223
357
  return;
224
358
  }
225
359
 
226
- var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
360
+ const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
227
361
 
228
- this._slide(direction, this._items[index]);
229
- };
362
+ this._slide(order, this._items[index]);
363
+ }
230
364
 
231
- _proto.dispose = function dispose() {
232
- $__default["default"](this._element).off(EVENT_KEY);
233
- $__default["default"].removeData(this._element, DATA_KEY);
365
+ dispose() {
234
366
  this._items = null;
235
367
  this._config = null;
236
- this._element = null;
237
368
  this._interval = null;
238
369
  this._isPaused = null;
239
370
  this._isSliding = null;
240
371
  this._activeElement = null;
241
372
  this._indicatorsElement = null;
373
+ super.dispose();
242
374
  } // Private
243
- ;
244
375
 
245
- _proto._getConfig = function _getConfig(config) {
246
- config = _extends({}, Default, config);
247
- Util__default["default"].typeCheckConfig(NAME, config, DefaultType);
376
+
377
+ _getConfig(config) {
378
+ config = { ...Default,
379
+ ...config
380
+ };
381
+ typeCheckConfig(NAME, config, DefaultType);
248
382
  return config;
249
- };
383
+ }
250
384
 
251
- _proto._handleSwipe = function _handleSwipe() {
252
- var absDeltax = Math.abs(this.touchDeltaX);
385
+ _handleSwipe() {
386
+ const absDeltax = Math.abs(this.touchDeltaX);
253
387
 
254
388
  if (absDeltax <= SWIPE_THRESHOLD) {
255
389
  return;
256
390
  }
257
391
 
258
- var direction = absDeltax / this.touchDeltaX;
259
- this.touchDeltaX = 0; // swipe left
260
-
261
- if (direction > 0) {
262
- this.prev();
263
- } // swipe right
264
-
392
+ const direction = absDeltax / this.touchDeltaX;
393
+ this.touchDeltaX = 0;
265
394
 
266
- if (direction < 0) {
267
- this.next();
395
+ if (!direction) {
396
+ return;
268
397
  }
269
- };
270
398
 
271
- _proto._addEventListeners = function _addEventListeners() {
272
- var _this2 = this;
399
+ this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
400
+ }
273
401
 
402
+ _addEventListeners() {
274
403
  if (this._config.keyboard) {
275
- $__default["default"](this._element).on(EVENT_KEYDOWN, function (event) {
276
- return _this2._keydown(event);
277
- });
404
+ EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
278
405
  }
279
406
 
280
407
  if (this._config.pause === 'hover') {
281
- $__default["default"](this._element).on(EVENT_MOUSEENTER, function (event) {
282
- return _this2.pause(event);
283
- }).on(EVENT_MOUSELEAVE, function (event) {
284
- return _this2.cycle(event);
285
- });
408
+ EventHandler__default['default'].on(this._element, EVENT_MOUSEENTER, event => this.pause(event));
409
+ EventHandler__default['default'].on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event));
286
410
  }
287
411
 
288
- if (this._config.touch) {
412
+ if (this._config.touch && this._touchSupported) {
289
413
  this._addTouchEventListeners();
290
414
  }
291
- };
292
-
293
- _proto._addTouchEventListeners = function _addTouchEventListeners() {
294
- var _this3 = this;
295
-
296
- if (!this._touchSupported) {
297
- return;
298
- }
415
+ }
299
416
 
300
- var start = function start(event) {
301
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
302
- _this3.touchStartX = event.originalEvent.clientX;
303
- } else if (!_this3._pointerEvent) {
304
- _this3.touchStartX = event.originalEvent.touches[0].clientX;
417
+ _addTouchEventListeners() {
418
+ const start = event => {
419
+ if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
420
+ this.touchStartX = event.clientX;
421
+ } else if (!this._pointerEvent) {
422
+ this.touchStartX = event.touches[0].clientX;
305
423
  }
306
424
  };
307
425
 
308
- var move = function move(event) {
426
+ const move = event => {
309
427
  // ensure swiping with one touch and not pinching
310
- _this3.touchDeltaX = event.originalEvent.touches && event.originalEvent.touches.length > 1 ? 0 : event.originalEvent.touches[0].clientX - _this3.touchStartX;
428
+ this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
311
429
  };
312
430
 
313
- var end = function end(event) {
314
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
315
- _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
431
+ const end = event => {
432
+ if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
433
+ this.touchDeltaX = event.clientX - this.touchStartX;
316
434
  }
317
435
 
318
- _this3._handleSwipe();
436
+ this._handleSwipe();
319
437
 
320
- if (_this3._config.pause === 'hover') {
438
+ if (this._config.pause === 'hover') {
321
439
  // If it's a touch-enabled device, mouseenter/leave are fired as
322
440
  // part of the mouse compatibility events on first tap - the carousel
323
441
  // would stop cycling until user tapped out of it;
@@ -325,121 +443,109 @@
325
443
  // (as if it's the second time we tap on it, mouseenter compat event
326
444
  // is NOT fired) and after a timeout (to allow for mouse compatibility
327
445
  // events to fire) we explicitly restart cycling
328
- _this3.pause();
446
+ this.pause();
329
447
 
330
- if (_this3.touchTimeout) {
331
- clearTimeout(_this3.touchTimeout);
448
+ if (this.touchTimeout) {
449
+ clearTimeout(this.touchTimeout);
332
450
  }
333
451
 
334
- _this3.touchTimeout = setTimeout(function (event) {
335
- return _this3.cycle(event);
336
- }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
452
+ this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
337
453
  }
338
454
  };
339
455
 
340
- $__default["default"](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
341
- return e.preventDefault();
456
+ SelectorEngine__default['default'].find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
457
+ EventHandler__default['default'].on(itemImg, EVENT_DRAG_START, e => e.preventDefault());
342
458
  });
343
459
 
344
460
  if (this._pointerEvent) {
345
- $__default["default"](this._element).on(EVENT_POINTERDOWN, function (event) {
346
- return start(event);
347
- });
348
- $__default["default"](this._element).on(EVENT_POINTERUP, function (event) {
349
- return end(event);
350
- });
461
+ EventHandler__default['default'].on(this._element, EVENT_POINTERDOWN, event => start(event));
462
+ EventHandler__default['default'].on(this._element, EVENT_POINTERUP, event => end(event));
351
463
 
352
464
  this._element.classList.add(CLASS_NAME_POINTER_EVENT);
353
465
  } else {
354
- $__default["default"](this._element).on(EVENT_TOUCHSTART, function (event) {
355
- return start(event);
356
- });
357
- $__default["default"](this._element).on(EVENT_TOUCHMOVE, function (event) {
358
- return move(event);
359
- });
360
- $__default["default"](this._element).on(EVENT_TOUCHEND, function (event) {
361
- return end(event);
362
- });
466
+ EventHandler__default['default'].on(this._element, EVENT_TOUCHSTART, event => start(event));
467
+ EventHandler__default['default'].on(this._element, EVENT_TOUCHMOVE, event => move(event));
468
+ EventHandler__default['default'].on(this._element, EVENT_TOUCHEND, event => end(event));
363
469
  }
364
- };
470
+ }
365
471
 
366
- _proto._keydown = function _keydown(event) {
472
+ _keydown(event) {
367
473
  if (/input|textarea/i.test(event.target.tagName)) {
368
474
  return;
369
475
  }
370
476
 
371
- switch (event.which) {
372
- case ARROW_LEFT_KEYCODE:
373
- event.preventDefault();
374
- this.prev();
375
- break;
477
+ if (event.key === ARROW_LEFT_KEY) {
478
+ event.preventDefault();
376
479
 
377
- case ARROW_RIGHT_KEYCODE:
378
- event.preventDefault();
379
- this.next();
380
- break;
480
+ this._slide(DIRECTION_RIGHT);
481
+ } else if (event.key === ARROW_RIGHT_KEY) {
482
+ event.preventDefault();
483
+
484
+ this._slide(DIRECTION_LEFT);
381
485
  }
382
- };
486
+ }
383
487
 
384
- _proto._getItemIndex = function _getItemIndex(element) {
385
- this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
488
+ _getItemIndex(element) {
489
+ this._items = element && element.parentNode ? SelectorEngine__default['default'].find(SELECTOR_ITEM, element.parentNode) : [];
386
490
  return this._items.indexOf(element);
387
- };
491
+ }
388
492
 
389
- _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
390
- var isNextDirection = direction === DIRECTION_NEXT;
391
- var isPrevDirection = direction === DIRECTION_PREV;
493
+ _getItemByOrder(order, activeElement) {
494
+ const isNext = order === ORDER_NEXT;
495
+ const isPrev = order === ORDER_PREV;
392
496
 
393
- var activeIndex = this._getItemIndex(activeElement);
497
+ const activeIndex = this._getItemIndex(activeElement);
394
498
 
395
- var lastItemIndex = this._items.length - 1;
396
- var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
499
+ const lastItemIndex = this._items.length - 1;
500
+ const isGoingToWrap = isPrev && activeIndex === 0 || isNext && activeIndex === lastItemIndex;
397
501
 
398
502
  if (isGoingToWrap && !this._config.wrap) {
399
503
  return activeElement;
400
504
  }
401
505
 
402
- var delta = direction === DIRECTION_PREV ? -1 : 1;
403
- var itemIndex = (activeIndex + delta) % this._items.length;
506
+ const delta = isPrev ? -1 : 1;
507
+ const itemIndex = (activeIndex + delta) % this._items.length;
404
508
  return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
405
- };
509
+ }
406
510
 
407
- _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
408
- var targetIndex = this._getItemIndex(relatedTarget);
511
+ _triggerSlideEvent(relatedTarget, eventDirectionName) {
512
+ const targetIndex = this._getItemIndex(relatedTarget);
409
513
 
410
- var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
514
+ const fromIndex = this._getItemIndex(SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element));
411
515
 
412
- var slideEvent = $__default["default"].Event(EVENT_SLIDE, {
413
- relatedTarget: relatedTarget,
516
+ return EventHandler__default['default'].trigger(this._element, EVENT_SLIDE, {
517
+ relatedTarget,
414
518
  direction: eventDirectionName,
415
519
  from: fromIndex,
416
520
  to: targetIndex
417
521
  });
418
- $__default["default"](this._element).trigger(slideEvent);
419
- return slideEvent;
420
- };
522
+ }
421
523
 
422
- _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
524
+ _setActiveIndicatorElement(element) {
423
525
  if (this._indicatorsElement) {
424
- var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE));
425
- $__default["default"](indicators).removeClass(CLASS_NAME_ACTIVE);
426
-
427
- var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
428
-
429
- if (nextIndicator) {
430
- $__default["default"](nextIndicator).addClass(CLASS_NAME_ACTIVE);
526
+ const activeIndicator = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE, this._indicatorsElement);
527
+ activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
528
+ activeIndicator.removeAttribute('aria-current');
529
+ const indicators = SelectorEngine__default['default'].find(SELECTOR_INDICATOR, this._indicatorsElement);
530
+
531
+ for (let i = 0; i < indicators.length; i++) {
532
+ if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
533
+ indicators[i].classList.add(CLASS_NAME_ACTIVE);
534
+ indicators[i].setAttribute('aria-current', 'true');
535
+ break;
536
+ }
431
537
  }
432
538
  }
433
- };
539
+ }
434
540
 
435
- _proto._updateInterval = function _updateInterval() {
436
- var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM);
541
+ _updateInterval() {
542
+ const element = this._activeElement || SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
437
543
 
438
544
  if (!element) {
439
545
  return;
440
546
  }
441
547
 
442
- var elementInterval = parseInt(element.getAttribute('data-interval'), 10);
548
+ const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
443
549
 
444
550
  if (elementInterval) {
445
551
  this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
@@ -447,42 +553,34 @@
447
553
  } else {
448
554
  this._config.interval = this._config.defaultInterval || this._config.interval;
449
555
  }
450
- };
556
+ }
451
557
 
452
- _proto._slide = function _slide(direction, element) {
453
- var _this4 = this;
558
+ _slide(directionOrOrder, element) {
559
+ const order = this._directionToOrder(directionOrOrder);
454
560
 
455
- var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
561
+ const activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
456
562
 
457
- var activeElementIndex = this._getItemIndex(activeElement);
563
+ const activeElementIndex = this._getItemIndex(activeElement);
458
564
 
459
- var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
565
+ const nextElement = element || this._getItemByOrder(order, activeElement);
460
566
 
461
- var nextElementIndex = this._getItemIndex(nextElement);
567
+ const nextElementIndex = this._getItemIndex(nextElement);
462
568
 
463
- var isCycling = Boolean(this._interval);
464
- var directionalClassName;
465
- var orderClassName;
466
- var eventDirectionName;
569
+ const isCycling = Boolean(this._interval);
570
+ const isNext = order === ORDER_NEXT;
571
+ const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
572
+ const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
467
573
 
468
- if (direction === DIRECTION_NEXT) {
469
- directionalClassName = CLASS_NAME_LEFT;
470
- orderClassName = CLASS_NAME_NEXT;
471
- eventDirectionName = DIRECTION_LEFT;
472
- } else {
473
- directionalClassName = CLASS_NAME_RIGHT;
474
- orderClassName = CLASS_NAME_PREV;
475
- eventDirectionName = DIRECTION_RIGHT;
476
- }
574
+ const eventDirectionName = this._orderToDirection(order);
477
575
 
478
- if (nextElement && $__default["default"](nextElement).hasClass(CLASS_NAME_ACTIVE)) {
576
+ if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
479
577
  this._isSliding = false;
480
578
  return;
481
579
  }
482
580
 
483
- var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
581
+ const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
484
582
 
485
- if (slideEvent.isDefaultPrevented()) {
583
+ if (slideEvent.defaultPrevented) {
486
584
  return;
487
585
  }
488
586
 
@@ -500,143 +598,158 @@
500
598
  this._setActiveIndicatorElement(nextElement);
501
599
 
502
600
  this._activeElement = nextElement;
503
- var slidEvent = $__default["default"].Event(EVENT_SLID, {
504
- relatedTarget: nextElement,
505
- direction: eventDirectionName,
506
- from: activeElementIndex,
507
- to: nextElementIndex
508
- });
509
601
 
510
- if ($__default["default"](this._element).hasClass(CLASS_NAME_SLIDE)) {
511
- $__default["default"](nextElement).addClass(orderClassName);
512
- Util__default["default"].reflow(nextElement);
513
- $__default["default"](activeElement).addClass(directionalClassName);
514
- $__default["default"](nextElement).addClass(directionalClassName);
515
- var transitionDuration = Util__default["default"].getTransitionDurationFromElement(activeElement);
516
- $__default["default"](activeElement).one(Util__default["default"].TRANSITION_END, function () {
517
- $__default["default"](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE);
518
- $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE + " " + orderClassName + " " + directionalClassName);
519
- _this4._isSliding = false;
520
- setTimeout(function () {
521
- return $__default["default"](_this4._element).trigger(slidEvent);
602
+ if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
603
+ nextElement.classList.add(orderClassName);
604
+ reflow(nextElement);
605
+ activeElement.classList.add(directionalClassName);
606
+ nextElement.classList.add(directionalClassName);
607
+ const transitionDuration = getTransitionDurationFromElement(activeElement);
608
+ EventHandler__default['default'].one(activeElement, 'transitionend', () => {
609
+ nextElement.classList.remove(directionalClassName, orderClassName);
610
+ nextElement.classList.add(CLASS_NAME_ACTIVE);
611
+ activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
612
+ this._isSliding = false;
613
+ setTimeout(() => {
614
+ EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
615
+ relatedTarget: nextElement,
616
+ direction: eventDirectionName,
617
+ from: activeElementIndex,
618
+ to: nextElementIndex
619
+ });
522
620
  }, 0);
523
- }).emulateTransitionEnd(transitionDuration);
621
+ });
622
+ emulateTransitionEnd(activeElement, transitionDuration);
524
623
  } else {
525
- $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE);
526
- $__default["default"](nextElement).addClass(CLASS_NAME_ACTIVE);
624
+ activeElement.classList.remove(CLASS_NAME_ACTIVE);
625
+ nextElement.classList.add(CLASS_NAME_ACTIVE);
527
626
  this._isSliding = false;
528
- $__default["default"](this._element).trigger(slidEvent);
627
+ EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
628
+ relatedTarget: nextElement,
629
+ direction: eventDirectionName,
630
+ from: activeElementIndex,
631
+ to: nextElementIndex
632
+ });
529
633
  }
530
634
 
531
635
  if (isCycling) {
532
636
  this.cycle();
533
637
  }
534
- } // Static
535
- ;
638
+ }
536
639
 
537
- Carousel._jQueryInterface = function _jQueryInterface(config) {
538
- return this.each(function () {
539
- var data = $__default["default"](this).data(DATA_KEY);
640
+ _directionToOrder(direction) {
641
+ if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
642
+ return direction;
643
+ }
540
644
 
541
- var _config = _extends({}, Default, $__default["default"](this).data());
645
+ if (isRTL()) {
646
+ return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
647
+ }
542
648
 
543
- if (typeof config === 'object') {
544
- _config = _extends({}, _config, config);
545
- }
649
+ return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
650
+ }
546
651
 
547
- var action = typeof config === 'string' ? config : _config.slide;
652
+ _orderToDirection(order) {
653
+ if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
654
+ return order;
655
+ }
548
656
 
549
- if (!data) {
550
- data = new Carousel(this, _config);
551
- $__default["default"](this).data(DATA_KEY, data);
552
- }
657
+ if (isRTL()) {
658
+ return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
659
+ }
553
660
 
554
- if (typeof config === 'number') {
555
- data.to(config);
556
- } else if (typeof action === 'string') {
557
- if (typeof data[action] === 'undefined') {
558
- throw new TypeError("No method named \"" + action + "\"");
559
- }
661
+ return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
662
+ } // Static
560
663
 
561
- data[action]();
562
- } else if (_config.interval && _config.ride) {
563
- data.pause();
564
- data.cycle();
565
- }
566
- });
567
- };
568
664
 
569
- Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
570
- var selector = Util__default["default"].getSelectorFromElement(this);
665
+ static carouselInterface(element, config) {
666
+ let data = Data__default['default'].get(element, DATA_KEY);
667
+ let _config = { ...Default,
668
+ ...Manipulator__default['default'].getDataAttributes(element)
669
+ };
571
670
 
572
- if (!selector) {
573
- return;
671
+ if (typeof config === 'object') {
672
+ _config = { ..._config,
673
+ ...config
674
+ };
574
675
  }
575
676
 
576
- var target = $__default["default"](selector)[0];
677
+ const action = typeof config === 'string' ? config : _config.slide;
577
678
 
578
- if (!target || !$__default["default"](target).hasClass(CLASS_NAME_CAROUSEL)) {
579
- return;
679
+ if (!data) {
680
+ data = new Carousel(element, _config);
681
+ }
682
+
683
+ if (typeof config === 'number') {
684
+ data.to(config);
685
+ } else if (typeof action === 'string') {
686
+ if (typeof data[action] === 'undefined') {
687
+ throw new TypeError(`No method named "${action}"`);
688
+ }
689
+
690
+ data[action]();
691
+ } else if (_config.interval && _config.ride) {
692
+ data.pause();
693
+ data.cycle();
580
694
  }
695
+ }
696
+
697
+ static jQueryInterface(config) {
698
+ return this.each(function () {
699
+ Carousel.carouselInterface(this, config);
700
+ });
701
+ }
581
702
 
582
- var config = _extends({}, $__default["default"](target).data(), $__default["default"](this).data());
703
+ static dataApiClickHandler(event) {
704
+ const target = getElementFromSelector(this);
583
705
 
584
- var slideIndex = this.getAttribute('data-slide-to');
706
+ if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
707
+ return;
708
+ }
709
+
710
+ const config = { ...Manipulator__default['default'].getDataAttributes(target),
711
+ ...Manipulator__default['default'].getDataAttributes(this)
712
+ };
713
+ const slideIndex = this.getAttribute('data-bs-slide-to');
585
714
 
586
715
  if (slideIndex) {
587
716
  config.interval = false;
588
717
  }
589
718
 
590
- Carousel._jQueryInterface.call($__default["default"](target), config);
719
+ Carousel.carouselInterface(target, config);
591
720
 
592
721
  if (slideIndex) {
593
- $__default["default"](target).data(DATA_KEY).to(slideIndex);
722
+ Data__default['default'].get(target, DATA_KEY).to(slideIndex);
594
723
  }
595
724
 
596
725
  event.preventDefault();
597
- };
598
-
599
- _createClass(Carousel, null, [{
600
- key: "VERSION",
601
- get: function get() {
602
- return VERSION;
603
- }
604
- }, {
605
- key: "Default",
606
- get: function get() {
607
- return Default;
608
- }
609
- }]);
726
+ }
610
727
 
611
- return Carousel;
612
- }();
728
+ }
613
729
  /**
614
- * Data API implementation
730
+ * ------------------------------------------------------------------------
731
+ * Data Api implementation
732
+ * ------------------------------------------------------------------------
615
733
  */
616
734
 
617
735
 
618
- $__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler);
619
- $__default["default"](window).on(EVENT_LOAD_DATA_API, function () {
620
- var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE));
621
-
622
- for (var i = 0, len = carousels.length; i < len; i++) {
623
- var $carousel = $__default["default"](carousels[i]);
736
+ EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
737
+ EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
738
+ const carousels = SelectorEngine__default['default'].find(SELECTOR_DATA_RIDE);
624
739
 
625
- Carousel._jQueryInterface.call($carousel, $carousel.data());
740
+ for (let i = 0, len = carousels.length; i < len; i++) {
741
+ Carousel.carouselInterface(carousels[i], Data__default['default'].get(carousels[i], DATA_KEY));
626
742
  }
627
743
  });
628
744
  /**
745
+ * ------------------------------------------------------------------------
629
746
  * jQuery
747
+ * ------------------------------------------------------------------------
748
+ * add .Carousel to jQuery only if jQuery is present
630
749
  */
631
750
 
632
- $__default["default"].fn[NAME] = Carousel._jQueryInterface;
633
- $__default["default"].fn[NAME].Constructor = Carousel;
634
-
635
- $__default["default"].fn[NAME].noConflict = function () {
636
- $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
637
- return Carousel._jQueryInterface;
638
- };
751
+ defineJQueryPlugin(NAME, Carousel);
639
752
 
640
753
  return Carousel;
641
754
 
642
- }));
755
+ })));