bootstrap 4.6.2 → 5.3.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 (175) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +55 -0
  3. data/README.md +28 -5
  4. data/assets/javascripts/bootstrap/alert.js +50 -147
  5. data/assets/javascripts/bootstrap/base-component.js +83 -0
  6. data/assets/javascripts/bootstrap/button.js +40 -190
  7. data/assets/javascripts/bootstrap/carousel.js +282 -537
  8. data/assets/javascripts/bootstrap/collapse.js +166 -314
  9. data/assets/javascripts/bootstrap/dom/data.js +62 -0
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
  12. data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
  13. data/assets/javascripts/bootstrap/dropdown.js +297 -455
  14. data/assets/javascripts/bootstrap/modal.js +223 -566
  15. data/assets/javascripts/bootstrap/offcanvas.js +245 -0
  16. data/assets/javascripts/bootstrap/popover.js +59 -208
  17. data/assets/javascripts/bootstrap/scrollspy.js +213 -276
  18. data/assets/javascripts/bootstrap/tab.js +222 -200
  19. data/assets/javascripts/bootstrap/toast.js +137 -206
  20. data/assets/javascripts/bootstrap/tooltip.js +403 -746
  21. data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
  22. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  23. data/assets/javascripts/bootstrap/util/config.js +67 -0
  24. data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
  25. data/assets/javascripts/bootstrap/util/index.js +281 -0
  26. data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
  27. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  28. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  29. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  30. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  31. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  32. data/assets/javascripts/bootstrap-sprockets.js +21 -5
  33. data/assets/javascripts/bootstrap.js +3623 -3485
  34. data/assets/javascripts/bootstrap.min.js +3 -3
  35. data/assets/stylesheets/_bootstrap-grid.scss +53 -21
  36. data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
  37. data/assets/stylesheets/_bootstrap.scss +21 -13
  38. data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
  39. data/assets/stylesheets/bootstrap/_alert.scss +32 -16
  40. data/assets/stylesheets/bootstrap/_badge.scss +15 -31
  41. data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
  42. data/assets/stylesheets/bootstrap/_button-group.scss +27 -48
  43. data/assets/stylesheets/bootstrap/_buttons.scss +136 -71
  44. data/assets/stylesheets/bootstrap/_card.scss +66 -113
  45. data/assets/stylesheets/bootstrap/_carousel.scss +78 -34
  46. data/assets/stylesheets/bootstrap/_close.scss +51 -28
  47. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  48. data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
  49. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  50. data/assets/stylesheets/bootstrap/_functions.scss +135 -23
  51. data/assets/stylesheets/bootstrap/_grid.scss +18 -52
  52. data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
  53. data/assets/stylesheets/bootstrap/_list-group.scss +77 -34
  54. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  55. data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
  56. data/assets/stylesheets/bootstrap/_modal.scss +107 -110
  57. data/assets/stylesheets/bootstrap/_nav.scss +99 -27
  58. data/assets/stylesheets/bootstrap/_navbar.scss +129 -172
  59. data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
  60. data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
  61. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  62. data/assets/stylesheets/bootstrap/_popover.scss +99 -73
  63. data/assets/stylesheets/bootstrap/_progress.scss +35 -14
  64. data/assets/stylesheets/bootstrap/_reboot.scss +318 -192
  65. data/assets/stylesheets/bootstrap/_root.scss +174 -9
  66. data/assets/stylesheets/bootstrap/_spinners.scss +43 -23
  67. data/assets/stylesheets/bootstrap/_tables.scss +101 -115
  68. data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
  69. data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
  70. data/assets/stylesheets/bootstrap/_transitions.scss +3 -2
  71. data/assets/stylesheets/bootstrap/_type.scss +40 -59
  72. data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
  73. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  74. data/assets/stylesheets/bootstrap/_variables.scss +1202 -606
  75. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +19 -0
  76. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
  77. data/assets/stylesheets/bootstrap/forms/_form-check.scss +188 -0
  78. data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
  79. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  80. data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
  81. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  82. data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
  83. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  84. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  85. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  86. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
  87. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  88. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  89. data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
  90. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  91. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  92. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  93. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  94. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  95. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  96. data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
  97. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  98. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  99. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
  100. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  101. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
  102. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
  103. data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
  104. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  105. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  106. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  107. data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
  108. data/assets/stylesheets/bootstrap/mixins/_forms.scss +54 -96
  109. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  110. data/assets/stylesheets/bootstrap/mixins/_grid.scss +118 -36
  111. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  112. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
  113. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  114. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
  115. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
  116. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
  117. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  118. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
  119. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
  120. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  121. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +211 -91
  122. data/bootstrap.gemspec +3 -5
  123. data/lib/bootstrap/version.rb +2 -2
  124. data/tasks/updater/js.rb +17 -5
  125. data/tasks/updater/network.rb +2 -2
  126. data/tasks/updater/scss.rb +1 -1
  127. data/tasks/updater.rb +2 -2
  128. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  129. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  130. data/test/dummy_rails/app/views/pages/root.html +89 -0
  131. data/test/dummy_rails/config/application.rb +0 -3
  132. data/test/gemfiles/rails_5_2.gemfile +8 -0
  133. data/test/gemfiles/rails_6_1.gemfile +7 -0
  134. data/test/gemfiles/rails_7_0.gemfile +7 -0
  135. data/test/test_helper.rb +3 -2
  136. metadata +78 -82
  137. data/.travis.yml +0 -31
  138. data/assets/javascripts/bootstrap/util.js +0 -189
  139. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  140. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  141. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  142. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  143. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  144. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  145. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  146. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  147. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  148. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  149. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  150. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  151. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
  152. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  153. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  154. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  155. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  156. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  157. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  158. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  159. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  160. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  161. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  162. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  163. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  164. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  165. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  166. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  167. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  168. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  169. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  170. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  171. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  172. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  173. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  174. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  175. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,887 +1,544 @@
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.1 (https://getbootstrap.com/)
3
+ * Copyright 2011-2023 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') {
115
+ class Tooltip extends BaseComponent {
116
+ constructor(element, config) {
117
+ if (typeof Popper__namespace === 'undefined') {
262
118
  throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
263
- } // Private
264
-
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
+ this._activeTrigger.click = !this._activeTrigger.click;
165
+ if (this._isShown()) {
166
+ this._leave();
167
+ return;
324
168
  }
325
- };
326
-
327
- _proto.dispose = function dispose() {
169
+ this._enter();
170
+ }
171
+ dispose() {
328
172
  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();
173
+ EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
174
+ if (this._element.getAttribute('data-bs-original-title')) {
175
+ this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
344
176
  }
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') {
177
+ this._disposePopper();
178
+ super.dispose();
179
+ }
180
+ show() {
181
+ if (this._element.style.display === 'none') {
356
182
  throw new Error('Please use show on visible elements');
357
183
  }
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
- }
184
+ if (!(this._isWithContent() && this._isEnabled)) {
185
+ return;
186
+ }
187
+ const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW));
188
+ const shadowRoot = index_js.findShadowRoot(this._element);
189
+ const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
190
+ if (showEvent.defaultPrevented || !isInTheDom) {
191
+ return;
426
192
  }
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
193
 
446
- if (_this2._popper !== null) {
447
- _this2._popper.destroy();
194
+ // TODO: v6 remove this or make it optional
195
+ this._disposePopper();
196
+ const tip = this._getTipElement();
197
+ this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
198
+ const {
199
+ container
200
+ } = this._config;
201
+ if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
202
+ container.append(tip);
203
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
204
+ }
205
+ this._popper = this._createPopper(tip);
206
+ tip.classList.add(CLASS_NAME_SHOW);
207
+
208
+ // If this is a touch-enabled device we add extra
209
+ // empty mouseover listeners to the body's immediate children;
210
+ // only needed because of broken event delegation on iOS
211
+ // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
212
+ if ('ontouchstart' in document.documentElement) {
213
+ for (const element of [].concat(...document.body.children)) {
214
+ EventHandler.on(element, 'mouseover', index_js.noop);
448
215
  }
449
-
450
- if (callback) {
451
- callback();
216
+ }
217
+ const complete = () => {
218
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN));
219
+ if (this._isHovered === false) {
220
+ this._leave();
452
221
  }
222
+ this._isHovered = false;
453
223
  };
454
-
455
- $__default["default"](this.element).trigger(hideEvent);
456
-
457
- if (hideEvent.isDefaultPrevented()) {
224
+ this._queueCallback(complete, this.tip, this._isAnimated());
225
+ }
226
+ hide() {
227
+ if (!this._isShown()) {
228
+ return;
229
+ }
230
+ const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE));
231
+ if (hideEvent.defaultPrevented) {
458
232
  return;
459
233
  }
234
+ const tip = this._getTipElement();
235
+ tip.classList.remove(CLASS_NAME_SHOW);
460
236
 
461
- $__default["default"](tip).removeClass(CLASS_NAME_SHOW); // If this is a touch-enabled device we remove the extra
237
+ // If this is a touch-enabled device we remove the extra
462
238
  // empty mouseover listeners we added for iOS support
463
-
464
239
  if ('ontouchstart' in document.documentElement) {
465
- $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop);
240
+ for (const element of [].concat(...document.body.children)) {
241
+ EventHandler.off(element, 'mouseover', index_js.noop);
242
+ }
466
243
  }
467
-
468
244
  this._activeTrigger[TRIGGER_CLICK] = false;
469
245
  this._activeTrigger[TRIGGER_FOCUS] = false;
470
246
  this._activeTrigger[TRIGGER_HOVER] = false;
247
+ this._isHovered = null; // it is a trick to support manual triggering
471
248
 
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();
249
+ const complete = () => {
250
+ if (this._isWithActiveTrigger()) {
251
+ return;
252
+ }
253
+ if (!this._isHovered) {
254
+ this._disposePopper();
255
+ }
256
+ this._element.removeAttribute('aria-describedby');
257
+ EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN));
258
+ };
259
+ this._queueCallback(complete, this.tip, this._isAnimated());
260
+ }
261
+ update() {
262
+ if (this._popper) {
263
+ this._popper.update();
477
264
  }
265
+ }
478
266
 
479
- this._hoverState = '';
480
- };
481
-
482
- _proto.update = function update() {
483
- if (this._popper !== null) {
484
- this._popper.scheduleUpdate();
267
+ // Protected
268
+ _isWithContent() {
269
+ return Boolean(this._getTitle());
270
+ }
271
+ _getTipElement() {
272
+ if (!this.tip) {
273
+ this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
485
274
  }
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
275
  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;
276
+ }
277
+ _createTipElement(content) {
278
+ const tip = this._getTemplateFactory(content).toHtml();
279
+
280
+ // TODO: remove this check in v6
281
+ if (!tip) {
282
+ return null;
283
+ }
284
+ tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
285
+ // TODO: v6 the following can be achieved with CSS only
286
+ tip.classList.add(`bs-${this.constructor.NAME}-auto`);
287
+ const tipId = index_js.getUID(this.constructor.NAME).toString();
288
+ tip.setAttribute('id', tipId);
289
+ if (this._isAnimated()) {
290
+ tip.classList.add(CLASS_NAME_FADE);
291
+ }
292
+ return tip;
293
+ }
294
+ setContent(content) {
295
+ this._newContent = content;
296
+ if (this._isShown()) {
297
+ this._disposePopper();
298
+ this.show();
520
299
  }
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);
300
+ }
301
+ _getTemplateFactory(content) {
302
+ if (this._templateFactory) {
303
+ this._templateFactory.changeContent(content);
528
304
  } else {
529
- $element.text(content);
305
+ this._templateFactory = new TemplateFactory({
306
+ ...this._config,
307
+ // the `content` var has to be after `this._config`
308
+ // to override config.content in case of popover
309
+ content,
310
+ extraClass: this._resolvePossibleFunction(this._config.customClass)
311
+ });
530
312
  }
531
- };
532
-
533
- _proto.getTitle = function getTitle() {
534
- var title = this.element.getAttribute('data-original-title');
313
+ return this._templateFactory;
314
+ }
315
+ _getContentForTemplate() {
316
+ return {
317
+ [SELECTOR_TOOLTIP_INNER]: this._getTitle()
318
+ };
319
+ }
320
+ _getTitle() {
321
+ return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
322
+ }
535
323
 
536
- if (!title) {
537
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
324
+ // Private
325
+ _initializeOnDelegatedTarget(event) {
326
+ return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
327
+ }
328
+ _isAnimated() {
329
+ return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE);
330
+ }
331
+ _isShown() {
332
+ return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW);
333
+ }
334
+ _createPopper(tip) {
335
+ const placement = index_js.execute(this._config.placement, [this, tip, this._element]);
336
+ const attachment = AttachmentMap[placement.toUpperCase()];
337
+ return Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
338
+ }
339
+ _getOffset() {
340
+ const {
341
+ offset
342
+ } = this._config;
343
+ if (typeof offset === 'string') {
344
+ return offset.split(',').map(value => Number.parseInt(value, 10));
538
345
  }
539
-
540
- return title;
541
- } // Private
542
- ;
543
-
544
- _proto._getPopperConfig = function _getPopperConfig(attachment) {
545
- var _this3 = this;
546
-
547
- var defaultBsConfig = {
346
+ if (typeof offset === 'function') {
347
+ return popperData => offset(popperData, this._element);
348
+ }
349
+ return offset;
350
+ }
351
+ _resolvePossibleFunction(arg) {
352
+ return index_js.execute(arg, [this._element]);
353
+ }
354
+ _getPopperConfig(attachment) {
355
+ const defaultBsPopperConfig = {
548
356
  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
357
+ modifiers: [{
358
+ name: 'flip',
359
+ options: {
360
+ fallbackPlacements: this._config.fallbackPlacements
559
361
  }
560
- },
561
- onCreate: function onCreate(data) {
562
- if (data.originalPlacement !== data.placement) {
563
- _this3._handlePopperPlacementChange(data);
362
+ }, {
363
+ name: 'offset',
364
+ options: {
365
+ offset: this._getOffset()
564
366
  }
565
- },
566
- onUpdate: function onUpdate(data) {
567
- return _this3._handlePopperPlacementChange(data);
568
- }
367
+ }, {
368
+ name: 'preventOverflow',
369
+ options: {
370
+ boundary: this._config.boundary
371
+ }
372
+ }, {
373
+ name: 'arrow',
374
+ options: {
375
+ element: `.${this.constructor.NAME}-arrow`
376
+ }
377
+ }, {
378
+ name: 'preSetPlacement',
379
+ enabled: true,
380
+ phase: 'beforeMain',
381
+ fn: data => {
382
+ // Pre-set Popper's placement attribute in order to read the arrow sizes properly.
383
+ // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
384
+ this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
385
+ }
386
+ }]
569
387
  };
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) {
388
+ return {
389
+ ...defaultBsPopperConfig,
390
+ ...index_js.execute(this._config.popperConfig, [defaultBsPopperConfig])
391
+ };
392
+ }
393
+ _setListeners() {
394
+ const triggers = this._config.trigger.split(' ');
395
+ for (const trigger of triggers) {
611
396
  if (trigger === 'click') {
612
- $__default["default"](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
613
- return _this5.toggle(event);
397
+ EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {
398
+ const context = this._initializeOnDelegatedTarget(event);
399
+ context.toggle();
614
400
  });
615
401
  } 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);
402
+ const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN);
403
+ const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT);
404
+ EventHandler.on(this._element, eventIn, this._config.selector, event => {
405
+ const context = this._initializeOnDelegatedTarget(event);
406
+ context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
407
+ context._enter();
408
+ });
409
+ EventHandler.on(this._element, eventOut, this._config.selector, event => {
410
+ const context = this._initializeOnDelegatedTarget(event);
411
+ context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
412
+ context._leave();
622
413
  });
623
414
  }
624
- });
625
-
626
- this._hideModalHandler = function () {
627
- if (_this5.element) {
628
- _this5.hide();
415
+ }
416
+ this._hideModalHandler = () => {
417
+ if (this._element) {
418
+ this.hide();
629
419
  }
630
420
  };
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();
421
+ EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
422
+ }
423
+ _fixTitle() {
424
+ const title = this._element.getAttribute('title');
425
+ if (!title) {
676
426
  return;
677
427
  }
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);
428
+ if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
429
+ this._element.setAttribute('aria-label', title);
693
430
  }
694
-
695
- if (event) {
696
- context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
697
- }
698
-
699
- if (context._isWithActiveTrigger()) {
431
+ this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
432
+ this._element.removeAttribute('title');
433
+ }
434
+ _enter() {
435
+ if (this._isShown() || this._isHovered) {
436
+ this._isHovered = true;
700
437
  return;
701
438
  }
702
-
703
- clearTimeout(context._timeout);
704
- context._hoverState = HOVER_STATE_OUT;
705
-
706
- if (!context.config.delay || !context.config.delay.hide) {
707
- context.hide();
439
+ this._isHovered = true;
440
+ this._setTimeout(() => {
441
+ if (this._isHovered) {
442
+ this.show();
443
+ }
444
+ }, this._config.delay.show);
445
+ }
446
+ _leave() {
447
+ if (this._isWithActiveTrigger()) {
708
448
  return;
709
449
  }
710
-
711
- context._timeout = setTimeout(function () {
712
- if (context._hoverState === HOVER_STATE_OUT) {
713
- context.hide();
450
+ this._isHovered = false;
451
+ this._setTimeout(() => {
452
+ if (!this._isHovered) {
453
+ this.hide();
714
454
  }
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;
455
+ }, this._config.delay.hide);
456
+ }
457
+ _setTimeout(handler, timeout) {
458
+ clearTimeout(this._timeout);
459
+ this._timeout = setTimeout(handler, timeout);
460
+ }
461
+ _isWithActiveTrigger() {
462
+ return Object.values(this._activeTrigger).includes(true);
463
+ }
464
+ _getConfig(config) {
465
+ const dataAttributes = Manipulator.getDataAttributes(this._element);
466
+ for (const dataAttribute of Object.keys(dataAttributes)) {
467
+ if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
468
+ delete dataAttributes[dataAttribute];
722
469
  }
723
470
  }
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
-
471
+ config = {
472
+ ...dataAttributes,
473
+ ...(typeof config === 'object' && config ? config : {})
474
+ };
475
+ config = this._mergeConfigObj(config);
476
+ config = this._configAfterMerge(config);
477
+ this._typeCheckConfig(config);
478
+ return config;
479
+ }
480
+ _configAfterMerge(config) {
481
+ config.container = config.container === false ? document.body : index_js.getElement(config.container);
737
482
  if (typeof config.delay === 'number') {
738
483
  config.delay = {
739
484
  show: config.delay,
740
485
  hide: config.delay
741
486
  };
742
487
  }
743
-
744
488
  if (typeof config.title === 'number') {
745
489
  config.title = config.title.toString();
746
490
  }
747
-
748
491
  if (typeof config.content === 'number') {
749
492
  config.content = config.content.toString();
750
493
  }
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
494
  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
- }
495
+ }
496
+ _getDelegateConfig() {
497
+ const config = {};
498
+ for (const [key, value] of Object.entries(this._config)) {
499
+ if (this.constructor.Default[key] !== value) {
500
+ config[key] = value;
769
501
  }
770
502
  }
503
+ config.selector = false;
504
+ config.trigger = 'manual';
771
505
 
506
+ // In the future can be replaced with:
507
+ // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
508
+ // `Object.fromEntries(keysWithDifferentValues)`
772
509
  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(''));
510
+ }
511
+ _disposePopper() {
512
+ if (this._popper) {
513
+ this._popper.destroy();
514
+ this._popper = null;
781
515
  }
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;
516
+ if (this.tip) {
517
+ this.tip.remove();
518
+ this.tip = null;
798
519
  }
520
+ }
799
521
 
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) {
522
+ // Static
523
+ static jQueryInterface(config) {
809
524
  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)) {
525
+ const data = Tooltip.getOrCreateInstance(this, config);
526
+ if (typeof config !== 'string') {
816
527
  return;
817
528
  }
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]();
529
+ if (typeof data[config] === 'undefined') {
530
+ throw new TypeError(`No method named "${config}"`);
830
531
  }
532
+ data[config]();
831
533
  });
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
- }]);
534
+ }
535
+ }
870
536
 
871
- return Tooltip;
872
- }();
873
537
  /**
874
538
  * jQuery
875
539
  */
876
540
 
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
- };
541
+ index_js.defineJQueryPlugin(Tooltip);
885
542
 
886
543
  return Tooltip;
887
544