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,29 +1,21 @@
1
1
  /*!
2
- * Bootstrap modal.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap modal.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('./util/index'), require('./dom/event-handler'), require('./dom/selector-engine'), require('./util/scrollbar'), require('./base-component'), require('./util/backdrop'), require('./util/focustrap'), require('./util/component-functions')) :
8
- typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './dom/selector-engine', './util/scrollbar', './base-component', './util/backdrop', './util/focustrap', './util/component-functions'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.Index, global.EventHandler, global.SelectorEngine, global.Scrollbar, global.BaseComponent, global.Backdrop, global.Focustrap, global.ComponentFunctions));
10
- })(this, (function (index, EventHandler, SelectorEngine, ScrollBarHelper, BaseComponent, Backdrop, FocusTrap, componentFunctions) { '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 SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
16
- const ScrollBarHelper__default = /*#__PURE__*/_interopDefaultLegacy(ScrollBarHelper);
17
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
18
- const Backdrop__default = /*#__PURE__*/_interopDefaultLegacy(Backdrop);
19
- const FocusTrap__default = /*#__PURE__*/_interopDefaultLegacy(FocusTrap);
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./base-component.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./util/backdrop.js'), require('./util/component-functions.js'), require('./util/focustrap.js'), require('./util/index.js'), require('./util/scrollbar.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/backdrop', './util/component-functions', './util/focustrap', './util/index', './util/scrollbar'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Backdrop, global.ComponentFunctions, global.Focustrap, global.Index, global.Scrollbar));
10
+ })(this, (function (BaseComponent, EventHandler, SelectorEngine, Backdrop, componentFunctions_js, FocusTrap, index_js, ScrollBarHelper) { 'use strict';
20
11
 
21
12
  /**
22
13
  * --------------------------------------------------------------------------
23
- * Bootstrap (v5.2.3): modal.js
14
+ * Bootstrap modal.js
24
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
25
16
  * --------------------------------------------------------------------------
26
17
  */
18
+
27
19
  /**
28
20
  * Constants
29
21
  */
@@ -61,338 +53,265 @@
61
53
  focus: 'boolean',
62
54
  keyboard: 'boolean'
63
55
  };
56
+
64
57
  /**
65
58
  * Class definition
66
59
  */
67
60
 
68
- class Modal extends BaseComponent__default.default {
61
+ class Modal extends BaseComponent {
69
62
  constructor(element, config) {
70
63
  super(element, config);
71
- this._dialog = SelectorEngine__default.default.findOne(SELECTOR_DIALOG, this._element);
64
+ this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
72
65
  this._backdrop = this._initializeBackDrop();
73
66
  this._focustrap = this._initializeFocusTrap();
74
67
  this._isShown = false;
75
68
  this._isTransitioning = false;
76
- this._scrollBar = new ScrollBarHelper__default.default();
77
-
69
+ this._scrollBar = new ScrollBarHelper();
78
70
  this._addEventListeners();
79
- } // Getters
80
-
71
+ }
81
72
 
73
+ // Getters
82
74
  static get Default() {
83
75
  return Default;
84
76
  }
85
-
86
77
  static get DefaultType() {
87
78
  return DefaultType;
88
79
  }
89
-
90
80
  static get NAME() {
91
81
  return NAME;
92
- } // Public
93
-
82
+ }
94
83
 
84
+ // Public
95
85
  toggle(relatedTarget) {
96
86
  return this._isShown ? this.hide() : this.show(relatedTarget);
97
87
  }
98
-
99
88
  show(relatedTarget) {
100
89
  if (this._isShown || this._isTransitioning) {
101
90
  return;
102
91
  }
103
-
104
- const showEvent = EventHandler__default.default.trigger(this._element, EVENT_SHOW, {
92
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
105
93
  relatedTarget
106
94
  });
107
-
108
95
  if (showEvent.defaultPrevented) {
109
96
  return;
110
97
  }
111
-
112
98
  this._isShown = true;
113
99
  this._isTransitioning = true;
114
-
115
100
  this._scrollBar.hide();
116
-
117
101
  document.body.classList.add(CLASS_NAME_OPEN);
118
-
119
102
  this._adjustDialog();
120
-
121
103
  this._backdrop.show(() => this._showElement(relatedTarget));
122
104
  }
123
-
124
105
  hide() {
125
106
  if (!this._isShown || this._isTransitioning) {
126
107
  return;
127
108
  }
128
-
129
- const hideEvent = EventHandler__default.default.trigger(this._element, EVENT_HIDE);
130
-
109
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
131
110
  if (hideEvent.defaultPrevented) {
132
111
  return;
133
112
  }
134
-
135
113
  this._isShown = false;
136
114
  this._isTransitioning = true;
137
-
138
115
  this._focustrap.deactivate();
139
-
140
116
  this._element.classList.remove(CLASS_NAME_SHOW);
141
-
142
117
  this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
143
118
  }
144
-
145
119
  dispose() {
146
- for (const htmlElement of [window, this._dialog]) {
147
- EventHandler__default.default.off(htmlElement, EVENT_KEY);
148
- }
149
-
120
+ EventHandler.off(window, EVENT_KEY);
121
+ EventHandler.off(this._dialog, EVENT_KEY);
150
122
  this._backdrop.dispose();
151
-
152
123
  this._focustrap.deactivate();
153
-
154
124
  super.dispose();
155
125
  }
156
-
157
126
  handleUpdate() {
158
127
  this._adjustDialog();
159
- } // Private
160
-
128
+ }
161
129
 
130
+ // Private
162
131
  _initializeBackDrop() {
163
- return new Backdrop__default.default({
132
+ return new Backdrop({
164
133
  isVisible: Boolean(this._config.backdrop),
165
134
  // 'static' option will be translated to true, and booleans will keep their value,
166
135
  isAnimated: this._isAnimated()
167
136
  });
168
137
  }
169
-
170
138
  _initializeFocusTrap() {
171
- return new FocusTrap__default.default({
139
+ return new FocusTrap({
172
140
  trapElement: this._element
173
141
  });
174
142
  }
175
-
176
143
  _showElement(relatedTarget) {
177
144
  // try to append dynamic modal
178
145
  if (!document.body.contains(this._element)) {
179
146
  document.body.append(this._element);
180
147
  }
181
-
182
148
  this._element.style.display = 'block';
183
-
184
149
  this._element.removeAttribute('aria-hidden');
185
-
186
150
  this._element.setAttribute('aria-modal', true);
187
-
188
151
  this._element.setAttribute('role', 'dialog');
189
-
190
152
  this._element.scrollTop = 0;
191
- const modalBody = SelectorEngine__default.default.findOne(SELECTOR_MODAL_BODY, this._dialog);
192
-
153
+ const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
193
154
  if (modalBody) {
194
155
  modalBody.scrollTop = 0;
195
156
  }
196
-
197
- index.reflow(this._element);
198
-
157
+ index_js.reflow(this._element);
199
158
  this._element.classList.add(CLASS_NAME_SHOW);
200
-
201
159
  const transitionComplete = () => {
202
160
  if (this._config.focus) {
203
161
  this._focustrap.activate();
204
162
  }
205
-
206
163
  this._isTransitioning = false;
207
- EventHandler__default.default.trigger(this._element, EVENT_SHOWN, {
164
+ EventHandler.trigger(this._element, EVENT_SHOWN, {
208
165
  relatedTarget
209
166
  });
210
167
  };
211
-
212
168
  this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
213
169
  }
214
-
215
170
  _addEventListeners() {
216
- EventHandler__default.default.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
171
+ EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
217
172
  if (event.key !== ESCAPE_KEY) {
218
173
  return;
219
174
  }
220
-
221
175
  if (this._config.keyboard) {
222
- event.preventDefault();
223
176
  this.hide();
224
177
  return;
225
178
  }
226
-
227
179
  this._triggerBackdropTransition();
228
180
  });
229
- EventHandler__default.default.on(window, EVENT_RESIZE, () => {
181
+ EventHandler.on(window, EVENT_RESIZE, () => {
230
182
  if (this._isShown && !this._isTransitioning) {
231
183
  this._adjustDialog();
232
184
  }
233
185
  });
234
- EventHandler__default.default.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
186
+ EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
235
187
  // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
236
- EventHandler__default.default.one(this._element, EVENT_CLICK_DISMISS, event2 => {
188
+ EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
237
189
  if (this._element !== event.target || this._element !== event2.target) {
238
190
  return;
239
191
  }
240
-
241
192
  if (this._config.backdrop === 'static') {
242
193
  this._triggerBackdropTransition();
243
-
244
194
  return;
245
195
  }
246
-
247
196
  if (this._config.backdrop) {
248
197
  this.hide();
249
198
  }
250
199
  });
251
200
  });
252
201
  }
253
-
254
202
  _hideModal() {
255
203
  this._element.style.display = 'none';
256
-
257
204
  this._element.setAttribute('aria-hidden', true);
258
-
259
205
  this._element.removeAttribute('aria-modal');
260
-
261
206
  this._element.removeAttribute('role');
262
-
263
207
  this._isTransitioning = false;
264
-
265
208
  this._backdrop.hide(() => {
266
209
  document.body.classList.remove(CLASS_NAME_OPEN);
267
-
268
210
  this._resetAdjustments();
269
-
270
211
  this._scrollBar.reset();
271
-
272
- EventHandler__default.default.trigger(this._element, EVENT_HIDDEN);
212
+ EventHandler.trigger(this._element, EVENT_HIDDEN);
273
213
  });
274
214
  }
275
-
276
215
  _isAnimated() {
277
216
  return this._element.classList.contains(CLASS_NAME_FADE);
278
217
  }
279
-
280
218
  _triggerBackdropTransition() {
281
- const hideEvent = EventHandler__default.default.trigger(this._element, EVENT_HIDE_PREVENTED);
282
-
219
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
283
220
  if (hideEvent.defaultPrevented) {
284
221
  return;
285
222
  }
286
-
287
223
  const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
288
- const initialOverflowY = this._element.style.overflowY; // return if the following background transition hasn't yet completed
289
-
224
+ const initialOverflowY = this._element.style.overflowY;
225
+ // return if the following background transition hasn't yet completed
290
226
  if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
291
227
  return;
292
228
  }
293
-
294
229
  if (!isModalOverflowing) {
295
230
  this._element.style.overflowY = 'hidden';
296
231
  }
297
-
298
232
  this._element.classList.add(CLASS_NAME_STATIC);
299
-
300
233
  this._queueCallback(() => {
301
234
  this._element.classList.remove(CLASS_NAME_STATIC);
302
-
303
235
  this._queueCallback(() => {
304
236
  this._element.style.overflowY = initialOverflowY;
305
237
  }, this._dialog);
306
238
  }, this._dialog);
307
-
308
239
  this._element.focus();
309
240
  }
241
+
310
242
  /**
311
243
  * The following methods are used to handle overflowing modals
312
244
  */
313
245
 
314
-
315
246
  _adjustDialog() {
316
247
  const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
317
-
318
248
  const scrollbarWidth = this._scrollBar.getWidth();
319
-
320
249
  const isBodyOverflowing = scrollbarWidth > 0;
321
-
322
250
  if (isBodyOverflowing && !isModalOverflowing) {
323
- const property = index.isRTL() ? 'paddingLeft' : 'paddingRight';
251
+ const property = index_js.isRTL() ? 'paddingLeft' : 'paddingRight';
324
252
  this._element.style[property] = `${scrollbarWidth}px`;
325
253
  }
326
-
327
254
  if (!isBodyOverflowing && isModalOverflowing) {
328
- const property = index.isRTL() ? 'paddingRight' : 'paddingLeft';
255
+ const property = index_js.isRTL() ? 'paddingRight' : 'paddingLeft';
329
256
  this._element.style[property] = `${scrollbarWidth}px`;
330
257
  }
331
258
  }
332
-
333
259
  _resetAdjustments() {
334
260
  this._element.style.paddingLeft = '';
335
261
  this._element.style.paddingRight = '';
336
- } // Static
337
-
262
+ }
338
263
 
264
+ // Static
339
265
  static jQueryInterface(config, relatedTarget) {
340
266
  return this.each(function () {
341
267
  const data = Modal.getOrCreateInstance(this, config);
342
-
343
268
  if (typeof config !== 'string') {
344
269
  return;
345
270
  }
346
-
347
271
  if (typeof data[config] === 'undefined') {
348
272
  throw new TypeError(`No method named "${config}"`);
349
273
  }
350
-
351
274
  data[config](relatedTarget);
352
275
  });
353
276
  }
354
-
355
277
  }
278
+
356
279
  /**
357
280
  * Data API implementation
358
281
  */
359
282
 
360
-
361
- EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
362
- const target = index.getElementFromSelector(this);
363
-
283
+ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
284
+ const target = SelectorEngine.getElementFromSelector(this);
364
285
  if (['A', 'AREA'].includes(this.tagName)) {
365
286
  event.preventDefault();
366
287
  }
367
-
368
- EventHandler__default.default.one(target, EVENT_SHOW, showEvent => {
288
+ EventHandler.one(target, EVENT_SHOW, showEvent => {
369
289
  if (showEvent.defaultPrevented) {
370
290
  // only register focus restorer if modal will actually get shown
371
291
  return;
372
292
  }
373
-
374
- EventHandler__default.default.one(target, EVENT_HIDDEN, () => {
375
- if (index.isVisible(this)) {
293
+ EventHandler.one(target, EVENT_HIDDEN, () => {
294
+ if (index_js.isVisible(this)) {
376
295
  this.focus();
377
296
  }
378
297
  });
379
- }); // avoid conflict when clicking modal toggler while another one is open
380
-
381
- const alreadyOpen = SelectorEngine__default.default.findOne(OPEN_SELECTOR);
298
+ });
382
299
 
300
+ // avoid conflict when clicking modal toggler while another one is open
301
+ const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
383
302
  if (alreadyOpen) {
384
303
  Modal.getInstance(alreadyOpen).hide();
385
304
  }
386
-
387
305
  const data = Modal.getOrCreateInstance(target);
388
306
  data.toggle(this);
389
307
  });
390
- componentFunctions.enableDismissTrigger(Modal);
308
+ componentFunctions_js.enableDismissTrigger(Modal);
309
+
391
310
  /**
392
311
  * jQuery
393
312
  */
394
313
 
395
- index.defineJQueryPlugin(Modal);
314
+ index_js.defineJQueryPlugin(Modal);
396
315
 
397
316
  return Modal;
398
317