forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_loading.scss
148 lines (123 loc) · 3.14 KB
/
_loading.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//
// Copyright IBM Corp. 2016, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//
@use 'vars' as *;
@use 'functions' as *;
@use 'animation';
@use '../../config' as *;
@use '../../layer' as *;
@use '../../motion' as *;
@use '../../spacing' as *;
@use '../../theme' as *;
@use '../../utilities/component-reset';
@use '../../utilities/convert';
@use '../../utilities/z-index' as *;
/// Loading styles
/// @access private
/// @group loading
@mixin loading {
.#{$prefix}--loading {
@include component-reset.reset;
@include animation.spin;
block-size: $loading-size;
inline-size: $loading-size;
}
// Animation (Spin by default)
.#{$prefix}--loading__svg {
fill: transparent;
}
.#{$prefix}--loading__svg circle {
stroke-dasharray: $circumference $circumference;
stroke-linecap: butt;
stroke-width: 10;
}
.#{$prefix}--loading__stroke {
stroke: $interactive;
stroke-dashoffset: loading-progress($circumference, 81);
}
.#{$prefix}--loading--small .#{$prefix}--loading__stroke {
stroke-dashoffset: loading-progress($circumference, 48);
}
.#{$prefix}--loading--stop {
@include animation.stop;
}
.#{$prefix}--loading--small {
block-size: convert.to-rem(16px);
inline-size: convert.to-rem(16px);
//See https://github.com/carbon-design-system/carbon/issues/13121
line-height: 1rem;
circle {
stroke-width: 16;
}
}
.#{$prefix}--loading--small .#{$prefix}--loading__svg {
stroke: $interactive;
}
.#{$prefix}--loading__background {
stroke: $layer-accent;
stroke-dashoffset: -22;
}
// Negative values for `stroke-dashoffset` are not supported in Safari
@media not all and (resolution >= 0.001dpcm) {
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
circle.#{$prefix}--loading__background {
stroke-dasharray: 265;
stroke-dashoffset: 0;
}
}
}
.#{$prefix}--loading-overlay {
position: fixed;
z-index: z('overlay');
display: flex;
align-items: center;
justify-content: center;
background-color: $overlay;
block-size: 100%;
inline-size: 100%;
inset-block-start: 0;
inset-inline-start: 0;
transition: background-color $duration-slow-02 motion(standard, expressive);
}
.#{$prefix}--loading-overlay--stop {
display: none;
}
@keyframes #{$prefix}--rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes #{$prefix}--rotate-end-p1 {
100% {
transform: rotate(360deg);
}
}
@keyframes #{$prefix}--rotate-end-p2 {
100% {
transform: rotate(-360deg);
}
}
/* Stroke animations */
@keyframes #{$prefix}--init-stroke {
0% {
stroke-dashoffset: loading-progress($circumference, 0);
}
100% {
stroke-dashoffset: loading-progress($circumference, 81);
}
}
@keyframes #{$prefix}--stroke-end {
0% {
stroke-dashoffset: loading-progress($circumference, 81);
}
100% {
stroke-dashoffset: loading-progress($circumference, 0);
}
}
}