naive-ui/styles/Transfer.scss
2020-03-05 13:46:03 +08:00

351 lines
10 KiB
SCSS

@import './mixins/mixins.scss';
@keyframes transfer-slide-in-from-left {
0% {
transform: translateX(-150%);
}
100% {
transform: translateX(0);
}
}
@keyframes transfer-slide-out-to-right {
0% {
transform: translateX(0);
}
100% {
transform: translateX(150%);
}
}
@keyframes transfer-slide-in-from-right {
0% {
transform: translateX(150%);
}
100% {
transform: translateX(0);
}
}
@keyframes transfer-slide-out-to-left {
0% {
transform: translateX(0);
}
100% {
transform: translateX(-150%);
}
}
@mixin transfer-animation-mixin($size) {
@keyframes transfer-height-collapse--#{$size} {
0% {
max-height: map-get($--n-height, $size);
}
100% {
max-height: 0;
}
}
@keyframes transfer-height-expand--#{$size} {
0% {
max-height: 0;
}
100% {
max-height: map-get($--n-height, $size);
}
}
}
@mixin transfer-size-mixin($size) {
@include m($size + '-size') {
@include m(filterable) {
@include b(transfer-list) {
@include b(transfer-list-body) {
height: map-get($--n-height, $size) * 5.6 + 45px;
}
}
}
@include b(transfer-list) {
@include b(transfer-list-header) {
font-size: map-get($--n-font-size, $size);
height: map-get($--n-height, $size) + 6px;
}
@include b(transfer-list-body) {
height: map-get($--n-height, $size) * 5.6;
@include b(transfer-list-item) {
font-size: map-get($--n-font-size, $size);
height: map-get($--n-height, $size);
max-height: map-get($--n-height, $size);
@include m(source) {
@include m(enter) {
animation-name: transfer-height-expand--#{$size}, transfer-slide-in-from-right;
}
@include m(leave) {
animation-name: transfer-height-collapse--#{$size}, transfer-slide-out-to-right;
}
}
@include m(target) {
@include m(enter) {
animation-name: transfer-height-expand--#{$size}, transfer-slide-in-from-left;
}
@include m(leave) {
animation-name: transfer-height-collapse--#{$size}, transfer-slide-out-to-left;
}
}
}
}
}
}
}
@include transfer-animation-mixin('small');
@include transfer-animation-mixin('medium');
@include transfer-animation-mixin('large');
@include themes-mixin {
@include b(transfer) {
@include once {
display: flex;
width: 444px;
@include transfer-size-mixin('small');
@include transfer-size-mixin('medium');
@include transfer-size-mixin('large');
}
@include b(transfer-list) {
@include once {
background-clip: padding-box;
width: calc(50% - 36px);
position: relative;
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
border-radius: $--n-transfer-border-radius;
@include b(virtual-scroller) {
height: 100%;
scrollbar-width: none;
-moz-scrollbar-width: none;
&::-webkit-scrollbar {
width: 0;
height: 0;
}
}
@include e(border-mask) {
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
border-radius: $--n-transfer-border-radius;
}
}
@include e(border-mask) {
border: 1px solid $--transfer-border-color;
pointer-events: $--transfer-list-border-mask-pointer-events;
}
background-color: map-get($--transfer-list-background-color, 'default');
@include b(transfer-list-header) {
@include once {
box-sizing: border-box;
transition: background-color .3s $--n-ease-in-out-cubic-bezier, border-color .3s $--n-ease-in-out-cubic-bezier;
display: flex;
border-radius: $--n-transfer-border-radius $--n-transfer-border-radius 0 0;
align-items: center;
background-clip: padding-box;
@include e(checkbox) {
position: relative;
padding: 0 8px 0 14px;
@include b(checkbox) {
display: block;
}
}
}
background-color: map-get($--transfer-list-header-background-color, 'default');
@include e(header) {
@include once {
flex: 1;
line-height: 1;
font-weight: $--n-strong-weight;
transition: color .3s $--n-ease-in-out-cubic-bezier;
}
color: map-get($--transfer-list-header-text-color, 'default');
@include m(disabled) {
color: map-get($--transfer-list-header-text-color, 'disabled');
}
}
@include e(extra) {
@include once {
transition: color .3s $--n-ease-in-out-cubic-bezier;
font-size: 12px;
justify-self: flex-end;
margin-right: 14px;
white-space: nowrap;
}
color: map-get($--transfer-list-header-extra-text-color, 'default');
}
}
@include b(transfer-list-body) {
@include b(transfer-filter) {
border-bottom: 1px solid $--transfer-filter-border-color;
}
@include once {
box-sizing: border-box;
overflow: hidden;
position: relative;
height: 272px;
display: flex;
flex-direction: column;
border-bottom-right-radius: $--n-transfer-border-radius;
border-bottom-left-radius: $--n-transfer-border-radius;
@include b(transfer-list-flex-container) {
flex: 1;
position: relative;
@include b(scrollbar) {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
height: unset;
@include b(scrollbar-content) {
width: 100%;
}
}
@include b(empty) {
position: absolute;
left: 50%;
top: 50%;
transform: translateY(-50%) translateX(-50%);
}
}
@include b(transfer-filter) {
padding: 8px 8px;
box-sizing: border-box;
transition: border-color .3s $--n-ease-in-out-cubic-bezier;
}
}
@include b(transfer-list-content) {
@include once {
padding: 0;
margin: 0;
position: relative;
@include m(animation-disabled) {
@include b(transfer-list-item) {
animation: none !important;
}
}
}
@include b(transfer-list-item) {
@include once {
transition: color .3s $--n-ease-in-out-cubic-bezier;
position: relative;
cursor: pointer;
display: flex;
align-items: center;
@include e(extra) {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
padding-right: 4px;
}
@include m(source) {
animation-fill-mode: forwards;
@include m(enter) {
transform: translateX(150%);
animation-duration: .25s, .25s;
animation-timing-function: $--n-ease-in-out-cubic-bezier, $--n-ease-out-cubic-bezier;
animation-delay: 0s, .25s;
}
@include m(leave) {
transform: translateX(-150%);
animation-duration: .25s, .25s;
animation-timing-function: $--n-ease-in-out-cubic-bezier, $--n-ease-in-cubic-bezier;
animation-delay: .25s, 0s;
}
}
@include m(target) {
animation-fill-mode: forwards;
@include m(enter) {
transform: translateX(-150%);
animation-duration: .25s, .25s;
animation-timing-function: $--n-ease-in-out-cubic-bezier, $--n-ease-out-cubic-bezier;
animation-delay: 0s, .25s;
}
@include m(leave) {
transform: translateX(150%);
animation-duration: .25s, .25s;
animation-timing-function: $--n-ease-in-out-cubic-bezier, $--n-ease-in-cubic-bezier;
animation-delay: .25s, 0s;
}
}
}
color: map-get($--transfer-item-text-color, 'default');
@include e(checkbox) {
@include once {
position: relative;
padding: 0 8px 0 14px;
@include b(checkbox) {
display: block;
}
}
padding-left: 14px;
}
@include m(disabled) {
@include once {
cursor: not-allowed;
}
color: map-get($--transfer-item-text-color, 'disabled');
}
}
}
}
}
@include b(transfer-gap) {
@include once {
width: 72px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
@include b(transfer-button) {
@include once {
width: 36px;
height: 36px;
border-radius: 18px;
cursor: pointer;
&:first-child {
margin-bottom: 12px;
}
@include m(to) {
transform: rotate(180deg);
}
}
@include e(icon) {
@include once {
pointer-events: none;
transition: fill .3s $--n-ease-in-out-cubic-bezier;
}
fill: map-get($--transfer-gap-button-background-color, 'default');
}
&:hover {
@include e(icon) {
fill: map-get($--transfer-gap-button-background-color, 'hover');
}
}
&:active {
@include e(icon) {
fill: map-get($--transfer-gap-button-background-color, 'active');
}
}
@include m(disabled) {
@include once {
cursor: not-allowed;
}
@include e(icon) {
fill: map-get($--transfer-gap-button-background-color, 'disabled') !important;
}
}
}
}
}
}