bootstrap 4.3.1 → 5.1.3

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 (158) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +17 -2
  3. data/CHANGELOG.md +2 -14
  4. data/README.md +7 -4
  5. data/assets/javascripts/bootstrap/alert.js +172 -136
  6. data/assets/javascripts/bootstrap/base-component.js +182 -0
  7. data/assets/javascripts/bootstrap/button.js +101 -142
  8. data/assets/javascripts/bootstrap/carousel.js +483 -408
  9. data/assets/javascripts/bootstrap/collapse.js +340 -273
  10. data/assets/javascripts/bootstrap/dom/data.js +68 -0
  11. data/assets/javascripts/bootstrap/dom/event-handler.js +321 -0
  12. data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
  13. data/assets/javascripts/bootstrap/dom/selector-engine.js +127 -0
  14. data/assets/javascripts/bootstrap/dropdown.js +491 -399
  15. data/assets/javascripts/bootstrap/modal.js +841 -449
  16. data/assets/javascripts/bootstrap/offcanvas.js +866 -0
  17. data/assets/javascripts/bootstrap/popover.js +121 -198
  18. data/assets/javascripts/bootstrap/scrollspy.js +256 -240
  19. data/assets/javascripts/bootstrap/tab.js +218 -154
  20. data/assets/javascripts/bootstrap/toast.js +329 -189
  21. data/assets/javascripts/bootstrap/tooltip.js +651 -552
  22. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  23. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  24. data/assets/javascripts/bootstrap-sprockets.js +8 -1
  25. data/assets/javascripts/bootstrap.js +3503 -2892
  26. data/assets/javascripts/bootstrap.min.js +4 -4
  27. data/assets/stylesheets/_bootstrap-grid.scss +56 -18
  28. data/assets/stylesheets/_bootstrap-reboot.scss +5 -4
  29. data/assets/stylesheets/_bootstrap.scss +20 -11
  30. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  31. data/assets/stylesheets/bootstrap/_alert.scss +15 -9
  32. data/assets/stylesheets/bootstrap/_badge.scss +2 -27
  33. data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -18
  34. data/assets/stylesheets/bootstrap/_button-group.scss +21 -45
  35. data/assets/stylesheets/bootstrap/_buttons.scss +28 -54
  36. data/assets/stylesheets/bootstrap/_card.scss +52 -125
  37. data/assets/stylesheets/bootstrap/_carousel.scss +70 -38
  38. data/assets/stylesheets/bootstrap/_close.scss +30 -31
  39. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  40. data/assets/stylesheets/bootstrap/_dropdown.scss +88 -39
  41. data/assets/stylesheets/bootstrap/_forms.scss +9 -330
  42. data/assets/stylesheets/bootstrap/_functions.scss +243 -27
  43. data/assets/stylesheets/bootstrap/_grid.scss +14 -33
  44. data/assets/stylesheets/bootstrap/_helpers.scss +9 -0
  45. data/assets/stylesheets/bootstrap/_images.scss +3 -3
  46. data/assets/stylesheets/bootstrap/_list-group.scss +61 -36
  47. data/assets/stylesheets/bootstrap/_mixins.scss +12 -16
  48. data/assets/stylesheets/bootstrap/_modal.scss +64 -84
  49. data/assets/stylesheets/bootstrap/_nav.scss +29 -10
  50. data/assets/stylesheets/bootstrap/_navbar.scss +93 -52
  51. data/assets/stylesheets/bootstrap/_offcanvas.scss +83 -0
  52. data/assets/stylesheets/bootstrap/_pagination.scss +13 -22
  53. data/assets/stylesheets/bootstrap/_placeholders.scss +51 -0
  54. data/assets/stylesheets/bootstrap/_popover.scss +29 -42
  55. data/assets/stylesheets/bootstrap/_progress.scss +10 -5
  56. data/assets/stylesheets/bootstrap/_reboot.scss +350 -208
  57. data/assets/stylesheets/bootstrap/_root.scss +43 -8
  58. data/assets/stylesheets/bootstrap/_spinners.scss +21 -7
  59. data/assets/stylesheets/bootstrap/_tables.scss +84 -114
  60. data/assets/stylesheets/bootstrap/_toasts.scss +21 -14
  61. data/assets/stylesheets/bootstrap/_tooltip.scss +21 -21
  62. data/assets/stylesheets/bootstrap/_transitions.scss +8 -1
  63. data/assets/stylesheets/bootstrap/_type.scss +40 -61
  64. data/assets/stylesheets/bootstrap/_utilities.scss +630 -17
  65. data/assets/stylesheets/bootstrap/_variables.scss +1007 -489
  66. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  67. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +63 -0
  68. data/assets/stylesheets/bootstrap/forms/_form-check.scss +152 -0
  69. data/assets/stylesheets/bootstrap/forms/_form-control.scss +219 -0
  70. data/assets/stylesheets/bootstrap/forms/_form-range.scss +91 -0
  71. data/assets/stylesheets/bootstrap/forms/_form-select.scss +72 -0
  72. data/assets/stylesheets/bootstrap/forms/_form-text.scss +11 -0
  73. data/assets/stylesheets/bootstrap/forms/_input-group.scss +121 -0
  74. data/assets/stylesheets/bootstrap/forms/_labels.scss +36 -0
  75. data/assets/stylesheets/bootstrap/forms/_validation.scss +12 -0
  76. data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
  77. data/assets/stylesheets/bootstrap/helpers/_colored-links.scss +12 -0
  78. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  79. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  80. data/assets/stylesheets/bootstrap/helpers/_stacks.scss +15 -0
  81. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  82. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  83. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  84. data/assets/stylesheets/bootstrap/helpers/_vr.scss +8 -0
  85. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
  86. data/assets/stylesheets/bootstrap/mixins/_backdrop.scss +14 -0
  87. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +37 -22
  88. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +7 -9
  89. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +14 -10
  90. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +77 -51
  91. data/assets/stylesheets/bootstrap/mixins/_caret.scss +10 -8
  92. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  93. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  94. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  95. data/assets/stylesheets/bootstrap/mixins/_forms.scss +67 -115
  96. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  97. data/assets/stylesheets/bootstrap/mixins/_grid.scss +132 -32
  98. data/assets/stylesheets/bootstrap/mixins/_image.scss +0 -20
  99. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
  100. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +17 -8
  101. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -1
  102. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  103. data/assets/stylesheets/bootstrap/mixins/_transition.scss +18 -8
  104. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +89 -0
  105. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
  106. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  107. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +278 -128
  108. data/bootstrap.gemspec +4 -6
  109. data/lib/bootstrap/version.rb +2 -2
  110. data/tasks/updater/js.rb +25 -6
  111. data/tasks/updater/network.rb +8 -2
  112. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  113. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  114. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  115. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  116. data/test/dummy_rails/app/views/pages/root.html +89 -0
  117. data/test/dummy_rails/config/application.rb +0 -3
  118. data/test/gemfiles/rails_6_0.gemfile +7 -0
  119. data/test/gemfiles/rails_6_1.gemfile +7 -0
  120. data/test/support/dummy_rails_integration.rb +3 -1
  121. data/test/test_helper.rb +18 -13
  122. metadata +61 -79
  123. data/assets/javascripts/bootstrap/util.js +0 -171
  124. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  125. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -507
  126. data/assets/stylesheets/bootstrap/_input-group.scss +0 -193
  127. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -17
  128. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  129. data/assets/stylesheets/bootstrap/_print.scss +0 -141
  130. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -21
  131. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -17
  132. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -14
  133. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -66
  134. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  135. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -10
  136. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -33
  137. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -7
  138. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -39
  139. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -16
  140. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -11
  141. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -8
  142. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  143. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  144. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -75
  145. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -26
  146. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -39
  147. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  148. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -11
  149. data/assets/stylesheets/bootstrap/utilities/_overflow.scss +0 -5
  150. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -32
  151. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  152. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  153. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -20
  154. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -73
  155. data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +0 -19
  156. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -72
  157. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -13
  158. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
@@ -3,105 +3,131 @@
3
3
  // Easily pump out default styles, as well as :hover, :focus, :active,
4
4
  // and disabled options for all buttons
5
5
 
6
- @mixin button-variant($background, $border, $hover-background: darken($background, 7.5%), $hover-border: darken($border, 10%), $active-background: darken($background, 10%), $active-border: darken($border, 12.5%)) {
7
- color: color-yiq($background);
6
+ // scss-docs-start btn-variant-mixin
7
+ @mixin button-variant(
8
+ $background,
9
+ $border,
10
+ $color: color-contrast($background),
11
+ $hover-background: if($color == $color-contrast-light, shade-color($background, $btn-hover-bg-shade-amount), tint-color($background, $btn-hover-bg-tint-amount)),
12
+ $hover-border: if($color == $color-contrast-light, shade-color($border, $btn-hover-border-shade-amount), tint-color($border, $btn-hover-border-tint-amount)),
13
+ $hover-color: color-contrast($hover-background),
14
+ $active-background: if($color == $color-contrast-light, shade-color($background, $btn-active-bg-shade-amount), tint-color($background, $btn-active-bg-tint-amount)),
15
+ $active-border: if($color == $color-contrast-light, shade-color($border, $btn-active-border-shade-amount), tint-color($border, $btn-active-border-tint-amount)),
16
+ $active-color: color-contrast($active-background),
17
+ $disabled-background: $background,
18
+ $disabled-border: $border,
19
+ $disabled-color: color-contrast($disabled-background)
20
+ ) {
21
+ color: $color;
8
22
  @include gradient-bg($background);
9
23
  border-color: $border;
10
24
  @include box-shadow($btn-box-shadow);
11
25
 
12
- @include hover {
13
- color: color-yiq($hover-background);
26
+ &:hover {
27
+ color: $hover-color;
14
28
  @include gradient-bg($hover-background);
15
29
  border-color: $hover-border;
16
30
  }
17
31
 
18
- &:focus,
19
- &.focus {
20
- // Avoid using mixin so we can pass custom focus shadow properly
32
+ .btn-check:focus + &,
33
+ &:focus {
34
+ color: $hover-color;
35
+ @include gradient-bg($hover-background);
36
+ border-color: $hover-border;
21
37
  @if $enable-shadows {
22
- box-shadow: $btn-box-shadow, 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5);
38
+ @include box-shadow($btn-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5));
23
39
  } @else {
24
- box-shadow: 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5);
25
- }
26
- }
27
-
28
- // Disabled comes first so active can properly restyle
29
- &.disabled,
30
- &:disabled {
31
- color: color-yiq($background);
32
- background-color: $background;
33
- border-color: $border;
34
- // Remove CSS gradients if they're enabled
35
- @if $enable-gradients {
36
- background-image: none;
40
+ // Avoid using mixin so we can pass custom focus shadow properly
41
+ box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
37
42
  }
38
43
  }
39
44
 
40
- &:not(:disabled):not(.disabled):active,
41
- &:not(:disabled):not(.disabled).active,
45
+ .btn-check:checked + &,
46
+ .btn-check:active + &,
47
+ &:active,
48
+ &.active,
42
49
  .show > &.dropdown-toggle {
43
- color: color-yiq($active-background);
50
+ color: $active-color;
44
51
  background-color: $active-background;
45
- @if $enable-gradients {
46
- background-image: none; // Remove the gradient for the pressed/active state
47
- }
52
+ // Remove CSS gradients if they're enabled
53
+ background-image: if($enable-gradients, none, null);
48
54
  border-color: $active-border;
49
55
 
50
56
  &:focus {
51
- // Avoid using mixin so we can pass custom focus shadow properly
52
- @if $enable-shadows and $btn-active-box-shadow != none {
53
- box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5);
57
+ @if $enable-shadows {
58
+ @include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5));
54
59
  } @else {
55
- box-shadow: 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5);
60
+ // Avoid using mixin so we can pass custom focus shadow properly
61
+ box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
56
62
  }
57
63
  }
58
64
  }
65
+
66
+ &:disabled,
67
+ &.disabled {
68
+ color: $disabled-color;
69
+ background-color: $disabled-background;
70
+ // Remove CSS gradients if they're enabled
71
+ background-image: if($enable-gradients, none, null);
72
+ border-color: $disabled-border;
73
+ }
59
74
  }
75
+ // scss-docs-end btn-variant-mixin
60
76
 
61
- @mixin button-outline-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) {
77
+ // scss-docs-start btn-outline-variant-mixin
78
+ @mixin button-outline-variant(
79
+ $color,
80
+ $color-hover: color-contrast($color),
81
+ $active-background: $color,
82
+ $active-border: $color,
83
+ $active-color: color-contrast($active-background)
84
+ ) {
62
85
  color: $color;
63
86
  border-color: $color;
64
87
 
65
- @include hover {
88
+ &:hover {
66
89
  color: $color-hover;
67
90
  background-color: $active-background;
68
91
  border-color: $active-border;
69
92
  }
70
93
 
71
- &:focus,
72
- &.focus {
94
+ .btn-check:focus + &,
95
+ &:focus {
73
96
  box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
74
97
  }
75
98
 
76
- &.disabled,
77
- &:disabled {
78
- color: $color;
79
- background-color: transparent;
80
- }
81
-
82
- &:not(:disabled):not(.disabled):active,
83
- &:not(:disabled):not(.disabled).active,
84
- .show > &.dropdown-toggle {
85
- color: color-yiq($active-background);
99
+ .btn-check:checked + &,
100
+ .btn-check:active + &,
101
+ &:active,
102
+ &.active,
103
+ &.dropdown-toggle.show {
104
+ color: $active-color;
86
105
  background-color: $active-background;
87
106
  border-color: $active-border;
88
107
 
89
108
  &:focus {
90
- // Avoid using mixin so we can pass custom focus shadow properly
91
- @if $enable-shadows and $btn-active-box-shadow != none {
92
- box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($color, .5);
109
+ @if $enable-shadows {
110
+ @include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($color, .5));
93
111
  } @else {
112
+ // Avoid using mixin so we can pass custom focus shadow properly
94
113
  box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
95
114
  }
96
115
  }
97
116
  }
117
+
118
+ &:disabled,
119
+ &.disabled {
120
+ color: $color;
121
+ background-color: transparent;
122
+ }
98
123
  }
124
+ // scss-docs-end btn-outline-variant-mixin
99
125
 
100
- // Button sizes
101
- @mixin button-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) {
126
+ // scss-docs-start btn-size-mixin
127
+ @mixin button-size($padding-y, $padding-x, $font-size, $border-radius) {
102
128
  padding: $padding-y $padding-x;
103
129
  @include font-size($font-size);
104
- line-height: $line-height;
105
130
  // Manually declare to provide an override to the browser default
106
131
  @include border-radius($border-radius, 0);
107
132
  }
133
+ // scss-docs-end btn-size-mixin
@@ -1,3 +1,4 @@
1
+ // scss-docs-start caret-mixins
1
2
  @mixin caret-down {
2
3
  border-top: $caret-width solid;
3
4
  border-right: $caret-width solid transparent;
@@ -12,14 +13,14 @@
12
13
  border-left: $caret-width solid transparent;
13
14
  }
14
15
 
15
- @mixin caret-right {
16
+ @mixin caret-end {
16
17
  border-top: $caret-width solid transparent;
17
18
  border-right: 0;
18
19
  border-bottom: $caret-width solid transparent;
19
20
  border-left: $caret-width solid;
20
21
  }
21
22
 
22
- @mixin caret-left {
23
+ @mixin caret-start {
23
24
  border-top: $caret-width solid transparent;
24
25
  border-right: $caret-width solid;
25
26
  border-bottom: $caret-width solid transparent;
@@ -33,15 +34,15 @@
33
34
  vertical-align: $caret-vertical-align;
34
35
  content: "";
35
36
  @if $direction == down {
36
- @include caret-down;
37
+ @include caret-down();
37
38
  } @else if $direction == up {
38
- @include caret-up;
39
- } @else if $direction == right {
40
- @include caret-right;
39
+ @include caret-up();
40
+ } @else if $direction == end {
41
+ @include caret-end();
41
42
  }
42
43
  }
43
44
 
44
- @if $direction == left {
45
+ @if $direction == start {
45
46
  &::after {
46
47
  display: none;
47
48
  }
@@ -51,7 +52,7 @@
51
52
  margin-right: $caret-spacing;
52
53
  vertical-align: $caret-vertical-align;
53
54
  content: "";
54
- @include caret-left;
55
+ @include caret-start();
55
56
  }
56
57
  }
57
58
 
@@ -60,3 +61,4 @@
60
61
  }
61
62
  }
62
63
  }
64
+ // scss-docs-end caret-mixins
@@ -1,3 +1,4 @@
1
+ // scss-docs-start clearfix
1
2
  @mixin clearfix() {
2
3
  &::after {
3
4
  display: block;
@@ -5,3 +6,4 @@
5
6
  content: "";
6
7
  }
7
8
  }
9
+ // scss-docs-end clearfix
@@ -0,0 +1,7 @@
1
+ // scss-docs-start mixin-color-scheme
2
+ @mixin color-scheme($name) {
3
+ @media (prefers-color-scheme: #{$name}) {
4
+ @content;
5
+ }
6
+ }
7
+ // scss-docs-end mixin-color-scheme
@@ -0,0 +1,9 @@
1
+ // Container mixins
2
+
3
+ @mixin make-container($gutter: $container-padding-x) {
4
+ width: 100%;
5
+ padding-right: var(--#{$variable-prefix}gutter-x, #{$gutter});
6
+ padding-left: var(--#{$variable-prefix}gutter-x, #{$gutter});
7
+ margin-right: auto;
8
+ margin-left: auto;
9
+ }
@@ -1,37 +1,34 @@
1
- // Form control focus state
2
- //
3
- // Generate a customized focus state and for any input with the specified color,
4
- // which defaults to the `$input-focus-border-color` variable.
5
- //
6
- // We highly encourage you to not customize the default value, but instead use
7
- // this to tweak colors on an as-needed basis. This aesthetic change is based on
8
- // WebKit's default styles, but applicable to a wider range of browsers. Its
9
- // usability and accessibility should be taken into account with any change.
10
- //
11
- // Example usage: change the default blue border and shadow to white for better
12
- // contrast against a dark gray background.
13
- @mixin form-control-focus() {
14
- &:focus {
15
- color: $input-focus-color;
16
- background-color: $input-focus-bg;
17
- border-color: $input-focus-border-color;
18
- outline: 0;
19
- // Avoid using mixin so we can pass custom focus shadow properly
20
- @if $enable-shadows {
21
- box-shadow: $input-box-shadow, $input-focus-box-shadow;
22
- } @else {
23
- box-shadow: $input-focus-box-shadow;
1
+ // This mixin uses an `if()` technique to be compatible with Dart Sass
2
+ // See https://github.com/sass/sass/issues/1873#issuecomment-152293725 for more details
3
+
4
+ // scss-docs-start form-validation-mixins
5
+ @mixin form-validation-state-selector($state) {
6
+ @if ($state == "valid" or $state == "invalid") {
7
+ .was-validated #{if(&, "&", "")}:#{$state},
8
+ #{if(&, "&", "")}.is-#{$state} {
9
+ @content;
10
+ }
11
+ } @else {
12
+ #{if(&, "&", "")}.is-#{$state} {
13
+ @content;
24
14
  }
25
15
  }
26
16
  }
27
17
 
28
-
29
- @mixin form-validation-state($state, $color, $icon) {
18
+ @mixin form-validation-state(
19
+ $state,
20
+ $color,
21
+ $icon,
22
+ $tooltip-color: color-contrast($color),
23
+ $tooltip-bg-color: rgba($color, $form-feedback-tooltip-opacity),
24
+ $focus-box-shadow: 0 0 $input-btn-focus-blur $input-focus-width rgba($color, $input-btn-focus-color-opacity)
25
+ ) {
30
26
  .#{$state}-feedback {
31
27
  display: none;
32
28
  width: 100%;
33
29
  margin-top: $form-feedback-margin-top;
34
30
  @include font-size($form-feedback-font-size);
31
+ font-style: $form-feedback-font-style;
35
32
  color: $color;
36
33
  }
37
34
 
@@ -45,40 +42,40 @@
45
42
  margin-top: .1rem;
46
43
  @include font-size($form-feedback-tooltip-font-size);
47
44
  line-height: $form-feedback-tooltip-line-height;
48
- color: color-yiq($color);
49
- background-color: rgba($color, $form-feedback-tooltip-opacity);
45
+ color: $tooltip-color;
46
+ background-color: $tooltip-bg-color;
50
47
  @include border-radius($form-feedback-tooltip-border-radius);
51
48
  }
52
49
 
50
+ @include form-validation-state-selector($state) {
51
+ ~ .#{$state}-feedback,
52
+ ~ .#{$state}-tooltip {
53
+ display: block;
54
+ }
55
+ }
56
+
53
57
  .form-control {
54
- .was-validated &:#{$state},
55
- &.is-#{$state} {
58
+ @include form-validation-state-selector($state) {
56
59
  border-color: $color;
57
60
 
58
61
  @if $enable-validation-icons {
59
62
  padding-right: $input-height-inner;
60
- background-image: $icon;
63
+ background-image: escape-svg($icon);
61
64
  background-repeat: no-repeat;
62
- background-position: center right $input-height-inner-quarter;
65
+ background-position: right $input-height-inner-quarter center;
63
66
  background-size: $input-height-inner-half $input-height-inner-half;
64
67
  }
65
68
 
66
69
  &:focus {
67
70
  border-color: $color;
68
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
69
- }
70
-
71
- ~ .#{$state}-feedback,
72
- ~ .#{$state}-tooltip {
73
- display: block;
71
+ box-shadow: $focus-box-shadow;
74
72
  }
75
73
  }
76
74
  }
77
75
 
78
76
  // stylelint-disable-next-line selector-no-qualifying-type
79
77
  textarea.form-control {
80
- .was-validated &:#{$state},
81
- &.is-#{$state} {
78
+ @include form-validation-state-selector($state) {
82
79
  @if $enable-validation-icons {
83
80
  padding-right: $input-height-inner;
84
81
  background-position: top $input-height-inner-quarter right $input-height-inner-quarter;
@@ -86,107 +83,62 @@
86
83
  }
87
84
  }
88
85
 
89
- .custom-select {
90
- .was-validated &:#{$state},
91
- &.is-#{$state} {
86
+ .form-select {
87
+ @include form-validation-state-selector($state) {
92
88
  border-color: $color;
93
89
 
94
90
  @if $enable-validation-icons {
95
- padding-right: $custom-select-feedback-icon-padding-right;
96
- background: $custom-select-background, $icon $custom-select-bg no-repeat $custom-select-feedback-icon-position / $custom-select-feedback-icon-size;
91
+ &:not([multiple]):not([size]),
92
+ &:not([multiple])[size="1"] {
93
+ padding-right: $form-select-feedback-icon-padding-end;
94
+ background-image: escape-svg($form-select-indicator), escape-svg($icon);
95
+ background-position: $form-select-bg-position, $form-select-feedback-icon-position;
96
+ background-size: $form-select-bg-size, $form-select-feedback-icon-size;
97
+ }
97
98
  }
98
99
 
99
100
  &:focus {
100
101
  border-color: $color;
101
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
102
- }
103
-
104
- ~ .#{$state}-feedback,
105
- ~ .#{$state}-tooltip {
106
- display: block;
107
- }
108
- }
109
- }
110
-
111
-
112
- .form-control-file {
113
- .was-validated &:#{$state},
114
- &.is-#{$state} {
115
- ~ .#{$state}-feedback,
116
- ~ .#{$state}-tooltip {
117
- display: block;
102
+ box-shadow: $focus-box-shadow;
118
103
  }
119
104
  }
120
105
  }
121
106
 
122
107
  .form-check-input {
123
- .was-validated &:#{$state},
124
- &.is-#{$state} {
125
- ~ .form-check-label {
126
- color: $color;
127
- }
128
-
129
- ~ .#{$state}-feedback,
130
- ~ .#{$state}-tooltip {
131
- display: block;
132
- }
133
- }
134
- }
135
-
136
- .custom-control-input {
137
- .was-validated &:#{$state},
138
- &.is-#{$state} {
139
- ~ .custom-control-label {
140
- color: $color;
141
-
142
- &::before {
143
- border-color: $color;
144
- }
145
- }
146
-
147
- ~ .#{$state}-feedback,
148
- ~ .#{$state}-tooltip {
149
- display: block;
150
- }
108
+ @include form-validation-state-selector($state) {
109
+ border-color: $color;
151
110
 
152
111
  &:checked {
153
- ~ .custom-control-label::before {
154
- border-color: lighten($color, 10%);
155
- @include gradient-bg(lighten($color, 10%));
156
- }
112
+ background-color: $color;
157
113
  }
158
114
 
159
115
  &:focus {
160
- ~ .custom-control-label::before {
161
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
162
- }
116
+ box-shadow: $focus-box-shadow;
117
+ }
163
118
 
164
- &:not(:checked) ~ .custom-control-label::before {
165
- border-color: $color;
166
- }
119
+ ~ .form-check-label {
120
+ color: $color;
167
121
  }
168
122
  }
169
123
  }
124
+ .form-check-inline .form-check-input {
125
+ ~ .#{$state}-feedback {
126
+ margin-left: .5em;
127
+ }
128
+ }
170
129
 
171
- // custom file
172
- .custom-file-input {
173
- .was-validated &:#{$state},
174
- &.is-#{$state} {
175
- ~ .custom-file-label {
176
- border-color: $color;
177
- }
178
-
179
- ~ .#{$state}-feedback,
180
- ~ .#{$state}-tooltip {
181
- display: block;
130
+ .input-group .form-control,
131
+ .input-group .form-select {
132
+ @include form-validation-state-selector($state) {
133
+ @if $state == "valid" {
134
+ z-index: 1;
135
+ } @else if $state == "invalid" {
136
+ z-index: 2;
182
137
  }
183
-
184
138
  &:focus {
185
- ~ .custom-file-label {
186
- border-color: $color;
187
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
188
- }
139
+ z-index: 3;
189
140
  }
190
141
  }
191
142
  }
192
143
  }
144
+ // scss-docs-end form-validation-mixins
@@ -1,45 +1,47 @@
1
1
  // Gradients
2
2
 
3
- @mixin gradient-bg($color) {
3
+ // scss-docs-start gradient-bg-mixin
4
+ @mixin gradient-bg($color: null) {
5
+ background-color: $color;
6
+
4
7
  @if $enable-gradients {
5
- background: $color linear-gradient(180deg, mix($body-bg, $color, 15%), $color) repeat-x;
6
- } @else {
7
- background-color: $color;
8
+ background-image: var(--#{$variable-prefix}gradient);
8
9
  }
9
10
  }
11
+ // scss-docs-end gradient-bg-mixin
10
12
 
13
+ // scss-docs-start gradient-mixins
11
14
  // Horizontal gradient, from left to right
12
15
  //
13
16
  // Creates two color stops, start and end, by specifying a color and position for each color stop.
14
17
  @mixin gradient-x($start-color: $gray-700, $end-color: $gray-800, $start-percent: 0%, $end-percent: 100%) {
15
18
  background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent);
16
- background-repeat: repeat-x;
17
19
  }
18
20
 
19
21
  // Vertical gradient, from top to bottom
20
22
  //
21
23
  // Creates two color stops, start and end, by specifying a color and position for each color stop.
22
- @mixin gradient-y($start-color: $gray-700, $end-color: $gray-800, $start-percent: 0%, $end-percent: 100%) {
24
+ @mixin gradient-y($start-color: $gray-700, $end-color: $gray-800, $start-percent: null, $end-percent: null) {
23
25
  background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent);
24
- background-repeat: repeat-x;
25
26
  }
26
27
 
27
28
  @mixin gradient-directional($start-color: $gray-700, $end-color: $gray-800, $deg: 45deg) {
28
29
  background-image: linear-gradient($deg, $start-color, $end-color);
29
- background-repeat: repeat-x;
30
30
  }
31
+
31
32
  @mixin gradient-x-three-colors($start-color: $blue, $mid-color: $purple, $color-stop: 50%, $end-color: $red) {
32
33
  background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color);
33
- background-repeat: no-repeat;
34
34
  }
35
+
35
36
  @mixin gradient-y-three-colors($start-color: $blue, $mid-color: $purple, $color-stop: 50%, $end-color: $red) {
36
37
  background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color);
37
- background-repeat: no-repeat;
38
38
  }
39
+
39
40
  @mixin gradient-radial($inner-color: $gray-700, $outer-color: $gray-800) {
40
41
  background-image: radial-gradient(circle, $inner-color, $outer-color);
41
- background-repeat: no-repeat;
42
42
  }
43
+
43
44
  @mixin gradient-striped($color: rgba($white, .15), $angle: 45deg) {
44
45
  background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
45
46
  }
47
+ // scss-docs-end gradient-mixins