Files
sogo/UI/WebServerResources/scss/components/switch/switch.scss

91 lines
1.8 KiB
SCSS

$switch-width: 36px !default;
$switch-height: $baseline-grid * 3 !default;
$switch-bar-height: 14px !default;
$switch-thumb-size: 20px !default;
md-switch {
display: flex;
align-items: center;
.md-container {
cursor: grab;
width: $switch-width;
height: $switch-height;
position: relative;
user-select: none;
margin-right: 8px;
}
// If the user moves his mouse off the switch, stil display grabbing cursor
&:not([disabled]) {
.md-dragging,
&.md-dragging .md-container {
cursor: grabbing;
}
}
.md-label {
border-color: transparent;
border-width: 1px;
}
.md-bar {
left: 1px;
width: $switch-width - 2px;
top: $switch-height / 2 - $switch-bar-height / 2;
height: $switch-bar-height;
border-radius: 8px;
position: absolute;
}
.md-thumb-container {
top: $switch-height / 2 - $switch-thumb-size / 2;
left: 0;
width: $switch-width - $switch-thumb-size;
position: absolute;
transform: translate3d(0,0,0);
z-index: 1;
}
&.md-checked .md-thumb-container {
transform: translate3d(100%,0,0);
}
.md-thumb {
position: absolute;
margin: 0;
left: 0;
top: 0;
outline: none;
height: $switch-thumb-size;
width: $switch-thumb-size;
border-radius: 50%;
box-shadow: $whiteframe-shadow-z1;
.md-ripple-container {
position: absolute;
display: block;
width: auto;
height: auto;
left: -$switch-thumb-size;
top: -$switch-thumb-size;
right: -$switch-thumb-size;
bottom: -$switch-thumb-size;
}
}
&:not(.md-dragging) {
.md-bar,
.md-thumb-container,
.md-thumb {
transition: $swift-ease-in-out;
transition-property: transform, background-color;
}
.md-bar,
.md-thumb {
transition-delay: 0.05s;
}
}
}