bootstrap 4.5.3 → 5.2.3

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