bootstrap 5.1.3 → 5.3.5

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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +61 -0
  3. data/CHANGELOG.md +9 -0
  4. data/Gemfile +1 -0
  5. data/README.md +35 -14
  6. data/Rakefile +16 -5
  7. data/assets/javascripts/bootstrap/alert.js +22 -167
  8. data/assets/javascripts/bootstrap/base-component.js +34 -133
  9. data/assets/javascripts/bootstrap/button.js +19 -86
  10. data/assets/javascripts/bootstrap/carousel.js +209 -564
  11. data/assets/javascripts/bootstrap/collapse.js +78 -324
  12. data/assets/javascripts/bootstrap/dom/data.js +8 -14
  13. data/assets/javascripts/bootstrap/dom/event-handler.js +89 -174
  14. data/assets/javascripts/bootstrap/dom/manipulator.js +22 -39
  15. data/assets/javascripts/bootstrap/dom/selector-engine.js +47 -71
  16. data/assets/javascripts/bootstrap/dropdown.js +135 -420
  17. data/assets/javascripts/bootstrap/modal.js +115 -837
  18. data/assets/javascripts/bootstrap/offcanvas.js +93 -714
  19. data/assets/javascripts/bootstrap/popover.js +42 -130
  20. data/assets/javascripts/bootstrap/scrollspy.js +180 -296
  21. data/assets/javascripts/bootstrap/tab.js +197 -245
  22. data/assets/javascripts/bootstrap/toast.js +52 -276
  23. data/assets/javascripts/bootstrap/tooltip.js +283 -744
  24. data/assets/javascripts/bootstrap/util/backdrop.js +138 -0
  25. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  26. data/assets/javascripts/bootstrap/util/config.js +67 -0
  27. data/assets/javascripts/bootstrap/util/focustrap.js +112 -0
  28. data/assets/javascripts/bootstrap/util/index.js +280 -0
  29. data/assets/javascripts/bootstrap/util/sanitizer.js +113 -0
  30. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  31. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  32. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  33. data/assets/javascripts/bootstrap-global-this-define.js +1 -1
  34. data/assets/javascripts/bootstrap-sprockets.js +15 -6
  35. data/assets/javascripts/bootstrap.js +2278 -2831
  36. data/assets/javascripts/bootstrap.min.js +3 -3
  37. data/assets/stylesheets/_bootstrap-grid.scss +4 -9
  38. data/assets/stylesheets/_bootstrap-reboot.scss +4 -7
  39. data/assets/stylesheets/_bootstrap-utilities.scss +19 -0
  40. data/assets/stylesheets/_bootstrap.scss +5 -6
  41. data/assets/stylesheets/bootstrap/_accordion.scss +68 -33
  42. data/assets/stylesheets/bootstrap/_alert.scss +25 -14
  43. data/assets/stylesheets/bootstrap/_badge.scss +14 -5
  44. data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -10
  45. data/assets/stylesheets/bootstrap/_button-group.scss +12 -4
  46. data/assets/stylesheets/bootstrap/_buttons.scss +133 -28
  47. data/assets/stylesheets/bootstrap/_card.scss +61 -39
  48. data/assets/stylesheets/bootstrap/_carousel.scss +22 -25
  49. data/assets/stylesheets/bootstrap/_close.scss +36 -10
  50. data/assets/stylesheets/bootstrap/_containers.scss +1 -1
  51. data/assets/stylesheets/bootstrap/_dropdown.scss +86 -76
  52. data/assets/stylesheets/bootstrap/_functions.scss +10 -10
  53. data/assets/stylesheets/bootstrap/_grid.scss +9 -3
  54. data/assets/stylesheets/bootstrap/_helpers.scss +3 -0
  55. data/assets/stylesheets/bootstrap/_list-group.scss +81 -56
  56. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  57. data/assets/stylesheets/bootstrap/_mixins.scss +1 -2
  58. data/assets/stylesheets/bootstrap/_modal.scss +76 -45
  59. data/assets/stylesheets/bootstrap/_nav.scss +87 -29
  60. data/assets/stylesheets/bootstrap/_navbar.scss +102 -148
  61. data/assets/stylesheets/bootstrap/_offcanvas.scss +125 -61
  62. data/assets/stylesheets/bootstrap/_pagination.scss +66 -21
  63. data/assets/stylesheets/bootstrap/_placeholders.scss +1 -1
  64. data/assets/stylesheets/bootstrap/_popover.scss +90 -52
  65. data/assets/stylesheets/bootstrap/_progress.scss +31 -11
  66. data/assets/stylesheets/bootstrap/_reboot.scss +32 -46
  67. data/assets/stylesheets/bootstrap/_root.scss +155 -22
  68. data/assets/stylesheets/bootstrap/_spinners.scss +38 -22
  69. data/assets/stylesheets/bootstrap/_tables.scss +40 -24
  70. data/assets/stylesheets/bootstrap/_toasts.scss +38 -16
  71. data/assets/stylesheets/bootstrap/_tooltip.scss +60 -56
  72. data/assets/stylesheets/bootstrap/_type.scss +3 -1
  73. data/assets/stylesheets/bootstrap/_utilities.scss +209 -33
  74. data/assets/stylesheets/bootstrap/_variables-dark.scss +102 -0
  75. data/assets/stylesheets/bootstrap/_variables.scss +415 -303
  76. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +39 -5
  77. data/assets/stylesheets/bootstrap/forms/_form-check.scss +51 -14
  78. data/assets/stylesheets/bootstrap/forms/_form-control.scss +36 -41
  79. data/assets/stylesheets/bootstrap/forms/_form-range.scss +3 -3
  80. data/assets/stylesheets/bootstrap/forms/_form-select.scss +12 -4
  81. data/assets/stylesheets/bootstrap/forms/_input-group.scss +20 -9
  82. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  83. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +20 -2
  84. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  85. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  86. data/assets/stylesheets/bootstrap/helpers/_position.scss +7 -1
  87. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +2 -2
  88. data/assets/stylesheets/bootstrap/helpers/_vr.scss +2 -2
  89. data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -4
  90. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  91. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +8 -8
  92. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +32 -95
  93. data/assets/stylesheets/bootstrap/mixins/_caret.scss +30 -25
  94. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  95. data/assets/stylesheets/bootstrap/mixins/_container.scss +4 -2
  96. data/assets/stylesheets/bootstrap/mixins/_forms.scss +38 -19
  97. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +1 -1
  98. data/assets/stylesheets/bootstrap/mixins/_grid.scss +15 -15
  99. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +2 -0
  100. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +4 -25
  101. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -1
  102. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +12 -9
  103. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +14 -6
  104. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +6 -2
  105. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +23 -29
  106. data/bootstrap.gemspec +3 -3
  107. data/lib/bootstrap/engine.rb +17 -2
  108. data/lib/bootstrap/version.rb +2 -2
  109. data/tasks/updater/js.rb +10 -5
  110. data/tasks/updater/network.rb +2 -2
  111. data/tasks/updater/scss.rb +2 -2
  112. data/tasks/updater.rb +2 -2
  113. data/test/dummy_rails/config/application.rb +0 -2
  114. data/test/dummy_rails/public/favicon.ico +0 -0
  115. data/test/gemfiles/rails_4_2.gemfile +2 -1
  116. data/test/gemfiles/rails_5_0.gemfile +1 -2
  117. data/test/gemfiles/rails_5_1.gemfile +1 -2
  118. data/test/gemfiles/rails_5_2.gemfile +7 -0
  119. data/test/gemfiles/rails_6_0.gemfile +1 -1
  120. data/test/gemfiles/rails_6_1.gemfile +1 -1
  121. data/test/gemfiles/rails_7_0_dartsass.gemfile +7 -0
  122. data/test/gemfiles/rails_7_0_sassc.gemfile +7 -0
  123. data/test/rails_test.rb +0 -5
  124. data/test/test_helper.rb +3 -2
  125. metadata +49 -29
  126. data/.travis.yml +0 -32
  127. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +0 -18
@@ -1,125 +1,101 @@
1
1
  /*!
2
- * Bootstrap selector-engine.js v5.1.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap selector-engine.js v5.3.5 (https://getbootstrap.com/)
3
+ * Copyright 2011-2025 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() :
8
- typeof define === 'function' && define.amd ? define(factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.SelectorEngine = factory());
10
- })(this, (function () { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../util/index.js')) :
8
+ typeof define === 'function' && define.amd ? define(['../util/index'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.SelectorEngine = factory(global.Index));
10
+ })(this, (function (index_js) { 'use strict';
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.1.3): util/index.js
14
+ * Bootstrap dom/selector-engine.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
- }
19
+ const getSelector = element => {
20
+ let selector = element.getAttribute('data-bs-target');
21
+ if (!selector || selector === '#') {
22
+ let hrefAttribute = element.getAttribute('href');
23
+
24
+ // The only valid content that could double as a selector are IDs or classes,
25
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
26
+ // `document.querySelector` will rightfully complain it is invalid.
27
+ // See https://github.com/twbs/bootstrap/issues/32273
28
+ if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) {
29
+ return null;
30
+ }
47
31
 
48
- if (typeof element.disabled !== 'undefined') {
49
- return element.disabled;
32
+ // Just in case some CMS puts out a full URL with the anchor appended
33
+ if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
34
+ hrefAttribute = `#${hrefAttribute.split('#')[1]}`;
35
+ }
36
+ selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
50
37
  }
51
-
52
- return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
38
+ return selector ? selector.split(',').map(sel => index_js.parseSelector(sel)).join(',') : null;
53
39
  };
54
-
55
- /**
56
- * --------------------------------------------------------------------------
57
- * Bootstrap (v5.1.3): dom/selector-engine.js
58
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
59
- * --------------------------------------------------------------------------
60
- */
61
- const NODE_TEXT = 3;
62
40
  const SelectorEngine = {
63
41
  find(selector, element = document.documentElement) {
64
42
  return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
65
43
  },
66
-
67
44
  findOne(selector, element = document.documentElement) {
68
45
  return Element.prototype.querySelector.call(element, selector);
69
46
  },
70
-
71
47
  children(element, selector) {
72
48
  return [].concat(...element.children).filter(child => child.matches(selector));
73
49
  },
74
-
75
50
  parents(element, selector) {
76
51
  const parents = [];
77
- let ancestor = element.parentNode;
78
-
79
- while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
80
- if (ancestor.matches(selector)) {
81
- parents.push(ancestor);
82
- }
83
-
84
- ancestor = ancestor.parentNode;
52
+ let ancestor = element.parentNode.closest(selector);
53
+ while (ancestor) {
54
+ parents.push(ancestor);
55
+ ancestor = ancestor.parentNode.closest(selector);
85
56
  }
86
-
87
57
  return parents;
88
58
  },
89
-
90
59
  prev(element, selector) {
91
60
  let previous = element.previousElementSibling;
92
-
93
61
  while (previous) {
94
62
  if (previous.matches(selector)) {
95
63
  return [previous];
96
64
  }
97
-
98
65
  previous = previous.previousElementSibling;
99
66
  }
100
-
101
67
  return [];
102
68
  },
103
-
69
+ // TODO: this is now unused; remove later along with prev()
104
70
  next(element, selector) {
105
71
  let next = element.nextElementSibling;
106
-
107
72
  while (next) {
108
73
  if (next.matches(selector)) {
109
74
  return [next];
110
75
  }
111
-
112
76
  next = next.nextElementSibling;
113
77
  }
114
-
115
78
  return [];
116
79
  },
117
-
118
80
  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));
81
+ const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(',');
82
+ return this.find(focusables, element).filter(el => !index_js.isDisabled(el) && index_js.isVisible(el));
83
+ },
84
+ getSelectorFromElement(element) {
85
+ const selector = getSelector(element);
86
+ if (selector) {
87
+ return SelectorEngine.findOne(selector) ? selector : null;
88
+ }
89
+ return null;
90
+ },
91
+ getElementFromSelector(element) {
92
+ const selector = getSelector(element);
93
+ return selector ? SelectorEngine.findOne(selector) : null;
94
+ },
95
+ getMultipleElementsFromSelector(element) {
96
+ const selector = getSelector(element);
97
+ return selector ? SelectorEngine.find(selector) : [];
121
98
  }
122
-
123
99
  };
124
100
 
125
101
  return SelectorEngine;