Skip to content

Commit 1a329f5

Browse files
GTonyalexbrillant
authored andcommitted
feat(RadioButtonGroup): add tooltip to label
1 parent 1c2359e commit 1a329f5

File tree

4 files changed

+106
-202
lines changed

4 files changed

+106
-202
lines changed

packages/react/src/components/radio-button-group/radio-button-group.test.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ describe('Radio button', () => {
5353
});
5454

5555
test('Matches the snapshot', () => {
56-
const tree = renderWithTheme(<RadioButtonGroup label="Planets" groupName="planets" buttons={Buttons} />);
56+
const tree = renderWithTheme(
57+
<RadioButtonGroup
58+
id='test-id'
59+
label="Planets"
60+
groupName="planets"
61+
buttons={Buttons}
62+
/>,
63+
);
5764

5865
expect(tree).toMatchSnapshot();
5966
});
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`Radio button Matches the snapshot 1`] = `
4-
Array [
5-
.c0 {
4+
.c2 {
5+
color: #000000;
6+
display: block;
67
font-size: 0.75rem;
8+
font-weight: var(--font-normal);
9+
-webkit-letter-spacing: 0.02rem;
10+
-moz-letter-spacing: 0.02rem;
11+
-ms-letter-spacing: 0.02rem;
12+
letter-spacing: 0.02rem;
713
line-height: 1.25rem;
8-
margin-bottom: var(--spacing-1x);
9-
padding: 0;
14+
margin: 0;
15+
width: -webkit-fit-content;
16+
width: -moz-fit-content;
17+
width: fit-content;
1018
}
1119
12-
<legend
13-
class="c0"
14-
>
15-
Planets
16-
</legend>,
17-
.c0 {
20+
input + .c1 {
21+
margin-left: var(--spacing-half);
22+
}
23+
24+
.c0 div + label {
25+
margin-top: var(--spacing-1x);
26+
}
27+
28+
.c3 {
1829
cursor: pointer;
1930
display: block;
2031
font-size: 0.875rem;
@@ -27,11 +38,11 @@ Array [
2738
user-select: none;
2839
}
2940
30-
.c0:not(:first-of-type) {
41+
.c3:not(:first-of-type) {
3142
margin-top: var(--spacing-1x);
3243
}
3344
34-
.c0 input {
45+
.c3 input {
3546
height: 16px;
3647
left: 0;
3748
margin: 0;
@@ -41,12 +52,12 @@ Array [
4152
width: 16px;
4253
}
4354
44-
.c0 input:checked + .radioInput {
55+
.c3 input:checked + .radioInput {
4556
background-color: #006296;
4657
border: 1px solid #006296;
4758
}
4859
49-
.c0 input:checked + .radioInput::after {
60+
.c3 input:checked + .radioInput::after {
5061
background-color: #FFFFFF;
5162
border-radius: 50%;
5263
content: "";
@@ -60,13 +71,13 @@ Array [
6071
width: 8px;
6172
}
6273
63-
.c0 input:focus + .radioInput {
74+
.c3 input:focus + .radioInput {
6475
outline: none;
6576
border-color: #006296;
6677
box-shadow: 0 0 0 2px #84C6EA;
6778
}
6879
69-
.c0 .radioInput {
80+
.c3 .radioInput {
7081
background-color: #FFFFFF;
7182
border: 1px solid #60666E;
7283
border-radius: 50%;
@@ -80,26 +91,11 @@ Array [
8091
width: 16px;
8192
}
8293
83-
.c0:hover .radioInput {
94+
.c3:hover .radioInput {
8495
border: 1px solid #006296;
8596
}
8697
87-
<label
88-
class="c0"
89-
>
90-
Earth
91-
<input
92-
data-testid="radio-button-group-earth"
93-
name="planets"
94-
type="radio"
95-
value="earth"
96-
/>
97-
<span
98-
class="radioInput"
99-
/>
100-
</label>,
101-
.c0 {
102-
cursor: pointer;
98+
.c4 {
10399
display: block;
104100
font-size: 0.875rem;
105101
line-height: 1.5rem;
@@ -111,11 +107,11 @@ Array [
111107
user-select: none;
112108
}
113109
114-
.c0:not(:first-of-type) {
110+
.c4:not(:first-of-type) {
115111
margin-top: var(--spacing-1x);
116112
}
117113
118-
.c0 input {
114+
.c4 input {
119115
height: 16px;
120116
left: 0;
121117
margin: 0;
@@ -125,12 +121,12 @@ Array [
125121
width: 16px;
126122
}
127123
128-
.c0 input:checked + .radioInput {
124+
.c4 input:checked + .radioInput {
129125
background-color: #006296;
130126
border: 1px solid #006296;
131127
}
132128
133-
.c0 input:checked + .radioInput::after {
129+
.c4 input:checked + .radioInput::after {
134130
background-color: #FFFFFF;
135131
border-radius: 50%;
136132
content: "";
@@ -144,15 +140,15 @@ Array [
144140
width: 8px;
145141
}
146142
147-
.c0 input:focus + .radioInput {
143+
.c4 input:focus + .radioInput {
148144
outline: none;
149145
border-color: #006296;
150146
box-shadow: 0 0 0 2px #84C6EA;
151147
}
152148
153-
.c0 .radioInput {
154-
background-color: #FFFFFF;
155-
border: 1px solid #60666E;
149+
.c4 .radioInput {
150+
background-color: #F1F2F2;
151+
border: 1px solid #DBDEE1;
156152
border-radius: 50%;
157153
box-sizing: border-box;
158154
display: inline-block;
@@ -164,12 +160,35 @@ Array [
164160
width: 16px;
165161
}
166162
167-
.c0:hover .radioInput {
168-
border: 1px solid #006296;
163+
.c4:hover .radioInput {
164+
border: 1px solid #DBDEE1;
169165
}
170166
171-
<label
172-
class="c0"
167+
<div
168+
class="c0"
169+
>
170+
<label
171+
class="c1 c2"
172+
for="test-id"
173+
>
174+
Planets
175+
</label>
176+
<label
177+
class="c3"
178+
>
179+
Earth
180+
<input
181+
data-testid="radio-button-group-earth"
182+
name="planets"
183+
type="radio"
184+
value="earth"
185+
/>
186+
<span
187+
class="radioInput"
188+
/>
189+
</label>
190+
<label
191+
class="c3"
173192
>
174193
Mars
175194
<input
@@ -182,78 +201,9 @@ Array [
182201
<span
183202
class="radioInput"
184203
/>
185-
</label>,
186-
.c0 {
187-
display: block;
188-
font-size: 0.875rem;
189-
line-height: 1.5rem;
190-
padding-left: var(--spacing-3x);
191-
position: relative;
192-
-webkit-user-select: none;
193-
-moz-user-select: none;
194-
-ms-user-select: none;
195-
user-select: none;
196-
}
197-
198-
.c0:not(:first-of-type) {
199-
margin-top: var(--spacing-1x);
200-
}
201-
202-
.c0 input {
203-
height: 16px;
204-
left: 0;
205-
margin: 0;
206-
opacity: 0;
207-
position: absolute;
208-
top: 2px;
209-
width: 16px;
210-
}
211-
212-
.c0 input:checked + .radioInput {
213-
background-color: #006296;
214-
border: 1px solid #006296;
215-
}
216-
217-
.c0 input:checked + .radioInput::after {
218-
background-color: #FFFFFF;
219-
border-radius: 50%;
220-
content: "";
221-
height: 8px;
222-
left: 50%;
223-
position: absolute;
224-
top: 50%;
225-
-webkit-transform: translate(-50%,-50%);
226-
-ms-transform: translate(-50%,-50%);
227-
transform: translate(-50%,-50%);
228-
width: 8px;
229-
}
230-
231-
.c0 input:focus + .radioInput {
232-
outline: none;
233-
border-color: #006296;
234-
box-shadow: 0 0 0 2px #84C6EA;
235-
}
236-
237-
.c0 .radioInput {
238-
background-color: #F1F2F2;
239-
border: 1px solid #DBDEE1;
240-
border-radius: 50%;
241-
box-sizing: border-box;
242-
display: inline-block;
243-
height: 16px;
244-
left: 0;
245-
margin-top: var(--spacing-half);
246-
position: absolute;
247-
top: 0;
248-
width: 16px;
249-
}
250-
251-
.c0:hover .radioInput {
252-
border: 1px solid #DBDEE1;
253-
}
254-
255-
<label
256-
class="c0"
204+
</label>
205+
<label
206+
class="c4"
257207
disabled=""
258208
>
259209
Pluto
@@ -267,79 +217,9 @@ Array [
267217
<span
268218
class="radioInput"
269219
/>
270-
</label>,
271-
.c0 {
272-
cursor: pointer;
273-
display: block;
274-
font-size: 0.875rem;
275-
line-height: 1.5rem;
276-
padding-left: var(--spacing-3x);
277-
position: relative;
278-
-webkit-user-select: none;
279-
-moz-user-select: none;
280-
-ms-user-select: none;
281-
user-select: none;
282-
}
283-
284-
.c0:not(:first-of-type) {
285-
margin-top: var(--spacing-1x);
286-
}
287-
288-
.c0 input {
289-
height: 16px;
290-
left: 0;
291-
margin: 0;
292-
opacity: 0;
293-
position: absolute;
294-
top: 2px;
295-
width: 16px;
296-
}
297-
298-
.c0 input:checked + .radioInput {
299-
background-color: #006296;
300-
border: 1px solid #006296;
301-
}
302-
303-
.c0 input:checked + .radioInput::after {
304-
background-color: #FFFFFF;
305-
border-radius: 50%;
306-
content: "";
307-
height: 8px;
308-
left: 50%;
309-
position: absolute;
310-
top: 50%;
311-
-webkit-transform: translate(-50%,-50%);
312-
-ms-transform: translate(-50%,-50%);
313-
transform: translate(-50%,-50%);
314-
width: 8px;
315-
}
316-
317-
.c0 input:focus + .radioInput {
318-
outline: none;
319-
border-color: #006296;
320-
box-shadow: 0 0 0 2px #84C6EA;
321-
}
322-
323-
.c0 .radioInput {
324-
background-color: #FFFFFF;
325-
border: 1px solid #60666E;
326-
border-radius: 50%;
327-
box-sizing: border-box;
328-
display: inline-block;
329-
height: 16px;
330-
left: 0;
331-
margin-top: var(--spacing-half);
332-
position: absolute;
333-
top: 0;
334-
width: 16px;
335-
}
336-
337-
.c0:hover .radioInput {
338-
border: 1px solid #006296;
339-
}
340-
341-
<label
342-
class="c0"
220+
</label>
221+
<label
222+
class="c3"
343223
>
344224
Saturn
345225
<input
@@ -351,6 +231,6 @@ Array [
351231
<span
352232
class="radioInput"
353233
/>
354-
</label>,
355-
]
234+
</label>
235+
</div>
356236
`;

0 commit comments

Comments
 (0)