naive-ui/styles/Transfer.scss

351 lines
10 KiB
SCSS
Raw Normal View History

@import './mixins/mixins.scss';
2020-02-11 14:44:29 +08:00
@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%);
}
}
2020-03-02 14:19:27 +08:00
@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') {
2020-03-03 17:41:05 +08:00
@include m(filterable) {
@include b(transfer-list) {
@include b(transfer-list-body) {
height: map-get($--n-height, $size) * 5.6 + 45px;
}
}
}
2020-03-02 14:19:27 +08:00
@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');
2019-11-08 16:07:20 +08:00
@include themes-mixin {
@include b(transfer) {
@include once {
display: flex;
width: 444px;
2020-03-02 14:19:27 +08:00
@include transfer-size-mixin('small');
@include transfer-size-mixin('medium');
@include transfer-size-mixin('large');
}
2019-11-08 16:07:20 +08:00
@include b(transfer-list) {
@include once {
background-clip: padding-box;
width: calc(50% - 36px);
2020-03-02 14:19:27 +08:00
position: relative;
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
2020-02-28 22:57:10 +08:00
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;
}
}
2020-03-02 14:19:27 +08:00
@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');
2019-11-08 16:07:20 +08:00
@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;
2020-02-28 22:57:10 +08:00
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;
}
2019-11-08 16:07:20 +08:00
}
}
background-color: map-get($--transfer-list-header-background-color, 'default');
2019-11-08 16:07:20 +08:00
@include e(header) {
@include once {
flex: 1;
line-height: 1;
2020-02-27 23:02:58 +08:00
font-weight: $--n-strong-weight;
transition: color .3s $--n-ease-in-out-cubic-bezier;
}
color: map-get($--transfer-list-header-text-color, 'default');
2019-11-08 16:07:20 +08:00
@include m(disabled) {
color: map-get($--transfer-list-header-text-color, 'disabled');
2019-11-08 16:07:20 +08:00
}
}
@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');
}
}
2019-11-08 16:07:20 +08:00
@include b(transfer-list-body) {
2020-02-21 12:53:30 +08:00
@include b(transfer-filter) {
2020-03-02 14:19:27 +08:00
border-bottom: 1px solid $--transfer-filter-border-color;
2020-02-21 12:53:30 +08:00
}
@include once {
box-sizing: border-box;
overflow: hidden;
2019-09-04 11:26:24 +08:00
position: relative;
height: 272px;
2020-02-05 22:20:12 +08:00
display: flex;
flex-direction: column;
2020-02-28 22:57:10 +08:00
border-bottom-right-radius: $--n-transfer-border-radius;
border-bottom-left-radius: $--n-transfer-border-radius;
2020-02-05 22:20:12 +08:00
@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) {
2020-03-02 14:19:27 +08:00
padding: 8px 8px;
2020-02-05 22:20:12 +08:00
box-sizing: border-box;
2020-03-02 14:19:27 +08:00
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;
}
}
}
2019-11-08 16:07:20 +08:00
@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;
2020-02-11 14:44:29 +08:00
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;
2020-02-11 14:44:29 +08:00
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;
2020-02-11 14:44:29 +08:00
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;
2020-02-11 14:44:29 +08:00
animation-timing-function: $--n-ease-in-out-cubic-bezier, $--n-ease-in-cubic-bezier;
animation-delay: .25s, 0s;
}
}
2019-11-08 16:07:20 +08:00
}
color: map-get($--transfer-item-text-color, 'default');
2019-11-08 16:07:20 +08:00
@include e(checkbox) {
@include once {
position: relative;
padding: 0 8px 0 14px;
@include b(checkbox) {
display: block;
}
}
2020-03-02 14:19:27 +08:00
padding-left: 14px;
2019-11-08 16:07:20 +08:00
}
@include m(disabled) {
@include once {
cursor: not-allowed;
}
2019-11-08 16:07:20 +08:00
color: map-get($--transfer-item-text-color, 'disabled');
}
}
}
}
}
2019-11-08 16:07:20 +08:00
@include b(transfer-gap) {
@include once {
width: 72px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
2019-11-08 16:07:20 +08:00
@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);
}
2019-09-04 11:26:24 +08:00
}
@include e(icon) {
@include once {
pointer-events: none;
transition: fill .3s $--n-ease-in-out-cubic-bezier;
}
2019-11-08 16:07:20 +08:00
fill: map-get($--transfer-gap-button-background-color, 'default');
2019-09-04 11:26:24 +08:00
}
2019-11-08 16:07:20 +08:00
&: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;
}
2019-11-08 16:07:20 +08:00
@include e(icon) {
fill: map-get($--transfer-gap-button-background-color, 'disabled') !important;
}
2019-09-04 11:26:24 +08:00
}
}
}
}
}