naive-ui/styles/Progress.scss

282 lines
8.2 KiB
SCSS
Raw Normal View History

@import "./mixins/mixins.scss";
2020-02-11 14:44:29 +08:00
2019-10-18 16:45:40 +08:00
@mixin progress-animation-mixin ($type) {
@keyframes progress-#{$type}-type-ripple {
0% {
2019-08-13 19:14:09 +08:00
position: absolute;
2019-10-18 16:45:40 +08:00
left: 0;
top: 0;
bottom: 0;
right: 100%;
opacity: 1;
2019-08-13 19:14:09 +08:00
}
2019-10-18 16:45:40 +08:00
66% {
position: absolute;
2019-10-18 16:45:40 +08:00
left: 0;
top: 0;
bottom: 0;
right: 0;
opacity: 0;
}
2019-10-18 16:45:40 +08:00
100% {
2019-08-13 17:50:14 +08:00
position: absolute;
2019-10-18 16:45:40 +08:00
left: 0;
top: 0;
bottom: 0;
right: 0;
opacity: 0;
2019-08-13 17:50:14 +08:00
}
}
2019-10-18 16:45:40 +08:00
}
@mixin progress-type-mixin ($type) {
@include m($type) {
@include b(progress-text) {
2020-02-22 18:08:53 +08:00
color: map-get($--progress-indicator-text-color, 'outside');
2019-08-13 19:14:09 +08:00
}
2019-10-18 16:45:40 +08:00
$fill-color: map-get($--progress-fill-color, $type);
@include b(progress-icon) {
2020-02-20 21:42:38 +08:00
@include b(icon) {
fill: $fill-color;
}
2019-10-18 16:45:40 +08:00
@include m(as-text) {
2020-02-22 18:08:53 +08:00
color: map-get($--progress-indicator-text-color, 'outside');
2019-10-18 16:45:40 +08:00
}
}
@include b(progress-graph) {
@include b(progress-graph-circle) {
@include b(progress-graph-circle-fill) {
stroke: $fill-color;
}
}
2019-10-18 16:45:40 +08:00
@include b(progress-graph-line) {
@include b(progress-graph-line-rail) {
@include b(progress-graph-line-fill) {
background-color: $fill-color;
@include m(processing) {
&::after {
content: '';
2019-12-09 15:12:53 +08:00
background-image: $--progress-line-processing-background-image;
animation: progress-#{$type}-type-ripple 2s $--n-ease-out-cubic-bezier infinite;
2019-10-18 16:45:40 +08:00
}
}
}
}
@include b(progress-graph-line-indicator) {
background-color: $fill-color;
}
}
}
}
2019-10-18 16:45:40 +08:00
}
2019-12-09 15:49:38 +08:00
@include progress-animation-mixin('default');
@include progress-animation-mixin('success');
@include progress-animation-mixin('warning');
@include progress-animation-mixin('error');
@include progress-animation-mixin('info');
2019-10-18 16:45:40 +08:00
@include themes-mixin {
@include b(progress) {
2019-12-09 15:49:38 +08:00
@include once {
display: inline-block;
@include m(line) {
width: 100%;
2020-02-01 00:47:07 +08:00
display: block;
2019-12-09 15:49:38 +08:00
@include b(progress-content) {
display: flex;
align-items: center;
@include b(progress-graph) {
flex: 1;
}
}
2019-12-09 15:49:38 +08:00
@include b(progress-custom-content) {
2019-10-18 16:45:40 +08:00
margin-left: 14px;
}
2019-12-09 15:49:38 +08:00
@include b(progress-icon) {
width: 30px;
padding-left: 14px;
height: 18px;
line-height: 18px;
font-size: 18px;
transition:
fill .3s $--n-ease-in-out-cubic-bezier,
color .3s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:49:38 +08:00
@include m(as-text) {
text-align: center;
width: 40px;
font-size: 14px;
padding-left: 4px;
}
}
}
2019-12-09 15:49:38 +08:00
@include m(circle) {
width: 120px;
@include b(progress-custom-content) {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
@include b(progress-text) {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
2019-10-18 16:45:40 +08:00
color: inherit;
2019-12-09 15:49:38 +08:00
font-size: 36px;
transition: color .3s $--n-ease-in-out-cubic-bezier;
}
2019-12-09 15:49:38 +08:00
@include b(progress-icon) {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
2019-10-18 16:45:40 +08:00
color: inherit;
2019-12-09 15:49:38 +08:00
font-size: 36px;
}
@include b(progress-text) {
white-space: nowrap;
2020-02-27 23:02:58 +08:00
font-weight: $--n-strong-weight;
transition: color .3s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:49:38 +08:00
@include e(percentage) {
color: inherit;
font-size: 28px;
}
@include e(unit) {
color: inherit;
font-size: 24px;
margin-left: 6px;
}
}
}
2019-12-09 15:49:38 +08:00
@include m(multiple-circle) {
width: 200px;
color: inherit;
@include b(progress-text) {
transition: color .3s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:49:38 +08:00
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
display: flex;
align-items: center;
justify-content: center;
}
}
@include b(progress-content) {
position: relative;
2019-10-18 16:45:40 +08:00
}
}
@include progress-type-mixin('default');
@include progress-type-mixin('info');
@include progress-type-mixin('success');
@include progress-type-mixin('warning');
@include progress-type-mixin('error');
@include b(progress-graph) {
2019-12-09 15:49:38 +08:00
@include once {
position: relative;
}
2019-10-18 16:45:40 +08:00
@include b(progress-graph-circle) {
2019-12-09 15:49:38 +08:00
@include once {
svg {
vertical-align: bottom;
}
@include b(progress-graph-circle-fill) {
transition: stroke .3s $--n-ease-in-out-cubic-bezier, stroke-dasharray .3s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:49:38 +08:00
}
}
2019-10-18 16:45:40 +08:00
@include b(progress-graph-circle-rail) {
2019-12-09 15:49:38 +08:00
@include once {
transition: stroke .3s $--n-ease-in-out-cubic-bezier;
overflow: hidden;
2019-12-09 15:49:38 +08:00
}
2019-10-18 16:45:40 +08:00
stroke: $--progress-rail-color;
}
}
2019-10-18 16:45:40 +08:00
@include b(progress-graph-line) {
@include m(indicator-inside) {
2019-12-09 15:49:38 +08:00
@include once {
@include b(progress-graph-line-rail) {
2019-10-18 16:45:40 +08:00
height: 21px;
border-radius: 10.5px;
2019-12-09 15:49:38 +08:00
@include b(progress-graph-line-fill) {
height: 21px;
border-radius: 10.5px;
}
2019-10-18 16:45:40 +08:00
}
}
@include b(progress-graph-line-indicator) {
2019-12-09 15:49:38 +08:00
@include once {
background-color: transparent;
transition: color .3s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:49:38 +08:00
white-space: nowrap;
text-align: right;
2020-02-27 23:02:58 +08:00
font-weight: $--n-strong-weight;
2019-12-09 15:49:38 +08:00
margin-left: 14px;
margin-right: 14px;
height: 21px;
font-size: 14px;
line-height: 21px;
}
2020-02-22 18:08:53 +08:00
color: map-get($--progress-indicator-text-color, 'inside');
2019-10-18 16:45:40 +08:00
}
}
@include m(indicator-inside-label) {
2019-12-09 15:49:38 +08:00
@include once {
height: 21px;
display: flex;
align-items: center;
@include b(progress-graph-line-rail) {
transition: background-color .3s $--n-ease-in-out-cubic-bezier, right .2s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:49:38 +08:00
flex: 1;
}
2019-10-18 16:45:40 +08:00
}
@include b(progress-graph-line-indicator) {
2019-12-09 15:49:38 +08:00
@include once {
transform: translateZ(0); // to avoid strange offset
display: flex;
vertical-align: middle;
transition: right .2s $--n-ease-in-out-cubic-bezier, color .3s $--n-ease-in-out-cubic-bezier, background-color .3s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:49:38 +08:00
height: 21px;
line-height: 21px;
padding: 0 10px;
border-radius: 10.5px;
position: absolute;
white-space: nowrap;
2020-02-27 23:02:58 +08:00
font-weight: $--n-strong-weight;
2019-12-09 15:49:38 +08:00
font-size: 14px;
}
2020-02-22 18:08:53 +08:00
color: map-get($--progress-indicator-text-color, 'inside');
2019-10-18 16:45:40 +08:00
}
}
@include b(progress-graph-line-rail) {
2019-12-09 15:49:38 +08:00
@include once {
2019-10-18 16:45:40 +08:00
position: relative;
2019-12-09 15:49:38 +08:00
overflow: hidden;
2019-10-18 16:45:40 +08:00
height: 10px;
2019-12-09 15:49:38 +08:00
border-radius: 5px;
@include b(progress-graph-line-fill) {
position: relative;
border-radius: 5px;
height: 10px;
width: 100%;
max-width: 0%;
transition: background-color .3s $--n-ease-in-out-cubic-bezier, max-width .2s $--n-ease-in-out-cubic-bezier;
2019-12-09 15:49:38 +08:00
}
2019-10-18 16:45:40 +08:00
}
2019-12-09 15:49:38 +08:00
background-color: $--progress-rail-color;
transition: background-color .3s $--n-ease-in-out-cubic-bezier;
2019-10-18 16:45:40 +08:00
}
}
}
}
2019-10-18 16:45:40 +08:00
}