bootstrap 5.0.1 → 5.1.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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/assets/javascripts/bootstrap/alert.js +89 -58
- data/assets/javascripts/bootstrap/base-component.js +53 -39
- data/assets/javascripts/bootstrap/button.js +31 -25
- data/assets/javascripts/bootstrap/carousel.js +126 -89
- data/assets/javascripts/bootstrap/collapse.js +125 -133
- data/assets/javascripts/bootstrap/dom/data.js +5 -5
- data/assets/javascripts/bootstrap/dom/event-handler.js +11 -5
- data/assets/javascripts/bootstrap/dom/manipulator.js +6 -6
- data/assets/javascripts/bootstrap/dom/selector-engine.js +49 -7
- data/assets/javascripts/bootstrap/dropdown.js +147 -140
- data/assets/javascripts/bootstrap/modal.js +397 -180
- data/assets/javascripts/bootstrap/offcanvas.js +333 -138
- data/assets/javascripts/bootstrap/popover.js +36 -54
- data/assets/javascripts/bootstrap/scrollspy.js +58 -68
- data/assets/javascripts/bootstrap/tab.js +53 -26
- data/assets/javascripts/bootstrap/toast.js +138 -41
- data/assets/javascripts/bootstrap/tooltip.js +137 -120
- data/assets/javascripts/bootstrap-sprockets.js +8 -8
- data/assets/javascripts/bootstrap.js +937 -886
- 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/_buttons.scss +1 -0
- 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/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modal.scss +5 -15
- 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 +9 -5
- 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 +206 -29
- 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 +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +5 -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/_grid.scss +35 -9
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +27 -6
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +1 -1
- 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: a581703e37a15500e6877790e3174a9938610cd3d6250e9058a00315bc560dcd
|
4
|
+
data.tar.gz: 6fac8e4322b8bbcb368381c10dc19036f46ece7544dd58fd66e7d0f23e1ddde3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f78f85046b10501027d059fda1e760ac4e1f583120bb71f2b2a05a16b148b7db5d3ece5397068a2febd1ba293d810eec9c02992742ffadd79dd931a0c178acd
|
7
|
+
data.tar.gz: b72e89c5d2a9aba75fce2fbb8249d0bee925cc2d2db51002f16ecdae3249f26e8a597ffda733192c773870f6aea1e7654733232856acbe8e33898c31ffefefce
|
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.2'
|
24
24
|
```
|
25
25
|
|
26
26
|
Ensure that `sprockets-rails` is at least v2.3.2.
|
@@ -1,19 +1,25 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap alert.js v5.
|
2
|
+
* Bootstrap alert.js v5.1.2 (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
|
+
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
15
|
+
const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
16
|
+
|
17
|
+
/**
|
18
|
+
* --------------------------------------------------------------------------
|
19
|
+
* Bootstrap (v5.1.2): util/index.js
|
20
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
21
|
+
* --------------------------------------------------------------------------
|
22
|
+
*/
|
17
23
|
|
18
24
|
const getSelector = element => {
|
19
25
|
let selector = element.getAttribute('data-bs-target');
|
@@ -44,6 +50,22 @@
|
|
44
50
|
return selector ? document.querySelector(selector) : null;
|
45
51
|
};
|
46
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
|
+
|
47
69
|
const getjQuery = () => {
|
48
70
|
const {
|
49
71
|
jQuery
|
@@ -56,9 +78,18 @@
|
|
56
78
|
return null;
|
57
79
|
};
|
58
80
|
|
81
|
+
const DOMContentLoadedCallbacks = [];
|
82
|
+
|
59
83
|
const onDOMContentLoaded = callback => {
|
60
84
|
if (document.readyState === 'loading') {
|
61
|
-
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);
|
62
93
|
} else {
|
63
94
|
callback();
|
64
95
|
}
|
@@ -85,7 +116,33 @@
|
|
85
116
|
|
86
117
|
/**
|
87
118
|
* --------------------------------------------------------------------------
|
88
|
-
* Bootstrap (v5.
|
119
|
+
* Bootstrap (v5.1.2): 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.2): alert.js
|
89
146
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
90
147
|
* --------------------------------------------------------------------------
|
91
148
|
*/
|
@@ -98,12 +155,8 @@
|
|
98
155
|
const NAME = 'alert';
|
99
156
|
const DATA_KEY = 'bs.alert';
|
100
157
|
const EVENT_KEY = `.${DATA_KEY}`;
|
101
|
-
const DATA_API_KEY = '.data-api';
|
102
|
-
const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
|
103
158
|
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
104
159
|
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
105
|
-
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
106
|
-
const CLASS_NAME_ALERT = 'alert';
|
107
160
|
const CLASS_NAME_FADE = 'fade';
|
108
161
|
const CLASS_NAME_SHOW = 'show';
|
109
162
|
/**
|
@@ -112,72 +165,50 @@
|
|
112
165
|
* ------------------------------------------------------------------------
|
113
166
|
*/
|
114
167
|
|
115
|
-
class Alert extends BaseComponent__default
|
168
|
+
class Alert extends BaseComponent__default.default {
|
116
169
|
// Getters
|
117
170
|
static get NAME() {
|
118
171
|
return NAME;
|
119
172
|
} // Public
|
120
173
|
|
121
174
|
|
122
|
-
close(
|
123
|
-
const
|
175
|
+
close() {
|
176
|
+
const closeEvent = EventHandler__default.default.trigger(this._element, EVENT_CLOSE);
|
124
177
|
|
125
|
-
|
126
|
-
|
127
|
-
if (customEvent === null || customEvent.defaultPrevented) {
|
178
|
+
if (closeEvent.defaultPrevented) {
|
128
179
|
return;
|
129
180
|
}
|
130
181
|
|
131
|
-
this.
|
132
|
-
} // Private
|
182
|
+
this._element.classList.remove(CLASS_NAME_SHOW);
|
133
183
|
|
184
|
+
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE);
|
134
185
|
|
135
|
-
|
136
|
-
|
137
|
-
}
|
138
|
-
|
139
|
-
_triggerCloseEvent(element) {
|
140
|
-
return EventHandler__default['default'].trigger(element, EVENT_CLOSE);
|
141
|
-
}
|
142
|
-
|
143
|
-
_removeElement(element) {
|
144
|
-
element.classList.remove(CLASS_NAME_SHOW);
|
145
|
-
const isAnimated = element.classList.contains(CLASS_NAME_FADE);
|
186
|
+
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
|
187
|
+
} // Private
|
146
188
|
|
147
|
-
this._queueCallback(() => this._destroyElement(element), element, isAnimated);
|
148
|
-
}
|
149
189
|
|
150
|
-
_destroyElement(
|
151
|
-
|
152
|
-
element.parentNode.removeChild(element);
|
153
|
-
}
|
190
|
+
_destroyElement() {
|
191
|
+
this._element.remove();
|
154
192
|
|
155
|
-
EventHandler__default
|
193
|
+
EventHandler__default.default.trigger(this._element, EVENT_CLOSED);
|
194
|
+
this.dispose();
|
156
195
|
} // Static
|
157
196
|
|
158
197
|
|
159
198
|
static jQueryInterface(config) {
|
160
199
|
return this.each(function () {
|
161
|
-
|
200
|
+
const data = Alert.getOrCreateInstance(this);
|
162
201
|
|
163
|
-
if (
|
164
|
-
|
202
|
+
if (typeof config !== 'string') {
|
203
|
+
return;
|
165
204
|
}
|
166
205
|
|
167
|
-
if (config === '
|
168
|
-
|
206
|
+
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
207
|
+
throw new TypeError(`No method named "${config}"`);
|
169
208
|
}
|
170
|
-
});
|
171
|
-
}
|
172
209
|
|
173
|
-
|
174
|
-
|
175
|
-
if (event) {
|
176
|
-
event.preventDefault();
|
177
|
-
}
|
178
|
-
|
179
|
-
alertInstance.close(this);
|
180
|
-
};
|
210
|
+
data[config](this);
|
211
|
+
});
|
181
212
|
}
|
182
213
|
|
183
214
|
}
|
@@ -188,7 +219,7 @@
|
|
188
219
|
*/
|
189
220
|
|
190
221
|
|
191
|
-
|
222
|
+
enableDismissTrigger(Alert, 'close');
|
192
223
|
/**
|
193
224
|
* ------------------------------------------------------------------------
|
194
225
|
* jQuery
|
@@ -200,4 +231,4 @@
|
|
200
231
|
|
201
232
|
return Alert;
|
202
233
|
|
203
|
-
}))
|
234
|
+
}));
|
@@ -1,20 +1,25 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap base-component.js v5.
|
2
|
+
* Bootstrap base-component.js v5.1.2 (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/data.js'), require('./dom/
|
8
|
-
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.
|
10
|
-
}(this, (function (Data,
|
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';
|
11
11
|
|
12
|
-
|
12
|
+
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
14
|
+
const Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
15
|
+
const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
17
16
|
|
17
|
+
/**
|
18
|
+
* --------------------------------------------------------------------------
|
19
|
+
* Bootstrap (v5.1.2): util/index.js
|
20
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
21
|
+
* --------------------------------------------------------------------------
|
22
|
+
*/
|
18
23
|
const MILLISECONDS_MULTIPLIER = 1000;
|
19
24
|
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
20
25
|
|
@@ -64,39 +69,51 @@
|
|
64
69
|
}
|
65
70
|
|
66
71
|
if (typeof obj === 'string' && obj.length > 0) {
|
67
|
-
return
|
72
|
+
return document.querySelector(obj);
|
68
73
|
}
|
69
74
|
|
70
75
|
return null;
|
71
76
|
};
|
72
77
|
|
73
|
-
const
|
74
|
-
|
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
|
+
|
75
90
|
const durationPadding = 5;
|
76
|
-
const emulatedDuration =
|
91
|
+
const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
92
|
+
let called = false;
|
93
|
+
|
94
|
+
const handler = ({
|
95
|
+
target
|
96
|
+
}) => {
|
97
|
+
if (target !== transitionElement) {
|
98
|
+
return;
|
99
|
+
}
|
77
100
|
|
78
|
-
function listener() {
|
79
101
|
called = true;
|
80
|
-
|
81
|
-
|
102
|
+
transitionElement.removeEventListener(TRANSITION_END, handler);
|
103
|
+
execute(callback);
|
104
|
+
};
|
82
105
|
|
83
|
-
|
106
|
+
transitionElement.addEventListener(TRANSITION_END, handler);
|
84
107
|
setTimeout(() => {
|
85
108
|
if (!called) {
|
86
|
-
triggerTransitionEnd(
|
109
|
+
triggerTransitionEnd(transitionElement);
|
87
110
|
}
|
88
111
|
}, emulatedDuration);
|
89
112
|
};
|
90
113
|
|
91
|
-
const execute = callback => {
|
92
|
-
if (typeof callback === 'function') {
|
93
|
-
callback();
|
94
|
-
}
|
95
|
-
};
|
96
|
-
|
97
114
|
/**
|
98
115
|
* --------------------------------------------------------------------------
|
99
|
-
* Bootstrap (v5.
|
116
|
+
* Bootstrap (v5.1.2): base-component.js
|
100
117
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
101
118
|
* --------------------------------------------------------------------------
|
102
119
|
*/
|
@@ -106,7 +123,7 @@
|
|
106
123
|
* ------------------------------------------------------------------------
|
107
124
|
*/
|
108
125
|
|
109
|
-
const VERSION = '5.
|
126
|
+
const VERSION = '5.1.2';
|
110
127
|
|
111
128
|
class BaseComponent {
|
112
129
|
constructor(element) {
|
@@ -117,32 +134,29 @@
|
|
117
134
|
}
|
118
135
|
|
119
136
|
this._element = element;
|
120
|
-
Data__default
|
137
|
+
Data__default.default.set(this._element, this.constructor.DATA_KEY, this);
|
121
138
|
}
|
122
139
|
|
123
140
|
dispose() {
|
124
|
-
Data__default
|
125
|
-
EventHandler__default
|
141
|
+
Data__default.default.remove(this._element, this.constructor.DATA_KEY);
|
142
|
+
EventHandler__default.default.off(this._element, this.constructor.EVENT_KEY);
|
126
143
|
Object.getOwnPropertyNames(this).forEach(propertyName => {
|
127
144
|
this[propertyName] = null;
|
128
145
|
});
|
129
146
|
}
|
130
147
|
|
131
148
|
_queueCallback(callback, element, isAnimated = true) {
|
132
|
-
|
133
|
-
execute(callback);
|
134
|
-
return;
|
135
|
-
}
|
136
|
-
|
137
|
-
const transitionDuration = getTransitionDurationFromElement(element);
|
138
|
-
EventHandler__default['default'].one(element, 'transitionend', () => execute(callback));
|
139
|
-
emulateTransitionEnd(element, transitionDuration);
|
149
|
+
executeAfterTransition(callback, element, isAnimated);
|
140
150
|
}
|
141
151
|
/** Static */
|
142
152
|
|
143
153
|
|
144
154
|
static getInstance(element) {
|
145
|
-
return Data__default
|
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);
|
146
160
|
}
|
147
161
|
|
148
162
|
static get VERSION() {
|
@@ -165,4 +179,4 @@
|
|
165
179
|
|
166
180
|
return BaseComponent;
|
167
181
|
|
168
|
-
}))
|
182
|
+
}));
|
@@ -1,19 +1,25 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap button.js v5.
|
2
|
+
* Bootstrap button.js v5.1.2 (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
|
+
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
15
|
+
const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
16
|
+
|
17
|
+
/**
|
18
|
+
* --------------------------------------------------------------------------
|
19
|
+
* Bootstrap (v5.1.2): util/index.js
|
20
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
21
|
+
* --------------------------------------------------------------------------
|
22
|
+
*/
|
17
23
|
|
18
24
|
const getjQuery = () => {
|
19
25
|
const {
|
@@ -27,9 +33,18 @@
|
|
27
33
|
return null;
|
28
34
|
};
|
29
35
|
|
36
|
+
const DOMContentLoadedCallbacks = [];
|
37
|
+
|
30
38
|
const onDOMContentLoaded = callback => {
|
31
39
|
if (document.readyState === 'loading') {
|
32
|
-
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);
|
33
48
|
} else {
|
34
49
|
callback();
|
35
50
|
}
|
@@ -56,7 +71,7 @@
|
|
56
71
|
|
57
72
|
/**
|
58
73
|
* --------------------------------------------------------------------------
|
59
|
-
* Bootstrap (v5.
|
74
|
+
* Bootstrap (v5.1.2): button.js
|
60
75
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
61
76
|
* --------------------------------------------------------------------------
|
62
77
|
*/
|
@@ -79,7 +94,7 @@
|
|
79
94
|
* ------------------------------------------------------------------------
|
80
95
|
*/
|
81
96
|
|
82
|
-
class Button extends BaseComponent__default
|
97
|
+
class Button extends BaseComponent__default.default {
|
83
98
|
// Getters
|
84
99
|
static get NAME() {
|
85
100
|
return NAME;
|
@@ -94,11 +109,7 @@
|
|
94
109
|
|
95
110
|
static jQueryInterface(config) {
|
96
111
|
return this.each(function () {
|
97
|
-
|
98
|
-
|
99
|
-
if (!data) {
|
100
|
-
data = new Button(this);
|
101
|
-
}
|
112
|
+
const data = Button.getOrCreateInstance(this);
|
102
113
|
|
103
114
|
if (config === 'toggle') {
|
104
115
|
data[config]();
|
@@ -114,15 +125,10 @@
|
|
114
125
|
*/
|
115
126
|
|
116
127
|
|
117
|
-
EventHandler__default
|
128
|
+
EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
|
118
129
|
event.preventDefault();
|
119
130
|
const button = event.target.closest(SELECTOR_DATA_TOGGLE);
|
120
|
-
|
121
|
-
|
122
|
-
if (!data) {
|
123
|
-
data = new Button(button);
|
124
|
-
}
|
125
|
-
|
131
|
+
const data = Button.getOrCreateInstance(button);
|
126
132
|
data.toggle();
|
127
133
|
});
|
128
134
|
/**
|
@@ -136,4 +142,4 @@
|
|
136
142
|
|
137
143
|
return Button;
|
138
144
|
|
139
|
-
}))
|
145
|
+
}));
|