bootstrap 4.3.1 → 5.1.3

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