bootstrap 5.1.3 → 5.2.2

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 +24 -4
  3. data/assets/javascripts/bootstrap/alert.js +11 -146
  4. data/assets/javascripts/bootstrap/base-component.js +37 -120
  5. data/assets/javascripts/bootstrap/button.js +10 -74
  6. data/assets/javascripts/bootstrap/carousel.js +213 -485
  7. data/assets/javascripts/bootstrap/collapse.js +65 -249
  8. data/assets/javascripts/bootstrap/dom/data.js +3 -5
  9. data/assets/javascripts/bootstrap/dom/event-handler.js +94 -132
  10. data/assets/javascripts/bootstrap/dom/manipulator.js +23 -27
  11. data/assets/javascripts/bootstrap/dom/selector-engine.js +16 -58
  12. data/assets/javascripts/bootstrap/dropdown.js +103 -317
  13. data/assets/javascripts/bootstrap/modal.js +107 -749
  14. data/assets/javascripts/bootstrap/offcanvas.js +90 -659
  15. data/assets/javascripts/bootstrap/popover.js +36 -118
  16. data/assets/javascripts/bootstrap/scrollspy.js +183 -262
  17. data/assets/javascripts/bootstrap/tab.js +215 -214
  18. data/assets/javascripts/bootstrap/toast.js +36 -218
  19. data/assets/javascripts/bootstrap/tooltip.js +280 -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 +17 -8
  31. data/assets/javascripts/bootstrap.js +2093 -1881
  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 +56 -25
  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 +4 -1
  41. data/assets/stylesheets/bootstrap/_buttons.scss +125 -29
  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 +85 -76
  46. data/assets/stylesheets/bootstrap/_functions.scss +8 -8
  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 +48 -30
  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 +93 -150
  54. data/assets/stylesheets/bootstrap/_offcanvas.scss +120 -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 +32 -23
  63. data/assets/stylesheets/bootstrap/_toasts.scss +38 -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 +128 -135
  68. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +3 -6
  69. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +15 -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 +0 -1
  73. data/assets/stylesheets/bootstrap/forms/_input-group.scss +19 -8
  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 +18 -10
  85. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +1 -1
  86. data/assets/stylesheets/bootstrap/mixins/_grid.scss +12 -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 +13 -5
  91. data/bootstrap.gemspec +1 -1
  92. data/lib/bootstrap/version.rb +2 -2
  93. data/tasks/updater/js.rb +10 -5
  94. data/tasks/updater.rb +2 -2
  95. metadata +16 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 666b108731be39c8122df9a54b7b2a1715f02b92e03caa941c132b3e7ec352ca
4
- data.tar.gz: 57086f0d9bb88ba6a0abf74a5f0006b6eed21168d37009c2159e8ab9b68385f4
3
+ metadata.gz: a293b6bb0f077b3634982eeed77c89bfc3631f890f3df2027ddc45ceab3b18a5
4
+ data.tar.gz: d8fd6730b835bbe608e62d26359b7530a52cbadbccbe7d3589b895ac37944f79
5
5
  SHA512:
6
- metadata.gz: 6171d65c922c486d41a0cb7f4e781e389b2cf0d9e00cf7c350fcdf6ab59b814e8daa7449a9a97d7462e6945f766261466cbf750f0aedc07301f366d2f7731eaf
7
- data.tar.gz: b65871d048cecf29a714362f75348bc167ba158e50197908cde71ff197d834c0d84eb9ead9be4f7c87c22f49da0c164a6aa997843b2bc5998f6b12effc762db7
6
+ metadata.gz: 6fcbeba2892da722b611946a283a166fa57cc44f80e0ccb8096f903e0d0e9f5d5dd69fbead50e819ce35184a62cb9df29d7aceb59bc215b90e75c8020fde1516
7
+ data.tar.gz: 8931244575e0476fba2ea27f1d7524043755a2237035abfd6aa1af5fe9da64001f826350f0631d9a7b9164091c4d766b8c0aa80f6d85ee78b8384b03b6b141a8
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # Bootstrap Ruby Gem [![Build Status](https://travis-ci.org/twbs/bootstrap-rubygem.svg?branch=master)](https://travis-ci.org/twbs/bootstrap-rubygem) [![Gem](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap)
2
2
 
3
- [Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) and Hanami (formerly Lotus).
3
+ [Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*/*Importmaps*) and Hanami (formerly Lotus).
4
4
 
5
5
  For Sass versions of Bootstrap 3 and 2 see [bootstrap-sass](https://github.com/twbs/bootstrap-sass) instead.
6
6
 
7
- **Ruby on Rails 6 Note:**:
8
- With the release of Rails 6 there have been some minor changes made to the default configuration for The Asset Pipeline. In specific, by default _Sprockets no longer processes JavaScript_ and instead Webpack is set as the default. The `twbs/bootstrap-rubygem` is for use with Sprockets not Webpack.
7
+ **Ruby on Rails Note**: Newer releases of Rails have added additional ways for
8
+ assets to be processed. The `twbs/bootstrap-rubygem` is for use with Importmaps
9
+ or Sprockets, but not Webpack.
9
10
 
10
11
  ## Installation
11
12
 
@@ -20,7 +21,7 @@ Please see the appropriate guide for your environment of choice:
20
21
  Add `bootstrap` to your Gemfile:
21
22
 
22
23
  ```ruby
23
- gem 'bootstrap', '~> 5.1.3'
24
+ gem 'bootstrap', '~> 5.2.2'
24
25
  ```
25
26
 
26
27
  Ensure that `sprockets-rails` is at least v2.3.2.
@@ -58,6 +59,25 @@ Bootstrap tooltips and popovers depend on [popper.js] for positioning.
58
59
  The `bootstrap` gem already depends on the
59
60
  [popper_js](https://github.com/glebm/popper_js-rubygem) gem.
60
61
 
62
+ #### Importmaps
63
+
64
+ You can pin either `bootstrap.js` or `bootstrap.min.js` in `config/importmap.rb`
65
+ as well as `popper.js`:
66
+
67
+ ```ruby
68
+ pin "bootstrap", to: "bootstrap.min.js", preload: true
69
+ pin "@popperjs/core", to: "popper.js", preload: true
70
+ ```
71
+
72
+ Whichever files you pin will need to be added to `config.assets.precompile`:
73
+
74
+ ```ruby
75
+ # config/initializers/assets.rb
76
+ Rails.application.config.assets.precompile += %w(bootstrap.min.js popper.js)
77
+ ```
78
+
79
+ #### Sprockets
80
+
61
81
  Add Bootstrap dependencies and Bootstrap to your `application.js`:
62
82
 
63
83
  ```js
@@ -1,13 +1,13 @@
1
1
  /*!
2
- * Bootstrap alert.js v5.1.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap alert.js v5.2.2 (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
12
  const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
13
 
@@ -16,140 +16,12 @@
16
16
 
17
17
  /**
18
18
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.1.3): 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.3): 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.3): alert.js
19
+ * Bootstrap (v5.2.2): 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,9 +32,7 @@
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
38
  class Alert extends BaseComponent__default.default {
@@ -213,21 +83,16 @@
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
 
@@ -1,158 +1,75 @@
1
1
  /*!
2
- * Bootstrap base-component.js v5.1.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap base-component.js v5.2.2 (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
12
  const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
13
 
14
14
  const Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
15
15
  const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
16
+ const Config__default = /*#__PURE__*/_interopDefaultLegacy(Config);
16
17
 
17
18
  /**
18
19
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.1.3): 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.3): base-component.js
20
+ * Bootstrap (v5.2.2): 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.3';
28
+ const VERSION = '5.2.2';
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;
43
+ this._config = this._getConfig(config);
137
44
  Data__default.default.set(this._element, this.constructor.DATA_KEY, this);
138
- }
45
+ } // Public
46
+
139
47
 
140
48
  dispose() {
141
49
  Data__default.default.remove(this._element, this.constructor.DATA_KEY);
142
50
  EventHandler__default.default.off(this._element, this.constructor.EVENT_KEY);
143
- Object.getOwnPropertyNames(this).forEach(propertyName => {
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,6 +88,10 @@
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;
@@ -1,13 +1,13 @@
1
1
  /*!
2
- * Bootstrap button.js v5.1.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap button.js v5.2.2 (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
12
  const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
13
 
@@ -16,69 +16,12 @@
16
16
 
17
17
  /**
18
18
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.1.3): 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.3): button.js
19
+ * Bootstrap (v5.2.2): 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,9 +32,7 @@
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
38
  class Button extends BaseComponent__default.default {
@@ -119,9 +60,7 @@
119
60
 
120
61
  }
121
62
  /**
122
- * ------------------------------------------------------------------------
123
- * Data Api implementation
124
- * ------------------------------------------------------------------------
63
+ * Data API implementation
125
64
  */
126
65
 
127
66
 
@@ -132,13 +71,10 @@
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