Skip to content

Commit 28fee1b

Browse files
committed
fixup! fixup! fixup! Refactor(web): Remove label wrap from Checkbox, Radio, and Toggle
1 parent 927df64 commit 28fee1b

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

packages/web/src/scss/components/Checkbox/_Checkbox.scss

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// and therefore bloating the CSS.
33
// 2. We need to set the background-color of the non-disabled Checkbox input to initial color when it is hovered
44
// or active, because we need it contrasting with the background color.
5-
// 3. Make the text selectable
5+
// 3. Make the text selectable and allow links to be clickable in the helper text.
66

77
@use 'theme';
88
@use '../../theme/form-fields' as form-fields-theme;
@@ -21,6 +21,9 @@ $_field-name: 'Checkbox';
2121

2222
.Checkbox__label {
2323
@include form-fields-tools.inline-field-label();
24+
@include form-fields-tools.stretch(before, left);
25+
26+
position: relative;
2427
}
2528

2629
.Checkbox__label--hidden {

packages/web/src/scss/components/Radio/_Radio.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// 1. We need to set the background-color of the non-disabled Radio input to initial color when it is hovered
22
// or active, because we need it contrasting with the background color.
3-
// 2. Make the text selectable
3+
// 2. Make the text selectable and allow links to be clickable in the helper text.
44

55
@use 'sass:map';
66
@use '../../theme/form-fields' as form-fields-theme;

packages/web/src/scss/components/Toggle/_Toggle.scss

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ $_field-name: 'Toggle';
2525

2626
.Toggle__label {
2727
@include form-fields-tools.inline-field-label();
28+
@include form-fields-tools.stretch(before, right);
2829

2930
position: relative;
3031
}

packages/web/src/scss/theme/_form-fields.scss

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ $helper-text-color-state-disabled: tokens.$disabled-content;
3333
// Inline field form components – Checkbox, Radio, etc.
3434
$inline-field-gap: tokens.$space-500;
3535
$inline-field-margin-y: tokens.$space-500;
36+
$inline-field-margin-x: tokens.$space-600;
3637
$inline-field-input-border-color-checked: tokens.$form-field-filled-border-state-selected;
3738
$inline-field-input-border-color-checked-disabled: tokens.$disabled-background;
3839
$inline-field-input-border-width: tokens.$border-width-200;

packages/web/src/scss/tools/_form-fields.scss

+7-1
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,17 @@
272272
@include typography.generate(form-fields-theme.$item-helper-text-typography);
273273
}
274274

275-
@mixin stretch($pseudo-element: before) {
275+
@mixin stretch($pseudo-element: before, $expand: left) {
276276
&::#{$pseudo-element} {
277277
content: '';
278278
position: absolute;
279279
inset: 0;
280280
z-index: 0;
281+
282+
@if $expand == 'left' {
283+
left: -#{form-fields-theme.$inline-field-margin-x};
284+
} @else {
285+
right: -#{form-fields-theme.$inline-field-margin-x};
286+
}
281287
}
282288
}

0 commit comments

Comments
 (0)