2022-08-31 08:23:22 +02:00
|
|
|
// stylelint-disable max-nesting-depth
|
|
|
|
|
|
|
|
// Core button styles
|
|
|
|
|
2021-12-23 03:42:22 +01:00
|
|
|
@use 'sass:color';
|
2022-08-31 08:23:22 +02:00
|
|
|
|
2019-01-02 00:11:47 +01:00
|
|
|
.button {
|
2022-08-31 08:23:22 +02:00
|
|
|
border-radius: theme('borderRadius.sm');
|
2019-01-02 00:11:47 +01:00
|
|
|
width: auto;
|
2022-08-31 08:23:22 +02:00
|
|
|
height: 2.25em;
|
2019-01-02 00:11:47 +01:00
|
|
|
padding: 0 1em;
|
2022-08-31 08:23:22 +02:00
|
|
|
font-size: theme('fontSize.14');
|
|
|
|
font-weight: theme('fontWeight.normal');
|
2022-09-05 12:46:57 +02:00
|
|
|
line-height: calc(2.25em - 2px); // account for border
|
2019-01-02 00:11:47 +01:00
|
|
|
vertical-align: middle;
|
|
|
|
display: inline-block;
|
|
|
|
background-color: $color-button;
|
|
|
|
border: 1px solid $color-button;
|
|
|
|
color: $color-white;
|
|
|
|
text-decoration: none;
|
|
|
|
white-space: nowrap;
|
|
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
2022-08-31 08:23:22 +02:00
|
|
|
transition: background-color 0.1s ease;
|
2019-01-02 00:11:47 +01:00
|
|
|
// stylelint-disable-next-line property-no-vendor-prefix
|
|
|
|
-moz-appearance: none;
|
2022-08-31 08:23:22 +02:00
|
|
|
-webkit-font-smoothing: auto;
|
2022-02-04 12:57:55 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
+ .button {
|
|
|
|
// ensure buttons can sit next to each other with a nice margin
|
|
|
|
margin-inline-start: theme('spacing.4');
|
|
|
|
}
|
2022-02-04 12:57:55 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.button-small {
|
|
|
|
padding: 0 0.8em;
|
|
|
|
height: 2em;
|
|
|
|
font-size: calc(theme('fontSize.14') * 0.87);
|
2022-09-05 12:46:57 +02:00
|
|
|
line-height: calc(2em - 2px); // account for border
|
2022-08-31 08:23:22 +02:00
|
|
|
}
|
|
|
|
|
2022-09-07 10:05:23 +02:00
|
|
|
&.button--icon {
|
|
|
|
.icon {
|
|
|
|
@include svg-icon(1.5em);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.button-secondary {
|
|
|
|
color: $color-button;
|
|
|
|
background-color: transparent;
|
2022-09-08 10:53:34 +02:00
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: theme('colors.secondary.50');
|
|
|
|
border-color: currentColor;
|
|
|
|
color: $color-button;
|
|
|
|
}
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
|
2019-01-02 00:11:47 +01:00
|
|
|
&.warning {
|
|
|
|
background-color: $color-button-warning;
|
2022-09-05 12:46:57 +02:00
|
|
|
border-color: $color-button-warning;
|
2022-02-04 12:57:55 +01:00
|
|
|
|
2019-01-02 00:11:47 +01:00
|
|
|
&.button-secondary {
|
2022-09-05 12:46:57 +02:00
|
|
|
border-color: $color-button-warning;
|
2019-01-02 00:11:47 +01:00
|
|
|
color: $color-button-warning;
|
|
|
|
background-color: transparent;
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
|
2019-01-02 00:11:47 +01:00
|
|
|
&:hover {
|
|
|
|
color: $color-white;
|
|
|
|
border-color: transparent;
|
2022-07-09 08:32:51 +02:00
|
|
|
background-color: $color-button-warning;
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-08 10:53:34 +02:00
|
|
|
// no/serious is not compatible with the button-secondary class
|
2022-02-04 12:57:55 +01:00
|
|
|
&.no,
|
2019-01-02 00:11:47 +01:00
|
|
|
&.serious {
|
2022-09-06 20:48:59 +02:00
|
|
|
background-color: $color-white;
|
|
|
|
border: 1px solid $color-button-no;
|
|
|
|
color: $color-button-no;
|
2022-02-04 12:57:55 +01:00
|
|
|
|
2019-01-02 00:11:47 +01:00
|
|
|
&:hover {
|
2022-09-13 13:58:09 +02:00
|
|
|
color: $color-button-no;
|
|
|
|
border-color: $color-button-no;
|
|
|
|
background-color: theme('colors.critical.50');
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-02 00:11:47 +01:00
|
|
|
&.bicolor {
|
2022-03-15 14:21:06 +01:00
|
|
|
padding-inline-start: 3.5em;
|
2022-02-04 12:57:55 +01:00
|
|
|
|
2020-06-15 11:44:18 +02:00
|
|
|
&:before {
|
|
|
|
// iconfont
|
2022-08-31 08:23:22 +02:00
|
|
|
font-size: theme('fontSize.15');
|
2019-01-02 00:11:47 +01:00
|
|
|
position: absolute;
|
2022-03-15 14:21:06 +01:00
|
|
|
inset-inline-start: 0;
|
2022-02-04 12:57:55 +01:00
|
|
|
top: 0;
|
2019-01-02 00:11:47 +01:00
|
|
|
width: 2em;
|
2022-08-31 08:23:22 +02:00
|
|
|
line-height: inherit;
|
2019-01-02 00:11:47 +01:00
|
|
|
height: 100%;
|
|
|
|
text-align: center;
|
2022-07-09 08:32:51 +02:00
|
|
|
background-color: theme('colors.black-20');
|
2019-01-02 00:11:47 +01:00
|
|
|
display: block;
|
2022-03-15 14:21:06 +01:00
|
|
|
// Remove once we drop support for Safari 14.
|
|
|
|
// stylelint-disable-next-line property-disallowed-list
|
2019-01-02 00:11:47 +01:00
|
|
|
border-top-left-radius: inherit;
|
2022-03-15 14:21:06 +01:00
|
|
|
border-start-start-radius: inherit;
|
|
|
|
// Remove once we drop support for Safari 14.
|
|
|
|
// stylelint-disable-next-line property-disallowed-list
|
2019-01-02 00:11:47 +01:00
|
|
|
border-bottom-left-radius: inherit;
|
2022-03-15 14:21:06 +01:00
|
|
|
border-end-start-radius: inherit;
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
|
2020-06-15 11:44:18 +02:00
|
|
|
.icon-wrapper {
|
2022-07-09 08:32:51 +02:00
|
|
|
background-color: theme('colors.black-20');
|
2022-04-29 13:59:52 +02:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2020-06-15 11:44:18 +02:00
|
|
|
position: absolute;
|
2022-03-15 14:21:06 +01:00
|
|
|
inset-inline-start: 0;
|
2022-02-04 12:57:55 +01:00
|
|
|
top: 0;
|
2020-06-15 11:44:18 +02:00
|
|
|
width: 3em;
|
|
|
|
height: 100%;
|
2022-07-25 04:33:09 +02:00
|
|
|
box-sizing: content-box;
|
2020-06-15 11:44:18 +02:00
|
|
|
text-align: center;
|
2022-03-15 14:21:06 +01:00
|
|
|
// Remove once we drop support for Safari 14.
|
|
|
|
// stylelint-disable-next-line property-disallowed-list
|
2020-06-15 11:44:18 +02:00
|
|
|
border-top-left-radius: inherit;
|
2022-03-15 14:21:06 +01:00
|
|
|
border-start-start-radius: inherit;
|
|
|
|
// Remove once we drop support for Safari 14.
|
|
|
|
// stylelint-disable-next-line property-disallowed-list
|
2020-06-15 11:44:18 +02:00
|
|
|
border-bottom-left-radius: inherit;
|
2022-03-15 14:21:06 +01:00
|
|
|
border-end-start-radius: inherit;
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
|
2020-06-15 11:44:18 +02:00
|
|
|
&.button--icon {
|
|
|
|
&:before {
|
|
|
|
display: none; // TODO: remove once the icon font styles are gone
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
2022-08-31 08:23:22 +02:00
|
|
|
|
|
|
|
.icon {
|
|
|
|
@include svg-icon(1.5em);
|
|
|
|
}
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
|
2020-06-15 17:13:08 +02:00
|
|
|
&.button--icon-flipped {
|
2022-02-04 12:57:55 +01:00
|
|
|
.icon {
|
2020-06-15 17:13:08 +02:00
|
|
|
transform: scaleX(-1);
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-12 14:43:09 +01:00
|
|
|
&.button-secondary {
|
2022-09-05 12:46:57 +02:00
|
|
|
border-color: theme('colors.black-20');
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.button-small {
|
|
|
|
padding-inline-start: 3.5em;
|
2022-02-04 12:57:55 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
.icon-wrapper {
|
|
|
|
width: theme('spacing.8');
|
|
|
|
}
|
2019-01-02 00:11:47 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.button--icon .icon {
|
|
|
|
@include svg-icon(0.9rem);
|
|
|
|
padding: 0.25em;
|
|
|
|
}
|
2019-01-02 00:11:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.button-longrunning {
|
2022-02-04 12:57:55 +01:00
|
|
|
span {
|
2019-01-02 00:11:47 +01:00
|
|
|
// iconfont
|
|
|
|
@include transition(all 0.3s ease);
|
|
|
|
transform: scale(0.9);
|
|
|
|
display: inline-block;
|
2022-08-31 08:23:22 +02:00
|
|
|
height: 1em;
|
2019-01-02 00:11:47 +01:00
|
|
|
position: relative;
|
|
|
|
opacity: 0;
|
|
|
|
width: 0;
|
|
|
|
visibility: hidden;
|
|
|
|
text-align: center;
|
2022-03-15 14:21:06 +01:00
|
|
|
padding-inline-end: 0;
|
2019-01-02 00:11:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
em {
|
|
|
|
font-style: normal;
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
2019-01-02 00:11:47 +01:00
|
|
|
|
|
|
|
span.icon-spinner:after {
|
|
|
|
// iconfont
|
|
|
|
text-align: center;
|
|
|
|
position: absolute;
|
2022-03-15 14:21:06 +01:00
|
|
|
inset-inline-start: 0;
|
2019-01-02 00:11:47 +01:00
|
|
|
margin: 0;
|
|
|
|
line-height: 1em;
|
|
|
|
display: inline-block;
|
|
|
|
font-size: 1em;
|
|
|
|
}
|
|
|
|
|
|
|
|
svg.icon-spinner {
|
|
|
|
@include transition(all 0.3s ease);
|
|
|
|
display: none;
|
|
|
|
}
|
2022-08-31 08:23:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
&.button-longrunning-active {
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
2019-01-02 00:11:47 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
span {
|
|
|
|
// iconfont
|
|
|
|
transform: scale(1);
|
|
|
|
visibility: visible;
|
|
|
|
width: 1em;
|
|
|
|
height: 1em;
|
|
|
|
opacity: 0.8;
|
|
|
|
padding-inline-end: 0.5em;
|
|
|
|
}
|
|
|
|
|
|
|
|
svg.icon-spinner {
|
2020-06-15 17:13:08 +02:00
|
|
|
@include svg-icon();
|
2019-01-02 00:11:47 +01:00
|
|
|
display: inline-block;
|
|
|
|
opacity: 0.8;
|
2020-06-15 13:31:05 +02:00
|
|
|
padding: 0;
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
2019-01-02 00:11:47 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
.button-longrunning__icon {
|
2019-01-02 00:11:47 +01:00
|
|
|
display: none;
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
2019-01-02 00:11:47 +01:00
|
|
|
}
|
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
// Base hover state
|
|
|
|
&:hover {
|
|
|
|
background-color: $color-button-hover;
|
|
|
|
color: $color-white;
|
|
|
|
border-color: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Disabled state
|
2019-01-02 00:11:47 +01:00
|
|
|
&:disabled,
|
|
|
|
&[disabled],
|
|
|
|
&.disabled {
|
|
|
|
background-color: $color-grey-3;
|
|
|
|
border-color: $color-grey-3;
|
2022-09-08 11:08:38 +02:00
|
|
|
color: $color-white;
|
2019-01-02 00:11:47 +01:00
|
|
|
cursor: default;
|
2022-09-08 11:08:38 +02:00
|
|
|
pointer-events: none;
|
2022-08-31 08:23:22 +02:00
|
|
|
|
2022-09-06 20:48:59 +02:00
|
|
|
&:hover {
|
|
|
|
background-color: $color-grey-3;
|
|
|
|
border-color: $color-grey-3;
|
2022-09-08 11:08:38 +02:00
|
|
|
color: $color-white;
|
2022-09-06 20:48:59 +02:00
|
|
|
cursor: default;
|
|
|
|
}
|
|
|
|
|
2022-10-14 07:09:02 +02:00
|
|
|
@media (forced-colors: $media-forced-colours) {
|
2022-08-04 18:55:00 +02:00
|
|
|
color: GrayText;
|
|
|
|
border-color: GrayText;
|
|
|
|
border-style: dashed;
|
|
|
|
}
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
|
2019-01-02 00:11:47 +01:00
|
|
|
&.button-secondary:disabled,
|
|
|
|
&.button-secondary[disabled],
|
|
|
|
&.button-secondary.disabled {
|
|
|
|
background-color: $color-white;
|
2022-09-08 11:08:38 +02:00
|
|
|
border-color: $color-grey-4;
|
2019-01-02 00:11:47 +01:00
|
|
|
color: $color-grey-3;
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
// Buttons which are only an icon
|
|
|
|
&.text-replace {
|
|
|
|
&.icon {
|
|
|
|
// iconfont
|
|
|
|
font-size: 0; // unavoidable duplication of setting in icons.scss
|
|
|
|
height: inherit;
|
|
|
|
width: inherit;
|
|
|
|
box-sizing: content-box;
|
2019-01-02 00:11:47 +01:00
|
|
|
|
|
|
|
&:before {
|
2022-08-31 08:23:22 +02:00
|
|
|
line-height: 1.7em;
|
2019-01-02 00:11:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.button--icon {
|
|
|
|
background-color: transparent;
|
|
|
|
color: $color-grey-2;
|
|
|
|
border-color: transparent;
|
|
|
|
font-size: 0;
|
|
|
|
text-align: center;
|
|
|
|
height: inherit;
|
|
|
|
width: inherit;
|
2019-01-02 00:11:47 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&:hover {
|
|
|
|
color: $color-grey-1;
|
2019-01-02 00:11:47 +01:00
|
|
|
}
|
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
.icon {
|
|
|
|
@include svg-icon(1rem, middle);
|
2020-06-15 12:06:29 +02:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
font-size: initial;
|
|
|
|
padding: 0.5em;
|
|
|
|
box-sizing: content-box;
|
|
|
|
}
|
2020-06-15 12:06:29 +02:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.button-small {
|
|
|
|
line-height: 1.75em;
|
2020-06-15 12:06:29 +02:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
.icon {
|
|
|
|
padding: 0.25em;
|
|
|
|
}
|
2020-06-15 12:06:29 +02:00
|
|
|
}
|
|
|
|
}
|
2022-08-12 14:17:40 +02:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
@include media-breakpoint-up(sm) {
|
|
|
|
&.icon {
|
|
|
|
&:before {
|
|
|
|
line-height: 2.1em;
|
|
|
|
}
|
2020-06-15 12:06:29 +02:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.button-small {
|
|
|
|
width: 1.75em;
|
|
|
|
height: 1.75em;
|
2020-06-15 12:06:29 +02:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&:before {
|
|
|
|
line-height: 1.7em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-06-15 12:06:29 +02:00
|
|
|
}
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
2020-06-15 12:06:29 +02:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
// Larger viewport width adjustments
|
2020-06-15 11:44:18 +02:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
@include media-breakpoint-up(sm) {
|
|
|
|
font-size: theme('fontSize.14');
|
|
|
|
padding: 0 1.4em;
|
|
|
|
height: 3em;
|
2022-09-05 12:46:57 +02:00
|
|
|
line-height: calc(3em - 2px); // account for border
|
2019-01-02 00:11:47 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.bicolor {
|
|
|
|
padding-inline-start: 3.5em;
|
2019-01-02 00:11:47 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&:before {
|
|
|
|
width: 2em;
|
|
|
|
font-size: theme('fontSize.16');
|
|
|
|
}
|
2019-01-02 00:11:47 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&.button-small {
|
|
|
|
padding-inline-start: 3em;
|
2019-01-02 00:11:47 +01:00
|
|
|
|
2022-08-31 08:23:22 +02:00
|
|
|
&:before {
|
|
|
|
width: 1.75em;
|
|
|
|
}
|
|
|
|
}
|
2019-01-02 00:11:47 +01:00
|
|
|
}
|
2022-02-04 12:57:55 +01:00
|
|
|
}
|
2022-10-14 07:09:02 +02:00
|
|
|
|
|
|
|
// Ensure visual consistency between button and a elements in WHCM
|
|
|
|
|
|
|
|
@media (forced-colors: $media-forced-colours) {
|
|
|
|
&:not(:disabled):not(.disabled):not([disabled]) {
|
|
|
|
color: ButtonText;
|
|
|
|
border-color: ButtonText;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
border-color: Highlight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-01-02 00:11:47 +01:00
|
|
|
}
|