bootstrap 4.4.1 → 5.0.1

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