bootstrap 4.1.3 → 4.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bootstrap might be problematic. Click here for more details.

Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/README.md +1 -1
  4. data/Rakefile +2 -2
  5. data/assets/javascripts/bootstrap-sprockets.js +6 -5
  6. data/assets/javascripts/bootstrap.js +3290 -2985
  7. data/assets/javascripts/bootstrap.min.js +2 -2
  8. data/assets/javascripts/bootstrap/alert.js +127 -132
  9. data/assets/javascripts/bootstrap/button.js +119 -124
  10. data/assets/javascripts/bootstrap/carousel.js +492 -393
  11. data/assets/javascripts/bootstrap/collapse.js +276 -279
  12. data/assets/javascripts/bootstrap/dropdown.js +413 -374
  13. data/assets/javascripts/bootstrap/modal.js +455 -445
  14. data/assets/javascripts/bootstrap/popover.js +155 -160
  15. data/assets/javascripts/bootstrap/scrollspy.js +246 -250
  16. data/assets/javascripts/bootstrap/tab.js +180 -192
  17. data/assets/javascripts/bootstrap/toast.js +277 -0
  18. data/assets/javascripts/bootstrap/tooltip.js +533 -522
  19. data/assets/javascripts/bootstrap/util.js +140 -116
  20. data/assets/stylesheets/_bootstrap-grid.scss +2 -5
  21. data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
  22. data/assets/stylesheets/_bootstrap.scss +3 -1
  23. data/assets/stylesheets/bootstrap/_alert.scss +1 -1
  24. data/assets/stylesheets/bootstrap/_badge.scss +6 -0
  25. data/assets/stylesheets/bootstrap/_button-group.scss +9 -18
  26. data/assets/stylesheets/bootstrap/_buttons.scss +7 -10
  27. data/assets/stylesheets/bootstrap/_card.scss +30 -21
  28. data/assets/stylesheets/bootstrap/_carousel.scss +36 -74
  29. data/assets/stylesheets/bootstrap/_close.scss +15 -6
  30. data/assets/stylesheets/bootstrap/_custom-forms.scss +103 -29
  31. data/assets/stylesheets/bootstrap/_dropdown.scss +30 -5
  32. data/assets/stylesheets/bootstrap/_forms.scss +12 -11
  33. data/assets/stylesheets/bootstrap/_functions.scss +4 -4
  34. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  35. data/assets/stylesheets/bootstrap/_input-group.scss +24 -4
  36. data/assets/stylesheets/bootstrap/_list-group.scss +6 -0
  37. data/assets/stylesheets/bootstrap/_modal.scss +16 -10
  38. data/assets/stylesheets/bootstrap/_nav.scss +2 -0
  39. data/assets/stylesheets/bootstrap/_navbar.scss +4 -4
  40. data/assets/stylesheets/bootstrap/_popover.scss +1 -1
  41. data/assets/stylesheets/bootstrap/_reboot.scss +14 -35
  42. data/assets/stylesheets/bootstrap/_spinners.scss +53 -0
  43. data/assets/stylesheets/bootstrap/_tables.scss +2 -2
  44. data/assets/stylesheets/bootstrap/_toasts.scss +43 -0
  45. data/assets/stylesheets/bootstrap/_type.scss +2 -2
  46. data/assets/stylesheets/bootstrap/_utilities.scss +1 -0
  47. data/assets/stylesheets/bootstrap/_variables.scss +220 -81
  48. data/assets/stylesheets/bootstrap/mixins/_badge.scss +1 -2
  49. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +2 -2
  50. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +9 -7
  51. data/assets/stylesheets/bootstrap/mixins/_caret.scss +0 -4
  52. data/assets/stylesheets/bootstrap/mixins/_forms.scss +61 -10
  53. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +3 -4
  54. data/assets/stylesheets/bootstrap/mixins/_grid.scss +9 -10
  55. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +10 -1
  56. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +1 -1
  57. data/assets/stylesheets/bootstrap/mixins/_transition.scss +5 -2
  58. data/assets/stylesheets/bootstrap/utilities/_borders.scss +4 -0
  59. data/assets/stylesheets/bootstrap/utilities/_embed.scss +7 -20
  60. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +5 -0
  61. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -5
  62. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +8 -0
  63. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +23 -1
  64. data/assets/stylesheets/bootstrap/utilities/_text.scss +13 -4
  65. data/bootstrap.gemspec +6 -3
  66. data/lib/bootstrap.rb +10 -7
  67. data/lib/bootstrap/engine.rb +3 -0
  68. data/lib/bootstrap/version.rb +4 -2
  69. metadata +15 -11
@@ -1,3 +1,8 @@
1
+ /*!
2
+ * Bootstrap carousel.js v4.2.1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2018 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
+ */
1
6
  (function (global, factory) {
2
7
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
3
8
  typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
@@ -58,508 +63,602 @@
58
63
  }
59
64
 
60
65
  /**
61
- * --------------------------------------------------------------------------
62
- * Bootstrap (v4.1.3): carousel.js
63
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
64
- * --------------------------------------------------------------------------
66
+ * ------------------------------------------------------------------------
67
+ * Constants
68
+ * ------------------------------------------------------------------------
65
69
  */
66
70
 
67
- var Carousel = function ($$$1) {
71
+ var NAME = 'carousel';
72
+ var VERSION = '4.2.1';
73
+ var DATA_KEY = 'bs.carousel';
74
+ var EVENT_KEY = "." + DATA_KEY;
75
+ var DATA_API_KEY = '.data-api';
76
+ var JQUERY_NO_CONFLICT = $.fn[NAME];
77
+ var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
78
+
79
+ var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
80
+
81
+ var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
82
+
83
+ var SWIPE_THRESHOLD = 40;
84
+ var Default = {
85
+ interval: 5000,
86
+ keyboard: true,
87
+ slide: false,
88
+ pause: 'hover',
89
+ wrap: true,
90
+ touch: true
91
+ };
92
+ var DefaultType = {
93
+ interval: '(number|boolean)',
94
+ keyboard: 'boolean',
95
+ slide: '(boolean|string)',
96
+ pause: '(string|boolean)',
97
+ wrap: 'boolean',
98
+ touch: 'boolean'
99
+ };
100
+ var Direction = {
101
+ NEXT: 'next',
102
+ PREV: 'prev',
103
+ LEFT: 'left',
104
+ RIGHT: 'right'
105
+ };
106
+ var Event = {
107
+ SLIDE: "slide" + EVENT_KEY,
108
+ SLID: "slid" + EVENT_KEY,
109
+ KEYDOWN: "keydown" + EVENT_KEY,
110
+ MOUSEENTER: "mouseenter" + EVENT_KEY,
111
+ MOUSELEAVE: "mouseleave" + EVENT_KEY,
112
+ TOUCHSTART: "touchstart" + EVENT_KEY,
113
+ TOUCHMOVE: "touchmove" + EVENT_KEY,
114
+ TOUCHEND: "touchend" + EVENT_KEY,
115
+ POINTERDOWN: "pointerdown" + EVENT_KEY,
116
+ POINTERUP: "pointerup" + EVENT_KEY,
117
+ DRAG_START: "dragstart" + EVENT_KEY,
118
+ LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
119
+ CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
120
+ };
121
+ var ClassName = {
122
+ CAROUSEL: 'carousel',
123
+ ACTIVE: 'active',
124
+ SLIDE: 'slide',
125
+ RIGHT: 'carousel-item-right',
126
+ LEFT: 'carousel-item-left',
127
+ NEXT: 'carousel-item-next',
128
+ PREV: 'carousel-item-prev',
129
+ ITEM: 'carousel-item',
130
+ POINTER_EVENT: 'pointer-event'
131
+ };
132
+ var Selector = {
133
+ ACTIVE: '.active',
134
+ ACTIVE_ITEM: '.active.carousel-item',
135
+ ITEM: '.carousel-item',
136
+ ITEM_IMG: '.carousel-item img',
137
+ NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
138
+ INDICATORS: '.carousel-indicators',
139
+ DATA_SLIDE: '[data-slide], [data-slide-to]',
140
+ DATA_RIDE: '[data-ride="carousel"]'
141
+ };
142
+ var PointerType = {
143
+ TOUCH: 'touch',
144
+ PEN: 'pen'
68
145
  /**
69
146
  * ------------------------------------------------------------------------
70
- * Constants
147
+ * Class Definition
71
148
  * ------------------------------------------------------------------------
72
149
  */
73
- var NAME = 'carousel';
74
- var VERSION = '4.1.3';
75
- var DATA_KEY = 'bs.carousel';
76
- var EVENT_KEY = "." + DATA_KEY;
77
- var DATA_API_KEY = '.data-api';
78
- var JQUERY_NO_CONFLICT = $$$1.fn[NAME];
79
- var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
80
-
81
- var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
82
-
83
- var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
84
-
85
- var Default = {
86
- interval: 5000,
87
- keyboard: true,
88
- slide: false,
89
- pause: 'hover',
90
- wrap: true
91
- };
92
- var DefaultType = {
93
- interval: '(number|boolean)',
94
- keyboard: 'boolean',
95
- slide: '(boolean|string)',
96
- pause: '(string|boolean)',
97
- wrap: 'boolean'
98
- };
99
- var Direction = {
100
- NEXT: 'next',
101
- PREV: 'prev',
102
- LEFT: 'left',
103
- RIGHT: 'right'
150
+
151
+ };
152
+
153
+ var Carousel =
154
+ /*#__PURE__*/
155
+ function () {
156
+ function Carousel(element, config) {
157
+ this._items = null;
158
+ this._interval = null;
159
+ this._activeElement = null;
160
+ this._isPaused = false;
161
+ this._isSliding = false;
162
+ this.touchTimeout = null;
163
+ this.touchStartX = 0;
164
+ this.touchDeltaX = 0;
165
+ this._config = this._getConfig(config);
166
+ this._element = element;
167
+ this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
168
+ this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
169
+ this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
170
+
171
+ this._addEventListeners();
172
+ } // Getters
173
+
174
+
175
+ var _proto = Carousel.prototype;
176
+
177
+ // Public
178
+ _proto.next = function next() {
179
+ if (!this._isSliding) {
180
+ this._slide(Direction.NEXT);
181
+ }
104
182
  };
105
- var Event = {
106
- SLIDE: "slide" + EVENT_KEY,
107
- SLID: "slid" + EVENT_KEY,
108
- KEYDOWN: "keydown" + EVENT_KEY,
109
- MOUSEENTER: "mouseenter" + EVENT_KEY,
110
- MOUSELEAVE: "mouseleave" + EVENT_KEY,
111
- TOUCHEND: "touchend" + EVENT_KEY,
112
- LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
113
- CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
183
+
184
+ _proto.nextWhenVisible = function nextWhenVisible() {
185
+ // Don't call next when the page isn't visible
186
+ // or the carousel or its parent isn't visible
187
+ if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
188
+ this.next();
189
+ }
114
190
  };
115
- var ClassName = {
116
- CAROUSEL: 'carousel',
117
- ACTIVE: 'active',
118
- SLIDE: 'slide',
119
- RIGHT: 'carousel-item-right',
120
- LEFT: 'carousel-item-left',
121
- NEXT: 'carousel-item-next',
122
- PREV: 'carousel-item-prev',
123
- ITEM: 'carousel-item'
191
+
192
+ _proto.prev = function prev() {
193
+ if (!this._isSliding) {
194
+ this._slide(Direction.PREV);
195
+ }
124
196
  };
125
- var Selector = {
126
- ACTIVE: '.active',
127
- ACTIVE_ITEM: '.active.carousel-item',
128
- ITEM: '.carousel-item',
129
- NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
130
- INDICATORS: '.carousel-indicators',
131
- DATA_SLIDE: '[data-slide], [data-slide-to]',
132
- DATA_RIDE: '[data-ride="carousel"]'
133
- /**
134
- * ------------------------------------------------------------------------
135
- * Class Definition
136
- * ------------------------------------------------------------------------
137
- */
138
197
 
198
+ _proto.pause = function pause(event) {
199
+ if (!event) {
200
+ this._isPaused = true;
201
+ }
202
+
203
+ if (this._element.querySelector(Selector.NEXT_PREV)) {
204
+ Util.triggerTransitionEnd(this._element);
205
+ this.cycle(true);
206
+ }
207
+
208
+ clearInterval(this._interval);
209
+ this._interval = null;
139
210
  };
140
211
 
141
- var Carousel =
142
- /*#__PURE__*/
143
- function () {
144
- function Carousel(element, config) {
145
- this._items = null;
146
- this._interval = null;
147
- this._activeElement = null;
212
+ _proto.cycle = function cycle(event) {
213
+ if (!event) {
148
214
  this._isPaused = false;
149
- this._isSliding = false;
150
- this.touchTimeout = null;
151
- this._config = this._getConfig(config);
152
- this._element = $$$1(element)[0];
153
- this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
154
-
155
- this._addEventListeners();
156
- } // Getters
215
+ }
157
216
 
217
+ if (this._interval) {
218
+ clearInterval(this._interval);
219
+ this._interval = null;
220
+ }
158
221
 
159
- var _proto = Carousel.prototype;
222
+ if (this._config.interval && !this._isPaused) {
223
+ this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
224
+ }
225
+ };
160
226
 
161
- // Public
162
- _proto.next = function next() {
163
- if (!this._isSliding) {
164
- this._slide(Direction.NEXT);
165
- }
166
- };
227
+ _proto.to = function to(index) {
228
+ var _this = this;
167
229
 
168
- _proto.nextWhenVisible = function nextWhenVisible() {
169
- // Don't call next when the page isn't visible
170
- // or the carousel or its parent isn't visible
171
- if (!document.hidden && $$$1(this._element).is(':visible') && $$$1(this._element).css('visibility') !== 'hidden') {
172
- this.next();
173
- }
174
- };
230
+ this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
175
231
 
176
- _proto.prev = function prev() {
177
- if (!this._isSliding) {
178
- this._slide(Direction.PREV);
179
- }
180
- };
232
+ var activeIndex = this._getItemIndex(this._activeElement);
181
233
 
182
- _proto.pause = function pause(event) {
183
- if (!event) {
184
- this._isPaused = true;
185
- }
234
+ if (index > this._items.length - 1 || index < 0) {
235
+ return;
236
+ }
186
237
 
187
- if (this._element.querySelector(Selector.NEXT_PREV)) {
188
- Util.triggerTransitionEnd(this._element);
189
- this.cycle(true);
190
- }
238
+ if (this._isSliding) {
239
+ $(this._element).one(Event.SLID, function () {
240
+ return _this.to(index);
241
+ });
242
+ return;
243
+ }
191
244
 
192
- clearInterval(this._interval);
193
- this._interval = null;
194
- };
245
+ if (activeIndex === index) {
246
+ this.pause();
247
+ this.cycle();
248
+ return;
249
+ }
195
250
 
196
- _proto.cycle = function cycle(event) {
197
- if (!event) {
198
- this._isPaused = false;
199
- }
251
+ var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
200
252
 
201
- if (this._interval) {
202
- clearInterval(this._interval);
203
- this._interval = null;
204
- }
253
+ this._slide(direction, this._items[index]);
254
+ };
205
255
 
206
- if (this._config.interval && !this._isPaused) {
207
- this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
208
- }
209
- };
256
+ _proto.dispose = function dispose() {
257
+ $(this._element).off(EVENT_KEY);
258
+ $.removeData(this._element, DATA_KEY);
259
+ this._items = null;
260
+ this._config = null;
261
+ this._element = null;
262
+ this._interval = null;
263
+ this._isPaused = null;
264
+ this._isSliding = null;
265
+ this._activeElement = null;
266
+ this._indicatorsElement = null;
267
+ }; // Private
268
+
269
+
270
+ _proto._getConfig = function _getConfig(config) {
271
+ config = _objectSpread({}, Default, config);
272
+ Util.typeCheckConfig(NAME, config, DefaultType);
273
+ return config;
274
+ };
210
275
 
211
- _proto.to = function to(index) {
212
- var _this = this;
276
+ _proto._handleSwipe = function _handleSwipe() {
277
+ var absDeltax = Math.abs(this.touchDeltaX);
213
278
 
214
- this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
279
+ if (absDeltax <= SWIPE_THRESHOLD) {
280
+ return;
281
+ }
215
282
 
216
- var activeIndex = this._getItemIndex(this._activeElement);
283
+ var direction = absDeltax / this.touchDeltaX; // swipe left
217
284
 
218
- if (index > this._items.length - 1 || index < 0) {
219
- return;
220
- }
285
+ if (direction > 0) {
286
+ this.prev();
287
+ } // swipe right
221
288
 
222
- if (this._isSliding) {
223
- $$$1(this._element).one(Event.SLID, function () {
224
- return _this.to(index);
225
- });
226
- return;
227
- }
228
289
 
229
- if (activeIndex === index) {
230
- this.pause();
231
- this.cycle();
232
- return;
233
- }
290
+ if (direction < 0) {
291
+ this.next();
292
+ }
293
+ };
234
294
 
235
- var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
295
+ _proto._addEventListeners = function _addEventListeners() {
296
+ var _this2 = this;
236
297
 
237
- this._slide(direction, this._items[index]);
238
- };
298
+ if (this._config.keyboard) {
299
+ $(this._element).on(Event.KEYDOWN, function (event) {
300
+ return _this2._keydown(event);
301
+ });
302
+ }
239
303
 
240
- _proto.dispose = function dispose() {
241
- $$$1(this._element).off(EVENT_KEY);
242
- $$$1.removeData(this._element, DATA_KEY);
243
- this._items = null;
244
- this._config = null;
245
- this._element = null;
246
- this._interval = null;
247
- this._isPaused = null;
248
- this._isSliding = null;
249
- this._activeElement = null;
250
- this._indicatorsElement = null;
251
- }; // Private
304
+ if (this._config.pause === 'hover') {
305
+ $(this._element).on(Event.MOUSEENTER, function (event) {
306
+ return _this2.pause(event);
307
+ }).on(Event.MOUSELEAVE, function (event) {
308
+ return _this2.cycle(event);
309
+ });
310
+ }
252
311
 
312
+ this._addTouchEventListeners();
313
+ };
253
314
 
254
- _proto._getConfig = function _getConfig(config) {
255
- config = _objectSpread({}, Default, config);
256
- Util.typeCheckConfig(NAME, config, DefaultType);
257
- return config;
258
- };
315
+ _proto._addTouchEventListeners = function _addTouchEventListeners() {
316
+ var _this3 = this;
259
317
 
260
- _proto._addEventListeners = function _addEventListeners() {
261
- var _this2 = this;
318
+ if (!this._touchSupported) {
319
+ return;
320
+ }
262
321
 
263
- if (this._config.keyboard) {
264
- $$$1(this._element).on(Event.KEYDOWN, function (event) {
265
- return _this2._keydown(event);
266
- });
322
+ var start = function start(event) {
323
+ if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
324
+ _this3.touchStartX = event.originalEvent.clientX;
325
+ } else if (!_this3._pointerEvent) {
326
+ _this3.touchStartX = event.originalEvent.touches[0].clientX;
267
327
  }
328
+ };
268
329
 
269
- if (this._config.pause === 'hover') {
270
- $$$1(this._element).on(Event.MOUSEENTER, function (event) {
271
- return _this2.pause(event);
272
- }).on(Event.MOUSELEAVE, function (event) {
273
- return _this2.cycle(event);
274
- });
275
-
276
- if ('ontouchstart' in document.documentElement) {
277
- // If it's a touch-enabled device, mouseenter/leave are fired as
278
- // part of the mouse compatibility events on first tap - the carousel
279
- // would stop cycling until user tapped out of it;
280
- // here, we listen for touchend, explicitly pause the carousel
281
- // (as if it's the second time we tap on it, mouseenter compat event
282
- // is NOT fired) and after a timeout (to allow for mouse compatibility
283
- // events to fire) we explicitly restart cycling
284
- $$$1(this._element).on(Event.TOUCHEND, function () {
285
- _this2.pause();
286
-
287
- if (_this2.touchTimeout) {
288
- clearTimeout(_this2.touchTimeout);
289
- }
290
-
291
- _this2.touchTimeout = setTimeout(function (event) {
292
- return _this2.cycle(event);
293
- }, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval);
294
- });
295
- }
330
+ var move = function move(event) {
331
+ // ensure swiping with one touch and not pinching
332
+ if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
333
+ _this3.touchDeltaX = 0;
334
+ } else {
335
+ _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
296
336
  }
297
337
  };
298
338
 
299
- _proto._keydown = function _keydown(event) {
300
- if (/input|textarea/i.test(event.target.tagName)) {
301
- return;
339
+ var end = function end(event) {
340
+ if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
341
+ _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
302
342
  }
303
343
 
304
- switch (event.which) {
305
- case ARROW_LEFT_KEYCODE:
306
- event.preventDefault();
307
- this.prev();
308
- break;
344
+ _this3._handleSwipe();
309
345
 
310
- case ARROW_RIGHT_KEYCODE:
311
- event.preventDefault();
312
- this.next();
313
- break;
346
+ if (_this3._config.pause === 'hover') {
347
+ // If it's a touch-enabled device, mouseenter/leave are fired as
348
+ // part of the mouse compatibility events on first tap - the carousel
349
+ // would stop cycling until user tapped out of it;
350
+ // here, we listen for touchend, explicitly pause the carousel
351
+ // (as if it's the second time we tap on it, mouseenter compat event
352
+ // is NOT fired) and after a timeout (to allow for mouse compatibility
353
+ // events to fire) we explicitly restart cycling
354
+ _this3.pause();
314
355
 
315
- default:
316
- }
317
- };
356
+ if (_this3.touchTimeout) {
357
+ clearTimeout(_this3.touchTimeout);
358
+ }
318
359
 
319
- _proto._getItemIndex = function _getItemIndex(element) {
320
- this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
321
- return this._items.indexOf(element);
360
+ _this3.touchTimeout = setTimeout(function (event) {
361
+ return _this3.cycle(event);
362
+ }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
363
+ }
322
364
  };
323
365
 
324
- _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
325
- var isNextDirection = direction === Direction.NEXT;
326
- var isPrevDirection = direction === Direction.PREV;
366
+ $(this._element.querySelectorAll(Selector.ITEM_IMG)).on(Event.DRAG_START, function (e) {
367
+ return e.preventDefault();
368
+ });
327
369
 
328
- var activeIndex = this._getItemIndex(activeElement);
370
+ if (this._pointerEvent) {
371
+ $(this._element).on(Event.POINTERDOWN, function (event) {
372
+ return start(event);
373
+ });
374
+ $(this._element).on(Event.POINTERUP, function (event) {
375
+ return end(event);
376
+ });
329
377
 
330
- var lastItemIndex = this._items.length - 1;
331
- var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
378
+ this._element.classList.add(ClassName.POINTER_EVENT);
379
+ } else {
380
+ $(this._element).on(Event.TOUCHSTART, function (event) {
381
+ return start(event);
382
+ });
383
+ $(this._element).on(Event.TOUCHMOVE, function (event) {
384
+ return move(event);
385
+ });
386
+ $(this._element).on(Event.TOUCHEND, function (event) {
387
+ return end(event);
388
+ });
389
+ }
390
+ };
332
391
 
333
- if (isGoingToWrap && !this._config.wrap) {
334
- return activeElement;
335
- }
392
+ _proto._keydown = function _keydown(event) {
393
+ if (/input|textarea/i.test(event.target.tagName)) {
394
+ return;
395
+ }
336
396
 
337
- var delta = direction === Direction.PREV ? -1 : 1;
338
- var itemIndex = (activeIndex + delta) % this._items.length;
339
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
340
- };
397
+ switch (event.which) {
398
+ case ARROW_LEFT_KEYCODE:
399
+ event.preventDefault();
400
+ this.prev();
401
+ break;
341
402
 
342
- _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
343
- var targetIndex = this._getItemIndex(relatedTarget);
403
+ case ARROW_RIGHT_KEYCODE:
404
+ event.preventDefault();
405
+ this.next();
406
+ break;
344
407
 
345
- var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
408
+ default:
409
+ }
410
+ };
346
411
 
347
- var slideEvent = $$$1.Event(Event.SLIDE, {
348
- relatedTarget: relatedTarget,
349
- direction: eventDirectionName,
350
- from: fromIndex,
351
- to: targetIndex
352
- });
353
- $$$1(this._element).trigger(slideEvent);
354
- return slideEvent;
355
- };
412
+ _proto._getItemIndex = function _getItemIndex(element) {
413
+ this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
414
+ return this._items.indexOf(element);
415
+ };
356
416
 
357
- _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
358
- if (this._indicatorsElement) {
359
- var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
360
- $$$1(indicators).removeClass(ClassName.ACTIVE);
417
+ _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
418
+ var isNextDirection = direction === Direction.NEXT;
419
+ var isPrevDirection = direction === Direction.PREV;
361
420
 
362
- var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
421
+ var activeIndex = this._getItemIndex(activeElement);
363
422
 
364
- if (nextIndicator) {
365
- $$$1(nextIndicator).addClass(ClassName.ACTIVE);
366
- }
367
- }
368
- };
423
+ var lastItemIndex = this._items.length - 1;
424
+ var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
369
425
 
370
- _proto._slide = function _slide(direction, element) {
371
- var _this3 = this;
426
+ if (isGoingToWrap && !this._config.wrap) {
427
+ return activeElement;
428
+ }
372
429
 
373
- var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
430
+ var delta = direction === Direction.PREV ? -1 : 1;
431
+ var itemIndex = (activeIndex + delta) % this._items.length;
432
+ return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
433
+ };
374
434
 
375
- var activeElementIndex = this._getItemIndex(activeElement);
435
+ _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
436
+ var targetIndex = this._getItemIndex(relatedTarget);
376
437
 
377
- var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
438
+ var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
378
439
 
379
- var nextElementIndex = this._getItemIndex(nextElement);
440
+ var slideEvent = $.Event(Event.SLIDE, {
441
+ relatedTarget: relatedTarget,
442
+ direction: eventDirectionName,
443
+ from: fromIndex,
444
+ to: targetIndex
445
+ });
446
+ $(this._element).trigger(slideEvent);
447
+ return slideEvent;
448
+ };
380
449
 
381
- var isCycling = Boolean(this._interval);
382
- var directionalClassName;
383
- var orderClassName;
384
- var eventDirectionName;
450
+ _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
451
+ if (this._indicatorsElement) {
452
+ var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
453
+ $(indicators).removeClass(ClassName.ACTIVE);
385
454
 
386
- if (direction === Direction.NEXT) {
387
- directionalClassName = ClassName.LEFT;
388
- orderClassName = ClassName.NEXT;
389
- eventDirectionName = Direction.LEFT;
390
- } else {
391
- directionalClassName = ClassName.RIGHT;
392
- orderClassName = ClassName.PREV;
393
- eventDirectionName = Direction.RIGHT;
394
- }
455
+ var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
395
456
 
396
- if (nextElement && $$$1(nextElement).hasClass(ClassName.ACTIVE)) {
397
- this._isSliding = false;
398
- return;
457
+ if (nextIndicator) {
458
+ $(nextIndicator).addClass(ClassName.ACTIVE);
399
459
  }
460
+ }
461
+ };
400
462
 
401
- var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
402
-
403
- if (slideEvent.isDefaultPrevented()) {
404
- return;
405
- }
463
+ _proto._slide = function _slide(direction, element) {
464
+ var _this4 = this;
406
465
 
407
- if (!activeElement || !nextElement) {
408
- // Some weirdness is happening, so we bail
409
- return;
410
- }
466
+ var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
411
467
 
412
- this._isSliding = true;
468
+ var activeElementIndex = this._getItemIndex(activeElement);
413
469
 
414
- if (isCycling) {
415
- this.pause();
416
- }
470
+ var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
417
471
 
418
- this._setActiveIndicatorElement(nextElement);
472
+ var nextElementIndex = this._getItemIndex(nextElement);
419
473
 
420
- var slidEvent = $$$1.Event(Event.SLID, {
421
- relatedTarget: nextElement,
422
- direction: eventDirectionName,
423
- from: activeElementIndex,
424
- to: nextElementIndex
425
- });
474
+ var isCycling = Boolean(this._interval);
475
+ var directionalClassName;
476
+ var orderClassName;
477
+ var eventDirectionName;
426
478
 
427
- if ($$$1(this._element).hasClass(ClassName.SLIDE)) {
428
- $$$1(nextElement).addClass(orderClassName);
429
- Util.reflow(nextElement);
430
- $$$1(activeElement).addClass(directionalClassName);
431
- $$$1(nextElement).addClass(directionalClassName);
432
- var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
433
- $$$1(activeElement).one(Util.TRANSITION_END, function () {
434
- $$$1(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
435
- $$$1(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
436
- _this3._isSliding = false;
437
- setTimeout(function () {
438
- return $$$1(_this3._element).trigger(slidEvent);
439
- }, 0);
440
- }).emulateTransitionEnd(transitionDuration);
441
- } else {
442
- $$$1(activeElement).removeClass(ClassName.ACTIVE);
443
- $$$1(nextElement).addClass(ClassName.ACTIVE);
444
- this._isSliding = false;
445
- $$$1(this._element).trigger(slidEvent);
446
- }
479
+ if (direction === Direction.NEXT) {
480
+ directionalClassName = ClassName.LEFT;
481
+ orderClassName = ClassName.NEXT;
482
+ eventDirectionName = Direction.LEFT;
483
+ } else {
484
+ directionalClassName = ClassName.RIGHT;
485
+ orderClassName = ClassName.PREV;
486
+ eventDirectionName = Direction.RIGHT;
487
+ }
447
488
 
448
- if (isCycling) {
449
- this.cycle();
450
- }
451
- }; // Static
489
+ if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
490
+ this._isSliding = false;
491
+ return;
492
+ }
452
493
 
494
+ var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
453
495
 
454
- Carousel._jQueryInterface = function _jQueryInterface(config) {
455
- return this.each(function () {
456
- var data = $$$1(this).data(DATA_KEY);
496
+ if (slideEvent.isDefaultPrevented()) {
497
+ return;
498
+ }
457
499
 
458
- var _config = _objectSpread({}, Default, $$$1(this).data());
500
+ if (!activeElement || !nextElement) {
501
+ // Some weirdness is happening, so we bail
502
+ return;
503
+ }
459
504
 
460
- if (typeof config === 'object') {
461
- _config = _objectSpread({}, _config, config);
462
- }
505
+ this._isSliding = true;
463
506
 
464
- var action = typeof config === 'string' ? config : _config.slide;
507
+ if (isCycling) {
508
+ this.pause();
509
+ }
465
510
 
466
- if (!data) {
467
- data = new Carousel(this, _config);
468
- $$$1(this).data(DATA_KEY, data);
469
- }
511
+ this._setActiveIndicatorElement(nextElement);
470
512
 
471
- if (typeof config === 'number') {
472
- data.to(config);
473
- } else if (typeof action === 'string') {
474
- if (typeof data[action] === 'undefined') {
475
- throw new TypeError("No method named \"" + action + "\"");
476
- }
477
-
478
- data[action]();
479
- } else if (_config.interval) {
480
- data.pause();
481
- data.cycle();
482
- }
483
- });
484
- };
513
+ var slidEvent = $.Event(Event.SLID, {
514
+ relatedTarget: nextElement,
515
+ direction: eventDirectionName,
516
+ from: activeElementIndex,
517
+ to: nextElementIndex
518
+ });
485
519
 
486
- Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
487
- var selector = Util.getSelectorFromElement(this);
520
+ if ($(this._element).hasClass(ClassName.SLIDE)) {
521
+ $(nextElement).addClass(orderClassName);
522
+ Util.reflow(nextElement);
523
+ $(activeElement).addClass(directionalClassName);
524
+ $(nextElement).addClass(directionalClassName);
525
+ var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
488
526
 
489
- if (!selector) {
490
- return;
527
+ if (nextElementInterval) {
528
+ this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
529
+ this._config.interval = nextElementInterval;
530
+ } else {
531
+ this._config.interval = this._config.defaultInterval || this._config.interval;
491
532
  }
492
533
 
493
- var target = $$$1(selector)[0];
534
+ var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
535
+ $(activeElement).one(Util.TRANSITION_END, function () {
536
+ $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
537
+ $(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
538
+ _this4._isSliding = false;
539
+ setTimeout(function () {
540
+ return $(_this4._element).trigger(slidEvent);
541
+ }, 0);
542
+ }).emulateTransitionEnd(transitionDuration);
543
+ } else {
544
+ $(activeElement).removeClass(ClassName.ACTIVE);
545
+ $(nextElement).addClass(ClassName.ACTIVE);
546
+ this._isSliding = false;
547
+ $(this._element).trigger(slidEvent);
548
+ }
549
+
550
+ if (isCycling) {
551
+ this.cycle();
552
+ }
553
+ }; // Static
494
554
 
495
- if (!target || !$$$1(target).hasClass(ClassName.CAROUSEL)) {
496
- return;
497
- }
498
555
 
499
- var config = _objectSpread({}, $$$1(target).data(), $$$1(this).data());
556
+ Carousel._jQueryInterface = function _jQueryInterface(config) {
557
+ return this.each(function () {
558
+ var data = $(this).data(DATA_KEY);
500
559
 
501
- var slideIndex = this.getAttribute('data-slide-to');
560
+ var _config = _objectSpread({}, Default, $(this).data());
502
561
 
503
- if (slideIndex) {
504
- config.interval = false;
562
+ if (typeof config === 'object') {
563
+ _config = _objectSpread({}, _config, config);
505
564
  }
506
565
 
507
- Carousel._jQueryInterface.call($$$1(target), config);
566
+ var action = typeof config === 'string' ? config : _config.slide;
508
567
 
509
- if (slideIndex) {
510
- $$$1(target).data(DATA_KEY).to(slideIndex);
568
+ if (!data) {
569
+ data = new Carousel(this, _config);
570
+ $(this).data(DATA_KEY, data);
511
571
  }
512
572
 
513
- event.preventDefault();
514
- };
573
+ if (typeof config === 'number') {
574
+ data.to(config);
575
+ } else if (typeof action === 'string') {
576
+ if (typeof data[action] === 'undefined') {
577
+ throw new TypeError("No method named \"" + action + "\"");
578
+ }
515
579
 
516
- _createClass(Carousel, null, [{
517
- key: "VERSION",
518
- get: function get() {
519
- return VERSION;
520
- }
521
- }, {
522
- key: "Default",
523
- get: function get() {
524
- return Default;
580
+ data[action]();
581
+ } else if (_config.interval) {
582
+ data.pause();
583
+ data.cycle();
525
584
  }
526
- }]);
585
+ });
586
+ };
527
587
 
528
- return Carousel;
529
- }();
530
- /**
531
- * ------------------------------------------------------------------------
532
- * Data Api implementation
533
- * ------------------------------------------------------------------------
534
- */
588
+ Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
589
+ var selector = Util.getSelectorFromElement(this);
535
590
 
591
+ if (!selector) {
592
+ return;
593
+ }
536
594
 
537
- $$$1(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
538
- $$$1(window).on(Event.LOAD_DATA_API, function () {
539
- var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
595
+ var target = $(selector)[0];
540
596
 
541
- for (var i = 0, len = carousels.length; i < len; i++) {
542
- var $carousel = $$$1(carousels[i]);
597
+ if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
598
+ return;
599
+ }
600
+
601
+ var config = _objectSpread({}, $(target).data(), $(this).data());
543
602
 
544
- Carousel._jQueryInterface.call($carousel, $carousel.data());
603
+ var slideIndex = this.getAttribute('data-slide-to');
604
+
605
+ if (slideIndex) {
606
+ config.interval = false;
545
607
  }
546
- });
547
- /**
548
- * ------------------------------------------------------------------------
549
- * jQuery
550
- * ------------------------------------------------------------------------
551
- */
552
608
 
553
- $$$1.fn[NAME] = Carousel._jQueryInterface;
554
- $$$1.fn[NAME].Constructor = Carousel;
609
+ Carousel._jQueryInterface.call($(target), config);
610
+
611
+ if (slideIndex) {
612
+ $(target).data(DATA_KEY).to(slideIndex);
613
+ }
555
614
 
556
- $$$1.fn[NAME].noConflict = function () {
557
- $$$1.fn[NAME] = JQUERY_NO_CONFLICT;
558
- return Carousel._jQueryInterface;
615
+ event.preventDefault();
559
616
  };
560
617
 
618
+ _createClass(Carousel, null, [{
619
+ key: "VERSION",
620
+ get: function get() {
621
+ return VERSION;
622
+ }
623
+ }, {
624
+ key: "Default",
625
+ get: function get() {
626
+ return Default;
627
+ }
628
+ }]);
629
+
561
630
  return Carousel;
562
- }($);
631
+ }();
632
+ /**
633
+ * ------------------------------------------------------------------------
634
+ * Data Api implementation
635
+ * ------------------------------------------------------------------------
636
+ */
637
+
638
+
639
+ $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
640
+ $(window).on(Event.LOAD_DATA_API, function () {
641
+ var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
642
+
643
+ for (var i = 0, len = carousels.length; i < len; i++) {
644
+ var $carousel = $(carousels[i]);
645
+
646
+ Carousel._jQueryInterface.call($carousel, $carousel.data());
647
+ }
648
+ });
649
+ /**
650
+ * ------------------------------------------------------------------------
651
+ * jQuery
652
+ * ------------------------------------------------------------------------
653
+ */
654
+
655
+ $.fn[NAME] = Carousel._jQueryInterface;
656
+ $.fn[NAME].Constructor = Carousel;
657
+
658
+ $.fn[NAME].noConflict = function () {
659
+ $.fn[NAME] = JQUERY_NO_CONFLICT;
660
+ return Carousel._jQueryInterface;
661
+ };
563
662
 
564
663
  return Carousel;
565
664