@availity/form
Version:
Form Wrapper around formik using reactstrap components
203 lines (161 loc) • 5.13 kB
TypeScript
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 * as react_jsx_runtime from 'react/jsx-runtime';
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;
disabled?: boolean;
readOnly?: boolean;
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;
isHelpVideoType?: boolean;
}
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;
isHelpVideoType?: boolean;
}
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;
isHelpVideoType?: boolean;
}
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;
helpId?: string;
required?: boolean;
isHelpVideoType?: boolean;
}
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;
isHelpVideoType?: boolean;
}
declare const Radio: (props: RadioProps) => JSX.Element;
interface LabelProps extends LabelProps$1 {
helpId?: string;
required?: boolean;
isHelpVideoType?: boolean;
}
declare const Label: (props: LabelProps) => JSX.Element;
declare const RequiredAsterisk: () => JSX.Element;
declare const RequiredKey: () => JSX.Element;
type FieldHelpIconProps = {
/** The field Help ID Required */
id: string;
/** The bootstrap 3 color of the icon. Default:primary */
color?: string;
/** The size of the help icon. Default: 1x */
size?: string;
/** The id of the associated label for aria-describedby, needed for accessibility. */
labelId?: string;
/** The prop that allows the type of icon to be changed to video-help, if needed */
isHelpVideoType?: boolean;
};
declare const FieldHelpIcon: (props: FieldHelpIconProps) => JSX.Element;
declare const triggerFieldHelp: (id: string) => void;
type Props = {
name: string;
onValueChanged: (value: string | undefined) => void;
id?: string;
value?: string;
placeholder?: string;
disabled?: boolean;
} & CurrencyInputProps;
declare const CurrencyInput: ({ name, onValueChanged, id, value, placeholder, disabled, ...attributes }: Props) => react_jsx_runtime.JSX.Element;
export { Checkbox, CheckboxGroup, CurrencyInput, Field, FieldHelpIcon, type FieldHelpIconProps, type FieldProps, Form, FormGroup, type FormProps, Input, Label, type LabelProps, Radio, RadioGroup, RequiredAsterisk, RequiredKey, triggerFieldHelp };