drip-table
Version:
A tiny and powerful enterprise-class solution for building tables.
142 lines (119 loc) • 2.67 kB
text/less
/**
* This file is part of the drip-table project.
* @link : https://drip-table.jd.com/
* @author : Emil Zhai (root@derzh.com)
* @modifier : Emil Zhai (root@derzh.com)
* @copyright: Copyright (c) 2021 JD Network Technology Co., Ltd.
*/
@import url("../../../styles/theme/default.less");
@prefixCls: jfe-drip-table-rc-switch;
.@{prefixCls} {
position: relative;
display: inline-block;
box-sizing: border-box;
width: 44px;
height: 22px;
line-height: 20px;
padding: 0;
vertical-align: middle;
border-radius: 20px;
border: 1px solid #cccccc;
background-color: #cccccc;
cursor: pointer;
transition: all .3s cubic-bezier(.35, 0, .25, 1);
overflow: hidden;
}
.@{prefixCls}-inner-checked,.@{prefixCls}-inner-unchecked {
color: #ffffff;
font-size: 12px;
position: absolute;
top: 0;
transition: left .3s cubic-bezier(.35, 0, .25, 1);
}
.@{prefixCls}-inner-checked {
left: -14px;
}
.@{prefixCls}-inner-unchecked {
left: 24px;
}
.@{prefixCls}:after {
position: absolute;
width: 18px;
height: 18px;
left: 2px;
top: 1px;
border-radius: 50%;
background-color: #ffffff;
content: " ";
cursor: pointer;
box-shadow: 0 2px 5px #00000042;
transform: scale(1);
transition: left .3s cubic-bezier(.35, 0, .25, 1);
animation-timing-function: cubic-bezier(.35, 0, .25, 1);
animation-duration: .3s;
animation-name: jfe-drip-table-rc-switch-off;
}
.@{prefixCls}:hover:after {
transform: scale(1.1);
animation-name: jfe-drip-table-rc-switch-on;
}
.@{prefixCls}:focus {
box-shadow: 0 0 0 2px #d5f1fd;
outline: none;
}
.@{prefixCls}-checked {
border: 1px solid @drip-table-primary-color;
background-color: @drip-table-primary-color;
}
.@{prefixCls}-checked .@{prefixCls}-inner-checked {
left: 6px;
}
.@{prefixCls}-checked .@{prefixCls}-inner-unchecked {
left: 44px;
}
.@{prefixCls}-checked:after {
left: 22px;
}
.@{prefixCls}-disabled {
cursor: no-drop;
background: #cccccc;
border-color: #cccccc;
}
.@{prefixCls}-disabled:after {
background: #9e9e9e;
animation-name: none;
cursor: no-drop;
}
.@{prefixCls}-disabled:hover:after {
transform: scale(1);
animation-name: none;
}
.@{prefixCls}-label {
display: inline-block;
line-height: 20px;
font-size: 14px;
padding-left: 10px;
vertical-align: middle;
white-space: normal;
pointer-events: none;
user-select: text;
}
@keyframes jfe-drip-table-rc-switch-on {
0% {
transform: scale(1);
}
50% {
transform: scale(1.25);
}
100% {
transform: scale(1.1);
}
}
@keyframes jfe-drip-table-rc-switch-off {
0% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}