Skip to content

Commit 3d19d62

Browse files
committed
fixup! fixup! fixup! Create InputGroup component (#430)
1 parent a12a16d commit 3d19d62

File tree

6 files changed

+29
-35
lines changed

6 files changed

+29
-35
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/components/InputGroup/InputGroup.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const InputGroup = ({
3838
);
3939

4040
return (
41-
<label
41+
<div
4242
className={classNames(
4343
styles.root,
4444
resolveContextOrProp(formLayoutContext && formLayoutContext.layout, layout) === 'horizontal'
@@ -71,9 +71,7 @@ export const InputGroup = ({
7171
</InputGroupContext.Provider>
7272
</div>
7373
{validationTexts && (
74-
<div
75-
className={styles.validationTexts}
76-
>
74+
<div className={styles.validationTexts}>
7775
{validationTexts.map((validationText) => (
7876
<Text blockLevel key={validationText}>
7977
{validationText}
@@ -82,7 +80,7 @@ export const InputGroup = ({
8280
</div>
8381
)}
8482
</div>
85-
</label>
83+
</div>
8684
);
8785
};
8886

src/lib/components/SelectField/SelectField.scss

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
@include box-field-layout.in-form-layout();
9191
}
9292

93+
.isRootGrouped {
94+
@include box-field-layout.in-group-layout();
95+
}
96+
9397
// Sizes
9498
.isRootSizeSmall {
9599
@include box-field-sizes.size(small);
@@ -102,17 +106,3 @@
102106
.isRootSizeLarge {
103107
@include box-field-sizes.size(large);
104108
}
105-
106-
// Groups
107-
.isRootGrouped {
108-
&:not(:first-child) .input {
109-
margin-left: var(--rui-local-gap);
110-
border-top-left-radius: 0;
111-
border-bottom-left-radius: 0;
112-
}
113-
114-
&:not(:last-child) .input {
115-
border-top-right-radius: 0;
116-
border-bottom-right-radius: 0;
117-
}
118-
}

src/lib/components/TextField/TextField.scss

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
@include box-field-layout.horizontal-with-small-input();
8989
}
9090

91+
.isRootGrouped {
92+
@include box-field-layout.in-group-layout();
93+
}
94+
9195
// Sizes
9296
.isRootSizeSmall {
9397
@include box-field-sizes.size(small);
@@ -100,17 +104,3 @@
100104
.isRootSizeLarge {
101105
@include box-field-sizes.size(large);
102106
}
103-
104-
// Groups
105-
.isRootGrouped {
106-
&:not(:first-child) .input {
107-
margin-left: var(--rui-local-gap);
108-
border-top-left-radius: 0;
109-
border-bottom-left-radius: 0;
110-
}
111-
112-
&:not(:last-child) .input {
113-
border-top-right-radius: 0;
114-
border-bottom-right-radius: 0;
115-
}
116-
}

src/lib/styles/tools/form-fields/_box-field-layout.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
//
5252
// 13. Label and field are vertically aligned to top (start) by default (see 10.). Vertical
5353
// alignment of each block can be changed by theme configuration.
54+
//
55+
// 14. Inner corners of TextField and SelectField components inside the InputGroup component are sharp
56+
// (their radius is set to 0).
5457

5558
@use "../../settings/forms";
5659
@use "../../settings/form-fields" as settings;
@@ -227,3 +230,16 @@
227230
}
228231
}
229232
}
233+
234+
@mixin in-group-layout() {
235+
&:not(:first-child) .input {
236+
margin-left: var(--rui-local-gap);
237+
border-top-left-radius: 0; // 14.
238+
border-bottom-left-radius: 0; // 14.
239+
}
240+
241+
&:not(:last-child) .input {
242+
border-top-right-radius: 0; // 14.
243+
border-bottom-right-radius: 0; // 14.
244+
}
245+
}

src/lib/theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@
890890
// InputGroup
891891
// =======
892892

893-
--rui-InputGroup__gap: var(--rui-spacing-1);
893+
--rui-InputGroup__gap: var(--rui-dimension-space-1);
894894

895895
//
896896
// Modal

0 commit comments

Comments
 (0)