bootstrap 5.1.1 → 5.2.0

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/javascripts/bootstrap/alert.js +18 -153
  4. data/assets/javascripts/bootstrap/base-component.js +44 -127
  5. data/assets/javascripts/bootstrap/button.js +16 -80
  6. data/assets/javascripts/bootstrap/carousel.js +225 -497
  7. data/assets/javascripts/bootstrap/collapse.js +79 -262
  8. data/assets/javascripts/bootstrap/dom/data.js +6 -8
  9. data/assets/javascripts/bootstrap/dom/event-handler.js +95 -133
  10. data/assets/javascripts/bootstrap/dom/manipulator.js +25 -29
  11. data/assets/javascripts/bootstrap/dom/selector-engine.js +17 -59
  12. data/assets/javascripts/bootstrap/dropdown.js +124 -342
  13. data/assets/javascripts/bootstrap/modal.js +122 -767
  14. data/assets/javascripts/bootstrap/offcanvas.js +102 -671
  15. data/assets/javascripts/bootstrap/popover.js +42 -124
  16. data/assets/javascripts/bootstrap/scrollspy.js +186 -269
  17. data/assets/javascripts/bootstrap/tab.js +222 -221
  18. data/assets/javascripts/bootstrap/toast.js +41 -227
  19. data/assets/javascripts/bootstrap/tooltip.js +283 -629
  20. data/assets/javascripts/bootstrap/util/backdrop.js +165 -0
  21. data/assets/javascripts/bootstrap/util/component-functions.js +46 -0
  22. data/assets/javascripts/bootstrap/util/config.js +79 -0
  23. data/assets/javascripts/bootstrap/util/focustrap.js +129 -0
  24. data/assets/javascripts/bootstrap/util/index.js +350 -0
  25. data/assets/javascripts/bootstrap/util/sanitizer.js +122 -0
  26. data/assets/javascripts/bootstrap/util/scrollbar.js +138 -0
  27. data/assets/javascripts/bootstrap/util/swipe.js +155 -0
  28. data/assets/javascripts/bootstrap/util/template-factory.js +177 -0
  29. data/assets/javascripts/bootstrap-global-this-define.js +1 -1
  30. data/assets/javascripts/bootstrap-sprockets.js +16 -7
  31. data/assets/javascripts/bootstrap.js +2094 -1891
  32. data/assets/javascripts/bootstrap.min.js +3 -3
  33. data/assets/stylesheets/_bootstrap-grid.scss +3 -6
  34. data/assets/stylesheets/_bootstrap-reboot.scss +3 -7
  35. data/assets/stylesheets/_bootstrap.scss +4 -6
  36. data/assets/stylesheets/bootstrap/_accordion.scss +52 -24
  37. data/assets/stylesheets/bootstrap/_alert.scss +18 -4
  38. data/assets/stylesheets/bootstrap/_badge.scss +14 -5
  39. data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -10
  40. data/assets/stylesheets/bootstrap/_button-group.scss +3 -0
  41. data/assets/stylesheets/bootstrap/_buttons.scss +97 -22
  42. data/assets/stylesheets/bootstrap/_card.scss +55 -37
  43. data/assets/stylesheets/bootstrap/_close.scss +1 -1
  44. data/assets/stylesheets/bootstrap/_containers.scss +1 -1
  45. data/assets/stylesheets/bootstrap/_dropdown.scss +83 -75
  46. data/assets/stylesheets/bootstrap/_functions.scss +7 -7
  47. data/assets/stylesheets/bootstrap/_grid.scss +3 -3
  48. data/assets/stylesheets/bootstrap/_helpers.scss +1 -0
  49. data/assets/stylesheets/bootstrap/_list-group.scss +44 -27
  50. data/assets/stylesheets/bootstrap/_maps.scss +54 -0
  51. data/assets/stylesheets/bootstrap/_modal.scss +71 -43
  52. data/assets/stylesheets/bootstrap/_nav.scss +53 -20
  53. data/assets/stylesheets/bootstrap/_navbar.scss +91 -150
  54. data/assets/stylesheets/bootstrap/_offcanvas.scss +119 -59
  55. data/assets/stylesheets/bootstrap/_pagination.scss +66 -21
  56. data/assets/stylesheets/bootstrap/_placeholders.scss +1 -1
  57. data/assets/stylesheets/bootstrap/_popover.scss +90 -52
  58. data/assets/stylesheets/bootstrap/_progress.scss +20 -9
  59. data/assets/stylesheets/bootstrap/_reboot.scss +25 -40
  60. data/assets/stylesheets/bootstrap/_root.scss +40 -21
  61. data/assets/stylesheets/bootstrap/_spinners.scss +38 -22
  62. data/assets/stylesheets/bootstrap/_tables.scss +38 -25
  63. data/assets/stylesheets/bootstrap/_toasts.scss +35 -16
  64. data/assets/stylesheets/bootstrap/_tooltip.scss +61 -56
  65. data/assets/stylesheets/bootstrap/_type.scss +2 -0
  66. data/assets/stylesheets/bootstrap/_utilities.scss +43 -26
  67. data/assets/stylesheets/bootstrap/_variables.scss +118 -124
  68. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +3 -6
  69. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +14 -3
  70. data/assets/stylesheets/bootstrap/forms/_form-check.scss +28 -5
  71. data/assets/stylesheets/bootstrap/forms/_form-control.scss +12 -37
  72. data/assets/stylesheets/bootstrap/forms/_form-select.scss +2 -1
  73. data/assets/stylesheets/bootstrap/forms/_input-group.scss +15 -7
  74. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +10 -0
  75. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +2 -2
  76. data/assets/stylesheets/bootstrap/helpers/_position.scss +7 -1
  77. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +2 -2
  78. data/assets/stylesheets/bootstrap/helpers/_vr.scss +1 -1
  79. data/assets/stylesheets/bootstrap/mixins/_alert.scss +7 -3
  80. data/assets/stylesheets/bootstrap/mixins/_banner.scss +9 -0
  81. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +8 -8
  82. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +32 -95
  83. data/assets/stylesheets/bootstrap/mixins/_container.scss +4 -2
  84. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -0
  85. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +1 -1
  86. data/assets/stylesheets/bootstrap/mixins/_grid.scss +13 -12
  87. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +4 -25
  88. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -1
  89. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +12 -9
  90. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +12 -4
  91. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +1 -1
  92. data/bootstrap.gemspec +1 -1
  93. data/lib/bootstrap/version.rb +2 -2
  94. data/tasks/updater/js.rb +9 -4
  95. metadata +16 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b01026d318b10329a0807b13b6468916ce5222500fca7d405495ce2de3455b8d
4
- data.tar.gz: 194572fec23701c2836ede69479cb76eef1d4360da970c4f14a85a324d69c6d4
3
+ metadata.gz: 49075220be31b7b440684f6a22eb7ea6fcbff5860c940589c46aecbc2d20f6c1
4
+ data.tar.gz: 93841930e2afddf90c28b58a4273ea89aafd543fad464d329e7fcc255cecf479
5
5
  SHA512:
6
- metadata.gz: acfaf27f3e1c37ffb46653dfe31ccc4118b3af7333697144e8caf09eb1d547fb38964d84ac81267c66002d0e7e4331a6c8050d6badcf49e110bfe2c81809ffce
7
- data.tar.gz: d16647e78c6c10f02ea79b6f4c9b9da567ca67f7d5d9944d60df37b7230a1c0d2232e8d02d2c098f8fabe935909d2ed4de709d8fbe23ed8a7dd8d51e90e23eb2
6
+ metadata.gz: a9b0c4f2b4b41fd480484a246866b26762e9f5850b63b1c60eb12b1e7c180f70703254bf07aae93390a4b38a63db25f670fbf46eca0fec2f731a829825340459
7
+ data.tar.gz: 6737dd3980d44c004a05f1910aeec8f7b8e068235db3e2371622744e9e8d1a617e8c1a91d138ee86225cc521102d49c2d6cf28d02bf366c11d3a0e3f6c56ccfd
data/README.md CHANGED
@@ -20,7 +20,7 @@ Please see the appropriate guide for your environment of choice:
20
20
  Add `bootstrap` to your Gemfile:
21
21
 
22
22
  ```ruby
23
- gem 'bootstrap', '~> 5.1.1'
23
+ gem 'bootstrap', '~> 5.2.0'
24
24
  ```
25
25
 
26
26
  Ensure that `sprockets-rails` is at least v2.3.2.
@@ -1,155 +1,27 @@
1
1
  /*!
2
- * Bootstrap alert.js v5.1.1 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap alert.js v5.2.0 (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('./dom/event-handler.js'), require('./base-component.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.EventHandler, global.Base));
10
- }(this, (function (EventHandler, BaseComponent) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index'), require('./dom/event-handler'), require('./base-component'), require('./util/component-functions')) :
8
+ typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './base-component', './util/component-functions'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.Index, global.EventHandler, global.BaseComponent, global.ComponentFunctions));
10
+ })(this, (function (index, EventHandler, BaseComponent, componentFunctions) { 'use strict';
11
11
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+ const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
13
 
14
- var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
14
+ const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
+ const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
16
16
 
17
17
  /**
18
18
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.1.1): util/index.js
20
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
- * --------------------------------------------------------------------------
22
- */
23
-
24
- const getSelector = element => {
25
- let selector = element.getAttribute('data-bs-target');
26
-
27
- if (!selector || selector === '#') {
28
- let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
29
- // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
30
- // `document.querySelector` will rightfully complain it is invalid.
31
- // See https://github.com/twbs/bootstrap/issues/32273
32
-
33
- if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
34
- return null;
35
- } // Just in case some CMS puts out a full URL with the anchor appended
36
-
37
-
38
- if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
39
- hrefAttr = `#${hrefAttr.split('#')[1]}`;
40
- }
41
-
42
- selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
43
- }
44
-
45
- return selector;
46
- };
47
-
48
- const getElementFromSelector = element => {
49
- const selector = getSelector(element);
50
- return selector ? document.querySelector(selector) : null;
51
- };
52
-
53
- const isDisabled = element => {
54
- if (!element || element.nodeType !== Node.ELEMENT_NODE) {
55
- return true;
56
- }
57
-
58
- if (element.classList.contains('disabled')) {
59
- return true;
60
- }
61
-
62
- if (typeof element.disabled !== 'undefined') {
63
- return element.disabled;
64
- }
65
-
66
- return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
67
- };
68
-
69
- const getjQuery = () => {
70
- const {
71
- jQuery
72
- } = window;
73
-
74
- if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
75
- return jQuery;
76
- }
77
-
78
- return null;
79
- };
80
-
81
- const DOMContentLoadedCallbacks = [];
82
-
83
- const onDOMContentLoaded = callback => {
84
- if (document.readyState === 'loading') {
85
- // add listener on the first call when the document is in loading state
86
- if (!DOMContentLoadedCallbacks.length) {
87
- document.addEventListener('DOMContentLoaded', () => {
88
- DOMContentLoadedCallbacks.forEach(callback => callback());
89
- });
90
- }
91
-
92
- DOMContentLoadedCallbacks.push(callback);
93
- } else {
94
- callback();
95
- }
96
- };
97
-
98
- const defineJQueryPlugin = plugin => {
99
- onDOMContentLoaded(() => {
100
- const $ = getjQuery();
101
- /* istanbul ignore if */
102
-
103
- if ($) {
104
- const name = plugin.NAME;
105
- const JQUERY_NO_CONFLICT = $.fn[name];
106
- $.fn[name] = plugin.jQueryInterface;
107
- $.fn[name].Constructor = plugin;
108
-
109
- $.fn[name].noConflict = () => {
110
- $.fn[name] = JQUERY_NO_CONFLICT;
111
- return plugin.jQueryInterface;
112
- };
113
- }
114
- });
115
- };
116
-
117
- /**
118
- * --------------------------------------------------------------------------
119
- * Bootstrap (v5.1.1): util/component-functions.js
120
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
121
- * --------------------------------------------------------------------------
122
- */
123
-
124
- const enableDismissTrigger = (component, method = 'hide') => {
125
- const clickEvent = `click.dismiss${component.EVENT_KEY}`;
126
- const name = component.NAME;
127
- EventHandler__default['default'].on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
128
- if (['A', 'AREA'].includes(this.tagName)) {
129
- event.preventDefault();
130
- }
131
-
132
- if (isDisabled(this)) {
133
- return;
134
- }
135
-
136
- const target = getElementFromSelector(this) || this.closest(`.${name}`);
137
- const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
138
-
139
- instance[method]();
140
- });
141
- };
142
-
143
- /**
144
- * --------------------------------------------------------------------------
145
- * Bootstrap (v5.1.1): alert.js
19
+ * Bootstrap (v5.2.0): alert.js
146
20
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
147
21
  * --------------------------------------------------------------------------
148
22
  */
149
23
  /**
150
- * ------------------------------------------------------------------------
151
24
  * Constants
152
- * ------------------------------------------------------------------------
153
25
  */
154
26
 
155
27
  const NAME = 'alert';
@@ -160,12 +32,10 @@
160
32
  const CLASS_NAME_FADE = 'fade';
161
33
  const CLASS_NAME_SHOW = 'show';
162
34
  /**
163
- * ------------------------------------------------------------------------
164
- * Class Definition
165
- * ------------------------------------------------------------------------
35
+ * Class definition
166
36
  */
167
37
 
168
- class Alert extends BaseComponent__default['default'] {
38
+ class Alert extends BaseComponent__default.default {
169
39
  // Getters
170
40
  static get NAME() {
171
41
  return NAME;
@@ -173,7 +43,7 @@
173
43
 
174
44
 
175
45
  close() {
176
- const closeEvent = EventHandler__default['default'].trigger(this._element, EVENT_CLOSE);
46
+ const closeEvent = EventHandler__default.default.trigger(this._element, EVENT_CLOSE);
177
47
 
178
48
  if (closeEvent.defaultPrevented) {
179
49
  return;
@@ -190,7 +60,7 @@
190
60
  _destroyElement() {
191
61
  this._element.remove();
192
62
 
193
- EventHandler__default['default'].trigger(this._element, EVENT_CLOSED);
63
+ EventHandler__default.default.trigger(this._element, EVENT_CLOSED);
194
64
  this.dispose();
195
65
  } // Static
196
66
 
@@ -213,22 +83,17 @@
213
83
 
214
84
  }
215
85
  /**
216
- * ------------------------------------------------------------------------
217
- * Data Api implementation
218
- * ------------------------------------------------------------------------
86
+ * Data API implementation
219
87
  */
220
88
 
221
89
 
222
- enableDismissTrigger(Alert, 'close');
90
+ componentFunctions.enableDismissTrigger(Alert, 'close');
223
91
  /**
224
- * ------------------------------------------------------------------------
225
92
  * jQuery
226
- * ------------------------------------------------------------------------
227
- * add .Alert to jQuery only if jQuery is present
228
93
  */
229
94
 
230
- defineJQueryPlugin(Alert);
95
+ index.defineJQueryPlugin(Alert);
231
96
 
232
97
  return Alert;
233
98
 
234
- })));
99
+ }));
@@ -1,158 +1,75 @@
1
1
  /*!
2
- * Bootstrap base-component.js v5.1.1 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap base-component.js v5.2.0 (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('./dom/data.js'), require('./dom/event-handler.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.EventHandler));
10
- }(this, (function (Data, EventHandler) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data'), require('./util/index'), require('./dom/event-handler'), require('./util/config')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/data', './util/index', './dom/event-handler', './util/config'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BaseComponent = factory(global.Data, global.Index, global.EventHandler, global.Config));
10
+ })(this, (function (Data, index, EventHandler, Config) { 'use strict';
11
11
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+ const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
13
 
14
- var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
- var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
14
+ const Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
+ const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
+ const Config__default = /*#__PURE__*/_interopDefaultLegacy(Config);
16
17
 
17
18
  /**
18
19
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.1.1): util/index.js
20
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
- * --------------------------------------------------------------------------
22
- */
23
- const MILLISECONDS_MULTIPLIER = 1000;
24
- const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
25
-
26
- const getTransitionDurationFromElement = element => {
27
- if (!element) {
28
- return 0;
29
- } // Get transition-duration of the element
30
-
31
-
32
- let {
33
- transitionDuration,
34
- transitionDelay
35
- } = window.getComputedStyle(element);
36
- const floatTransitionDuration = Number.parseFloat(transitionDuration);
37
- const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
38
-
39
- if (!floatTransitionDuration && !floatTransitionDelay) {
40
- return 0;
41
- } // If multiple durations are defined, take the first
42
-
43
-
44
- transitionDuration = transitionDuration.split(',')[0];
45
- transitionDelay = transitionDelay.split(',')[0];
46
- return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
47
- };
48
-
49
- const triggerTransitionEnd = element => {
50
- element.dispatchEvent(new Event(TRANSITION_END));
51
- };
52
-
53
- const isElement = obj => {
54
- if (!obj || typeof obj !== 'object') {
55
- return false;
56
- }
57
-
58
- if (typeof obj.jquery !== 'undefined') {
59
- obj = obj[0];
60
- }
61
-
62
- return typeof obj.nodeType !== 'undefined';
63
- };
64
-
65
- const getElement = obj => {
66
- if (isElement(obj)) {
67
- // it's a jQuery object or a node element
68
- return obj.jquery ? obj[0] : obj;
69
- }
70
-
71
- if (typeof obj === 'string' && obj.length > 0) {
72
- return document.querySelector(obj);
73
- }
74
-
75
- return null;
76
- };
77
-
78
- const execute = callback => {
79
- if (typeof callback === 'function') {
80
- callback();
81
- }
82
- };
83
-
84
- const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
85
- if (!waitForTransition) {
86
- execute(callback);
87
- return;
88
- }
89
-
90
- const durationPadding = 5;
91
- const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
92
- let called = false;
93
-
94
- const handler = ({
95
- target
96
- }) => {
97
- if (target !== transitionElement) {
98
- return;
99
- }
100
-
101
- called = true;
102
- transitionElement.removeEventListener(TRANSITION_END, handler);
103
- execute(callback);
104
- };
105
-
106
- transitionElement.addEventListener(TRANSITION_END, handler);
107
- setTimeout(() => {
108
- if (!called) {
109
- triggerTransitionEnd(transitionElement);
110
- }
111
- }, emulatedDuration);
112
- };
113
-
114
- /**
115
- * --------------------------------------------------------------------------
116
- * Bootstrap (v5.1.1): base-component.js
20
+ * Bootstrap (v5.2.0): base-component.js
117
21
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
118
22
  * --------------------------------------------------------------------------
119
23
  */
120
24
  /**
121
- * ------------------------------------------------------------------------
122
25
  * Constants
123
- * ------------------------------------------------------------------------
124
26
  */
125
27
 
126
- const VERSION = '5.1.1';
28
+ const VERSION = '5.2.0';
29
+ /**
30
+ * Class definition
31
+ */
127
32
 
128
- class BaseComponent {
129
- constructor(element) {
130
- element = getElement(element);
33
+ class BaseComponent extends Config__default.default {
34
+ constructor(element, config) {
35
+ super();
36
+ element = index.getElement(element);
131
37
 
132
38
  if (!element) {
133
39
  return;
134
40
  }
135
41
 
136
42
  this._element = element;
137
- Data__default['default'].set(this._element, this.constructor.DATA_KEY, this);
138
- }
43
+ this._config = this._getConfig(config);
44
+ Data__default.default.set(this._element, this.constructor.DATA_KEY, this);
45
+ } // Public
46
+
139
47
 
140
48
  dispose() {
141
- Data__default['default'].remove(this._element, this.constructor.DATA_KEY);
142
- EventHandler__default['default'].off(this._element, this.constructor.EVENT_KEY);
143
- Object.getOwnPropertyNames(this).forEach(propertyName => {
49
+ Data__default.default.remove(this._element, this.constructor.DATA_KEY);
50
+ EventHandler__default.default.off(this._element, this.constructor.EVENT_KEY);
51
+
52
+ for (const propertyName of Object.getOwnPropertyNames(this)) {
144
53
  this[propertyName] = null;
145
- });
54
+ }
146
55
  }
147
56
 
148
57
  _queueCallback(callback, element, isAnimated = true) {
149
- executeAfterTransition(callback, element, isAnimated);
58
+ index.executeAfterTransition(callback, element, isAnimated);
150
59
  }
151
- /** Static */
60
+
61
+ _getConfig(config) {
62
+ config = this._mergeConfigObj(config, this._element);
63
+ config = this._configAfterMerge(config);
64
+
65
+ this._typeCheckConfig(config);
66
+
67
+ return config;
68
+ } // Static
152
69
 
153
70
 
154
71
  static getInstance(element) {
155
- return Data__default['default'].get(getElement(element), this.DATA_KEY);
72
+ return Data__default.default.get(index.getElement(element), this.DATA_KEY);
156
73
  }
157
74
 
158
75
  static getOrCreateInstance(element, config = {}) {
@@ -163,10 +80,6 @@
163
80
  return VERSION;
164
81
  }
165
82
 
166
- static get NAME() {
167
- throw new Error('You have to implement the static method "NAME", for each component!');
168
- }
169
-
170
83
  static get DATA_KEY() {
171
84
  return `bs.${this.NAME}`;
172
85
  }
@@ -175,8 +88,12 @@
175
88
  return `.${this.DATA_KEY}`;
176
89
  }
177
90
 
91
+ static eventName(name) {
92
+ return `${name}${this.EVENT_KEY}`;
93
+ }
94
+
178
95
  }
179
96
 
180
97
  return BaseComponent;
181
98
 
182
- })));
99
+ }));
@@ -1,84 +1,27 @@
1
1
  /*!
2
- * Bootstrap button.js v5.1.1 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap button.js v5.2.0 (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('./dom/event-handler.js'), require('./base-component.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.EventHandler, global.Base));
10
- }(this, (function (EventHandler, BaseComponent) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index'), require('./dom/event-handler'), require('./base-component')) :
8
+ typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.Index, global.EventHandler, global.BaseComponent));
10
+ })(this, (function (index, EventHandler, BaseComponent) { 'use strict';
11
11
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+ const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
13
 
14
- var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
14
+ const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
+ const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
16
16
 
17
17
  /**
18
18
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.1.1): util/index.js
20
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
- * --------------------------------------------------------------------------
22
- */
23
-
24
- const getjQuery = () => {
25
- const {
26
- jQuery
27
- } = window;
28
-
29
- if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
30
- return jQuery;
31
- }
32
-
33
- return null;
34
- };
35
-
36
- const DOMContentLoadedCallbacks = [];
37
-
38
- const onDOMContentLoaded = callback => {
39
- if (document.readyState === 'loading') {
40
- // add listener on the first call when the document is in loading state
41
- if (!DOMContentLoadedCallbacks.length) {
42
- document.addEventListener('DOMContentLoaded', () => {
43
- DOMContentLoadedCallbacks.forEach(callback => callback());
44
- });
45
- }
46
-
47
- DOMContentLoadedCallbacks.push(callback);
48
- } else {
49
- callback();
50
- }
51
- };
52
-
53
- const defineJQueryPlugin = plugin => {
54
- onDOMContentLoaded(() => {
55
- const $ = getjQuery();
56
- /* istanbul ignore if */
57
-
58
- if ($) {
59
- const name = plugin.NAME;
60
- const JQUERY_NO_CONFLICT = $.fn[name];
61
- $.fn[name] = plugin.jQueryInterface;
62
- $.fn[name].Constructor = plugin;
63
-
64
- $.fn[name].noConflict = () => {
65
- $.fn[name] = JQUERY_NO_CONFLICT;
66
- return plugin.jQueryInterface;
67
- };
68
- }
69
- });
70
- };
71
-
72
- /**
73
- * --------------------------------------------------------------------------
74
- * Bootstrap (v5.1.1): button.js
19
+ * Bootstrap (v5.2.0): button.js
75
20
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
76
21
  * --------------------------------------------------------------------------
77
22
  */
78
23
  /**
79
- * ------------------------------------------------------------------------
80
24
  * Constants
81
- * ------------------------------------------------------------------------
82
25
  */
83
26
 
84
27
  const NAME = 'button';
@@ -89,12 +32,10 @@
89
32
  const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="button"]';
90
33
  const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
91
34
  /**
92
- * ------------------------------------------------------------------------
93
- * Class Definition
94
- * ------------------------------------------------------------------------
35
+ * Class definition
95
36
  */
96
37
 
97
- class Button extends BaseComponent__default['default'] {
38
+ class Button extends BaseComponent__default.default {
98
39
  // Getters
99
40
  static get NAME() {
100
41
  return NAME;
@@ -119,27 +60,22 @@
119
60
 
120
61
  }
121
62
  /**
122
- * ------------------------------------------------------------------------
123
- * Data Api implementation
124
- * ------------------------------------------------------------------------
63
+ * Data API implementation
125
64
  */
126
65
 
127
66
 
128
- EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
67
+ EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
129
68
  event.preventDefault();
130
69
  const button = event.target.closest(SELECTOR_DATA_TOGGLE);
131
70
  const data = Button.getOrCreateInstance(button);
132
71
  data.toggle();
133
72
  });
134
73
  /**
135
- * ------------------------------------------------------------------------
136
74
  * jQuery
137
- * ------------------------------------------------------------------------
138
- * add .Button to jQuery only if jQuery is present
139
75
  */
140
76
 
141
- defineJQueryPlugin(Button);
77
+ index.defineJQueryPlugin(Button);
142
78
 
143
79
  return Button;
144
80
 
145
- })));
81
+ }));