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,6 +1,6 @@
1
1
  /*!
2
- * Bootstrap manipulator.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap manipulator.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) {
@@ -11,72 +11,59 @@
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.2.3): dom/manipulator.js
14
+ * Bootstrap dom/manipulator.js
15
15
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
16
16
  * --------------------------------------------------------------------------
17
17
  */
18
+
18
19
  function normalizeData(value) {
19
20
  if (value === 'true') {
20
21
  return true;
21
22
  }
22
-
23
23
  if (value === 'false') {
24
24
  return false;
25
25
  }
26
-
27
26
  if (value === Number(value).toString()) {
28
27
  return Number(value);
29
28
  }
30
-
31
29
  if (value === '' || value === 'null') {
32
30
  return null;
33
31
  }
34
-
35
32
  if (typeof value !== 'string') {
36
33
  return value;
37
34
  }
38
-
39
35
  try {
40
36
  return JSON.parse(decodeURIComponent(value));
41
37
  } catch (_unused) {
42
38
  return value;
43
39
  }
44
40
  }
45
-
46
41
  function normalizeDataKey(key) {
47
42
  return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
48
43
  }
49
-
50
44
  const Manipulator = {
51
45
  setDataAttribute(element, key, value) {
52
46
  element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
53
47
  },
54
-
55
48
  removeDataAttribute(element, key) {
56
49
  element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
57
50
  },
58
-
59
51
  getDataAttributes(element) {
60
52
  if (!element) {
61
53
  return {};
62
54
  }
63
-
64
55
  const attributes = {};
65
56
  const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
66
-
67
57
  for (const key of bsKeys) {
68
58
  let pureKey = key.replace(/^bs/, '');
69
59
  pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
70
60
  attributes[pureKey] = normalizeData(element.dataset[key]);
71
61
  }
72
-
73
62
  return attributes;
74
63
  },
75
-
76
64
  getDataAttribute(element, key) {
77
65
  return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
78
66
  }
79
-
80
67
  };
81
68
 
82
69
  return Manipulator;
@@ -1,83 +1,100 @@
1
1
  /*!
2
- * Bootstrap selector-engine.js v5.2.3 (https://getbootstrap.com/)
3
- * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
2
+ * Bootstrap selector-engine.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')) :
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../util/index.js')) :
8
8
  typeof define === 'function' && define.amd ? define(['../util/index'], factory) :
9
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.SelectorEngine = factory(global.Index));
10
- })(this, (function (index) { 'use strict';
10
+ })(this, (function (index_js) { 'use strict';
11
11
 
12
12
  /**
13
13
  * --------------------------------------------------------------------------
14
- * Bootstrap (v5.2.3): dom/selector-engine.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
- /**
19
- * Constants
20
- */
18
+ const getSelector = element => {
19
+ let selector = element.getAttribute('data-bs-target');
20
+ if (!selector || selector === '#') {
21
+ let hrefAttribute = element.getAttribute('href');
22
+
23
+ // The only valid content that could double as a selector are IDs or classes,
24
+ // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
25
+ // `document.querySelector` will rightfully complain it is invalid.
26
+ // See https://github.com/twbs/bootstrap/issues/32273
27
+ if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) {
28
+ return null;
29
+ }
21
30
 
31
+ // Just in case some CMS puts out a full URL with the anchor appended
32
+ if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
33
+ hrefAttribute = `#${hrefAttribute.split('#')[1]}`;
34
+ }
35
+ selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
36
+ }
37
+ return index_js.parseSelector(selector);
38
+ };
22
39
  const SelectorEngine = {
23
40
  find(selector, element = document.documentElement) {
24
41
  return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
25
42
  },
26
-
27
43
  findOne(selector, element = document.documentElement) {
28
44
  return Element.prototype.querySelector.call(element, selector);
29
45
  },
30
-
31
46
  children(element, selector) {
32
47
  return [].concat(...element.children).filter(child => child.matches(selector));
33
48
  },
34
-
35
49
  parents(element, selector) {
36
50
  const parents = [];
37
51
  let ancestor = element.parentNode.closest(selector);
38
-
39
52
  while (ancestor) {
40
53
  parents.push(ancestor);
41
54
  ancestor = ancestor.parentNode.closest(selector);
42
55
  }
43
-
44
56
  return parents;
45
57
  },
46
-
47
58
  prev(element, selector) {
48
59
  let previous = element.previousElementSibling;
49
-
50
60
  while (previous) {
51
61
  if (previous.matches(selector)) {
52
62
  return [previous];
53
63
  }
54
-
55
64
  previous = previous.previousElementSibling;
56
65
  }
57
-
58
66
  return [];
59
67
  },
60
-
61
68
  // TODO: this is now unused; remove later along with prev()
62
69
  next(element, selector) {
63
70
  let next = element.nextElementSibling;
64
-
65
71
  while (next) {
66
72
  if (next.matches(selector)) {
67
73
  return [next];
68
74
  }
69
-
70
75
  next = next.nextElementSibling;
71
76
  }
72
-
73
77
  return [];
74
78
  },
75
-
76
79
  focusableChildren(element) {
77
80
  const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(',');
78
- return this.find(focusables, element).filter(el => !index.isDisabled(el) && index.isVisible(el));
81
+ return this.find(focusables, element).filter(el => !index_js.isDisabled(el) && index_js.isVisible(el));
82
+ },
83
+ getSelectorFromElement(element) {
84
+ const selector = getSelector(element);
85
+ if (selector) {
86
+ return SelectorEngine.findOne(selector) ? selector : null;
87
+ }
88
+ return null;
89
+ },
90
+ getElementFromSelector(element) {
91
+ const selector = getSelector(element);
92
+ return selector ? SelectorEngine.findOne(selector) : null;
93
+ },
94
+ getMultipleElementsFromSelector(element) {
95
+ const selector = getSelector(element);
96
+ return selector ? SelectorEngine.find(selector) : [];
79
97
  }
80
-
81
98
  };
82
99
 
83
100
  return SelectorEngine;