-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathradio.css
132 lines (116 loc) · 3 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
126
127
128
129
130
131
132
.matter-radio {
--matter-helper-theme: var(--matter-theme-rgb, var(--matter-primary-rgb, 33, 150, 243));
z-index: 0;
position: relative;
display: inline-block;
color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.87);
font-family: var(--matter-font-family, "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system);
font-size: 16px;
line-height: 1.5;
}
/* Circle */
.matter-radio > input {
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
z-index: 1;
position: absolute;
display: block;
box-sizing: border-box;
margin: 2px 0;
border: solid 2px; /* Safari */
border-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.6);
border-radius: 50%;
width: 20px;
height: 20px;
outline: none;
cursor: pointer;
transition: border-color 0.2s;
}
/* Span */
.matter-radio > input + span {
display: inline-block;
box-sizing: border-box;
padding-left: 30px;
width: inherit;
cursor: pointer;
}
/* Highlight */
.matter-radio > input + span::before {
content: "";
position: absolute;
left: -10px;
top: -8px;
display: block;
border-radius: 50%;
width: 40px;
height: 40px;
background-color: rgb(var(--matter-onsurface-rgb, 0, 0, 0));
opacity: 0;
transform: scale(0);
pointer-events: none;
transition: opacity 0.3s, transform 0.2s;
}
/* Check Mark */
.matter-radio > input + span::after {
content: "";
display: block;
position: absolute;
top: 2px;
left: 0;
border-radius: 50%;
width: 10px;
height: 10px;
background-color: rgb(var(--matter-helper-theme));
transform: translate(5px, 5px) scale(0);
transition: transform 0.2s;
}
/* Checked */
.matter-radio > input:checked {
border-color: rgb(var(--matter-helper-theme));
}
.matter-radio > input:checked + span::before {
background-color: rgb(var(--matter-helper-theme));
}
.matter-radio > input:checked + span::after {
transform: translate(5px, 5px) scale(1);
}
/* Hover, Focus */
.matter-radio:hover > input + span::before {
transform: scale(1);
opacity: 0.04;
}
.matter-radio > input:focus + span::before {
transform: scale(1);
opacity: 0.12;
}
.matter-radio:hover > input:focus + span::before {
transform: scale(1);
opacity: 0.16;
}
/* Active */
.matter-radio:active > input {
border-color: rgb(var(--matter-helper-theme));
}
.matter-radio:active > input + span::before,
.matter-radio:active:hover > input + span::before {
opacity: 1;
transform: scale(0);
transition: transform 0s, opacity 0s;
}
/* Disabled */
.matter-radio > input:disabled {
border-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.38);
cursor: initial;
}
.matter-radio > input:disabled + span {
color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.38);
cursor: initial;
}
.matter-radio > input:disabled + span::before {
opacity: 0;
transform: scale(0);
}
.matter-radio > input:disabled + span::after {
background-color: currentColor;
}