bootstrap 5.2.3 → 5.3.0.alpha3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/javascripts/bootstrap/alert.js +21 -32
  4. data/assets/javascripts/bootstrap/base-component.js +21 -38
  5. data/assets/javascripts/bootstrap/button.js +18 -22
  6. data/assets/javascripts/bootstrap/carousel.js +51 -135
  7. data/assets/javascripts/bootstrap/collapse.js +39 -102
  8. data/assets/javascripts/bootstrap/dom/data.js +8 -12
  9. data/assets/javascripts/bootstrap/dom/event-handler.js +18 -66
  10. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -17
  11. data/assets/javascripts/bootstrap/dom/selector-engine.js +41 -24
  12. data/assets/javascripts/bootstrap/dropdown.js +73 -145
  13. data/assets/javascripts/bootstrap/modal.js +52 -133
  14. data/assets/javascripts/bootstrap/offcanvas.js +49 -102
  15. data/assets/javascripts/bootstrap/popover.js +22 -29
  16. data/assets/javascripts/bootstrap/scrollspy.js +51 -89
  17. data/assets/javascripts/bootstrap/tab.js +51 -109
  18. data/assets/javascripts/bootstrap/toast.js +30 -73
  19. data/assets/javascripts/bootstrap/tooltip.js +74 -177
  20. data/assets/javascripts/bootstrap/util/backdrop.js +27 -54
  21. data/assets/javascripts/bootstrap/util/component-functions.js +13 -19
  22. data/assets/javascripts/bootstrap/util/config.js +14 -27
  23. data/assets/javascripts/bootstrap/util/focustrap.js +19 -36
  24. data/assets/javascripts/bootstrap/util/index.js +42 -111
  25. data/assets/javascripts/bootstrap/util/sanitizer.js +13 -19
  26. data/assets/javascripts/bootstrap/util/scrollbar.js +23 -50
  27. data/assets/javascripts/bootstrap/util/swipe.js +26 -48
  28. data/assets/javascripts/bootstrap/util/template-factory.js +24 -52
  29. data/assets/javascripts/bootstrap-sprockets.js +1 -1
  30. data/assets/javascripts/bootstrap.js +626 -1406
  31. data/assets/javascripts/bootstrap.min.js +3 -3
  32. data/assets/stylesheets/_bootstrap-grid.scss +1 -3
  33. data/assets/stylesheets/_bootstrap-reboot.scss +1 -0
  34. data/assets/stylesheets/_bootstrap.scss +1 -0
  35. data/assets/stylesheets/bootstrap/_accordion.scss +9 -0
  36. data/assets/stylesheets/bootstrap/_alert.scss +8 -11
  37. data/assets/stylesheets/bootstrap/_button-group.scss +2 -2
  38. data/assets/stylesheets/bootstrap/_buttons.scss +3 -3
  39. data/assets/stylesheets/bootstrap/_card.scss +5 -0
  40. data/assets/stylesheets/bootstrap/_carousel.scss +20 -2
  41. data/assets/stylesheets/bootstrap/_close.scss +32 -9
  42. data/assets/stylesheets/bootstrap/_dropdown.scss +1 -0
  43. data/assets/stylesheets/bootstrap/_functions.scss +1 -1
  44. data/assets/stylesheets/bootstrap/_grid.scss +6 -0
  45. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  46. data/assets/stylesheets/bootstrap/_list-group.scss +12 -7
  47. data/assets/stylesheets/bootstrap/_maps.scss +120 -0
  48. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  49. data/assets/stylesheets/bootstrap/_nav.scss +40 -3
  50. data/assets/stylesheets/bootstrap/_navbar.scss +13 -3
  51. data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -2
  52. data/assets/stylesheets/bootstrap/_pagination.scss +1 -1
  53. data/assets/stylesheets/bootstrap/_progress.scss +10 -1
  54. data/assets/stylesheets/bootstrap/_reboot.scss +3 -3
  55. data/assets/stylesheets/bootstrap/_root.scss +125 -10
  56. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  57. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -5
  58. data/assets/stylesheets/bootstrap/_utilities.scss +172 -13
  59. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  60. data/assets/stylesheets/bootstrap/_variables.scss +260 -151
  61. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -0
  62. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +21 -3
  63. data/assets/stylesheets/bootstrap/forms/_form-check.scss +24 -11
  64. data/assets/stylesheets/bootstrap/forms/_form-control.scss +23 -3
  65. data/assets/stylesheets/bootstrap/forms/_form-select.scss +11 -2
  66. data/assets/stylesheets/bootstrap/forms/_input-group.scss +1 -1
  67. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +22 -2
  68. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  69. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  70. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -1
  71. data/assets/stylesheets/bootstrap/mixins/_banner.scss +2 -4
  72. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  73. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  74. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -7
  75. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  76. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +1 -1
  77. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +5 -1
  78. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  79. data/bootstrap.gemspec +1 -1
  80. data/lib/bootstrap/version.rb +2 -2
  81. data/tasks/updater/js.rb +1 -1
  82. data/tasks/updater/scss.rb +1 -1
  83. metadata +10 -6
@@ -1,18 +1,15 @@
1
1
  /*!
2
- * Bootstrap dropdown.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap dropdown.js v5.3.0-alpha3 (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('@popperjs/core'), require('./util/index'), require('./dom/event-handler'), require('./dom/manipulator'), require('./dom/selector-engine'), require('./base-component')) :
8
- typeof define === 'function' && define.amd ? define(['@popperjs/core', './util/index', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global["@popperjs/core"], global.Index, global.EventHandler, global.Manipulator, global.SelectorEngine, global.BaseComponent));
10
- })(this, (function (Popper, index, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./util/index.js')) :
8
+ typeof define === 'function' && define.amd ? define(['@popperjs/core', './base-component', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './util/index'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global["@popperjs/core"], global.BaseComponent, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Index));
10
+ })(this, (function (Popper, BaseComponent, EventHandler, Manipulator, SelectorEngine, index_js) { 'use strict';
11
11
 
12
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
13
-
14
- function _interopNamespace(e) {
15
- if (e && e.__esModule) return e;
12
+ function _interopNamespaceDefault(e) {
16
13
  const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
17
14
  if (e) {
18
15
  for (const k in e) {
@@ -29,18 +26,15 @@
29
26
  return Object.freeze(n);
30
27
  }
31
28
 
32
- const Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
33
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
34
- const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
35
- const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
36
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
29
+ const Popper__namespace = /*#__PURE__*/_interopNamespaceDefault(Popper);
37
30
 
38
31
  /**
39
32
  * --------------------------------------------------------------------------
40
- * Bootstrap (v5.2.3): dropdown.js
33
+ * Bootstrap dropdown.js
41
34
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
42
35
  * --------------------------------------------------------------------------
43
36
  */
37
+
44
38
  /**
45
39
  * Constants
46
40
  */
@@ -74,12 +68,12 @@
74
68
  const SELECTOR_NAVBAR = '.navbar';
75
69
  const SELECTOR_NAVBAR_NAV = '.navbar-nav';
76
70
  const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
77
- const PLACEMENT_TOP = index.isRTL() ? 'top-end' : 'top-start';
78
- const PLACEMENT_TOPEND = index.isRTL() ? 'top-start' : 'top-end';
79
- const PLACEMENT_BOTTOM = index.isRTL() ? 'bottom-end' : 'bottom-start';
80
- const PLACEMENT_BOTTOMEND = index.isRTL() ? 'bottom-start' : 'bottom-end';
81
- const PLACEMENT_RIGHT = index.isRTL() ? 'left-start' : 'right-start';
82
- const PLACEMENT_LEFT = index.isRTL() ? 'right-start' : 'left-start';
71
+ const PLACEMENT_TOP = index_js.isRTL() ? 'top-end' : 'top-start';
72
+ const PLACEMENT_TOPEND = index_js.isRTL() ? 'top-start' : 'top-end';
73
+ const PLACEMENT_BOTTOM = index_js.isRTL() ? 'bottom-end' : 'bottom-start';
74
+ const PLACEMENT_BOTTOMEND = index_js.isRTL() ? 'bottom-start' : 'bottom-end';
75
+ const PLACEMENT_RIGHT = index_js.isRTL() ? 'left-start' : 'right-start';
76
+ const PLACEMENT_LEFT = index_js.isRTL() ? 'right-start' : 'left-start';
83
77
  const PLACEMENT_TOPCENTER = 'top';
84
78
  const PLACEMENT_BOTTOMCENTER = 'bottom';
85
79
  const Default = {
@@ -98,218 +92,172 @@
98
92
  popperConfig: '(null|object|function)',
99
93
  reference: '(string|element|object)'
100
94
  };
95
+
101
96
  /**
102
97
  * Class definition
103
98
  */
104
99
 
105
- class Dropdown extends BaseComponent__default.default {
100
+ class Dropdown extends BaseComponent {
106
101
  constructor(element, config) {
107
102
  super(element, config);
108
103
  this._popper = null;
109
104
  this._parent = this._element.parentNode; // dropdown wrapper
110
- // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
111
-
112
- this._menu = SelectorEngine__default.default.next(this._element, SELECTOR_MENU)[0] || SelectorEngine__default.default.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine__default.default.findOne(SELECTOR_MENU, this._parent);
105
+ // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
106
+ this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent);
113
107
  this._inNavbar = this._detectNavbar();
114
- } // Getters
115
-
108
+ }
116
109
 
110
+ // Getters
117
111
  static get Default() {
118
112
  return Default;
119
113
  }
120
-
121
114
  static get DefaultType() {
122
115
  return DefaultType;
123
116
  }
124
-
125
117
  static get NAME() {
126
118
  return NAME;
127
- } // Public
128
-
119
+ }
129
120
 
121
+ // Public
130
122
  toggle() {
131
123
  return this._isShown() ? this.hide() : this.show();
132
124
  }
133
-
134
125
  show() {
135
- if (index.isDisabled(this._element) || this._isShown()) {
126
+ if (index_js.isDisabled(this._element) || this._isShown()) {
136
127
  return;
137
128
  }
138
-
139
129
  const relatedTarget = {
140
130
  relatedTarget: this._element
141
131
  };
142
- const showEvent = EventHandler__default.default.trigger(this._element, EVENT_SHOW, relatedTarget);
143
-
132
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget);
144
133
  if (showEvent.defaultPrevented) {
145
134
  return;
146
135
  }
136
+ this._createPopper();
147
137
 
148
- this._createPopper(); // If this is a touch-enabled device we add extra
138
+ // If this is a touch-enabled device we add extra
149
139
  // empty mouseover listeners to the body's immediate children;
150
140
  // only needed because of broken event delegation on iOS
151
141
  // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
152
-
153
-
154
142
  if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
155
143
  for (const element of [].concat(...document.body.children)) {
156
- EventHandler__default.default.on(element, 'mouseover', index.noop);
144
+ EventHandler.on(element, 'mouseover', index_js.noop);
157
145
  }
158
146
  }
159
-
160
147
  this._element.focus();
161
-
162
148
  this._element.setAttribute('aria-expanded', true);
163
-
164
149
  this._menu.classList.add(CLASS_NAME_SHOW);
165
-
166
150
  this._element.classList.add(CLASS_NAME_SHOW);
167
-
168
- EventHandler__default.default.trigger(this._element, EVENT_SHOWN, relatedTarget);
151
+ EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget);
169
152
  }
170
-
171
153
  hide() {
172
- if (index.isDisabled(this._element) || !this._isShown()) {
154
+ if (index_js.isDisabled(this._element) || !this._isShown()) {
173
155
  return;
174
156
  }
175
-
176
157
  const relatedTarget = {
177
158
  relatedTarget: this._element
178
159
  };
179
-
180
160
  this._completeHide(relatedTarget);
181
161
  }
182
-
183
162
  dispose() {
184
163
  if (this._popper) {
185
164
  this._popper.destroy();
186
165
  }
187
-
188
166
  super.dispose();
189
167
  }
190
-
191
168
  update() {
192
169
  this._inNavbar = this._detectNavbar();
193
-
194
170
  if (this._popper) {
195
171
  this._popper.update();
196
172
  }
197
- } // Private
198
-
173
+ }
199
174
 
175
+ // Private
200
176
  _completeHide(relatedTarget) {
201
- const hideEvent = EventHandler__default.default.trigger(this._element, EVENT_HIDE, relatedTarget);
202
-
177
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget);
203
178
  if (hideEvent.defaultPrevented) {
204
179
  return;
205
- } // If this is a touch-enabled device we remove the extra
206
- // empty mouseover listeners we added for iOS support
207
-
180
+ }
208
181
 
182
+ // If this is a touch-enabled device we remove the extra
183
+ // empty mouseover listeners we added for iOS support
209
184
  if ('ontouchstart' in document.documentElement) {
210
185
  for (const element of [].concat(...document.body.children)) {
211
- EventHandler__default.default.off(element, 'mouseover', index.noop);
186
+ EventHandler.off(element, 'mouseover', index_js.noop);
212
187
  }
213
188
  }
214
-
215
189
  if (this._popper) {
216
190
  this._popper.destroy();
217
191
  }
218
-
219
192
  this._menu.classList.remove(CLASS_NAME_SHOW);
220
-
221
193
  this._element.classList.remove(CLASS_NAME_SHOW);
222
-
223
194
  this._element.setAttribute('aria-expanded', 'false');
224
-
225
- Manipulator__default.default.removeDataAttribute(this._menu, 'popper');
226
- EventHandler__default.default.trigger(this._element, EVENT_HIDDEN, relatedTarget);
195
+ Manipulator.removeDataAttribute(this._menu, 'popper');
196
+ EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget);
227
197
  }
228
-
229
198
  _getConfig(config) {
230
199
  config = super._getConfig(config);
231
-
232
- if (typeof config.reference === 'object' && !index.isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
200
+ if (typeof config.reference === 'object' && !index_js.isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
233
201
  // Popper virtual elements require a getBoundingClientRect method
234
202
  throw new TypeError(`${NAME.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
235
203
  }
236
-
237
204
  return config;
238
205
  }
239
-
240
206
  _createPopper() {
241
207
  if (typeof Popper__namespace === 'undefined') {
242
208
  throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
243
209
  }
244
-
245
210
  let referenceElement = this._element;
246
-
247
211
  if (this._config.reference === 'parent') {
248
212
  referenceElement = this._parent;
249
- } else if (index.isElement(this._config.reference)) {
250
- referenceElement = index.getElement(this._config.reference);
213
+ } else if (index_js.isElement(this._config.reference)) {
214
+ referenceElement = index_js.getElement(this._config.reference);
251
215
  } else if (typeof this._config.reference === 'object') {
252
216
  referenceElement = this._config.reference;
253
217
  }
254
-
255
218
  const popperConfig = this._getPopperConfig();
256
-
257
219
  this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
258
220
  }
259
-
260
221
  _isShown() {
261
222
  return this._menu.classList.contains(CLASS_NAME_SHOW);
262
223
  }
263
-
264
224
  _getPlacement() {
265
225
  const parentDropdown = this._parent;
266
-
267
226
  if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
268
227
  return PLACEMENT_RIGHT;
269
228
  }
270
-
271
229
  if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
272
230
  return PLACEMENT_LEFT;
273
231
  }
274
-
275
232
  if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
276
233
  return PLACEMENT_TOPCENTER;
277
234
  }
278
-
279
235
  if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
280
236
  return PLACEMENT_BOTTOMCENTER;
281
- } // We need to trim the value because custom properties can also include spaces
282
-
237
+ }
283
238
 
239
+ // We need to trim the value because custom properties can also include spaces
284
240
  const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
285
-
286
241
  if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
287
242
  return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
288
243
  }
289
-
290
244
  return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
291
245
  }
292
-
293
246
  _detectNavbar() {
294
247
  return this._element.closest(SELECTOR_NAVBAR) !== null;
295
248
  }
296
-
297
249
  _getOffset() {
298
250
  const {
299
251
  offset
300
252
  } = this._config;
301
-
302
253
  if (typeof offset === 'string') {
303
254
  return offset.split(',').map(value => Number.parseInt(value, 10));
304
255
  }
305
-
306
256
  if (typeof offset === 'function') {
307
257
  return popperData => offset(popperData, this._element);
308
258
  }
309
-
310
259
  return offset;
311
260
  }
312
-
313
261
  _getPopperConfig() {
314
262
  const defaultBsPopperConfig = {
315
263
  placement: this._getPlacement(),
@@ -324,121 +272,101 @@
324
272
  offset: this._getOffset()
325
273
  }
326
274
  }]
327
- }; // Disable Popper if we have a static display or Dropdown is in Navbar
275
+ };
328
276
 
277
+ // Disable Popper if we have a static display or Dropdown is in Navbar
329
278
  if (this._inNavbar || this._config.display === 'static') {
330
- Manipulator__default.default.setDataAttribute(this._menu, 'popper', 'static'); // todo:v6 remove
331
-
279
+ Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // TODO: v6 remove
332
280
  defaultBsPopperConfig.modifiers = [{
333
281
  name: 'applyStyles',
334
282
  enabled: false
335
283
  }];
336
284
  }
337
-
338
- return { ...defaultBsPopperConfig,
339
- ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
285
+ return {
286
+ ...defaultBsPopperConfig,
287
+ ...index_js.execute(this._config.popperConfig, [defaultBsPopperConfig])
340
288
  };
341
289
  }
342
-
343
290
  _selectMenuItem({
344
291
  key,
345
292
  target
346
293
  }) {
347
- const items = SelectorEngine__default.default.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => index.isVisible(element));
348
-
294
+ const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => index_js.isVisible(element));
349
295
  if (!items.length) {
350
296
  return;
351
- } // if target isn't included in items (e.g. when expanding the dropdown)
352
- // allow cycling to get the last item in case key equals ARROW_UP_KEY
353
-
354
-
355
- index.getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
356
- } // Static
297
+ }
357
298
 
299
+ // if target isn't included in items (e.g. when expanding the dropdown)
300
+ // allow cycling to get the last item in case key equals ARROW_UP_KEY
301
+ index_js.getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
302
+ }
358
303
 
304
+ // Static
359
305
  static jQueryInterface(config) {
360
306
  return this.each(function () {
361
307
  const data = Dropdown.getOrCreateInstance(this, config);
362
-
363
308
  if (typeof config !== 'string') {
364
309
  return;
365
310
  }
366
-
367
311
  if (typeof data[config] === 'undefined') {
368
312
  throw new TypeError(`No method named "${config}"`);
369
313
  }
370
-
371
314
  data[config]();
372
315
  });
373
316
  }
374
-
375
317
  static clearMenus(event) {
376
318
  if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY) {
377
319
  return;
378
320
  }
379
-
380
- const openToggles = SelectorEngine__default.default.find(SELECTOR_DATA_TOGGLE_SHOWN);
381
-
321
+ const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);
382
322
  for (const toggle of openToggles) {
383
323
  const context = Dropdown.getInstance(toggle);
384
-
385
324
  if (!context || context._config.autoClose === false) {
386
325
  continue;
387
326
  }
388
-
389
327
  const composedPath = event.composedPath();
390
328
  const isMenuTarget = composedPath.includes(context._menu);
391
-
392
329
  if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
393
330
  continue;
394
- } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
395
-
331
+ }
396
332
 
333
+ // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
397
334
  if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
398
335
  continue;
399
336
  }
400
-
401
337
  const relatedTarget = {
402
338
  relatedTarget: context._element
403
339
  };
404
-
405
340
  if (event.type === 'click') {
406
341
  relatedTarget.clickEvent = event;
407
342
  }
408
-
409
343
  context._completeHide(relatedTarget);
410
344
  }
411
345
  }
412
-
413
346
  static dataApiKeydownHandler(event) {
414
347
  // If not an UP | DOWN | ESCAPE key => not a dropdown command
415
348
  // If input/textarea && if key is other than ESCAPE => not a dropdown command
349
+
416
350
  const isInput = /input|textarea/i.test(event.target.tagName);
417
351
  const isEscapeEvent = event.key === ESCAPE_KEY;
418
352
  const isUpOrDownEvent = [ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key);
419
-
420
353
  if (!isUpOrDownEvent && !isEscapeEvent) {
421
354
  return;
422
355
  }
423
-
424
356
  if (isInput && !isEscapeEvent) {
425
357
  return;
426
358
  }
359
+ event.preventDefault();
427
360
 
428
- event.preventDefault(); // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
429
-
430
- const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default.default.prev(this, SELECTOR_DATA_TOGGLE)[0] || SelectorEngine__default.default.next(this, SELECTOR_DATA_TOGGLE)[0] || SelectorEngine__default.default.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode);
361
+ // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
362
+ const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode);
431
363
  const instance = Dropdown.getOrCreateInstance(getToggleButton);
432
-
433
364
  if (isUpOrDownEvent) {
434
365
  event.stopPropagation();
435
366
  instance.show();
436
-
437
367
  instance._selectMenuItem(event);
438
-
439
368
  return;
440
369
  }
441
-
442
370
  if (instance._isShown()) {
443
371
  // else is escape and we check if it is shown
444
372
  event.stopPropagation();
@@ -446,26 +374,26 @@
446
374
  getToggleButton.focus();
447
375
  }
448
376
  }
449
-
450
377
  }
378
+
451
379
  /**
452
380
  * Data API implementation
453
381
  */
454
382
 
455
-
456
- EventHandler__default.default.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler);
457
- EventHandler__default.default.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
458
- EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
459
- EventHandler__default.default.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
460
- EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
383
+ EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler);
384
+ EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
385
+ EventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus);
386
+ EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
387
+ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
461
388
  event.preventDefault();
462
389
  Dropdown.getOrCreateInstance(this).toggle();
463
390
  });
391
+
464
392
  /**
465
393
  * jQuery
466
394
  */
467
395
 
468
- index.defineJQueryPlugin(Dropdown);
396
+ index_js.defineJQueryPlugin(Dropdown);
469
397
 
470
398
  return Dropdown;
471
399