bootstrap 4.3.1 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +55 -0
  3. data/CHANGELOG.md +2 -14
  4. data/README.md +28 -5
  5. data/assets/javascripts/bootstrap/alert.js +54 -163
  6. data/assets/javascripts/bootstrap/base-component.js +83 -0
  7. data/assets/javascripts/bootstrap/button.js +44 -152
  8. data/assets/javascripts/bootstrap/carousel.js +289 -569
  9. data/assets/javascripts/bootstrap/collapse.js +170 -349
  10. data/assets/javascripts/bootstrap/dom/data.js +62 -0
  11. data/assets/javascripts/bootstrap/dom/event-handler.js +236 -0
  12. data/assets/javascripts/bootstrap/dom/manipulator.js +71 -0
  13. data/assets/javascripts/bootstrap/dom/selector-engine.js +103 -0
  14. data/assets/javascripts/bootstrap/dropdown.js +303 -496
  15. data/assets/javascripts/bootstrap/modal.js +229 -559
  16. data/assets/javascripts/bootstrap/offcanvas.js +245 -0
  17. data/assets/javascripts/bootstrap/popover.js +61 -226
  18. data/assets/javascripts/bootstrap/scrollspy.js +217 -317
  19. data/assets/javascripts/bootstrap/tab.js +220 -212
  20. data/assets/javascripts/bootstrap/toast.js +145 -229
  21. data/assets/javascripts/bootstrap/tooltip.js +421 -782
  22. data/assets/javascripts/bootstrap/util/backdrop.js +139 -0
  23. data/assets/javascripts/bootstrap/util/component-functions.js +41 -0
  24. data/assets/javascripts/bootstrap/util/config.js +67 -0
  25. data/assets/javascripts/bootstrap/util/focustrap.js +113 -0
  26. data/assets/javascripts/bootstrap/util/index.js +281 -0
  27. data/assets/javascripts/bootstrap/util/sanitizer.js +110 -0
  28. data/assets/javascripts/bootstrap/util/scrollbar.js +112 -0
  29. data/assets/javascripts/bootstrap/util/swipe.js +134 -0
  30. data/assets/javascripts/bootstrap/util/template-factory.js +150 -0
  31. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  32. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  33. data/assets/javascripts/bootstrap-sprockets.js +23 -7
  34. data/assets/javascripts/bootstrap.js +3690 -3639
  35. data/assets/javascripts/bootstrap.min.js +4 -4
  36. data/assets/stylesheets/_bootstrap-grid.scss +53 -20
  37. data/assets/stylesheets/_bootstrap-reboot.scss +5 -7
  38. data/assets/stylesheets/_bootstrap.scss +21 -13
  39. data/assets/stylesheets/bootstrap/_accordion.scss +158 -0
  40. data/assets/stylesheets/bootstrap/_alert.scss +32 -15
  41. data/assets/stylesheets/bootstrap/_badge.scss +15 -31
  42. data/assets/stylesheets/bootstrap/_breadcrumb.scss +23 -24
  43. data/assets/stylesheets/bootstrap/_button-group.scss +27 -48
  44. data/assets/stylesheets/bootstrap/_buttons.scss +139 -69
  45. data/assets/stylesheets/bootstrap/_card.scss +91 -141
  46. data/assets/stylesheets/bootstrap/_carousel.scss +86 -39
  47. data/assets/stylesheets/bootstrap/_close.scss +51 -29
  48. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  49. data/assets/stylesheets/bootstrap/_dropdown.scss +131 -72
  50. data/assets/stylesheets/bootstrap/_forms.scss +9 -330
  51. data/assets/stylesheets/bootstrap/_functions.scss +244 -28
  52. data/assets/stylesheets/bootstrap/_grid.scss +18 -31
  53. data/assets/stylesheets/bootstrap/_helpers.scss +12 -0
  54. data/assets/stylesheets/bootstrap/_images.scss +3 -3
  55. data/assets/stylesheets/bootstrap/_list-group.scss +101 -53
  56. data/assets/stylesheets/bootstrap/_maps.scss +174 -0
  57. data/assets/stylesheets/bootstrap/_mixins.scss +13 -18
  58. data/assets/stylesheets/bootstrap/_modal.scss +120 -112
  59. data/assets/stylesheets/bootstrap/_nav.scss +113 -24
  60. data/assets/stylesheets/bootstrap/_navbar.scss +145 -150
  61. data/assets/stylesheets/bootstrap/_offcanvas.scss +146 -0
  62. data/assets/stylesheets/bootstrap/_pagination.scss +74 -38
  63. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  64. data/assets/stylesheets/bootstrap/_popover.scss +99 -74
  65. data/assets/stylesheets/bootstrap/_progress.scss +40 -15
  66. data/assets/stylesheets/bootstrap/_reboot.scss +342 -215
  67. data/assets/stylesheets/bootstrap/_root.scss +174 -9
  68. data/assets/stylesheets/bootstrap/_spinners.scss +52 -22
  69. data/assets/stylesheets/bootstrap/_tables.scss +101 -115
  70. data/assets/stylesheets/bootstrap/_toasts.scss +54 -25
  71. data/assets/stylesheets/bootstrap/_tooltip.scss +67 -63
  72. data/assets/stylesheets/bootstrap/_transitions.scss +8 -1
  73. data/assets/stylesheets/bootstrap/_type.scss +42 -61
  74. data/assets/stylesheets/bootstrap/_utilities.scss +806 -17
  75. data/assets/stylesheets/bootstrap/_variables-dark.scss +85 -0
  76. data/assets/stylesheets/bootstrap/_variables.scss +1235 -615
  77. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +19 -0
  78. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +94 -0
  79. data/assets/stylesheets/bootstrap/forms/_form-check.scss +188 -0
  80. data/assets/stylesheets/bootstrap/forms/_form-control.scss +214 -0
  81. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  82. data/assets/stylesheets/bootstrap/forms/_form-select.scss +80 -0
  83. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  84. data/assets/stylesheets/bootstrap/forms/_input-group.scss +132 -0
  85. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  86. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  87. data/assets/stylesheets/bootstrap/helpers/_color-bg.scss +8 -0
  88. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +30 -0
  89. data/assets/stylesheets/bootstrap/helpers/_focus-ring.scss +5 -0
  90. data/assets/stylesheets/bootstrap/helpers/_icon-link.scss +25 -0
  91. data/assets/stylesheets/bootstrap/helpers/_position.scss +36 -0
  92. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  93. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  94. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  95. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  96. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  97. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  98. data/assets/stylesheets/bootstrap/mixins/_alert.scss +11 -6
  99. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  100. data/assets/stylesheets/bootstrap/mixins/_banner.scss +7 -0
  101. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +37 -22
  102. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  103. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +20 -16
  104. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +60 -97
  105. data/assets/stylesheets/bootstrap/mixins/_caret.scss +34 -27
  106. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  107. data/assets/stylesheets/bootstrap/mixins/_color-mode.scss +21 -0
  108. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  109. data/assets/stylesheets/bootstrap/mixins/_container.scss +11 -0
  110. data/assets/stylesheets/bootstrap/mixins/_forms.scss +77 -116
  111. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  112. data/assets/stylesheets/bootstrap/mixins/_grid.scss +133 -33
  113. data/assets/stylesheets/bootstrap/mixins/_image.scss +0 -20
  114. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +7 -2
  115. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +7 -19
  116. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
  117. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +24 -0
  118. data/assets/stylesheets/bootstrap/mixins/_transition.scss +18 -8
  119. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +97 -0
  120. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +33 -0
  121. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  122. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +276 -132
  123. data/bootstrap.gemspec +4 -6
  124. data/lib/bootstrap/version.rb +2 -2
  125. data/tasks/updater/js.rb +31 -7
  126. data/tasks/updater/network.rb +10 -4
  127. data/tasks/updater/scss.rb +1 -1
  128. data/tasks/updater.rb +2 -2
  129. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  130. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  131. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  132. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  133. data/test/dummy_rails/app/views/pages/root.html +89 -0
  134. data/test/dummy_rails/config/application.rb +0 -3
  135. data/test/gemfiles/rails_5_2.gemfile +8 -0
  136. data/test/gemfiles/rails_6_0.gemfile +7 -0
  137. data/test/gemfiles/rails_6_1.gemfile +7 -0
  138. data/test/gemfiles/rails_7_0.gemfile +7 -0
  139. data/test/support/dummy_rails_integration.rb +3 -1
  140. data/test/test_helper.rb +18 -12
  141. metadata +86 -84
  142. data/.travis.yml +0 -17
  143. data/assets/javascripts/bootstrap/util.js +0 -171
  144. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  145. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -507
  146. data/assets/stylesheets/bootstrap/_input-group.scss +0 -193
  147. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  148. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  149. data/assets/stylesheets/bootstrap/_print.scss +0 -141
  150. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -21
  151. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  152. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  153. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -66
  154. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  155. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -10
  156. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -33
  157. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  158. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  159. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -16
  160. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  161. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  162. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  163. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  164. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  165. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  166. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  167. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  168. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  169. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  170. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  171. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  172. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  173. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  174. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  175. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  176. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  177. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  178. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  179. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -1,330 +1,9 @@
1
- // stylelint-disable selector-no-qualifying-type
2
-
3
- //
4
- // Textual form controls
5
- //
6
-
7
- .form-control {
8
- display: block;
9
- width: 100%;
10
- height: $input-height;
11
- padding: $input-padding-y $input-padding-x;
12
- font-family: $input-font-family;
13
- @include font-size($input-font-size);
14
- font-weight: $input-font-weight;
15
- line-height: $input-line-height;
16
- color: $input-color;
17
- background-color: $input-bg;
18
- background-clip: padding-box;
19
- border: $input-border-width solid $input-border-color;
20
-
21
- // Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
22
- @include border-radius($input-border-radius, 0);
23
-
24
- @include box-shadow($input-box-shadow);
25
- @include transition($input-transition);
26
-
27
- // Unstyle the caret on `<select>`s in IE10+.
28
- &::-ms-expand {
29
- background-color: transparent;
30
- border: 0;
31
- }
32
-
33
- // Customize the `:focus` state to imitate native WebKit styles.
34
- @include form-control-focus();
35
-
36
- // Placeholder
37
- &::placeholder {
38
- color: $input-placeholder-color;
39
- // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526.
40
- opacity: 1;
41
- }
42
-
43
- // Disabled and read-only inputs
44
- //
45
- // HTML5 says that controls under a fieldset > legend:first-child won't be
46
- // disabled if the fieldset is disabled. Due to implementation difficulty, we
47
- // don't honor that edge case; we style them as disabled anyway.
48
- &:disabled,
49
- &[readonly] {
50
- background-color: $input-disabled-bg;
51
- // iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
52
- opacity: 1;
53
- }
54
- }
55
-
56
- select.form-control {
57
- &:focus::-ms-value {
58
- // Suppress the nested default white text on blue background highlight given to
59
- // the selected option text when the (still closed) <select> receives focus
60
- // in IE and (under certain conditions) Edge, as it looks bad and cannot be made to
61
- // match the appearance of the native widget.
62
- // See https://github.com/twbs/bootstrap/issues/19398.
63
- color: $input-color;
64
- background-color: $input-bg;
65
- }
66
- }
67
-
68
- // Make file inputs better match text inputs by forcing them to new lines.
69
- .form-control-file,
70
- .form-control-range {
71
- display: block;
72
- width: 100%;
73
- }
74
-
75
-
76
- //
77
- // Labels
78
- //
79
-
80
- // For use with horizontal and inline forms, when you need the label (or legend)
81
- // text to align with the form controls.
82
- .col-form-label {
83
- padding-top: calc(#{$input-padding-y} + #{$input-border-width});
84
- padding-bottom: calc(#{$input-padding-y} + #{$input-border-width});
85
- margin-bottom: 0; // Override the `<label>/<legend>` default
86
- @include font-size(inherit); // Override the `<legend>` default
87
- line-height: $input-line-height;
88
- }
89
-
90
- .col-form-label-lg {
91
- padding-top: calc(#{$input-padding-y-lg} + #{$input-border-width});
92
- padding-bottom: calc(#{$input-padding-y-lg} + #{$input-border-width});
93
- @include font-size($input-font-size-lg);
94
- line-height: $input-line-height-lg;
95
- }
96
-
97
- .col-form-label-sm {
98
- padding-top: calc(#{$input-padding-y-sm} + #{$input-border-width});
99
- padding-bottom: calc(#{$input-padding-y-sm} + #{$input-border-width});
100
- @include font-size($input-font-size-sm);
101
- line-height: $input-line-height-sm;
102
- }
103
-
104
-
105
- // Readonly controls as plain text
106
- //
107
- // Apply class to a readonly input to make it appear like regular plain
108
- // text (without any border, background color, focus indicator)
109
-
110
- .form-control-plaintext {
111
- display: block;
112
- width: 100%;
113
- padding-top: $input-padding-y;
114
- padding-bottom: $input-padding-y;
115
- margin-bottom: 0; // match inputs if this class comes on inputs with default margins
116
- line-height: $input-line-height;
117
- color: $input-plaintext-color;
118
- background-color: transparent;
119
- border: solid transparent;
120
- border-width: $input-border-width 0;
121
-
122
- &.form-control-sm,
123
- &.form-control-lg {
124
- padding-right: 0;
125
- padding-left: 0;
126
- }
127
- }
128
-
129
-
130
- // Form control sizing
131
- //
132
- // Build on `.form-control` with modifier classes to decrease or increase the
133
- // height and font-size of form controls.
134
- //
135
- // Repeated in `_input_group.scss` to avoid Sass extend issues.
136
-
137
- .form-control-sm {
138
- height: $input-height-sm;
139
- padding: $input-padding-y-sm $input-padding-x-sm;
140
- @include font-size($input-font-size-sm);
141
- line-height: $input-line-height-sm;
142
- @include border-radius($input-border-radius-sm);
143
- }
144
-
145
- .form-control-lg {
146
- height: $input-height-lg;
147
- padding: $input-padding-y-lg $input-padding-x-lg;
148
- @include font-size($input-font-size-lg);
149
- line-height: $input-line-height-lg;
150
- @include border-radius($input-border-radius-lg);
151
- }
152
-
153
- // stylelint-disable-next-line no-duplicate-selectors
154
- select.form-control {
155
- &[size],
156
- &[multiple] {
157
- height: auto;
158
- }
159
- }
160
-
161
- textarea.form-control {
162
- height: auto;
163
- }
164
-
165
- // Form groups
166
- //
167
- // Designed to help with the organization and spacing of vertical forms. For
168
- // horizontal forms, use the predefined grid classes.
169
-
170
- .form-group {
171
- margin-bottom: $form-group-margin-bottom;
172
- }
173
-
174
- .form-text {
175
- display: block;
176
- margin-top: $form-text-margin-top;
177
- }
178
-
179
-
180
- // Form grid
181
- //
182
- // Special replacement for our grid system's `.row` for tighter form layouts.
183
-
184
- .form-row {
185
- display: flex;
186
- flex-wrap: wrap;
187
- margin-right: -$form-grid-gutter-width / 2;
188
- margin-left: -$form-grid-gutter-width / 2;
189
-
190
- > .col,
191
- > [class*="col-"] {
192
- padding-right: $form-grid-gutter-width / 2;
193
- padding-left: $form-grid-gutter-width / 2;
194
- }
195
- }
196
-
197
-
198
- // Checkboxes and radios
199
- //
200
- // Indent the labels to position radios/checkboxes as hanging controls.
201
-
202
- .form-check {
203
- position: relative;
204
- display: block;
205
- padding-left: $form-check-input-gutter;
206
- }
207
-
208
- .form-check-input {
209
- position: absolute;
210
- margin-top: $form-check-input-margin-y;
211
- margin-left: -$form-check-input-gutter;
212
-
213
- &:disabled ~ .form-check-label {
214
- color: $text-muted;
215
- }
216
- }
217
-
218
- .form-check-label {
219
- margin-bottom: 0; // Override default `<label>` bottom margin
220
- }
221
-
222
- .form-check-inline {
223
- display: inline-flex;
224
- align-items: center;
225
- padding-left: 0; // Override base .form-check
226
- margin-right: $form-check-inline-margin-x;
227
-
228
- // Undo .form-check-input defaults and add some `margin-right`.
229
- .form-check-input {
230
- position: static;
231
- margin-top: 0;
232
- margin-right: $form-check-inline-input-margin-x;
233
- margin-left: 0;
234
- }
235
- }
236
-
237
-
238
- // Form validation
239
- //
240
- // Provide feedback to users when form field values are valid or invalid. Works
241
- // primarily for client-side validation via scoped `:invalid` and `:valid`
242
- // pseudo-classes but also includes `.is-invalid` and `.is-valid` classes for
243
- // server side validation.
244
-
245
- @each $state, $data in $form-validation-states {
246
- @include form-validation-state($state, map-get($data, color), map-get($data, icon));
247
- }
248
-
249
- // Inline forms
250
- //
251
- // Make forms appear inline(-block) by adding the `.form-inline` class. Inline
252
- // forms begin stacked on extra small (mobile) devices and then go inline when
253
- // viewports reach <768px.
254
- //
255
- // Requires wrapping inputs and labels with `.form-group` for proper display of
256
- // default HTML form controls and our custom form controls (e.g., input groups).
257
-
258
- .form-inline {
259
- display: flex;
260
- flex-flow: row wrap;
261
- align-items: center; // Prevent shorter elements from growing to same height as others (e.g., small buttons growing to normal sized button height)
262
-
263
- // Because we use flex, the initial sizing of checkboxes is collapsed and
264
- // doesn't occupy the full-width (which is what we want for xs grid tier),
265
- // so we force that here.
266
- .form-check {
267
- width: 100%;
268
- }
269
-
270
- // Kick in the inline
271
- @include media-breakpoint-up(sm) {
272
- label {
273
- display: flex;
274
- align-items: center;
275
- justify-content: center;
276
- margin-bottom: 0;
277
- }
278
-
279
- // Inline-block all the things for "inline"
280
- .form-group {
281
- display: flex;
282
- flex: 0 0 auto;
283
- flex-flow: row wrap;
284
- align-items: center;
285
- margin-bottom: 0;
286
- }
287
-
288
- // Allow folks to *not* use `.form-group`
289
- .form-control {
290
- display: inline-block;
291
- width: auto; // Prevent labels from stacking above inputs in `.form-group`
292
- vertical-align: middle;
293
- }
294
-
295
- // Make static controls behave like regular ones
296
- .form-control-plaintext {
297
- display: inline-block;
298
- }
299
-
300
- .input-group,
301
- .custom-select {
302
- width: auto;
303
- }
304
-
305
- // Remove default margin on radios/checkboxes that were used for stacking, and
306
- // then undo the floating of radios and checkboxes to match.
307
- .form-check {
308
- display: flex;
309
- align-items: center;
310
- justify-content: center;
311
- width: auto;
312
- padding-left: 0;
313
- }
314
- .form-check-input {
315
- position: relative;
316
- flex-shrink: 0;
317
- margin-top: 0;
318
- margin-right: $form-check-input-margin-x;
319
- margin-left: 0;
320
- }
321
-
322
- .custom-control {
323
- align-items: center;
324
- justify-content: center;
325
- }
326
- .custom-control-label {
327
- margin-bottom: 0;
328
- }
329
- }
330
- }
1
+ @import "forms/labels";
2
+ @import "forms/form-text";
3
+ @import "forms/form-control";
4
+ @import "forms/form-select";
5
+ @import "forms/form-check";
6
+ @import "forms/form-range";
7
+ @import "forms/floating-labels";
8
+ @import "forms/input-group";
9
+ @import "forms/validation";
@@ -8,7 +8,7 @@
8
8
  $prev-key: null;
9
9
  $prev-num: null;
10
10
  @each $key, $num in $map {
11
- @if $prev-num == null or unit($num) == "%" {
11
+ @if $prev-num == null or unit($num) == "%" or unit($prev-num) == "%" {
12
12
  // Do nothing
13
13
  } @else if not comparable($prev-num, $num) {
14
14
  @warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
@@ -23,17 +23,93 @@
23
23
  // Starts at zero
24
24
  // Used to ensure the min-width of the lowest breakpoint starts at 0.
25
25
  @mixin _assert-starts-at-zero($map, $map-name: "$grid-breakpoints") {
26
- $values: map-values($map);
27
- $first-value: nth($values, 1);
28
- @if $first-value != 0 {
29
- @warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
26
+ @if length($map) > 0 {
27
+ $values: map-values($map);
28
+ $first-value: nth($values, 1);
29
+ @if $first-value != 0 {
30
+ @warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
31
+ }
32
+ }
33
+ }
34
+
35
+ // Colors
36
+ @function to-rgb($value) {
37
+ @return red($value), green($value), blue($value);
38
+ }
39
+
40
+ // stylelint-disable scss/dollar-variable-pattern
41
+ @function rgba-css-var($identifier, $target) {
42
+ @if $identifier == "body" and $target == "bg" {
43
+ @return rgba(var(--#{$prefix}#{$identifier}-bg-rgb), var(--#{$prefix}#{$target}-opacity));
44
+ } @if $identifier == "body" and $target == "text" {
45
+ @return rgba(var(--#{$prefix}#{$identifier}-color-rgb), var(--#{$prefix}#{$target}-opacity));
46
+ } @else {
47
+ @return rgba(var(--#{$prefix}#{$identifier}-rgb), var(--#{$prefix}#{$target}-opacity));
48
+ }
49
+ }
50
+
51
+ @function map-loop($map, $func, $args...) {
52
+ $_map: ();
53
+
54
+ @each $key, $value in $map {
55
+ // allow to pass the $key and $value of the map as an function argument
56
+ $_args: ();
57
+ @each $arg in $args {
58
+ $_args: append($_args, if($arg == "$key", $key, if($arg == "$value", $value, $arg)));
59
+ }
60
+
61
+ $_map: map-merge($_map, ($key: call(get-function($func), $_args...)));
62
+ }
63
+
64
+ @return $_map;
65
+ }
66
+ // stylelint-enable scss/dollar-variable-pattern
67
+
68
+ @function varify($list) {
69
+ $result: null;
70
+ @each $entry in $list {
71
+ $result: append($result, var(--#{$prefix}#{$entry}), space);
30
72
  }
73
+ @return $result;
74
+ }
75
+
76
+ // Internal Bootstrap function to turn maps into its negative variant.
77
+ // It prefixes the keys with `n` and makes the value negative.
78
+ @function negativify-map($map) {
79
+ $result: ();
80
+ @each $key, $value in $map {
81
+ @if $key != 0 {
82
+ $result: map-merge($result, ("n" + $key: (-$value)));
83
+ }
84
+ }
85
+ @return $result;
86
+ }
87
+
88
+ // Get multiple keys from a sass map
89
+ @function map-get-multiple($map, $values) {
90
+ $result: ();
91
+ @each $key, $value in $map {
92
+ @if (index($values, $key) != null) {
93
+ $result: map-merge($result, ($key: $value));
94
+ }
95
+ }
96
+ @return $result;
97
+ }
98
+
99
+ // Merge multiple maps
100
+ @function map-merge-multiple($maps...) {
101
+ $merged-maps: ();
102
+
103
+ @each $map in $maps {
104
+ $merged-maps: map-merge($merged-maps, $map);
105
+ }
106
+ @return $merged-maps;
31
107
  }
32
108
 
33
109
  // Replace `$search` with `$replace` in `$string`
34
110
  // Used on our SVG icon backgrounds for custom forms.
35
111
  //
36
- // @author Hugo Giraudel
112
+ // @author Kitty Giraudel
37
113
  // @param {String} $string - Initial string
38
114
  // @param {String} $search - Substring to replace
39
115
  // @param {String} $replace ('') - New value
@@ -48,39 +124,179 @@
48
124
  @return $string;
49
125
  }
50
126
 
127
+ // See https://codepen.io/kevinweber/pen/dXWoRw
128
+ //
129
+ // Requires the use of quotes around data URIs.
130
+
131
+ @function escape-svg($string) {
132
+ @if str-index($string, "data:image/svg+xml") {
133
+ @each $char, $encoded in $escaped-characters {
134
+ // Do not escape the url brackets
135
+ @if str-index($string, "url(") == 1 {
136
+ $string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
137
+ } @else {
138
+ $string: str-replace($string, $char, $encoded);
139
+ }
140
+ }
141
+ }
142
+
143
+ @return $string;
144
+ }
145
+
51
146
  // Color contrast
52
- @function color-yiq($color, $dark: $yiq-text-dark, $light: $yiq-text-light) {
53
- $r: red($color);
54
- $g: green($color);
55
- $b: blue($color);
147
+ // See https://github.com/twbs/bootstrap/pull/30168
56
148
 
57
- $yiq: (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
149
+ // A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
150
+ // stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
151
+ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
58
152
 
59
- @if ($yiq >= $yiq-contrasted-threshold) {
60
- @return $dark;
61
- } @else {
62
- @return $light;
153
+ @function color-contrast($background, $color-contrast-dark: $color-contrast-dark, $color-contrast-light: $color-contrast-light, $min-contrast-ratio: $min-contrast-ratio) {
154
+ $foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black;
155
+ $max-ratio: 0;
156
+ $max-ratio-color: null;
157
+
158
+ @each $color in $foregrounds {
159
+ $contrast-ratio: contrast-ratio($background, $color);
160
+ @if $contrast-ratio > $min-contrast-ratio {
161
+ @return $color;
162
+ } @else if $contrast-ratio > $max-ratio {
163
+ $max-ratio: $contrast-ratio;
164
+ $max-ratio-color: $color;
165
+ }
63
166
  }
167
+
168
+ @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}...";
169
+
170
+ @return $max-ratio-color;
171
+ }
172
+
173
+ @function contrast-ratio($background, $foreground: $color-contrast-light) {
174
+ $l1: luminance($background);
175
+ $l2: luminance(opaque($background, $foreground));
176
+
177
+ @return if($l1 > $l2, divide($l1 + .05, $l2 + .05), divide($l2 + .05, $l1 + .05));
64
178
  }
65
179
 
66
- // Retrieve color Sass maps
67
- @function color($key: "blue") {
68
- @return map-get($colors, $key);
180
+ // Return WCAG2.1 relative luminance
181
+ // See https://www.w3.org/TR/WCAG/#dfn-relative-luminance
182
+ // See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
183
+ @function luminance($color) {
184
+ $rgb: (
185
+ "r": red($color),
186
+ "g": green($color),
187
+ "b": blue($color)
188
+ );
189
+
190
+ @each $name, $value in $rgb {
191
+ $value: if(divide($value, 255) < .04045, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1));
192
+ $rgb: map-merge($rgb, ($name: $value));
193
+ }
194
+
195
+ @return (map-get($rgb, "r") * .2126) + (map-get($rgb, "g") * .7152) + (map-get($rgb, "b") * .0722);
69
196
  }
70
197
 
71
- @function theme-color($key: "primary") {
72
- @return map-get($theme-colors, $key);
198
+ // Return opaque color
199
+ // opaque(#fff, rgba(0, 0, 0, .5)) => #808080
200
+ @function opaque($background, $foreground) {
201
+ @return mix(rgba($foreground, 1), $background, opacity($foreground) * 100%);
73
202
  }
74
203
 
75
- @function gray($key: "100") {
76
- @return map-get($grays, $key);
204
+ // scss-docs-start color-functions
205
+ // Tint a color: mix a color with white
206
+ @function tint-color($color, $weight) {
207
+ @return mix(white, $color, $weight);
208
+ }
209
+
210
+ // Shade a color: mix a color with black
211
+ @function shade-color($color, $weight) {
212
+ @return mix(black, $color, $weight);
213
+ }
214
+
215
+ // Shade the color if the weight is positive, else tint it
216
+ @function shift-color($color, $weight) {
217
+ @return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight));
218
+ }
219
+ // scss-docs-end color-functions
220
+
221
+ // Return valid calc
222
+ @function add($value1, $value2, $return-calc: true) {
223
+ @if $value1 == null {
224
+ @return $value2;
225
+ }
226
+
227
+ @if $value2 == null {
228
+ @return $value1;
229
+ }
230
+
231
+ @if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
232
+ @return $value1 + $value2;
233
+ }
234
+
235
+ @return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2);
77
236
  }
78
237
 
79
- // Request a theme color level
80
- @function theme-color-level($color-name: "primary", $level: 0) {
81
- $color: theme-color($color-name);
82
- $color-base: if($level > 0, $black, $white);
83
- $level: abs($level);
238
+ @function subtract($value1, $value2, $return-calc: true) {
239
+ @if $value1 == null and $value2 == null {
240
+ @return null;
241
+ }
242
+
243
+ @if $value1 == null {
244
+ @return -$value2;
245
+ }
246
+
247
+ @if $value2 == null {
248
+ @return $value1;
249
+ }
84
250
 
85
- @return mix($color-base, $color, $level * $theme-color-interval);
251
+ @if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
252
+ @return $value1 - $value2;
253
+ }
254
+
255
+ @if type-of($value2) != number {
256
+ $value2: unquote("(") + $value2 + unquote(")");
257
+ }
258
+
259
+ @return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
260
+ }
261
+
262
+ @function divide($dividend, $divisor, $precision: 10) {
263
+ $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
264
+ $dividend: abs($dividend);
265
+ $divisor: abs($divisor);
266
+ @if $dividend == 0 {
267
+ @return 0;
268
+ }
269
+ @if $divisor == 0 {
270
+ @error "Cannot divide by 0";
271
+ }
272
+ $remainder: $dividend;
273
+ $result: 0;
274
+ $factor: 10;
275
+ @while ($remainder > 0 and $precision >= 0) {
276
+ $quotient: 0;
277
+ @while ($remainder >= $divisor) {
278
+ $remainder: $remainder - $divisor;
279
+ $quotient: $quotient + 1;
280
+ }
281
+ $result: $result * 10 + $quotient;
282
+ $factor: $factor * .1;
283
+ $remainder: $remainder * 10;
284
+ $precision: $precision - 1;
285
+ @if ($precision < 0 and $remainder >= $divisor * 5) {
286
+ $result: $result + 1;
287
+ }
288
+ }
289
+ $result: $result * $factor * $sign;
290
+ $dividend-unit: unit($dividend);
291
+ $divisor-unit: unit($divisor);
292
+ $unit-map: (
293
+ "px": 1px,
294
+ "rem": 1rem,
295
+ "em": 1em,
296
+ "%": 1%
297
+ );
298
+ @if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
299
+ $result: $result * map-get($unit-map, $dividend-unit);
300
+ }
301
+ @return $result;
86
302
  }