bootstrap 4.6.2 → 5.3.1

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 (175) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +55 -0
  3. data/README.md +28 -5
  4. data/assets/javascripts/bootstrap/alert.js +50 -147
  5. data/assets/javascripts/bootstrap/base-component.js +83 -0
  6. data/assets/javascripts/bootstrap/button.js +40 -190
  7. data/assets/javascripts/bootstrap/carousel.js +282 -537
  8. data/assets/javascripts/bootstrap/collapse.js +166 -314
  9. data/assets/javascripts/bootstrap/dom/data.js +62 -0
  10. data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
  11. data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
  12. data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
  13. data/assets/javascripts/bootstrap/dropdown.js +297 -455
  14. data/assets/javascripts/bootstrap/modal.js +223 -566
  15. data/assets/javascripts/bootstrap/offcanvas.js +245 -0
  16. data/assets/javascripts/bootstrap/popover.js +59 -208
  17. data/assets/javascripts/bootstrap/scrollspy.js +213 -276
  18. data/assets/javascripts/bootstrap/tab.js +222 -200
  19. data/assets/javascripts/bootstrap/toast.js +137 -206
  20. data/assets/javascripts/bootstrap/tooltip.js +403 -746
  21. data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
  22. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  23. data/assets/javascripts/bootstrap/util/config.js +67 -0
  24. data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
  25. data/assets/javascripts/bootstrap/util/index.js +281 -0
  26. data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
  27. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  28. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  29. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  30. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  31. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  32. data/assets/javascripts/bootstrap-sprockets.js +21 -5
  33. data/assets/javascripts/bootstrap.js +3623 -3485
  34. data/assets/javascripts/bootstrap.min.js +3 -3
  35. data/assets/stylesheets/_bootstrap-grid.scss +53 -21
  36. data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
  37. data/assets/stylesheets/_bootstrap.scss +21 -13
  38. data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
  39. data/assets/stylesheets/bootstrap/_alert.scss +32 -16
  40. data/assets/stylesheets/bootstrap/_badge.scss +15 -31
  41. data/assets/stylesheets/bootstrap/_breadcrumb.scss +22 -24
  42. data/assets/stylesheets/bootstrap/_button-group.scss +27 -48
  43. data/assets/stylesheets/bootstrap/_buttons.scss +136 -71
  44. data/assets/stylesheets/bootstrap/_card.scss +66 -113
  45. data/assets/stylesheets/bootstrap/_carousel.scss +78 -34
  46. data/assets/stylesheets/bootstrap/_close.scss +51 -28
  47. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  48. data/assets/stylesheets/bootstrap/_dropdown.scss +129 -71
  49. data/assets/stylesheets/bootstrap/_forms.scss +9 -347
  50. data/assets/stylesheets/bootstrap/_functions.scss +135 -23
  51. data/assets/stylesheets/bootstrap/_grid.scss +18 -52
  52. data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
  53. data/assets/stylesheets/bootstrap/_list-group.scss +77 -34
  54. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  55. data/assets/stylesheets/bootstrap/_mixins.scss +10 -15
  56. data/assets/stylesheets/bootstrap/_modal.scss +107 -110
  57. data/assets/stylesheets/bootstrap/_nav.scss +99 -27
  58. data/assets/stylesheets/bootstrap/_navbar.scss +129 -172
  59. data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
  60. data/assets/stylesheets/bootstrap/_pagination.scss +72 -37
  61. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  62. data/assets/stylesheets/bootstrap/_popover.scss +99 -73
  63. data/assets/stylesheets/bootstrap/_progress.scss +35 -14
  64. data/assets/stylesheets/bootstrap/_reboot.scss +318 -192
  65. data/assets/stylesheets/bootstrap/_root.scss +174 -9
  66. data/assets/stylesheets/bootstrap/_spinners.scss +43 -23
  67. data/assets/stylesheets/bootstrap/_tables.scss +101 -115
  68. data/assets/stylesheets/bootstrap/_toasts.scss +54 -27
  69. data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
  70. data/assets/stylesheets/bootstrap/_transitions.scss +3 -2
  71. data/assets/stylesheets/bootstrap/_type.scss +40 -59
  72. data/assets/stylesheets/bootstrap/_utilities.scss +806 -18
  73. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  74. data/assets/stylesheets/bootstrap/_variables.scss +1202 -606
  75. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +19 -0
  76. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +95 -0
  77. data/assets/stylesheets/bootstrap/forms/_form-check.scss +188 -0
  78. data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
  79. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  80. data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
  81. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  82. data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
  83. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  84. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  85. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +7 -0
  86. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
  87. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  88. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  89. data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
  90. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  91. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  92. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  93. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  94. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  95. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  96. data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
  97. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  98. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  99. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +10 -8
  100. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  101. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
  102. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -100
  103. data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
  104. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  105. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  106. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  107. data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
  108. data/assets/stylesheets/bootstrap/mixins/_forms.scss +54 -96
  109. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  110. data/assets/stylesheets/bootstrap/mixins/_grid.scss +118 -36
  111. data/assets/stylesheets/bootstrap/mixins/_image.scss +1 -21
  112. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
  113. data/assets/stylesheets/bootstrap/mixins/_lists.scss +1 -1
  114. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
  115. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
  116. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
  117. data/assets/stylesheets/bootstrap/mixins/_transition.scss +1 -1
  118. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
  119. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
  120. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  121. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +211 -91
  122. data/bootstrap.gemspec +3 -5
  123. data/lib/bootstrap/version.rb +2 -2
  124. data/tasks/updater/js.rb +17 -5
  125. data/tasks/updater/network.rb +2 -2
  126. data/tasks/updater/scss.rb +1 -1
  127. data/tasks/updater.rb +2 -2
  128. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  129. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  130. data/test/dummy_rails/app/views/pages/root.html +89 -0
  131. data/test/dummy_rails/config/application.rb +0 -3
  132. data/test/gemfiles/rails_5_2.gemfile +8 -0
  133. data/test/gemfiles/rails_6_1.gemfile +7 -0
  134. data/test/gemfiles/rails_7_0.gemfile +7 -0
  135. data/test/test_helper.rb +3 -2
  136. metadata +78 -82
  137. data/.travis.yml +0 -31
  138. data/assets/javascripts/bootstrap/util.js +0 -189
  139. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  140. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -526
  141. data/assets/stylesheets/bootstrap/_input-group.scss +0 -211
  142. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  143. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  144. data/assets/stylesheets/bootstrap/_print.scss +0 -132
  145. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -23
  146. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  147. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  148. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -80
  149. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  150. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -11
  151. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -34
  152. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  153. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  154. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -17
  155. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  156. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  157. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  158. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  159. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  160. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  161. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  162. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  163. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  164. data/assets/stylesheets/bootstrap/utilities/_interactions.scss +0 -5
  165. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  166. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  167. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  168. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  169. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  170. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  171. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  172. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  173. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  174. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  175. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,22 +1,22 @@
1
- // stylelint-disable property-blacklist, scss/dollar-variable-default
1
+ // stylelint-disable scss/dimension-no-non-numeric-values
2
2
 
3
3
  // SCSS RFS mixin
4
4
  //
5
- // Automated responsive font sizes
5
+ // Automated responsive values for font sizes, paddings, margins and much more
6
6
  //
7
- // Licensed under MIT (https://github.com/twbs/rfs/blob/v8.x/LICENSE)
7
+ // Licensed under MIT (https://github.com/twbs/rfs/blob/main/LICENSE)
8
8
 
9
9
  // Configuration
10
10
 
11
- // Base font size
12
- $rfs-base-font-size: 1.25rem !default;
13
- $rfs-font-size-unit: rem !default;
11
+ // Base value
12
+ $rfs-base-value: 1.25rem !default;
13
+ $rfs-unit: rem !default;
14
14
 
15
- @if $rfs-font-size-unit != rem and $rfs-font-size-unit != px {
16
- @error "`#{$rfs-font-size-unit}` is not a valid unit for $rfs-font-size-unit. Use `px` or `rem`.";
15
+ @if $rfs-unit != rem and $rfs-unit != px {
16
+ @error "`#{$rfs-unit}` is not a valid unit for $rfs-unit. Use `px` or `rem`.";
17
17
  }
18
18
 
19
- // Breakpoint at where font-size starts decreasing if screen width is smaller
19
+ // Breakpoint at where values start decreasing if screen width is smaller
20
20
  $rfs-breakpoint: 1200px !default;
21
21
  $rfs-breakpoint-unit: px !default;
22
22
 
@@ -24,16 +24,19 @@ $rfs-breakpoint-unit: px !default;
24
24
  @error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
25
25
  }
26
26
 
27
- // Resize font size based on screen height and width
27
+ // Resize values based on screen height and width
28
28
  $rfs-two-dimensional: false !default;
29
29
 
30
30
  // Factor of decrease
31
31
  $rfs-factor: 10 !default;
32
32
 
33
- @if type-of($rfs-factor) != "number" or $rfs-factor <= 1 {
33
+ @if type-of($rfs-factor) != number or $rfs-factor <= 1 {
34
34
  @error "`#{$rfs-factor}` is not a valid $rfs-factor, it must be greater than 1.";
35
35
  }
36
36
 
37
+ // Mode. Possibilities: "min-media-query", "max-media-query"
38
+ $rfs-mode: min-media-query !default;
39
+
37
40
  // Generate enable or disable classes. Possibilities: false, "enable" or "disable"
38
41
  $rfs-class: false !default;
39
42
 
@@ -43,11 +46,11 @@ $rfs-rem-value: 16 !default;
43
46
  // Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
44
47
  $rfs-safari-iframe-resize-bug-fix: false !default;
45
48
 
46
- // Disable RFS by setting $enable-responsive-font-sizes to false
47
- $enable-responsive-font-sizes: true !default;
49
+ // Disable RFS by setting $enable-rfs to false
50
+ $enable-rfs: true !default;
48
51
 
49
- // Cache $rfs-base-font-size unit
50
- $rfs-base-font-size-unit: unit($rfs-base-font-size);
52
+ // Cache $rfs-base-value unit
53
+ $rfs-base-value-unit: unit($rfs-base-value);
51
54
 
52
55
  @function divide($dividend, $divisor, $precision: 10) {
53
56
  $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
@@ -91,138 +94,255 @@ $rfs-base-font-size-unit: unit($rfs-base-font-size);
91
94
  @return $result;
92
95
  }
93
96
 
94
- // Remove px-unit from $rfs-base-font-size for calculations
95
- @if $rfs-base-font-size-unit == "px" {
96
- $rfs-base-font-size: divide($rfs-base-font-size, $rfs-base-font-size * 0 + 1);
97
+ // Remove px-unit from $rfs-base-value for calculations
98
+ @if $rfs-base-value-unit == px {
99
+ $rfs-base-value: divide($rfs-base-value, $rfs-base-value * 0 + 1);
97
100
  }
98
- @else if $rfs-base-font-size-unit == "rem" {
99
- $rfs-base-font-size: divide($rfs-base-font-size, divide($rfs-base-font-size * 0 + 1, $rfs-rem-value));
101
+ @else if $rfs-base-value-unit == rem {
102
+ $rfs-base-value: divide($rfs-base-value, divide($rfs-base-value * 0 + 1, $rfs-rem-value));
100
103
  }
101
104
 
102
105
  // Cache $rfs-breakpoint unit to prevent multiple calls
103
106
  $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
104
107
 
105
108
  // Remove unit from $rfs-breakpoint for calculations
106
- @if $rfs-breakpoint-unit-cache == "px" {
109
+ @if $rfs-breakpoint-unit-cache == px {
107
110
  $rfs-breakpoint: divide($rfs-breakpoint, $rfs-breakpoint * 0 + 1);
108
111
  }
109
- @else if $rfs-breakpoint-unit-cache == "rem" or $rfs-breakpoint-unit-cache == "em" {
112
+ @else if $rfs-breakpoint-unit-cache == rem or $rfs-breakpoint-unit-cache == "em" {
110
113
  $rfs-breakpoint: divide($rfs-breakpoint, divide($rfs-breakpoint * 0 + 1, $rfs-rem-value));
111
114
  }
112
115
 
113
- // Internal mixin that adds disable classes to the selector if needed.
114
- @mixin _rfs-disable-class {
115
- @if $rfs-class == "disable" {
116
- // Adding an extra class increases specificity, which prevents the media query to override the font size
117
- &,
118
- .disable-responsive-font-size &,
119
- &.disable-responsive-font-size {
120
- @content;
116
+ // Calculate the media query value
117
+ $rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{divide($rfs-breakpoint, $rfs-rem-value)}#{$rfs-breakpoint-unit});
118
+ $rfs-mq-property-width: if($rfs-mode == max-media-query, max-width, min-width);
119
+ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height);
120
+
121
+ // Internal mixin used to determine which media query needs to be used
122
+ @mixin _rfs-media-query {
123
+ @if $rfs-two-dimensional {
124
+ @if $rfs-mode == max-media-query {
125
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
126
+ @content;
127
+ }
128
+ }
129
+ @else {
130
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) and (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
131
+ @content;
132
+ }
121
133
  }
122
134
  }
123
135
  @else {
124
- @content;
136
+ @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
137
+ @content;
138
+ }
125
139
  }
126
140
  }
127
141
 
128
- // Internal mixin that adds enable classes to the selector if needed.
129
- @mixin _rfs-enable-class {
130
- @if $rfs-class == "enable" {
131
- .enable-responsive-font-size &,
132
- &.enable-responsive-font-size {
142
+ // Internal mixin that adds disable classes to the selector if needed.
143
+ @mixin _rfs-rule {
144
+ @if $rfs-class == disable and $rfs-mode == max-media-query {
145
+ // Adding an extra class increases specificity, which prevents the media query to override the property
146
+ &,
147
+ .disable-rfs &,
148
+ &.disable-rfs {
133
149
  @content;
134
150
  }
135
151
  }
136
- @else {
152
+ @else if $rfs-class == enable and $rfs-mode == min-media-query {
153
+ .enable-rfs &,
154
+ &.enable-rfs {
155
+ @content;
156
+ }
157
+ } @else {
137
158
  @content;
138
159
  }
139
160
  }
140
161
 
141
- // Internal mixin used to determine which media query needs to be used
142
- @mixin _rfs-media-query($mq-value) {
143
- @if $rfs-two-dimensional {
144
- @media (max-width: #{$mq-value}), (max-height: #{$mq-value}) {
162
+ // Internal mixin that adds enable classes to the selector if needed.
163
+ @mixin _rfs-media-query-rule {
164
+
165
+ @if $rfs-class == enable {
166
+ @if $rfs-mode == min-media-query {
145
167
  @content;
146
168
  }
169
+
170
+ @include _rfs-media-query () {
171
+ .enable-rfs &,
172
+ &.enable-rfs {
173
+ @content;
174
+ }
175
+ }
147
176
  }
148
177
  @else {
149
- @media (max-width: #{$mq-value}) {
178
+ @if $rfs-class == disable and $rfs-mode == min-media-query {
179
+ .disable-rfs &,
180
+ &.disable-rfs {
181
+ @content;
182
+ }
183
+ }
184
+ @include _rfs-media-query () {
150
185
  @content;
151
186
  }
152
187
  }
153
188
  }
154
189
 
155
- // Responsive font size mixin
156
- @mixin rfs($fs, $important: false) {
157
- // Cache $fs unit
158
- $fs-unit: if(type-of($fs) == "number", unit($fs), false);
190
+ // Helper function to get the formatted non-responsive value
191
+ @function rfs-value($values) {
192
+ // Convert to list
193
+ $values: if(type-of($values) != list, ($values,), $values);
159
194
 
160
- // Add !important suffix if needed
161
- $rfs-suffix: if($important, " !important", "");
195
+ $val: "";
162
196
 
163
- // If $fs isn't a number (like inherit) or $fs has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
164
- @if not $fs-unit or $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0 {
165
- font-size: #{$fs}#{$rfs-suffix};
166
- }
167
- @else {
168
- // Remove unit from $fs for calculations
169
- @if $fs-unit == "px" {
170
- $fs: divide($fs, $fs * 0 + 1);
197
+ // Loop over each value and calculate value
198
+ @each $value in $values {
199
+ @if $value == 0 {
200
+ $val: $val + " 0";
171
201
  }
172
- @else if $fs-unit == "rem" {
173
- $fs: divide($fs, divide($fs * 0 + 1, $rfs-rem-value));
174
- }
175
-
176
- // Set default font size
177
- $rfs-static: if($rfs-font-size-unit == rem, #{divide($fs, $rfs-rem-value)}rem, #{$fs}px);
202
+ @else {
203
+ // Cache $value unit
204
+ $unit: if(type-of($value) == "number", unit($value), false);
178
205
 
179
- // Only add the media query if the font size is bigger than the minimum font size
180
- @if $fs <= $rfs-base-font-size or not $enable-responsive-font-sizes {
181
- font-size: #{$rfs-static}#{$rfs-suffix};
206
+ @if $unit == px {
207
+ // Convert to rem if needed
208
+ $val: $val + " " + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value);
209
+ }
210
+ @else if $unit == rem {
211
+ // Convert to px if needed
212
+ $val: $val + " " + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value);
213
+ } @else {
214
+ // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
215
+ $val: $val + " " + $value;
216
+ }
182
217
  }
183
- @else {
184
- // Calculate the minimum font size for $fs
185
- $fs-min: $rfs-base-font-size + divide($fs - $rfs-base-font-size, $rfs-factor);
218
+ }
186
219
 
187
- // Calculate difference between $fs and the minimum font size
188
- $fs-diff: $fs - $fs-min;
220
+ // Remove first space
221
+ @return unquote(str-slice($val, 2));
222
+ }
189
223
 
190
- // Base font-size formatting
191
- $min-width: if($rfs-font-size-unit == rem, #{divide($fs-min, $rfs-rem-value)}rem, #{$fs-min}px);
224
+ // Helper function to get the responsive value calculated by RFS
225
+ @function rfs-fluid-value($values) {
226
+ // Convert to list
227
+ $values: if(type-of($values) != list, ($values,), $values);
228
+
229
+ $val: "";
230
+
231
+ // Loop over each value and calculate value
232
+ @each $value in $values {
233
+ @if $value == 0 {
234
+ $val: $val + " 0";
235
+ } @else {
236
+ // Cache $value unit
237
+ $unit: if(type-of($value) == "number", unit($value), false);
238
+
239
+ // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
240
+ @if not $unit or $unit != px and $unit != rem {
241
+ $val: $val + " " + $value;
242
+ } @else {
243
+ // Remove unit from $value for calculations
244
+ $value: divide($value, $value * 0 + if($unit == px, 1, divide(1, $rfs-rem-value)));
245
+
246
+ // Only add the media query if the value is greater than the minimum value
247
+ @if abs($value) <= $rfs-base-value or not $enable-rfs {
248
+ $val: $val + " " + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px);
249
+ }
250
+ @else {
251
+ // Calculate the minimum value
252
+ $value-min: $rfs-base-value + divide(abs($value) - $rfs-base-value, $rfs-factor);
192
253
 
193
- // Use `vmin` if two-dimensional is enabled
194
- $variable-unit: if($rfs-two-dimensional, vmin, vw);
254
+ // Calculate difference between $value and the minimum value
255
+ $value-diff: abs($value) - $value-min;
195
256
 
196
- // Calculate the variable width between 0 and $rfs-breakpoint
197
- $variable-width: #{divide($fs-diff * 100, $rfs-breakpoint)}#{$variable-unit};
257
+ // Base value formatting
258
+ $min-width: if($rfs-unit == rem, #{divide($value-min, $rfs-rem-value)}rem, #{$value-min}px);
198
259
 
199
- // Set the calculated font-size
200
- $rfs-fluid: calc(#{$min-width} + #{$variable-width}) #{$rfs-suffix};
260
+ // Use negative value if needed
261
+ $min-width: if($value < 0, -$min-width, $min-width);
201
262
 
202
- // Breakpoint formatting
203
- $mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{divide($rfs-breakpoint, $rfs-rem-value)}#{$rfs-breakpoint-unit});
263
+ // Use `vmin` if two-dimensional is enabled
264
+ $variable-unit: if($rfs-two-dimensional, vmin, vw);
204
265
 
205
- @include _rfs-disable-class {
206
- font-size: #{$rfs-static}#{$rfs-suffix};
207
- }
266
+ // Calculate the variable width between 0 and $rfs-breakpoint
267
+ $variable-width: #{divide($value-diff * 100, $rfs-breakpoint)}#{$variable-unit};
208
268
 
209
- @include _rfs-media-query($mq-value) {
210
- @include _rfs-enable-class {
211
- font-size: $rfs-fluid;
269
+ // Return the calculated value
270
+ $val: $val + " calc(" + $min-width + if($value < 0, " - ", " + ") + $variable-width + ")";
212
271
  }
272
+ }
273
+ }
274
+ }
275
+
276
+ // Remove first space
277
+ @return unquote(str-slice($val, 2));
278
+ }
279
+
280
+ // RFS mixin
281
+ @mixin rfs($values, $property: font-size) {
282
+ @if $values != null {
283
+ $val: rfs-value($values);
284
+ $fluid-val: rfs-fluid-value($values);
285
+
286
+ // Do not print the media query if responsive & non-responsive values are the same
287
+ @if $val == $fluid-val {
288
+ #{$property}: $val;
289
+ }
290
+ @else {
291
+ @include _rfs-rule () {
292
+ #{$property}: if($rfs-mode == max-media-query, $val, $fluid-val);
213
293
 
214
294
  // Include safari iframe resize fix if needed
215
295
  min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
216
296
  }
297
+
298
+ @include _rfs-media-query-rule () {
299
+ #{$property}: if($rfs-mode == max-media-query, $fluid-val, $val);
300
+ }
217
301
  }
218
302
  }
219
303
  }
220
304
 
221
- // The font-size & responsive-font-size mixins use RFS to rescale the font size
222
- @mixin font-size($fs, $important: false) {
223
- @include rfs($fs, $important);
305
+ // Shorthand helper mixins
306
+ @mixin font-size($value) {
307
+ @include rfs($value);
308
+ }
309
+
310
+ @mixin padding($value) {
311
+ @include rfs($value, padding);
312
+ }
313
+
314
+ @mixin padding-top($value) {
315
+ @include rfs($value, padding-top);
316
+ }
317
+
318
+ @mixin padding-right($value) {
319
+ @include rfs($value, padding-right);
320
+ }
321
+
322
+ @mixin padding-bottom($value) {
323
+ @include rfs($value, padding-bottom);
324
+ }
325
+
326
+ @mixin padding-left($value) {
327
+ @include rfs($value, padding-left);
328
+ }
329
+
330
+ @mixin margin($value) {
331
+ @include rfs($value, margin);
332
+ }
333
+
334
+ @mixin margin-top($value) {
335
+ @include rfs($value, margin-top);
336
+ }
337
+
338
+ @mixin margin-right($value) {
339
+ @include rfs($value, margin-right);
340
+ }
341
+
342
+ @mixin margin-bottom($value) {
343
+ @include rfs($value, margin-bottom);
224
344
  }
225
345
 
226
- @mixin responsive-font-size($fs, $important: false) {
227
- @include rfs($fs, $important);
346
+ @mixin margin-left($value) {
347
+ @include rfs($value, margin-left);
228
348
  }
data/bootstrap.gemspec CHANGED
@@ -14,14 +14,14 @@ Gem::Specification.new do |s|
14
14
  # SassC requires Ruby 2.3.3. Also specify here to make it obvious.
15
15
  s.required_ruby_version = '>= 2.3.3'
16
16
 
17
- s.add_runtime_dependency 'popper_js', '>= 1.16.1', '< 2'
17
+ s.add_runtime_dependency 'popper_js', '>= 2.11.8', '< 3'
18
18
 
19
19
  s.add_runtime_dependency 'sassc-rails', '>= 2.0.0'
20
20
  s.add_runtime_dependency 'autoprefixer-rails', '>= 9.1.0'
21
21
 
22
22
  # Testing dependencies
23
- s.add_development_dependency 'minitest', '~> 5.8.0'
24
- s.add_development_dependency 'minitest-reporters', '~> 1.0.5'
23
+ s.add_development_dependency 'minitest', '~> 5.14.4'
24
+ s.add_development_dependency 'minitest-reporters', '~> 1.4.3'
25
25
  s.add_development_dependency 'term-ansicolor'
26
26
  # Integration testing
27
27
  s.add_development_dependency 'capybara', '>= 2.6.0'
@@ -31,8 +31,6 @@ Gem::Specification.new do |s|
31
31
  s.add_development_dependency 'activesupport', '>= 4.1.5'
32
32
  s.add_development_dependency 'json', '>= 1.8.1'
33
33
  s.add_development_dependency 'sprockets-rails', '>= 2.3.2'
34
- s.add_development_dependency 'jquery-rails', '>= 3.1.0'
35
- s.add_development_dependency 'slim-rails'
36
34
  s.add_development_dependency 'uglifier'
37
35
 
38
36
  s.files = `git ls-files`.split("\n")
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootstrap
4
- VERSION = '4.6.2'
5
- BOOTSTRAP_SHA = 'e5643aaa89eb67327a5b4abe7db976f0ea276b70'
4
+ VERSION = '5.3.1'
5
+ BOOTSTRAP_SHA = '2a1bf52b73fc9a97f6fef75aa1b29b3e9f0288b3'
6
6
  end
data/tasks/updater/js.rb CHANGED
@@ -3,8 +3,7 @@ require 'tsort'
3
3
 
4
4
  class Updater
5
5
  module Js
6
- INLINED_SRCS = %w[index.js tools/sanitizer.js].freeze
7
- EXTERNAL_JS = %w[popper.js].freeze
6
+ INLINED_SRCS = %w[].freeze
8
7
 
9
8
  def update_javascript_assets
10
9
  log_status 'Updating javascripts...'
@@ -15,13 +14,26 @@ class Updater
15
14
  log_processed "#{bootstrap_js_files * ' '}"
16
15
 
17
16
  log_status 'Updating javascript manifest'
18
- manifest = ''
17
+ manifest = "//= require ./bootstrap-global-this-define\n"
19
18
  bootstrap_js_files.each do |name|
20
19
  name = name.gsub(/\.js$/, '')
21
20
  manifest << "//= require ./bootstrap/#{name}\n"
22
21
  end
22
+ manifest << "//= require ./bootstrap-global-this-undefine\n"
23
23
  dist_js = read_files('dist/js', %w(bootstrap.js bootstrap.min.js))
24
24
  {
25
+ 'assets/javascripts/bootstrap-global-this-define.js' => <<~JS,
26
+ // Set a `globalThis` so that bootstrap components are defined on window.bootstrap instead of window.
27
+ window['bootstrap'] = {
28
+ "@popperjs/core": window.Popper,
29
+ _originalGlobalThis: window['globalThis']
30
+ };
31
+ window['globalThis'] = window['bootstrap'];
32
+ JS
33
+ 'assets/javascripts/bootstrap-global-this-undefine.js' => <<~JS,
34
+ window['globalThis'] = window['bootstrap']._originalGlobalThis;
35
+ window['bootstrap']._originalGlobalThis = null;
36
+ JS
25
37
  'assets/javascripts/bootstrap-sprockets.js' => manifest,
26
38
  'assets/javascripts/bootstrap.js' => dist_js['bootstrap.js'],
27
39
  'assets/javascripts/bootstrap.min.js' => dist_js['bootstrap.min.js'],
@@ -39,9 +51,9 @@ class Updater
39
51
  # Get the imports from the ES6 files to order requires correctly.
40
52
  read_files('js/src', src_files).each do |name, content|
41
53
  file_imports = content.scan(%r{import *(?:[a-zA-Z]*|\{[a-zA-Z ,]*\}) *from '([\w/.-]+)}).flatten(1).map do |f|
42
- Pathname.new(name).dirname.join(f.end_with?(".js") ? f : "#{f}.js").cleanpath.to_s
54
+ Pathname.new(name).dirname.join(f).cleanpath.to_s
43
55
  end.uniq
44
- imports.add name, *(file_imports - INLINED_SRCS - EXTERNAL_JS)
56
+ imports.add name, *(file_imports - INLINED_SRCS)
45
57
  end
46
58
  imports.tsort
47
59
  end
@@ -44,7 +44,7 @@ class Updater
44
44
  if File.directory?(full_path)
45
45
  files.each do |name|
46
46
  path = "#{full_path}/#{name}"
47
- contents[name] = File.read(path, mode: 'rb') if File.exists?(path)
47
+ contents[name] = File.read(path, mode: 'rb') if File.exist?(path)
48
48
  end
49
49
  end
50
50
  contents
@@ -63,7 +63,7 @@ class Updater
63
63
  uri = URI(url)
64
64
  cache_path = "./#@cache_path#{uri.path}#{uri.query.tr('?&=', '-') if uri.query}"
65
65
  FileUtils.mkdir_p File.dirname(cache_path)
66
- if File.exists?(cache_path)
66
+ if File.exist?(cache_path)
67
67
  log_http_get_file url, true
68
68
  File.read(cache_path, mode: 'rb')
69
69
  else
@@ -4,7 +4,7 @@ class Updater
4
4
  log_status 'Updating scss...'
5
5
  save_to = @save_to[:scss]
6
6
  contents = {}
7
- bootstrap_scss_files = get_paths_by_type('scss', /\.scss$/)
7
+ bootstrap_scss_files = get_paths_by_type('scss', /\.scss$/).reject { |p| p.start_with?('tests/') }
8
8
  read_files('scss', bootstrap_scss_files).each do |name, file|
9
9
  contents[name] = file
10
10
  save_file("#{save_to}/#{name}", file)
data/tasks/updater.rb CHANGED
@@ -18,10 +18,10 @@ class Updater
18
18
  include Js
19
19
  include Scss
20
20
 
21
- def initialize(repo: 'twbs/bootstrap', branch: 'master', save_to: {}, cache_path: 'tmp/bootstrap-cache')
21
+ def initialize(repo: 'twbs/bootstrap', branch: 'main', save_to: {}, cache_path: 'tmp/bootstrap-cache')
22
22
  @logger = Logger.new
23
23
  @repo = repo
24
- @branch = branch || 'master'
24
+ @branch = branch || 'main'
25
25
  @branch_sha = get_branch_sha
26
26
  @cache_path = cache_path
27
27
  @repo_url = "https://github.com/#@repo"
@@ -1,7 +1,8 @@
1
- //= require jquery
2
1
  //= require popper.js
3
2
  //= require bootstrap-sprockets
4
3
 
5
- jQuery(function ($) {
6
- $('[data-toggle="tooltip"]').tooltip()
4
+ document.addEventListener('DOMContentLoaded', () => {
5
+ for (const tooltipTriggerEl of document.querySelectorAll('[data-bs-toggle="tooltip"]')) {
6
+ new bootstrap.Tooltip(tooltipTriggerEl)
7
+ }
7
8
  });
@@ -1,14 +1,16 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
4
5
  <title>bootstrap Dummy App</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
7
  <%= stylesheet_link_tag 'application', media: "all", 'data-turbolinks-track' => true %>
6
- <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
8
  <%= csrf_meta_tags %>
8
9
  </head>
9
10
 
10
11
  <body>
11
12
  <%= yield %>
13
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
12
14
  </body>
13
15
 
14
16
  </html>
@@ -0,0 +1,89 @@
1
+ <nav class="navbar navbar-expand-lg navbar-light bg-light">
2
+ <div class="container-fluid">
3
+ <a class="navbar-brand" href="#">Navbar</a>
4
+ <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
5
+ aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
6
+ <span class="navbar-toggler-icon"></span>
7
+ </button>
8
+ <div class="collapse navbar-collapse" id="navbarSupportedContent">
9
+ <ul class="navbar-nav me-auto mb-2 mb-lg-0">
10
+ <li class="nav-item">
11
+ <a class="nav-link active" aria-current="page" href="#">Home</a>
12
+ </li>
13
+ <li class="nav-item">
14
+ <a class="nav-link" href="#">Link</a>
15
+ </li>
16
+ <li class="nav-item dropdown">
17
+ <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown"
18
+ aria-expanded="false">
19
+ Dropdown
20
+ </a>
21
+ <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
22
+ <li><a class="dropdown-item" href="#">Action</a></li>
23
+ <li><a class="dropdown-item" href="#">Another action</a></li>
24
+ <li>
25
+ <hr class="dropdown-divider">
26
+ </li>
27
+ <li><a class="dropdown-item" href="#">Something else here</a></li>
28
+ </ul>
29
+ </li>
30
+ <li class="nav-item">
31
+ <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
32
+ </li>
33
+ </ul>
34
+ <form class="d-flex">
35
+ <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
36
+ <button class="btn btn-outline-success" type="submit">Search</button>
37
+ </form>
38
+ </div>
39
+ </div>
40
+ </nav>
41
+
42
+ <div class="container">
43
+ <div class="row">
44
+ <div class="card" style="width: 18rem;">
45
+ <div class="card-body">
46
+ <h5 class="card-title">Card title</h5>
47
+ <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's
48
+ content.</p>
49
+ <a href="#" class="btn btn-primary">Go somewhere</a>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ <div class="row">
54
+ <div class="col-sm">
55
+ <div class="card" style="width: 18rem;">
56
+ <ul class="list-group list-group-flush">
57
+ <li class="list-group-item">An item</li>
58
+ <li class="list-group-item">A second item</li>
59
+ <li class="list-group-item">A third item</li>
60
+ </ul>
61
+ </div>
62
+ </div>
63
+ <div class="col-sm">
64
+ <div class="btn-group" role="group" aria-label="Basic mixed styles example">
65
+ <button type="button" class="btn btn-danger">Left</button>
66
+ <button type="button" class="btn btn-warning">Middle</button>
67
+ <button type="button" class="btn btn-success">Right</button>
68
+ </div>
69
+ </div>
70
+ <div class="col-sm">
71
+ <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top"
72
+ title="Tooltip on top">
73
+ Tooltip on top
74
+ </button>
75
+ <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="right"
76
+ title="Tooltip on right">
77
+ Tooltip on right
78
+ </button>
79
+ <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom"
80
+ title="Tooltip on bottom">
81
+ Tooltip on bottom
82
+ </button>
83
+ <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="left"
84
+ title="Tooltip on left">
85
+ Tooltip on left
86
+ </button>
87
+ </div>
88
+ </div>
89
+ </div>