bootstrap 4.1.3 → 5.0.0

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 (156) 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/Rakefile +2 -2
  6. data/assets/javascripts/bootstrap/alert.js +226 -166
  7. data/assets/javascripts/bootstrap/base-component.js +63 -0
  8. data/assets/javascripts/bootstrap/button.js +119 -165
  9. data/assets/javascripts/bootstrap/carousel.js +634 -445
  10. data/assets/javascripts/bootstrap/collapse.js +447 -327
  11. data/assets/javascripts/bootstrap/dom/data.js +68 -0
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +322 -0
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +88 -0
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +85 -0
  15. data/assets/javascripts/bootstrap/dropdown.js +550 -425
  16. data/assets/javascripts/bootstrap/modal.js +695 -492
  17. data/assets/javascripts/bootstrap/offcanvas.js +671 -0
  18. data/assets/javascripts/bootstrap/popover.js +167 -217
  19. data/assets/javascripts/bootstrap/scrollspy.js +319 -302
  20. data/assets/javascripts/bootstrap/tab.js +303 -221
  21. data/assets/javascripts/bootstrap/toast.js +333 -0
  22. data/assets/javascripts/bootstrap/tooltip.js +896 -577
  23. data/assets/javascripts/bootstrap-global-this-define.js +6 -0
  24. data/assets/javascripts/bootstrap-global-this-undefine.js +2 -0
  25. data/assets/javascripts/bootstrap-sprockets.js +15 -7
  26. data/assets/javascripts/bootstrap.js +4262 -3163
  27. data/assets/javascripts/bootstrap.min.js +4 -4
  28. data/assets/stylesheets/_bootstrap-grid.scss +54 -21
  29. data/assets/stylesheets/_bootstrap-reboot.scss +7 -4
  30. data/assets/stylesheets/_bootstrap.scss +21 -11
  31. data/assets/stylesheets/bootstrap/_accordion.scss +118 -0
  32. data/assets/stylesheets/bootstrap/_alert.scss +15 -9
  33. data/assets/stylesheets/bootstrap/_badge.scss +3 -21
  34. data/assets/stylesheets/bootstrap/_breadcrumb.scss +5 -18
  35. data/assets/stylesheets/bootstrap/_button-group.scss +29 -62
  36. data/assets/stylesheets/bootstrap/_buttons.scss +33 -65
  37. data/assets/stylesheets/bootstrap/_card.scss +55 -141
  38. data/assets/stylesheets/bootstrap/_carousel.scss +94 -101
  39. data/assets/stylesheets/bootstrap/_close.scss +33 -28
  40. data/assets/stylesheets/bootstrap/_containers.scss +41 -0
  41. data/assets/stylesheets/bootstrap/_dropdown.scss +114 -40
  42. data/assets/stylesheets/bootstrap/_forms.scss +9 -333
  43. data/assets/stylesheets/bootstrap/_functions.scss +148 -29
  44. data/assets/stylesheets/bootstrap/_grid.scss +4 -34
  45. data/assets/stylesheets/bootstrap/_helpers.scss +7 -0
  46. data/assets/stylesheets/bootstrap/_images.scss +4 -4
  47. data/assets/stylesheets/bootstrap/_list-group.scss +86 -27
  48. data/assets/stylesheets/bootstrap/_mixins.scss +17 -16
  49. data/assets/stylesheets/bootstrap/_modal.scss +90 -42
  50. data/assets/stylesheets/bootstrap/_nav.scss +31 -10
  51. data/assets/stylesheets/bootstrap/_navbar.scss +68 -61
  52. data/assets/stylesheets/bootstrap/_offcanvas.scss +77 -0
  53. data/assets/stylesheets/bootstrap/_pagination.scss +13 -27
  54. data/assets/stylesheets/bootstrap/_popover.scss +63 -88
  55. data/assets/stylesheets/bootstrap/_progress.scss +20 -6
  56. data/assets/stylesheets/bootstrap/_reboot.scss +349 -211
  57. data/assets/stylesheets/bootstrap/_root.scss +5 -8
  58. data/assets/stylesheets/bootstrap/_spinners.scss +69 -0
  59. data/assets/stylesheets/bootstrap/_tables.scss +79 -116
  60. data/assets/stylesheets/bootstrap/_toasts.scss +51 -0
  61. data/assets/stylesheets/bootstrap/_tooltip.scss +18 -18
  62. data/assets/stylesheets/bootstrap/_transitions.scss +2 -3
  63. data/assets/stylesheets/bootstrap/_type.scss +42 -63
  64. data/assets/stylesheets/bootstrap/_utilities.scss +594 -15
  65. data/assets/stylesheets/bootstrap/_variables.scss +952 -440
  66. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +18 -0
  67. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +61 -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 +67 -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/helpers/_colored-links.scss +12 -0
  77. data/assets/stylesheets/bootstrap/helpers/_position.scss +30 -0
  78. data/assets/stylesheets/bootstrap/helpers/_ratio.scss +26 -0
  79. data/assets/stylesheets/bootstrap/helpers/_stretched-link.scss +15 -0
  80. data/assets/stylesheets/bootstrap/helpers/_text-truncation.scss +7 -0
  81. data/assets/stylesheets/bootstrap/helpers/_visually-hidden.scss +8 -0
  82. data/assets/stylesheets/bootstrap/mixins/_alert.scss +3 -5
  83. data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +57 -14
  84. data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +14 -1
  85. data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +13 -9
  86. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +77 -53
  87. data/assets/stylesheets/bootstrap/mixins/_caret.scss +14 -16
  88. data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +2 -0
  89. data/assets/stylesheets/bootstrap/mixins/_color-scheme.scss +7 -0
  90. data/assets/stylesheets/bootstrap/mixins/_container.scss +9 -0
  91. data/assets/stylesheets/bootstrap/mixins/_deprecate.scss +10 -0
  92. data/assets/stylesheets/bootstrap/mixins/_forms.scss +87 -97
  93. data/assets/stylesheets/bootstrap/mixins/_gradients.scss +13 -11
  94. data/assets/stylesheets/bootstrap/mixins/_grid.scss +106 -33
  95. data/assets/stylesheets/bootstrap/mixins/_image.scss +0 -20
  96. data/assets/stylesheets/bootstrap/mixins/_list-group.scss +5 -2
  97. data/assets/stylesheets/bootstrap/mixins/_pagination.scss +18 -9
  98. data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +2 -2
  99. data/assets/stylesheets/bootstrap/mixins/_table-variants.scss +21 -0
  100. data/assets/stylesheets/bootstrap/mixins/_transition.scss +19 -6
  101. data/assets/stylesheets/bootstrap/mixins/_utilities.scss +68 -0
  102. data/assets/stylesheets/bootstrap/mixins/_visually-hidden.scss +29 -0
  103. data/assets/stylesheets/bootstrap/utilities/_api.scss +47 -0
  104. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +312 -0
  105. data/bootstrap.gemspec +7 -6
  106. data/lib/bootstrap/engine.rb +3 -0
  107. data/lib/bootstrap/version.rb +4 -2
  108. data/lib/bootstrap.rb +10 -7
  109. data/tasks/updater/js.rb +20 -5
  110. data/tasks/updater/network.rb +8 -2
  111. data/test/dummy_rails/app/assets/config/manifest.js +3 -0
  112. data/test/dummy_rails/app/assets/javascripts/application.js +4 -3
  113. data/test/dummy_rails/app/assets/stylesheets/.browserslistrc +1 -0
  114. data/test/dummy_rails/app/views/layouts/application.html.erb +3 -1
  115. data/test/dummy_rails/app/views/pages/root.html +89 -0
  116. data/test/dummy_rails/config/application.rb +0 -3
  117. data/test/gemfiles/rails_6_0.gemfile +7 -0
  118. data/test/gemfiles/rails_6_1.gemfile +7 -0
  119. data/test/support/dummy_rails_integration.rb +3 -1
  120. data/test/test_helper.rb +18 -13
  121. metadata +64 -79
  122. data/assets/javascripts/bootstrap/util.js +0 -143
  123. data/assets/stylesheets/bootstrap/_code.scss +0 -48
  124. data/assets/stylesheets/bootstrap/_custom-forms.scss +0 -433
  125. data/assets/stylesheets/bootstrap/_input-group.scss +0 -173
  126. data/assets/stylesheets/bootstrap/_jumbotron.scss +0 -16
  127. data/assets/stylesheets/bootstrap/_media.scss +0 -8
  128. data/assets/stylesheets/bootstrap/_print.scss +0 -141
  129. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -21
  130. data/assets/stylesheets/bootstrap/mixins/_badge.scss +0 -12
  131. data/assets/stylesheets/bootstrap/mixins/_float.scss +0 -11
  132. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +0 -67
  133. data/assets/stylesheets/bootstrap/mixins/_hover.scss +0 -37
  134. data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +0 -10
  135. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +0 -33
  136. data/assets/stylesheets/bootstrap/mixins/_size.scss +0 -6
  137. data/assets/stylesheets/bootstrap/mixins/_table-row.scss +0 -30
  138. data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +0 -14
  139. data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +0 -13
  140. data/assets/stylesheets/bootstrap/mixins/_visibility.scss +0 -7
  141. data/assets/stylesheets/bootstrap/utilities/_align.scss +0 -8
  142. data/assets/stylesheets/bootstrap/utilities/_background.scss +0 -19
  143. data/assets/stylesheets/bootstrap/utilities/_borders.scss +0 -59
  144. data/assets/stylesheets/bootstrap/utilities/_display.scss +0 -38
  145. data/assets/stylesheets/bootstrap/utilities/_embed.scss +0 -52
  146. data/assets/stylesheets/bootstrap/utilities/_flex.scss +0 -51
  147. data/assets/stylesheets/bootstrap/utilities/_float.scss +0 -9
  148. data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -37
  149. data/assets/stylesheets/bootstrap/utilities/_screenreaders.scss +0 -11
  150. data/assets/stylesheets/bootstrap/utilities/_shadows.scss +0 -6
  151. data/assets/stylesheets/bootstrap/utilities/_sizing.scss +0 -12
  152. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +0 -51
  153. data/assets/stylesheets/bootstrap/utilities/_text.scss +0 -58
  154. data/assets/stylesheets/bootstrap/utilities/_visibility.scss +0 -11
  155. data/test/dummy_rails/app/views/pages/root.html.slim +0 -58
  156. /data/assets/stylesheets/bootstrap/{utilities → helpers}/_clearfix.scss +0 -0
@@ -0,0 +1,121 @@
1
+ //
2
+ // Base styles
3
+ //
4
+
5
+ .input-group {
6
+ position: relative;
7
+ display: flex;
8
+ flex-wrap: wrap; // For form validation feedback
9
+ align-items: stretch;
10
+ width: 100%;
11
+
12
+ > .form-control,
13
+ > .form-select {
14
+ position: relative; // For focus state's z-index
15
+ flex: 1 1 auto;
16
+ width: 1%;
17
+ min-width: 0; // https://stackoverflow.com/questions/36247140/why-dont-flex-items-shrink-past-content-size
18
+ }
19
+
20
+ // Bring the "active" form control to the top of surrounding elements
21
+ > .form-control:focus,
22
+ > .form-select:focus {
23
+ z-index: 3;
24
+ }
25
+
26
+ // Ensure buttons are always above inputs for more visually pleasing borders.
27
+ // This isn't needed for `.input-group-text` since it shares the same border-color
28
+ // as our inputs.
29
+ .btn {
30
+ position: relative;
31
+ z-index: 2;
32
+
33
+ &:focus {
34
+ z-index: 3;
35
+ }
36
+ }
37
+ }
38
+
39
+
40
+ // Textual addons
41
+ //
42
+ // Serves as a catch-all element for any text or radio/checkbox input you wish
43
+ // to prepend or append to an input.
44
+
45
+ .input-group-text {
46
+ display: flex;
47
+ align-items: center;
48
+ padding: $input-group-addon-padding-y $input-group-addon-padding-x;
49
+ @include font-size($input-font-size); // Match inputs
50
+ font-weight: $input-group-addon-font-weight;
51
+ line-height: $input-line-height;
52
+ color: $input-group-addon-color;
53
+ text-align: center;
54
+ white-space: nowrap;
55
+ background-color: $input-group-addon-bg;
56
+ border: $input-border-width solid $input-group-addon-border-color;
57
+ @include border-radius($input-border-radius);
58
+ }
59
+
60
+
61
+ // Sizing
62
+ //
63
+ // Remix the default form control sizing classes into new ones for easier
64
+ // manipulation.
65
+
66
+ .input-group-lg > .form-control,
67
+ .input-group-lg > .form-select,
68
+ .input-group-lg > .input-group-text,
69
+ .input-group-lg > .btn {
70
+ padding: $input-padding-y-lg $input-padding-x-lg;
71
+ @include font-size($input-font-size-lg);
72
+ @include border-radius($input-border-radius-lg);
73
+ }
74
+
75
+ .input-group-sm > .form-control,
76
+ .input-group-sm > .form-select,
77
+ .input-group-sm > .input-group-text,
78
+ .input-group-sm > .btn {
79
+ padding: $input-padding-y-sm $input-padding-x-sm;
80
+ @include font-size($input-font-size-sm);
81
+ @include border-radius($input-border-radius-sm);
82
+ }
83
+
84
+ .input-group-lg > .form-select,
85
+ .input-group-sm > .form-select {
86
+ padding-right: $form-select-padding-x + $form-select-indicator-padding;
87
+ }
88
+
89
+
90
+ // Rounded corners
91
+ //
92
+ // These rulesets must come after the sizing ones to properly override sm and lg
93
+ // border-radius values when extending. They're more specific than we'd like
94
+ // with the `.input-group >` part, but without it, we cannot override the sizing.
95
+
96
+ // stylelint-disable-next-line no-duplicate-selectors
97
+ .input-group {
98
+ &:not(.has-validation) {
99
+ > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu),
100
+ > .dropdown-toggle:nth-last-child(n + 3) {
101
+ @include border-end-radius(0);
102
+ }
103
+ }
104
+
105
+ &.has-validation {
106
+ > :nth-last-child(n + 3):not(.dropdown-toggle):not(.dropdown-menu),
107
+ > .dropdown-toggle:nth-last-child(n + 4) {
108
+ @include border-end-radius(0);
109
+ }
110
+ }
111
+
112
+ $validation-messages: "";
113
+ @each $state in map-keys($form-validation-states) {
114
+ $validation-messages: $validation-messages + ":not(." + unquote($state) + "-tooltip)" + ":not(." + unquote($state) + "-feedback)";
115
+ }
116
+
117
+ > :not(:first-child):not(.dropdown-menu)#{$validation-messages} {
118
+ margin-left: -$input-border-width;
119
+ @include border-start-radius(0);
120
+ }
121
+ }
@@ -0,0 +1,36 @@
1
+ //
2
+ // Labels
3
+ //
4
+
5
+ .form-label {
6
+ margin-bottom: $form-label-margin-bottom;
7
+ @include font-size($form-label-font-size);
8
+ font-style: $form-label-font-style;
9
+ font-weight: $form-label-font-weight;
10
+ color: $form-label-color;
11
+ }
12
+
13
+ // For use with horizontal and inline forms, when you need the label (or legend)
14
+ // text to align with the form controls.
15
+ .col-form-label {
16
+ padding-top: add($input-padding-y, $input-border-width);
17
+ padding-bottom: add($input-padding-y, $input-border-width);
18
+ margin-bottom: 0; // Override the `<legend>` default
19
+ @include font-size(inherit); // Override the `<legend>` default
20
+ font-style: $form-label-font-style;
21
+ font-weight: $form-label-font-weight;
22
+ line-height: $input-line-height;
23
+ color: $form-label-color;
24
+ }
25
+
26
+ .col-form-label-lg {
27
+ padding-top: add($input-padding-y-lg, $input-border-width);
28
+ padding-bottom: add($input-padding-y-lg, $input-border-width);
29
+ @include font-size($input-font-size-lg);
30
+ }
31
+
32
+ .col-form-label-sm {
33
+ padding-top: add($input-padding-y-sm, $input-border-width);
34
+ padding-bottom: add($input-padding-y-sm, $input-border-width);
35
+ @include font-size($input-font-size-sm);
36
+ }
@@ -0,0 +1,12 @@
1
+ // Form validation
2
+ //
3
+ // Provide feedback to users when form field values are valid or invalid. Works
4
+ // primarily for client-side validation via scoped `:invalid` and `:valid`
5
+ // pseudo-classes but also includes `.is-invalid` and `.is-valid` classes for
6
+ // server-side validation.
7
+
8
+ // scss-docs-start form-validation-states-loop
9
+ @each $state, $data in $form-validation-states {
10
+ @include form-validation-state($state, $data...);
11
+ }
12
+ // scss-docs-end form-validation-states-loop
@@ -0,0 +1,12 @@
1
+ @each $color, $value in $theme-colors {
2
+ .link-#{$color} {
3
+ color: $value;
4
+
5
+ @if $link-shade-percentage != 0 {
6
+ &:hover,
7
+ &:focus {
8
+ color: if(color-contrast($value) == $color-contrast-light, shade-color($value, $link-shade-percentage), tint-color($value, $link-shade-percentage));
9
+ }
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,30 @@
1
+ // Shorthand
2
+
3
+ .fixed-top {
4
+ position: fixed;
5
+ top: 0;
6
+ right: 0;
7
+ left: 0;
8
+ z-index: $zindex-fixed;
9
+ }
10
+
11
+ .fixed-bottom {
12
+ position: fixed;
13
+ right: 0;
14
+ bottom: 0;
15
+ left: 0;
16
+ z-index: $zindex-fixed;
17
+ }
18
+
19
+ // Responsive sticky top
20
+ @each $breakpoint in map-keys($grid-breakpoints) {
21
+ @include media-breakpoint-up($breakpoint) {
22
+ $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
23
+
24
+ .sticky#{$infix}-top {
25
+ position: sticky;
26
+ top: 0;
27
+ z-index: $zindex-sticky;
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,26 @@
1
+ // Credit: Nicolas Gallagher and SUIT CSS.
2
+
3
+ .ratio {
4
+ position: relative;
5
+ width: 100%;
6
+
7
+ &::before {
8
+ display: block;
9
+ padding-top: var(--#{$variable-prefix}aspect-ratio);
10
+ content: "";
11
+ }
12
+
13
+ > * {
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0;
17
+ width: 100%;
18
+ height: 100%;
19
+ }
20
+ }
21
+
22
+ @each $key, $ratio in $aspect-ratios {
23
+ .ratio-#{$key} {
24
+ --#{$variable-prefix}aspect-ratio: #{$ratio};
25
+ }
26
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Stretched link
3
+ //
4
+
5
+ .stretched-link {
6
+ &::#{$stretched-link-pseudo-element} {
7
+ position: absolute;
8
+ top: 0;
9
+ right: 0;
10
+ bottom: 0;
11
+ left: 0;
12
+ z-index: $stretched-link-z-index;
13
+ content: "";
14
+ }
15
+ }
@@ -0,0 +1,7 @@
1
+ //
2
+ // Text truncation
3
+ //
4
+
5
+ .text-truncate {
6
+ @include text-truncate();
7
+ }
@@ -0,0 +1,8 @@
1
+ //
2
+ // Visually hidden
3
+ //
4
+
5
+ .visually-hidden,
6
+ .visually-hidden-focusable:not(:focus):not(:focus-within) {
7
+ @include visually-hidden();
8
+ }
@@ -1,13 +1,11 @@
1
+ // scss-docs-start alert-variant-mixin
1
2
  @mixin alert-variant($background, $border, $color) {
2
3
  color: $color;
3
4
  @include gradient-bg($background);
4
5
  border-color: $border;
5
6
 
6
- hr {
7
- border-top-color: darken($border, 5%);
8
- }
9
-
10
7
  .alert-link {
11
- color: darken($color, 10%);
8
+ color: shade-color($color, 20%);
12
9
  }
13
10
  }
11
+ // scss-docs-end alert-variant-mixin
@@ -1,35 +1,78 @@
1
+ // stylelint-disable property-disallowed-list
1
2
  // Single side border-radius
2
3
 
3
- @mixin border-radius($radius: $border-radius) {
4
+ // Helper function to replace negative values with 0
5
+ @function valid-radius($radius) {
6
+ $return: ();
7
+ @each $value in $radius {
8
+ @if type-of($value) == number {
9
+ $return: append($return, max($value, 0));
10
+ } @else {
11
+ $return: append($return, $value);
12
+ }
13
+ }
14
+ @return $return;
15
+ }
16
+
17
+ // scss-docs-start border-radius-mixins
18
+ @mixin border-radius($radius: $border-radius, $fallback-border-radius: false) {
19
+ @if $enable-rounded {
20
+ border-radius: valid-radius($radius);
21
+ }
22
+ @else if $fallback-border-radius != false {
23
+ border-radius: $fallback-border-radius;
24
+ }
25
+ }
26
+
27
+ @mixin border-top-radius($radius: $border-radius) {
28
+ @if $enable-rounded {
29
+ border-top-left-radius: valid-radius($radius);
30
+ border-top-right-radius: valid-radius($radius);
31
+ }
32
+ }
33
+
34
+ @mixin border-end-radius($radius: $border-radius) {
35
+ @if $enable-rounded {
36
+ border-top-right-radius: valid-radius($radius);
37
+ border-bottom-right-radius: valid-radius($radius);
38
+ }
39
+ }
40
+
41
+ @mixin border-bottom-radius($radius: $border-radius) {
42
+ @if $enable-rounded {
43
+ border-bottom-right-radius: valid-radius($radius);
44
+ border-bottom-left-radius: valid-radius($radius);
45
+ }
46
+ }
47
+
48
+ @mixin border-start-radius($radius: $border-radius) {
4
49
  @if $enable-rounded {
5
- border-radius: $radius;
50
+ border-top-left-radius: valid-radius($radius);
51
+ border-bottom-left-radius: valid-radius($radius);
6
52
  }
7
53
  }
8
54
 
9
- @mixin border-top-radius($radius) {
55
+ @mixin border-top-start-radius($radius: $border-radius) {
10
56
  @if $enable-rounded {
11
- border-top-left-radius: $radius;
12
- border-top-right-radius: $radius;
57
+ border-top-left-radius: valid-radius($radius);
13
58
  }
14
59
  }
15
60
 
16
- @mixin border-right-radius($radius) {
61
+ @mixin border-top-end-radius($radius: $border-radius) {
17
62
  @if $enable-rounded {
18
- border-top-right-radius: $radius;
19
- border-bottom-right-radius: $radius;
63
+ border-top-right-radius: valid-radius($radius);
20
64
  }
21
65
  }
22
66
 
23
- @mixin border-bottom-radius($radius) {
67
+ @mixin border-bottom-end-radius($radius: $border-radius) {
24
68
  @if $enable-rounded {
25
- border-bottom-right-radius: $radius;
26
- border-bottom-left-radius: $radius;
69
+ border-bottom-right-radius: valid-radius($radius);
27
70
  }
28
71
  }
29
72
 
30
- @mixin border-left-radius($radius) {
73
+ @mixin border-bottom-start-radius($radius: $border-radius) {
31
74
  @if $enable-rounded {
32
- border-top-left-radius: $radius;
33
- border-bottom-left-radius: $radius;
75
+ border-bottom-left-radius: valid-radius($radius);
34
76
  }
35
77
  }
78
+ // scss-docs-end border-radius-mixins
@@ -1,5 +1,18 @@
1
1
  @mixin box-shadow($shadow...) {
2
2
  @if $enable-shadows {
3
- box-shadow: $shadow;
3
+ $result: ();
4
+
5
+ @each $value in $shadow {
6
+ @if $value != null {
7
+ $result: append($result, $value, "comma");
8
+ }
9
+ @if $value == none and length($shadow) > 1 {
10
+ @warn "The keyword 'none' must be used as a single argument.";
11
+ }
12
+ }
13
+
14
+ @if (length($result) > 0) {
15
+ box-shadow: $result;
16
+ }
4
17
  }
5
18
  }
@@ -16,6 +16,9 @@
16
16
  // md
17
17
  @function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
18
18
  $n: index($breakpoint-names, $name);
19
+ @if not $n {
20
+ @error "breakpoint `#{$name}` not found in `#{$breakpoints}`";
21
+ }
19
22
  @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
20
23
  }
21
24
 
@@ -28,18 +31,18 @@
28
31
  @return if($min != 0, $min, null);
29
32
  }
30
33
 
31
- // Maximum breakpoint width. Null for the largest (last) breakpoint.
32
- // The maximum value is calculated as the minimum of the next one less 0.02px
33
- // to work around the limitations of `min-` and `max-` prefixes and viewports with fractional widths.
34
+ // Maximum breakpoint width.
35
+ // The maximum value is reduced by 0.02px to work around the limitations of
36
+ // `min-` and `max-` prefixes and viewports with fractional widths.
34
37
  // See https://www.w3.org/TR/mediaqueries-4/#mq-min-max
35
38
  // Uses 0.02px rather than 0.01px to work around a current rounding bug in Safari.
36
39
  // See https://bugs.webkit.org/show_bug.cgi?id=178261
37
40
  //
38
- // >> breakpoint-max(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
41
+ // >> breakpoint-max(md, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
39
42
  // 767.98px
40
43
  @function breakpoint-max($name, $breakpoints: $grid-breakpoints) {
41
- $next: breakpoint-next($name, $breakpoints);
42
- @return if($next, breakpoint-min($next, $breakpoints) - .02px, null);
44
+ $max: map-get($breakpoints, $name);
45
+ @return if($max and $max > 0, $max - .02, null);
43
46
  }
44
47
 
45
48
  // Returns a blank string if smallest breakpoint, otherwise returns the name with a dash in front.
@@ -104,8 +107,9 @@
104
107
  // No minimum for the smallest breakpoint, and no maximum for the largest one.
105
108
  // Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.
106
109
  @mixin media-breakpoint-only($name, $breakpoints: $grid-breakpoints) {
107
- $min: breakpoint-min($name, $breakpoints);
108
- $max: breakpoint-max($name, $breakpoints);
110
+ $min: breakpoint-min($name, $breakpoints);
111
+ $next: breakpoint-next($name, $breakpoints);
112
+ $max: breakpoint-max($next);
109
113
 
110
114
  @if $min != null and $max != null {
111
115
  @media (min-width: $min) and (max-width: $max) {
@@ -116,7 +120,7 @@
116
120
  @content;
117
121
  }
118
122
  } @else if $min == null {
119
- @include media-breakpoint-down($name, $breakpoints) {
123
+ @include media-breakpoint-down($next, $breakpoints) {
120
124
  @content;
121
125
  }
122
126
  }
@@ -3,61 +3,86 @@
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($border, .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($border, .5);
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);
25
42
  }
26
43
  }
27
44
 
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
- }
35
-
36
- &:not(:disabled):not(.disabled):active,
37
- &:not(:disabled):not(.disabled).active,
45
+ .btn-check:checked + &,
46
+ .btn-check:active + &,
47
+ &:active,
48
+ &.active,
38
49
  .show > &.dropdown-toggle {
39
- color: color-yiq($active-background);
50
+ color: $active-color;
40
51
  background-color: $active-background;
41
- @if $enable-gradients {
42
- background-image: none; // Remove the gradient for the pressed/active state
43
- }
52
+ // Remove CSS gradients if they're enabled
53
+ background-image: if($enable-gradients, none, null);
44
54
  border-color: $active-border;
45
55
 
46
56
  &:focus {
47
- // Avoid using mixin so we can pass custom focus shadow properly
48
57
  @if $enable-shadows {
49
- box-shadow: $btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($border, .5);
58
+ @include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5));
50
59
  } @else {
51
- box-shadow: 0 0 0 $btn-focus-width rgba($border, .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);
52
62
  }
53
63
  }
54
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
+ }
55
74
  }
75
+ // scss-docs-end btn-variant-mixin
56
76
 
57
- @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
+ ) {
58
85
  color: $color;
59
- background-color: transparent;
60
- background-image: none;
61
86
  border-color: $color;
62
87
 
63
88
  &:hover {
@@ -66,44 +91,43 @@
66
91
  border-color: $active-border;
67
92
  }
68
93
 
69
- &:focus,
70
- &.focus {
94
+ .btn-check:focus + &,
95
+ &:focus {
71
96
  box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
72
97
  }
73
98
 
74
- &.disabled,
75
- &:disabled {
76
- color: $color;
77
- background-color: transparent;
78
- }
79
-
80
- &:not(:disabled):not(.disabled):active,
81
- &:not(:disabled):not(.disabled).active,
82
- .show > &.dropdown-toggle {
83
- 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;
84
105
  background-color: $active-background;
85
106
  border-color: $active-border;
86
107
 
87
108
  &:focus {
88
- // Avoid using mixin so we can pass custom focus shadow properly
89
- @if $enable-shadows and $btn-active-box-shadow != none {
90
- 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));
91
111
  } @else {
112
+ // Avoid using mixin so we can pass custom focus shadow properly
92
113
  box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
93
114
  }
94
115
  }
95
116
  }
117
+
118
+ &:disabled,
119
+ &.disabled {
120
+ color: $color;
121
+ background-color: transparent;
122
+ }
96
123
  }
124
+ // scss-docs-end btn-outline-variant-mixin
97
125
 
98
- // Button sizes
99
- @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) {
100
128
  padding: $padding-y $padding-x;
101
- font-size: $font-size;
102
- line-height: $line-height;
129
+ @include font-size($font-size);
103
130
  // Manually declare to provide an override to the browser default
104
- @if $enable-rounded {
105
- border-radius: $border-radius;
106
- } @else {
107
- border-radius: 0;
108
- }
131
+ @include border-radius($border-radius, 0);
109
132
  }
133
+ // scss-docs-end btn-size-mixin