bootstrap 5.0.0.beta1 → 5.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/README.md +3 -3
  4. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  5. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  6. data/assets/javascripts/bootstrap-sprockets.js +3 -0
  7. data/assets/javascripts/bootstrap.js +429 -486
  8. data/assets/javascripts/bootstrap.min.js +3 -3
  9. data/assets/javascripts/bootstrap/alert.js +81 -80
  10. data/assets/javascripts/bootstrap/base-component.js +75 -0
  11. data/assets/javascripts/bootstrap/button.js +60 -72
  12. data/assets/javascripts/bootstrap/carousel.js +131 -110
  13. data/assets/javascripts/bootstrap/collapse.js +94 -77
  14. data/assets/javascripts/bootstrap/dom/data.js +3 -3
  15. data/assets/javascripts/bootstrap/dom/event-handler.js +6 -5
  16. data/assets/javascripts/bootstrap/dom/manipulator.js +3 -3
  17. data/assets/javascripts/bootstrap/dom/selector-engine.js +6 -11
  18. data/assets/javascripts/bootstrap/dropdown.js +159 -90
  19. data/assets/javascripts/bootstrap/modal.js +132 -125
  20. data/assets/javascripts/bootstrap/popover.js +73 -25
  21. data/assets/javascripts/bootstrap/scrollspy.js +93 -76
  22. data/assets/javascripts/bootstrap/tab.js +78 -82
  23. data/assets/javascripts/bootstrap/toast.js +79 -75
  24. data/assets/javascripts/bootstrap/tooltip.js +207 -185
  25. data/assets/stylesheets/_bootstrap-grid.scss +3 -3
  26. data/assets/stylesheets/_bootstrap-reboot.scss +3 -3
  27. data/assets/stylesheets/_bootstrap.scss +3 -3
  28. data/assets/stylesheets/bootstrap/_accordion.scss +1 -0
  29. data/assets/stylesheets/bootstrap/_alert.scss +6 -6
  30. data/assets/stylesheets/bootstrap/_carousel.scss +12 -6
  31. data/assets/stylesheets/bootstrap/_close.scss +1 -1
  32. data/assets/stylesheets/bootstrap/_dropdown.scss +29 -15
  33. data/assets/stylesheets/bootstrap/_list-group.scss +5 -5
  34. data/assets/stylesheets/bootstrap/_nav.scss +5 -0
  35. data/assets/stylesheets/bootstrap/_navbar.scss +12 -1
  36. data/assets/stylesheets/bootstrap/_pagination.scss +2 -2
  37. data/assets/stylesheets/bootstrap/_popover.scss +0 -15
  38. data/assets/stylesheets/bootstrap/_reboot.scss +6 -6
  39. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  40. data/assets/stylesheets/bootstrap/_toasts.scss +1 -0
  41. data/assets/stylesheets/bootstrap/_utilities.scss +6 -0
  42. data/assets/stylesheets/bootstrap/_variables.scss +30 -7
  43. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +5 -5
  44. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -0
  45. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  46. data/assets/stylesheets/bootstrap/forms/_form-select.scss +1 -2
  47. data/assets/stylesheets/bootstrap/forms/_validation.scss +1 -1
  48. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +2 -2
  49. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +1 -1
  50. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +4 -4
  51. data/assets/stylesheets/bootstrap/mixins/_forms.scss +13 -6
  52. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +4 -0
  53. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +3 -2
  54. data/assets/stylesheets/bootstrap/utilities/_api.scss +1 -1
  55. data/bootstrap.gemspec +1 -3
  56. data/lib/bootstrap/version.rb +2 -2
  57. data/tasks/updater/js.rb +15 -2
  58. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  59. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  60. data/test/dummy_rails/app/views/pages/root.html +89 -0
  61. data/test/dummy_rails/config/application.rb +0 -3
  62. data/test/gemfiles/rails_6_1.gemfile +7 -0
  63. metadata +13 -36
  64. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
@@ -1,23 +1,74 @@
1
1
  /*!
2
- * Bootstrap toast.js v5.0.0-beta1 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap toast.js v5.0.0-beta2 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator));
10
- }(this, (function (Data, EventHandler, Manipulator) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator, global.Base));
10
+ }(this, (function (Data, EventHandler, Manipulator, BaseComponent) { 'use strict';
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
14
14
  var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
15
  var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
16
  var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
17
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
18
+
19
+ function _defineProperties(target, props) {
20
+ for (var i = 0; i < props.length; i++) {
21
+ var descriptor = props[i];
22
+ descriptor.enumerable = descriptor.enumerable || false;
23
+ descriptor.configurable = true;
24
+ if ("value" in descriptor) descriptor.writable = true;
25
+ Object.defineProperty(target, descriptor.key, descriptor);
26
+ }
27
+ }
28
+
29
+ function _createClass(Constructor, protoProps, staticProps) {
30
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
31
+ if (staticProps) _defineProperties(Constructor, staticProps);
32
+ return Constructor;
33
+ }
34
+
35
+ function _extends() {
36
+ _extends = Object.assign || function (target) {
37
+ for (var i = 1; i < arguments.length; i++) {
38
+ var source = arguments[i];
39
+
40
+ for (var key in source) {
41
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
42
+ target[key] = source[key];
43
+ }
44
+ }
45
+ }
46
+
47
+ return target;
48
+ };
49
+
50
+ return _extends.apply(this, arguments);
51
+ }
52
+
53
+ function _inheritsLoose(subClass, superClass) {
54
+ subClass.prototype = Object.create(superClass.prototype);
55
+ subClass.prototype.constructor = subClass;
56
+
57
+ _setPrototypeOf(subClass, superClass);
58
+ }
59
+
60
+ function _setPrototypeOf(o, p) {
61
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
62
+ o.__proto__ = p;
63
+ return o;
64
+ };
65
+
66
+ return _setPrototypeOf(o, p);
67
+ }
17
68
 
18
69
  /**
19
70
  * --------------------------------------------------------------------------
20
- * Bootstrap (v5.0.0-beta1): util/index.js
71
+ * Bootstrap (v5.0.0-beta2): util/index.js
21
72
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
22
73
  * --------------------------------------------------------------------------
23
74
  */
@@ -88,7 +139,7 @@
88
139
  var valueType = value && isElement(value) ? 'element' : toType(value);
89
140
 
90
141
  if (!new RegExp(expectedTypes).test(valueType)) {
91
- throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
142
+ throw new TypeError(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
92
143
  }
93
144
  });
94
145
  };
@@ -116,59 +167,26 @@
116
167
  }
117
168
  };
118
169
 
119
- var isRTL = document.documentElement.dir === 'rtl';
120
-
121
- 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); } }
122
-
123
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
124
- /**
125
- * ------------------------------------------------------------------------
126
- * Constants
127
- * ------------------------------------------------------------------------
128
- */
129
-
130
- var VERSION = '5.0.0-beta1';
131
-
132
- var BaseComponent = /*#__PURE__*/function () {
133
- function BaseComponent(element) {
134
- if (!element) {
135
- return;
136
- }
170
+ document.documentElement.dir === 'rtl';
137
171
 
138
- this._element = element;
139
- Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
140
- }
172
+ var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
173
+ onDOMContentLoaded(function () {
174
+ var $ = getjQuery();
175
+ /* istanbul ignore if */
141
176
 
142
- var _proto = BaseComponent.prototype;
177
+ if ($) {
178
+ var JQUERY_NO_CONFLICT = $.fn[name];
179
+ $.fn[name] = plugin.jQueryInterface;
180
+ $.fn[name].Constructor = plugin;
143
181
 
144
- _proto.dispose = function dispose() {
145
- Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
146
- this._element = null;
147
- }
148
- /** Static */
149
- ;
150
-
151
- BaseComponent.getInstance = function getInstance(element) {
152
- return Data__default['default'].getData(element, this.DATA_KEY);
153
- };
154
-
155
- _createClass(BaseComponent, null, [{
156
- key: "VERSION",
157
- get: function get() {
158
- return VERSION;
182
+ $.fn[name].noConflict = function () {
183
+ $.fn[name] = JQUERY_NO_CONFLICT;
184
+ return plugin.jQueryInterface;
185
+ };
159
186
  }
160
- }]);
161
-
162
- return BaseComponent;
163
- }();
164
-
165
- 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); }
166
-
167
- function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
168
-
169
- function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
187
+ });
188
+ };
170
189
 
171
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
172
190
  /**
173
191
  * ------------------------------------------------------------------------
174
192
  * Constants
@@ -260,7 +278,7 @@
260
278
 
261
279
  if (this._config.animation) {
262
280
  var transitionDuration = getTransitionDurationFromElement(this._element);
263
- EventHandler__default['default'].one(this._element, TRANSITION_END, complete);
281
+ EventHandler__default['default'].one(this._element, 'transitionend', complete);
264
282
  emulateTransitionEnd(this._element, transitionDuration);
265
283
  } else {
266
284
  complete();
@@ -290,7 +308,7 @@
290
308
 
291
309
  if (this._config.animation) {
292
310
  var transitionDuration = getTransitionDurationFromElement(this._element);
293
- EventHandler__default['default'].one(this._element, TRANSITION_END, complete);
311
+ EventHandler__default['default'].one(this._element, 'transitionend', complete);
294
312
  emulateTransitionEnd(this._element, transitionDuration);
295
313
  } else {
296
314
  complete();
@@ -352,7 +370,7 @@
352
370
  });
353
371
  };
354
372
 
355
- _createClass$1(Toast, null, [{
373
+ _createClass(Toast, null, [{
356
374
  key: "DefaultType",
357
375
  get: function get() {
358
376
  return DefaultType;
@@ -370,7 +388,7 @@
370
388
  }]);
371
389
 
372
390
  return Toast;
373
- }(BaseComponent);
391
+ }(BaseComponent__default['default']);
374
392
  /**
375
393
  * ------------------------------------------------------------------------
376
394
  * jQuery
@@ -379,21 +397,7 @@
379
397
  */
380
398
 
381
399
 
382
- onDOMContentLoaded(function () {
383
- var $ = getjQuery();
384
- /* istanbul ignore if */
385
-
386
- if ($) {
387
- var JQUERY_NO_CONFLICT = $.fn[NAME];
388
- $.fn[NAME] = Toast.jQueryInterface;
389
- $.fn[NAME].Constructor = Toast;
390
-
391
- $.fn[NAME].noConflict = function () {
392
- $.fn[NAME] = JQUERY_NO_CONFLICT;
393
- return Toast.jQueryInterface;
394
- };
395
- }
396
- });
400
+ defineJQueryPlugin(NAME, Toast);
397
401
 
398
402
  return Toast;
399
403
 
@@ -1,13 +1,13 @@
1
1
  /*!
2
- * Bootstrap tooltip.js v5.0.0-beta1 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap tooltip.js v5.0.0-beta2 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
8
- typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Popper, global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
10
- }(this, (function (Popper, Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
8
+ typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Popper, global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
10
+ }(this, (function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
@@ -36,10 +36,61 @@
36
36
  var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
37
37
  var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
38
38
  var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
39
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
40
+
41
+ function _defineProperties(target, props) {
42
+ for (var i = 0; i < props.length; i++) {
43
+ var descriptor = props[i];
44
+ descriptor.enumerable = descriptor.enumerable || false;
45
+ descriptor.configurable = true;
46
+ if ("value" in descriptor) descriptor.writable = true;
47
+ Object.defineProperty(target, descriptor.key, descriptor);
48
+ }
49
+ }
50
+
51
+ function _createClass(Constructor, protoProps, staticProps) {
52
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
53
+ if (staticProps) _defineProperties(Constructor, staticProps);
54
+ return Constructor;
55
+ }
56
+
57
+ function _extends() {
58
+ _extends = Object.assign || function (target) {
59
+ for (var i = 1; i < arguments.length; i++) {
60
+ var source = arguments[i];
61
+
62
+ for (var key in source) {
63
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
64
+ target[key] = source[key];
65
+ }
66
+ }
67
+ }
68
+
69
+ return target;
70
+ };
71
+
72
+ return _extends.apply(this, arguments);
73
+ }
74
+
75
+ function _inheritsLoose(subClass, superClass) {
76
+ subClass.prototype = Object.create(superClass.prototype);
77
+ subClass.prototype.constructor = subClass;
78
+
79
+ _setPrototypeOf(subClass, superClass);
80
+ }
81
+
82
+ function _setPrototypeOf(o, p) {
83
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
84
+ o.__proto__ = p;
85
+ return o;
86
+ };
87
+
88
+ return _setPrototypeOf(o, p);
89
+ }
39
90
 
40
91
  /**
41
92
  * --------------------------------------------------------------------------
42
- * Bootstrap (v5.0.0-beta1): util/index.js
93
+ * Bootstrap (v5.0.0-beta2): util/index.js
43
94
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
44
95
  * --------------------------------------------------------------------------
45
96
  */
@@ -125,7 +176,7 @@
125
176
  var valueType = value && isElement(value) ? 'element' : toType(value);
126
177
 
127
178
  if (!new RegExp(expectedTypes).test(valueType)) {
128
- throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
179
+ throw new TypeError(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
129
180
  }
130
181
  });
131
182
  };
@@ -178,9 +229,27 @@
178
229
 
179
230
  var isRTL = document.documentElement.dir === 'rtl';
180
231
 
232
+ var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
233
+ onDOMContentLoaded(function () {
234
+ var $ = getjQuery();
235
+ /* istanbul ignore if */
236
+
237
+ if ($) {
238
+ var JQUERY_NO_CONFLICT = $.fn[name];
239
+ $.fn[name] = plugin.jQueryInterface;
240
+ $.fn[name].Constructor = plugin;
241
+
242
+ $.fn[name].noConflict = function () {
243
+ $.fn[name] = JQUERY_NO_CONFLICT;
244
+ return plugin.jQueryInterface;
245
+ };
246
+ }
247
+ });
248
+ };
249
+
181
250
  /**
182
251
  * --------------------------------------------------------------------------
183
- * Bootstrap (v5.0.0-beta1): util/sanitizer.js
252
+ * Bootstrap (v5.0.0-beta2): util/sanitizer.js
184
253
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
185
254
  * --------------------------------------------------------------------------
186
255
  */
@@ -206,7 +275,7 @@
206
275
 
207
276
  if (allowedAttributeList.includes(attrName)) {
208
277
  if (uriAttrs.has(attrName)) {
209
- return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
278
+ return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
210
279
  }
211
280
 
212
281
  return true;
@@ -217,7 +286,7 @@
217
286
  }); // Check if a regular expression validates the attribute.
218
287
 
219
288
  for (var i = 0, len = regExp.length; i < len; i++) {
220
- if (attrName.match(regExp[i])) {
289
+ if (regExp[i].test(attrName)) {
221
290
  return true;
222
291
  }
223
292
  }
@@ -305,57 +374,6 @@
305
374
  return createdDocument.body.innerHTML;
306
375
  }
307
376
 
308
- 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); } }
309
-
310
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
311
- /**
312
- * ------------------------------------------------------------------------
313
- * Constants
314
- * ------------------------------------------------------------------------
315
- */
316
-
317
- var VERSION = '5.0.0-beta1';
318
-
319
- var BaseComponent = /*#__PURE__*/function () {
320
- function BaseComponent(element) {
321
- if (!element) {
322
- return;
323
- }
324
-
325
- this._element = element;
326
- Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
327
- }
328
-
329
- var _proto = BaseComponent.prototype;
330
-
331
- _proto.dispose = function dispose() {
332
- Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
333
- this._element = null;
334
- }
335
- /** Static */
336
- ;
337
-
338
- BaseComponent.getInstance = function getInstance(element) {
339
- return Data__default['default'].getData(element, this.DATA_KEY);
340
- };
341
-
342
- _createClass(BaseComponent, null, [{
343
- key: "VERSION",
344
- get: function get() {
345
- return VERSION;
346
- }
347
- }]);
348
-
349
- return BaseComponent;
350
- }();
351
-
352
- 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); }
353
-
354
- function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
355
-
356
- function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
357
-
358
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
359
377
  /**
360
378
  * ------------------------------------------------------------------------
361
379
  * Constants
@@ -377,14 +395,15 @@
377
395
  html: 'boolean',
378
396
  selector: '(string|boolean)',
379
397
  placement: '(string|function)',
398
+ offset: '(array|string|function)',
380
399
  container: '(string|element|boolean)',
381
- fallbackPlacements: '(null|array)',
400
+ fallbackPlacements: 'array',
382
401
  boundary: '(string|element)',
383
402
  customClass: '(string|function)',
384
403
  sanitize: 'boolean',
385
404
  sanitizeFn: '(null|function)',
386
405
  allowList: 'object',
387
- popperConfig: '(null|object)'
406
+ popperConfig: '(null|object|function)'
388
407
  };
389
408
  var AttachmentMap = {
390
409
  AUTO: 'auto',
@@ -402,8 +421,9 @@
402
421
  html: false,
403
422
  selector: false,
404
423
  placement: 'top',
424
+ offset: [0, 0],
405
425
  container: false,
406
- fallbackPlacements: null,
426
+ fallbackPlacements: ['top', 'right', 'bottom', 'left'],
407
427
  boundary: 'clippingParents',
408
428
  customClass: '',
409
429
  sanitize: true,
@@ -487,13 +507,7 @@
487
507
  }
488
508
 
489
509
  if (event) {
490
- var dataKey = this.constructor.DATA_KEY;
491
- var context = Data__default['default'].getData(event.delegateTarget, dataKey);
492
-
493
- if (!context) {
494
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
495
- Data__default['default'].setData(event.delegateTarget, dataKey, context);
496
- }
510
+ var context = this._initializeOnDelegatedTarget(event);
497
511
 
498
512
  context._activeTrigger.click = !context._activeTrigger.click;
499
513
 
@@ -518,7 +532,7 @@
518
532
  EventHandler__default['default'].off(this._element, this.constructor.EVENT_KEY);
519
533
  EventHandler__default['default'].off(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
520
534
 
521
- if (this.tip) {
535
+ if (this.tip && this.tip.parentNode) {
522
536
  this.tip.parentNode.removeChild(this.tip);
523
537
  }
524
538
 
@@ -545,81 +559,83 @@
545
559
  throw new Error('Please use show on visible elements');
546
560
  }
547
561
 
548
- if (this.isWithContent() && this._isEnabled) {
549
- var showEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.SHOW);
550
- var shadowRoot = findShadowRoot(this._element);
551
- var isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
562
+ if (!(this.isWithContent() && this._isEnabled)) {
563
+ return;
564
+ }
552
565
 
553
- if (showEvent.defaultPrevented || !isInTheDom) {
554
- return;
555
- }
566
+ var showEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.SHOW);
567
+ var shadowRoot = findShadowRoot(this._element);
568
+ var isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
556
569
 
557
- var tip = this.getTipElement();
558
- var tipId = getUID(this.constructor.NAME);
559
- tip.setAttribute('id', tipId);
570
+ if (showEvent.defaultPrevented || !isInTheDom) {
571
+ return;
572
+ }
560
573
 
561
- this._element.setAttribute('aria-describedby', tipId);
574
+ var tip = this.getTipElement();
575
+ var tipId = getUID(this.constructor.NAME);
576
+ tip.setAttribute('id', tipId);
562
577
 
563
- this.setContent();
578
+ this._element.setAttribute('aria-describedby', tipId);
564
579
 
565
- if (this.config.animation) {
566
- tip.classList.add(CLASS_NAME_FADE);
567
- }
580
+ this.setContent();
568
581
 
569
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
582
+ if (this.config.animation) {
583
+ tip.classList.add(CLASS_NAME_FADE);
584
+ }
570
585
 
571
- var attachment = this._getAttachment(placement);
586
+ var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
572
587
 
573
- this._addAttachmentClass(attachment);
588
+ var attachment = this._getAttachment(placement);
574
589
 
575
- var container = this._getContainer();
590
+ this._addAttachmentClass(attachment);
576
591
 
577
- Data__default['default'].setData(tip, this.constructor.DATA_KEY, this);
592
+ var container = this._getContainer();
578
593
 
579
- if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
580
- container.appendChild(tip);
581
- }
594
+ Data__default['default'].setData(tip, this.constructor.DATA_KEY, this);
582
595
 
583
- EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
584
- this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
585
- tip.classList.add(CLASS_NAME_SHOW);
586
- var customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
596
+ if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
597
+ container.appendChild(tip);
598
+ }
587
599
 
588
- if (customClass) {
589
- var _tip$classList;
600
+ EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
601
+ this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
602
+ tip.classList.add(CLASS_NAME_SHOW);
603
+ var customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
590
604
 
591
- (_tip$classList = tip.classList).add.apply(_tip$classList, customClass.split(' '));
592
- } // If this is a touch-enabled device we add extra
593
- // empty mouseover listeners to the body's immediate children;
594
- // only needed because of broken event delegation on iOS
595
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
605
+ if (customClass) {
606
+ var _tip$classList;
596
607
 
608
+ (_tip$classList = tip.classList).add.apply(_tip$classList, customClass.split(' '));
609
+ } // If this is a touch-enabled device we add extra
610
+ // empty mouseover listeners to the body's immediate children;
611
+ // only needed because of broken event delegation on iOS
612
+ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
597
613
 
598
- if ('ontouchstart' in document.documentElement) {
599
- var _ref;
600
614
 
601
- (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
602
- EventHandler__default['default'].on(element, 'mouseover', noop());
603
- });
604
- }
615
+ if ('ontouchstart' in document.documentElement) {
616
+ var _ref;
605
617
 
606
- var complete = function complete() {
607
- var prevHoverState = _this2._hoverState;
608
- _this2._hoverState = null;
609
- EventHandler__default['default'].trigger(_this2._element, _this2.constructor.Event.SHOWN);
618
+ (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
619
+ EventHandler__default['default'].on(element, 'mouseover', noop());
620
+ });
621
+ }
610
622
 
611
- if (prevHoverState === HOVER_STATE_OUT) {
612
- _this2._leave(null, _this2);
613
- }
614
- };
623
+ var complete = function complete() {
624
+ var prevHoverState = _this2._hoverState;
625
+ _this2._hoverState = null;
626
+ EventHandler__default['default'].trigger(_this2._element, _this2.constructor.Event.SHOWN);
615
627
 
616
- if (this.tip.classList.contains(CLASS_NAME_FADE)) {
617
- var transitionDuration = getTransitionDurationFromElement(this.tip);
618
- EventHandler__default['default'].one(this.tip, TRANSITION_END, complete);
619
- emulateTransitionEnd(this.tip, transitionDuration);
620
- } else {
621
- complete();
628
+ if (prevHoverState === HOVER_STATE_OUT) {
629
+ _this2._leave(null, _this2);
622
630
  }
631
+ };
632
+
633
+ if (this.tip.classList.contains(CLASS_NAME_FADE)) {
634
+ var transitionDuration = getTransitionDurationFromElement(this.tip);
635
+ EventHandler__default['default'].one(this.tip, 'transitionend', complete);
636
+ emulateTransitionEnd(this.tip, transitionDuration);
637
+ } else {
638
+ complete();
623
639
  }
624
640
  };
625
641
 
@@ -673,7 +689,7 @@
673
689
 
674
690
  if (this.tip.classList.contains(CLASS_NAME_FADE)) {
675
691
  var transitionDuration = getTransitionDurationFromElement(tip);
676
- EventHandler__default['default'].one(tip, TRANSITION_END, complete);
692
+ EventHandler__default['default'].one(tip, 'transitionend', complete);
677
693
  emulateTransitionEnd(tip, transitionDuration);
678
694
  } else {
679
695
  complete();
@@ -767,26 +783,58 @@
767
783
  } // Private
768
784
  ;
769
785
 
770
- _proto._getPopperConfig = function _getPopperConfig(attachment) {
786
+ _proto._initializeOnDelegatedTarget = function _initializeOnDelegatedTarget(event, context) {
787
+ var dataKey = this.constructor.DATA_KEY;
788
+ context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
789
+
790
+ if (!context) {
791
+ context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
792
+ Data__default['default'].setData(event.delegateTarget, dataKey, context);
793
+ }
794
+
795
+ return context;
796
+ };
797
+
798
+ _proto._getOffset = function _getOffset() {
771
799
  var _this4 = this;
772
800
 
773
- var flipModifier = {
774
- name: 'flip',
775
- options: {
776
- altBoundary: true
777
- }
778
- };
801
+ var offset = this.config.offset;
779
802
 
780
- if (this.config.fallbackPlacements) {
781
- flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
803
+ if (typeof offset === 'string') {
804
+ return offset.split(',').map(function (val) {
805
+ return Number.parseInt(val, 10);
806
+ });
782
807
  }
783
808
 
784
- var defaultBsConfig = {
809
+ if (typeof offset === 'function') {
810
+ return function (popperData) {
811
+ return offset(popperData, _this4._element);
812
+ };
813
+ }
814
+
815
+ return offset;
816
+ };
817
+
818
+ _proto._getPopperConfig = function _getPopperConfig(attachment) {
819
+ var _this5 = this;
820
+
821
+ var defaultBsPopperConfig = {
785
822
  placement: attachment,
786
- modifiers: [flipModifier, {
823
+ modifiers: [{
824
+ name: 'flip',
825
+ options: {
826
+ altBoundary: true,
827
+ fallbackPlacements: this.config.fallbackPlacements
828
+ }
829
+ }, {
830
+ name: 'offset',
831
+ options: {
832
+ offset: this._getOffset()
833
+ }
834
+ }, {
787
835
  name: 'preventOverflow',
788
836
  options: {
789
- rootBoundary: this.config.boundary
837
+ boundary: this.config.boundary
790
838
  }
791
839
  }, {
792
840
  name: 'arrow',
@@ -798,16 +846,16 @@
798
846
  enabled: true,
799
847
  phase: 'afterWrite',
800
848
  fn: function fn(data) {
801
- return _this4._handlePopperPlacementChange(data);
849
+ return _this5._handlePopperPlacementChange(data);
802
850
  }
803
851
  }],
804
852
  onFirstUpdate: function onFirstUpdate(data) {
805
853
  if (data.options.placement !== data.placement) {
806
- _this4._handlePopperPlacementChange(data);
854
+ _this5._handlePopperPlacementChange(data);
807
855
  }
808
856
  }
809
857
  };
810
- return _extends({}, defaultBsConfig, this.config.popperConfig);
858
+ return _extends({}, defaultBsPopperConfig, typeof this.config.popperConfig === 'function' ? this.config.popperConfig(defaultBsPopperConfig) : this.config.popperConfig);
811
859
  };
812
860
 
813
861
  _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
@@ -831,29 +879,29 @@
831
879
  };
832
880
 
833
881
  _proto._setListeners = function _setListeners() {
834
- var _this5 = this;
882
+ var _this6 = this;
835
883
 
836
884
  var triggers = this.config.trigger.split(' ');
837
885
  triggers.forEach(function (trigger) {
838
886
  if (trigger === 'click') {
839
- EventHandler__default['default'].on(_this5._element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
840
- return _this5.toggle(event);
887
+ EventHandler__default['default'].on(_this6._element, _this6.constructor.Event.CLICK, _this6.config.selector, function (event) {
888
+ return _this6.toggle(event);
841
889
  });
842
890
  } else if (trigger !== TRIGGER_MANUAL) {
843
- var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
844
- var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
845
- EventHandler__default['default'].on(_this5._element, eventIn, _this5.config.selector, function (event) {
846
- return _this5._enter(event);
891
+ var eventIn = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSEENTER : _this6.constructor.Event.FOCUSIN;
892
+ var eventOut = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSELEAVE : _this6.constructor.Event.FOCUSOUT;
893
+ EventHandler__default['default'].on(_this6._element, eventIn, _this6.config.selector, function (event) {
894
+ return _this6._enter(event);
847
895
  });
848
- EventHandler__default['default'].on(_this5._element, eventOut, _this5.config.selector, function (event) {
849
- return _this5._leave(event);
896
+ EventHandler__default['default'].on(_this6._element, eventOut, _this6.config.selector, function (event) {
897
+ return _this6._leave(event);
850
898
  });
851
899
  }
852
900
  });
853
901
 
854
902
  this._hideModalHandler = function () {
855
- if (_this5._element) {
856
- _this5.hide();
903
+ if (_this6._element) {
904
+ _this6.hide();
857
905
  }
858
906
  };
859
907
 
@@ -886,13 +934,7 @@
886
934
  };
887
935
 
888
936
  _proto._enter = function _enter(event, context) {
889
- var dataKey = this.constructor.DATA_KEY;
890
- context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
891
-
892
- if (!context) {
893
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
894
- Data__default['default'].setData(event.delegateTarget, dataKey, context);
895
- }
937
+ context = this._initializeOnDelegatedTarget(event, context);
896
938
 
897
939
  if (event) {
898
940
  context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
@@ -919,13 +961,7 @@
919
961
  };
920
962
 
921
963
  _proto._leave = function _leave(event, context) {
922
- var dataKey = this.constructor.DATA_KEY;
923
- context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
924
-
925
- if (!context) {
926
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
927
- Data__default['default'].setData(event.delegateTarget, dataKey, context);
928
- }
964
+ context = this._initializeOnDelegatedTarget(event, context);
929
965
 
930
966
  if (event) {
931
967
  context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
@@ -1064,7 +1100,7 @@
1064
1100
  });
1065
1101
  };
1066
1102
 
1067
- _createClass$1(Tooltip, null, [{
1103
+ _createClass(Tooltip, null, [{
1068
1104
  key: "Default",
1069
1105
  get: function get() {
1070
1106
  return Default;
@@ -1097,7 +1133,7 @@
1097
1133
  }]);
1098
1134
 
1099
1135
  return Tooltip;
1100
- }(BaseComponent);
1136
+ }(BaseComponent__default['default']);
1101
1137
  /**
1102
1138
  * ------------------------------------------------------------------------
1103
1139
  * jQuery
@@ -1106,21 +1142,7 @@
1106
1142
  */
1107
1143
 
1108
1144
 
1109
- onDOMContentLoaded(function () {
1110
- var $ = getjQuery();
1111
- /* istanbul ignore if */
1112
-
1113
- if ($) {
1114
- var JQUERY_NO_CONFLICT = $.fn[NAME];
1115
- $.fn[NAME] = Tooltip.jQueryInterface;
1116
- $.fn[NAME].Constructor = Tooltip;
1117
-
1118
- $.fn[NAME].noConflict = function () {
1119
- $.fn[NAME] = JQUERY_NO_CONFLICT;
1120
- return Tooltip.jQueryInterface;
1121
- };
1122
- }
1123
- });
1145
+ defineJQueryPlugin(NAME, Tooltip);
1124
1146
 
1125
1147
  return Tooltip;
1126
1148