bootstrap 4.5.3 → 5.2.3

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