Skip to content

Commit 4cc814c

Browse files
committed
move required to main
1 parent 4014b12 commit 4cc814c

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

packages/components/src/formControls/InputText/InputText.stories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ export const Required: Story = {
5858
args: {
5959
helperText: 'This is a helper text',
6060
label: 'Input Label',
61+
required: true,
6162
input: {
6263
size: 'medium',
63-
required: true,
6464
type: 'text',
6565
},
6666
},

packages/components/src/formControls/InputText/InputText.test.stories.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ export const NotRequired: Story = {
5252
export const Required: Story = {
5353
name: 'Required',
5454
args: {
55-
input: {
56-
required: true,
57-
},
55+
required: true,
5856
},
5957
play: async ({ canvasElement, step, args }) => {
6058
const canvas = within(canvasElement);

packages/components/src/formControls/InputText/InputText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ const FormControlInputText = ({
1717
name,
1818
onChange = () => undefined,
1919
onValidate = () => undefined,
20+
required = false,
2021
value = '',
2122
}: FormControlInputTextProps) => {
22-
const required = input.required ?? false;
2323
const validators = useInitValidators({ required });
2424
const { isValid, messages } = useValidateInput({ validators, value });
2525
const helperTextProps = {

packages/components/src/formControls/InputText/InputText.types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import { LabelProps } from '../../Label/Label.types';
77
export interface FormControlInputTextProps extends BaseComponentAttributes {
88
id: string;
99
name: BasicInputTextProps['name'];
10-
input?: Omit<BasicInputTextProps, 'error' | 'name' | 'onChange' | 'value'>;
10+
input?: Omit<BasicInputTextProps, 'error' | 'name' | 'onChange' | 'required' | 'value'>;
1111
helperText?: HelperTextProps['children'];
1212
helperTextExtra?: Omit<HelperTextProps, 'children' | 'type'>;
1313
label?: LabelProps['children'];
1414
labelExtra?: Omit<LabelProps, 'children' | 'error' | 'htmlFor' | 'required'>;
1515
onChange?: BasicInputTextProps['onChange'];
1616
onValidate?: (isValid: boolean, messages: string[]) => void;
17+
required?: boolean;
1718
value?: BasicInputTextProps['value'];
1819
}
1920

0 commit comments

Comments
 (0)