2019-12-04 22:17:59 +08:00
|
|
|
// scss-lint:disable SelectorDepth QualifyingElement NestingDepth
|
|
|
|
|
2020-01-24 22:43:13 +08:00
|
|
|
.sci-toggle-checkbox-container {
|
2023-08-04 17:44:21 +08:00
|
|
|
--sci-toggle-check-size: .625rem;
|
2023-07-12 18:49:33 +08:00
|
|
|
--sci-toggle-container-height: 1.5rem;
|
|
|
|
--sci-toggle-container-width: 2.25rem;
|
|
|
|
--sci-toggle-label-border: .0625rem;
|
2023-08-04 17:44:21 +08:00
|
|
|
--sci-toggle-label-height: .875rem;
|
|
|
|
--sci-toggle-label-width: 1.875rem;
|
2020-01-24 22:43:13 +08:00
|
|
|
display: inline-block;
|
2023-07-12 18:49:33 +08:00
|
|
|
height: var(--sci-toggle-container-height);
|
2020-01-24 22:43:13 +08:00
|
|
|
position: relative;
|
2023-07-12 18:49:33 +08:00
|
|
|
width: var(--sci-toggle-container-width);
|
2020-01-24 22:43:13 +08:00
|
|
|
}
|
|
|
|
|
2019-12-01 23:13:25 +08:00
|
|
|
input[type="checkbox"].sci-toggle-checkbox {
|
|
|
|
cursor: pointer;
|
|
|
|
flex-shrink: 0;
|
2023-07-12 18:49:33 +08:00
|
|
|
height: var(--sci-toggle-container-height);
|
2019-12-01 23:13:25 +08:00
|
|
|
margin: 0;
|
|
|
|
opacity: 0;
|
|
|
|
position: relative;
|
2023-07-12 18:49:33 +08:00
|
|
|
width: var(--sci-toggle-container-width);
|
2019-12-01 23:13:25 +08:00
|
|
|
z-index: 2;
|
|
|
|
|
|
|
|
+ .sci-toggle-checkbox-label {
|
|
|
|
animation-timing-function: $timing-function-sharp;
|
2023-07-12 18:49:33 +08:00
|
|
|
background: var(--sn-white);
|
|
|
|
border: var(--sci-toggle-label-border) solid var(--sn-grey);
|
|
|
|
border-radius: calc(var(--sci-toggle-label-height) / 2);
|
2019-12-01 23:13:25 +08:00
|
|
|
display: inline-block;
|
|
|
|
flex-shrink: 0;
|
2020-07-29 22:09:23 +08:00
|
|
|
font-weight: normal;
|
2023-07-12 18:49:33 +08:00
|
|
|
height: var(--sci-toggle-label-height);
|
|
|
|
left: calc((var(--sci-toggle-container-width) - var(--sci-toggle-label-width))/2);
|
2020-01-24 22:43:13 +08:00
|
|
|
position: absolute;
|
2023-07-12 18:49:33 +08:00
|
|
|
top: calc((var(--sci-toggle-container-height) - var(--sci-toggle-label-height))/2);
|
|
|
|
transition: .4s;
|
|
|
|
width: var(--sci-toggle-label-width);
|
2019-12-01 23:13:25 +08:00
|
|
|
|
|
|
|
&::before {
|
|
|
|
animation-timing-function: $timing-function-sharp;
|
2023-07-12 18:49:33 +08:00
|
|
|
background: var(--sn-grey);
|
|
|
|
border-radius: 50%;
|
2023-08-04 17:44:21 +08:00
|
|
|
bottom: calc(var(--sci-toggle-label-height) / 2 - var(--sci-toggle-check-size) / 2);
|
2019-12-01 23:13:25 +08:00
|
|
|
content: "";
|
2023-08-04 17:44:21 +08:00
|
|
|
left: calc(var(--sci-toggle-label-height) / 2 - var(--sci-toggle-check-size) / 2);
|
2019-12-01 23:13:25 +08:00
|
|
|
position: absolute;
|
2023-08-04 17:44:21 +08:00
|
|
|
right: calc(var(--sci-toggle-label-width) - var(--sci-toggle-label-height) / 2 - var(--sci-toggle-check-size) / 2);
|
|
|
|
top: calc(var(--sci-toggle-label-height) / 2 - var(--sci-toggle-check-size) / 2);
|
|
|
|
transition: .6s;
|
2019-12-01 23:13:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.hidden + .sci-toggle-checkbox-label {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2023-11-15 22:55:48 +08:00
|
|
|
&:disabled {
|
|
|
|
cursor: not-allowed;
|
|
|
|
}
|
|
|
|
|
2019-12-01 23:13:25 +08:00
|
|
|
&:checked + .sci-toggle-checkbox-label {
|
2023-07-12 18:49:33 +08:00
|
|
|
border-color: var(--sn-blue);
|
2019-12-01 23:13:25 +08:00
|
|
|
|
|
|
|
&::before {
|
2023-07-12 18:49:33 +08:00
|
|
|
background-color: var(--sn-science-blue);
|
2023-08-04 17:44:21 +08:00
|
|
|
left: calc(var(--sci-toggle-label-width) - var(--sci-toggle-label-height) / 2 - var(--sci-toggle-check-size) / 2);
|
|
|
|
right: calc(var(--sci-toggle-label-height) / 2 - var(--sci-toggle-check-size) / 2);
|
2019-12-01 23:13:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&:disabled + .sci-toggle-checkbox-label {
|
2023-07-12 18:49:33 +08:00
|
|
|
border-color: var(--sn-light-grey);
|
2019-12-01 23:13:25 +08:00
|
|
|
|
|
|
|
&::before {
|
2023-07-12 18:49:33 +08:00
|
|
|
background-color: var(--sn-light-grey);
|
2019-12-01 23:13:25 +08:00
|
|
|
}
|
|
|
|
}
|
2023-07-12 18:49:33 +08:00
|
|
|
|
|
|
|
&:disabled:checked + .sci-toggle-checkbox-label {
|
|
|
|
background-color: var(--sn-super-light-grey);
|
|
|
|
}
|
2019-12-01 23:13:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.sci-toggles-group {
|
|
|
|
align-items: center;
|
|
|
|
display: flex;
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
input[type="radio"].sci-toggle-item {
|
|
|
|
cursor: pointer;
|
|
|
|
height: 36px;
|
|
|
|
margin: 0;
|
|
|
|
opacity: 0;
|
|
|
|
position: relative;
|
|
|
|
width: 48px;
|
|
|
|
z-index: 2;
|
|
|
|
|
|
|
|
+ .sci-toggle-item-label {
|
|
|
|
animation-timing-function: $timing-function-sharp;
|
|
|
|
background: $color-white;
|
|
|
|
border: $border-default;
|
|
|
|
border-left-color: transparent;
|
2019-12-04 18:27:22 +08:00
|
|
|
color: $color-black;
|
2019-12-01 23:13:25 +08:00
|
|
|
display: inline-block;
|
2020-07-29 22:09:23 +08:00
|
|
|
font-weight: normal;
|
2019-12-01 23:13:25 +08:00
|
|
|
height: 36px;
|
|
|
|
line-height: 34px;
|
|
|
|
margin-left: -48px;
|
|
|
|
position: relative;
|
|
|
|
text-align: center;
|
|
|
|
transition: .2s;
|
|
|
|
width: 48px;
|
|
|
|
|
2023-01-05 20:29:13 +08:00
|
|
|
svg,
|
|
|
|
svg path {
|
|
|
|
fill: $color-black;
|
2023-04-26 16:24:50 +08:00
|
|
|
display: initial;
|
2023-01-05 20:29:13 +08:00
|
|
|
}
|
|
|
|
|
2019-12-01 23:13:25 +08:00
|
|
|
&:first-of-type {
|
|
|
|
border-left-color: $color-silver-chalice;
|
|
|
|
border-radius: $border-radius-default 0 0 $border-radius-default;
|
|
|
|
}
|
2019-12-04 22:17:59 +08:00
|
|
|
|
2019-12-01 23:13:25 +08:00
|
|
|
&:last-of-type {
|
|
|
|
border-radius: 0 $border-radius-default $border-radius-default 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&:checked + .sci-toggle-item-label {
|
|
|
|
background: $brand-primary;
|
|
|
|
border: 1px solid $brand-primary;
|
|
|
|
color: $color-white;
|
2023-01-05 20:29:13 +08:00
|
|
|
|
|
|
|
svg,
|
|
|
|
svg path {
|
|
|
|
fill: $color-white;
|
|
|
|
}
|
2019-12-01 23:13:25 +08:00
|
|
|
}
|
|
|
|
}
|
2019-12-04 22:17:59 +08:00
|
|
|
}
|