forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_loading.scss
143 lines (120 loc) · 2.9 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
//
// 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 '../../config' as *;
@use '../../motion' as *;
@use '../../spacing' as *;
@use '../../theme' as *;
@use '../../utilities/component-reset';
@use '../../utilities/convert';
@use '../../utilities/z-index' as *;
@use 'vars' as *;
@use 'functions' as *;
@use 'animation';
/// Loading styles
/// @access private
/// @group loading
@mixin loading {
.#{$prefix}--loading {
@include component-reset.reset;
@include animation.spin;
width: $loading-size;
height: $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 {
width: convert.rem(16px);
height: convert.rem(16px);
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 (min-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');
top: 0;
left: 0;
display: flex;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
background-color: $overlay;
transition: background-color $duration-slow-02 motion(standard, expressive);
}
.#{$prefix}--loading-overlay--stop {
display: none;
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes rotate-end-p1 {
100% {
transform: rotate(360deg);
}
}
@keyframes rotate-end-p2 {
100% {
transform: rotate(-360deg);
}
}
/* Stroke animations */
@keyframes init-stroke {
0% {
stroke-dashoffset: loading-progress($circumference, 0);
}
100% {
stroke-dashoffset: loading-progress($circumference, 81);
}
}
@keyframes stroke-end {
0% {
stroke-dashoffset: loading-progress($circumference, 81);
}
100% {
stroke-dashoffset: loading-progress($circumference, 0);
}
}
}