bootstrap 5.0.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/assets/javascripts/bootstrap/alert.js +77 -106
- data/assets/javascripts/bootstrap/base-component.js +126 -7
- data/assets/javascripts/bootstrap/button.js +24 -24
- data/assets/javascripts/bootstrap/carousel.js +115 -128
- data/assets/javascripts/bootstrap/collapse.js +119 -176
- data/assets/javascripts/bootstrap/dom/data.js +2 -2
- data/assets/javascripts/bootstrap/dom/event-handler.js +3 -4
- data/assets/javascripts/bootstrap/dom/manipulator.js +4 -4
- data/assets/javascripts/bootstrap/dom/selector-engine.js +47 -5
- data/assets/javascripts/bootstrap/dropdown.js +142 -130
- data/assets/javascripts/bootstrap/modal.js +376 -171
- data/assets/javascripts/bootstrap/offcanvas.js +328 -133
- data/assets/javascripts/bootstrap/popover.js +27 -59
- data/assets/javascripts/bootstrap/scrollspy.js +51 -56
- data/assets/javascripts/bootstrap/tab.js +39 -66
- data/assets/javascripts/bootstrap/toast.js +175 -86
- data/assets/javascripts/bootstrap/tooltip.js +141 -185
- data/assets/javascripts/bootstrap-sprockets.js +6 -6
- data/assets/javascripts/bootstrap.js +1031 -1026
- data/assets/javascripts/bootstrap.min.js +2 -2
- data/assets/stylesheets/_bootstrap-grid.scss +3 -1
- data/assets/stylesheets/_bootstrap-reboot.scss +2 -4
- data/assets/stylesheets/_bootstrap.scss +2 -1
- data/assets/stylesheets/bootstrap/_card.scss +7 -6
- data/assets/stylesheets/bootstrap/_carousel.scss +2 -2
- data/assets/stylesheets/bootstrap/_dropdown.scss +4 -4
- data/assets/stylesheets/bootstrap/_functions.scss +100 -3
- data/assets/stylesheets/bootstrap/_grid.scss +11 -0
- data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +5 -5
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modal.scss +7 -26
- data/assets/stylesheets/bootstrap/_navbar.scss +30 -1
- data/assets/stylesheets/bootstrap/_offcanvas.scss +8 -2
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_popover.scss +10 -10
- data/assets/stylesheets/bootstrap/_reboot.scss +12 -8
- data/assets/stylesheets/bootstrap/_root.scss +40 -2
- data/assets/stylesheets/bootstrap/_tables.scss +1 -0
- data/assets/stylesheets/bootstrap/_toasts.scss +3 -3
- data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
- data/assets/stylesheets/bootstrap/_transitions.scss +6 -0
- data/assets/stylesheets/bootstrap/_utilities.scss +44 -8
- data/assets/stylesheets/bootstrap/_variables.scss +200 -25
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +6 -6
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +3 -0
- data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -1
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +33 -8
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +27 -6
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
- data/bootstrap.gemspec +3 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +6 -2
- metadata +12 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b01026d318b10329a0807b13b6468916ce5222500fca7d405495ce2de3455b8d
|
4
|
+
data.tar.gz: 194572fec23701c2836ede69479cb76eef1d4360da970c4f14a85a324d69c6d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acfaf27f3e1c37ffb46653dfe31ccc4118b3af7333697144e8caf09eb1d547fb38964d84ac81267c66002d0e7e4331a6c8050d6badcf49e110bfe2c81809ffce
|
7
|
+
data.tar.gz: d16647e78c6c10f02ea79b6f4c9b9da567ca67f7d5d9944d60df37b7230a1c0d2232e8d02d2c098f8fabe935909d2ed4de709d8fbe23ed8a7dd8d51e90e23eb2
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Bootstrap Ruby Gem [](https://travis-ci.org/twbs/bootstrap-rubygem) [](https://rubygems.org/gems/bootstrap)
|
2
2
|
|
3
|
-
[Bootstrap
|
3
|
+
[Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) 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
|
|
@@ -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.
|
23
|
+
gem 'bootstrap', '~> 5.1.1'
|
24
24
|
```
|
25
25
|
|
26
26
|
Ensure that `sprockets-rails` is at least v2.3.2.
|
@@ -1,28 +1,25 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap alert.js v5.
|
2
|
+
* Bootstrap alert.js v5.1.1 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 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/
|
8
|
-
typeof define === 'function' && define.amd ? define(['./dom/
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.
|
10
|
-
}(this, (function (
|
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';
|
11
11
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
13
13
|
|
14
|
-
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
15
14
|
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
16
15
|
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
17
16
|
|
18
17
|
/**
|
19
18
|
* --------------------------------------------------------------------------
|
20
|
-
* Bootstrap (v5.
|
19
|
+
* Bootstrap (v5.1.1): util/index.js
|
21
20
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
22
21
|
* --------------------------------------------------------------------------
|
23
22
|
*/
|
24
|
-
const MILLISECONDS_MULTIPLIER = 1000;
|
25
|
-
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
26
23
|
|
27
24
|
const getSelector = element => {
|
28
25
|
let selector = element.getAttribute('data-bs-target');
|
@@ -53,49 +50,20 @@
|
|
53
50
|
return selector ? document.querySelector(selector) : null;
|
54
51
|
};
|
55
52
|
|
56
|
-
const
|
57
|
-
if (!element) {
|
58
|
-
return
|
59
|
-
}
|
60
|
-
|
61
|
-
|
62
|
-
let {
|
63
|
-
transitionDuration,
|
64
|
-
transitionDelay
|
65
|
-
} = window.getComputedStyle(element);
|
66
|
-
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
67
|
-
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
68
|
-
|
69
|
-
if (!floatTransitionDuration && !floatTransitionDelay) {
|
70
|
-
return 0;
|
71
|
-
} // If multiple durations are defined, take the first
|
72
|
-
|
73
|
-
|
74
|
-
transitionDuration = transitionDuration.split(',')[0];
|
75
|
-
transitionDelay = transitionDelay.split(',')[0];
|
76
|
-
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
77
|
-
};
|
78
|
-
|
79
|
-
const triggerTransitionEnd = element => {
|
80
|
-
element.dispatchEvent(new Event(TRANSITION_END));
|
81
|
-
};
|
53
|
+
const isDisabled = element => {
|
54
|
+
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
55
|
+
return true;
|
56
|
+
}
|
82
57
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
const emulatedDuration = duration + durationPadding;
|
58
|
+
if (element.classList.contains('disabled')) {
|
59
|
+
return true;
|
60
|
+
}
|
87
61
|
|
88
|
-
|
89
|
-
|
90
|
-
element.removeEventListener(TRANSITION_END, listener);
|
62
|
+
if (typeof element.disabled !== 'undefined') {
|
63
|
+
return element.disabled;
|
91
64
|
}
|
92
65
|
|
93
|
-
element.
|
94
|
-
setTimeout(() => {
|
95
|
-
if (!called) {
|
96
|
-
triggerTransitionEnd(element);
|
97
|
-
}
|
98
|
-
}, emulatedDuration);
|
66
|
+
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
99
67
|
};
|
100
68
|
|
101
69
|
const getjQuery = () => {
|
@@ -110,20 +78,30 @@
|
|
110
78
|
return null;
|
111
79
|
};
|
112
80
|
|
81
|
+
const DOMContentLoadedCallbacks = [];
|
82
|
+
|
113
83
|
const onDOMContentLoaded = callback => {
|
114
84
|
if (document.readyState === 'loading') {
|
115
|
-
document
|
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);
|
116
93
|
} else {
|
117
94
|
callback();
|
118
95
|
}
|
119
96
|
};
|
120
97
|
|
121
|
-
const defineJQueryPlugin =
|
98
|
+
const defineJQueryPlugin = plugin => {
|
122
99
|
onDOMContentLoaded(() => {
|
123
100
|
const $ = getjQuery();
|
124
101
|
/* istanbul ignore if */
|
125
102
|
|
126
103
|
if ($) {
|
104
|
+
const name = plugin.NAME;
|
127
105
|
const JQUERY_NO_CONFLICT = $.fn[name];
|
128
106
|
$.fn[name] = plugin.jQueryInterface;
|
129
107
|
$.fn[name].Constructor = plugin;
|
@@ -138,7 +116,33 @@
|
|
138
116
|
|
139
117
|
/**
|
140
118
|
* --------------------------------------------------------------------------
|
141
|
-
* Bootstrap (v5.
|
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
|
142
146
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
143
147
|
* --------------------------------------------------------------------------
|
144
148
|
*/
|
@@ -151,12 +155,8 @@
|
|
151
155
|
const NAME = 'alert';
|
152
156
|
const DATA_KEY = 'bs.alert';
|
153
157
|
const EVENT_KEY = `.${DATA_KEY}`;
|
154
|
-
const DATA_API_KEY = '.data-api';
|
155
|
-
const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
|
156
158
|
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
157
159
|
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
158
|
-
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
159
|
-
const CLASS_NAME_ALERT = 'alert';
|
160
160
|
const CLASS_NAME_FADE = 'fade';
|
161
161
|
const CLASS_NAME_SHOW = 'show';
|
162
162
|
/**
|
@@ -167,77 +167,48 @@
|
|
167
167
|
|
168
168
|
class Alert extends BaseComponent__default['default'] {
|
169
169
|
// Getters
|
170
|
-
static get
|
171
|
-
return
|
170
|
+
static get NAME() {
|
171
|
+
return NAME;
|
172
172
|
} // Public
|
173
173
|
|
174
174
|
|
175
|
-
close(
|
176
|
-
const
|
177
|
-
|
178
|
-
const customEvent = this._triggerCloseEvent(rootElement);
|
175
|
+
close() {
|
176
|
+
const closeEvent = EventHandler__default['default'].trigger(this._element, EVENT_CLOSE);
|
179
177
|
|
180
|
-
if (
|
178
|
+
if (closeEvent.defaultPrevented) {
|
181
179
|
return;
|
182
180
|
}
|
183
181
|
|
184
|
-
this.
|
185
|
-
} // Private
|
186
|
-
|
187
|
-
|
188
|
-
_getRootElement(element) {
|
189
|
-
return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
|
190
|
-
}
|
191
|
-
|
192
|
-
_triggerCloseEvent(element) {
|
193
|
-
return EventHandler__default['default'].trigger(element, EVENT_CLOSE);
|
194
|
-
}
|
182
|
+
this._element.classList.remove(CLASS_NAME_SHOW);
|
195
183
|
|
196
|
-
|
197
|
-
element.classList.remove(CLASS_NAME_SHOW);
|
184
|
+
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE);
|
198
185
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
return;
|
203
|
-
}
|
186
|
+
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
|
187
|
+
} // Private
|
204
188
|
|
205
|
-
const transitionDuration = getTransitionDurationFromElement(element);
|
206
|
-
EventHandler__default['default'].one(element, 'transitionend', () => this._destroyElement(element));
|
207
|
-
emulateTransitionEnd(element, transitionDuration);
|
208
|
-
}
|
209
189
|
|
210
|
-
_destroyElement(
|
211
|
-
|
212
|
-
element.parentNode.removeChild(element);
|
213
|
-
}
|
190
|
+
_destroyElement() {
|
191
|
+
this._element.remove();
|
214
192
|
|
215
|
-
EventHandler__default['default'].trigger(
|
193
|
+
EventHandler__default['default'].trigger(this._element, EVENT_CLOSED);
|
194
|
+
this.dispose();
|
216
195
|
} // Static
|
217
196
|
|
218
197
|
|
219
198
|
static jQueryInterface(config) {
|
220
199
|
return this.each(function () {
|
221
|
-
|
200
|
+
const data = Alert.getOrCreateInstance(this);
|
222
201
|
|
223
|
-
if (
|
224
|
-
|
202
|
+
if (typeof config !== 'string') {
|
203
|
+
return;
|
225
204
|
}
|
226
205
|
|
227
|
-
if (config === '
|
228
|
-
|
206
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
207
|
+
throw new TypeError(`No method named "${config}"`);
|
229
208
|
}
|
230
|
-
});
|
231
|
-
}
|
232
209
|
|
233
|
-
|
234
|
-
|
235
|
-
if (event) {
|
236
|
-
event.preventDefault();
|
237
|
-
}
|
238
|
-
|
239
|
-
alertInstance.close(this);
|
240
|
-
};
|
210
|
+
data[config](this);
|
211
|
+
});
|
241
212
|
}
|
242
213
|
|
243
214
|
}
|
@@ -248,7 +219,7 @@
|
|
248
219
|
*/
|
249
220
|
|
250
221
|
|
251
|
-
|
222
|
+
enableDismissTrigger(Alert, 'close');
|
252
223
|
/**
|
253
224
|
* ------------------------------------------------------------------------
|
254
225
|
* jQuery
|
@@ -256,7 +227,7 @@
|
|
256
227
|
* add .Alert to jQuery only if jQuery is present
|
257
228
|
*/
|
258
229
|
|
259
|
-
defineJQueryPlugin(
|
230
|
+
defineJQueryPlugin(Alert);
|
260
231
|
|
261
232
|
return Alert;
|
262
233
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap base-component.js v5.
|
2
|
+
* Bootstrap base-component.js v5.1.1 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 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
|
*/
|
@@ -16,7 +16,104 @@
|
|
16
16
|
|
17
17
|
/**
|
18
18
|
* --------------------------------------------------------------------------
|
19
|
-
* Bootstrap (v5.
|
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
117
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
21
118
|
* --------------------------------------------------------------------------
|
22
119
|
*/
|
@@ -26,11 +123,11 @@
|
|
26
123
|
* ------------------------------------------------------------------------
|
27
124
|
*/
|
28
125
|
|
29
|
-
const VERSION = '5.
|
126
|
+
const VERSION = '5.1.1';
|
30
127
|
|
31
128
|
class BaseComponent {
|
32
129
|
constructor(element) {
|
33
|
-
element =
|
130
|
+
element = getElement(element);
|
34
131
|
|
35
132
|
if (!element) {
|
36
133
|
return;
|
@@ -42,20 +139,42 @@
|
|
42
139
|
|
43
140
|
dispose() {
|
44
141
|
Data__default['default'].remove(this._element, this.constructor.DATA_KEY);
|
45
|
-
EventHandler__default['default'].off(this._element,
|
46
|
-
this.
|
142
|
+
EventHandler__default['default'].off(this._element, this.constructor.EVENT_KEY);
|
143
|
+
Object.getOwnPropertyNames(this).forEach(propertyName => {
|
144
|
+
this[propertyName] = null;
|
145
|
+
});
|
146
|
+
}
|
147
|
+
|
148
|
+
_queueCallback(callback, element, isAnimated = true) {
|
149
|
+
executeAfterTransition(callback, element, isAnimated);
|
47
150
|
}
|
48
151
|
/** Static */
|
49
152
|
|
50
153
|
|
51
154
|
static getInstance(element) {
|
52
|
-
return Data__default['default'].get(element, this.DATA_KEY);
|
155
|
+
return Data__default['default'].get(getElement(element), this.DATA_KEY);
|
156
|
+
}
|
157
|
+
|
158
|
+
static getOrCreateInstance(element, config = {}) {
|
159
|
+
return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
|
53
160
|
}
|
54
161
|
|
55
162
|
static get VERSION() {
|
56
163
|
return VERSION;
|
57
164
|
}
|
58
165
|
|
166
|
+
static get NAME() {
|
167
|
+
throw new Error('You have to implement the static method "NAME", for each component!');
|
168
|
+
}
|
169
|
+
|
170
|
+
static get DATA_KEY() {
|
171
|
+
return `bs.${this.NAME}`;
|
172
|
+
}
|
173
|
+
|
174
|
+
static get EVENT_KEY() {
|
175
|
+
return `.${this.DATA_KEY}`;
|
176
|
+
}
|
177
|
+
|
59
178
|
}
|
60
179
|
|
61
180
|
return BaseComponent;
|
@@ -1,23 +1,22 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap button.js v5.
|
2
|
+
* Bootstrap button.js v5.1.1 (https://getbootstrap.com/)
|
3
3
|
* Copyright 2011-2021 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/
|
8
|
-
typeof define === 'function' && define.amd ? define(['./dom/
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.
|
10
|
-
}(this, (function (
|
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';
|
11
11
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
13
13
|
|
14
|
-
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
15
14
|
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
16
15
|
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
17
16
|
|
18
17
|
/**
|
19
18
|
* --------------------------------------------------------------------------
|
20
|
-
* Bootstrap (v5.
|
19
|
+
* Bootstrap (v5.1.1): util/index.js
|
21
20
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
22
21
|
* --------------------------------------------------------------------------
|
23
22
|
*/
|
@@ -34,20 +33,30 @@
|
|
34
33
|
return null;
|
35
34
|
};
|
36
35
|
|
36
|
+
const DOMContentLoadedCallbacks = [];
|
37
|
+
|
37
38
|
const onDOMContentLoaded = callback => {
|
38
39
|
if (document.readyState === 'loading') {
|
39
|
-
document
|
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);
|
40
48
|
} else {
|
41
49
|
callback();
|
42
50
|
}
|
43
51
|
};
|
44
52
|
|
45
|
-
const defineJQueryPlugin =
|
53
|
+
const defineJQueryPlugin = plugin => {
|
46
54
|
onDOMContentLoaded(() => {
|
47
55
|
const $ = getjQuery();
|
48
56
|
/* istanbul ignore if */
|
49
57
|
|
50
58
|
if ($) {
|
59
|
+
const name = plugin.NAME;
|
51
60
|
const JQUERY_NO_CONFLICT = $.fn[name];
|
52
61
|
$.fn[name] = plugin.jQueryInterface;
|
53
62
|
$.fn[name].Constructor = plugin;
|
@@ -62,7 +71,7 @@
|
|
62
71
|
|
63
72
|
/**
|
64
73
|
* --------------------------------------------------------------------------
|
65
|
-
* Bootstrap (v5.
|
74
|
+
* Bootstrap (v5.1.1): button.js
|
66
75
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
67
76
|
* --------------------------------------------------------------------------
|
68
77
|
*/
|
@@ -87,8 +96,8 @@
|
|
87
96
|
|
88
97
|
class Button extends BaseComponent__default['default'] {
|
89
98
|
// Getters
|
90
|
-
static get
|
91
|
-
return
|
99
|
+
static get NAME() {
|
100
|
+
return NAME;
|
92
101
|
} // Public
|
93
102
|
|
94
103
|
|
@@ -100,11 +109,7 @@
|
|
100
109
|
|
101
110
|
static jQueryInterface(config) {
|
102
111
|
return this.each(function () {
|
103
|
-
|
104
|
-
|
105
|
-
if (!data) {
|
106
|
-
data = new Button(this);
|
107
|
-
}
|
112
|
+
const data = Button.getOrCreateInstance(this);
|
108
113
|
|
109
114
|
if (config === 'toggle') {
|
110
115
|
data[config]();
|
@@ -123,12 +128,7 @@
|
|
123
128
|
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
|
124
129
|
event.preventDefault();
|
125
130
|
const button = event.target.closest(SELECTOR_DATA_TOGGLE);
|
126
|
-
|
127
|
-
|
128
|
-
if (!data) {
|
129
|
-
data = new Button(button);
|
130
|
-
}
|
131
|
-
|
131
|
+
const data = Button.getOrCreateInstance(button);
|
132
132
|
data.toggle();
|
133
133
|
});
|
134
134
|
/**
|
@@ -138,7 +138,7 @@
|
|
138
138
|
* add .Button to jQuery only if jQuery is present
|
139
139
|
*/
|
140
140
|
|
141
|
-
defineJQueryPlugin(
|
141
|
+
defineJQueryPlugin(Button);
|
142
142
|
|
143
143
|
return Button;
|
144
144
|
|