bootstrap 5.0.0.alpha2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/README.md +7 -4
  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 +10 -7
  7. data/assets/javascripts/bootstrap.js +2554 -2564
  8. data/assets/javascripts/bootstrap.min.js +3 -3
  9. data/assets/javascripts/bootstrap/alert.js +119 -115
  10. data/assets/javascripts/bootstrap/base-component.js +63 -0
  11. data/assets/javascripts/bootstrap/button.js +67 -69
  12. data/assets/javascripts/bootstrap/carousel.js +340 -331
  13. data/assets/javascripts/bootstrap/collapse.js +214 -209
  14. data/assets/javascripts/bootstrap/dom/data.js +35 -48
  15. data/assets/javascripts/bootstrap/dom/event-handler.js +105 -98
  16. data/assets/javascripts/bootstrap/dom/manipulator.js +26 -34
  17. data/assets/javascripts/bootstrap/dom/selector-engine.js +28 -41
  18. data/assets/javascripts/bootstrap/dropdown.js +392 -325
  19. data/assets/javascripts/bootstrap/modal.js +492 -434
  20. data/assets/javascripts/bootstrap/offcanvas.js +671 -0
  21. data/assets/javascripts/bootstrap/popover.js +114 -132
  22. data/assets/javascripts/bootstrap/scrollspy.js +172 -180
  23. data/assets/javascripts/bootstrap/tab.js +168 -144
  24. data/assets/javascripts/bootstrap/toast.js +141 -150
  25. data/assets/javascripts/bootstrap/tooltip.js +466 -452
  26. data/assets/stylesheets/_bootstrap-grid.scss +9 -9
  27. data/assets/stylesheets/_bootstrap-reboot.scss +3 -3
  28. data/assets/stylesheets/_bootstrap.scss +5 -3
  29. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  30. data/assets/stylesheets/bootstrap/_alert.scss +10 -3
  31. data/assets/stylesheets/bootstrap/_breadcrumb.scss +2 -4
  32. data/assets/stylesheets/bootstrap/_button-group.scss +5 -7
  33. data/assets/stylesheets/bootstrap/_buttons.scss +2 -15
  34. data/assets/stylesheets/bootstrap/_card.scss +2 -29
  35. data/assets/stylesheets/bootstrap/_carousel.scss +35 -18
  36. data/assets/stylesheets/bootstrap/_close.scss +2 -3
  37. data/assets/stylesheets/bootstrap/_dropdown.scss +33 -29
  38. data/assets/stylesheets/bootstrap/_forms.scss +1 -1
  39. data/assets/stylesheets/bootstrap/_functions.scss +11 -12
  40. data/assets/stylesheets/bootstrap/_list-group.scss +23 -6
  41. data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
  42. data/assets/stylesheets/bootstrap/_modal.scss +2 -9
  43. data/assets/stylesheets/bootstrap/_nav.scss +12 -0
  44. data/assets/stylesheets/bootstrap/_navbar.scss +15 -2
  45. data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
  46. data/assets/stylesheets/bootstrap/_pagination.scss +3 -3
  47. data/assets/stylesheets/bootstrap/_popover.scss +10 -22
  48. data/assets/stylesheets/bootstrap/_progress.scss +4 -1
  49. data/assets/stylesheets/bootstrap/_reboot.scss +48 -44
  50. data/assets/stylesheets/bootstrap/_root.scss +5 -5
  51. data/assets/stylesheets/bootstrap/_spinners.scss +18 -5
  52. data/assets/stylesheets/bootstrap/_tables.scss +15 -16
  53. data/assets/stylesheets/bootstrap/_toasts.scss +15 -12
  54. data/assets/stylesheets/bootstrap/_tooltip.scss +12 -12
  55. data/assets/stylesheets/bootstrap/_transitions.scss +2 -0
  56. data/assets/stylesheets/bootstrap/_utilities.scss +133 -70
  57. data/assets/stylesheets/bootstrap/_variables.scss +363 -207
  58. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +5 -5
  59. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
  60. data/assets/stylesheets/bootstrap/forms/_form-check.scss +21 -11
  61. data/assets/stylesheets/bootstrap/forms/_form-control.scss +112 -9
  62. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -46
  63. data/assets/stylesheets/bootstrap/forms/_form-select.scss +1 -16
  64. data/assets/stylesheets/bootstrap/forms/_input-group.scss +21 -40
  65. data/assets/stylesheets/bootstrap/forms/_validation.scss +1 -1
  66. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +2 -2
  67. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +2 -2
  68. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +1 -1
  69. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -1
  70. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +8 -6
  71. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +10 -5
  72. data/assets/stylesheets/bootstrap/mixins/_caret.scss +8 -6
  73. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  74. data/assets/stylesheets/bootstrap/mixins/_container.scss +2 -4
  75. data/assets/stylesheets/bootstrap/mixins/_forms.scss +26 -22
  76. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +5 -1
  77. data/assets/stylesheets/bootstrap/mixins/_grid.scss +18 -13
  78. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +3 -1
  79. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +5 -3
  80. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +7 -7
  81. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +19 -0
  82. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +3 -2
  83. data/assets/stylesheets/bootstrap/utilities/_api.scss +1 -1
  84. data/bootstrap.gemspec +1 -3
  85. data/lib/bootstrap/version.rb +2 -2
  86. data/tasks/updater/js.rb +20 -5
  87. data/tasks/updater/network.rb +7 -1
  88. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  89. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  90. data/test/dummy_rails/app/views/pages/root.html +89 -0
  91. data/test/dummy_rails/config/application.rb +0 -3
  92. data/test/gemfiles/rails_6_1.gemfile +7 -0
  93. metadata +20 -40
  94. data/assets/javascripts/bootstrap/dom/polyfill.js +0 -110
  95. data/assets/stylesheets/bootstrap/forms/_form-file.scss +0 -91
  96. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
@@ -1,35 +1,56 @@
1
1
  /*!
2
- * Bootstrap tooltip.js v5.0.0-alpha2 (https://getbootstrap.com/)
3
- * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap tooltip.js v5.0.0 (https://getbootstrap.com/)
3
+ * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
10
- }(this, (function (Data, EventHandler, Manipulator, Popper, 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
 
14
+ function _interopNamespace(e) {
15
+ if (e && e.__esModule) return e;
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () {
24
+ return e[k];
25
+ }
26
+ });
27
+ }
28
+ });
29
+ }
30
+ n['default'] = e;
31
+ return Object.freeze(n);
32
+ }
33
+
34
+ var Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
14
35
  var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
36
  var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
37
  var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
17
- var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
18
38
  var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
39
+ var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
19
40
 
20
41
  /**
21
42
  * --------------------------------------------------------------------------
22
- * Bootstrap (v5.0.0-alpha2): util/index.js
43
+ * Bootstrap (v5.0.0): util/index.js
23
44
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
24
45
  * --------------------------------------------------------------------------
25
46
  */
26
- var MAX_UID = 1000000;
27
- var MILLISECONDS_MULTIPLIER = 1000;
28
- var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
47
+ const MAX_UID = 1000000;
48
+ const MILLISECONDS_MULTIPLIER = 1000;
49
+ const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
29
50
 
30
- var toType = function toType(obj) {
51
+ const toType = obj => {
31
52
  if (obj === null || obj === undefined) {
32
- return "" + obj;
53
+ return `${obj}`;
33
54
  }
34
55
 
35
56
  return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
@@ -41,7 +62,7 @@
41
62
  */
42
63
 
43
64
 
44
- var getUID = function getUID(prefix) {
65
+ const getUID = prefix => {
45
66
  do {
46
67
  prefix += Math.floor(Math.random() * MAX_UID);
47
68
  } while (document.getElementById(prefix));
@@ -49,18 +70,18 @@
49
70
  return prefix;
50
71
  };
51
72
 
52
- var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) {
73
+ const getTransitionDurationFromElement = element => {
53
74
  if (!element) {
54
75
  return 0;
55
76
  } // Get transition-duration of the element
56
77
 
57
78
 
58
- var _window$getComputedSt = window.getComputedStyle(element),
59
- transitionDuration = _window$getComputedSt.transitionDuration,
60
- transitionDelay = _window$getComputedSt.transitionDelay;
61
-
62
- var floatTransitionDuration = parseFloat(transitionDuration);
63
- var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
79
+ let {
80
+ transitionDuration,
81
+ transitionDelay
82
+ } = window.getComputedStyle(element);
83
+ const floatTransitionDuration = Number.parseFloat(transitionDuration);
84
+ const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
64
85
 
65
86
  if (!floatTransitionDuration && !floatTransitionDelay) {
66
87
  return 0;
@@ -69,21 +90,19 @@
69
90
 
70
91
  transitionDuration = transitionDuration.split(',')[0];
71
92
  transitionDelay = transitionDelay.split(',')[0];
72
- return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
93
+ return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
73
94
  };
74
95
 
75
- var triggerTransitionEnd = function triggerTransitionEnd(element) {
96
+ const triggerTransitionEnd = element => {
76
97
  element.dispatchEvent(new Event(TRANSITION_END));
77
98
  };
78
99
 
79
- var isElement = function isElement(obj) {
80
- return (obj[0] || obj).nodeType;
81
- };
100
+ const isElement = obj => (obj[0] || obj).nodeType;
82
101
 
83
- var emulateTransitionEnd = function emulateTransitionEnd(element, duration) {
84
- var called = false;
85
- var durationPadding = 5;
86
- var emulatedDuration = duration + durationPadding;
102
+ const emulateTransitionEnd = (element, duration) => {
103
+ let called = false;
104
+ const durationPadding = 5;
105
+ const emulatedDuration = duration + durationPadding;
87
106
 
88
107
  function listener() {
89
108
  called = true;
@@ -91,33 +110,33 @@
91
110
  }
92
111
 
93
112
  element.addEventListener(TRANSITION_END, listener);
94
- setTimeout(function () {
113
+ setTimeout(() => {
95
114
  if (!called) {
96
115
  triggerTransitionEnd(element);
97
116
  }
98
117
  }, emulatedDuration);
99
118
  };
100
119
 
101
- var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) {
102
- Object.keys(configTypes).forEach(function (property) {
103
- var expectedTypes = configTypes[property];
104
- var value = config[property];
105
- var valueType = value && isElement(value) ? 'element' : toType(value);
120
+ const typeCheckConfig = (componentName, config, configTypes) => {
121
+ Object.keys(configTypes).forEach(property => {
122
+ const expectedTypes = configTypes[property];
123
+ const value = config[property];
124
+ const valueType = value && isElement(value) ? 'element' : toType(value);
106
125
 
107
126
  if (!new RegExp(expectedTypes).test(valueType)) {
108
- throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
127
+ throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
109
128
  }
110
129
  });
111
130
  };
112
131
 
113
- var findShadowRoot = function findShadowRoot(element) {
132
+ const findShadowRoot = element => {
114
133
  if (!document.documentElement.attachShadow) {
115
134
  return null;
116
135
  } // Can find the shadow root otherwise it'll return the document
117
136
 
118
137
 
119
138
  if (typeof element.getRootNode === 'function') {
120
- var root = element.getRootNode();
139
+ const root = element.getRootNode();
121
140
  return root instanceof ShadowRoot ? root : null;
122
141
  }
123
142
 
@@ -133,61 +152,86 @@
133
152
  return findShadowRoot(element.parentNode);
134
153
  };
135
154
 
136
- var noop = function noop() {
137
- return function () {};
138
- };
155
+ const noop = () => {};
139
156
 
140
- var getjQuery = function getjQuery() {
141
- var _window = window,
142
- jQuery = _window.jQuery;
157
+ const getjQuery = () => {
158
+ const {
159
+ jQuery
160
+ } = window;
143
161
 
144
- if (jQuery && !document.body.hasAttribute('data-no-jquery')) {
162
+ if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
145
163
  return jQuery;
146
164
  }
147
165
 
148
166
  return null;
149
167
  };
150
168
 
169
+ const onDOMContentLoaded = callback => {
170
+ if (document.readyState === 'loading') {
171
+ document.addEventListener('DOMContentLoaded', callback);
172
+ } else {
173
+ callback();
174
+ }
175
+ };
176
+
177
+ const isRTL = () => document.documentElement.dir === 'rtl';
178
+
179
+ const defineJQueryPlugin = (name, plugin) => {
180
+ onDOMContentLoaded(() => {
181
+ const $ = getjQuery();
182
+ /* istanbul ignore if */
183
+
184
+ if ($) {
185
+ const JQUERY_NO_CONFLICT = $.fn[name];
186
+ $.fn[name] = plugin.jQueryInterface;
187
+ $.fn[name].Constructor = plugin;
188
+
189
+ $.fn[name].noConflict = () => {
190
+ $.fn[name] = JQUERY_NO_CONFLICT;
191
+ return plugin.jQueryInterface;
192
+ };
193
+ }
194
+ });
195
+ };
196
+
151
197
  /**
152
198
  * --------------------------------------------------------------------------
153
- * Bootstrap (v5.0.0-alpha2): util/sanitizer.js
199
+ * Bootstrap (v5.0.0): util/sanitizer.js
154
200
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
155
201
  * --------------------------------------------------------------------------
156
202
  */
157
- var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
158
- var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
203
+ const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
204
+ const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
159
205
  /**
160
206
  * A pattern that recognizes a commonly useful subset of URLs that are safe.
161
207
  *
162
208
  * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
163
209
  */
164
210
 
165
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi;
211
+ const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
166
212
  /**
167
213
  * A pattern that matches safe data URLs. Only matches image, video and audio types.
168
214
  *
169
215
  * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
170
216
  */
171
217
 
172
- var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
218
+ const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
173
219
 
174
- var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) {
175
- var attrName = attr.nodeName.toLowerCase();
220
+ const allowedAttribute = (attr, allowedAttributeList) => {
221
+ const attrName = attr.nodeName.toLowerCase();
176
222
 
177
- if (allowedAttributeList.indexOf(attrName) !== -1) {
178
- if (uriAttrs.indexOf(attrName) !== -1) {
179
- return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
223
+ if (allowedAttributeList.includes(attrName)) {
224
+ if (uriAttrs.has(attrName)) {
225
+ return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
180
226
  }
181
227
 
182
228
  return true;
183
229
  }
184
230
 
185
- var regExp = allowedAttributeList.filter(function (attrRegex) {
186
- return attrRegex instanceof RegExp;
187
- }); // Check if a regular expression validates the attribute.
231
+ const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute.
188
232
 
189
- for (var i = 0, len = regExp.length; i < len; i++) {
190
- if (attrName.match(regExp[i])) {
233
+ for (let i = 0, len = regExp.length; i < len; i++) {
234
+ if (regExp[i].test(attrName)) {
191
235
  return true;
192
236
  }
193
237
  }
@@ -195,7 +239,7 @@
195
239
  return false;
196
240
  };
197
241
 
198
- var DefaultAllowlist = {
242
+ const DefaultAllowlist = {
199
243
  // Global attributes allowed on any supplied element below.
200
244
  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
201
245
  a: ['target', 'href', 'title', 'rel'],
@@ -229,8 +273,6 @@
229
273
  ul: []
230
274
  };
231
275
  function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
232
- var _ref;
233
-
234
276
  if (!unsafeHtml.length) {
235
277
  return unsafeHtml;
236
278
  }
@@ -239,61 +281,51 @@
239
281
  return sanitizeFn(unsafeHtml);
240
282
  }
241
283
 
242
- var domParser = new window.DOMParser();
243
- var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
244
- var allowlistKeys = Object.keys(allowList);
245
-
246
- var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
247
-
248
- var _loop = function _loop(i, len) {
249
- var _ref2;
284
+ const domParser = new window.DOMParser();
285
+ const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
286
+ const allowlistKeys = Object.keys(allowList);
287
+ const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
250
288
 
251
- var el = elements[i];
252
- var elName = el.nodeName.toLowerCase();
289
+ for (let i = 0, len = elements.length; i < len; i++) {
290
+ const el = elements[i];
291
+ const elName = el.nodeName.toLowerCase();
253
292
 
254
- if (allowlistKeys.indexOf(elName) === -1) {
293
+ if (!allowlistKeys.includes(elName)) {
255
294
  el.parentNode.removeChild(el);
256
- return "continue";
295
+ continue;
257
296
  }
258
297
 
259
- var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);
260
-
261
- var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
262
- attributeList.forEach(function (attr) {
298
+ const attributeList = [].concat(...el.attributes);
299
+ const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
300
+ attributeList.forEach(attr => {
263
301
  if (!allowedAttribute(attr, allowedAttributes)) {
264
302
  el.removeAttribute(attr.nodeName);
265
303
  }
266
304
  });
267
- };
268
-
269
- for (var i = 0, len = elements.length; i < len; i++) {
270
- var _ret = _loop(i);
271
-
272
- if (_ret === "continue") continue;
273
305
  }
274
306
 
275
307
  return createdDocument.body.innerHTML;
276
308
  }
277
309
 
278
- 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); }
279
-
280
- 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); } }
281
-
282
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
310
+ /**
311
+ * --------------------------------------------------------------------------
312
+ * Bootstrap (v5.0.0): tooltip.js
313
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
314
+ * --------------------------------------------------------------------------
315
+ */
283
316
  /**
284
317
  * ------------------------------------------------------------------------
285
318
  * Constants
286
319
  * ------------------------------------------------------------------------
287
320
  */
288
321
 
289
- var NAME = 'tooltip';
290
- var VERSION = '5.0.0-alpha2';
291
- var DATA_KEY = 'bs.tooltip';
292
- var EVENT_KEY = "." + DATA_KEY;
293
- var CLASS_PREFIX = 'bs-tooltip';
294
- var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
295
- var DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn'];
296
- var DefaultType = {
322
+ const NAME = 'tooltip';
323
+ const DATA_KEY = 'bs.tooltip';
324
+ const EVENT_KEY = `.${DATA_KEY}`;
325
+ const CLASS_PREFIX = 'bs-tooltip';
326
+ const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
327
+ const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
328
+ const DefaultType = {
297
329
  animation: 'boolean',
298
330
  template: 'string',
299
331
  title: '(string|element|function)',
@@ -302,74 +334,77 @@
302
334
  html: 'boolean',
303
335
  selector: '(string|boolean)',
304
336
  placement: '(string|function)',
305
- offset: '(number|string|function)',
337
+ offset: '(array|string|function)',
306
338
  container: '(string|element|boolean)',
307
- fallbackPlacement: '(string|array)',
339
+ fallbackPlacements: 'array',
308
340
  boundary: '(string|element)',
341
+ customClass: '(string|function)',
309
342
  sanitize: 'boolean',
310
343
  sanitizeFn: '(null|function)',
311
344
  allowList: 'object',
312
- popperConfig: '(null|object)'
345
+ popperConfig: '(null|object|function)'
313
346
  };
314
- var AttachmentMap = {
347
+ const AttachmentMap = {
315
348
  AUTO: 'auto',
316
349
  TOP: 'top',
317
- RIGHT: 'right',
350
+ RIGHT: isRTL() ? 'left' : 'right',
318
351
  BOTTOM: 'bottom',
319
- LEFT: 'left'
352
+ LEFT: isRTL() ? 'right' : 'left'
320
353
  };
321
- var Default = {
354
+ const Default = {
322
355
  animation: true,
323
- template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
356
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
324
357
  trigger: 'hover focus',
325
358
  title: '',
326
359
  delay: 0,
327
360
  html: false,
328
361
  selector: false,
329
362
  placement: 'top',
330
- offset: 0,
363
+ offset: [0, 0],
331
364
  container: false,
332
- fallbackPlacement: 'flip',
333
- boundary: 'scrollParent',
365
+ fallbackPlacements: ['top', 'right', 'bottom', 'left'],
366
+ boundary: 'clippingParents',
367
+ customClass: '',
334
368
  sanitize: true,
335
369
  sanitizeFn: null,
336
370
  allowList: DefaultAllowlist,
337
371
  popperConfig: null
338
372
  };
339
- var Event$1 = {
340
- HIDE: "hide" + EVENT_KEY,
341
- HIDDEN: "hidden" + EVENT_KEY,
342
- SHOW: "show" + EVENT_KEY,
343
- SHOWN: "shown" + EVENT_KEY,
344
- INSERTED: "inserted" + EVENT_KEY,
345
- CLICK: "click" + EVENT_KEY,
346
- FOCUSIN: "focusin" + EVENT_KEY,
347
- FOCUSOUT: "focusout" + EVENT_KEY,
348
- MOUSEENTER: "mouseenter" + EVENT_KEY,
349
- MOUSELEAVE: "mouseleave" + EVENT_KEY
373
+ const Event$1 = {
374
+ HIDE: `hide${EVENT_KEY}`,
375
+ HIDDEN: `hidden${EVENT_KEY}`,
376
+ SHOW: `show${EVENT_KEY}`,
377
+ SHOWN: `shown${EVENT_KEY}`,
378
+ INSERTED: `inserted${EVENT_KEY}`,
379
+ CLICK: `click${EVENT_KEY}`,
380
+ FOCUSIN: `focusin${EVENT_KEY}`,
381
+ FOCUSOUT: `focusout${EVENT_KEY}`,
382
+ MOUSEENTER: `mouseenter${EVENT_KEY}`,
383
+ MOUSELEAVE: `mouseleave${EVENT_KEY}`
350
384
  };
351
- var CLASS_NAME_FADE = 'fade';
352
- var CLASS_NAME_MODAL = 'modal';
353
- var CLASS_NAME_SHOW = 'show';
354
- var HOVER_STATE_SHOW = 'show';
355
- var HOVER_STATE_OUT = 'out';
356
- var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
357
- var TRIGGER_HOVER = 'hover';
358
- var TRIGGER_FOCUS = 'focus';
359
- var TRIGGER_CLICK = 'click';
360
- var TRIGGER_MANUAL = 'manual';
385
+ const CLASS_NAME_FADE = 'fade';
386
+ const CLASS_NAME_MODAL = 'modal';
387
+ const CLASS_NAME_SHOW = 'show';
388
+ const HOVER_STATE_SHOW = 'show';
389
+ const HOVER_STATE_OUT = 'out';
390
+ const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
391
+ const TRIGGER_HOVER = 'hover';
392
+ const TRIGGER_FOCUS = 'focus';
393
+ const TRIGGER_CLICK = 'click';
394
+ const TRIGGER_MANUAL = 'manual';
361
395
  /**
362
396
  * ------------------------------------------------------------------------
363
397
  * Class Definition
364
398
  * ------------------------------------------------------------------------
365
399
  */
366
400
 
367
- var Tooltip = /*#__PURE__*/function () {
368
- function Tooltip(element, config) {
369
- if (typeof Popper__default['default'] === 'undefined') {
370
- throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
371
- } // private
401
+ class Tooltip extends BaseComponent__default['default'] {
402
+ constructor(element, config) {
403
+ if (typeof Popper__namespace === 'undefined') {
404
+ throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
405
+ }
372
406
 
407
+ super(element); // private
373
408
 
374
409
  this._isEnabled = true;
375
410
  this._timeout = 0;
@@ -377,44 +412,57 @@
377
412
  this._activeTrigger = {};
378
413
  this._popper = null; // Protected
379
414
 
380
- this.element = element;
381
415
  this.config = this._getConfig(config);
382
416
  this.tip = null;
383
417
 
384
418
  this._setListeners();
385
-
386
- Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
387
419
  } // Getters
388
420
 
389
421
 
390
- var _proto = Tooltip.prototype;
422
+ static get Default() {
423
+ return Default;
424
+ }
425
+
426
+ static get NAME() {
427
+ return NAME;
428
+ }
429
+
430
+ static get DATA_KEY() {
431
+ return DATA_KEY;
432
+ }
433
+
434
+ static get Event() {
435
+ return Event$1;
436
+ }
437
+
438
+ static get EVENT_KEY() {
439
+ return EVENT_KEY;
440
+ }
441
+
442
+ static get DefaultType() {
443
+ return DefaultType;
444
+ } // Public
445
+
391
446
 
392
- // Public
393
- _proto.enable = function enable() {
447
+ enable() {
394
448
  this._isEnabled = true;
395
- };
449
+ }
396
450
 
397
- _proto.disable = function disable() {
451
+ disable() {
398
452
  this._isEnabled = false;
399
- };
453
+ }
400
454
 
401
- _proto.toggleEnabled = function toggleEnabled() {
455
+ toggleEnabled() {
402
456
  this._isEnabled = !this._isEnabled;
403
- };
457
+ }
404
458
 
405
- _proto.toggle = function toggle(event) {
459
+ toggle(event) {
406
460
  if (!this._isEnabled) {
407
461
  return;
408
462
  }
409
463
 
410
464
  if (event) {
411
- var dataKey = this.constructor.DATA_KEY;
412
- var context = Data__default['default'].getData(event.delegateTarget, dataKey);
413
-
414
- if (!context) {
415
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
416
- Data__default['default'].setData(event.delegateTarget, dataKey, context);
417
- }
465
+ const context = this._initializeOnDelegatedTarget(event);
418
466
 
419
467
  context._activeTrigger.click = !context._activeTrigger.click;
420
468
 
@@ -432,15 +480,13 @@
432
480
 
433
481
  this._enter(null, this);
434
482
  }
435
- };
483
+ }
436
484
 
437
- _proto.dispose = function dispose() {
485
+ dispose() {
438
486
  clearTimeout(this._timeout);
439
- Data__default['default'].removeData(this.element, this.constructor.DATA_KEY);
440
- EventHandler__default['default'].off(this.element, this.constructor.EVENT_KEY);
441
- EventHandler__default['default'].off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
487
+ EventHandler__default['default'].off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
442
488
 
443
- if (this.tip) {
489
+ if (this.tip && this.tip.parentNode) {
444
490
  this.tip.parentNode.removeChild(this.tip);
445
491
  }
446
492
 
@@ -454,114 +500,127 @@
454
500
  }
455
501
 
456
502
  this._popper = null;
457
- this.element = null;
458
503
  this.config = null;
459
504
  this.tip = null;
460
- };
461
-
462
- _proto.show = function show() {
463
- var _this = this;
505
+ super.dispose();
506
+ }
464
507
 
465
- if (this.element.style.display === 'none') {
508
+ show() {
509
+ if (this._element.style.display === 'none') {
466
510
  throw new Error('Please use show on visible elements');
467
511
  }
468
512
 
469
- if (this.isWithContent() && this._isEnabled) {
470
- var showEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.SHOW);
471
- var shadowRoot = findShadowRoot(this.element);
472
- var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element);
513
+ if (!(this.isWithContent() && this._isEnabled)) {
514
+ return;
515
+ }
473
516
 
474
- if (showEvent.defaultPrevented || !isInTheDom) {
475
- return;
476
- }
517
+ const showEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.SHOW);
518
+ const shadowRoot = findShadowRoot(this._element);
519
+ const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
477
520
 
478
- var tip = this.getTipElement();
479
- var tipId = getUID(this.constructor.NAME);
480
- tip.setAttribute('id', tipId);
481
- this.element.setAttribute('aria-describedby', tipId);
482
- this.setContent();
521
+ if (showEvent.defaultPrevented || !isInTheDom) {
522
+ return;
523
+ }
483
524
 
484
- if (this.config.animation) {
485
- tip.classList.add(CLASS_NAME_FADE);
486
- }
525
+ const tip = this.getTipElement();
526
+ const tipId = getUID(this.constructor.NAME);
527
+ tip.setAttribute('id', tipId);
487
528
 
488
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
529
+ this._element.setAttribute('aria-describedby', tipId);
489
530
 
490
- var attachment = this._getAttachment(placement);
531
+ this.setContent();
491
532
 
492
- this._addAttachmentClass(attachment);
533
+ if (this.config.animation) {
534
+ tip.classList.add(CLASS_NAME_FADE);
535
+ }
493
536
 
494
- var container = this._getContainer();
537
+ const placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement;
495
538
 
496
- Data__default['default'].setData(tip, this.constructor.DATA_KEY, this);
539
+ const attachment = this._getAttachment(placement);
497
540
 
498
- if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
499
- container.appendChild(tip);
500
- }
541
+ this._addAttachmentClass(attachment);
501
542
 
502
- EventHandler__default['default'].trigger(this.element, this.constructor.Event.INSERTED);
503
- this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
504
- tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
505
- // empty mouseover listeners to the body's immediate children;
506
- // only needed because of broken event delegation on iOS
507
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
543
+ const container = this._getContainer();
508
544
 
509
- if ('ontouchstart' in document.documentElement) {
510
- var _ref;
545
+ Data__default['default'].set(tip, this.constructor.DATA_KEY, this);
511
546
 
512
- (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) {
513
- EventHandler__default['default'].on(element, 'mouseover', noop());
514
- });
515
- }
547
+ if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
548
+ container.appendChild(tip);
549
+ EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
550
+ }
516
551
 
517
- var complete = function complete() {
518
- if (_this.config.animation) {
519
- _this._fixTransition();
520
- }
552
+ if (this._popper) {
553
+ this._popper.update();
554
+ } else {
555
+ this._popper = Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
556
+ }
521
557
 
522
- var prevHoverState = _this._hoverState;
523
- _this._hoverState = null;
524
- EventHandler__default['default'].trigger(_this.element, _this.constructor.Event.SHOWN);
558
+ tip.classList.add(CLASS_NAME_SHOW);
559
+ const customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
525
560
 
526
- if (prevHoverState === HOVER_STATE_OUT) {
527
- _this._leave(null, _this);
528
- }
529
- };
561
+ if (customClass) {
562
+ tip.classList.add(...customClass.split(' '));
563
+ } // If this is a touch-enabled device we add extra
564
+ // empty mouseover listeners to the body's immediate children;
565
+ // only needed because of broken event delegation on iOS
566
+ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
530
567
 
531
- if (this.tip.classList.contains(CLASS_NAME_FADE)) {
532
- var transitionDuration = getTransitionDurationFromElement(this.tip);
533
- EventHandler__default['default'].one(this.tip, TRANSITION_END, complete);
534
- emulateTransitionEnd(this.tip, transitionDuration);
535
- } else {
536
- complete();
537
- }
568
+
569
+ if ('ontouchstart' in document.documentElement) {
570
+ [].concat(...document.body.children).forEach(element => {
571
+ EventHandler__default['default'].on(element, 'mouseover', noop);
572
+ });
538
573
  }
539
- };
540
574
 
541
- _proto.hide = function hide() {
542
- var _this2 = this;
575
+ const complete = () => {
576
+ const prevHoverState = this._hoverState;
577
+ this._hoverState = null;
578
+ EventHandler__default['default'].trigger(this._element, this.constructor.Event.SHOWN);
543
579
 
580
+ if (prevHoverState === HOVER_STATE_OUT) {
581
+ this._leave(null, this);
582
+ }
583
+ };
584
+
585
+ if (this.tip.classList.contains(CLASS_NAME_FADE)) {
586
+ const transitionDuration = getTransitionDurationFromElement(this.tip);
587
+ EventHandler__default['default'].one(this.tip, 'transitionend', complete);
588
+ emulateTransitionEnd(this.tip, transitionDuration);
589
+ } else {
590
+ complete();
591
+ }
592
+ }
593
+
594
+ hide() {
544
595
  if (!this._popper) {
545
596
  return;
546
597
  }
547
598
 
548
- var tip = this.getTipElement();
599
+ const tip = this.getTipElement();
549
600
 
550
- var complete = function complete() {
551
- if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
601
+ const complete = () => {
602
+ if (this._isWithActiveTrigger()) {
603
+ return;
604
+ }
605
+
606
+ if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
552
607
  tip.parentNode.removeChild(tip);
553
608
  }
554
609
 
555
- _this2._cleanTipClass();
610
+ this._cleanTipClass();
611
+
612
+ this._element.removeAttribute('aria-describedby');
556
613
 
557
- _this2.element.removeAttribute('aria-describedby');
614
+ EventHandler__default['default'].trigger(this._element, this.constructor.Event.HIDDEN);
558
615
 
559
- EventHandler__default['default'].trigger(_this2.element, _this2.constructor.Event.HIDDEN);
616
+ if (this._popper) {
617
+ this._popper.destroy();
560
618
 
561
- _this2._popper.destroy();
619
+ this._popper = null;
620
+ }
562
621
  };
563
622
 
564
- var hideEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.HIDE);
623
+ const hideEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.HIDE);
565
624
 
566
625
  if (hideEvent.defaultPrevented) {
567
626
  return;
@@ -571,11 +630,7 @@
571
630
  // empty mouseover listeners we added for iOS support
572
631
 
573
632
  if ('ontouchstart' in document.documentElement) {
574
- var _ref2;
575
-
576
- (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) {
577
- return EventHandler__default['default'].off(element, 'mouseover', noop);
578
- });
633
+ [].concat(...document.body.children).forEach(element => EventHandler__default['default'].off(element, 'mouseover', noop));
579
634
  }
580
635
 
581
636
  this._activeTrigger[TRIGGER_CLICK] = false;
@@ -583,45 +638,45 @@
583
638
  this._activeTrigger[TRIGGER_HOVER] = false;
584
639
 
585
640
  if (this.tip.classList.contains(CLASS_NAME_FADE)) {
586
- var transitionDuration = getTransitionDurationFromElement(tip);
587
- EventHandler__default['default'].one(tip, TRANSITION_END, complete);
641
+ const transitionDuration = getTransitionDurationFromElement(tip);
642
+ EventHandler__default['default'].one(tip, 'transitionend', complete);
588
643
  emulateTransitionEnd(tip, transitionDuration);
589
644
  } else {
590
645
  complete();
591
646
  }
592
647
 
593
648
  this._hoverState = '';
594
- };
649
+ }
595
650
 
596
- _proto.update = function update() {
651
+ update() {
597
652
  if (this._popper !== null) {
598
- this._popper.scheduleUpdate();
653
+ this._popper.update();
599
654
  }
600
655
  } // Protected
601
- ;
602
656
 
603
- _proto.isWithContent = function isWithContent() {
657
+
658
+ isWithContent() {
604
659
  return Boolean(this.getTitle());
605
- };
660
+ }
606
661
 
607
- _proto.getTipElement = function getTipElement() {
662
+ getTipElement() {
608
663
  if (this.tip) {
609
664
  return this.tip;
610
665
  }
611
666
 
612
- var element = document.createElement('div');
667
+ const element = document.createElement('div');
613
668
  element.innerHTML = this.config.template;
614
669
  this.tip = element.children[0];
615
670
  return this.tip;
616
- };
671
+ }
617
672
 
618
- _proto.setContent = function setContent() {
619
- var tip = this.getTipElement();
673
+ setContent() {
674
+ const tip = this.getTipElement();
620
675
  this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
621
676
  tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
622
- };
677
+ }
623
678
 
624
- _proto.setElementContent = function setElementContent(element, content) {
679
+ setElementContent(element, content) {
625
680
  if (element === null) {
626
681
  return;
627
682
  }
@@ -653,70 +708,104 @@
653
708
  } else {
654
709
  element.textContent = content;
655
710
  }
656
- };
711
+ }
657
712
 
658
- _proto.getTitle = function getTitle() {
659
- var title = this.element.getAttribute('data-original-title');
713
+ getTitle() {
714
+ let title = this._element.getAttribute('data-bs-original-title');
660
715
 
661
716
  if (!title) {
662
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
717
+ title = typeof this.config.title === 'function' ? this.config.title.call(this._element) : this.config.title;
663
718
  }
664
719
 
665
720
  return title;
721
+ }
722
+
723
+ updateAttachment(attachment) {
724
+ if (attachment === 'right') {
725
+ return 'end';
726
+ }
727
+
728
+ if (attachment === 'left') {
729
+ return 'start';
730
+ }
731
+
732
+ return attachment;
666
733
  } // Private
667
- ;
668
734
 
669
- _proto._getPopperConfig = function _getPopperConfig(attachment) {
670
- var _this3 = this;
671
735
 
672
- var defaultBsConfig = {
673
- placement: attachment,
674
- modifiers: {
675
- offset: this._getOffset(),
676
- flip: {
677
- behavior: this.config.fallbackPlacement
678
- },
679
- arrow: {
680
- element: "." + this.constructor.NAME + "-arrow"
681
- },
682
- preventOverflow: {
683
- boundariesElement: this.config.boundary
684
- }
685
- },
686
- onCreate: function onCreate(data) {
687
- if (data.originalPlacement !== data.placement) {
688
- _this3._handlePopperPlacementChange(data);
689
- }
690
- },
691
- onUpdate: function onUpdate(data) {
692
- return _this3._handlePopperPlacementChange(data);
693
- }
694
- };
695
- return _extends({}, defaultBsConfig, this.config.popperConfig);
696
- };
736
+ _initializeOnDelegatedTarget(event, context) {
737
+ const dataKey = this.constructor.DATA_KEY;
738
+ context = context || Data__default['default'].get(event.delegateTarget, dataKey);
739
+
740
+ if (!context) {
741
+ context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
742
+ Data__default['default'].set(event.delegateTarget, dataKey, context);
743
+ }
697
744
 
698
- _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
699
- this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
700
- };
745
+ return context;
746
+ }
701
747
 
702
- _proto._getOffset = function _getOffset() {
703
- var _this4 = this;
748
+ _getOffset() {
749
+ const {
750
+ offset
751
+ } = this.config;
704
752
 
705
- var offset = {};
753
+ if (typeof offset === 'string') {
754
+ return offset.split(',').map(val => Number.parseInt(val, 10));
755
+ }
706
756
 
707
- if (typeof this.config.offset === 'function') {
708
- offset.fn = function (data) {
709
- data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {});
710
- return data;
711
- };
712
- } else {
713
- offset.offset = this.config.offset;
757
+ if (typeof offset === 'function') {
758
+ return popperData => offset(popperData, this._element);
714
759
  }
715
760
 
716
761
  return offset;
717
- };
762
+ }
718
763
 
719
- _proto._getContainer = function _getContainer() {
764
+ _getPopperConfig(attachment) {
765
+ const defaultBsPopperConfig = {
766
+ placement: attachment,
767
+ modifiers: [{
768
+ name: 'flip',
769
+ options: {
770
+ fallbackPlacements: this.config.fallbackPlacements
771
+ }
772
+ }, {
773
+ name: 'offset',
774
+ options: {
775
+ offset: this._getOffset()
776
+ }
777
+ }, {
778
+ name: 'preventOverflow',
779
+ options: {
780
+ boundary: this.config.boundary
781
+ }
782
+ }, {
783
+ name: 'arrow',
784
+ options: {
785
+ element: `.${this.constructor.NAME}-arrow`
786
+ }
787
+ }, {
788
+ name: 'onChange',
789
+ enabled: true,
790
+ phase: 'afterWrite',
791
+ fn: data => this._handlePopperPlacementChange(data)
792
+ }],
793
+ onFirstUpdate: data => {
794
+ if (data.options.placement !== data.placement) {
795
+ this._handlePopperPlacementChange(data);
796
+ }
797
+ }
798
+ };
799
+ return { ...defaultBsPopperConfig,
800
+ ...(typeof this.config.popperConfig === 'function' ? this.config.popperConfig(defaultBsPopperConfig) : this.config.popperConfig)
801
+ };
802
+ }
803
+
804
+ _addAttachmentClass(attachment) {
805
+ this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
806
+ }
807
+
808
+ _getContainer() {
720
809
  if (this.config.container === false) {
721
810
  return document.body;
722
811
  }
@@ -726,68 +815,61 @@
726
815
  }
727
816
 
728
817
  return SelectorEngine__default['default'].findOne(this.config.container);
729
- };
818
+ }
730
819
 
731
- _proto._getAttachment = function _getAttachment(placement) {
820
+ _getAttachment(placement) {
732
821
  return AttachmentMap[placement.toUpperCase()];
733
- };
734
-
735
- _proto._setListeners = function _setListeners() {
736
- var _this5 = this;
822
+ }
737
823
 
738
- var triggers = this.config.trigger.split(' ');
739
- triggers.forEach(function (trigger) {
824
+ _setListeners() {
825
+ const triggers = this.config.trigger.split(' ');
826
+ triggers.forEach(trigger => {
740
827
  if (trigger === 'click') {
741
- EventHandler__default['default'].on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
742
- return _this5.toggle(event);
743
- });
828
+ EventHandler__default['default'].on(this._element, this.constructor.Event.CLICK, this.config.selector, event => this.toggle(event));
744
829
  } else if (trigger !== TRIGGER_MANUAL) {
745
- var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
746
- var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
747
- EventHandler__default['default'].on(_this5.element, eventIn, _this5.config.selector, function (event) {
748
- return _this5._enter(event);
749
- });
750
- EventHandler__default['default'].on(_this5.element, eventOut, _this5.config.selector, function (event) {
751
- return _this5._leave(event);
752
- });
830
+ const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
831
+ const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
832
+ EventHandler__default['default'].on(this._element, eventIn, this.config.selector, event => this._enter(event));
833
+ EventHandler__default['default'].on(this._element, eventOut, this.config.selector, event => this._leave(event));
753
834
  }
754
835
  });
755
836
 
756
- this._hideModalHandler = function () {
757
- if (_this5.element) {
758
- _this5.hide();
837
+ this._hideModalHandler = () => {
838
+ if (this._element) {
839
+ this.hide();
759
840
  }
760
841
  };
761
842
 
762
- EventHandler__default['default'].on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
843
+ EventHandler__default['default'].on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
763
844
 
764
845
  if (this.config.selector) {
765
- this.config = _extends({}, this.config, {
846
+ this.config = { ...this.config,
766
847
  trigger: 'manual',
767
848
  selector: ''
768
- });
849
+ };
769
850
  } else {
770
851
  this._fixTitle();
771
852
  }
772
- };
853
+ }
773
854
 
774
- _proto._fixTitle = function _fixTitle() {
775
- var titleType = typeof this.element.getAttribute('data-original-title');
855
+ _fixTitle() {
856
+ const title = this._element.getAttribute('title');
776
857
 
777
- if (this.element.getAttribute('title') || titleType !== 'string') {
778
- this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
779
- this.element.setAttribute('title', '');
780
- }
781
- };
858
+ const originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
782
859
 
783
- _proto._enter = function _enter(event, context) {
784
- var dataKey = this.constructor.DATA_KEY;
785
- context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
860
+ if (title || originalTitleType !== 'string') {
861
+ this._element.setAttribute('data-bs-original-title', title || '');
786
862
 
787
- if (!context) {
788
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
789
- Data__default['default'].setData(event.delegateTarget, dataKey, context);
863
+ if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
864
+ this._element.setAttribute('aria-label', title);
865
+ }
866
+
867
+ this._element.setAttribute('title', '');
790
868
  }
869
+ }
870
+
871
+ _enter(event, context) {
872
+ context = this._initializeOnDelegatedTarget(event, context);
791
873
 
792
874
  if (event) {
793
875
  context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
@@ -806,24 +888,18 @@
806
888
  return;
807
889
  }
808
890
 
809
- context._timeout = setTimeout(function () {
891
+ context._timeout = setTimeout(() => {
810
892
  if (context._hoverState === HOVER_STATE_SHOW) {
811
893
  context.show();
812
894
  }
813
895
  }, context.config.delay.show);
814
- };
815
-
816
- _proto._leave = function _leave(event, context) {
817
- var dataKey = this.constructor.DATA_KEY;
818
- context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
896
+ }
819
897
 
820
- if (!context) {
821
- context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
822
- Data__default['default'].setData(event.delegateTarget, dataKey, context);
823
- }
898
+ _leave(event, context) {
899
+ context = this._initializeOnDelegatedTarget(event, context);
824
900
 
825
901
  if (event) {
826
- context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
902
+ context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
827
903
  }
828
904
 
829
905
  if (context._isWithActiveTrigger()) {
@@ -838,27 +914,27 @@
838
914
  return;
839
915
  }
840
916
 
841
- context._timeout = setTimeout(function () {
917
+ context._timeout = setTimeout(() => {
842
918
  if (context._hoverState === HOVER_STATE_OUT) {
843
919
  context.hide();
844
920
  }
845
921
  }, context.config.delay.hide);
846
- };
922
+ }
847
923
 
848
- _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
849
- for (var trigger in this._activeTrigger) {
924
+ _isWithActiveTrigger() {
925
+ for (const trigger in this._activeTrigger) {
850
926
  if (this._activeTrigger[trigger]) {
851
927
  return true;
852
928
  }
853
929
  }
854
930
 
855
931
  return false;
856
- };
932
+ }
857
933
 
858
- _proto._getConfig = function _getConfig(config) {
859
- var dataAttributes = Manipulator__default['default'].getDataAttributes(this.element);
860
- Object.keys(dataAttributes).forEach(function (dataAttr) {
861
- if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
934
+ _getConfig(config) {
935
+ const dataAttributes = Manipulator__default['default'].getDataAttributes(this._element);
936
+ Object.keys(dataAttributes).forEach(dataAttr => {
937
+ if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
862
938
  delete dataAttributes[dataAttr];
863
939
  }
864
940
  });
@@ -867,7 +943,10 @@
867
943
  config.container = config.container[0];
868
944
  }
869
945
 
870
- config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
946
+ config = { ...this.constructor.Default,
947
+ ...dataAttributes,
948
+ ...(typeof config === 'object' && config ? config : {})
949
+ };
871
950
 
872
951
  if (typeof config.delay === 'number') {
873
952
  config.delay = {
@@ -891,13 +970,13 @@
891
970
  }
892
971
 
893
972
  return config;
894
- };
973
+ }
895
974
 
896
- _proto._getDelegateConfig = function _getDelegateConfig() {
897
- var config = {};
975
+ _getDelegateConfig() {
976
+ const config = {};
898
977
 
899
978
  if (this.config) {
900
- for (var key in this.config) {
979
+ for (const key in this.config) {
901
980
  if (this.constructor.Default[key] !== this.config[key]) {
902
981
  config[key] = this.config[key];
903
982
  }
@@ -905,50 +984,39 @@
905
984
  }
906
985
 
907
986
  return config;
908
- };
987
+ }
909
988
 
910
- _proto._cleanTipClass = function _cleanTipClass() {
911
- var tip = this.getTipElement();
912
- var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
989
+ _cleanTipClass() {
990
+ const tip = this.getTipElement();
991
+ const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
913
992
 
914
993
  if (tabClass !== null && tabClass.length > 0) {
915
- tabClass.map(function (token) {
916
- return token.trim();
917
- }).forEach(function (tClass) {
918
- return tip.classList.remove(tClass);
919
- });
994
+ tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
920
995
  }
921
- };
922
-
923
- _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
924
- this.tip = popperData.instance.popper;
925
-
926
- this._cleanTipClass();
927
-
928
- this._addAttachmentClass(this._getAttachment(popperData.placement));
929
- };
996
+ }
930
997
 
931
- _proto._fixTransition = function _fixTransition() {
932
- var tip = this.getTipElement();
933
- var initConfigAnimation = this.config.animation;
998
+ _handlePopperPlacementChange(popperData) {
999
+ const {
1000
+ state
1001
+ } = popperData;
934
1002
 
935
- if (tip.getAttribute('x-placement') !== null) {
1003
+ if (!state) {
936
1004
  return;
937
1005
  }
938
1006
 
939
- tip.classList.remove(CLASS_NAME_FADE);
940
- this.config.animation = false;
941
- this.hide();
942
- this.show();
943
- this.config.animation = initConfigAnimation;
1007
+ this.tip = state.elements.popper;
1008
+
1009
+ this._cleanTipClass();
1010
+
1011
+ this._addAttachmentClass(this._getAttachment(state.placement));
944
1012
  } // Static
945
- ;
946
1013
 
947
- Tooltip.jQueryInterface = function jQueryInterface(config) {
1014
+
1015
+ static jQueryInterface(config) {
948
1016
  return this.each(function () {
949
- var data = Data__default['default'].getData(this, DATA_KEY);
1017
+ let data = Data__default['default'].get(this, DATA_KEY);
950
1018
 
951
- var _config = typeof config === 'object' && config;
1019
+ const _config = typeof config === 'object' && config;
952
1020
 
953
1021
  if (!data && /dispose|hide/.test(config)) {
954
1022
  return;
@@ -960,78 +1028,24 @@
960
1028
 
961
1029
  if (typeof config === 'string') {
962
1030
  if (typeof data[config] === 'undefined') {
963
- throw new TypeError("No method named \"" + config + "\"");
1031
+ throw new TypeError(`No method named "${config}"`);
964
1032
  }
965
1033
 
966
1034
  data[config]();
967
1035
  }
968
1036
  });
969
- };
970
-
971
- Tooltip.getInstance = function getInstance(element) {
972
- return Data__default['default'].getData(element, DATA_KEY);
973
- };
974
-
975
- _createClass(Tooltip, null, [{
976
- key: "VERSION",
977
- get: function get() {
978
- return VERSION;
979
- }
980
- }, {
981
- key: "Default",
982
- get: function get() {
983
- return Default;
984
- }
985
- }, {
986
- key: "NAME",
987
- get: function get() {
988
- return NAME;
989
- }
990
- }, {
991
- key: "DATA_KEY",
992
- get: function get() {
993
- return DATA_KEY;
994
- }
995
- }, {
996
- key: "Event",
997
- get: function get() {
998
- return Event$1;
999
- }
1000
- }, {
1001
- key: "EVENT_KEY",
1002
- get: function get() {
1003
- return EVENT_KEY;
1004
- }
1005
- }, {
1006
- key: "DefaultType",
1007
- get: function get() {
1008
- return DefaultType;
1009
- }
1010
- }]);
1011
-
1012
- return Tooltip;
1013
- }();
1037
+ }
1014
1038
 
1015
- var $ = getjQuery();
1039
+ }
1016
1040
  /**
1017
1041
  * ------------------------------------------------------------------------
1018
1042
  * jQuery
1019
1043
  * ------------------------------------------------------------------------
1020
- * add .tooltip to jQuery only if jQuery is present
1044
+ * add .Tooltip to jQuery only if jQuery is present
1021
1045
  */
1022
1046
 
1023
- /* istanbul ignore if */
1024
1047
 
1025
- if ($) {
1026
- var JQUERY_NO_CONFLICT = $.fn[NAME];
1027
- $.fn[NAME] = Tooltip.jQueryInterface;
1028
- $.fn[NAME].Constructor = Tooltip;
1029
-
1030
- $.fn[NAME].noConflict = function () {
1031
- $.fn[NAME] = JQUERY_NO_CONFLICT;
1032
- return Tooltip.jQueryInterface;
1033
- };
1034
- }
1048
+ defineJQueryPlugin(NAME, Tooltip);
1035
1049
 
1036
1050
  return Tooltip;
1037
1051