UNPKG

@availity/form

Version:

Form Wrapper around formik using reactstrap components

179 lines (140 loc) 4.29 kB
import { FormikConfig, FieldValidator } from 'formik'; export { ErrorMessage as Feedback } from 'formik'; import { InputHTMLAttributes, ReactNode, HTMLAttributes } from 'react'; import { FormGroupProps, LabelProps as LabelProps$1 } from 'reactstrap'; import { CurrencyInputProps } from 'react-currency-input-field'; /* eslint-disable @typescript-eslint/no-explicit-any */ type FormProps<FormValues> = { id?: string; focusInvalidField?: boolean; invalidInputSelectors?: string; } & FormikConfig<FormValues>; declare const Form: <FormValues>(props: FormProps<FormValues>) => JSX.Element; /* eslint-disable @typescript-eslint/no-explicit-any */ type InputType = | 'text' | 'email' | 'select' | 'file' | 'radio' | 'checkbox' | 'textarea' | 'button' | 'reset' | 'submit' | 'date' | 'datetime-local' | 'hidden' | 'image' | 'month' | 'number' | 'range' | 'search' | 'tel' | 'url' | 'week' | 'password' | 'datetime' | 'time' | 'color'; interface InputProps extends InputHTMLAttributes<HTMLInputElement> { [key: string]: any; type?: InputType; name: string; validate?: FieldValidator; tag?: Node | string; feedback?: boolean; help?: boolean; required?: boolean; } declare const Input: (props: InputProps) => JSX.Element; type Props$1 = { for: string; } & FormGroupProps; declare const FormGroup: (props: Props$1) => JSX.Element; /* eslint-disable @typescript-eslint/ban-types */ interface FieldChildProps { input: ReactNode; feedback: ReactNode; } interface FieldProps extends InputProps { label?: ReactNode; labelHidden?: boolean | false; disabled?: boolean | false; readOnly?: boolean | false; inputClass?: string; labelClass?: string; helpMessage?: string | object; errorMessage?: string | object; labelAttrs?: HTMLLabelElement; groupAttrs?: Partial<Props$1>; grid?: object; children?: (props: FieldChildProps) => ReactNode; append?: string | ReactNode; prepend?: string | ReactNode; helpId?: string; } declare const Field: (props: FieldProps) => JSX.Element; /* eslint-disable @typescript-eslint/no-explicit-any */ interface CheckboxGroupProps extends FormGroupProps { name: string; label?: ReactNode; labelClassName?: string; groupClassName?: string; onChange?: (value: any) => void; helpId?: string; required?: boolean | false; } declare const CheckboxGroup: (props: CheckboxGroupProps) => JSX.Element; /* eslint-disable @typescript-eslint/ban-types */ interface CheckboxProps extends HTMLAttributes<HTMLInputElement> { label?: ReactNode; value?: string | boolean | object; inline?: boolean; disabled?: boolean; id?: string; groupClassName?: string; groupName?: string; helpId?: string; } declare const Checkbox: (props: CheckboxProps) => JSX.Element; /* eslint-disable @typescript-eslint/no-explicit-any */ interface RadioGroupProps extends FormGroupProps { name: string; label?: ReactNode; labelClassName?: string; groupClassName?: string; onChange?: (value: any) => void; inline?: boolean | false; helpId?: string; required?: boolean | false; } declare const RadioGroup: (props: RadioGroupProps) => JSX.Element; /* eslint-disable @typescript-eslint/ban-types */ interface RadioProps extends HTMLAttributes<HTMLInputElement> { label?: ReactNode; name?: string; id?: string; groupClassName?: string; value?: string | boolean | object; disabled?: boolean; helpId?: string; } declare const Radio: (props: RadioProps) => JSX.Element; interface LabelProps extends LabelProps$1 { helpId?: string; required?: boolean | false; } declare const Label: (props: LabelProps) => JSX.Element; declare const RequiredAsterisk: () => JSX.Element; declare const RequiredKey: () => JSX.Element; declare type Props = { id?: string; value?: string; name: string; placeholder?: string; disabled?: boolean; onValueChanged: (value: string | undefined) => void; } & CurrencyInputProps; declare const CurrencyInput: ({ id, name, value, placeholder, disabled, onValueChanged, ...attributes }: Props) => JSX.Element; export { Checkbox, CheckboxGroup, CurrencyInput, Field, FieldProps, Form, FormGroup, FormProps, Input, Label, LabelProps, Radio, RadioGroup, RequiredAsterisk, RequiredKey };