bootstrap 4.6.2 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +55 -0
  3. data/README.md +28 -5
  4. data/assets/javascripts/bootstrap/alert.js +50 -147
  5. data/assets/javascripts/bootstrap/base-component.js +83 -0
  6. data/assets/javascripts/bootstrap/button.js +40 -190
  7. data/assets/javascripts/bootstrap/carousel.js +282 -537
  8. data/assets/javascripts/bootstrap/collapse.js +166 -314
  9. data/assets/javascripts/bootstrap/dom/data.js +62 -0
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
  12. data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
  13. data/assets/javascripts/bootstrap/dropdown.js +297 -455
  14. data/assets/javascripts/bootstrap/modal.js +223 -566
  15. data/assets/javascripts/bootstrap/offcanvas.js +245 -0
  16. data/assets/javascripts/bootstrap/popover.js +59 -208
  17. data/assets/javascripts/bootstrap/scrollspy.js +213 -276
  18. data/assets/javascripts/bootstrap/tab.js +222 -200
  19. data/assets/javascripts/bootstrap/toast.js +137 -206
  20. data/assets/javascripts/bootstrap/tooltip.js +403 -746
  21. data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
  22. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  23. data/assets/javascripts/bootstrap/util/config.js +67 -0
  24. data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
  25. data/assets/javascripts/bootstrap/util/index.js +281 -0
  26. data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
  27. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  28. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  29. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  30. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  31. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  32. data/assets/javascripts/bootstrap-sprockets.js +21 -5
  33. data/assets/javascripts/bootstrap.js +3623 -3485
  34. data/assets/javascripts/bootstrap.min.js +3 -3
  35. data/assets/stylesheets/_bootstrap-grid.scss +53 -21
  36. data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
  37. data/assets/stylesheets/_bootstrap.scss +21 -13
  38. data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
  39. data/assets/stylesheets/bootstrap/_alert.scss +32 -16
  40. data/assets/stylesheets/bootstrap/_badge.scss +15 -31
  41. data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
  42. data/assets/stylesheets/bootstrap/_button-group.scss +27 -48
  43. data/assets/stylesheets/bootstrap/_buttons.scss +136 -71
  44. data/assets/stylesheets/bootstrap/_card.scss +66 -113
  45. data/assets/stylesheets/bootstrap/_carousel.scss +78 -34
  46. data/assets/stylesheets/bootstrap/_close.scss +51 -28
  47. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  48. data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
  49. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  50. data/assets/stylesheets/bootstrap/_functions.scss +135 -23
  51. data/assets/stylesheets/bootstrap/_grid.scss +18 -52
  52. data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
  53. data/assets/stylesheets/bootstrap/_list-group.scss +77 -34
  54. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  55. data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
  56. data/assets/stylesheets/bootstrap/_modal.scss +107 -110
  57. data/assets/stylesheets/bootstrap/_nav.scss +99 -27
  58. data/assets/stylesheets/bootstrap/_navbar.scss +129 -172
  59. data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
  60. data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
  61. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  62. data/assets/stylesheets/bootstrap/_popover.scss +99 -73
  63. data/assets/stylesheets/bootstrap/_progress.scss +35 -14
  64. data/assets/stylesheets/bootstrap/_reboot.scss +318 -192
  65. data/assets/stylesheets/bootstrap/_root.scss +174 -9
  66. data/assets/stylesheets/bootstrap/_spinners.scss +43 -23
  67. data/assets/stylesheets/bootstrap/_tables.scss +101 -115
  68. data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
  69. data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
  70. data/assets/stylesheets/bootstrap/_transitions.scss +3 -2
  71. data/assets/stylesheets/bootstrap/_type.scss +40 -59
  72. data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
  73. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  74. data/assets/stylesheets/bootstrap/_variables.scss +1202 -606
  75. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +19 -0
  76. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
  77. data/assets/stylesheets/bootstrap/forms/_form-check.scss +188 -0
  78. data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
  79. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  80. data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
  81. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  82. data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
  83. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  84. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  85. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  86. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
  87. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  88. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  89. data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
  90. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  91. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  92. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  93. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  94. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  95. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  96. data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
  97. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  98. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  99. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
  100. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  101. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
  102. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
  103. data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
  104. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  105. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  106. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  107. data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
  108. data/assets/stylesheets/bootstrap/mixins/_forms.scss +54 -96
  109. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  110. data/assets/stylesheets/bootstrap/mixins/_grid.scss +118 -36
  111. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  112. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
  113. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  114. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
  115. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
  116. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
  117. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  118. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
  119. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
  120. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  121. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +211 -91
  122. data/bootstrap.gemspec +3 -5
  123. data/lib/bootstrap/version.rb +2 -2
  124. data/tasks/updater/js.rb +17 -5
  125. data/tasks/updater/network.rb +2 -2
  126. data/tasks/updater/scss.rb +1 -1
  127. data/tasks/updater.rb +2 -2
  128. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  129. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  130. data/test/dummy_rails/app/views/pages/root.html +89 -0
  131. data/test/dummy_rails/config/application.rb +0 -3
  132. data/test/gemfiles/rails_5_2.gemfile +8 -0
  133. data/test/gemfiles/rails_6_1.gemfile +7 -0
  134. data/test/gemfiles/rails_7_0.gemfile +7 -0
  135. data/test/test_helper.rb +3 -2
  136. metadata +78 -82
  137. data/.travis.yml +0 -31
  138. data/assets/javascripts/bootstrap/util.js +0 -189
  139. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  140. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  141. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  142. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  143. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  144. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  145. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  146. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  147. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  148. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  149. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  150. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  151. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
  152. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  153. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  154. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  155. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  156. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  157. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  158. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  159. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  160. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  161. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  162. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  163. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  164. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  165. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  166. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  167. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  168. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  169. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  170. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  171. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  172. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  173. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  174. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  175. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,641 +1,386 @@
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.3.1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 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('./base-component.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./util/index.js'), require('./util/swipe.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './util/index', './util/swipe'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.BaseComponent, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Index, global.Swipe));
10
+ })(this, (function (BaseComponent, EventHandler, Manipulator, SelectorEngine, index_js, Swipe) { 'use strict';
11
11
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
- var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
16
-
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);
24
- }
25
- }
26
-
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
- }
35
-
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];
40
-
41
- for (var key in source) {
42
- if (Object.prototype.hasOwnProperty.call(source, key)) {
43
- target[key] = source[key];
44
- }
45
- }
46
- }
12
+ /**
13
+ * --------------------------------------------------------------------------
14
+ * Bootstrap carousel.js
15
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
+ * --------------------------------------------------------------------------
17
+ */
47
18
 
48
- return target;
49
- };
50
- return _extends.apply(this, arguments);
51
- }
52
19
 
53
20
  /**
54
21
  * Constants
55
22
  */
56
23
 
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 = {
24
+ const NAME = 'carousel';
25
+ const DATA_KEY = 'bs.carousel';
26
+ const EVENT_KEY = `.${DATA_KEY}`;
27
+ const DATA_API_KEY = '.data-api';
28
+ const ARROW_LEFT_KEY = 'ArrowLeft';
29
+ const ARROW_RIGHT_KEY = 'ArrowRight';
30
+ const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
31
+
32
+ const ORDER_NEXT = 'next';
33
+ const ORDER_PREV = 'prev';
34
+ const DIRECTION_LEFT = 'left';
35
+ const DIRECTION_RIGHT = 'right';
36
+ const EVENT_SLIDE = `slide${EVENT_KEY}`;
37
+ const EVENT_SLID = `slid${EVENT_KEY}`;
38
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY}`;
39
+ const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`;
40
+ const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`;
41
+ const EVENT_DRAG_START = `dragstart${EVENT_KEY}`;
42
+ const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`;
43
+ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
44
+ const CLASS_NAME_CAROUSEL = 'carousel';
45
+ const CLASS_NAME_ACTIVE = 'active';
46
+ const CLASS_NAME_SLIDE = 'slide';
47
+ const CLASS_NAME_END = 'carousel-item-end';
48
+ const CLASS_NAME_START = 'carousel-item-start';
49
+ const CLASS_NAME_NEXT = 'carousel-item-next';
50
+ const CLASS_NAME_PREV = 'carousel-item-prev';
51
+ const SELECTOR_ACTIVE = '.active';
52
+ const SELECTOR_ITEM = '.carousel-item';
53
+ const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
54
+ const SELECTOR_ITEM_IMG = '.carousel-item img';
55
+ const SELECTOR_INDICATORS = '.carousel-indicators';
56
+ const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
57
+ const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
58
+ const KEY_TO_DIRECTION = {
59
+ [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
60
+ [ARROW_RIGHT_KEY]: DIRECTION_LEFT
61
+ };
62
+ const Default = {
104
63
  interval: 5000,
105
64
  keyboard: true,
106
- slide: false,
107
65
  pause: 'hover',
108
- wrap: true,
109
- touch: true
66
+ ride: false,
67
+ touch: true,
68
+ wrap: true
110
69
  };
111
- var DefaultType = {
70
+ const DefaultType = {
112
71
  interval: '(number|boolean)',
72
+ // TODO:v6 remove boolean support
113
73
  keyboard: 'boolean',
114
- slide: '(boolean|string)',
115
74
  pause: '(string|boolean)',
116
- wrap: 'boolean',
117
- touch: 'boolean'
118
- };
119
- var PointerType = {
120
- TOUCH: 'touch',
121
- PEN: 'pen'
75
+ ride: '(boolean|string)',
76
+ touch: 'boolean',
77
+ wrap: 'boolean'
122
78
  };
79
+
123
80
  /**
124
81
  * Class definition
125
82
  */
126
83
 
127
- var Carousel = /*#__PURE__*/function () {
128
- function Carousel(element, config) {
129
- this._items = null;
84
+ class Carousel extends BaseComponent {
85
+ constructor(element, config) {
86
+ super(element, config);
130
87
  this._interval = null;
131
88
  this._activeElement = null;
132
- this._isPaused = false;
133
89
  this._isSliding = false;
134
90
  this.touchTimeout = null;
135
- this.touchStartX = 0;
136
- this.touchDeltaX = 0;
137
- this._config = this._getConfig(config);
138
- this._element = element;
139
- this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS);
140
- this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
141
- this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
142
-
91
+ this._swipeHelper = null;
92
+ this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
143
93
  this._addEventListeners();
144
- } // Getters
145
-
94
+ if (this._config.ride === CLASS_NAME_CAROUSEL) {
95
+ this.cycle();
96
+ }
97
+ }
146
98
 
147
- var _proto = Carousel.prototype;
99
+ // Getters
100
+ static get Default() {
101
+ return Default;
102
+ }
103
+ static get DefaultType() {
104
+ return DefaultType;
105
+ }
106
+ static get NAME() {
107
+ return NAME;
108
+ }
148
109
 
149
110
  // Public
150
- _proto.next = function next() {
151
- if (!this._isSliding) {
152
- this._slide(DIRECTION_NEXT);
153
- }
154
- };
155
-
156
- _proto.nextWhenVisible = function nextWhenVisible() {
157
- var $element = $__default["default"](this._element); // Don't call next when the page isn't visible
111
+ next() {
112
+ this._slide(ORDER_NEXT);
113
+ }
114
+ nextWhenVisible() {
115
+ // FIXME TODO use `document.visibilityState`
116
+ // Don't call next when the page isn't visible
158
117
  // or the carousel or its parent isn't visible
159
-
160
- if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') {
118
+ if (!document.hidden && index_js.isVisible(this._element)) {
161
119
  this.next();
162
120
  }
163
- };
164
-
165
- _proto.prev = function prev() {
166
- if (!this._isSliding) {
167
- this._slide(DIRECTION_PREV);
168
- }
169
- };
170
-
171
- _proto.pause = function pause(event) {
172
- if (!event) {
173
- this._isPaused = true;
174
- }
175
-
176
- if (this._element.querySelector(SELECTOR_NEXT_PREV)) {
177
- Util__default["default"].triggerTransitionEnd(this._element);
178
- this.cycle(true);
179
- }
180
-
181
- clearInterval(this._interval);
182
- this._interval = null;
183
- };
184
-
185
- _proto.cycle = function cycle(event) {
186
- if (!event) {
187
- this._isPaused = false;
121
+ }
122
+ prev() {
123
+ this._slide(ORDER_PREV);
124
+ }
125
+ pause() {
126
+ if (this._isSliding) {
127
+ index_js.triggerTransitionEnd(this._element);
188
128
  }
189
-
190
- if (this._interval) {
191
- clearInterval(this._interval);
192
- this._interval = null;
129
+ this._clearInterval();
130
+ }
131
+ cycle() {
132
+ this._clearInterval();
133
+ this._updateInterval();
134
+ this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
135
+ }
136
+ _maybeEnableCycle() {
137
+ if (!this._config.ride) {
138
+ return;
193
139
  }
194
-
195
- if (this._config.interval && !this._isPaused) {
196
- this._updateInterval();
197
-
198
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
140
+ if (this._isSliding) {
141
+ EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
142
+ return;
199
143
  }
200
- };
201
-
202
- _proto.to = function to(index) {
203
- var _this = this;
204
-
205
- this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
206
-
207
- var activeIndex = this._getItemIndex(this._activeElement);
208
-
209
- if (index > this._items.length - 1 || index < 0) {
144
+ this.cycle();
145
+ }
146
+ to(index) {
147
+ const items = this._getItems();
148
+ if (index > items.length - 1 || index < 0) {
210
149
  return;
211
150
  }
212
-
213
151
  if (this._isSliding) {
214
- $__default["default"](this._element).one(EVENT_SLID, function () {
215
- return _this.to(index);
216
- });
152
+ EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
217
153
  return;
218
154
  }
219
-
155
+ const activeIndex = this._getItemIndex(this._getActive());
220
156
  if (activeIndex === index) {
221
- this.pause();
222
- this.cycle();
223
- return;
224
- }
225
-
226
- var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV;
227
-
228
- this._slide(direction, this._items[index]);
229
- };
230
-
231
- _proto.dispose = function dispose() {
232
- $__default["default"](this._element).off(EVENT_KEY);
233
- $__default["default"].removeData(this._element, DATA_KEY);
234
- this._items = null;
235
- this._config = null;
236
- this._element = null;
237
- this._interval = null;
238
- this._isPaused = null;
239
- this._isSliding = null;
240
- this._activeElement = null;
241
- this._indicatorsElement = null;
242
- } // Private
243
- ;
244
-
245
- _proto._getConfig = function _getConfig(config) {
246
- config = _extends({}, Default, config);
247
- Util__default["default"].typeCheckConfig(NAME, config, DefaultType);
248
- return config;
249
- };
250
-
251
- _proto._handleSwipe = function _handleSwipe() {
252
- var absDeltax = Math.abs(this.touchDeltaX);
253
-
254
- if (absDeltax <= SWIPE_THRESHOLD) {
255
157
  return;
256
158
  }
257
-
258
- var direction = absDeltax / this.touchDeltaX;
259
- this.touchDeltaX = 0; // swipe left
260
-
261
- if (direction > 0) {
262
- this.prev();
263
- } // swipe right
264
-
265
-
266
- if (direction < 0) {
267
- this.next();
159
+ const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
160
+ this._slide(order, items[index]);
161
+ }
162
+ dispose() {
163
+ if (this._swipeHelper) {
164
+ this._swipeHelper.dispose();
268
165
  }
269
- };
270
-
271
- _proto._addEventListeners = function _addEventListeners() {
272
- var _this2 = this;
166
+ super.dispose();
167
+ }
273
168
 
169
+ // Private
170
+ _configAfterMerge(config) {
171
+ config.defaultInterval = config.interval;
172
+ return config;
173
+ }
174
+ _addEventListeners() {
274
175
  if (this._config.keyboard) {
275
- $__default["default"](this._element).on(EVENT_KEYDOWN, function (event) {
276
- return _this2._keydown(event);
277
- });
176
+ EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
278
177
  }
279
-
280
178
  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
- });
179
+ EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause());
180
+ EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle());
286
181
  }
287
-
288
- if (this._config.touch) {
182
+ if (this._config.touch && Swipe.isSupported()) {
289
183
  this._addTouchEventListeners();
290
184
  }
291
- };
292
-
293
- _proto._addTouchEventListeners = function _addTouchEventListeners() {
294
- var _this3 = this;
295
-
296
- if (!this._touchSupported) {
297
- return;
185
+ }
186
+ _addTouchEventListeners() {
187
+ for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
188
+ EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault());
298
189
  }
299
-
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;
305
- }
306
- };
307
-
308
- var move = function move(event) {
309
- // 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;
311
- };
312
-
313
- var end = function end(event) {
314
- if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
315
- _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
190
+ const endCallBack = () => {
191
+ if (this._config.pause !== 'hover') {
192
+ return;
316
193
  }
317
194
 
318
- _this3._handleSwipe();
195
+ // If it's a touch-enabled device, mouseenter/leave are fired as
196
+ // part of the mouse compatibility events on first tap - the carousel
197
+ // would stop cycling until user tapped out of it;
198
+ // here, we listen for touchend, explicitly pause the carousel
199
+ // (as if it's the second time we tap on it, mouseenter compat event
200
+ // is NOT fired) and after a timeout (to allow for mouse compatibility
201
+ // events to fire) we explicitly restart cycling
319
202
 
320
- if (_this3._config.pause === 'hover') {
321
- // If it's a touch-enabled device, mouseenter/leave are fired as
322
- // part of the mouse compatibility events on first tap - the carousel
323
- // would stop cycling until user tapped out of it;
324
- // here, we listen for touchend, explicitly pause the carousel
325
- // (as if it's the second time we tap on it, mouseenter compat event
326
- // is NOT fired) and after a timeout (to allow for mouse compatibility
327
- // events to fire) we explicitly restart cycling
328
- _this3.pause();
329
-
330
- if (_this3.touchTimeout) {
331
- clearTimeout(_this3.touchTimeout);
332
- }
333
-
334
- _this3.touchTimeout = setTimeout(function (event) {
335
- return _this3.cycle(event);
336
- }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
203
+ this.pause();
204
+ if (this.touchTimeout) {
205
+ clearTimeout(this.touchTimeout);
337
206
  }
207
+ this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
338
208
  };
339
-
340
- $__default["default"](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) {
341
- return e.preventDefault();
342
- });
343
-
344
- 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
- });
351
-
352
- this._element.classList.add(CLASS_NAME_POINTER_EVENT);
353
- } 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
- });
363
- }
364
- };
365
-
366
- _proto._keydown = function _keydown(event) {
209
+ const swipeConfig = {
210
+ leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
211
+ rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
212
+ endCallback: endCallBack
213
+ };
214
+ this._swipeHelper = new Swipe(this._element, swipeConfig);
215
+ }
216
+ _keydown(event) {
367
217
  if (/input|textarea/i.test(event.target.tagName)) {
368
218
  return;
369
219
  }
370
-
371
- switch (event.which) {
372
- case ARROW_LEFT_KEYCODE:
373
- event.preventDefault();
374
- this.prev();
375
- break;
376
-
377
- case ARROW_RIGHT_KEYCODE:
378
- event.preventDefault();
379
- this.next();
380
- break;
220
+ const direction = KEY_TO_DIRECTION[event.key];
221
+ if (direction) {
222
+ event.preventDefault();
223
+ this._slide(this._directionToOrder(direction));
381
224
  }
382
- };
383
-
384
- _proto._getItemIndex = function _getItemIndex(element) {
385
- this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : [];
386
- return this._items.indexOf(element);
387
- };
388
-
389
- _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
390
- var isNextDirection = direction === DIRECTION_NEXT;
391
- var isPrevDirection = direction === DIRECTION_PREV;
392
-
393
- var activeIndex = this._getItemIndex(activeElement);
394
-
395
- var lastItemIndex = this._items.length - 1;
396
- var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
397
-
398
- if (isGoingToWrap && !this._config.wrap) {
399
- return activeElement;
225
+ }
226
+ _getItemIndex(element) {
227
+ return this._getItems().indexOf(element);
228
+ }
229
+ _setActiveIndicatorElement(index) {
230
+ if (!this._indicatorsElement) {
231
+ return;
400
232
  }
401
-
402
- var delta = direction === DIRECTION_PREV ? -1 : 1;
403
- var itemIndex = (activeIndex + delta) % this._items.length;
404
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
405
- };
406
-
407
- _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
408
- var targetIndex = this._getItemIndex(relatedTarget);
409
-
410
- var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM));
411
-
412
- var slideEvent = $__default["default"].Event(EVENT_SLIDE, {
413
- relatedTarget: relatedTarget,
414
- direction: eventDirectionName,
415
- from: fromIndex,
416
- to: targetIndex
417
- });
418
- $__default["default"](this._element).trigger(slideEvent);
419
- return slideEvent;
420
- };
421
-
422
- _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
423
- 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);
431
- }
233
+ const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
234
+ activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
235
+ activeIndicator.removeAttribute('aria-current');
236
+ const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement);
237
+ if (newActiveIndicator) {
238
+ newActiveIndicator.classList.add(CLASS_NAME_ACTIVE);
239
+ newActiveIndicator.setAttribute('aria-current', 'true');
432
240
  }
433
- };
434
-
435
- _proto._updateInterval = function _updateInterval() {
436
- var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM);
437
-
241
+ }
242
+ _updateInterval() {
243
+ const element = this._activeElement || this._getActive();
438
244
  if (!element) {
439
245
  return;
440
246
  }
441
-
442
- var elementInterval = parseInt(element.getAttribute('data-interval'), 10);
443
-
444
- if (elementInterval) {
445
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
446
- this._config.interval = elementInterval;
447
- } else {
448
- this._config.interval = this._config.defaultInterval || this._config.interval;
449
- }
450
- };
451
-
452
- _proto._slide = function _slide(direction, element) {
453
- var _this4 = this;
454
-
455
- var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM);
456
-
457
- var activeElementIndex = this._getItemIndex(activeElement);
458
-
459
- var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
460
-
461
- var nextElementIndex = this._getItemIndex(nextElement);
462
-
463
- var isCycling = Boolean(this._interval);
464
- var directionalClassName;
465
- var orderClassName;
466
- var eventDirectionName;
467
-
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;
247
+ const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
248
+ this._config.interval = elementInterval || this._config.defaultInterval;
249
+ }
250
+ _slide(order, element = null) {
251
+ if (this._isSliding) {
252
+ return;
476
253
  }
477
-
478
- if (nextElement && $__default["default"](nextElement).hasClass(CLASS_NAME_ACTIVE)) {
479
- this._isSliding = false;
254
+ const activeElement = this._getActive();
255
+ const isNext = order === ORDER_NEXT;
256
+ const nextElement = element || index_js.getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
257
+ if (nextElement === activeElement) {
480
258
  return;
481
259
  }
482
-
483
- var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
484
-
485
- if (slideEvent.isDefaultPrevented()) {
260
+ const nextElementIndex = this._getItemIndex(nextElement);
261
+ const triggerEvent = eventName => {
262
+ return EventHandler.trigger(this._element, eventName, {
263
+ relatedTarget: nextElement,
264
+ direction: this._orderToDirection(order),
265
+ from: this._getItemIndex(activeElement),
266
+ to: nextElementIndex
267
+ });
268
+ };
269
+ const slideEvent = triggerEvent(EVENT_SLIDE);
270
+ if (slideEvent.defaultPrevented) {
486
271
  return;
487
272
  }
488
-
489
273
  if (!activeElement || !nextElement) {
490
274
  // Some weirdness is happening, so we bail
275
+ // TODO: change tests that use empty divs to avoid this check
491
276
  return;
492
277
  }
493
-
278
+ const isCycling = Boolean(this._interval);
279
+ this.pause();
494
280
  this._isSliding = true;
495
-
496
- if (isCycling) {
497
- this.pause();
498
- }
499
-
500
- this._setActiveIndicatorElement(nextElement);
501
-
281
+ this._setActiveIndicatorElement(nextElementIndex);
502
282
  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
-
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);
522
- }, 0);
523
- }).emulateTransitionEnd(transitionDuration);
524
- } else {
525
- $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE);
526
- $__default["default"](nextElement).addClass(CLASS_NAME_ACTIVE);
283
+ const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
284
+ const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
285
+ nextElement.classList.add(orderClassName);
286
+ index_js.reflow(nextElement);
287
+ activeElement.classList.add(directionalClassName);
288
+ nextElement.classList.add(directionalClassName);
289
+ const completeCallBack = () => {
290
+ nextElement.classList.remove(directionalClassName, orderClassName);
291
+ nextElement.classList.add(CLASS_NAME_ACTIVE);
292
+ activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
527
293
  this._isSliding = false;
528
- $__default["default"](this._element).trigger(slidEvent);
529
- }
530
-
294
+ triggerEvent(EVENT_SLID);
295
+ };
296
+ this._queueCallback(completeCallBack, activeElement, this._isAnimated());
531
297
  if (isCycling) {
532
298
  this.cycle();
533
299
  }
534
- } // Static
535
- ;
300
+ }
301
+ _isAnimated() {
302
+ return this._element.classList.contains(CLASS_NAME_SLIDE);
303
+ }
304
+ _getActive() {
305
+ return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
306
+ }
307
+ _getItems() {
308
+ return SelectorEngine.find(SELECTOR_ITEM, this._element);
309
+ }
310
+ _clearInterval() {
311
+ if (this._interval) {
312
+ clearInterval(this._interval);
313
+ this._interval = null;
314
+ }
315
+ }
316
+ _directionToOrder(direction) {
317
+ if (index_js.isRTL()) {
318
+ return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
319
+ }
320
+ return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
321
+ }
322
+ _orderToDirection(order) {
323
+ if (index_js.isRTL()) {
324
+ return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
325
+ }
326
+ return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
327
+ }
536
328
 
537
- Carousel._jQueryInterface = function _jQueryInterface(config) {
329
+ // Static
330
+ static jQueryInterface(config) {
538
331
  return this.each(function () {
539
- var data = $__default["default"](this).data(DATA_KEY);
540
-
541
- var _config = _extends({}, Default, $__default["default"](this).data());
542
-
543
- if (typeof config === 'object') {
544
- _config = _extends({}, _config, config);
545
- }
546
-
547
- var action = typeof config === 'string' ? config : _config.slide;
548
-
549
- if (!data) {
550
- data = new Carousel(this, _config);
551
- $__default["default"](this).data(DATA_KEY, data);
552
- }
553
-
332
+ const data = Carousel.getOrCreateInstance(this, config);
554
333
  if (typeof config === 'number') {
555
334
  data.to(config);
556
- } else if (typeof action === 'string') {
557
- if (typeof data[action] === 'undefined') {
558
- throw new TypeError("No method named \"" + action + "\"");
335
+ return;
336
+ }
337
+ if (typeof config === 'string') {
338
+ if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
339
+ throw new TypeError(`No method named "${config}"`);
559
340
  }
560
-
561
- data[action]();
562
- } else if (_config.interval && _config.ride) {
563
- data.pause();
564
- data.cycle();
341
+ data[config]();
565
342
  }
566
343
  });
567
- };
568
-
569
- Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
570
- var selector = Util__default["default"].getSelectorFromElement(this);
571
-
572
- if (!selector) {
573
- return;
574
- }
575
-
576
- var target = $__default["default"](selector)[0];
577
-
578
- if (!target || !$__default["default"](target).hasClass(CLASS_NAME_CAROUSEL)) {
579
- return;
580
- }
581
-
582
- var config = _extends({}, $__default["default"](target).data(), $__default["default"](this).data());
583
-
584
- var slideIndex = this.getAttribute('data-slide-to');
585
-
586
- if (slideIndex) {
587
- config.interval = false;
588
- }
589
-
590
- Carousel._jQueryInterface.call($__default["default"](target), config);
591
-
592
- if (slideIndex) {
593
- $__default["default"](target).data(DATA_KEY).to(slideIndex);
594
- }
595
-
596
- 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
- }]);
344
+ }
345
+ }
610
346
 
611
- return Carousel;
612
- }();
613
347
  /**
614
348
  * Data API implementation
615
349
  */
616
350
 
617
-
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]);
624
-
625
- Carousel._jQueryInterface.call($carousel, $carousel.data());
351
+ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {
352
+ const target = SelectorEngine.getElementFromSelector(this);
353
+ if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
354
+ return;
355
+ }
356
+ event.preventDefault();
357
+ const carousel = Carousel.getOrCreateInstance(target);
358
+ const slideIndex = this.getAttribute('data-bs-slide-to');
359
+ if (slideIndex) {
360
+ carousel.to(slideIndex);
361
+ carousel._maybeEnableCycle();
362
+ return;
363
+ }
364
+ if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
365
+ carousel.next();
366
+ carousel._maybeEnableCycle();
367
+ return;
368
+ }
369
+ carousel.prev();
370
+ carousel._maybeEnableCycle();
371
+ });
372
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
373
+ const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
374
+ for (const carousel of carousels) {
375
+ Carousel.getOrCreateInstance(carousel);
626
376
  }
627
377
  });
378
+
628
379
  /**
629
380
  * jQuery
630
381
  */
631
382
 
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
- };
383
+ index_js.defineJQueryPlugin(Carousel);
639
384
 
640
385
  return Carousel;
641
386