UNPKG

1.03 kBSCSSView Raw
1/**
2 * Loading ([aria-busy=true])
3 */
4
5
6// Cursor
7[aria-busy="true"] {
8 cursor: progress;
9}
10
11// Everyting except form elements
12[aria-busy="true"]:not(input, select, textarea) {
13
14 &::before {
15 display: inline-block;
16 width: 1em;
17 height: 1em;
18 border: 0.1875em solid currentColor;
19 border-radius: 1em;
20 border-right-color: transparent;
21 content: "";
22 vertical-align: text-bottom;
23 vertical-align: -.125em; // Visual alignment
24 animation: spinner 0.75s linear infinite;
25 opacity: var(--loading-spinner-opacity);
26 }
27
28 &:not(:empty) {
29 &::before {
30 margin-right: calc(var(--spacing) * 0.5);
31 margin-left: 0;
32 margin-inline-start: 0;
33 margin-inline-end: calc(var(--spacing) * 0.5);
34 }
35 }
36
37 &:empty {
38 text-align: center;
39 }
40}
41
42// Buttons and links
43button,
44input[type="submit"],
45input[type="button"],
46input[type="reset"],
47a {
48 &[aria-busy="true"] {
49 pointer-events: none;
50 }
51}
52
53// Animation: rotate
54@keyframes spinner {
55 to {
56 transform: rotate(360deg);
57 }
58}