2020-05-19 16:53:54 +00:00
|
|
|
// Button variants
|
|
|
|
//
|
|
|
|
// Easily pump out default styles, as well as :hover, :focus, :active,
|
|
|
|
// and disabled options for all buttons
|
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
// scss-docs-start btn-variant-mixin
|
|
|
|
@mixin button-variant(
|
|
|
|
$background,
|
|
|
|
$border,
|
|
|
|
$color: color-contrast($background),
|
|
|
|
$hover-background: if($color == $color-contrast-light, shade-color($background, $btn-hover-bg-shade-amount), tint-color($background, $btn-hover-bg-tint-amount)),
|
|
|
|
$hover-border: if($color == $color-contrast-light, shade-color($border, $btn-hover-border-shade-amount), tint-color($border, $btn-hover-border-tint-amount)),
|
|
|
|
$hover-color: color-contrast($hover-background),
|
|
|
|
$active-background: if($color == $color-contrast-light, shade-color($background, $btn-active-bg-shade-amount), tint-color($background, $btn-active-bg-tint-amount)),
|
|
|
|
$active-border: if($color == $color-contrast-light, shade-color($border, $btn-active-border-shade-amount), tint-color($border, $btn-active-border-tint-amount)),
|
|
|
|
$active-color: color-contrast($active-background),
|
|
|
|
$disabled-background: $background,
|
|
|
|
$disabled-border: $border,
|
|
|
|
$disabled-color: color-contrast($disabled-background)
|
|
|
|
) {
|
|
|
|
color: $color;
|
2020-05-19 16:53:54 +00:00
|
|
|
@include gradient-bg($background);
|
|
|
|
border-color: $border;
|
|
|
|
@include box-shadow($btn-box-shadow);
|
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
&:hover {
|
|
|
|
color: $hover-color;
|
2020-05-19 16:53:54 +00:00
|
|
|
@include gradient-bg($hover-background);
|
|
|
|
border-color: $hover-border;
|
|
|
|
}
|
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
.btn-check:focus + &,
|
|
|
|
&:focus {
|
|
|
|
color: $hover-color;
|
2020-05-19 16:53:54 +00:00
|
|
|
@include gradient-bg($hover-background);
|
|
|
|
border-color: $hover-border;
|
|
|
|
@if $enable-shadows {
|
2021-07-07 11:12:38 +00:00
|
|
|
@include box-shadow($btn-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5));
|
2020-05-19 16:53:54 +00:00
|
|
|
} @else {
|
|
|
|
// Avoid using mixin so we can pass custom focus shadow properly
|
2021-07-07 11:12:38 +00:00
|
|
|
box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
|
2020-05-19 16:53:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
.btn-check:checked + &,
|
|
|
|
.btn-check:active + &,
|
|
|
|
&:active,
|
|
|
|
&.active,
|
2020-05-19 16:53:54 +00:00
|
|
|
.show > &.dropdown-toggle {
|
2021-07-07 11:12:38 +00:00
|
|
|
color: $active-color;
|
2020-05-19 16:53:54 +00:00
|
|
|
background-color: $active-background;
|
2021-07-07 11:12:38 +00:00
|
|
|
// Remove CSS gradients if they're enabled
|
|
|
|
background-image: if($enable-gradients, none, null);
|
2020-05-19 16:53:54 +00:00
|
|
|
border-color: $active-border;
|
|
|
|
|
|
|
|
&:focus {
|
2021-07-07 11:12:38 +00:00
|
|
|
@if $enable-shadows {
|
|
|
|
@include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5));
|
2020-05-19 16:53:54 +00:00
|
|
|
} @else {
|
|
|
|
// Avoid using mixin so we can pass custom focus shadow properly
|
2021-07-07 11:12:38 +00:00
|
|
|
box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5);
|
2020-05-19 16:53:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-07 11:12:38 +00:00
|
|
|
|
|
|
|
&:disabled,
|
|
|
|
&.disabled {
|
|
|
|
color: $disabled-color;
|
|
|
|
background-color: $disabled-background;
|
|
|
|
// Remove CSS gradients if they're enabled
|
|
|
|
background-image: if($enable-gradients, none, null);
|
|
|
|
border-color: $disabled-border;
|
|
|
|
}
|
2020-05-19 16:53:54 +00:00
|
|
|
}
|
2021-07-07 11:12:38 +00:00
|
|
|
// scss-docs-end btn-variant-mixin
|
2020-05-19 16:53:54 +00:00
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
// scss-docs-start btn-outline-variant-mixin
|
|
|
|
@mixin button-outline-variant(
|
|
|
|
$color,
|
|
|
|
$color-hover: color-contrast($color),
|
|
|
|
$active-background: $color,
|
|
|
|
$active-border: $color,
|
|
|
|
$active-color: color-contrast($active-background)
|
|
|
|
) {
|
2020-05-19 16:53:54 +00:00
|
|
|
color: $color;
|
|
|
|
border-color: $color;
|
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
&:hover {
|
2020-05-19 16:53:54 +00:00
|
|
|
color: $color-hover;
|
|
|
|
background-color: $active-background;
|
|
|
|
border-color: $active-border;
|
|
|
|
}
|
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
.btn-check:focus + &,
|
|
|
|
&:focus {
|
2020-05-19 16:53:54 +00:00
|
|
|
box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
|
|
|
|
}
|
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
.btn-check:checked + &,
|
|
|
|
.btn-check:active + &,
|
|
|
|
&:active,
|
|
|
|
&.active,
|
|
|
|
&.dropdown-toggle.show {
|
|
|
|
color: $active-color;
|
2020-05-19 16:53:54 +00:00
|
|
|
background-color: $active-background;
|
|
|
|
border-color: $active-border;
|
|
|
|
|
|
|
|
&:focus {
|
2021-07-07 11:12:38 +00:00
|
|
|
@if $enable-shadows {
|
2020-05-19 16:53:54 +00:00
|
|
|
@include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba($color, .5));
|
|
|
|
} @else {
|
|
|
|
// Avoid using mixin so we can pass custom focus shadow properly
|
|
|
|
box-shadow: 0 0 0 $btn-focus-width rgba($color, .5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-07-07 11:12:38 +00:00
|
|
|
|
|
|
|
&:disabled,
|
|
|
|
&.disabled {
|
|
|
|
color: $color;
|
|
|
|
background-color: transparent;
|
|
|
|
}
|
2020-05-19 16:53:54 +00:00
|
|
|
}
|
2021-07-07 11:12:38 +00:00
|
|
|
// scss-docs-end btn-outline-variant-mixin
|
2020-05-19 16:53:54 +00:00
|
|
|
|
2021-07-07 11:12:38 +00:00
|
|
|
// scss-docs-start btn-size-mixin
|
|
|
|
@mixin button-size($padding-y, $padding-x, $font-size, $border-radius) {
|
2020-05-19 16:53:54 +00:00
|
|
|
padding: $padding-y $padding-x;
|
|
|
|
@include font-size($font-size);
|
|
|
|
// Manually declare to provide an override to the browser default
|
|
|
|
@include border-radius($border-radius, 0);
|
|
|
|
}
|
2021-07-07 11:12:38 +00:00
|
|
|
// scss-docs-end btn-size-mixin
|