bootstrap 4.6.0 → 5.3.2

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