2024-07-29 22:04:11 -07:00
|
|
|
@use "functions";
|
|
|
|
@use "mixins/border-radius";
|
|
|
|
@use "mixins/box-shadow";
|
|
|
|
@use "mixins/buttons";
|
|
|
|
@use "mixins/gradients";
|
|
|
|
@use "mixins/transition";
|
|
|
|
@use "variables";
|
|
|
|
@use "vendor/rfs";
|
|
|
|
|
2015-04-18 11:15:40 -07:00
|
|
|
//
|
2012-01-26 11:10:07 -08:00
|
|
|
// Base styles
|
2015-04-18 11:15:40 -07:00
|
|
|
//
|
2012-01-26 11:10:07 -08:00
|
|
|
|
2012-12-19 22:25:56 -08:00
|
|
|
.btn {
|
2021-07-27 21:36:12 -07:00
|
|
|
// scss-docs-start btn-css-vars
|
2024-07-29 22:04:11 -07:00
|
|
|
--#{variables.$prefix}btn-padding-x: #{variables.$btn-padding-x};
|
|
|
|
--#{variables.$prefix}btn-padding-y: #{variables.$btn-padding-y};
|
|
|
|
--#{variables.$prefix}btn-font-family: #{variables.$btn-font-family};
|
|
|
|
@include rfs.rfs(variables.$btn-font-size, --#{variables.$prefix}btn-font-size);
|
|
|
|
--#{variables.$prefix}btn-font-weight: #{variables.$btn-font-weight};
|
|
|
|
--#{variables.$prefix}btn-line-height: #{variables.$btn-line-height};
|
|
|
|
--#{variables.$prefix}btn-color: #{variables.$btn-color};
|
|
|
|
--#{variables.$prefix}btn-bg: transparent;
|
|
|
|
--#{variables.$prefix}btn-border-width: #{variables.$btn-border-width};
|
|
|
|
--#{variables.$prefix}btn-border-color: transparent;
|
|
|
|
--#{variables.$prefix}btn-border-radius: #{variables.$btn-border-radius};
|
|
|
|
--#{variables.$prefix}btn-hover-border-color: transparent;
|
|
|
|
--#{variables.$prefix}btn-box-shadow: #{variables.$btn-box-shadow};
|
|
|
|
--#{variables.$prefix}btn-disabled-opacity: #{variables.$btn-disabled-opacity};
|
|
|
|
--#{variables.$prefix}btn-focus-box-shadow: 0 0 0 #{variables.$btn-focus-width} rgba(var(--#{variables.$prefix}btn-focus-shadow-rgb), .5);
|
2021-07-27 21:36:12 -07:00
|
|
|
// scss-docs-end btn-css-vars
|
|
|
|
|
2012-12-19 22:25:56 -08:00
|
|
|
display: inline-block;
|
2024-07-29 22:04:11 -07:00
|
|
|
padding: var(--#{variables.$prefix}btn-padding-y) var(--#{variables.$prefix}btn-padding-x);
|
|
|
|
font-family: var(--#{variables.$prefix}btn-font-family);
|
|
|
|
@include rfs.font-size(var(--#{variables.$prefix}btn-font-size));
|
|
|
|
font-weight: var(--#{variables.$prefix}btn-font-weight);
|
|
|
|
line-height: var(--#{variables.$prefix}btn-line-height);
|
|
|
|
color: var(--#{variables.$prefix}btn-color);
|
2012-12-19 22:54:04 -08:00
|
|
|
text-align: center;
|
2024-07-29 22:04:11 -07:00
|
|
|
text-decoration: if(variables.$link-decoration == none, null, none);
|
|
|
|
white-space: variables.$btn-white-space;
|
2012-12-19 22:25:56 -08:00
|
|
|
vertical-align: middle;
|
2024-07-29 22:04:11 -07:00
|
|
|
cursor: if(variables.$enable-button-pointers, pointer, null);
|
2014-12-11 12:05:29 -08:00
|
|
|
user-select: none;
|
2024-07-29 22:04:11 -07:00
|
|
|
border: var(--#{variables.$prefix}btn-border-width) solid var(--#{variables.$prefix}btn-border-color);
|
|
|
|
@include border-radius.border-radius(var(--#{variables.$prefix}btn-border-radius));
|
|
|
|
@include gradients.gradient-bg(var(--#{variables.$prefix}btn-bg));
|
|
|
|
@include box-shadow.box-shadow(var(--#{variables.$prefix}btn-box-shadow));
|
|
|
|
@include transition.transition(variables.$btn-transition);
|
2012-12-19 22:25:56 -08:00
|
|
|
|
2022-09-20 14:15:46 +01:00
|
|
|
&:hover {
|
2024-07-29 22:04:11 -07:00
|
|
|
color: var(--#{variables.$prefix}btn-hover-color);
|
|
|
|
text-decoration: if(variables.$link-hover-decoration == underline, none, null);
|
|
|
|
background-color: var(--#{variables.$prefix}btn-hover-bg);
|
|
|
|
border-color: var(--#{variables.$prefix}btn-hover-border-color);
|
2015-01-01 01:05:01 -08:00
|
|
|
}
|
2017-12-27 16:42:59 -08:00
|
|
|
|
2022-09-20 14:15:46 +01:00
|
|
|
.btn-check + &:hover {
|
|
|
|
// override for the checkbox/radio buttons
|
2024-07-29 22:04:11 -07:00
|
|
|
color: var(--#{variables.$prefix}btn-color);
|
|
|
|
background-color: var(--#{variables.$prefix}btn-bg);
|
|
|
|
border-color: var(--#{variables.$prefix}btn-border-color);
|
2022-09-20 14:15:46 +01:00
|
|
|
}
|
|
|
|
|
2022-09-04 17:59:14 +01:00
|
|
|
&:focus-visible {
|
2024-07-29 22:04:11 -07:00
|
|
|
color: var(--#{variables.$prefix}btn-hover-color);
|
|
|
|
@include gradients.gradient-bg(var(--#{variables.$prefix}btn-hover-bg));
|
|
|
|
border-color: var(--#{variables.$prefix}btn-hover-border-color);
|
2022-09-04 17:59:14 +01:00
|
|
|
outline: 0;
|
2021-07-27 21:36:12 -07:00
|
|
|
// Avoid using mixin so we can pass custom focus shadow properly
|
2024-07-29 22:04:11 -07:00
|
|
|
@if variables.$enable-shadows {
|
|
|
|
box-shadow: var(--#{variables.$prefix}btn-box-shadow), var(--#{variables.$prefix}btn-focus-box-shadow);
|
2021-07-27 21:36:12 -07:00
|
|
|
} @else {
|
2024-07-29 22:04:11 -07:00
|
|
|
box-shadow: var(--#{variables.$prefix}btn-focus-box-shadow);
|
2021-07-27 21:36:12 -07:00
|
|
|
}
|
2013-12-18 14:29:33 -08:00
|
|
|
}
|
|
|
|
|
2022-09-04 17:59:14 +01:00
|
|
|
.btn-check:focus-visible + & {
|
2024-07-29 22:04:11 -07:00
|
|
|
border-color: var(--#{variables.$prefix}btn-hover-border-color);
|
2022-09-01 02:30:23 +01:00
|
|
|
outline: 0;
|
2022-09-04 17:59:14 +01:00
|
|
|
// Avoid using mixin so we can pass custom focus shadow properly
|
2024-07-29 22:04:11 -07:00
|
|
|
@if variables.$enable-shadows {
|
|
|
|
box-shadow: var(--#{variables.$prefix}btn-box-shadow), var(--#{variables.$prefix}btn-focus-box-shadow);
|
2022-09-04 17:59:14 +01:00
|
|
|
} @else {
|
2024-07-29 22:04:11 -07:00
|
|
|
box-shadow: var(--#{variables.$prefix}btn-focus-box-shadow);
|
2022-09-04 17:59:14 +01:00
|
|
|
}
|
2022-09-01 02:30:23 +01:00
|
|
|
}
|
|
|
|
|
2020-06-04 15:59:24 +02:00
|
|
|
.btn-check:checked + &,
|
2022-09-04 17:59:14 +01:00
|
|
|
:not(.btn-check) + &:active,
|
|
|
|
&:first-child:active,
|
2021-07-27 21:36:12 -07:00
|
|
|
&.active,
|
2022-02-15 14:04:16 +01:00
|
|
|
&.show {
|
2024-07-29 22:04:11 -07:00
|
|
|
color: var(--#{variables.$prefix}btn-active-color);
|
|
|
|
background-color: var(--#{variables.$prefix}btn-active-bg);
|
2021-07-27 21:36:12 -07:00
|
|
|
// Remove CSS gradients if they're enabled
|
2024-07-29 22:04:11 -07:00
|
|
|
background-image: if(variables.$enable-gradients, none, null);
|
|
|
|
border-color: var(--#{variables.$prefix}btn-active-border-color);
|
|
|
|
@include box-shadow.box-shadow(var(--#{variables.$prefix}btn-active-shadow));
|
2017-12-23 20:33:41 -08:00
|
|
|
|
2022-09-04 17:59:14 +01:00
|
|
|
&:focus-visible {
|
2021-07-27 21:36:12 -07:00
|
|
|
// Avoid using mixin so we can pass custom focus shadow properly
|
2024-07-29 22:04:11 -07:00
|
|
|
@if variables.$enable-shadows {
|
|
|
|
box-shadow: var(--#{variables.$prefix}btn-active-shadow), var(--#{variables.$prefix}btn-focus-box-shadow);
|
2021-07-27 21:36:12 -07:00
|
|
|
} @else {
|
2024-07-29 22:04:11 -07:00
|
|
|
box-shadow: var(--#{variables.$prefix}btn-focus-box-shadow);
|
2021-07-27 21:36:12 -07:00
|
|
|
}
|
2017-12-23 20:33:41 -08:00
|
|
|
}
|
2016-12-26 14:42:29 -08:00
|
|
|
}
|
2015-03-17 10:24:31 -07:00
|
|
|
|
2024-02-06 20:59:42 +01:00
|
|
|
.btn-check:checked:focus-visible + & {
|
|
|
|
// Avoid using mixin so we can pass custom focus shadow properly
|
2024-07-29 22:04:11 -07:00
|
|
|
@if variables.$enable-shadows {
|
|
|
|
box-shadow: var(--#{variables.$prefix}btn-active-shadow), var(--#{variables.$prefix}btn-focus-box-shadow);
|
2024-02-06 20:59:42 +01:00
|
|
|
} @else {
|
2024-07-29 22:04:11 -07:00
|
|
|
box-shadow: var(--#{variables.$prefix}btn-focus-box-shadow);
|
2024-02-06 20:59:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-27 17:40:06 +01:00
|
|
|
&:disabled,
|
|
|
|
&.disabled,
|
2020-06-12 11:11:36 +03:00
|
|
|
fieldset:disabled & {
|
2024-07-29 22:04:11 -07:00
|
|
|
color: var(--#{variables.$prefix}btn-disabled-color);
|
2019-12-27 17:40:06 +01:00
|
|
|
pointer-events: none;
|
2024-07-29 22:04:11 -07:00
|
|
|
background-color: var(--#{variables.$prefix}btn-disabled-bg);
|
|
|
|
background-image: if(variables.$enable-gradients, none, null);
|
|
|
|
border-color: var(--#{variables.$prefix}btn-disabled-border-color);
|
|
|
|
opacity: var(--#{variables.$prefix}btn-disabled-opacity);
|
|
|
|
@include box-shadow.box-shadow(none);
|
2019-12-27 17:40:06 +01:00
|
|
|
}
|
2012-12-19 22:25:56 -08:00
|
|
|
}
|
|
|
|
|
2012-01-30 20:50:51 -08:00
|
|
|
|
2015-04-18 11:15:40 -07:00
|
|
|
//
|
2012-01-30 20:50:51 -08:00
|
|
|
// Alternate buttons
|
2015-04-18 11:15:40 -07:00
|
|
|
//
|
2012-01-30 20:50:51 -08:00
|
|
|
|
2021-02-10 19:29:59 -08:00
|
|
|
// scss-docs-start btn-variant-loops
|
2024-07-29 22:04:11 -07:00
|
|
|
@each $color, $value in variables.$theme-colors {
|
2017-06-18 02:57:16 -07:00
|
|
|
.btn-#{$color} {
|
2022-04-13 20:43:37 -07:00
|
|
|
@if $color == "light" {
|
2024-07-29 22:04:11 -07:00
|
|
|
@include buttons.button-variant(
|
2022-04-13 20:43:37 -07:00
|
|
|
$value,
|
|
|
|
$value,
|
2024-07-29 22:04:11 -07:00
|
|
|
$hover-background: functions.shade-color($value, variables.$btn-hover-bg-shade-amount),
|
|
|
|
$hover-border: functions.shade-color($value, variables.$btn-hover-border-shade-amount),
|
|
|
|
$active-background: functions.shade-color($value, variables.$btn-active-bg-shade-amount),
|
|
|
|
$active-border: functions.shade-color($value, variables.$btn-active-border-shade-amount)
|
2022-04-13 20:43:37 -07:00
|
|
|
);
|
|
|
|
} @else if $color == "dark" {
|
2024-07-29 22:04:11 -07:00
|
|
|
@include buttons.button-variant(
|
2022-04-13 20:43:37 -07:00
|
|
|
$value,
|
|
|
|
$value,
|
2024-07-29 22:04:11 -07:00
|
|
|
$hover-background: functions.tint-color($value, variables.$btn-hover-bg-tint-amount),
|
|
|
|
$hover-border: functions.tint-color($value, variables.$btn-hover-border-tint-amount),
|
|
|
|
$active-background: functions.tint-color($value, variables.$btn-active-bg-tint-amount),
|
|
|
|
$active-border: functions.tint-color($value, variables.$btn-active-border-tint-amount)
|
2022-04-13 20:43:37 -07:00
|
|
|
);
|
|
|
|
} @else {
|
2024-07-29 22:04:11 -07:00
|
|
|
@include buttons.button-variant($value, $value);
|
2022-04-13 20:43:37 -07:00
|
|
|
}
|
2017-06-18 02:57:16 -07:00
|
|
|
}
|
2012-01-30 20:50:51 -08:00
|
|
|
}
|
|
|
|
|
2024-07-29 22:04:11 -07:00
|
|
|
@each $color, $value in variables.$theme-colors {
|
2017-06-18 02:57:16 -07:00
|
|
|
.btn-outline-#{$color} {
|
2024-07-29 22:04:11 -07:00
|
|
|
@include buttons.button-outline-variant($value);
|
2017-06-18 02:57:16 -07:00
|
|
|
}
|
2015-08-09 22:48:48 -07:00
|
|
|
}
|
2021-02-10 19:29:59 -08:00
|
|
|
// scss-docs-end btn-variant-loops
|
2015-08-09 22:48:48 -07:00
|
|
|
|
2012-07-17 23:32:52 -07:00
|
|
|
|
2015-04-18 11:15:40 -07:00
|
|
|
//
|
2012-07-17 23:32:52 -07:00
|
|
|
// Link buttons
|
2015-04-18 11:15:40 -07:00
|
|
|
//
|
2012-07-17 23:32:52 -07:00
|
|
|
|
|
|
|
// Make a button look and behave like a link
|
2012-08-18 16:30:47 -07:00
|
|
|
.btn-link {
|
2024-07-29 22:04:11 -07:00
|
|
|
--#{variables.$prefix}btn-font-weight: #{variables.$font-weight-normal};
|
|
|
|
--#{variables.$prefix}btn-color: #{variables.$btn-link-color};
|
|
|
|
--#{variables.$prefix}btn-bg: transparent;
|
|
|
|
--#{variables.$prefix}btn-border-color: transparent;
|
|
|
|
--#{variables.$prefix}btn-hover-color: #{variables.$btn-link-hover-color};
|
|
|
|
--#{variables.$prefix}btn-hover-border-color: transparent;
|
|
|
|
--#{variables.$prefix}btn-active-color: #{variables.$btn-link-hover-color};
|
|
|
|
--#{variables.$prefix}btn-active-border-color: transparent;
|
|
|
|
--#{variables.$prefix}btn-disabled-color: #{variables.$btn-link-disabled-color};
|
|
|
|
--#{variables.$prefix}btn-disabled-border-color: transparent;
|
|
|
|
--#{variables.$prefix}btn-box-shadow: 0 0 0 #000; // Can't use `none` as keyword negates all values when used with multiple shadows
|
|
|
|
--#{variables.$prefix}btn-focus-shadow-rgb: #{variables.$btn-link-focus-shadow-rgb};
|
|
|
|
|
|
|
|
text-decoration: variables.$link-decoration;
|
|
|
|
@if variables.$enable-gradients {
|
2022-09-02 15:48:48 -07:00
|
|
|
background-image: none;
|
|
|
|
}
|
2017-08-13 14:55:28 -07:00
|
|
|
|
2021-07-27 21:36:12 -07:00
|
|
|
&:hover,
|
2022-09-04 17:59:14 +01:00
|
|
|
&:focus-visible {
|
2024-07-29 22:04:11 -07:00
|
|
|
text-decoration: variables.$link-hover-decoration;
|
2013-07-06 22:13:37 -07:00
|
|
|
}
|
2016-12-26 14:02:24 -08:00
|
|
|
|
2022-09-04 17:59:14 +01:00
|
|
|
&:focus-visible {
|
2024-07-29 22:04:11 -07:00
|
|
|
color: var(--#{variables.$prefix}btn-color);
|
2022-07-16 11:33:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
2024-07-29 22:04:11 -07:00
|
|
|
color: var(--#{variables.$prefix}btn-hover-color);
|
2022-07-16 11:33:45 +02:00
|
|
|
}
|
|
|
|
|
2017-08-13 14:55:28 -07:00
|
|
|
// No need for an active state here
|
2012-08-31 14:02:18 -07:00
|
|
|
}
|
2013-05-07 18:07:06 -07:00
|
|
|
|
|
|
|
|
2015-04-18 11:15:40 -07:00
|
|
|
//
|
2013-05-07 18:07:06 -07:00
|
|
|
// Button Sizes
|
2015-04-18 11:15:40 -07:00
|
|
|
//
|
2013-05-07 18:07:06 -07:00
|
|
|
|
2013-08-03 21:39:57 -07:00
|
|
|
.btn-lg {
|
2024-07-29 22:04:11 -07:00
|
|
|
@include buttons.button-size(variables.$btn-padding-y-lg, variables.$btn-padding-x-lg, variables.$btn-font-size-lg, variables.$btn-border-radius-lg);
|
2013-05-07 18:07:06 -07:00
|
|
|
}
|
2017-03-28 09:28:27 -07:00
|
|
|
|
2013-12-03 18:03:04 -08:00
|
|
|
.btn-sm {
|
2024-07-29 22:04:11 -07:00
|
|
|
@include buttons.button-size(variables.$btn-padding-y-sm, variables.$btn-padding-x-sm, variables.$btn-font-size-sm, variables.$btn-border-radius-sm);
|
2013-07-29 17:08:04 -07:00
|
|
|
}
|