aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/scss/mixins/_forms.scss
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/scss/mixins/_forms.scss')
-rw-r--r--vendor/twbs/bootstrap/scss/mixins/_forms.scss125
1 files changed, 42 insertions, 83 deletions
diff --git a/vendor/twbs/bootstrap/scss/mixins/_forms.scss b/vendor/twbs/bootstrap/scss/mixins/_forms.scss
index a32163049..dc5bdb0b9 100644
--- a/vendor/twbs/bootstrap/scss/mixins/_forms.scss
+++ b/vendor/twbs/bootstrap/scss/mixins/_forms.scss
@@ -1,33 +1,7 @@
-// Form control focus state
-//
-// Generate a customized focus state and for any input with the specified color,
-// which defaults to the `$input-focus-border-color` variable.
-//
-// We highly encourage you to not customize the default value, but instead use
-// this to tweak colors on an as-needed basis. This aesthetic change is based on
-// WebKit's default styles, but applicable to a wider range of browsers. Its
-// usability and accessibility should be taken into account with any change.
-//
-// Example usage: change the default blue border and shadow to white for better
-// contrast against a dark gray background.
-@mixin form-control-focus($ignore-warning: false) {
- &:focus {
- color: $input-focus-color;
- background-color: $input-focus-bg;
- border-color: $input-focus-border-color;
- outline: 0;
- @if $enable-shadows {
- @include box-shadow($input-box-shadow, $input-focus-box-shadow);
- } @else {
- // Avoid using mixin so we can pass custom focus shadow properly
- box-shadow: $input-focus-box-shadow;
- }
- }
- @include deprecate("The `form-control-focus()` mixin", "v4.4.0", "v5", $ignore-warning);
-}
-
// This mixin uses an `if()` technique to be compatible with Dart Sass
// See https://github.com/sass/sass/issues/1873#issuecomment-152293725 for more details
+
+// scss-docs-start form-validation-mixins
@mixin form-validation-state-selector($state) {
@if ($state == "valid" or $state == "invalid") {
.was-validated #{if(&, "&", "")}:#{$state},
@@ -41,19 +15,26 @@
}
}
-@mixin form-validation-state($state, $color, $icon) {
+@mixin form-validation-state(
+ $state,
+ $color,
+ $icon,
+ $tooltip-color: color-contrast($color),
+ $tooltip-bg-color: rgba($color, $form-feedback-tooltip-opacity),
+ $focus-box-shadow: 0 0 $input-btn-focus-blur $input-focus-width rgba($color, $input-btn-focus-color-opacity)
+) {
.#{$state}-feedback {
display: none;
width: 100%;
margin-top: $form-feedback-margin-top;
@include font-size($form-feedback-font-size);
+ font-style: $form-feedback-font-style;
color: $color;
}
.#{$state}-tooltip {
position: absolute;
top: 100%;
- left: 0;
z-index: 5;
display: none;
max-width: 100%; // Contain to parent when possible
@@ -61,16 +42,9 @@
margin-top: .1rem;
@include font-size($form-feedback-tooltip-font-size);
line-height: $form-feedback-tooltip-line-height;
- color: color-yiq($color);
- background-color: rgba($color, $form-feedback-tooltip-opacity);
+ color: $tooltip-color;
+ background-color: $tooltip-bg-color;
@include border-radius($form-feedback-tooltip-border-radius);
-
- // See https://github.com/twbs/bootstrap/pull/31557
- // Align tooltip to form elements
- .form-row > .col > &,
- .form-row > [class*="col-"] > & {
- left: $form-grid-gutter-width / 2;
- }
}
@include form-validation-state-selector($state) {
@@ -94,7 +68,7 @@
&:focus {
border-color: $color;
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
+ box-shadow: $focus-box-shadow;
}
}
}
@@ -109,77 +83,62 @@
}
}
- .custom-select {
+ .form-select {
@include form-validation-state-selector($state) {
border-color: $color;
@if $enable-validation-icons {
- padding-right: $custom-select-feedback-icon-padding-right;
- background: $custom-select-background, $custom-select-bg escape-svg($icon) $custom-select-feedback-icon-position / $custom-select-feedback-icon-size no-repeat;
+ &:not([multiple]):not([size]),
+ &:not([multiple])[size="1"] {
+ padding-right: $form-select-feedback-icon-padding-end;
+ background-image: escape-svg($form-select-indicator), escape-svg($icon);
+ background-position: $form-select-bg-position, $form-select-feedback-icon-position;
+ background-size: $form-select-bg-size, $form-select-feedback-icon-size;
+ }
}
&:focus {
border-color: $color;
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
+ box-shadow: $focus-box-shadow;
}
}
}
.form-check-input {
@include form-validation-state-selector($state) {
- ~ .form-check-label {
- color: $color;
- }
-
- ~ .#{$state}-feedback,
- ~ .#{$state}-tooltip {
- display: block;
- }
- }
- }
-
- .custom-control-input {
- @include form-validation-state-selector($state) {
- ~ .custom-control-label {
- color: $color;
-
- &::before {
- border-color: $color;
- }
- }
+ border-color: $color;
&:checked {
- ~ .custom-control-label::before {
- border-color: lighten($color, 10%);
- @include gradient-bg(lighten($color, 10%));
- }
+ background-color: $color;
}
&:focus {
- ~ .custom-control-label::before {
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
- }
+ box-shadow: $focus-box-shadow;
+ }
- &:not(:checked) ~ .custom-control-label::before {
- border-color: $color;
- }
+ ~ .form-check-label {
+ color: $color;
}
}
}
+ .form-check-inline .form-check-input {
+ ~ .#{$state}-feedback {
+ margin-left: .5em;
+ }
+ }
- // custom file
- .custom-file-input {
+ .input-group .form-control,
+ .input-group .form-select {
@include form-validation-state-selector($state) {
- ~ .custom-file-label {
- border-color: $color;
+ @if $state == "valid" {
+ z-index: 1;
+ } @else if $state == "invalid" {
+ z-index: 2;
}
-
&:focus {
- ~ .custom-file-label {
- border-color: $color;
- box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
- }
+ z-index: 3;
}
}
}
}
+// scss-docs-end form-validation-mixins