mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
129 lines
2.9 KiB
SCSS
129 lines
2.9 KiB
SCSS
@use 'sass:map';
|
|
|
|
@import 'mixins/mixins';
|
|
@import 'mixins/var';
|
|
@import 'common/var';
|
|
|
|
@include b(switch) {
|
|
@include set-component-css-var('switch', $--switch);
|
|
}
|
|
|
|
@include b(switch) {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
position: relative;
|
|
font-size: var(--el-switch-font-size);
|
|
line-height: var(--el-switch-height);
|
|
height: var(--el-switch-height);
|
|
vertical-align: middle;
|
|
@include when(disabled) {
|
|
& .#{$namespace}-switch__core,
|
|
& .#{$namespace}-switch__label {
|
|
cursor: not-allowed;
|
|
}
|
|
}
|
|
|
|
@include e(label) {
|
|
transition: var(--el-transition-duration-fast);
|
|
height: var(--el-switch-height);
|
|
display: inline-block;
|
|
font-size: var(--el-switch-font-size);
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
vertical-align: middle;
|
|
color: var(--el-text-color-primary);
|
|
|
|
@include when(active) {
|
|
color: var(--el-color-primary);
|
|
}
|
|
|
|
@include m(left) {
|
|
margin-right: 10px;
|
|
}
|
|
@include m(right) {
|
|
margin-left: 10px;
|
|
}
|
|
& * {
|
|
line-height: 1;
|
|
font-size: var(--el-switch-font-size);
|
|
display: inline-block;
|
|
}
|
|
}
|
|
|
|
@include e(input) {
|
|
position: absolute;
|
|
width: 0;
|
|
height: 0;
|
|
opacity: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
@include e(core) {
|
|
margin: 0;
|
|
display: inline-block;
|
|
position: relative;
|
|
width: var(--el-switch-width);
|
|
height: var(--el-switch-height);
|
|
border: 1px solid var(--el-switch-off-color);
|
|
outline: none;
|
|
border-radius: var(--el-switch-core-border-radius);
|
|
box-sizing: border-box;
|
|
background: var(--el-switch-off-color);
|
|
cursor: pointer;
|
|
transition: border-color var(--el-transition-duration),
|
|
background-color var(--el-transition-duration);
|
|
vertical-align: middle;
|
|
|
|
.#{$namespace}-switch__action {
|
|
position: absolute;
|
|
top: 1px;
|
|
left: 1px;
|
|
border-radius: var(--el-border-radius-circle);
|
|
transition: all var(--el-transition-duration);
|
|
width: var(--el-switch-button-size);
|
|
height: var(--el-switch-button-size);
|
|
background-color: var(--el-color-white);
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
color: var(--el-switch-off-color);
|
|
}
|
|
}
|
|
|
|
@include when(checked) {
|
|
.#{$namespace}-switch__core {
|
|
border-color: var(--el-switch-on-color);
|
|
background-color: var(--el-switch-on-color);
|
|
.#{$namespace}-switch__action {
|
|
left: 100%;
|
|
margin-left: calc(-1px - var(--el-switch-button-size));
|
|
color: var(--el-switch-on-color);
|
|
}
|
|
}
|
|
}
|
|
|
|
@include when(disabled) {
|
|
opacity: 0.6;
|
|
}
|
|
|
|
@include m(wide) {
|
|
.#{$namespace}-switch__label {
|
|
&.#{$namespace}-switch__label--left {
|
|
span {
|
|
left: 10px;
|
|
}
|
|
}
|
|
&.#{$namespace}-switch__label--right {
|
|
span {
|
|
right: 10px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
& .label-fade-enter-from,
|
|
& .label-fade-leave-active {
|
|
opacity: 0;
|
|
}
|
|
}
|