bootstrap 5.2.3 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +11 -5
  3. data/Gemfile +1 -0
  4. data/README.md +6 -2
  5. data/Rakefile +10 -1
  6. data/assets/javascripts/bootstrap/alert.js +22 -32
  7. data/assets/javascripts/bootstrap/base-component.js +22 -38
  8. data/assets/javascripts/bootstrap/button.js +19 -22
  9. data/assets/javascripts/bootstrap/carousel.js +52 -135
  10. data/assets/javascripts/bootstrap/collapse.js +40 -102
  11. data/assets/javascripts/bootstrap/dom/data.js +8 -12
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +19 -66
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -17
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +42 -24
  15. data/assets/javascripts/bootstrap/dropdown.js +74 -145
  16. data/assets/javascripts/bootstrap/modal.js +53 -133
  17. data/assets/javascripts/bootstrap/offcanvas.js +50 -102
  18. data/assets/javascripts/bootstrap/popover.js +23 -29
  19. data/assets/javascripts/bootstrap/scrollspy.js +53 -90
  20. data/assets/javascripts/bootstrap/tab.js +63 -112
  21. data/assets/javascripts/bootstrap/toast.js +31 -73
  22. data/assets/javascripts/bootstrap/tooltip.js +75 -177
  23. data/assets/javascripts/bootstrap/util/backdrop.js +28 -54
  24. data/assets/javascripts/bootstrap/util/component-functions.js +13 -18
  25. data/assets/javascripts/bootstrap/util/config.js +15 -27
  26. data/assets/javascripts/bootstrap/util/focustrap.js +20 -36
  27. data/assets/javascripts/bootstrap/util/index.js +42 -111
  28. data/assets/javascripts/bootstrap/util/sanitizer.js +30 -42
  29. data/assets/javascripts/bootstrap/util/scrollbar.js +24 -50
  30. data/assets/javascripts/bootstrap/util/swipe.js +27 -48
  31. data/assets/javascripts/bootstrap/util/template-factory.js +25 -52
  32. data/assets/javascripts/bootstrap-sprockets.js +10 -10
  33. data/assets/javascripts/bootstrap.js +689 -1444
  34. data/assets/javascripts/bootstrap.min.js +3 -3
  35. data/assets/stylesheets/_bootstrap-grid.scss +1 -3
  36. data/assets/stylesheets/_bootstrap-reboot.scss +1 -0
  37. data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
  38. data/assets/stylesheets/_bootstrap.scss +1 -0
  39. data/assets/stylesheets/bootstrap/_accordion.scss +9 -0
  40. data/assets/stylesheets/bootstrap/_alert.scss +8 -11
  41. data/assets/stylesheets/bootstrap/_button-group.scss +2 -2
  42. data/assets/stylesheets/bootstrap/_buttons.scss +3 -3
  43. data/assets/stylesheets/bootstrap/_card.scss +5 -0
  44. data/assets/stylesheets/bootstrap/_carousel.scss +20 -2
  45. data/assets/stylesheets/bootstrap/_close.scss +32 -9
  46. data/assets/stylesheets/bootstrap/_dropdown.scss +1 -0
  47. data/assets/stylesheets/bootstrap/_functions.scss +1 -1
  48. data/assets/stylesheets/bootstrap/_grid.scss +6 -0
  49. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  50. data/assets/stylesheets/bootstrap/_list-group.scss +12 -7
  51. data/assets/stylesheets/bootstrap/_maps.scss +120 -0
  52. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  53. data/assets/stylesheets/bootstrap/_nav.scss +42 -17
  54. data/assets/stylesheets/bootstrap/_navbar.scss +15 -4
  55. data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -2
  56. data/assets/stylesheets/bootstrap/_pagination.scss +1 -1
  57. data/assets/stylesheets/bootstrap/_progress.scss +10 -1
  58. data/assets/stylesheets/bootstrap/_reboot.scss +8 -7
  59. data/assets/stylesheets/bootstrap/_root.scss +124 -10
  60. data/assets/stylesheets/bootstrap/_tables.scss +18 -11
  61. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -5
  62. data/assets/stylesheets/bootstrap/_utilities.scss +175 -16
  63. data/assets/stylesheets/bootstrap/_variables-dark.scss +87 -0
  64. data/assets/stylesheets/bootstrap/_variables.scss +282 -169
  65. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +23 -3
  66. data/assets/stylesheets/bootstrap/forms/_form-check.scss +26 -12
  67. data/assets/stylesheets/bootstrap/forms/_form-control.scss +24 -4
  68. data/assets/stylesheets/bootstrap/forms/_form-range.scss +3 -3
  69. data/assets/stylesheets/bootstrap/forms/_form-select.scss +12 -3
  70. data/assets/stylesheets/bootstrap/forms/_input-group.scss +1 -1
  71. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +1 -4
  72. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +20 -2
  73. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  74. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  75. data/assets/stylesheets/bootstrap/helpers/_vr.scss +1 -1
  76. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -1
  77. data/assets/stylesheets/bootstrap/mixins/_banner.scss +2 -4
  78. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  79. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  80. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -7
  81. data/assets/stylesheets/bootstrap/mixins/_grid.scss +1 -1
  82. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  83. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +1 -1
  84. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +5 -1
  85. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  86. data/bootstrap.gemspec +4 -3
  87. data/lib/bootstrap/engine.rb +7 -1
  88. data/lib/bootstrap/version.rb +2 -2
  89. data/tasks/updater/js.rb +1 -1
  90. data/tasks/updater/scss.rb +2 -2
  91. data/test/gemfiles/rails_4_2.gemfile +1 -1
  92. data/test/gemfiles/rails_5_0.gemfile +1 -1
  93. data/test/gemfiles/rails_5_1.gemfile +1 -1
  94. data/test/gemfiles/rails_5_2.gemfile +1 -1
  95. data/test/gemfiles/rails_6_0.gemfile +1 -0
  96. data/test/gemfiles/rails_6_1.gemfile +1 -0
  97. data/test/gemfiles/rails_7_0_dartsass.gemfile +8 -0
  98. data/test/gemfiles/{rails_7_0.gemfile → rails_7_0_sassc.gemfile} +1 -0
  99. metadata +35 -15
  100. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +0 -18
@@ -1,25 +1,22 @@
1
1
  /*!
2
- * Bootstrap backdrop.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
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
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler'), require('./index'), require('./config')) :
8
- typeof define === 'function' && define.amd ? define(['../dom/event-handler', './index', './config'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Backdrop = factory(global.EventHandler, global.Index, global.Config));
10
- })(this, (function (EventHandler, index, Config) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- const Config__default = /*#__PURE__*/_interopDefaultLegacy(Config);
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';
16
11
 
17
12
  /**
18
13
  * --------------------------------------------------------------------------
19
- * Bootstrap (v5.2.3): util/backdrop.js
14
+ * Bootstrap util/backdrop.js
20
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
21
16
  * --------------------------------------------------------------------------
22
17
  */
18
+
19
+
23
20
  /**
24
21
  * Constants
25
22
  */
@@ -35,8 +32,8 @@
35
32
  isVisible: true,
36
33
  // if false, we use the backdrop helper without adding any element to the dom
37
34
  rootElement: 'body' // give the choice to place backdrop under different elements
38
-
39
35
  };
36
+
40
37
  const DefaultType = {
41
38
  className: 'string',
42
39
  clickCallback: '(function|null)',
@@ -44,120 +41,97 @@
44
41
  isVisible: 'boolean',
45
42
  rootElement: '(element|string)'
46
43
  };
44
+
47
45
  /**
48
46
  * Class definition
49
47
  */
50
48
 
51
- class Backdrop extends Config__default.default {
49
+ class Backdrop extends Config {
52
50
  constructor(config) {
53
51
  super();
54
52
  this._config = this._getConfig(config);
55
53
  this._isAppended = false;
56
54
  this._element = null;
57
- } // Getters
58
-
55
+ }
59
56
 
57
+ // Getters
60
58
  static get Default() {
61
59
  return Default;
62
60
  }
63
-
64
61
  static get DefaultType() {
65
62
  return DefaultType;
66
63
  }
67
-
68
64
  static get NAME() {
69
65
  return NAME;
70
- } // Public
71
-
66
+ }
72
67
 
68
+ // Public
73
69
  show(callback) {
74
70
  if (!this._config.isVisible) {
75
- index.execute(callback);
71
+ index_js.execute(callback);
76
72
  return;
77
73
  }
78
-
79
74
  this._append();
80
-
81
75
  const element = this._getElement();
82
-
83
76
  if (this._config.isAnimated) {
84
- index.reflow(element);
77
+ index_js.reflow(element);
85
78
  }
86
-
87
79
  element.classList.add(CLASS_NAME_SHOW);
88
-
89
80
  this._emulateAnimation(() => {
90
- index.execute(callback);
81
+ index_js.execute(callback);
91
82
  });
92
83
  }
93
-
94
84
  hide(callback) {
95
85
  if (!this._config.isVisible) {
96
- index.execute(callback);
86
+ index_js.execute(callback);
97
87
  return;
98
88
  }
99
-
100
89
  this._getElement().classList.remove(CLASS_NAME_SHOW);
101
-
102
90
  this._emulateAnimation(() => {
103
91
  this.dispose();
104
- index.execute(callback);
92
+ index_js.execute(callback);
105
93
  });
106
94
  }
107
-
108
95
  dispose() {
109
96
  if (!this._isAppended) {
110
97
  return;
111
98
  }
112
-
113
- EventHandler__default.default.off(this._element, EVENT_MOUSEDOWN);
114
-
99
+ EventHandler.off(this._element, EVENT_MOUSEDOWN);
115
100
  this._element.remove();
116
-
117
101
  this._isAppended = false;
118
- } // Private
119
-
102
+ }
120
103
 
104
+ // Private
121
105
  _getElement() {
122
106
  if (!this._element) {
123
107
  const backdrop = document.createElement('div');
124
108
  backdrop.className = this._config.className;
125
-
126
109
  if (this._config.isAnimated) {
127
110
  backdrop.classList.add(CLASS_NAME_FADE);
128
111
  }
129
-
130
112
  this._element = backdrop;
131
113
  }
132
-
133
114
  return this._element;
134
115
  }
135
-
136
116
  _configAfterMerge(config) {
137
117
  // use getElement() with the default "body" to get a fresh Element on each instantiation
138
- config.rootElement = index.getElement(config.rootElement);
118
+ config.rootElement = index_js.getElement(config.rootElement);
139
119
  return config;
140
120
  }
141
-
142
121
  _append() {
143
122
  if (this._isAppended) {
144
123
  return;
145
124
  }
146
-
147
125
  const element = this._getElement();
148
-
149
126
  this._config.rootElement.append(element);
150
-
151
- EventHandler__default.default.on(element, EVENT_MOUSEDOWN, () => {
152
- index.execute(this._config.clickCallback);
127
+ EventHandler.on(element, EVENT_MOUSEDOWN, () => {
128
+ index_js.execute(this._config.clickCallback);
153
129
  });
154
130
  this._isAppended = true;
155
131
  }
156
-
157
132
  _emulateAnimation(callback) {
158
- index.executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
133
+ index_js.executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
159
134
  }
160
-
161
135
  }
162
136
 
163
137
  return Backdrop;
@@ -1,21 +1,17 @@
1
1
  /*!
2
- * Bootstrap component-functions.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
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
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' ? factory(exports, require('../dom/event-handler'), require('./index')) :
8
- typeof define === 'function' && define.amd ? define(['exports', '../dom/event-handler', './index'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ComponentFunctions = {}, global.EventHandler, global.Index));
10
- })(this, (function (exports, EventHandler, index) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
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';
15
11
 
16
12
  /**
17
13
  * --------------------------------------------------------------------------
18
- * Bootstrap (v5.2.3): util/component-functions.js
14
+ * Bootstrap util/component-functions.js
19
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
20
16
  * --------------------------------------------------------------------------
21
17
  */
@@ -23,24 +19,23 @@
23
19
  const enableDismissTrigger = (component, method = 'hide') => {
24
20
  const clickEvent = `click.dismiss${component.EVENT_KEY}`;
25
21
  const name = component.NAME;
26
- EventHandler__default.default.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
22
+ EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
27
23
  if (['A', 'AREA'].includes(this.tagName)) {
28
24
  event.preventDefault();
29
25
  }
30
-
31
- if (index.isDisabled(this)) {
26
+ if (index_js.isDisabled(this)) {
32
27
  return;
33
28
  }
29
+ const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`);
30
+ const instance = component.getOrCreateInstance(target);
34
31
 
35
- const target = index.getElementFromSelector(this) || this.closest(`.${name}`);
36
- const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
37
-
32
+ // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
38
33
  instance[method]();
39
34
  });
40
35
  };
41
36
 
42
37
  exports.enableDismissTrigger = enableDismissTrigger;
43
38
 
44
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
39
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
45
40
 
46
41
  }));
@@ -1,24 +1,22 @@
1
1
  /*!
2
- * Bootstrap config.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
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
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('./index'), require('../dom/manipulator')) :
8
- typeof define === 'function' && define.amd ? define(['./index', '../dom/manipulator'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Config = factory(global.Index, global.Manipulator));
10
- })(this, (function (index, Manipulator) { 'use strict';
11
-
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
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';
15
11
 
16
12
  /**
17
13
  * --------------------------------------------------------------------------
18
- * Bootstrap (v5.2.3): util/config.js
14
+ * Bootstrap util/config.js
19
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
20
16
  * --------------------------------------------------------------------------
21
17
  */
18
+
19
+
22
20
  /**
23
21
  * Class definition
24
22
  */
@@ -28,50 +26,40 @@
28
26
  static get Default() {
29
27
  return {};
30
28
  }
31
-
32
29
  static get DefaultType() {
33
30
  return {};
34
31
  }
35
-
36
32
  static get NAME() {
37
33
  throw new Error('You have to implement the static method "NAME", for each component!');
38
34
  }
39
-
40
35
  _getConfig(config) {
41
36
  config = this._mergeConfigObj(config);
42
37
  config = this._configAfterMerge(config);
43
-
44
38
  this._typeCheckConfig(config);
45
-
46
39
  return config;
47
40
  }
48
-
49
41
  _configAfterMerge(config) {
50
42
  return config;
51
43
  }
52
-
53
44
  _mergeConfigObj(config, element) {
54
- const jsonConfig = index.isElement(element) ? Manipulator__default.default.getDataAttribute(element, 'config') : {}; // try to parse
45
+ const jsonConfig = index_js.isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
55
46
 
56
- return { ...this.constructor.Default,
47
+ return {
48
+ ...this.constructor.Default,
57
49
  ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
58
- ...(index.isElement(element) ? Manipulator__default.default.getDataAttributes(element) : {}),
50
+ ...(index_js.isElement(element) ? Manipulator.getDataAttributes(element) : {}),
59
51
  ...(typeof config === 'object' ? config : {})
60
52
  };
61
53
  }
62
-
63
54
  _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
64
- for (const property of Object.keys(configTypes)) {
65
- const expectedTypes = configTypes[property];
55
+ for (const [property, expectedTypes] of Object.entries(configTypes)) {
66
56
  const value = config[property];
67
- const valueType = index.isElement(value) ? 'element' : index.toType(value);
68
-
57
+ const valueType = index_js.isElement(value) ? 'element' : index_js.toType(value);
69
58
  if (!new RegExp(expectedTypes).test(valueType)) {
70
59
  throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
71
60
  }
72
61
  }
73
62
  }
74
-
75
63
  }
76
64
 
77
65
  return Config;
@@ -1,26 +1,22 @@
1
1
  /*!
2
- * Bootstrap focustrap.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
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
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler'), require('../dom/selector-engine'), require('./config')) :
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler.js'), require('../dom/selector-engine.js'), require('./config.js')) :
8
8
  typeof define === 'function' && define.amd ? define(['../dom/event-handler', '../dom/selector-engine', './config'], factory) :
9
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Focustrap = factory(global.EventHandler, global.SelectorEngine, global.Config));
10
10
  })(this, (function (EventHandler, SelectorEngine, Config) { 'use strict';
11
11
 
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
15
- const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
16
- const Config__default = /*#__PURE__*/_interopDefaultLegacy(Config);
17
-
18
12
  /**
19
13
  * --------------------------------------------------------------------------
20
- * Bootstrap (v5.2.3): util/focustrap.js
14
+ * Bootstrap util/focustrap.js
21
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
22
16
  * --------------------------------------------------------------------------
23
17
  */
18
+
19
+
24
20
  /**
25
21
  * Constants
26
22
  */
@@ -36,75 +32,66 @@
36
32
  const Default = {
37
33
  autofocus: true,
38
34
  trapElement: null // The element to trap focus inside of
39
-
40
35
  };
36
+
41
37
  const DefaultType = {
42
38
  autofocus: 'boolean',
43
39
  trapElement: 'element'
44
40
  };
41
+
45
42
  /**
46
43
  * Class definition
47
44
  */
48
45
 
49
- class FocusTrap extends Config__default.default {
46
+ class FocusTrap extends Config {
50
47
  constructor(config) {
51
48
  super();
52
49
  this._config = this._getConfig(config);
53
50
  this._isActive = false;
54
51
  this._lastTabNavDirection = null;
55
- } // Getters
56
-
52
+ }
57
53
 
54
+ // Getters
58
55
  static get Default() {
59
56
  return Default;
60
57
  }
61
-
62
58
  static get DefaultType() {
63
59
  return DefaultType;
64
60
  }
65
-
66
61
  static get NAME() {
67
62
  return NAME;
68
- } // Public
69
-
63
+ }
70
64
 
65
+ // Public
71
66
  activate() {
72
67
  if (this._isActive) {
73
68
  return;
74
69
  }
75
-
76
70
  if (this._config.autofocus) {
77
71
  this._config.trapElement.focus();
78
72
  }
79
-
80
- EventHandler__default.default.off(document, EVENT_KEY); // guard against infinite focus loop
81
-
82
- EventHandler__default.default.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event));
83
- EventHandler__default.default.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
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));
84
76
  this._isActive = true;
85
77
  }
86
-
87
78
  deactivate() {
88
79
  if (!this._isActive) {
89
80
  return;
90
81
  }
91
-
92
82
  this._isActive = false;
93
- EventHandler__default.default.off(document, EVENT_KEY);
94
- } // Private
95
-
83
+ EventHandler.off(document, EVENT_KEY);
84
+ }
96
85
 
86
+ // Private
97
87
  _handleFocusin(event) {
98
88
  const {
99
89
  trapElement
100
90
  } = this._config;
101
-
102
91
  if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
103
92
  return;
104
93
  }
105
-
106
- const elements = SelectorEngine__default.default.focusableChildren(trapElement);
107
-
94
+ const elements = SelectorEngine.focusableChildren(trapElement);
108
95
  if (elements.length === 0) {
109
96
  trapElement.focus();
110
97
  } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
@@ -113,15 +100,12 @@
113
100
  elements[0].focus();
114
101
  }
115
102
  }
116
-
117
103
  _handleKeydown(event) {
118
104
  if (event.key !== TAB_KEY) {
119
105
  return;
120
106
  }
121
-
122
107
  this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
123
108
  }
124
-
125
109
  }
126
110
 
127
111
  return FocusTrap;