-
Notifications
You must be signed in to change notification settings - Fork 181
/
radio.css
125 lines (89 loc) · 2.2 KB
/
radio.css
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
@import "../global/variables.css";
@value unit from "../global/global.css";
@value radio-size: calc(2 * unit);
.radio {
position: relative;
display: flex;
flex-direction: row;
padding: 2px 0;
text-align: left;
color: var(--ring-text-color);
outline: none;
&:hover .circle {
transition: none;
border-color: var(--ring-border-hover-color);
}
}
.circle {
position: relative;
top: 2px;
flex-shrink: 0;
box-sizing: border-box;
width: radio-size;
height: radio-size;
user-select: none;
transition: border-color var(--ring-ease), box-shadow var(--ring-ease);
pointer-events: none;
border: 1px solid var(--ring-borders-color);
border-radius: unit;
background-color: var(--ring-content-background-color);
&::after {
position: absolute;
top: 3px;
left: 3px;
width: unit;
height: unit;
content: "";
transition: opacity var(--ring-fast-ease), transform var(--ring-fast-ease);
transform: scale(0);
opacity: 0;
border-radius: calc(unit / 2);
background-color: var(--ring-main-color);
}
}
.input {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
margin: 0;
cursor: pointer;
opacity: 0;
&[disabled] + .circle {
border-color: var(--ring-border-disabled-color);
background-color: var(--ring-disabled-background-color);
}
&:checked + .circle {
border-color: var(--ring-main-color);
/* stylelint-disable-next-line selector-max-specificity */
&::after {
transition: none;
transform: scale(1);
opacity: 1;
}
}
&:focus + .circle,
&.focus + .circle {
border-color: var(--ring-border-hover-color);
box-shadow: 0 0 0 1px var(--ring-border-hover-color);
}
&[disabled] {
pointer-events: none;
}
/* stylelint-disable-next-line selector-max-specificity */
&[disabled]:checked + .circle {
border-color: var(--ring-border-selected-disabled-color);
/* stylelint-disable-next-line selector-max-specificity */
&::after {
background-color: var(--ring-icon-disabled-color);
}
}
&[disabled] ~ .label {
color: var(--ring-disabled-color);
}
}
.label {
margin-left: unit;
line-height: var(--ring-line-height);
}