UNPKG

1.78 kBTypeScriptView Raw
1import * as React from 'react';
2import { List, useWatch } from 'rc-field-form';
3import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
4import type { FormRef } from 'rc-field-form/lib/interface';
5import type { Options } from 'scroll-into-view-if-needed';
6import type { SizeType } from '../config-provider/SizeContext';
7import type { ColProps } from '../grid/col';
8import type { FeedbackIcons } from './FormItem';
9import useForm from './hooks/useForm';
10import type { FormInstance } from './hooks/useForm';
11import type { Variant } from '../config-provider';
12import type { FormLabelAlign } from './interface';
13export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: {
14 required: boolean;
15}) => React.ReactNode);
16export type FormLayout = 'horizontal' | 'inline' | 'vertical';
17export type FormItemLayout = 'horizontal' | 'vertical';
18export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form'> {
19 prefixCls?: string;
20 colon?: boolean;
21 name?: string;
22 layout?: FormLayout;
23 labelAlign?: FormLabelAlign;
24 labelWrap?: boolean;
25 labelCol?: ColProps;
26 wrapperCol?: ColProps;
27 form?: FormInstance<Values>;
28 feedbackIcons?: FeedbackIcons;
29 size?: SizeType;
30 disabled?: boolean;
31 scrollToFirstError?: Options | boolean;
32 requiredMark?: RequiredMark;
33 /** @deprecated Will warning in future branch. Pls use `requiredMark` instead. */
34 hideRequiredMark?: boolean;
35 rootClassName?: string;
36 variant?: Variant;
37}
38declare const Form: (<Values = any>(props: React.PropsWithChildren<FormProps<Values>> & React.RefAttributes<FormRef<Values>>) => React.ReactElement) & Pick<React.FC, "displayName">;
39export { List, useForm, useWatch, type FormInstance };
40export default Form;
41
\No newline at end of file