Skip to content

Commit 7ce57cc

Browse files
authored
docs(Form): add JSDoc comments (#931)
1 parent b5fbe34 commit 7ce57cc

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

packages/main/src/components/Form/Form.stories.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ import { DocsHeader } from '@shared/stories/DocsHeader';
3434
<Story name="Default">
3535
{(args) => (
3636
<Form {...args} title={args.title}>
37+
<FormItem label={'Sole Form Item'}>
38+
<Input type={InputType.Text} />
39+
</FormItem>
3740
<FormGroup title={'Personal Data'}>
3841
<FormItem label={'Name'}>
3942
<Input type={InputType.Text} />
@@ -52,9 +55,6 @@ import { DocsHeader } from '@shared/stories/DocsHeader';
5255
<CheckBox checked />
5356
</FormItem>
5457
</FormGroup>
55-
<FormItem label={'Sole Form Item'}>
56-
<Input type={InputType.Text} />
57-
</FormItem>
5858
<FormGroup title={'Company Data'}>
5959
<FormItem label={'Company Name'}>
6060
<Input type={InputType.Text} />
@@ -91,9 +91,9 @@ import { DocsHeader } from '@shared/stories/DocsHeader';
9191
</Story>
9292
</Canvas>
9393

94+
<ArgsTable story="." />
95+
9496
### Usage Notes
9597

9698
Please note that the `FormGroup` and `FormItem` components are only used for calculating the final layout of the `Form`,
97-
thus they don't accept any other props then the specified ones, especially no `className`, `style` or `ref`.
98-
99-
<ArgsTable story="." />
99+
thus they don't accept any other props than the specified ones, especially no `className`, `style` or `ref`.

packages/main/src/components/Form/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ export interface FormPropTypes extends CommonProps {
8282
}
8383

8484
const useStyles = createComponentStyles(styles, { name: 'Form' });
85-
85+
/**
86+
* The `Form` component arranges labels and fields into groups and rows. There are different ways to visualize forms for different screen sizes.
87+
*/
8688
const Form: FC<FormPropTypes> = forwardRef((props: FormPropTypes, ref: Ref<HTMLDivElement>) => {
8789
const {
8890
title,

packages/main/src/components/FormGroup/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ const useStyles = createComponentStyles(
2323
},
2424
{ name: 'FormGroup' }
2525
);
26-
26+
/**
27+
* The `FormGroup` encapsulates `FormItems` into groups.
28+
* __Note:__ `FormGroup` is only used for calculating the final layout of the `Form`, thus it doesn't accept any other props than `title` and `children`, especially no `className`, `style` or `ref`.
29+
*/
2730
const FormGroup: FC<FormGroupProps> = (props: FormGroupProps) => {
2831
const { title, children } = props;
2932

packages/main/src/components/FormItem/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ const renderLabel = (
7070

7171
return null;
7272
};
73-
73+
/**
74+
* The `FormItem` is only used for calculating the final layout of the `Form`, thus it doesn't accept any other props than `label` and `children`, especially no `className`, `style` or `ref`.
75+
*/
7476
const FormItem: FC<FormItemProps> = (props: FormItemProps) => {
7577
const { label, children, columnIndex, rowIndex, labelSpan } = props as InternalProps;
7678

0 commit comments

Comments
 (0)