bootstrap 5.2.3 → 5.3.0

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