2025-07-05 19:55:43 +02:00
|
|
|
$toggle-switch-width: 2.8rem;
|
2025-07-03 20:17:00 +02:00
|
|
|
$toggle-switch-height: 1.6rem;
|
|
|
|
|
$toggle-switch-toggle-padding: 3px;
|
|
|
|
|
$toggle-switch-toggle-width: calc($toggle-switch-height - $toggle-switch-toggle-padding * 2);
|
|
|
|
|
$toggle-switch-toggle-end-pos: calc($toggle-switch-width - ($toggle-switch-toggle-width + $toggle-switch-toggle-padding * 2));
|
2026-04-01 17:36:39 +02:00
|
|
|
$toggle-switch-compact-width: 2.1rem;
|
|
|
|
|
$toggle-switch-compact-height: 1.2rem;
|
|
|
|
|
$toggle-switch-compact-toggle-padding: 2px;
|
|
|
|
|
$toggle-switch-compact-toggle-width: calc($toggle-switch-compact-height - $toggle-switch-compact-toggle-padding * 2);
|
|
|
|
|
$toggle-switch-compact-toggle-end-pos: calc($toggle-switch-compact-width - ($toggle-switch-compact-toggle-width + $toggle-switch-compact-toggle-padding * 2));
|
2025-07-03 20:17:00 +02:00
|
|
|
|
|
|
|
|
.tp__toggle-switch {
|
|
|
|
|
position: relative;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
width: $toggle-switch-width;
|
2025-12-02 10:26:02 +01:00
|
|
|
min-width: $toggle-switch-width;
|
|
|
|
|
max-width: $toggle-switch-width;
|
2025-07-03 20:17:00 +02:00
|
|
|
height: $toggle-switch-height;
|
2025-07-05 19:55:43 +02:00
|
|
|
cursor: pointer;
|
2025-08-22 15:52:41 +02:00
|
|
|
border: 2px solid transparent;
|
|
|
|
|
border-radius: var(--border-radius);
|
|
|
|
|
|
2025-07-05 19:55:43 +02:00
|
|
|
&__readonly {
|
|
|
|
|
cursor: default;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-03 20:17:00 +02:00
|
|
|
input {
|
|
|
|
|
opacity: 0; width: 0; height: 0
|
|
|
|
|
}
|
|
|
|
|
input:checked + span {
|
|
|
|
|
background-color: var(--toggle-switch-on-background-color);
|
|
|
|
|
}
|
|
|
|
|
input:checked + span > span {
|
|
|
|
|
transform: translateX($toggle-switch-toggle-end-pos);
|
|
|
|
|
}
|
|
|
|
|
&__track {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
|
|
|
background-color: var(--toggle-switch-off-background-color);
|
|
|
|
|
border-radius: $toggle-switch-toggle-width;
|
|
|
|
|
transition: 0.3s;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
&__toggle {
|
|
|
|
|
position: absolute;
|
|
|
|
|
height: $toggle-switch-toggle-width;
|
|
|
|
|
width: $toggle-switch-toggle-width;
|
|
|
|
|
left: $toggle-switch-toggle-padding;
|
|
|
|
|
bottom: $toggle-switch-toggle-padding;
|
|
|
|
|
background-color: var(--toggle-switch-toggle-color);
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
transition: 0.3s;
|
|
|
|
|
transform: translateX(0);
|
2026-03-28 21:57:13 +01:00
|
|
|
box-shadow: var(--toggle-switch-toggle-shadow);
|
2025-07-03 20:17:00 +02:00
|
|
|
}
|
|
|
|
|
&__active {
|
|
|
|
|
|
|
|
|
|
}
|
2025-08-22 15:52:41 +02:00
|
|
|
|
|
|
|
|
&:focus-within {
|
|
|
|
|
border-color: var(--input-focus-border-color);
|
|
|
|
|
}
|
2026-04-01 17:36:39 +02:00
|
|
|
|
|
|
|
|
&--compact {
|
|
|
|
|
width: $toggle-switch-compact-width;
|
|
|
|
|
min-width: $toggle-switch-compact-width;
|
|
|
|
|
max-width: $toggle-switch-compact-width;
|
|
|
|
|
height: $toggle-switch-compact-height;
|
|
|
|
|
|
|
|
|
|
.tp__toggle-switch__track {
|
|
|
|
|
border-radius: $toggle-switch-compact-toggle-width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tp__toggle-switch__toggle {
|
|
|
|
|
height: $toggle-switch-compact-toggle-width;
|
|
|
|
|
width: $toggle-switch-compact-toggle-width;
|
|
|
|
|
left: $toggle-switch-compact-toggle-padding;
|
|
|
|
|
bottom: $toggle-switch-compact-toggle-padding;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
input:checked + span > span {
|
|
|
|
|
transform: translateX($toggle-switch-compact-toggle-end-pos);
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-03-28 21:57:13 +01:00
|
|
|
}
|