bootstrap 5.2.0 → 5.3.0

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +55 -0
  3. data/README.md +25 -5
  4. data/assets/javascripts/bootstrap/alert.js +22 -32
  5. data/assets/javascripts/bootstrap/base-component.js +22 -38
  6. data/assets/javascripts/bootstrap/button.js +19 -22
  7. data/assets/javascripts/bootstrap/carousel.js +52 -135
  8. data/assets/javascripts/bootstrap/collapse.js +40 -102
  9. data/assets/javascripts/bootstrap/dom/data.js +8 -12
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +19 -66
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +4 -17
  12. data/assets/javascripts/bootstrap/dom/selector-engine.js +42 -24
  13. data/assets/javascripts/bootstrap/dropdown.js +74 -143
  14. data/assets/javascripts/bootstrap/modal.js +66 -143
  15. data/assets/javascripts/bootstrap/offcanvas.js +50 -102
  16. data/assets/javascripts/bootstrap/popover.js +23 -29
  17. data/assets/javascripts/bootstrap/scrollspy.js +64 -97
  18. data/assets/javascripts/bootstrap/tab.js +55 -112
  19. data/assets/javascripts/bootstrap/toast.js +39 -77
  20. data/assets/javascripts/bootstrap/tooltip.js +99 -216
  21. data/assets/javascripts/bootstrap/util/backdrop.js +28 -54
  22. data/assets/javascripts/bootstrap/util/component-functions.js +13 -18
  23. data/assets/javascripts/bootstrap/util/config.js +15 -27
  24. data/assets/javascripts/bootstrap/util/focustrap.js +20 -36
  25. data/assets/javascripts/bootstrap/util/index.js +42 -111
  26. data/assets/javascripts/bootstrap/util/sanitizer.js +30 -42
  27. data/assets/javascripts/bootstrap/util/scrollbar.js +24 -50
  28. data/assets/javascripts/bootstrap/util/swipe.js +27 -48
  29. data/assets/javascripts/bootstrap/util/template-factory.js +25 -52
  30. data/assets/javascripts/bootstrap-sprockets.js +12 -12
  31. data/assets/javascripts/bootstrap.js +764 -1529
  32. data/assets/javascripts/bootstrap.min.js +3 -3
  33. data/assets/stylesheets/_bootstrap-grid.scss +1 -3
  34. data/assets/stylesheets/_bootstrap-reboot.scss +1 -0
  35. data/assets/stylesheets/_bootstrap.scss +1 -0
  36. data/assets/stylesheets/bootstrap/_accordion.scss +16 -4
  37. data/assets/stylesheets/bootstrap/_alert.scss +8 -11
  38. data/assets/stylesheets/bootstrap/_button-group.scss +3 -3
  39. data/assets/stylesheets/bootstrap/_buttons.scss +31 -10
  40. data/assets/stylesheets/bootstrap/_card.scss +5 -0
  41. data/assets/stylesheets/bootstrap/_carousel.scss +20 -5
  42. data/assets/stylesheets/bootstrap/_close.scss +32 -9
  43. data/assets/stylesheets/bootstrap/_dropdown.scss +3 -1
  44. data/assets/stylesheets/bootstrap/_functions.scss +3 -3
  45. data/assets/stylesheets/bootstrap/_grid.scss +6 -0
  46. data/assets/stylesheets/bootstrap/_helpers.scss +2 -0
  47. data/assets/stylesheets/bootstrap/_list-group.scss +18 -12
  48. data/assets/stylesheets/bootstrap/_maps.scss +120 -0
  49. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  50. data/assets/stylesheets/bootstrap/_modal.scss +1 -1
  51. data/assets/stylesheets/bootstrap/_nav.scss +42 -5
  52. data/assets/stylesheets/bootstrap/_navbar.scss +17 -4
  53. data/assets/stylesheets/bootstrap/_offcanvas.scss +9 -6
  54. data/assets/stylesheets/bootstrap/_pagination.scss +1 -1
  55. data/assets/stylesheets/bootstrap/_popover.scss +5 -5
  56. data/assets/stylesheets/bootstrap/_progress.scss +10 -1
  57. data/assets/stylesheets/bootstrap/_reboot.scss +3 -3
  58. data/assets/stylesheets/bootstrap/_root.scss +121 -10
  59. data/assets/stylesheets/bootstrap/_tables.scss +18 -11
  60. data/assets/stylesheets/bootstrap/_toasts.scss +5 -2
  61. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -5
  62. data/assets/stylesheets/bootstrap/_utilities.scss +172 -13
  63. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  64. data/assets/stylesheets/bootstrap/_variables.scss +272 -162
  65. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +4 -0
  66. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +23 -3
  67. data/assets/stylesheets/bootstrap/forms/_form-check.scss +24 -11
  68. data/assets/stylesheets/bootstrap/forms/_form-control.scss +23 -3
  69. data/assets/stylesheets/bootstrap/forms/_form-select.scss +11 -2
  70. data/assets/stylesheets/bootstrap/forms/_input-group.scss +7 -4
  71. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +0 -2
  72. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +20 -2
  73. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  74. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  75. data/assets/stylesheets/bootstrap/mixins/_alert.scss +4 -1
  76. data/assets/stylesheets/bootstrap/mixins/_banner.scss +3 -5
  77. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  78. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  79. data/assets/stylesheets/bootstrap/mixins/_forms.scss +18 -17
  80. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  81. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +2 -2
  82. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +2 -2
  83. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +5 -1
  84. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  85. data/bootstrap.gemspec +1 -1
  86. data/lib/bootstrap/version.rb +2 -2
  87. data/tasks/updater/js.rb +2 -2
  88. data/tasks/updater/network.rb +2 -2
  89. data/tasks/updater/scss.rb +1 -1
  90. data/tasks/updater.rb +2 -2
  91. data/test/gemfiles/rails_5_2.gemfile +8 -0
  92. data/test/gemfiles/rails_7_0.gemfile +7 -0
  93. data/test/test_helper.rb +3 -2
  94. metadata +17 -9
  95. data/.travis.yml +0 -32
@@ -1,26 +1,22 @@
1
1
  /*!
2
- * Bootstrap scrollspy.js v5.2.0 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap scrollspy.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('./base-component')) :
8
- typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './dom/selector-engine', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Scrollspy = factory(global.Index, global.EventHandler, global.SelectorEngine, global.BaseComponent));
10
- })(this, (function (index, EventHandler, SelectorEngine, BaseComponent) { '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 BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
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/index.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./base-component', './dom/event-handler', './dom/selector-engine', './util/index'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Scrollspy = factory(global.BaseComponent, global.EventHandler, global.SelectorEngine, global.Index));
10
+ })(this, (function (BaseComponent, EventHandler, SelectorEngine, index_js) { 'use strict';
17
11
 
18
12
  /**
19
13
  * --------------------------------------------------------------------------
20
- * Bootstrap (v5.2.0): scrollspy.js
14
+ * Bootstrap scrollspy.js
21
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
22
16
  * --------------------------------------------------------------------------
23
17
  */
18
+
19
+
24
20
  /**
25
21
  * Constants
26
22
  */
@@ -48,23 +44,27 @@
48
44
  // TODO: v6 @deprecated, keep it for backwards compatibility reasons
49
45
  rootMargin: '0px 0px -25%',
50
46
  smoothScroll: false,
51
- target: null
47
+ target: null,
48
+ threshold: [0.1, 0.5, 1]
52
49
  };
53
50
  const DefaultType = {
54
51
  offset: '(number|null)',
55
52
  // TODO v6 @deprecated, keep it for backwards compatibility reasons
56
53
  rootMargin: 'string',
57
54
  smoothScroll: 'boolean',
58
- target: 'element'
55
+ target: 'element',
56
+ threshold: 'array'
59
57
  };
58
+
60
59
  /**
61
60
  * Class definition
62
61
  */
63
62
 
64
- class ScrollSpy extends BaseComponent__default.default {
63
+ class ScrollSpy extends BaseComponent {
65
64
  constructor(element, config) {
66
- super(element, config); // this._element is the observablesContainer and config.target the menu links wrapper
65
+ super(element, config);
67
66
 
67
+ // this._element is the observablesContainer and config.target the menu links wrapper
68
68
  this._targetLinks = new Map();
69
69
  this._observableSections = new Map();
70
70
  this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
@@ -75,232 +75,199 @@
75
75
  parentScrollTop: 0
76
76
  };
77
77
  this.refresh(); // initialize
78
- } // Getters
79
-
78
+ }
80
79
 
80
+ // Getters
81
81
  static get Default() {
82
82
  return Default;
83
83
  }
84
-
85
84
  static get DefaultType() {
86
85
  return DefaultType;
87
86
  }
88
-
89
87
  static get NAME() {
90
88
  return NAME;
91
- } // Public
92
-
89
+ }
93
90
 
91
+ // Public
94
92
  refresh() {
95
93
  this._initializeTargetsAndObservables();
96
-
97
94
  this._maybeEnableSmoothScroll();
98
-
99
95
  if (this._observer) {
100
96
  this._observer.disconnect();
101
97
  } else {
102
98
  this._observer = this._getNewObserver();
103
99
  }
104
-
105
100
  for (const section of this._observableSections.values()) {
106
101
  this._observer.observe(section);
107
102
  }
108
103
  }
109
-
110
104
  dispose() {
111
105
  this._observer.disconnect();
112
-
113
106
  super.dispose();
114
- } // Private
115
-
107
+ }
116
108
 
109
+ // Private
117
110
  _configAfterMerge(config) {
118
111
  // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
119
- config.target = index.getElement(config.target) || document.body;
112
+ config.target = index_js.getElement(config.target) || document.body;
113
+
114
+ // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
115
+ config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
116
+ if (typeof config.threshold === 'string') {
117
+ config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
118
+ }
120
119
  return config;
121
120
  }
122
-
123
121
  _maybeEnableSmoothScroll() {
124
122
  if (!this._config.smoothScroll) {
125
123
  return;
126
- } // unregister any previous listeners
127
-
124
+ }
128
125
 
129
- EventHandler__default.default.off(this._config.target, EVENT_CLICK);
130
- EventHandler__default.default.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
126
+ // unregister any previous listeners
127
+ EventHandler.off(this._config.target, EVENT_CLICK);
128
+ EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
131
129
  const observableSection = this._observableSections.get(event.target.hash);
132
-
133
130
  if (observableSection) {
134
131
  event.preventDefault();
135
132
  const root = this._rootElement || window;
136
133
  const height = observableSection.offsetTop - this._element.offsetTop;
137
-
138
134
  if (root.scrollTo) {
139
135
  root.scrollTo({
140
136
  top: height,
141
137
  behavior: 'smooth'
142
138
  });
143
139
  return;
144
- } // Chrome 60 doesn't support `scrollTo`
145
-
140
+ }
146
141
 
142
+ // Chrome 60 doesn't support `scrollTo`
147
143
  root.scrollTop = height;
148
144
  }
149
145
  });
150
146
  }
151
-
152
147
  _getNewObserver() {
153
148
  const options = {
154
149
  root: this._rootElement,
155
- threshold: [0.1, 0.5, 1],
156
- rootMargin: this._getRootMargin()
150
+ threshold: this._config.threshold,
151
+ rootMargin: this._config.rootMargin
157
152
  };
158
153
  return new IntersectionObserver(entries => this._observerCallback(entries), options);
159
- } // The logic of selection
160
-
154
+ }
161
155
 
156
+ // The logic of selection
162
157
  _observerCallback(entries) {
163
158
  const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
164
-
165
159
  const activate = entry => {
166
160
  this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
167
-
168
161
  this._process(targetElement(entry));
169
162
  };
170
-
171
163
  const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
172
164
  const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
173
165
  this._previousScrollData.parentScrollTop = parentScrollTop;
174
-
175
166
  for (const entry of entries) {
176
167
  if (!entry.isIntersecting) {
177
168
  this._activeTarget = null;
178
-
179
169
  this._clearActiveClass(targetElement(entry));
180
-
181
170
  continue;
182
171
  }
183
-
184
- const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop; // if we are scrolling down, pick the bigger offsetTop
185
-
172
+ const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
173
+ // if we are scrolling down, pick the bigger offsetTop
186
174
  if (userScrollsDown && entryIsLowerThanPrevious) {
187
- activate(entry); // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
188
-
175
+ activate(entry);
176
+ // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
189
177
  if (!parentScrollTop) {
190
178
  return;
191
179
  }
192
-
193
180
  continue;
194
- } // if we are scrolling up, pick the smallest offsetTop
195
-
181
+ }
196
182
 
183
+ // if we are scrolling up, pick the smallest offsetTop
197
184
  if (!userScrollsDown && !entryIsLowerThanPrevious) {
198
185
  activate(entry);
199
186
  }
200
187
  }
201
- } // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
202
-
203
-
204
- _getRootMargin() {
205
- return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin;
206
188
  }
207
-
208
189
  _initializeTargetsAndObservables() {
209
190
  this._targetLinks = new Map();
210
191
  this._observableSections = new Map();
211
- const targetLinks = SelectorEngine__default.default.find(SELECTOR_TARGET_LINKS, this._config.target);
212
-
192
+ const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
213
193
  for (const anchor of targetLinks) {
214
194
  // ensure that the anchor has an id and is not disabled
215
- if (!anchor.hash || index.isDisabled(anchor)) {
195
+ if (!anchor.hash || index_js.isDisabled(anchor)) {
216
196
  continue;
217
197
  }
198
+ const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
218
199
 
219
- const observableSection = SelectorEngine__default.default.findOne(anchor.hash, this._element); // ensure that the observableSection exists & is visible
220
-
221
- if (index.isVisible(observableSection)) {
222
- this._targetLinks.set(anchor.hash, anchor);
223
-
200
+ // ensure that the observableSection exists & is visible
201
+ if (index_js.isVisible(observableSection)) {
202
+ this._targetLinks.set(decodeURI(anchor.hash), anchor);
224
203
  this._observableSections.set(anchor.hash, observableSection);
225
204
  }
226
205
  }
227
206
  }
228
-
229
207
  _process(target) {
230
208
  if (this._activeTarget === target) {
231
209
  return;
232
210
  }
233
-
234
211
  this._clearActiveClass(this._config.target);
235
-
236
212
  this._activeTarget = target;
237
213
  target.classList.add(CLASS_NAME_ACTIVE);
238
-
239
214
  this._activateParents(target);
240
-
241
- EventHandler__default.default.trigger(this._element, EVENT_ACTIVATE, {
215
+ EventHandler.trigger(this._element, EVENT_ACTIVATE, {
242
216
  relatedTarget: target
243
217
  });
244
218
  }
245
-
246
219
  _activateParents(target) {
247
220
  // Activate dropdown parents
248
221
  if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
249
- SelectorEngine__default.default.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
222
+ SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
250
223
  return;
251
224
  }
252
-
253
- for (const listGroup of SelectorEngine__default.default.parents(target, SELECTOR_NAV_LIST_GROUP)) {
225
+ for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
254
226
  // Set triggered links parents as active
255
227
  // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
256
- for (const item of SelectorEngine__default.default.prev(listGroup, SELECTOR_LINK_ITEMS)) {
228
+ for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
257
229
  item.classList.add(CLASS_NAME_ACTIVE);
258
230
  }
259
231
  }
260
232
  }
261
-
262
233
  _clearActiveClass(parent) {
263
234
  parent.classList.remove(CLASS_NAME_ACTIVE);
264
- const activeNodes = SelectorEngine__default.default.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent);
265
-
235
+ const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent);
266
236
  for (const node of activeNodes) {
267
237
  node.classList.remove(CLASS_NAME_ACTIVE);
268
238
  }
269
- } // Static
270
-
239
+ }
271
240
 
241
+ // Static
272
242
  static jQueryInterface(config) {
273
243
  return this.each(function () {
274
244
  const data = ScrollSpy.getOrCreateInstance(this, config);
275
-
276
245
  if (typeof config !== 'string') {
277
246
  return;
278
247
  }
279
-
280
248
  if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
281
249
  throw new TypeError(`No method named "${config}"`);
282
250
  }
283
-
284
251
  data[config]();
285
252
  });
286
253
  }
287
-
288
254
  }
255
+
289
256
  /**
290
257
  * Data API implementation
291
258
  */
292
259
 
293
-
294
- EventHandler__default.default.on(window, EVENT_LOAD_DATA_API, () => {
295
- for (const spy of SelectorEngine__default.default.find(SELECTOR_DATA_SPY)) {
260
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
261
+ for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
296
262
  ScrollSpy.getOrCreateInstance(spy);
297
263
  }
298
264
  });
265
+
299
266
  /**
300
267
  * jQuery
301
268
  */
302
269
 
303
- index.defineJQueryPlugin(ScrollSpy);
270
+ index_js.defineJQueryPlugin(ScrollSpy);
304
271
 
305
272
  return ScrollSpy;
306
273