zent
Version:
一套前端设计语言和基于React的实现
140 lines (139 loc) • 3.54 kB
CSS
.zent-switch {
border-color: #999;
border-color: var(--theme-hint-color, var(--theme-stroke-3, #999));
background-color: #999;
background-color: var(--theme-hint-color, var(--theme-stroke-3, #999));
position: relative;
display: inline-block;
box-sizing: border-box;
width: 44px;
height: 22px;
line-height: 20px;
border-radius: 100px;
border-width: 1px;
border-style: solid;
cursor: pointer;
transition: all 0.16s cubic-bezier(0.5, 0, 0.5, 0.1);
}
.zent-switch:after {
background-color: #fff;
background-color: var(--theme-section-bg, var(--theme-stroke-9, #fff));
position: absolute;
width: 18px;
height: 18px;
left: 1px;
top: 1px;
border-radius: 100%;
content: " ";
cursor: pointer;
transition: left 0.16s cubic-bezier(0.5, 0, 0.5, 0.1);
}
.zent-switch:focus {
outline: 0;
}
.zent-switch:focus:hover {
box-shadow: none;
}
.zent-switch-large {
height: 50px;
line-height: 12px;
width: 90px;
border-radius: 50px;
}
.zent-switch-large:after {
width: 44px;
height: 44px;
top: 2px;
left: 2px;
}
.zent-switch-large.zent-switch-checked:after {
left: 42px;
}
.zent-switch-small {
width: 28px;
height: 16px;
}
.zent-switch-small:after {
width: 12px;
height: 12px;
left: 1px;
top: 1px;
}
.zent-switch-small.zent-switch-checked:after {
left: 13px;
}
.zent-switch-checked {
border-color: #155bd4;
border-color: var(--theme-primary-bg, var(--theme-primary-4, #155bd4));
background-color: #155bd4;
background-color: var(--theme-primary-bg, var(--theme-primary-4, #155bd4));
}
.zent-switch-checked::after {
left: 23px;
}
.zent-switch-disabled {
background-color: #ccc;
background-color: var(--theme-disabled-color, var(--theme-stroke-4, #ccc));
border-color: #ccc;
border-color: var(--theme-disabled-color, var(--theme-stroke-4, #ccc));
cursor: not-allowed;
}
.zent-switch-disabled.zent-switch-checked {
background-color: #94b4eb;
border-color: #94b4eb;
}
.zent-switch-disabled::after {
background-color: #fff;
background-color: var(--theme-section-bg, var(--theme-stroke-9, #fff));
cursor: not-allowed;
}
.zent-switch-loading {
position: relative;
color: transparent;
cursor: not-allowed;
}
.zent-switch-loading::after {
cursor: not-allowed;
}
.zent-switch-loading::before {
border-top-color: #e6efff;
border-top-color: var(--theme-default-selected-bg, var(--theme-primary-8, #e6efff));
border-right-color: #e6efff;
border-right-color: var(--theme-default-selected-bg, var(--theme-primary-8, #e6efff));
border-bottom-color: #155bd4;
border-bottom-color: var(--theme-primary-bg, var(--theme-primary-4, #155bd4));
border-left-color: #155bd4;
border-left-color: var(--theme-primary-bg, var(--theme-primary-4, #155bd4));
content: " ";
position: absolute;
top: 42%;
left: 36%;
z-index: 2;
width: 14px;
height: 14px;
margin: -5px 0 0 -12px;
border-width: 2px;
border-style: solid;
border-radius: 100%;
box-sizing: border-box;
animation: zent-ani-spin 1s cubic-bezier(0, 0, 0.1, 0.1);
animation-iteration-count: infinite;
}
.zent-switch-loading.zent-switch-checked::before {
margin: -5px 0 0 10px;
}
.zent-switch-loading.zent-switch-small::before {
width: 8px;
height: 8px;
margin: -3px 0 0 -6px;
border-width: 1px;
}
.zent-switch-loading.zent-switch-small.zent-switch-checked::before {
margin: -3px 0 0 6px;
}
.zent-switch-loading.zent-switch-large::before {
margin: -5px 0 0 -17px;
}
.zent-switch-loading.zent-switch-large.zent-switch-checked::before {
margin: -5px 0 0 23px;
}