2014-03-10 02:18:48 -04:00
|
|
|
// Form control focus state
|
|
|
|
//
|
|
|
|
// Generate a customized focus state and for any input with the specified color,
|
2017-09-26 11:14:52 -04:00
|
|
|
// which defaults to the `$input-focus-border-color` variable.
|
2014-03-10 02:18:48 -04:00
|
|
|
//
|
|
|
|
// 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.
|
2014-12-02 17:02:35 -05:00
|
|
|
@mixin form-control-focus() {
|
2014-03-10 02:18:48 -04:00
|
|
|
&:focus {
|
(#22414) Rename for consistency `$input-bg-disabled`, `$input-bg-focus`, `$input-border-color-focus`, `$input-box-shadow-focus`, `$input-color-focus`, `$input-color-placeholder` to `$input-disabled-bg`, `$input-focus-bg`, `$input-focus-border-color`, `$input-focus-box-shadow`, `$input-focus-color`, `$input-placeholder-color`, respectively
2017-06-08 22:11:40 -04:00
|
|
|
color: $input-focus-color;
|
|
|
|
background-color: $input-focus-bg;
|
|
|
|
border-color: $input-focus-border-color;
|
2017-11-05 19:23:36 -05:00
|
|
|
outline: 0;
|
2017-10-19 12:03:33 -04:00
|
|
|
// Avoid using mixin so we can pass custom focus shadow properly
|
|
|
|
@if $enable-shadows {
|
2017-10-25 15:30:29 -04:00
|
|
|
box-shadow: $input-box-shadow, $input-focus-box-shadow;
|
2017-10-19 12:03:33 -04:00
|
|
|
} @else {
|
2017-10-25 15:30:29 -04:00
|
|
|
box-shadow: $input-focus-box-shadow;
|
2017-10-19 12:03:33 -04:00
|
|
|
}
|
2014-03-10 02:18:48 -04:00
|
|
|
}
|
|
|
|
}
|
2017-06-10 19:30:26 -04:00
|
|
|
|
|
|
|
|
|
|
|
@mixin form-validation-state($state, $color) {
|
2017-10-02 23:37:28 -04:00
|
|
|
.#{$state}-feedback {
|
|
|
|
display: none;
|
2017-12-22 18:29:49 -05:00
|
|
|
width: 100%;
|
2017-11-14 20:32:08 -05:00
|
|
|
margin-top: $form-feedback-margin-top;
|
|
|
|
font-size: $form-feedback-font-size;
|
2017-10-02 23:37:28 -04:00
|
|
|
color: $color;
|
|
|
|
}
|
|
|
|
|
|
|
|
.#{$state}-tooltip {
|
|
|
|
position: absolute;
|
|
|
|
top: 100%;
|
|
|
|
z-index: 5;
|
|
|
|
display: none;
|
2018-01-03 00:57:56 -05:00
|
|
|
max-width: 100%; // Contain to parent when possible
|
2017-10-02 23:37:28 -04:00
|
|
|
padding: .5rem;
|
|
|
|
margin-top: .1rem;
|
|
|
|
font-size: .875rem;
|
|
|
|
line-height: 1;
|
2018-03-12 13:19:37 -04:00
|
|
|
color: $white;
|
2017-10-22 15:35:13 -04:00
|
|
|
background-color: rgba($color, .8);
|
2017-10-02 23:37:28 -04:00
|
|
|
border-radius: .2rem;
|
|
|
|
}
|
|
|
|
|
2017-06-10 19:30:26 -04:00
|
|
|
.form-control,
|
|
|
|
.custom-select {
|
|
|
|
.was-validated &:#{$state},
|
|
|
|
&.is-#{$state} {
|
|
|
|
border-color: $color;
|
|
|
|
|
|
|
|
&:focus {
|
2017-11-06 15:04:56 -05:00
|
|
|
border-color: $color;
|
2017-10-25 15:30:29 -04:00
|
|
|
box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
|
2017-06-10 19:30:26 -04:00
|
|
|
}
|
|
|
|
|
2017-08-12 20:13:53 -04:00
|
|
|
~ .#{$state}-feedback,
|
|
|
|
~ .#{$state}-tooltip {
|
2017-06-10 19:30:26 -04:00
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.form-check-input {
|
|
|
|
.was-validated &:#{$state},
|
|
|
|
&.is-#{$state} {
|
2017-12-22 19:13:01 -05:00
|
|
|
~ .form-check-label {
|
2017-06-10 19:30:26 -04:00
|
|
|
color: $color;
|
|
|
|
}
|
2018-01-05 13:55:13 -05:00
|
|
|
|
|
|
|
~ .#{$state}-feedback,
|
|
|
|
~ .#{$state}-tooltip {
|
|
|
|
display: block;
|
|
|
|
}
|
2017-06-10 19:30:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-control-input {
|
|
|
|
.was-validated &:#{$state},
|
|
|
|
&.is-#{$state} {
|
2017-12-22 19:13:01 -05:00
|
|
|
~ .custom-control-label {
|
2017-06-10 19:30:26 -04:00
|
|
|
color: $color;
|
2017-12-22 19:13:01 -05:00
|
|
|
|
|
|
|
&::before {
|
|
|
|
background-color: lighten($color, 25%);
|
|
|
|
}
|
2017-06-10 19:30:26 -04:00
|
|
|
}
|
2017-12-24 01:47:37 -05:00
|
|
|
|
|
|
|
~ .#{$state}-feedback,
|
|
|
|
~ .#{$state}-tooltip {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
2017-11-24 17:26:56 -05:00
|
|
|
&:checked {
|
2017-12-22 19:13:01 -05:00
|
|
|
~ .custom-control-label::before {
|
2017-11-24 17:26:56 -05:00
|
|
|
@include gradient-bg(lighten($color, 10%));
|
|
|
|
}
|
|
|
|
}
|
2017-12-24 01:47:37 -05:00
|
|
|
|
2017-10-21 23:57:19 -04:00
|
|
|
&:focus {
|
2017-12-22 19:13:01 -05:00
|
|
|
~ .custom-control-label::before {
|
2017-10-25 15:30:29 -04:00
|
|
|
box-shadow: 0 0 0 1px $body-bg, 0 0 0 $input-focus-width rgba($color, .25);
|
2017-10-21 23:57:19 -04:00
|
|
|
}
|
|
|
|
}
|
2017-06-10 19:30:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// custom file
|
|
|
|
.custom-file-input {
|
|
|
|
.was-validated &:#{$state},
|
|
|
|
&.is-#{$state} {
|
2017-12-24 01:47:37 -05:00
|
|
|
~ .custom-file-label {
|
2017-06-10 19:30:26 -04:00
|
|
|
border-color: $color;
|
|
|
|
|
|
|
|
&::before { border-color: inherit; }
|
|
|
|
}
|
2017-12-24 01:47:37 -05:00
|
|
|
|
|
|
|
~ .#{$state}-feedback,
|
|
|
|
~ .#{$state}-tooltip {
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
2017-06-10 19:30:26 -04:00
|
|
|
&:focus {
|
2017-12-24 01:47:37 -05:00
|
|
|
~ .custom-file-label {
|
2017-10-25 15:30:29 -04:00
|
|
|
box-shadow: 0 0 0 $input-focus-width rgba($color, .25);
|
2017-10-22 15:37:45 -04:00
|
|
|
}
|
2017-06-10 19:30:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|