UNPKG

antd

Version:

An enterprise-class UI design language and React components implementation

45 lines (44 loc) 2.06 kB
import * as React from 'react'; import { List, useWatch } from '@rc-component/form'; import type { FormProps as RcFormProps } from '@rc-component/form/lib/Form'; import type { FormRef } from '@rc-component/form/lib/interface'; import type { SemanticClassNamesType, SemanticStylesType } from '../_util/hooks'; import type { Variant } from '../config-provider'; import type { SizeType } from '../config-provider/SizeContext'; import type { ColProps } from '../grid/col'; import type { FeedbackIcons } from './FormItem'; import useForm from './hooks/useForm'; import type { FormInstance } from './hooks/useForm'; import type { FormLabelAlign, ScrollFocusOptions } from './interface'; export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: { required: boolean; }) => React.ReactNode); export type FormLayout = 'horizontal' | 'inline' | 'vertical'; export type FormItemLayout = 'horizontal' | 'vertical'; export type { ScrollFocusOptions }; export type FormSemanticName = 'root' | 'label' | 'content'; export type FormClassNamesType = SemanticClassNamesType<FormProps, FormSemanticName>; export type FormStylesType = SemanticStylesType<FormProps, FormSemanticName>; export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form'> { classNames?: FormClassNamesType; styles?: FormStylesType; prefixCls?: string; colon?: boolean; name?: string; layout?: FormLayout; labelAlign?: FormLabelAlign; labelWrap?: boolean; labelCol?: ColProps; wrapperCol?: ColProps; form?: FormInstance<Values>; feedbackIcons?: FeedbackIcons; size?: SizeType; disabled?: boolean; scrollToFirstError?: ScrollFocusOptions | boolean; requiredMark?: RequiredMark; rootClassName?: string; variant?: Variant; } declare const Form: (<Values = any>(props: React.PropsWithChildren<FormProps<Values>> & React.RefAttributes<FormRef<Values>>) => React.ReactElement) & Pick<React.FC, "displayName">; export { type FormInstance, List, useForm, useWatch }; export default Form;