bootstrap 4.6.2 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +7 -4
- data/assets/javascripts/bootstrap/alert.js +192 -115
- data/assets/javascripts/bootstrap/base-component.js +63 -0
- data/assets/javascripts/bootstrap/button.js +96 -179
- data/assets/javascripts/bootstrap/carousel.js +472 -359
- data/assets/javascripts/bootstrap/collapse.js +379 -225
- data/assets/javascripts/bootstrap/dom/data.js +68 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
- data/assets/javascripts/bootstrap/dropdown.js +472 -355
- data/assets/javascripts/bootstrap/modal.js +612 -438
- data/assets/javascripts/bootstrap/offcanvas.js +671 -0
- data/assets/javascripts/bootstrap/popover.js +138 -167
- data/assets/javascripts/bootstrap/scrollspy.js +250 -192
- data/assets/javascripts/bootstrap/tab.js +241 -144
- data/assets/javascripts/bootstrap/toast.js +223 -157
- data/assets/javascripts/bootstrap/tooltip.js +651 -487
- data/assets/javascripts/bootstrap-global-this-define.js +6 -0
- data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
- data/assets/javascripts/bootstrap-sprockets.js +8 -1
- data/assets/javascripts/bootstrap.js +3277 -2590
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -18
- data/assets/stylesheets/_bootstrap-reboot.scss +6 -3
- data/assets/stylesheets/_bootstrap.scss +18 -10
- data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
- data/assets/stylesheets/bootstrap/_alert.scss +15 -10
- data/assets/stylesheets/bootstrap/_badge.scss +2 -27
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +3 -17
- data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
- data/assets/stylesheets/bootstrap/_buttons.scss +29 -60
- data/assets/stylesheets/bootstrap/_card.scss +20 -91
- data/assets/stylesheets/bootstrap/_carousel.scss +64 -35
- data/assets/stylesheets/bootstrap/_close.scss +30 -30
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +84 -36
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +84 -69
- data/assets/stylesheets/bootstrap/_grid.scss +3 -54
- data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +28 -8
- data/assets/stylesheets/bootstrap/_mixins.scss +8 -13
- data/assets/stylesheets/bootstrap/_modal.scss +45 -57
- data/assets/stylesheets/bootstrap/_nav.scss +20 -6
- data/assets/stylesheets/bootstrap/_navbar.scss +45 -71
- data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +10 -20
- data/assets/stylesheets/bootstrap/_popover.scss +24 -36
- data/assets/stylesheets/bootstrap/_progress.scss +5 -4
- data/assets/stylesheets/bootstrap/_reboot.scss +316 -179
- data/assets/stylesheets/bootstrap/_root.scss +5 -8
- data/assets/stylesheets/bootstrap/_spinners.scss +11 -7
- data/assets/stylesheets/bootstrap/_tables.scss +79 -114
- data/assets/stylesheets/bootstrap/_toasts.scss +20 -15
- data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
- data/assets/stylesheets/bootstrap/_transitions.scss +2 -7
- data/assets/stylesheets/bootstrap/_type.scss +38 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +594 -18
- data/assets/stylesheets/bootstrap/_variables.scss +800 -485
- data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +67 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
- data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
- data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +71 -48
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +39 -97
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +90 -34
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +214 -130
- data/bootstrap.gemspec +1 -3
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +19 -16
- data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
- data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
- data/test/dummy_rails/app/views/pages/root.html +89 -0
- data/test/dummy_rails/config/application.rb +0 -3
- data/test/gemfiles/rails_6_1.gemfile +7 -0
- metadata +45 -73
- data/assets/javascripts/bootstrap/util.js +0 -189
- data/assets/stylesheets/bootstrap/_code.scss +0 -48
- data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
- data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -132
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
- data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
- data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
- data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
- data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
- data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
- data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
- data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
- /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,128 +1,241 @@
|
|
1
1
|
/*!
|
2
|
-
* Bootstrap tab.js
|
3
|
-
* Copyright 2011-
|
2
|
+
* Bootstrap tab.js v5.0.0 (https://getbootstrap.com/)
|
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('
|
8
|
-
typeof define === 'function' && define.amd ? define(['
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.
|
10
|
-
}
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/selector-engine', './base-component'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine, global.Base));
|
10
|
+
}(this, (function (Data, EventHandler, SelectorEngine, 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
|
15
|
-
var
|
14
|
+
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
|
15
|
+
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
16
|
+
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
17
|
+
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
/**
|
20
|
+
* --------------------------------------------------------------------------
|
21
|
+
* Bootstrap (v5.0.0): util/index.js
|
22
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
23
|
+
* --------------------------------------------------------------------------
|
24
|
+
*/
|
25
|
+
const MILLISECONDS_MULTIPLIER = 1000;
|
26
|
+
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
27
|
+
|
28
|
+
const getSelector = element => {
|
29
|
+
let selector = element.getAttribute('data-bs-target');
|
30
|
+
|
31
|
+
if (!selector || selector === '#') {
|
32
|
+
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
33
|
+
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
34
|
+
// `document.querySelector` will rightfully complain it is invalid.
|
35
|
+
// See https://github.com/twbs/bootstrap/issues/32273
|
36
|
+
|
37
|
+
if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
|
38
|
+
return null;
|
39
|
+
} // Just in case some CMS puts out a full URL with the anchor appended
|
40
|
+
|
41
|
+
|
42
|
+
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
|
43
|
+
hrefAttr = `#${hrefAttr.split('#')[1]}`;
|
44
|
+
}
|
45
|
+
|
46
|
+
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
24
47
|
}
|
25
|
-
}
|
26
48
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
49
|
+
return selector;
|
50
|
+
};
|
51
|
+
|
52
|
+
const getElementFromSelector = element => {
|
53
|
+
const selector = getSelector(element);
|
54
|
+
return selector ? document.querySelector(selector) : null;
|
55
|
+
};
|
56
|
+
|
57
|
+
const getTransitionDurationFromElement = element => {
|
58
|
+
if (!element) {
|
59
|
+
return 0;
|
60
|
+
} // Get transition-duration of the element
|
61
|
+
|
62
|
+
|
63
|
+
let {
|
64
|
+
transitionDuration,
|
65
|
+
transitionDelay
|
66
|
+
} = window.getComputedStyle(element);
|
67
|
+
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
68
|
+
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
69
|
+
|
70
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
71
|
+
return 0;
|
72
|
+
} // If multiple durations are defined, take the first
|
73
|
+
|
74
|
+
|
75
|
+
transitionDuration = transitionDuration.split(',')[0];
|
76
|
+
transitionDelay = transitionDelay.split(',')[0];
|
77
|
+
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
78
|
+
};
|
79
|
+
|
80
|
+
const triggerTransitionEnd = element => {
|
81
|
+
element.dispatchEvent(new Event(TRANSITION_END));
|
82
|
+
};
|
83
|
+
|
84
|
+
const emulateTransitionEnd = (element, duration) => {
|
85
|
+
let called = false;
|
86
|
+
const durationPadding = 5;
|
87
|
+
const emulatedDuration = duration + durationPadding;
|
88
|
+
|
89
|
+
function listener() {
|
90
|
+
called = true;
|
91
|
+
element.removeEventListener(TRANSITION_END, listener);
|
92
|
+
}
|
93
|
+
|
94
|
+
element.addEventListener(TRANSITION_END, listener);
|
95
|
+
setTimeout(() => {
|
96
|
+
if (!called) {
|
97
|
+
triggerTransitionEnd(element);
|
98
|
+
}
|
99
|
+
}, emulatedDuration);
|
100
|
+
};
|
101
|
+
|
102
|
+
const isDisabled = element => {
|
103
|
+
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
104
|
+
return true;
|
105
|
+
}
|
106
|
+
|
107
|
+
if (element.classList.contains('disabled')) {
|
108
|
+
return true;
|
109
|
+
}
|
110
|
+
|
111
|
+
if (typeof element.disabled !== 'undefined') {
|
112
|
+
return element.disabled;
|
113
|
+
}
|
114
|
+
|
115
|
+
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
116
|
+
};
|
117
|
+
|
118
|
+
const reflow = element => element.offsetHeight;
|
119
|
+
|
120
|
+
const getjQuery = () => {
|
121
|
+
const {
|
122
|
+
jQuery
|
123
|
+
} = window;
|
124
|
+
|
125
|
+
if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
126
|
+
return jQuery;
|
127
|
+
}
|
128
|
+
|
129
|
+
return null;
|
130
|
+
};
|
131
|
+
|
132
|
+
const onDOMContentLoaded = callback => {
|
133
|
+
if (document.readyState === 'loading') {
|
134
|
+
document.addEventListener('DOMContentLoaded', callback);
|
135
|
+
} else {
|
136
|
+
callback();
|
137
|
+
}
|
138
|
+
};
|
139
|
+
|
140
|
+
const defineJQueryPlugin = (name, plugin) => {
|
141
|
+
onDOMContentLoaded(() => {
|
142
|
+
const $ = getjQuery();
|
143
|
+
/* istanbul ignore if */
|
144
|
+
|
145
|
+
if ($) {
|
146
|
+
const JQUERY_NO_CONFLICT = $.fn[name];
|
147
|
+
$.fn[name] = plugin.jQueryInterface;
|
148
|
+
$.fn[name].Constructor = plugin;
|
149
|
+
|
150
|
+
$.fn[name].noConflict = () => {
|
151
|
+
$.fn[name] = JQUERY_NO_CONFLICT;
|
152
|
+
return plugin.jQueryInterface;
|
153
|
+
};
|
154
|
+
}
|
32
155
|
});
|
33
|
-
|
34
|
-
}
|
156
|
+
};
|
35
157
|
|
36
158
|
/**
|
159
|
+
* --------------------------------------------------------------------------
|
160
|
+
* Bootstrap (v5.0.0): tab.js
|
161
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
162
|
+
* --------------------------------------------------------------------------
|
163
|
+
*/
|
164
|
+
/**
|
165
|
+
* ------------------------------------------------------------------------
|
37
166
|
* Constants
|
167
|
+
* ------------------------------------------------------------------------
|
38
168
|
*/
|
39
169
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
var SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]';
|
61
|
-
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
62
|
-
var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active';
|
170
|
+
const NAME = 'tab';
|
171
|
+
const DATA_KEY = 'bs.tab';
|
172
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
173
|
+
const DATA_API_KEY = '.data-api';
|
174
|
+
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
175
|
+
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
176
|
+
const EVENT_SHOW = `show${EVENT_KEY}`;
|
177
|
+
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
178
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
179
|
+
const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
|
180
|
+
const CLASS_NAME_ACTIVE = 'active';
|
181
|
+
const CLASS_NAME_FADE = 'fade';
|
182
|
+
const CLASS_NAME_SHOW = 'show';
|
183
|
+
const SELECTOR_DROPDOWN = '.dropdown';
|
184
|
+
const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
|
185
|
+
const SELECTOR_ACTIVE = '.active';
|
186
|
+
const SELECTOR_ACTIVE_UL = ':scope > li > .active';
|
187
|
+
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
|
188
|
+
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
189
|
+
const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
|
63
190
|
/**
|
64
|
-
*
|
191
|
+
* ------------------------------------------------------------------------
|
192
|
+
* Class Definition
|
193
|
+
* ------------------------------------------------------------------------
|
65
194
|
*/
|
66
195
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
196
|
+
class Tab extends BaseComponent__default['default'] {
|
197
|
+
// Getters
|
198
|
+
static get DATA_KEY() {
|
199
|
+
return DATA_KEY;
|
200
|
+
} // Public
|
72
201
|
|
73
|
-
var _proto = Tab.prototype;
|
74
202
|
|
75
|
-
|
76
|
-
|
77
|
-
var _this = this;
|
78
|
-
|
79
|
-
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default["default"](this._element).hasClass(CLASS_NAME_ACTIVE) || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED) || this._element.hasAttribute('disabled')) {
|
203
|
+
show() {
|
204
|
+
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
|
80
205
|
return;
|
81
206
|
}
|
82
207
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
208
|
+
let previous;
|
209
|
+
const target = getElementFromSelector(this._element);
|
210
|
+
|
211
|
+
const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
|
87
212
|
|
88
213
|
if (listElement) {
|
89
|
-
|
90
|
-
previous =
|
214
|
+
const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
|
215
|
+
previous = SelectorEngine__default['default'].find(itemSelector, listElement);
|
91
216
|
previous = previous[previous.length - 1];
|
92
217
|
}
|
93
218
|
|
94
|
-
|
219
|
+
const hideEvent = previous ? EventHandler__default['default'].trigger(previous, EVENT_HIDE, {
|
95
220
|
relatedTarget: this._element
|
96
|
-
});
|
97
|
-
|
221
|
+
}) : null;
|
222
|
+
const showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
|
98
223
|
relatedTarget: previous
|
99
224
|
});
|
100
225
|
|
101
|
-
if (
|
102
|
-
$__default["default"](previous).trigger(hideEvent);
|
103
|
-
}
|
104
|
-
|
105
|
-
$__default["default"](this._element).trigger(showEvent);
|
106
|
-
|
107
|
-
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
|
226
|
+
if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
|
108
227
|
return;
|
109
228
|
}
|
110
229
|
|
111
|
-
if (selector) {
|
112
|
-
target = document.querySelector(selector);
|
113
|
-
}
|
114
|
-
|
115
230
|
this._activate(this._element, listElement);
|
116
231
|
|
117
|
-
|
118
|
-
|
119
|
-
relatedTarget:
|
232
|
+
const complete = () => {
|
233
|
+
EventHandler__default['default'].trigger(previous, EVENT_HIDDEN, {
|
234
|
+
relatedTarget: this._element
|
120
235
|
});
|
121
|
-
|
236
|
+
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, {
|
122
237
|
relatedTarget: previous
|
123
238
|
});
|
124
|
-
$__default["default"](previous).trigger(hiddenEvent);
|
125
|
-
$__default["default"](_this._element).trigger(shownEvent);
|
126
239
|
};
|
127
240
|
|
128
241
|
if (target) {
|
@@ -130,40 +243,33 @@
|
|
130
243
|
} else {
|
131
244
|
complete();
|
132
245
|
}
|
133
|
-
};
|
134
|
-
|
135
|
-
_proto.dispose = function dispose() {
|
136
|
-
$__default["default"].removeData(this._element, DATA_KEY);
|
137
|
-
this._element = null;
|
138
246
|
} // Private
|
139
|
-
;
|
140
247
|
|
141
|
-
_proto._activate = function _activate(element, container, callback) {
|
142
|
-
var _this2 = this;
|
143
248
|
|
144
|
-
|
145
|
-
|
146
|
-
|
249
|
+
_activate(element, container, callback) {
|
250
|
+
const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine__default['default'].find(SELECTOR_ACTIVE_UL, container) : SelectorEngine__default['default'].children(container, SELECTOR_ACTIVE);
|
251
|
+
const active = activeElements[0];
|
252
|
+
const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE);
|
147
253
|
|
148
|
-
|
149
|
-
return _this2._transitionComplete(element, active, callback);
|
150
|
-
};
|
254
|
+
const complete = () => this._transitionComplete(element, active, callback);
|
151
255
|
|
152
256
|
if (active && isTransitioning) {
|
153
|
-
|
154
|
-
|
257
|
+
const transitionDuration = getTransitionDurationFromElement(active);
|
258
|
+
active.classList.remove(CLASS_NAME_SHOW);
|
259
|
+
EventHandler__default['default'].one(active, 'transitionend', complete);
|
260
|
+
emulateTransitionEnd(active, transitionDuration);
|
155
261
|
} else {
|
156
262
|
complete();
|
157
263
|
}
|
158
|
-
}
|
264
|
+
}
|
159
265
|
|
160
|
-
|
266
|
+
_transitionComplete(element, active, callback) {
|
161
267
|
if (active) {
|
162
|
-
|
163
|
-
|
268
|
+
active.classList.remove(CLASS_NAME_ACTIVE);
|
269
|
+
const dropdownChild = SelectorEngine__default['default'].findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
|
164
270
|
|
165
271
|
if (dropdownChild) {
|
166
|
-
|
272
|
+
dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
|
167
273
|
}
|
168
274
|
|
169
275
|
if (active.getAttribute('role') === 'tab') {
|
@@ -171,30 +277,29 @@
|
|
171
277
|
}
|
172
278
|
}
|
173
279
|
|
174
|
-
|
280
|
+
element.classList.add(CLASS_NAME_ACTIVE);
|
175
281
|
|
176
282
|
if (element.getAttribute('role') === 'tab') {
|
177
283
|
element.setAttribute('aria-selected', true);
|
178
284
|
}
|
179
285
|
|
180
|
-
|
286
|
+
reflow(element);
|
181
287
|
|
182
288
|
if (element.classList.contains(CLASS_NAME_FADE)) {
|
183
289
|
element.classList.add(CLASS_NAME_SHOW);
|
184
290
|
}
|
185
291
|
|
186
|
-
|
292
|
+
let parent = element.parentNode;
|
187
293
|
|
188
294
|
if (parent && parent.nodeName === 'LI') {
|
189
295
|
parent = parent.parentNode;
|
190
296
|
}
|
191
297
|
|
192
|
-
if (parent &&
|
193
|
-
|
298
|
+
if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
|
299
|
+
const dropdownElement = element.closest(SELECTOR_DROPDOWN);
|
194
300
|
|
195
301
|
if (dropdownElement) {
|
196
|
-
|
197
|
-
$__default["default"](dropdownToggleList).addClass(CLASS_NAME_ACTIVE);
|
302
|
+
SelectorEngine__default['default'].find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
|
198
303
|
}
|
199
304
|
|
200
305
|
element.setAttribute('aria-expanded', true);
|
@@ -204,59 +309,51 @@
|
|
204
309
|
callback();
|
205
310
|
}
|
206
311
|
} // Static
|
207
|
-
;
|
208
312
|
|
209
|
-
Tab._jQueryInterface = function _jQueryInterface(config) {
|
210
|
-
return this.each(function () {
|
211
|
-
var $this = $__default["default"](this);
|
212
|
-
var data = $this.data(DATA_KEY);
|
213
313
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
}
|
314
|
+
static jQueryInterface(config) {
|
315
|
+
return this.each(function () {
|
316
|
+
const data = Data__default['default'].get(this, DATA_KEY) || new Tab(this);
|
218
317
|
|
219
318
|
if (typeof config === 'string') {
|
220
319
|
if (typeof data[config] === 'undefined') {
|
221
|
-
throw new TypeError(
|
320
|
+
throw new TypeError(`No method named "${config}"`);
|
222
321
|
}
|
223
322
|
|
224
323
|
data[config]();
|
225
324
|
}
|
226
325
|
});
|
227
|
-
}
|
228
|
-
|
229
|
-
_createClass(Tab, null, [{
|
230
|
-
key: "VERSION",
|
231
|
-
get: function get() {
|
232
|
-
return VERSION;
|
233
|
-
}
|
234
|
-
}]);
|
326
|
+
}
|
235
327
|
|
236
|
-
|
237
|
-
}();
|
328
|
+
}
|
238
329
|
/**
|
239
|
-
*
|
330
|
+
* ------------------------------------------------------------------------
|
331
|
+
* Data Api implementation
|
332
|
+
* ------------------------------------------------------------------------
|
240
333
|
*/
|
241
334
|
|
242
335
|
|
243
|
-
|
244
|
-
|
336
|
+
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
337
|
+
if (['A', 'AREA'].includes(this.tagName)) {
|
338
|
+
event.preventDefault();
|
339
|
+
}
|
245
340
|
|
246
|
-
|
341
|
+
if (isDisabled(this)) {
|
342
|
+
return;
|
343
|
+
}
|
344
|
+
|
345
|
+
const data = Data__default['default'].get(this, DATA_KEY) || new Tab(this);
|
346
|
+
data.show();
|
247
347
|
});
|
248
348
|
/**
|
349
|
+
* ------------------------------------------------------------------------
|
249
350
|
* jQuery
|
351
|
+
* ------------------------------------------------------------------------
|
352
|
+
* add .Tab to jQuery only if jQuery is present
|
250
353
|
*/
|
251
354
|
|
252
|
-
|
253
|
-
$__default["default"].fn[NAME].Constructor = Tab;
|
254
|
-
|
255
|
-
$__default["default"].fn[NAME].noConflict = function () {
|
256
|
-
$__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
|
257
|
-
return Tab._jQueryInterface;
|
258
|
-
};
|
355
|
+
defineJQueryPlugin(NAME, Tab);
|
259
356
|
|
260
357
|
return Tab;
|
261
358
|
|
262
|
-
}));
|
359
|
+
})));
|