bootstrap 4.6.2.1 → 5.3.5

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 (186) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +61 -0
  3. data/CHANGELOG.md +7 -2
  4. data/Gemfile +1 -0
  5. data/README.md +33 -15
  6. data/Rakefile +1 -2
  7. data/assets/javascripts/bootstrap/alert.js +50 -147
  8. data/assets/javascripts/bootstrap/base-component.js +83 -0
  9. data/assets/javascripts/bootstrap/button.js +40 -190
  10. data/assets/javascripts/bootstrap/carousel.js +282 -537
  11. data/assets/javascripts/bootstrap/collapse.js +166 -314
  12. data/assets/javascripts/bootstrap/dom/data.js +62 -0
  13. data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
  14. data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
  15. data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
  16. data/assets/javascripts/bootstrap/dropdown.js +297 -455
  17. data/assets/javascripts/bootstrap/modal.js +223 -566
  18. data/assets/javascripts/bootstrap/offcanvas.js +245 -0
  19. data/assets/javascripts/bootstrap/popover.js +59 -208
  20. data/assets/javascripts/bootstrap/scrollspy.js +213 -276
  21. data/assets/javascripts/bootstrap/tab.js +222 -200
  22. data/assets/javascripts/bootstrap/toast.js +137 -206
  23. data/assets/javascripts/bootstrap/tooltip.js +403 -747
  24. data/assets/javascripts/bootstrap/util/backdrop.js +138 -0
  25. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  26. data/assets/javascripts/bootstrap/util/config.js +67 -0
  27. data/assets/javascripts/bootstrap/util/focustrap.js +112 -0
  28. data/assets/javascripts/bootstrap/util/index.js +280 -0
  29. data/assets/javascripts/bootstrap/util/sanitizer.js +113 -0
  30. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  31. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  32. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  33. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  34. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  35. data/assets/javascripts/bootstrap-sprockets.js +21 -5
  36. data/assets/javascripts/bootstrap.js +3625 -3488
  37. data/assets/javascripts/bootstrap.min.js +3 -3
  38. data/assets/stylesheets/_bootstrap-grid.scss +53 -21
  39. data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
  40. data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
  41. data/assets/stylesheets/_bootstrap.scss +21 -13
  42. data/assets/stylesheets/bootstrap/_accordion.scss +153 -0
  43. data/assets/stylesheets/bootstrap/_alert.scss +32 -16
  44. data/assets/stylesheets/bootstrap/_badge.scss +15 -31
  45. data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
  46. data/assets/stylesheets/bootstrap/_button-group.scss +32 -48
  47. data/assets/stylesheets/bootstrap/_buttons.scss +145 -71
  48. data/assets/stylesheets/bootstrap/_card.scss +67 -115
  49. data/assets/stylesheets/bootstrap/_carousel.scss +63 -37
  50. data/assets/stylesheets/bootstrap/_close.scss +53 -27
  51. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  52. data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
  53. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  54. data/assets/stylesheets/bootstrap/_functions.scss +135 -23
  55. data/assets/stylesheets/bootstrap/_grid.scss +18 -52
  56. data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
  57. data/assets/stylesheets/bootstrap/_list-group.scss +93 -48
  58. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  59. data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
  60. data/assets/stylesheets/bootstrap/_modal.scss +112 -112
  61. data/assets/stylesheets/bootstrap/_nav.scss +100 -28
  62. data/assets/stylesheets/bootstrap/_navbar.scss +130 -173
  63. data/assets/stylesheets/bootstrap/_offcanvas.scss +147 -0
  64. data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
  65. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  66. data/assets/stylesheets/bootstrap/_popover.scss +99 -73
  67. data/assets/stylesheets/bootstrap/_progress.scss +35 -14
  68. data/assets/stylesheets/bootstrap/_reboot.scss +319 -192
  69. data/assets/stylesheets/bootstrap/_root.scss +177 -9
  70. data/assets/stylesheets/bootstrap/_spinners.scss +43 -23
  71. data/assets/stylesheets/bootstrap/_tables.scss +101 -115
  72. data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
  73. data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
  74. data/assets/stylesheets/bootstrap/_transitions.scss +3 -2
  75. data/assets/stylesheets/bootstrap/_type.scss +40 -59
  76. data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
  77. data/assets/stylesheets/bootstrap/_variables-dark.scss +102 -0
  78. data/assets/stylesheets/bootstrap/_variables.scss +1210 -606
  79. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +97 -0
  80. data/assets/stylesheets/bootstrap/forms/_form-check.scss +189 -0
  81. data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
  82. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  83. data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
  84. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  85. data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
  86. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  87. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  88. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  89. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
  90. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  91. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  92. data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
  93. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  94. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  95. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  96. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  97. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  98. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  99. data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
  100. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  101. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  102. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
  103. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  104. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
  105. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
  106. data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
  107. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  108. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  109. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  110. data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
  111. data/assets/stylesheets/bootstrap/mixins/_forms.scss +64 -96
  112. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  113. data/assets/stylesheets/bootstrap/mixins/_grid.scss +118 -36
  114. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  115. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
  116. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  117. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
  118. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
  119. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
  120. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  121. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
  122. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
  123. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  124. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +211 -91
  125. data/bootstrap.gemspec +6 -6
  126. data/lib/bootstrap/engine.rb +0 -1
  127. data/lib/bootstrap/version.rb +2 -2
  128. data/tasks/updater/js.rb +17 -5
  129. data/tasks/updater/network.rb +2 -2
  130. data/tasks/updater/scss.rb +2 -2
  131. data/tasks/updater.rb +2 -2
  132. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  133. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  134. data/test/dummy_rails/app/views/pages/root.html +89 -0
  135. data/test/dummy_rails/config/application.rb +0 -5
  136. data/test/dummy_rails/public/favicon.ico +0 -0
  137. data/test/gemfiles/rails_4_2.gemfile +2 -1
  138. data/test/gemfiles/rails_5_0.gemfile +1 -2
  139. data/test/gemfiles/rails_5_1.gemfile +1 -2
  140. data/test/gemfiles/rails_5_2.gemfile +7 -0
  141. data/test/gemfiles/rails_6_0.gemfile +1 -1
  142. data/test/gemfiles/rails_6_1.gemfile +7 -0
  143. data/test/gemfiles/rails_7_0_dartsass.gemfile +0 -1
  144. data/test/gemfiles/rails_7_0_sassc.gemfile +0 -1
  145. data/test/rails_test.rb +0 -5
  146. data/test/test_helper.rb +3 -2
  147. metadata +92 -86
  148. data/.travis.yml +0 -31
  149. data/assets/javascripts/bootstrap/util.js +0 -189
  150. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  151. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  152. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  153. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  154. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  155. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  156. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  157. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  158. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  159. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  160. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  161. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  162. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
  163. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  164. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  165. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  166. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  167. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  168. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  169. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  170. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  171. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  172. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  173. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  174. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  175. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  176. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  177. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  178. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  179. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  180. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  181. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  182. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  183. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  184. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  185. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  186. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,887 +1,543 @@
1
1
  /*!
2
- * Bootstrap tooltip.js v4.6.2 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap tooltip.js v5.3.5 (https://getbootstrap.com/)
3
+ * Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('popper.js'), require('./util.js')) :
8
- typeof define === 'function' && define.amd ? define(['jquery', 'popper.js', './util'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.jQuery, global.Popper, global.Util));
10
- })(this, (function ($, Popper, Util) { 'use strict';
11
-
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- var $__default = /*#__PURE__*/_interopDefaultLegacy($);
15
- var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
16
- var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
17
-
18
- function _defineProperties(target, props) {
19
- for (var i = 0; i < props.length; i++) {
20
- var descriptor = props[i];
21
- descriptor.enumerable = descriptor.enumerable || false;
22
- descriptor.configurable = true;
23
- if ("value" in descriptor) descriptor.writable = true;
24
- Object.defineProperty(target, descriptor.key, descriptor);
25
- }
26
- }
27
-
28
- function _createClass(Constructor, protoProps, staticProps) {
29
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
30
- if (staticProps) _defineProperties(Constructor, staticProps);
31
- Object.defineProperty(Constructor, "prototype", {
32
- writable: false
33
- });
34
- return Constructor;
35
- }
36
-
37
- function _extends() {
38
- _extends = Object.assign ? Object.assign.bind() : function (target) {
39
- for (var i = 1; i < arguments.length; i++) {
40
- var source = arguments[i];
41
-
42
- for (var key in source) {
43
- if (Object.prototype.hasOwnProperty.call(source, key)) {
44
- target[key] = source[key];
45
- }
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./util/index.js'), require('./util/sanitizer.js'), require('./util/template-factory.js')) :
8
+ typeof define === 'function' && define.amd ? define(['@popperjs/core', './base-component', './dom/event-handler', './dom/manipulator', './util/index', './util/sanitizer', './util/template-factory'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global["@popperjs/core"], global.BaseComponent, global.EventHandler, global.Manipulator, global.Index, global.Sanitizer, global.TemplateFactory));
10
+ })(this, (function (Popper, BaseComponent, EventHandler, Manipulator, index_js, sanitizer_js, TemplateFactory) { 'use strict';
11
+
12
+ function _interopNamespaceDefault(e) {
13
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
14
+ if (e) {
15
+ for (const k in e) {
16
+ if (k !== 'default') {
17
+ const d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: () => e[k]
21
+ });
46
22
  }
47
23
  }
48
-
49
- return target;
50
- };
51
- return _extends.apply(this, arguments);
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
52
27
  }
53
28
 
29
+ const Popper__namespace = /*#__PURE__*/_interopNamespaceDefault(Popper);
30
+
54
31
  /**
55
32
  * --------------------------------------------------------------------------
56
- * Bootstrap (v4.6.2): tools/sanitizer.js
33
+ * Bootstrap tooltip.js
57
34
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
58
35
  * --------------------------------------------------------------------------
59
36
  */
60
- var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
61
- var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
62
- var DefaultWhitelist = {
63
- // Global attributes allowed on any supplied element below.
64
- '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
65
- a: ['target', 'href', 'title', 'rel'],
66
- area: [],
67
- b: [],
68
- br: [],
69
- col: [],
70
- code: [],
71
- div: [],
72
- em: [],
73
- hr: [],
74
- h1: [],
75
- h2: [],
76
- h3: [],
77
- h4: [],
78
- h5: [],
79
- h6: [],
80
- i: [],
81
- img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
82
- li: [],
83
- ol: [],
84
- p: [],
85
- pre: [],
86
- s: [],
87
- small: [],
88
- span: [],
89
- sub: [],
90
- sup: [],
91
- strong: [],
92
- u: [],
93
- ul: []
94
- };
95
- /**
96
- * A pattern that recognizes a commonly useful subset of URLs that are safe.
97
- *
98
- * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
99
- */
100
-
101
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
102
- /**
103
- * A pattern that matches safe data URLs. Only matches image, video and audio types.
104
- *
105
- * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
106
- */
107
-
108
- var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
109
-
110
- function allowedAttribute(attr, allowedAttributeList) {
111
- var attrName = attr.nodeName.toLowerCase();
112
-
113
- if (allowedAttributeList.indexOf(attrName) !== -1) {
114
- if (uriAttrs.indexOf(attrName) !== -1) {
115
- return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
116
- }
117
-
118
- return true;
119
- }
120
-
121
- var regExp = allowedAttributeList.filter(function (attrRegex) {
122
- return attrRegex instanceof RegExp;
123
- }); // Check if a regular expression validates the attribute.
124
-
125
- for (var i = 0, len = regExp.length; i < len; i++) {
126
- if (regExp[i].test(attrName)) {
127
- return true;
128
- }
129
- }
130
-
131
- return false;
132
- }
133
-
134
- function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
135
- if (unsafeHtml.length === 0) {
136
- return unsafeHtml;
137
- }
138
-
139
- if (sanitizeFn && typeof sanitizeFn === 'function') {
140
- return sanitizeFn(unsafeHtml);
141
- }
142
-
143
- var domParser = new window.DOMParser();
144
- var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
145
- var whitelistKeys = Object.keys(whiteList);
146
- var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
147
-
148
- var _loop = function _loop(i, len) {
149
- var el = elements[i];
150
- var elName = el.nodeName.toLowerCase();
151
-
152
- if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
153
- el.parentNode.removeChild(el);
154
- return "continue";
155
- }
156
37
 
157
- var attributeList = [].slice.call(el.attributes); // eslint-disable-next-line unicorn/prefer-spread
158
-
159
- var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
160
- attributeList.forEach(function (attr) {
161
- if (!allowedAttribute(attr, whitelistedAttributes)) {
162
- el.removeAttribute(attr.nodeName);
163
- }
164
- });
165
- };
166
-
167
- for (var i = 0, len = elements.length; i < len; i++) {
168
- var _ret = _loop(i);
169
-
170
- if (_ret === "continue") continue;
171
- }
172
-
173
- return createdDocument.body.innerHTML;
174
- }
175
38
 
176
39
  /**
177
40
  * Constants
178
41
  */
179
42
 
180
- var NAME = 'tooltip';
181
- var VERSION = '4.6.2';
182
- var DATA_KEY = 'bs.tooltip';
183
- var EVENT_KEY = "." + DATA_KEY;
184
- var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
185
- var CLASS_PREFIX = 'bs-tooltip';
186
- var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
187
- var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
188
- var CLASS_NAME_FADE = 'fade';
189
- var CLASS_NAME_SHOW = 'show';
190
- var HOVER_STATE_SHOW = 'show';
191
- var HOVER_STATE_OUT = 'out';
192
- var SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
193
- var SELECTOR_ARROW = '.arrow';
194
- var TRIGGER_HOVER = 'hover';
195
- var TRIGGER_FOCUS = 'focus';
196
- var TRIGGER_CLICK = 'click';
197
- var TRIGGER_MANUAL = 'manual';
198
- var AttachmentMap = {
43
+ const NAME = 'tooltip';
44
+ const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
45
+ const CLASS_NAME_FADE = 'fade';
46
+ const CLASS_NAME_MODAL = 'modal';
47
+ const CLASS_NAME_SHOW = 'show';
48
+ const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
49
+ const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
50
+ const EVENT_MODAL_HIDE = 'hide.bs.modal';
51
+ const TRIGGER_HOVER = 'hover';
52
+ const TRIGGER_FOCUS = 'focus';
53
+ const TRIGGER_CLICK = 'click';
54
+ const TRIGGER_MANUAL = 'manual';
55
+ const EVENT_HIDE = 'hide';
56
+ const EVENT_HIDDEN = 'hidden';
57
+ const EVENT_SHOW = 'show';
58
+ const EVENT_SHOWN = 'shown';
59
+ const EVENT_INSERTED = 'inserted';
60
+ const EVENT_CLICK = 'click';
61
+ const EVENT_FOCUSIN = 'focusin';
62
+ const EVENT_FOCUSOUT = 'focusout';
63
+ const EVENT_MOUSEENTER = 'mouseenter';
64
+ const EVENT_MOUSELEAVE = 'mouseleave';
65
+ const AttachmentMap = {
199
66
  AUTO: 'auto',
200
67
  TOP: 'top',
201
- RIGHT: 'right',
68
+ RIGHT: index_js.isRTL() ? 'left' : 'right',
202
69
  BOTTOM: 'bottom',
203
- LEFT: 'left'
70
+ LEFT: index_js.isRTL() ? 'right' : 'left'
204
71
  };
205
- var Default = {
72
+ const Default = {
73
+ allowList: sanitizer_js.DefaultAllowlist,
206
74
  animation: true,
207
- template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
208
- trigger: 'hover focus',
209
- title: '',
75
+ boundary: 'clippingParents',
76
+ container: false,
77
+ customClass: '',
210
78
  delay: 0,
79
+ fallbackPlacements: ['top', 'right', 'bottom', 'left'],
211
80
  html: false,
212
- selector: false,
81
+ offset: [0, 6],
213
82
  placement: 'top',
214
- offset: 0,
215
- container: false,
216
- fallbackPlacement: 'flip',
217
- boundary: 'scrollParent',
218
- customClass: '',
83
+ popperConfig: null,
219
84
  sanitize: true,
220
85
  sanitizeFn: null,
221
- whiteList: DefaultWhitelist,
222
- popperConfig: null
86
+ selector: false,
87
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
88
+ title: '',
89
+ trigger: 'hover focus'
223
90
  };
224
- var DefaultType = {
91
+ const DefaultType = {
92
+ allowList: 'object',
225
93
  animation: 'boolean',
226
- template: 'string',
227
- title: '(string|element|function)',
228
- trigger: 'string',
94
+ boundary: '(string|element)',
95
+ container: '(string|element|boolean)',
96
+ customClass: '(string|function)',
229
97
  delay: '(number|object)',
98
+ fallbackPlacements: 'array',
230
99
  html: 'boolean',
231
- selector: '(string|boolean)',
100
+ offset: '(array|string|function)',
232
101
  placement: '(string|function)',
233
- offset: '(number|string|function)',
234
- container: '(string|element|boolean)',
235
- fallbackPlacement: '(string|array)',
236
- boundary: '(string|element)',
237
- customClass: '(string|function)',
102
+ popperConfig: '(null|object|function)',
238
103
  sanitize: 'boolean',
239
104
  sanitizeFn: '(null|function)',
240
- whiteList: 'object',
241
- popperConfig: '(null|object)'
242
- };
243
- var Event = {
244
- HIDE: "hide" + EVENT_KEY,
245
- HIDDEN: "hidden" + EVENT_KEY,
246
- SHOW: "show" + EVENT_KEY,
247
- SHOWN: "shown" + EVENT_KEY,
248
- INSERTED: "inserted" + EVENT_KEY,
249
- CLICK: "click" + EVENT_KEY,
250
- FOCUSIN: "focusin" + EVENT_KEY,
251
- FOCUSOUT: "focusout" + EVENT_KEY,
252
- MOUSEENTER: "mouseenter" + EVENT_KEY,
253
- MOUSELEAVE: "mouseleave" + EVENT_KEY
105
+ selector: '(string|boolean)',
106
+ template: 'string',
107
+ title: '(string|element|function)',
108
+ trigger: 'string'
254
109
  };
110
+
255
111
  /**
256
112
  * Class definition
257
113
  */
258
114
 
259
- var Tooltip = /*#__PURE__*/function () {
260
- function Tooltip(element, config) {
261
- if (typeof Popper__default["default"] === 'undefined') {
262
- throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
263
- } // Private
264
-
115
+ class Tooltip extends BaseComponent {
116
+ constructor(element, config) {
117
+ if (typeof Popper__namespace === 'undefined') {
118
+ throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org/docs/v2/)');
119
+ }
120
+ super(element, config);
265
121
 
122
+ // Private
266
123
  this._isEnabled = true;
267
124
  this._timeout = 0;
268
- this._hoverState = '';
125
+ this._isHovered = null;
269
126
  this._activeTrigger = {};
270
- this._popper = null; // Protected
127
+ this._popper = null;
128
+ this._templateFactory = null;
129
+ this._newContent = null;
271
130
 
272
- this.element = element;
273
- this.config = this._getConfig(config);
131
+ // Protected
274
132
  this.tip = null;
275
-
276
133
  this._setListeners();
277
- } // Getters
278
-
134
+ if (!this._config.selector) {
135
+ this._fixTitle();
136
+ }
137
+ }
279
138
 
280
- var _proto = Tooltip.prototype;
139
+ // Getters
140
+ static get Default() {
141
+ return Default;
142
+ }
143
+ static get DefaultType() {
144
+ return DefaultType;
145
+ }
146
+ static get NAME() {
147
+ return NAME;
148
+ }
281
149
 
282
150
  // Public
283
- _proto.enable = function enable() {
151
+ enable() {
284
152
  this._isEnabled = true;
285
- };
286
-
287
- _proto.disable = function disable() {
153
+ }
154
+ disable() {
288
155
  this._isEnabled = false;
289
- };
290
-
291
- _proto.toggleEnabled = function toggleEnabled() {
156
+ }
157
+ toggleEnabled() {
292
158
  this._isEnabled = !this._isEnabled;
293
- };
294
-
295
- _proto.toggle = function toggle(event) {
159
+ }
160
+ toggle() {
296
161
  if (!this._isEnabled) {
297
162
  return;
298
163
  }
299
-
300
- if (event) {
301
- var dataKey = this.constructor.DATA_KEY;
302
- var context = $__default["default"](event.currentTarget).data(dataKey);
303
-
304
- if (!context) {
305
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
306
- $__default["default"](event.currentTarget).data(dataKey, context);
307
- }
308
-
309
- context._activeTrigger.click = !context._activeTrigger.click;
310
-
311
- if (context._isWithActiveTrigger()) {
312
- context._enter(null, context);
313
- } else {
314
- context._leave(null, context);
315
- }
316
- } else {
317
- if ($__default["default"](this.getTipElement()).hasClass(CLASS_NAME_SHOW)) {
318
- this._leave(null, this);
319
-
320
- return;
321
- }
322
-
323
- this._enter(null, this);
164
+ if (this._isShown()) {
165
+ this._leave();
166
+ return;
324
167
  }
325
- };
326
-
327
- _proto.dispose = function dispose() {
168
+ this._enter();
169
+ }
170
+ dispose() {
328
171
  clearTimeout(this._timeout);
329
- $__default["default"].removeData(this.element, this.constructor.DATA_KEY);
330
- $__default["default"](this.element).off(this.constructor.EVENT_KEY);
331
- $__default["default"](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
332
-
333
- if (this.tip) {
334
- $__default["default"](this.tip).remove();
335
- }
336
-
337
- this._isEnabled = null;
338
- this._timeout = null;
339
- this._hoverState = null;
340
- this._activeTrigger = null;
341
-
342
- if (this._popper) {
343
- this._popper.destroy();
172
+ EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
173
+ if (this._element.getAttribute('data-bs-original-title')) {
174
+ this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
344
175
  }
345
-
346
- this._popper = null;
347
- this.element = null;
348
- this.config = null;
349
- this.tip = null;
350
- };
351
-
352
- _proto.show = function show() {
353
- var _this = this;
354
-
355
- if ($__default["default"](this.element).css('display') === 'none') {
176
+ this._disposePopper();
177
+ super.dispose();
178
+ }
179
+ show() {
180
+ if (this._element.style.display === 'none') {
356
181
  throw new Error('Please use show on visible elements');
357
182
  }
358
-
359
- var showEvent = $__default["default"].Event(this.constructor.Event.SHOW);
360
-
361
- if (this.isWithContent() && this._isEnabled) {
362
- $__default["default"](this.element).trigger(showEvent);
363
- var shadowRoot = Util__default["default"].findShadowRoot(this.element);
364
- var isInTheDom = $__default["default"].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
365
-
366
- if (showEvent.isDefaultPrevented() || !isInTheDom) {
367
- return;
368
- }
369
-
370
- var tip = this.getTipElement();
371
- var tipId = Util__default["default"].getUID(this.constructor.NAME);
372
- tip.setAttribute('id', tipId);
373
- this.element.setAttribute('aria-describedby', tipId);
374
- this.setContent();
375
-
376
- if (this.config.animation) {
377
- $__default["default"](tip).addClass(CLASS_NAME_FADE);
378
- }
379
-
380
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
381
-
382
- var attachment = this._getAttachment(placement);
383
-
384
- this.addAttachmentClass(attachment);
385
-
386
- var container = this._getContainer();
387
-
388
- $__default["default"](tip).data(this.constructor.DATA_KEY, this);
389
-
390
- if (!$__default["default"].contains(this.element.ownerDocument.documentElement, this.tip)) {
391
- $__default["default"](tip).appendTo(container);
392
- }
393
-
394
- $__default["default"](this.element).trigger(this.constructor.Event.INSERTED);
395
- this._popper = new Popper__default["default"](this.element, tip, this._getPopperConfig(attachment));
396
- $__default["default"](tip).addClass(CLASS_NAME_SHOW);
397
- $__default["default"](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra
398
- // empty mouseover listeners to the body's immediate children;
399
- // only needed because of broken event delegation on iOS
400
- // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
401
-
402
- if ('ontouchstart' in document.documentElement) {
403
- $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop);
404
- }
405
-
406
- var complete = function complete() {
407
- if (_this.config.animation) {
408
- _this._fixTransition();
409
- }
410
-
411
- var prevHoverState = _this._hoverState;
412
- _this._hoverState = null;
413
- $__default["default"](_this.element).trigger(_this.constructor.Event.SHOWN);
414
-
415
- if (prevHoverState === HOVER_STATE_OUT) {
416
- _this._leave(null, _this);
417
- }
418
- };
419
-
420
- if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE)) {
421
- var transitionDuration = Util__default["default"].getTransitionDurationFromElement(this.tip);
422
- $__default["default"](this.tip).one(Util__default["default"].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
423
- } else {
424
- complete();
425
- }
183
+ if (!(this._isWithContent() && this._isEnabled)) {
184
+ return;
185
+ }
186
+ const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW));
187
+ const shadowRoot = index_js.findShadowRoot(this._element);
188
+ const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
189
+ if (showEvent.defaultPrevented || !isInTheDom) {
190
+ return;
426
191
  }
427
- };
428
-
429
- _proto.hide = function hide(callback) {
430
- var _this2 = this;
431
-
432
- var tip = this.getTipElement();
433
- var hideEvent = $__default["default"].Event(this.constructor.Event.HIDE);
434
-
435
- var complete = function complete() {
436
- if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
437
- tip.parentNode.removeChild(tip);
438
- }
439
-
440
- _this2._cleanTipClass();
441
-
442
- _this2.element.removeAttribute('aria-describedby');
443
-
444
- $__default["default"](_this2.element).trigger(_this2.constructor.Event.HIDDEN);
445
192
 
446
- if (_this2._popper !== null) {
447
- _this2._popper.destroy();
193
+ // TODO: v6 remove this or make it optional
194
+ this._disposePopper();
195
+ const tip = this._getTipElement();
196
+ this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
197
+ const {
198
+ container
199
+ } = this._config;
200
+ if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
201
+ container.append(tip);
202
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
203
+ }
204
+ this._popper = this._createPopper(tip);
205
+ tip.classList.add(CLASS_NAME_SHOW);
206
+
207
+ // If this is a touch-enabled device we add extra
208
+ // empty mouseover listeners to the body's immediate children;
209
+ // only needed because of broken event delegation on iOS
210
+ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
211
+ if ('ontouchstart' in document.documentElement) {
212
+ for (const element of [].concat(...document.body.children)) {
213
+ EventHandler.on(element, 'mouseover', index_js.noop);
448
214
  }
449
-
450
- if (callback) {
451
- callback();
215
+ }
216
+ const complete = () => {
217
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN));
218
+ if (this._isHovered === false) {
219
+ this._leave();
452
220
  }
221
+ this._isHovered = false;
453
222
  };
454
-
455
- $__default["default"](this.element).trigger(hideEvent);
456
-
457
- if (hideEvent.isDefaultPrevented()) {
223
+ this._queueCallback(complete, this.tip, this._isAnimated());
224
+ }
225
+ hide() {
226
+ if (!this._isShown()) {
227
+ return;
228
+ }
229
+ const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE));
230
+ if (hideEvent.defaultPrevented) {
458
231
  return;
459
232
  }
233
+ const tip = this._getTipElement();
234
+ tip.classList.remove(CLASS_NAME_SHOW);
460
235
 
461
- $__default["default"](tip).removeClass(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra
236
+ // If this is a touch-enabled device we remove the extra
462
237
  // empty mouseover listeners we added for iOS support
463
-
464
238
  if ('ontouchstart' in document.documentElement) {
465
- $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop);
239
+ for (const element of [].concat(...document.body.children)) {
240
+ EventHandler.off(element, 'mouseover', index_js.noop);
241
+ }
466
242
  }
467
-
468
243
  this._activeTrigger[TRIGGER_CLICK] = false;
469
244
  this._activeTrigger[TRIGGER_FOCUS] = false;
470
245
  this._activeTrigger[TRIGGER_HOVER] = false;
246
+ this._isHovered = null; // it is a trick to support manual triggering
471
247
 
472
- if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE)) {
473
- var transitionDuration = Util__default["default"].getTransitionDurationFromElement(tip);
474
- $__default["default"](tip).one(Util__default["default"].TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
475
- } else {
476
- complete();
248
+ const complete = () => {
249
+ if (this._isWithActiveTrigger()) {
250
+ return;
251
+ }
252
+ if (!this._isHovered) {
253
+ this._disposePopper();
254
+ }
255
+ this._element.removeAttribute('aria-describedby');
256
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN));
257
+ };
258
+ this._queueCallback(complete, this.tip, this._isAnimated());
259
+ }
260
+ update() {
261
+ if (this._popper) {
262
+ this._popper.update();
477
263
  }
264
+ }
478
265
 
479
- this._hoverState = '';
480
- };
481
-
482
- _proto.update = function update() {
483
- if (this._popper !== null) {
484
- this._popper.scheduleUpdate();
266
+ // Protected
267
+ _isWithContent() {
268
+ return Boolean(this._getTitle());
269
+ }
270
+ _getTipElement() {
271
+ if (!this.tip) {
272
+ this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
485
273
  }
486
- } // Protected
487
- ;
488
-
489
- _proto.isWithContent = function isWithContent() {
490
- return Boolean(this.getTitle());
491
- };
492
-
493
- _proto.addAttachmentClass = function addAttachmentClass(attachment) {
494
- $__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
495
- };
496
-
497
- _proto.getTipElement = function getTipElement() {
498
- this.tip = this.tip || $__default["default"](this.config.template)[0];
499
274
  return this.tip;
500
- };
501
-
502
- _proto.setContent = function setContent() {
503
- var tip = this.getTipElement();
504
- this.setElementContent($__default["default"](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle());
505
- $__default["default"](tip).removeClass(CLASS_NAME_FADE + " " + CLASS_NAME_SHOW);
506
- };
507
-
508
- _proto.setElementContent = function setElementContent($element, content) {
509
- if (typeof content === 'object' && (content.nodeType || content.jquery)) {
510
- // Content is a DOM node or a jQuery
511
- if (this.config.html) {
512
- if (!$__default["default"](content).parent().is($element)) {
513
- $element.empty().append(content);
514
- }
515
- } else {
516
- $element.text($__default["default"](content).text());
517
- }
518
-
519
- return;
275
+ }
276
+ _createTipElement(content) {
277
+ const tip = this._getTemplateFactory(content).toHtml();
278
+
279
+ // TODO: remove this check in v6
280
+ if (!tip) {
281
+ return null;
282
+ }
283
+ tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
284
+ // TODO: v6 the following can be achieved with CSS only
285
+ tip.classList.add(`bs-${this.constructor.NAME}-auto`);
286
+ const tipId = index_js.getUID(this.constructor.NAME).toString();
287
+ tip.setAttribute('id', tipId);
288
+ if (this._isAnimated()) {
289
+ tip.classList.add(CLASS_NAME_FADE);
290
+ }
291
+ return tip;
292
+ }
293
+ setContent(content) {
294
+ this._newContent = content;
295
+ if (this._isShown()) {
296
+ this._disposePopper();
297
+ this.show();
520
298
  }
521
-
522
- if (this.config.html) {
523
- if (this.config.sanitize) {
524
- content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
525
- }
526
-
527
- $element.html(content);
299
+ }
300
+ _getTemplateFactory(content) {
301
+ if (this._templateFactory) {
302
+ this._templateFactory.changeContent(content);
528
303
  } else {
529
- $element.text(content);
304
+ this._templateFactory = new TemplateFactory({
305
+ ...this._config,
306
+ // the `content` var has to be after `this._config`
307
+ // to override config.content in case of popover
308
+ content,
309
+ extraClass: this._resolvePossibleFunction(this._config.customClass)
310
+ });
530
311
  }
531
- };
532
-
533
- _proto.getTitle = function getTitle() {
534
- var title = this.element.getAttribute('data-original-title');
312
+ return this._templateFactory;
313
+ }
314
+ _getContentForTemplate() {
315
+ return {
316
+ [SELECTOR_TOOLTIP_INNER]: this._getTitle()
317
+ };
318
+ }
319
+ _getTitle() {
320
+ return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
321
+ }
535
322
 
536
- if (!title) {
537
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
323
+ // Private
324
+ _initializeOnDelegatedTarget(event) {
325
+ return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
326
+ }
327
+ _isAnimated() {
328
+ return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE);
329
+ }
330
+ _isShown() {
331
+ return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW);
332
+ }
333
+ _createPopper(tip) {
334
+ const placement = index_js.execute(this._config.placement, [this, tip, this._element]);
335
+ const attachment = AttachmentMap[placement.toUpperCase()];
336
+ return Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
337
+ }
338
+ _getOffset() {
339
+ const {
340
+ offset
341
+ } = this._config;
342
+ if (typeof offset === 'string') {
343
+ return offset.split(',').map(value => Number.parseInt(value, 10));
538
344
  }
539
-
540
- return title;
541
- } // Private
542
- ;
543
-
544
- _proto._getPopperConfig = function _getPopperConfig(attachment) {
545
- var _this3 = this;
546
-
547
- var defaultBsConfig = {
345
+ if (typeof offset === 'function') {
346
+ return popperData => offset(popperData, this._element);
347
+ }
348
+ return offset;
349
+ }
350
+ _resolvePossibleFunction(arg) {
351
+ return index_js.execute(arg, [this._element, this._element]);
352
+ }
353
+ _getPopperConfig(attachment) {
354
+ const defaultBsPopperConfig = {
548
355
  placement: attachment,
549
- modifiers: {
550
- offset: this._getOffset(),
551
- flip: {
552
- behavior: this.config.fallbackPlacement
553
- },
554
- arrow: {
555
- element: SELECTOR_ARROW
556
- },
557
- preventOverflow: {
558
- boundariesElement: this.config.boundary
356
+ modifiers: [{
357
+ name: 'flip',
358
+ options: {
359
+ fallbackPlacements: this._config.fallbackPlacements
559
360
  }
560
- },
561
- onCreate: function onCreate(data) {
562
- if (data.originalPlacement !== data.placement) {
563
- _this3._handlePopperPlacementChange(data);
361
+ }, {
362
+ name: 'offset',
363
+ options: {
364
+ offset: this._getOffset()
564
365
  }
565
- },
566
- onUpdate: function onUpdate(data) {
567
- return _this3._handlePopperPlacementChange(data);
568
- }
366
+ }, {
367
+ name: 'preventOverflow',
368
+ options: {
369
+ boundary: this._config.boundary
370
+ }
371
+ }, {
372
+ name: 'arrow',
373
+ options: {
374
+ element: `.${this.constructor.NAME}-arrow`
375
+ }
376
+ }, {
377
+ name: 'preSetPlacement',
378
+ enabled: true,
379
+ phase: 'beforeMain',
380
+ fn: data => {
381
+ // Pre-set Popper's placement attribute in order to read the arrow sizes properly.
382
+ // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
383
+ this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
384
+ }
385
+ }]
569
386
  };
570
- return _extends({}, defaultBsConfig, this.config.popperConfig);
571
- };
572
-
573
- _proto._getOffset = function _getOffset() {
574
- var _this4 = this;
575
-
576
- var offset = {};
577
-
578
- if (typeof this.config.offset === 'function') {
579
- offset.fn = function (data) {
580
- data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element));
581
- return data;
582
- };
583
- } else {
584
- offset.offset = this.config.offset;
585
- }
586
-
587
- return offset;
588
- };
589
-
590
- _proto._getContainer = function _getContainer() {
591
- if (this.config.container === false) {
592
- return document.body;
593
- }
594
-
595
- if (Util__default["default"].isElement(this.config.container)) {
596
- return $__default["default"](this.config.container);
597
- }
598
-
599
- return $__default["default"](document).find(this.config.container);
600
- };
601
-
602
- _proto._getAttachment = function _getAttachment(placement) {
603
- return AttachmentMap[placement.toUpperCase()];
604
- };
605
-
606
- _proto._setListeners = function _setListeners() {
607
- var _this5 = this;
608
-
609
- var triggers = this.config.trigger.split(' ');
610
- triggers.forEach(function (trigger) {
387
+ return {
388
+ ...defaultBsPopperConfig,
389
+ ...index_js.execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
390
+ };
391
+ }
392
+ _setListeners() {
393
+ const triggers = this._config.trigger.split(' ');
394
+ for (const trigger of triggers) {
611
395
  if (trigger === 'click') {
612
- $__default["default"](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
613
- return _this5.toggle(event);
396
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {
397
+ const context = this._initializeOnDelegatedTarget(event);
398
+ context.toggle();
614
399
  });
615
400
  } else if (trigger !== TRIGGER_MANUAL) {
616
- var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
617
- var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
618
- $__default["default"](_this5.element).on(eventIn, _this5.config.selector, function (event) {
619
- return _this5._enter(event);
620
- }).on(eventOut, _this5.config.selector, function (event) {
621
- return _this5._leave(event);
401
+ const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN);
402
+ const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT);
403
+ EventHandler.on(this._element, eventIn, this._config.selector, event => {
404
+ const context = this._initializeOnDelegatedTarget(event);
405
+ context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
406
+ context._enter();
407
+ });
408
+ EventHandler.on(this._element, eventOut, this._config.selector, event => {
409
+ const context = this._initializeOnDelegatedTarget(event);
410
+ context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
411
+ context._leave();
622
412
  });
623
413
  }
624
- });
625
-
626
- this._hideModalHandler = function () {
627
- if (_this5.element) {
628
- _this5.hide();
414
+ }
415
+ this._hideModalHandler = () => {
416
+ if (this._element) {
417
+ this.hide();
629
418
  }
630
419
  };
631
-
632
- $__default["default"](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
633
-
634
- if (this.config.selector) {
635
- this.config = _extends({}, this.config, {
636
- trigger: 'manual',
637
- selector: ''
638
- });
639
- } else {
640
- this._fixTitle();
641
- }
642
- };
643
-
644
- _proto._fixTitle = function _fixTitle() {
645
- var titleType = typeof this.element.getAttribute('data-original-title');
646
-
647
- if (this.element.getAttribute('title') || titleType !== 'string') {
648
- this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
649
- this.element.setAttribute('title', '');
650
- }
651
- };
652
-
653
- _proto._enter = function _enter(event, context) {
654
- var dataKey = this.constructor.DATA_KEY;
655
- context = context || $__default["default"](event.currentTarget).data(dataKey);
656
-
657
- if (!context) {
658
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
659
- $__default["default"](event.currentTarget).data(dataKey, context);
660
- }
661
-
662
- if (event) {
663
- context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
664
- }
665
-
666
- if ($__default["default"](context.getTipElement()).hasClass(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) {
667
- context._hoverState = HOVER_STATE_SHOW;
668
- return;
669
- }
670
-
671
- clearTimeout(context._timeout);
672
- context._hoverState = HOVER_STATE_SHOW;
673
-
674
- if (!context.config.delay || !context.config.delay.show) {
675
- context.show();
420
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
421
+ }
422
+ _fixTitle() {
423
+ const title = this._element.getAttribute('title');
424
+ if (!title) {
676
425
  return;
677
426
  }
678
-
679
- context._timeout = setTimeout(function () {
680
- if (context._hoverState === HOVER_STATE_SHOW) {
681
- context.show();
682
- }
683
- }, context.config.delay.show);
684
- };
685
-
686
- _proto._leave = function _leave(event, context) {
687
- var dataKey = this.constructor.DATA_KEY;
688
- context = context || $__default["default"](event.currentTarget).data(dataKey);
689
-
690
- if (!context) {
691
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
692
- $__default["default"](event.currentTarget).data(dataKey, context);
427
+ if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
428
+ this._element.setAttribute('aria-label', title);
693
429
  }
694
-
695
- if (event) {
696
- context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
697
- }
698
-
699
- if (context._isWithActiveTrigger()) {
430
+ this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
431
+ this._element.removeAttribute('title');
432
+ }
433
+ _enter() {
434
+ if (this._isShown() || this._isHovered) {
435
+ this._isHovered = true;
700
436
  return;
701
437
  }
702
-
703
- clearTimeout(context._timeout);
704
- context._hoverState = HOVER_STATE_OUT;
705
-
706
- if (!context.config.delay || !context.config.delay.hide) {
707
- context.hide();
438
+ this._isHovered = true;
439
+ this._setTimeout(() => {
440
+ if (this._isHovered) {
441
+ this.show();
442
+ }
443
+ }, this._config.delay.show);
444
+ }
445
+ _leave() {
446
+ if (this._isWithActiveTrigger()) {
708
447
  return;
709
448
  }
710
-
711
- context._timeout = setTimeout(function () {
712
- if (context._hoverState === HOVER_STATE_OUT) {
713
- context.hide();
449
+ this._isHovered = false;
450
+ this._setTimeout(() => {
451
+ if (!this._isHovered) {
452
+ this.hide();
714
453
  }
715
- }, context.config.delay.hide);
716
- };
717
-
718
- _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
719
- for (var trigger in this._activeTrigger) {
720
- if (this._activeTrigger[trigger]) {
721
- return true;
454
+ }, this._config.delay.hide);
455
+ }
456
+ _setTimeout(handler, timeout) {
457
+ clearTimeout(this._timeout);
458
+ this._timeout = setTimeout(handler, timeout);
459
+ }
460
+ _isWithActiveTrigger() {
461
+ return Object.values(this._activeTrigger).includes(true);
462
+ }
463
+ _getConfig(config) {
464
+ const dataAttributes = Manipulator.getDataAttributes(this._element);
465
+ for (const dataAttribute of Object.keys(dataAttributes)) {
466
+ if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
467
+ delete dataAttributes[dataAttribute];
722
468
  }
723
469
  }
724
-
725
- return false;
726
- };
727
-
728
- _proto._getConfig = function _getConfig(config) {
729
- var dataAttributes = $__default["default"](this.element).data();
730
- Object.keys(dataAttributes).forEach(function (dataAttr) {
731
- if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
732
- delete dataAttributes[dataAttr];
733
- }
734
- });
735
- config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
736
-
470
+ config = {
471
+ ...dataAttributes,
472
+ ...(typeof config === 'object' && config ? config : {})
473
+ };
474
+ config = this._mergeConfigObj(config);
475
+ config = this._configAfterMerge(config);
476
+ this._typeCheckConfig(config);
477
+ return config;
478
+ }
479
+ _configAfterMerge(config) {
480
+ config.container = config.container === false ? document.body : index_js.getElement(config.container);
737
481
  if (typeof config.delay === 'number') {
738
482
  config.delay = {
739
483
  show: config.delay,
740
484
  hide: config.delay
741
485
  };
742
486
  }
743
-
744
487
  if (typeof config.title === 'number') {
745
488
  config.title = config.title.toString();
746
489
  }
747
-
748
490
  if (typeof config.content === 'number') {
749
491
  config.content = config.content.toString();
750
492
  }
751
-
752
- Util__default["default"].typeCheckConfig(NAME, config, this.constructor.DefaultType);
753
-
754
- if (config.sanitize) {
755
- config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
756
- }
757
-
758
493
  return config;
759
- };
760
-
761
- _proto._getDelegateConfig = function _getDelegateConfig() {
762
- var config = {};
763
-
764
- if (this.config) {
765
- for (var key in this.config) {
766
- if (this.constructor.Default[key] !== this.config[key]) {
767
- config[key] = this.config[key];
768
- }
494
+ }
495
+ _getDelegateConfig() {
496
+ const config = {};
497
+ for (const [key, value] of Object.entries(this._config)) {
498
+ if (this.constructor.Default[key] !== value) {
499
+ config[key] = value;
769
500
  }
770
501
  }
502
+ config.selector = false;
503
+ config.trigger = 'manual';
771
504
 
505
+ // In the future can be replaced with:
506
+ // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
507
+ // `Object.fromEntries(keysWithDifferentValues)`
772
508
  return config;
773
- };
774
-
775
- _proto._cleanTipClass = function _cleanTipClass() {
776
- var $tip = $__default["default"](this.getTipElement());
777
- var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
778
-
779
- if (tabClass !== null && tabClass.length) {
780
- $tip.removeClass(tabClass.join(''));
509
+ }
510
+ _disposePopper() {
511
+ if (this._popper) {
512
+ this._popper.destroy();
513
+ this._popper = null;
781
514
  }
782
- };
783
-
784
- _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
785
- this.tip = popperData.instance.popper;
786
-
787
- this._cleanTipClass();
788
-
789
- this.addAttachmentClass(this._getAttachment(popperData.placement));
790
- };
791
-
792
- _proto._fixTransition = function _fixTransition() {
793
- var tip = this.getTipElement();
794
- var initConfigAnimation = this.config.animation;
795
-
796
- if (tip.getAttribute('x-placement') !== null) {
797
- return;
515
+ if (this.tip) {
516
+ this.tip.remove();
517
+ this.tip = null;
798
518
  }
519
+ }
799
520
 
800
- $__default["default"](tip).removeClass(CLASS_NAME_FADE);
801
- this.config.animation = false;
802
- this.hide();
803
- this.show();
804
- this.config.animation = initConfigAnimation;
805
- } // Static
806
- ;
807
-
808
- Tooltip._jQueryInterface = function _jQueryInterface(config) {
521
+ // Static
522
+ static jQueryInterface(config) {
809
523
  return this.each(function () {
810
- var $element = $__default["default"](this);
811
- var data = $element.data(DATA_KEY);
812
-
813
- var _config = typeof config === 'object' && config;
814
-
815
- if (!data && /dispose|hide/.test(config)) {
524
+ const data = Tooltip.getOrCreateInstance(this, config);
525
+ if (typeof config !== 'string') {
816
526
  return;
817
527
  }
818
-
819
- if (!data) {
820
- data = new Tooltip(this, _config);
821
- $element.data(DATA_KEY, data);
822
- }
823
-
824
- if (typeof config === 'string') {
825
- if (typeof data[config] === 'undefined') {
826
- throw new TypeError("No method named \"" + config + "\"");
827
- }
828
-
829
- data[config]();
528
+ if (typeof data[config] === 'undefined') {
529
+ throw new TypeError(`No method named "${config}"`);
830
530
  }
531
+ data[config]();
831
532
  });
832
- };
833
-
834
- _createClass(Tooltip, null, [{
835
- key: "VERSION",
836
- get: function get() {
837
- return VERSION;
838
- }
839
- }, {
840
- key: "Default",
841
- get: function get() {
842
- return Default;
843
- }
844
- }, {
845
- key: "NAME",
846
- get: function get() {
847
- return NAME;
848
- }
849
- }, {
850
- key: "DATA_KEY",
851
- get: function get() {
852
- return DATA_KEY;
853
- }
854
- }, {
855
- key: "Event",
856
- get: function get() {
857
- return Event;
858
- }
859
- }, {
860
- key: "EVENT_KEY",
861
- get: function get() {
862
- return EVENT_KEY;
863
- }
864
- }, {
865
- key: "DefaultType",
866
- get: function get() {
867
- return DefaultType;
868
- }
869
- }]);
533
+ }
534
+ }
870
535
 
871
- return Tooltip;
872
- }();
873
536
  /**
874
537
  * jQuery
875
538
  */
876
539
 
877
-
878
- $__default["default"].fn[NAME] = Tooltip._jQueryInterface;
879
- $__default["default"].fn[NAME].Constructor = Tooltip;
880
-
881
- $__default["default"].fn[NAME].noConflict = function () {
882
- $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
883
- return Tooltip._jQueryInterface;
884
- };
540
+ index_js.defineJQueryPlugin(Tooltip);
885
541
 
886
542
  return Tooltip;
887
543