Skip to content

Commit 2bc61e2

Browse files
authored
Update spacing on fields to be more explicit (#893)
Update spacing around forms to be consistent with design artifacts
1 parent c839dbc commit 2bc61e2

File tree

19 files changed

+30
-49
lines changed

19 files changed

+30
-49
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- `MenuItem` renders an empty Box with the same size as the icon(s) of sibling `MenuItem's (if any)
2424
- `MenuList`, `MenuGroup` contain piece of state the tracks the size of the preserved icon space
2525
- Labels in `FieldInline` and `ButtonItem` now include the `for` attribute
26+
- Fields have more explicit line-heights to enforce consistent layout.
27+
- `Fieldset` default spacing switched from `xsmall` to `small` to improve visual relationship with their `Input*`
2628

2729
### Fixed
2830

packages/components/src/Form/Fields/Field.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ const fieldLabelCSS = (inline?: boolean) =>
162162
padding-right: ${({ theme }) => theme.space.small};
163163
`
164164
: css`
165+
line-height: ${({ theme }) => theme.lineHeights.xsmall};
165166
padding-bottom: ${({ theme }) => theme.space.xsmall};
166167
`
167168

packages/components/src/Form/Fields/FieldCheckbox/__snapshots__/FieldCheckbox.test.tsx.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ exports[`A FieldCheckbox 1`] = `
2424
}
2525
2626
.c4 {
27-
display: inline-block;
2827
height: 1rem;
2928
position: relative;
3029
width: 1rem;
31-
vertical-align: middle;
3230
}
3331
3432
.c4 input {
@@ -78,6 +76,7 @@ exports[`A FieldCheckbox 1`] = `
7876
display: grid;
7977
grid-template-areas: 'input label' '. messages';
8078
grid-template-columns: repeat(3,max-content);
79+
line-height: 1.25rem;
8180
}
8281
8382
.c0 .c3 {
@@ -175,11 +174,9 @@ exports[`A FieldCheckbox with checked value 1`] = `
175174
}
176175
177176
.c4 {
178-
display: inline-block;
179177
height: 1rem;
180178
position: relative;
181179
width: 1rem;
182-
vertical-align: middle;
183180
}
184181
185182
.c4 input {
@@ -229,6 +226,7 @@ exports[`A FieldCheckbox with checked value 1`] = `
229226
display: grid;
230227
grid-template-areas: 'input label' '. messages';
231228
grid-template-columns: repeat(3,max-content);
229+
line-height: 1.25rem;
232230
}
233231
234232
.c0 .c3 {

packages/components/src/Form/Fields/FieldInline.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const FieldInline = styled(FieldInlineLayout)`
7777
display: grid;
7878
grid-template-areas: 'input label' '. messages';
7979
grid-template-columns: repeat(3, max-content);
80+
line-height: ${({ theme }) => theme.lineHeights.small};
8081
8182
${InputArea} {
8283
grid-area: input;

packages/components/src/Form/Fields/FieldRadio/__snapshots__/FieldRadio.test.tsx.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ exports[`A FieldRadio 1`] = `
2626
}
2727
2828
.c4 {
29-
display: inline-block;
3029
height: 1rem;
3130
position: relative;
3231
width: 1rem;
33-
vertical-align: middle;
3432
}
3533
3634
.c4 input {
@@ -83,6 +81,7 @@ exports[`A FieldRadio 1`] = `
8381
display: grid;
8482
grid-template-areas: 'input label' '. messages';
8583
grid-template-columns: repeat(3,max-content);
84+
line-height: 1.25rem;
8685
}
8786
8887
.c0 .c3 {
@@ -163,11 +162,9 @@ exports[`A FieldRadio checked 1`] = `
163162
}
164163
165164
.c4 {
166-
display: inline-block;
167165
height: 1rem;
168166
position: relative;
169167
width: 1rem;
170-
vertical-align: middle;
171168
}
172169
173170
.c4 input {
@@ -220,6 +217,7 @@ exports[`A FieldRadio checked 1`] = `
220217
display: grid;
221218
grid-template-areas: 'input label' '. messages';
222219
grid-template-columns: repeat(3,max-content);
220+
line-height: 1.25rem;
223221
}
224222
225223
.c0 .c3 {

packages/components/src/Form/Fields/FieldSelect/__snapshots__/FieldSelect.test.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ exports[`A FieldSelect 1`] = `
140140
141141
.c0 > .c1 {
142142
grid-area: label;
143+
line-height: 1rem;
143144
padding-bottom: 0.5rem;
144145
}
145146
@@ -422,6 +423,7 @@ exports[`A FieldSelect with an error validation aligned to the right 1`] = `
422423
423424
.c0 > .c1 {
424425
grid-area: label;
426+
line-height: 1rem;
425427
padding-bottom: 0.5rem;
426428
}
427429
@@ -753,6 +755,7 @@ exports[`A required FieldSelect 1`] = `
753755
754756
.c0 > .c1 {
755757
grid-area: label;
758+
line-height: 1rem;
756759
padding-bottom: 0.5rem;
757760
}
758761
@@ -1041,6 +1044,7 @@ exports[`FieldSelect supports labelWeight 1`] = `
10411044
10421045
.c0 > .c1 {
10431046
grid-area: label;
1047+
line-height: 1rem;
10441048
padding-bottom: 0.5rem;
10451049
}
10461050

packages/components/src/Form/Fields/FieldText/__snapshots__/FieldText.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ exports[`A FieldText with default label 1`] = `
113113
114114
.c0 > .c1 {
115115
grid-area: label;
116+
line-height: 1rem;
116117
padding-bottom: 0.5rem;
117118
}
118119
@@ -256,6 +257,7 @@ exports[`A FieldText with label inline 1`] = `
256257
257258
.c7 > .c1 {
258259
grid-area: label;
260+
line-height: 1rem;
259261
padding-bottom: 0.5rem;
260262
}
261263

packages/components/src/Form/Fields/FieldTextArea/__snapshots__/FieldTextArea.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ exports[`A FieldTextArea with default label 1`] = `
8181
8282
.c0 > .c1 {
8383
grid-area: label;
84+
line-height: 1rem;
8485
padding-bottom: 0.5rem;
8586
}
8687
@@ -189,6 +190,7 @@ exports[`A FieldTextArea with label inline 1`] = `
189190
190191
.c6 > .c1 {
191192
grid-area: label;
193+
line-height: 1rem;
192194
padding-bottom: 0.5rem;
193195
}
194196

packages/components/src/Form/Fields/FieldToggleSwitch/__snapshots__/FieldToggleSwitch.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ exports[`A FieldToggleSwitch 1`] = `
6363
display: grid;
6464
grid-template-areas: 'input label' '. messages';
6565
grid-template-columns: repeat(3,max-content);
66+
line-height: 1.25rem;
6667
}
6768
6869
.c0 .c3 {
@@ -187,6 +188,7 @@ exports[`A FieldToggleSwitch turned on 1`] = `
187188
display: grid;
188189
grid-template-areas: 'input label' '. messages';
189190
grid-template-columns: repeat(3,max-content);
191+
line-height: 1.25rem;
190192
}
191193
192194
.c0 .c3 {

packages/components/src/Form/Fieldset/Fieldset.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const FieldsetLayout = forwardRef(
6060
const content = (
6161
<LayoutComponent
6262
{...restProps}
63-
gap={inline ? 'medium' : 'xsmall'}
63+
gap={inline ? 'medium' : 'small'}
6464
className={className}
6565
ref={ref}
6666
role="group"

0 commit comments

Comments
 (0)