bootstrap 5.0.0 → 5.1.1

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/assets/javascripts/bootstrap/alert.js +77 -106
  4. data/assets/javascripts/bootstrap/base-component.js +126 -7
  5. data/assets/javascripts/bootstrap/button.js +24 -24
  6. data/assets/javascripts/bootstrap/carousel.js +115 -128
  7. data/assets/javascripts/bootstrap/collapse.js +119 -176
  8. data/assets/javascripts/bootstrap/dom/data.js +2 -2
  9. data/assets/javascripts/bootstrap/dom/event-handler.js +3 -4
  10. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -4
  11. data/assets/javascripts/bootstrap/dom/selector-engine.js +47 -5
  12. data/assets/javascripts/bootstrap/dropdown.js +142 -130
  13. data/assets/javascripts/bootstrap/modal.js +376 -171
  14. data/assets/javascripts/bootstrap/offcanvas.js +328 -133
  15. data/assets/javascripts/bootstrap/popover.js +27 -59
  16. data/assets/javascripts/bootstrap/scrollspy.js +51 -56
  17. data/assets/javascripts/bootstrap/tab.js +39 -66
  18. data/assets/javascripts/bootstrap/toast.js +175 -86
  19. data/assets/javascripts/bootstrap/tooltip.js +141 -185
  20. data/assets/javascripts/bootstrap-sprockets.js +6 -6
  21. data/assets/javascripts/bootstrap.js +1031 -1026
  22. data/assets/javascripts/bootstrap.min.js +2 -2
  23. data/assets/stylesheets/_bootstrap-grid.scss +3 -1
  24. data/assets/stylesheets/_bootstrap-reboot.scss +2 -4
  25. data/assets/stylesheets/_bootstrap.scss +2 -1
  26. data/assets/stylesheets/bootstrap/_card.scss +7 -6
  27. data/assets/stylesheets/bootstrap/_carousel.scss +2 -2
  28. data/assets/stylesheets/bootstrap/_dropdown.scss +4 -4
  29. data/assets/stylesheets/bootstrap/_functions.scss +100 -3
  30. data/assets/stylesheets/bootstrap/_grid.scss +11 -0
  31. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  32. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  33. data/assets/stylesheets/bootstrap/_list-group.scss +5 -5
  34. data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
  35. data/assets/stylesheets/bootstrap/_modal.scss +7 -26
  36. data/assets/stylesheets/bootstrap/_navbar.scss +30 -1
  37. data/assets/stylesheets/bootstrap/_offcanvas.scss +8 -2
  38. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  39. data/assets/stylesheets/bootstrap/_popover.scss +10 -10
  40. data/assets/stylesheets/bootstrap/_reboot.scss +12 -8
  41. data/assets/stylesheets/bootstrap/_root.scss +40 -2
  42. data/assets/stylesheets/bootstrap/_tables.scss +1 -0
  43. data/assets/stylesheets/bootstrap/_toasts.scss +3 -3
  44. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
  45. data/assets/stylesheets/bootstrap/_transitions.scss +6 -0
  46. data/assets/stylesheets/bootstrap/_utilities.scss +44 -8
  47. data/assets/stylesheets/bootstrap/_variables.scss +200 -25
  48. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
  49. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
  50. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
  51. data/assets/stylesheets/bootstrap/forms/_form-control.scss +6 -6
  52. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  53. data/assets/stylesheets/bootstrap/forms/_form-select.scss +3 -0
  54. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  55. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  56. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  57. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +1 -1
  58. data/assets/stylesheets/bootstrap/mixins/_forms.scss +8 -1
  59. data/assets/stylesheets/bootstrap/mixins/_grid.scss +33 -8
  60. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +27 -6
  61. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
  62. data/bootstrap.gemspec +3 -3
  63. data/lib/bootstrap/version.rb +2 -2
  64. data/tasks/updater/js.rb +6 -2
  65. metadata +12 -8
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap collapse.js v5.0.0 (https://getbootstrap.com/)
2
+ * Bootstrap collapse.js v5.1.1 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -19,12 +19,10 @@
19
19
 
20
20
  /**
21
21
  * --------------------------------------------------------------------------
22
- * Bootstrap (v5.0.0): util/index.js
22
+ * Bootstrap (v5.1.1): util/index.js
23
23
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
24
24
  * --------------------------------------------------------------------------
25
25
  */
26
- const MILLISECONDS_MULTIPLIER = 1000;
27
- const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
28
26
 
29
27
  const toType = obj => {
30
28
  if (obj === null || obj === undefined) {
@@ -73,51 +71,29 @@
73
71
  return selector ? document.querySelector(selector) : null;
74
72
  };
75
73
 
76
- const getTransitionDurationFromElement = element => {
77
- if (!element) {
78
- return 0;
79
- } // Get transition-duration of the element
80
-
81
-
82
- let {
83
- transitionDuration,
84
- transitionDelay
85
- } = window.getComputedStyle(element);
86
- const floatTransitionDuration = Number.parseFloat(transitionDuration);
87
- const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
88
-
89
- if (!floatTransitionDuration && !floatTransitionDelay) {
90
- return 0;
91
- } // If multiple durations are defined, take the first
92
-
74
+ const isElement = obj => {
75
+ if (!obj || typeof obj !== 'object') {
76
+ return false;
77
+ }
93
78
 
94
- transitionDuration = transitionDuration.split(',')[0];
95
- transitionDelay = transitionDelay.split(',')[0];
96
- return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
97
- };
79
+ if (typeof obj.jquery !== 'undefined') {
80
+ obj = obj[0];
81
+ }
98
82
 
99
- const triggerTransitionEnd = element => {
100
- element.dispatchEvent(new Event(TRANSITION_END));
83
+ return typeof obj.nodeType !== 'undefined';
101
84
  };
102
85
 
103
- const isElement = obj => (obj[0] || obj).nodeType;
104
-
105
- const emulateTransitionEnd = (element, duration) => {
106
- let called = false;
107
- const durationPadding = 5;
108
- const emulatedDuration = duration + durationPadding;
86
+ const getElement = obj => {
87
+ if (isElement(obj)) {
88
+ // it's a jQuery object or a node element
89
+ return obj.jquery ? obj[0] : obj;
90
+ }
109
91
 
110
- function listener() {
111
- called = true;
112
- element.removeEventListener(TRANSITION_END, listener);
92
+ if (typeof obj === 'string' && obj.length > 0) {
93
+ return document.querySelector(obj);
113
94
  }
114
95
 
115
- element.addEventListener(TRANSITION_END, listener);
116
- setTimeout(() => {
117
- if (!called) {
118
- triggerTransitionEnd(element);
119
- }
120
- }, emulatedDuration);
96
+ return null;
121
97
  };
122
98
 
123
99
  const typeCheckConfig = (componentName, config, configTypes) => {
@@ -131,8 +107,20 @@
131
107
  }
132
108
  });
133
109
  };
110
+ /**
111
+ * Trick to restart an element's animation
112
+ *
113
+ * @param {HTMLElement} element
114
+ * @return void
115
+ *
116
+ * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
117
+ */
118
+
134
119
 
135
- const reflow = element => element.offsetHeight;
120
+ const reflow = element => {
121
+ // eslint-disable-next-line no-unused-expressions
122
+ element.offsetHeight;
123
+ };
136
124
 
137
125
  const getjQuery = () => {
138
126
  const {
@@ -146,20 +134,30 @@
146
134
  return null;
147
135
  };
148
136
 
137
+ const DOMContentLoadedCallbacks = [];
138
+
149
139
  const onDOMContentLoaded = callback => {
150
140
  if (document.readyState === 'loading') {
151
- document.addEventListener('DOMContentLoaded', callback);
141
+ // add listener on the first call when the document is in loading state
142
+ if (!DOMContentLoadedCallbacks.length) {
143
+ document.addEventListener('DOMContentLoaded', () => {
144
+ DOMContentLoadedCallbacks.forEach(callback => callback());
145
+ });
146
+ }
147
+
148
+ DOMContentLoadedCallbacks.push(callback);
152
149
  } else {
153
150
  callback();
154
151
  }
155
152
  };
156
153
 
157
- const defineJQueryPlugin = (name, plugin) => {
154
+ const defineJQueryPlugin = plugin => {
158
155
  onDOMContentLoaded(() => {
159
156
  const $ = getjQuery();
160
157
  /* istanbul ignore if */
161
158
 
162
159
  if ($) {
160
+ const name = plugin.NAME;
163
161
  const JQUERY_NO_CONFLICT = $.fn[name];
164
162
  $.fn[name] = plugin.jQueryInterface;
165
163
  $.fn[name].Constructor = plugin;
@@ -174,7 +172,7 @@
174
172
 
175
173
  /**
176
174
  * --------------------------------------------------------------------------
177
- * Bootstrap (v5.0.0): collapse.js
175
+ * Bootstrap (v5.1.1): collapse.js
178
176
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
179
177
  * --------------------------------------------------------------------------
180
178
  */
@@ -190,11 +188,11 @@
190
188
  const DATA_API_KEY = '.data-api';
191
189
  const Default = {
192
190
  toggle: true,
193
- parent: ''
191
+ parent: null
194
192
  };
195
193
  const DefaultType = {
196
194
  toggle: 'boolean',
197
- parent: '(string|element)'
195
+ parent: '(null|element)'
198
196
  };
199
197
  const EVENT_SHOW = `show${EVENT_KEY}`;
200
198
  const EVENT_SHOWN = `shown${EVENT_KEY}`;
@@ -205,9 +203,10 @@
205
203
  const CLASS_NAME_COLLAPSE = 'collapse';
206
204
  const CLASS_NAME_COLLAPSING = 'collapsing';
207
205
  const CLASS_NAME_COLLAPSED = 'collapsed';
206
+ const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
208
207
  const WIDTH = 'width';
209
208
  const HEIGHT = 'height';
210
- const SELECTOR_ACTIVES = '.show, .collapsing';
209
+ const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
211
210
  const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
212
211
  /**
213
212
  * ------------------------------------------------------------------------
@@ -220,7 +219,7 @@
220
219
  super(element);
221
220
  this._isTransitioning = false;
222
221
  this._config = this._getConfig(config);
223
- this._triggerArray = SelectorEngine__default['default'].find(`${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`);
222
+ this._triggerArray = [];
224
223
  const toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
225
224
 
226
225
  for (let i = 0, len = toggleList.length; i < len; i++) {
@@ -235,10 +234,10 @@
235
234
  }
236
235
  }
237
236
 
238
- this._parent = this._config.parent ? this._getParent() : null;
237
+ this._initializeChildren();
239
238
 
240
239
  if (!this._config.parent) {
241
- this._addAriaAndCollapsedClass(this._element, this._triggerArray);
240
+ this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
242
241
  }
243
242
 
244
243
  if (this._config.toggle) {
@@ -251,13 +250,13 @@
251
250
  return Default;
252
251
  }
253
252
 
254
- static get DATA_KEY() {
255
- return DATA_KEY;
253
+ static get NAME() {
254
+ return NAME;
256
255
  } // Public
257
256
 
258
257
 
259
258
  toggle() {
260
- if (this._element.classList.contains(CLASS_NAME_SHOW)) {
259
+ if (this._isShown()) {
261
260
  this.hide();
262
261
  } else {
263
262
  this.show();
@@ -265,32 +264,23 @@
265
264
  }
266
265
 
267
266
  show() {
268
- if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
267
+ if (this._isTransitioning || this._isShown()) {
269
268
  return;
270
269
  }
271
270
 
272
- let actives;
271
+ let actives = [];
273
272
  let activesData;
274
273
 
275
- if (this._parent) {
276
- actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(elem => {
277
- if (typeof this._config.parent === 'string') {
278
- return elem.getAttribute('data-bs-parent') === this._config.parent;
279
- }
280
-
281
- return elem.classList.contains(CLASS_NAME_COLLAPSE);
282
- });
283
-
284
- if (actives.length === 0) {
285
- actives = null;
286
- }
274
+ if (this._config.parent) {
275
+ const children = SelectorEngine__default['default'].find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
276
+ actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
287
277
  }
288
278
 
289
279
  const container = SelectorEngine__default['default'].findOne(this._selector);
290
280
 
291
- if (actives) {
281
+ if (actives.length) {
292
282
  const tempActiveData = actives.find(elem => container !== elem);
293
- activesData = tempActiveData ? Data__default['default'].get(tempActiveData, DATA_KEY) : null;
283
+ activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
294
284
 
295
285
  if (activesData && activesData._isTransitioning) {
296
286
  return;
@@ -303,17 +293,17 @@
303
293
  return;
304
294
  }
305
295
 
306
- if (actives) {
307
- actives.forEach(elemActive => {
308
- if (container !== elemActive) {
309
- Collapse.collapseInterface(elemActive, 'hide');
310
- }
296
+ actives.forEach(elemActive => {
297
+ if (container !== elemActive) {
298
+ Collapse.getOrCreateInstance(elemActive, {
299
+ toggle: false
300
+ }).hide();
301
+ }
311
302
 
312
- if (!activesData) {
313
- Data__default['default'].set(elemActive, DATA_KEY, null);
314
- }
315
- });
316
- }
303
+ if (!activesData) {
304
+ Data__default['default'].set(elemActive, DATA_KEY, null);
305
+ }
306
+ });
317
307
 
318
308
  const dimension = this._getDimension();
319
309
 
@@ -323,35 +313,31 @@
323
313
 
324
314
  this._element.style[dimension] = 0;
325
315
 
326
- if (this._triggerArray.length) {
327
- this._triggerArray.forEach(element => {
328
- element.classList.remove(CLASS_NAME_COLLAPSED);
329
- element.setAttribute('aria-expanded', true);
330
- });
331
- }
316
+ this._addAriaAndCollapsedClass(this._triggerArray, true);
332
317
 
333
- this.setTransitioning(true);
318
+ this._isTransitioning = true;
334
319
 
335
320
  const complete = () => {
321
+ this._isTransitioning = false;
322
+
336
323
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
337
324
 
338
325
  this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
339
326
 
340
327
  this._element.style[dimension] = '';
341
- this.setTransitioning(false);
342
328
  EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
343
329
  };
344
330
 
345
331
  const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
346
332
  const scrollSize = `scroll${capitalizedDimension}`;
347
- const transitionDuration = getTransitionDurationFromElement(this._element);
348
- EventHandler__default['default'].one(this._element, 'transitionend', complete);
349
- emulateTransitionEnd(this._element, transitionDuration);
333
+
334
+ this._queueCallback(complete, this._element, true);
335
+
350
336
  this._element.style[dimension] = `${this._element[scrollSize]}px`;
351
337
  }
352
338
 
353
339
  hide() {
354
- if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
340
+ if (this._isTransitioning || !this._isShown()) {
355
341
  return;
356
342
  }
357
343
 
@@ -372,22 +358,19 @@
372
358
 
373
359
  const triggerArrayLength = this._triggerArray.length;
374
360
 
375
- if (triggerArrayLength > 0) {
376
- for (let i = 0; i < triggerArrayLength; i++) {
377
- const trigger = this._triggerArray[i];
378
- const elem = getElementFromSelector(trigger);
361
+ for (let i = 0; i < triggerArrayLength; i++) {
362
+ const trigger = this._triggerArray[i];
363
+ const elem = getElementFromSelector(trigger);
379
364
 
380
- if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
381
- trigger.classList.add(CLASS_NAME_COLLAPSED);
382
- trigger.setAttribute('aria-expanded', false);
383
- }
365
+ if (elem && !this._isShown(elem)) {
366
+ this._addAriaAndCollapsedClass([trigger], false);
384
367
  }
385
368
  }
386
369
 
387
- this.setTransitioning(true);
370
+ this._isTransitioning = true;
388
371
 
389
372
  const complete = () => {
390
- this.setTransitioning(false);
373
+ this._isTransitioning = false;
391
374
 
392
375
  this._element.classList.remove(CLASS_NAME_COLLAPSING);
393
376
 
@@ -397,67 +380,51 @@
397
380
  };
398
381
 
399
382
  this._element.style[dimension] = '';
400
- const transitionDuration = getTransitionDurationFromElement(this._element);
401
- EventHandler__default['default'].one(this._element, 'transitionend', complete);
402
- emulateTransitionEnd(this._element, transitionDuration);
403
- }
404
383
 
405
- setTransitioning(isTransitioning) {
406
- this._isTransitioning = isTransitioning;
384
+ this._queueCallback(complete, this._element, true);
407
385
  }
408
386
 
409
- dispose() {
410
- super.dispose();
411
- this._config = null;
412
- this._parent = null;
413
- this._triggerArray = null;
414
- this._isTransitioning = null;
387
+ _isShown(element = this._element) {
388
+ return element.classList.contains(CLASS_NAME_SHOW);
415
389
  } // Private
416
390
 
417
391
 
418
392
  _getConfig(config) {
419
393
  config = { ...Default,
394
+ ...Manipulator__default['default'].getDataAttributes(this._element),
420
395
  ...config
421
396
  };
422
397
  config.toggle = Boolean(config.toggle); // Coerce string values
423
398
 
399
+ config.parent = getElement(config.parent);
424
400
  typeCheckConfig(NAME, config, DefaultType);
425
401
  return config;
426
402
  }
427
403
 
428
404
  _getDimension() {
429
- return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
405
+ return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
430
406
  }
431
407
 
432
- _getParent() {
433
- let {
434
- parent
435
- } = this._config;
436
-
437
- if (isElement(parent)) {
438
- // it's a jQuery object
439
- if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
440
- parent = parent[0];
441
- }
442
- } else {
443
- parent = SelectorEngine__default['default'].findOne(parent);
408
+ _initializeChildren() {
409
+ if (!this._config.parent) {
410
+ return;
444
411
  }
445
412
 
446
- const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
447
- SelectorEngine__default['default'].find(selector, parent).forEach(element => {
413
+ const children = SelectorEngine__default['default'].find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
414
+ SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
448
415
  const selected = getElementFromSelector(element);
449
416
 
450
- this._addAriaAndCollapsedClass(selected, [element]);
417
+ if (selected) {
418
+ this._addAriaAndCollapsedClass([element], this._isShown(selected));
419
+ }
451
420
  });
452
- return parent;
453
421
  }
454
422
 
455
- _addAriaAndCollapsedClass(element, triggerArray) {
456
- if (!element || !triggerArray.length) {
423
+ _addAriaAndCollapsedClass(triggerArray, isOpen) {
424
+ if (!triggerArray.length) {
457
425
  return;
458
426
  }
459
427
 
460
- const isOpen = element.classList.contains(CLASS_NAME_SHOW);
461
428
  triggerArray.forEach(elem => {
462
429
  if (isOpen) {
463
430
  elem.classList.remove(CLASS_NAME_COLLAPSED);
@@ -470,33 +437,23 @@
470
437
  } // Static
471
438
 
472
439
 
473
- static collapseInterface(element, config) {
474
- let data = Data__default['default'].get(element, DATA_KEY);
475
- const _config = { ...Default,
476
- ...Manipulator__default['default'].getDataAttributes(element),
477
- ...(typeof config === 'object' && config ? config : {})
478
- };
479
-
480
- if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
481
- _config.toggle = false;
482
- }
483
-
484
- if (!data) {
485
- data = new Collapse(element, _config);
486
- }
440
+ static jQueryInterface(config) {
441
+ return this.each(function () {
442
+ const _config = {};
487
443
 
488
- if (typeof config === 'string') {
489
- if (typeof data[config] === 'undefined') {
490
- throw new TypeError(`No method named "${config}"`);
444
+ if (typeof config === 'string' && /show|hide/.test(config)) {
445
+ _config.toggle = false;
491
446
  }
492
447
 
493
- data[config]();
494
- }
495
- }
448
+ const data = Collapse.getOrCreateInstance(this, _config);
496
449
 
497
- static jQueryInterface(config) {
498
- return this.each(function () {
499
- Collapse.collapseInterface(this, config);
450
+ if (typeof config === 'string') {
451
+ if (typeof data[config] === 'undefined') {
452
+ throw new TypeError(`No method named "${config}"`);
453
+ }
454
+
455
+ data[config]();
456
+ }
500
457
  });
501
458
  }
502
459
 
@@ -514,26 +471,12 @@
514
471
  event.preventDefault();
515
472
  }
516
473
 
517
- const triggerData = Manipulator__default['default'].getDataAttributes(this);
518
474
  const selector = getSelectorFromElement(this);
519
475
  const selectorElements = SelectorEngine__default['default'].find(selector);
520
476
  selectorElements.forEach(element => {
521
- const data = Data__default['default'].get(element, DATA_KEY);
522
- let config;
523
-
524
- if (data) {
525
- // update parent attribute
526
- if (data._parent === null && typeof triggerData.parent === 'string') {
527
- data._config.parent = triggerData.parent;
528
- data._parent = data._getParent();
529
- }
530
-
531
- config = 'toggle';
532
- } else {
533
- config = triggerData;
534
- }
535
-
536
- Collapse.collapseInterface(element, config);
477
+ Collapse.getOrCreateInstance(element, {
478
+ toggle: false
479
+ }).toggle();
537
480
  });
538
481
  });
539
482
  /**
@@ -543,7 +486,7 @@
543
486
  * add .Collapse to jQuery only if jQuery is present
544
487
  */
545
488
 
546
- defineJQueryPlugin(NAME, Collapse);
489
+ defineJQueryPlugin(Collapse);
547
490
 
548
491
  return Collapse;
549
492
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap data.js v5.0.0 (https://getbootstrap.com/)
2
+ * Bootstrap data.js v5.1.1 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0): dom/data.js
14
+ * Bootstrap (v5.1.1): dom/data.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap event-handler.js v5.0.0 (https://getbootstrap.com/)
2
+ * Bootstrap event-handler.js v5.1.1 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0): util/index.js
14
+ * Bootstrap (v5.1.1): util/index.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -30,7 +30,7 @@
30
30
 
31
31
  /**
32
32
  * --------------------------------------------------------------------------
33
- * Bootstrap (v5.0.0): dom/event-handler.js
33
+ * Bootstrap (v5.1.1): dom/event-handler.js
34
34
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
35
35
  * --------------------------------------------------------------------------
36
36
  */
@@ -93,7 +93,6 @@
93
93
  event.delegateTarget = target;
94
94
 
95
95
  if (handler.oneOff) {
96
- // eslint-disable-next-line unicorn/consistent-destructuring
97
96
  EventHandler.off(element, event.type, selector, fn);
98
97
  }
99
98
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap manipulator.js v5.0.0 (https://getbootstrap.com/)
2
+ * Bootstrap manipulator.js v5.1.1 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0): dom/manipulator.js
14
+ * Bootstrap (v5.1.1): dom/manipulator.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
@@ -69,8 +69,8 @@
69
69
  offset(element) {
70
70
  const rect = element.getBoundingClientRect();
71
71
  return {
72
- top: rect.top + document.body.scrollTop,
73
- left: rect.left + document.body.scrollLeft
72
+ top: rect.top + window.pageYOffset,
73
+ left: rect.left + window.pageXOffset
74
74
  };
75
75
  },
76
76
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Bootstrap selector-engine.js v5.0.0 (https://getbootstrap.com/)
2
+ * Bootstrap selector-engine.js v5.1.1 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
@@ -11,15 +11,52 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.0.0): dom/selector-engine.js
14
+ * Bootstrap (v5.1.1): util/index.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
18
18
 
19
+ const isElement = obj => {
20
+ if (!obj || typeof obj !== 'object') {
21
+ return false;
22
+ }
23
+
24
+ if (typeof obj.jquery !== 'undefined') {
25
+ obj = obj[0];
26
+ }
27
+
28
+ return typeof obj.nodeType !== 'undefined';
29
+ };
30
+
31
+ const isVisible = element => {
32
+ if (!isElement(element) || element.getClientRects().length === 0) {
33
+ return false;
34
+ }
35
+
36
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
37
+ };
38
+
39
+ const isDisabled = element => {
40
+ if (!element || element.nodeType !== Node.ELEMENT_NODE) {
41
+ return true;
42
+ }
43
+
44
+ if (element.classList.contains('disabled')) {
45
+ return true;
46
+ }
47
+
48
+ if (typeof element.disabled !== 'undefined') {
49
+ return element.disabled;
50
+ }
51
+
52
+ return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
53
+ };
54
+
19
55
  /**
20
- * ------------------------------------------------------------------------
21
- * Constants
22
- * ------------------------------------------------------------------------
56
+ * --------------------------------------------------------------------------
57
+ * Bootstrap (v5.1.1): dom/selector-engine.js
58
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
59
+ * --------------------------------------------------------------------------
23
60
  */
24
61
  const NODE_TEXT = 3;
25
62
  const SelectorEngine = {
@@ -76,6 +113,11 @@
76
113
  }
77
114
 
78
115
  return [];
116
+ },
117
+
118
+ focusableChildren(element) {
119
+ const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
120
+ return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
79
121
  }
80
122
 
81
123
  };