diff options
Diffstat (limited to 'vendor/twbs/bootstrap/scss/mixins/_buttons.scss')
-rw-r--r-- | vendor/twbs/bootstrap/scss/mixins/_buttons.scss | 119 |
1 files changed, 71 insertions, 48 deletions
diff --git a/vendor/twbs/bootstrap/scss/mixins/_buttons.scss b/vendor/twbs/bootstrap/scss/mixins/_buttons.scss index d6235aa27..b67499668 100644 --- a/vendor/twbs/bootstrap/scss/mixins/_buttons.scss +++ b/vendor/twbs/bootstrap/scss/mixins/_buttons.scss @@ -3,94 +3,110 @@ // Easily pump out default styles, as well as :hover, :focus, :active, // and disabled options for all buttons -@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%)) { - color: color-yiq($background); +// 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; @include gradient-bg($background); border-color: $border; @include box-shadow($btn-box-shadow); - @include hover() { - color: color-yiq($hover-background); + &:hover { + color: $hover-color; @include gradient-bg($hover-background); border-color: $hover-border; } - &:focus, - &.focus { - color: color-yiq($hover-background); + .btn-check:focus + &, + &:focus { + color: $hover-color; @include gradient-bg($hover-background); border-color: $hover-border; @if $enable-shadows { - @include box-shadow($btn-box-shadow, 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5)); + @include box-shadow($btn-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5)); } @else { // Avoid using mixin so we can pass custom focus shadow properly - box-shadow: 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5); - } - } - - // Disabled comes first so active can properly restyle - &.disabled, - &:disabled { - color: color-yiq($background); - background-color: $background; - border-color: $border; - // Remove CSS gradients if they're enabled - @if $enable-gradients { - background-image: none; + box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5); } } - &:not(:disabled):not(.disabled):active, - &:not(:disabled):not(.disabled).active, + .btn-check:checked + &, + .btn-check:active + &, + &:active, + &.active, .show > &.dropdown-toggle { - color: color-yiq($active-background); + color: $active-color; background-color: $active-background; - @if $enable-gradients { - background-image: none; // Remove the gradient for the pressed/active state - } + // Remove CSS gradients if they're enabled + background-image: if($enable-gradients, none, null); border-color: $active-border; &:focus { - @if $enable-shadows and $btn-active-box-shadow != none { - @include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5)); + @if $enable-shadows { + @include box-shadow($btn-active-box-shadow, 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5)); } @else { // Avoid using mixin so we can pass custom focus shadow properly - box-shadow: 0 0 0 $btn-focus-width rgba(mix(color-yiq($background), $border, 15%), .5); + box-shadow: 0 0 0 $btn-focus-width rgba(mix($color, $border, 15%), .5); } } } + + &: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; + } } +// scss-docs-end btn-variant-mixin -@mixin button-outline-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) { +// 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) +) { color: $color; border-color: $color; - @include hover() { + &:hover { color: $color-hover; background-color: $active-background; border-color: $active-border; } - &:focus, - &.focus { + .btn-check:focus + &, + &:focus { box-shadow: 0 0 0 $btn-focus-width rgba($color, .5); } - &.disabled, - &:disabled { - color: $color; - background-color: transparent; - } - - &:not(:disabled):not(.disabled):active, - &:not(:disabled):not(.disabled).active, - .show > &.dropdown-toggle { - color: color-yiq($active-background); + .btn-check:checked + &, + .btn-check:active + &, + &:active, + &.active, + &.dropdown-toggle.show { + color: $active-color; background-color: $active-background; border-color: $active-border; &:focus { - @if $enable-shadows and $btn-active-box-shadow != none { + @if $enable-shadows { @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 @@ -98,13 +114,20 @@ } } } + + &:disabled, + &.disabled { + color: $color; + background-color: transparent; + } } +// scss-docs-end btn-outline-variant-mixin -// Button sizes -@mixin button-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) { +// scss-docs-start btn-size-mixin +@mixin button-size($padding-y, $padding-x, $font-size, $border-radius) { padding: $padding-y $padding-x; @include font-size($font-size); - line-height: $line-height; // Manually declare to provide an override to the browser default @include border-radius($border-radius, 0); } +// scss-docs-end btn-size-mixin |