Skip to content

Commit 3c875d6

Browse files
authored
fix(Field): pass labelPosition prop (#127)
1 parent 042ee8c commit 3c875d6

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.changeset/six-parrots-bathe.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
fix(Field): pass labelPosition prop

src/components/forms/Form/Field.stories.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ WithErrorMessage.args = {
3737

3838
export const Styled = Template.bind({});
3939
Styled.args = {
40+
// labelPosition: 'side',
4041
styles: {
41-
width: '30x',
42+
placeItems: 'end',
4243
},
4344
};

src/components/forms/Form/Field.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import {
99
} from 'react';
1010
import { useFormProps } from './Form';
1111
import { mergeProps } from '../../../utils/react';
12-
import { OptionalFieldBaseProps, ValidationRule } from '../../../shared';
12+
import {
13+
LabelPosition,
14+
OptionalFieldBaseProps,
15+
ValidationRule,
16+
} from '../../../shared';
1317
import { CubeFormInstance } from './useForm';
1418
import { FieldWrapper } from '../FieldWrapper';
1519
import { Styles } from '../../../tasty';
@@ -120,6 +124,7 @@ export interface CubeFieldProps extends OptionalFieldBaseProps {
120124
/** Whether the field is hidden. */
121125
isHidden?: boolean;
122126
styles?: Styles;
127+
labelPosition?: LabelPosition;
123128
}
124129

125130
interface CubeFullFieldProps extends CubeFieldProps {
@@ -132,6 +137,7 @@ interface CubeReplaceFieldProps extends CubeFieldProps {
132137
onSelectionChange?: (any) => void;
133138
onBlur: () => void;
134139
onInputChange?: (any) => void;
140+
labelPosition?: LabelPosition;
135141
}
136142

137143
export function Field(allProps: CubeFieldProps) {
@@ -158,6 +164,7 @@ export function Field(allProps: CubeFieldProps) {
158164
tooltip,
159165
isHidden,
160166
styles,
167+
labelPosition,
161168
} = props;
162169
const nonInput = !name;
163170
const fieldName: string =
@@ -229,6 +236,7 @@ export function Field(allProps: CubeFieldProps) {
229236
description={description}
230237
Component={child}
231238
styles={styles}
239+
labelPosition={labelPosition}
232240
/>
233241
);
234242
}

0 commit comments

Comments
 (0)