bootstrap 4.6.0 → 5.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +61 -0
- data/Gemfile +1 -0
- data/README.md +33 -6
- data/Rakefile +10 -1
- data/assets/javascripts/bootstrap/alert.js +53 -155
- data/assets/javascripts/bootstrap/base-component.js +83 -0
- data/assets/javascripts/bootstrap/button.js +43 -198
- data/assets/javascripts/bootstrap/carousel.js +285 -550
- data/assets/javascripts/bootstrap/collapse.js +169 -323
- data/assets/javascripts/bootstrap/dom/data.js +62 -0
- data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
- data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
- data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
- data/assets/javascripts/bootstrap/dropdown.js +300 -467
- data/assets/javascripts/bootstrap/modal.js +226 -575
- data/assets/javascripts/bootstrap/offcanvas.js +245 -0
- data/assets/javascripts/bootstrap/popover.js +61 -205
- data/assets/javascripts/bootstrap/scrollspy.js +216 -287
- data/assets/javascripts/bootstrap/tab.js +226 -203
- data/assets/javascripts/bootstrap/toast.js +136 -209
- data/assets/javascripts/bootstrap/tooltip.js +411 -757
- data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
- data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
- data/assets/javascripts/bootstrap/util/config.js +67 -0
- data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
- data/assets/javascripts/bootstrap/util/index.js +281 -0
- data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
- data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
- data/assets/javascripts/bootstrap/util/swipe.js +134 -0
- data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
- 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 +23 -7
- data/assets/javascripts/bootstrap.js +3649 -3587
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +53 -21
- data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
- data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
- data/assets/stylesheets/_bootstrap.scss +21 -13
- data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
- data/assets/stylesheets/bootstrap/_alert.scss +32 -16
- data/assets/stylesheets/bootstrap/_badge.scss +15 -31
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
- data/assets/stylesheets/bootstrap/_button-group.scss +27 -48
- data/assets/stylesheets/bootstrap/_buttons.scss +136 -71
- data/assets/stylesheets/bootstrap/_card.scss +66 -113
- data/assets/stylesheets/bootstrap/_carousel.scss +83 -36
- data/assets/stylesheets/bootstrap/_close.scss +51 -28
- data/assets/stylesheets/bootstrap/_containers.scss +41 -0
- data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
- data/assets/stylesheets/bootstrap/_forms.scss +9 -347
- data/assets/stylesheets/bootstrap/_functions.scss +181 -23
- data/assets/stylesheets/bootstrap/_grid.scss +18 -52
- data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
- data/assets/stylesheets/bootstrap/_images.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +77 -34
- data/assets/stylesheets/bootstrap/_maps.scss +174 -0
- data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
- data/assets/stylesheets/bootstrap/_modal.scss +107 -110
- data/assets/stylesheets/bootstrap/_nav.scss +102 -25
- data/assets/stylesheets/bootstrap/_navbar.scss +129 -172
- data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
- data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
- data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
- data/assets/stylesheets/bootstrap/_popover.scss +99 -73
- data/assets/stylesheets/bootstrap/_progress.scss +35 -14
- data/assets/stylesheets/bootstrap/_reboot.scss +319 -192
- data/assets/stylesheets/bootstrap/_root.scss +177 -9
- data/assets/stylesheets/bootstrap/_spinners.scss +44 -24
- data/assets/stylesheets/bootstrap/_tables.scss +101 -115
- data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
- data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
- data/assets/stylesheets/bootstrap/_transitions.scss +8 -1
- data/assets/stylesheets/bootstrap/_type.scss +40 -59
- data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
- data/assets/stylesheets/bootstrap/_variables-dark.scss +87 -0
- data/assets/stylesheets/bootstrap/_variables.scss +1216 -615
- data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
- data/assets/stylesheets/bootstrap/forms/_form-check.scss +189 -0
- data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
- data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
- data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
- data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
- data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
- data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
- data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
- data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
- data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
- data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
- data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
- data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
- data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
- data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -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/helpers/_vr.scss +8 -0
- data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
- data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
- data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
- 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 +20 -16
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
- data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
- data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +53 -85
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +119 -37
- data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
- data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
- data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
- data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +276 -132
- data/bootstrap.gemspec +6 -7
- data/lib/bootstrap/engine.rb +7 -1
- data/lib/bootstrap/version.rb +2 -2
- data/tasks/updater/js.rb +31 -7
- data/tasks/updater/network.rb +9 -3
- data/tasks/updater/scss.rb +2 -2
- data/tasks/updater.rb +2 -2
- 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_4_2.gemfile +1 -1
- data/test/gemfiles/rails_5_0.gemfile +1 -1
- data/test/gemfiles/rails_5_1.gemfile +1 -1
- data/test/gemfiles/rails_5_2.gemfile +8 -0
- data/test/gemfiles/rails_6_0.gemfile +1 -0
- data/test/gemfiles/rails_6_1.gemfile +8 -0
- data/test/gemfiles/rails_7_0_dartsass.gemfile +8 -0
- data/test/gemfiles/rails_7_0_sassc.gemfile +8 -0
- data/test/test_helper.rb +3 -2
- metadata +97 -85
- data/.travis.yml +0 -31
- data/assets/javascripts/bootstrap/util.js +0 -192
- 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 -208
- data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
- data/assets/stylesheets/bootstrap/_media.scss +0 -8
- data/assets/stylesheets/bootstrap/_print.scss +0 -141
- 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
@@ -0,0 +1,139 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap backdrop.js v5.3.2 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler.js'), require('./config.js'), require('./index.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/event-handler', './config', './index'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Backdrop = factory(global.EventHandler, global.Config, global.Index));
|
10
|
+
})(this, (function (EventHandler, Config, index_js) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/backdrop.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Constants
|
22
|
+
*/
|
23
|
+
|
24
|
+
const NAME = 'backdrop';
|
25
|
+
const CLASS_NAME_FADE = 'fade';
|
26
|
+
const CLASS_NAME_SHOW = 'show';
|
27
|
+
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME}`;
|
28
|
+
const Default = {
|
29
|
+
className: 'modal-backdrop',
|
30
|
+
clickCallback: null,
|
31
|
+
isAnimated: false,
|
32
|
+
isVisible: true,
|
33
|
+
// if false, we use the backdrop helper without adding any element to the dom
|
34
|
+
rootElement: 'body' // give the choice to place backdrop under different elements
|
35
|
+
};
|
36
|
+
|
37
|
+
const DefaultType = {
|
38
|
+
className: 'string',
|
39
|
+
clickCallback: '(function|null)',
|
40
|
+
isAnimated: 'boolean',
|
41
|
+
isVisible: 'boolean',
|
42
|
+
rootElement: '(element|string)'
|
43
|
+
};
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Class definition
|
47
|
+
*/
|
48
|
+
|
49
|
+
class Backdrop extends Config {
|
50
|
+
constructor(config) {
|
51
|
+
super();
|
52
|
+
this._config = this._getConfig(config);
|
53
|
+
this._isAppended = false;
|
54
|
+
this._element = null;
|
55
|
+
}
|
56
|
+
|
57
|
+
// Getters
|
58
|
+
static get Default() {
|
59
|
+
return Default;
|
60
|
+
}
|
61
|
+
static get DefaultType() {
|
62
|
+
return DefaultType;
|
63
|
+
}
|
64
|
+
static get NAME() {
|
65
|
+
return NAME;
|
66
|
+
}
|
67
|
+
|
68
|
+
// Public
|
69
|
+
show(callback) {
|
70
|
+
if (!this._config.isVisible) {
|
71
|
+
index_js.execute(callback);
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
this._append();
|
75
|
+
const element = this._getElement();
|
76
|
+
if (this._config.isAnimated) {
|
77
|
+
index_js.reflow(element);
|
78
|
+
}
|
79
|
+
element.classList.add(CLASS_NAME_SHOW);
|
80
|
+
this._emulateAnimation(() => {
|
81
|
+
index_js.execute(callback);
|
82
|
+
});
|
83
|
+
}
|
84
|
+
hide(callback) {
|
85
|
+
if (!this._config.isVisible) {
|
86
|
+
index_js.execute(callback);
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
this._getElement().classList.remove(CLASS_NAME_SHOW);
|
90
|
+
this._emulateAnimation(() => {
|
91
|
+
this.dispose();
|
92
|
+
index_js.execute(callback);
|
93
|
+
});
|
94
|
+
}
|
95
|
+
dispose() {
|
96
|
+
if (!this._isAppended) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
EventHandler.off(this._element, EVENT_MOUSEDOWN);
|
100
|
+
this._element.remove();
|
101
|
+
this._isAppended = false;
|
102
|
+
}
|
103
|
+
|
104
|
+
// Private
|
105
|
+
_getElement() {
|
106
|
+
if (!this._element) {
|
107
|
+
const backdrop = document.createElement('div');
|
108
|
+
backdrop.className = this._config.className;
|
109
|
+
if (this._config.isAnimated) {
|
110
|
+
backdrop.classList.add(CLASS_NAME_FADE);
|
111
|
+
}
|
112
|
+
this._element = backdrop;
|
113
|
+
}
|
114
|
+
return this._element;
|
115
|
+
}
|
116
|
+
_configAfterMerge(config) {
|
117
|
+
// use getElement() with the default "body" to get a fresh Element on each instantiation
|
118
|
+
config.rootElement = index_js.getElement(config.rootElement);
|
119
|
+
return config;
|
120
|
+
}
|
121
|
+
_append() {
|
122
|
+
if (this._isAppended) {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
const element = this._getElement();
|
126
|
+
this._config.rootElement.append(element);
|
127
|
+
EventHandler.on(element, EVENT_MOUSEDOWN, () => {
|
128
|
+
index_js.execute(this._config.clickCallback);
|
129
|
+
});
|
130
|
+
this._isAppended = true;
|
131
|
+
}
|
132
|
+
_emulateAnimation(callback) {
|
133
|
+
index_js.executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
return Backdrop;
|
138
|
+
|
139
|
+
}));
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap component-functions.js v5.3.2 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('../dom/event-handler.js'), require('../dom/selector-engine.js'), require('./index.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports', '../dom/event-handler', '../dom/selector-engine', './index'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComponentFunctions = {}, global.EventHandler, global.SelectorEngine, global.Index));
|
10
|
+
})(this, (function (exports, EventHandler, SelectorEngine, index_js) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/component-functions.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
const enableDismissTrigger = (component, method = 'hide') => {
|
20
|
+
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
21
|
+
const name = component.NAME;
|
22
|
+
EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
|
23
|
+
if (['A', 'AREA'].includes(this.tagName)) {
|
24
|
+
event.preventDefault();
|
25
|
+
}
|
26
|
+
if (index_js.isDisabled(this)) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`);
|
30
|
+
const instance = component.getOrCreateInstance(target);
|
31
|
+
|
32
|
+
// Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
33
|
+
instance[method]();
|
34
|
+
});
|
35
|
+
};
|
36
|
+
|
37
|
+
exports.enableDismissTrigger = enableDismissTrigger;
|
38
|
+
|
39
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
40
|
+
|
41
|
+
}));
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap config.js v5.3.2 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/manipulator.js'), require('./index.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/manipulator', './index'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Config = factory(global.Manipulator, global.Index));
|
10
|
+
})(this, (function (Manipulator, index_js) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/config.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Class definition
|
22
|
+
*/
|
23
|
+
|
24
|
+
class Config {
|
25
|
+
// Getters
|
26
|
+
static get Default() {
|
27
|
+
return {};
|
28
|
+
}
|
29
|
+
static get DefaultType() {
|
30
|
+
return {};
|
31
|
+
}
|
32
|
+
static get NAME() {
|
33
|
+
throw new Error('You have to implement the static method "NAME", for each component!');
|
34
|
+
}
|
35
|
+
_getConfig(config) {
|
36
|
+
config = this._mergeConfigObj(config);
|
37
|
+
config = this._configAfterMerge(config);
|
38
|
+
this._typeCheckConfig(config);
|
39
|
+
return config;
|
40
|
+
}
|
41
|
+
_configAfterMerge(config) {
|
42
|
+
return config;
|
43
|
+
}
|
44
|
+
_mergeConfigObj(config, element) {
|
45
|
+
const jsonConfig = index_js.isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
|
46
|
+
|
47
|
+
return {
|
48
|
+
...this.constructor.Default,
|
49
|
+
...(typeof jsonConfig === 'object' ? jsonConfig : {}),
|
50
|
+
...(index_js.isElement(element) ? Manipulator.getDataAttributes(element) : {}),
|
51
|
+
...(typeof config === 'object' ? config : {})
|
52
|
+
};
|
53
|
+
}
|
54
|
+
_typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
|
55
|
+
for (const [property, expectedTypes] of Object.entries(configTypes)) {
|
56
|
+
const value = config[property];
|
57
|
+
const valueType = index_js.isElement(value) ? 'element' : index_js.toType(value);
|
58
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
59
|
+
throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
return Config;
|
66
|
+
|
67
|
+
}));
|
@@ -0,0 +1,113 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap focustrap.js v5.3.2 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler.js'), require('../dom/selector-engine.js'), require('./config.js')) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['../dom/event-handler', '../dom/selector-engine', './config'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Focustrap = factory(global.EventHandler, global.SelectorEngine, global.Config));
|
10
|
+
})(this, (function (EventHandler, SelectorEngine, Config) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/focustrap.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Constants
|
22
|
+
*/
|
23
|
+
|
24
|
+
const NAME = 'focustrap';
|
25
|
+
const DATA_KEY = 'bs.focustrap';
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`;
|
27
|
+
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
28
|
+
const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`;
|
29
|
+
const TAB_KEY = 'Tab';
|
30
|
+
const TAB_NAV_FORWARD = 'forward';
|
31
|
+
const TAB_NAV_BACKWARD = 'backward';
|
32
|
+
const Default = {
|
33
|
+
autofocus: true,
|
34
|
+
trapElement: null // The element to trap focus inside of
|
35
|
+
};
|
36
|
+
|
37
|
+
const DefaultType = {
|
38
|
+
autofocus: 'boolean',
|
39
|
+
trapElement: 'element'
|
40
|
+
};
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Class definition
|
44
|
+
*/
|
45
|
+
|
46
|
+
class FocusTrap extends Config {
|
47
|
+
constructor(config) {
|
48
|
+
super();
|
49
|
+
this._config = this._getConfig(config);
|
50
|
+
this._isActive = false;
|
51
|
+
this._lastTabNavDirection = null;
|
52
|
+
}
|
53
|
+
|
54
|
+
// Getters
|
55
|
+
static get Default() {
|
56
|
+
return Default;
|
57
|
+
}
|
58
|
+
static get DefaultType() {
|
59
|
+
return DefaultType;
|
60
|
+
}
|
61
|
+
static get NAME() {
|
62
|
+
return NAME;
|
63
|
+
}
|
64
|
+
|
65
|
+
// Public
|
66
|
+
activate() {
|
67
|
+
if (this._isActive) {
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
if (this._config.autofocus) {
|
71
|
+
this._config.trapElement.focus();
|
72
|
+
}
|
73
|
+
EventHandler.off(document, EVENT_KEY); // guard against infinite focus loop
|
74
|
+
EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event));
|
75
|
+
EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
|
76
|
+
this._isActive = true;
|
77
|
+
}
|
78
|
+
deactivate() {
|
79
|
+
if (!this._isActive) {
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
this._isActive = false;
|
83
|
+
EventHandler.off(document, EVENT_KEY);
|
84
|
+
}
|
85
|
+
|
86
|
+
// Private
|
87
|
+
_handleFocusin(event) {
|
88
|
+
const {
|
89
|
+
trapElement
|
90
|
+
} = this._config;
|
91
|
+
if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
const elements = SelectorEngine.focusableChildren(trapElement);
|
95
|
+
if (elements.length === 0) {
|
96
|
+
trapElement.focus();
|
97
|
+
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
|
98
|
+
elements[elements.length - 1].focus();
|
99
|
+
} else {
|
100
|
+
elements[0].focus();
|
101
|
+
}
|
102
|
+
}
|
103
|
+
_handleKeydown(event) {
|
104
|
+
if (event.key !== TAB_KEY) {
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
return FocusTrap;
|
112
|
+
|
113
|
+
}));
|
@@ -0,0 +1,281 @@
|
|
1
|
+
/*!
|
2
|
+
* Bootstrap index.js v5.3.2 (https://getbootstrap.com/)
|
3
|
+
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
*/
|
6
|
+
(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Index = {}));
|
10
|
+
})(this, (function (exports) { 'use strict';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* --------------------------------------------------------------------------
|
14
|
+
* Bootstrap util/index.js
|
15
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
16
|
+
* --------------------------------------------------------------------------
|
17
|
+
*/
|
18
|
+
|
19
|
+
const MAX_UID = 1000000;
|
20
|
+
const MILLISECONDS_MULTIPLIER = 1000;
|
21
|
+
const TRANSITION_END = 'transitionend';
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Properly escape IDs selectors to handle weird IDs
|
25
|
+
* @param {string} selector
|
26
|
+
* @returns {string}
|
27
|
+
*/
|
28
|
+
const parseSelector = selector => {
|
29
|
+
if (selector && window.CSS && window.CSS.escape) {
|
30
|
+
// document.querySelector needs escaping to handle IDs (html5+) containing for instance /
|
31
|
+
selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
|
32
|
+
}
|
33
|
+
return selector;
|
34
|
+
};
|
35
|
+
|
36
|
+
// Shout-out Angus Croll (https://goo.gl/pxwQGp)
|
37
|
+
const toType = object => {
|
38
|
+
if (object === null || object === undefined) {
|
39
|
+
return `${object}`;
|
40
|
+
}
|
41
|
+
return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
|
42
|
+
};
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Public Util API
|
46
|
+
*/
|
47
|
+
|
48
|
+
const getUID = prefix => {
|
49
|
+
do {
|
50
|
+
prefix += Math.floor(Math.random() * MAX_UID);
|
51
|
+
} while (document.getElementById(prefix));
|
52
|
+
return prefix;
|
53
|
+
};
|
54
|
+
const getTransitionDurationFromElement = element => {
|
55
|
+
if (!element) {
|
56
|
+
return 0;
|
57
|
+
}
|
58
|
+
|
59
|
+
// Get transition-duration of the element
|
60
|
+
let {
|
61
|
+
transitionDuration,
|
62
|
+
transitionDelay
|
63
|
+
} = window.getComputedStyle(element);
|
64
|
+
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
65
|
+
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
66
|
+
|
67
|
+
// Return 0 if element or transition duration is not found
|
68
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
69
|
+
return 0;
|
70
|
+
}
|
71
|
+
|
72
|
+
// If multiple durations are defined, take the first
|
73
|
+
transitionDuration = transitionDuration.split(',')[0];
|
74
|
+
transitionDelay = transitionDelay.split(',')[0];
|
75
|
+
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
76
|
+
};
|
77
|
+
const triggerTransitionEnd = element => {
|
78
|
+
element.dispatchEvent(new Event(TRANSITION_END));
|
79
|
+
};
|
80
|
+
const isElement = object => {
|
81
|
+
if (!object || typeof object !== 'object') {
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
if (typeof object.jquery !== 'undefined') {
|
85
|
+
object = object[0];
|
86
|
+
}
|
87
|
+
return typeof object.nodeType !== 'undefined';
|
88
|
+
};
|
89
|
+
const getElement = object => {
|
90
|
+
// it's a jQuery object or a node element
|
91
|
+
if (isElement(object)) {
|
92
|
+
return object.jquery ? object[0] : object;
|
93
|
+
}
|
94
|
+
if (typeof object === 'string' && object.length > 0) {
|
95
|
+
return document.querySelector(parseSelector(object));
|
96
|
+
}
|
97
|
+
return null;
|
98
|
+
};
|
99
|
+
const isVisible = element => {
|
100
|
+
if (!isElement(element) || element.getClientRects().length === 0) {
|
101
|
+
return false;
|
102
|
+
}
|
103
|
+
const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible';
|
104
|
+
// Handle `details` element as its content may falsie appear visible when it is closed
|
105
|
+
const closedDetails = element.closest('details:not([open])');
|
106
|
+
if (!closedDetails) {
|
107
|
+
return elementIsVisible;
|
108
|
+
}
|
109
|
+
if (closedDetails !== element) {
|
110
|
+
const summary = element.closest('summary');
|
111
|
+
if (summary && summary.parentNode !== closedDetails) {
|
112
|
+
return false;
|
113
|
+
}
|
114
|
+
if (summary === null) {
|
115
|
+
return false;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
return elementIsVisible;
|
119
|
+
};
|
120
|
+
const isDisabled = element => {
|
121
|
+
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
122
|
+
return true;
|
123
|
+
}
|
124
|
+
if (element.classList.contains('disabled')) {
|
125
|
+
return true;
|
126
|
+
}
|
127
|
+
if (typeof element.disabled !== 'undefined') {
|
128
|
+
return element.disabled;
|
129
|
+
}
|
130
|
+
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
131
|
+
};
|
132
|
+
const findShadowRoot = element => {
|
133
|
+
if (!document.documentElement.attachShadow) {
|
134
|
+
return null;
|
135
|
+
}
|
136
|
+
|
137
|
+
// Can find the shadow root otherwise it'll return the document
|
138
|
+
if (typeof element.getRootNode === 'function') {
|
139
|
+
const root = element.getRootNode();
|
140
|
+
return root instanceof ShadowRoot ? root : null;
|
141
|
+
}
|
142
|
+
if (element instanceof ShadowRoot) {
|
143
|
+
return element;
|
144
|
+
}
|
145
|
+
|
146
|
+
// when we don't find a shadow root
|
147
|
+
if (!element.parentNode) {
|
148
|
+
return null;
|
149
|
+
}
|
150
|
+
return findShadowRoot(element.parentNode);
|
151
|
+
};
|
152
|
+
const noop = () => {};
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Trick to restart an element's animation
|
156
|
+
*
|
157
|
+
* @param {HTMLElement} element
|
158
|
+
* @return void
|
159
|
+
*
|
160
|
+
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
161
|
+
*/
|
162
|
+
const reflow = element => {
|
163
|
+
element.offsetHeight; // eslint-disable-line no-unused-expressions
|
164
|
+
};
|
165
|
+
|
166
|
+
const getjQuery = () => {
|
167
|
+
if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
168
|
+
return window.jQuery;
|
169
|
+
}
|
170
|
+
return null;
|
171
|
+
};
|
172
|
+
const DOMContentLoadedCallbacks = [];
|
173
|
+
const onDOMContentLoaded = callback => {
|
174
|
+
if (document.readyState === 'loading') {
|
175
|
+
// add listener on the first call when the document is in loading state
|
176
|
+
if (!DOMContentLoadedCallbacks.length) {
|
177
|
+
document.addEventListener('DOMContentLoaded', () => {
|
178
|
+
for (const callback of DOMContentLoadedCallbacks) {
|
179
|
+
callback();
|
180
|
+
}
|
181
|
+
});
|
182
|
+
}
|
183
|
+
DOMContentLoadedCallbacks.push(callback);
|
184
|
+
} else {
|
185
|
+
callback();
|
186
|
+
}
|
187
|
+
};
|
188
|
+
const isRTL = () => document.documentElement.dir === 'rtl';
|
189
|
+
const defineJQueryPlugin = plugin => {
|
190
|
+
onDOMContentLoaded(() => {
|
191
|
+
const $ = getjQuery();
|
192
|
+
/* istanbul ignore if */
|
193
|
+
if ($) {
|
194
|
+
const name = plugin.NAME;
|
195
|
+
const JQUERY_NO_CONFLICT = $.fn[name];
|
196
|
+
$.fn[name] = plugin.jQueryInterface;
|
197
|
+
$.fn[name].Constructor = plugin;
|
198
|
+
$.fn[name].noConflict = () => {
|
199
|
+
$.fn[name] = JQUERY_NO_CONFLICT;
|
200
|
+
return plugin.jQueryInterface;
|
201
|
+
};
|
202
|
+
}
|
203
|
+
});
|
204
|
+
};
|
205
|
+
const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
|
206
|
+
return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue;
|
207
|
+
};
|
208
|
+
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
|
209
|
+
if (!waitForTransition) {
|
210
|
+
execute(callback);
|
211
|
+
return;
|
212
|
+
}
|
213
|
+
const durationPadding = 5;
|
214
|
+
const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
215
|
+
let called = false;
|
216
|
+
const handler = ({
|
217
|
+
target
|
218
|
+
}) => {
|
219
|
+
if (target !== transitionElement) {
|
220
|
+
return;
|
221
|
+
}
|
222
|
+
called = true;
|
223
|
+
transitionElement.removeEventListener(TRANSITION_END, handler);
|
224
|
+
execute(callback);
|
225
|
+
};
|
226
|
+
transitionElement.addEventListener(TRANSITION_END, handler);
|
227
|
+
setTimeout(() => {
|
228
|
+
if (!called) {
|
229
|
+
triggerTransitionEnd(transitionElement);
|
230
|
+
}
|
231
|
+
}, emulatedDuration);
|
232
|
+
};
|
233
|
+
|
234
|
+
/**
|
235
|
+
* Return the previous/next element of a list.
|
236
|
+
*
|
237
|
+
* @param {array} list The list of elements
|
238
|
+
* @param activeElement The active element
|
239
|
+
* @param shouldGetNext Choose to get next or previous element
|
240
|
+
* @param isCycleAllowed
|
241
|
+
* @return {Element|elem} The proper element
|
242
|
+
*/
|
243
|
+
const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
|
244
|
+
const listLength = list.length;
|
245
|
+
let index = list.indexOf(activeElement);
|
246
|
+
|
247
|
+
// if the element does not exist in the list return an element
|
248
|
+
// depending on the direction and if cycle is allowed
|
249
|
+
if (index === -1) {
|
250
|
+
return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
|
251
|
+
}
|
252
|
+
index += shouldGetNext ? 1 : -1;
|
253
|
+
if (isCycleAllowed) {
|
254
|
+
index = (index + listLength) % listLength;
|
255
|
+
}
|
256
|
+
return list[Math.max(0, Math.min(index, listLength - 1))];
|
257
|
+
};
|
258
|
+
|
259
|
+
exports.defineJQueryPlugin = defineJQueryPlugin;
|
260
|
+
exports.execute = execute;
|
261
|
+
exports.executeAfterTransition = executeAfterTransition;
|
262
|
+
exports.findShadowRoot = findShadowRoot;
|
263
|
+
exports.getElement = getElement;
|
264
|
+
exports.getNextActiveElement = getNextActiveElement;
|
265
|
+
exports.getTransitionDurationFromElement = getTransitionDurationFromElement;
|
266
|
+
exports.getUID = getUID;
|
267
|
+
exports.getjQuery = getjQuery;
|
268
|
+
exports.isDisabled = isDisabled;
|
269
|
+
exports.isElement = isElement;
|
270
|
+
exports.isRTL = isRTL;
|
271
|
+
exports.isVisible = isVisible;
|
272
|
+
exports.noop = noop;
|
273
|
+
exports.onDOMContentLoaded = onDOMContentLoaded;
|
274
|
+
exports.parseSelector = parseSelector;
|
275
|
+
exports.reflow = reflow;
|
276
|
+
exports.toType = toType;
|
277
|
+
exports.triggerTransitionEnd = triggerTransitionEnd;
|
278
|
+
|
279
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
280
|
+
|
281
|
+
}));
|