- Add
validate(options: { isSubmit: boolean })
method to the Form Object, to trigger form validation without theonSubmit
action. - Add
options: { isSubmit: boolean }
to the validator, to allow varied logic depending on the validation trigger. - Fix TypeScript definition for FormErrors
- Add
hasKeyOrAlias
to experimental Form Groups. - Fix TypeScript types for experimental Form Groups.
- Changed
dirtyFields
to include fields fromdefaultValues
when form is first loaded. - Fixed
whitelistKeys
in experimental Form Groups.
- Fix loading state of experiment Form Groups.
- Added
setLoading
to experimental Form Groups. - Fix TypeScript typedef.
- Added experimental Form Groups, usable with
useFormGroup
anduseFormGroupItem
. - Added
dirtyFields: string[]
andhasDirty: boolean
to form object. - Fixed Flow types to be compatible with
exact_by_default
- Fixed TypeScript typedef to be aligned with Flow types.
- BC Break: Form option changes:
defaultValues
form option is now always required.validate
renamed tovalidator
.validateOnChange
renamed toalwaysRevalidateOnChange
.addError
renamed toaddSubmitError
, to indicate it should only be used during form submission.
- BC Break:
isValid: bool
removed from field prop, replaced with more usefulerrorList?: string[]
. - BC Break: Several exports renamed, mainly to reflect that typed is very much the recommended mode of operation:
FieldProp
->UntypedFieldProp
FormProp
->UntypedFormObject
Form
->UntypedFormComponent
TypedFieldProp
->FieldProp
TypedFormProp
->FormObject
TypedForm
->FormComponent
- BC Break: Remove bridges for React Native and validate.js.
- Added
errors
,lastErrors
,hasErrors
andhasLastErrors
properties to the form object. - Added
revalidateFields
to the form option, to opt-in which fields should revalidate on change. - Added
preValidateTransform
andpostValidateTransform
to the form option - Added
isDirty
to the field prop, to indicate whether the field has seen a change since the last submission. onSubmit
can now return aboolen
orPromise<boolean>
, to indicate whether submission was successful (useful for code awaitinghandleSubmit
).- Validation functions can now return an empty array for a field to indicate no errors, rather than only
undefined
. - Fixed out of sync internal state (
isInvalid
lagging one change behind) by refactoring touseReducer
.
- Fix usage of
void
in TS types (replace withundefined
).
- Add exported TypeScript type definitions (
index.d.ts
).
- BC Break:
getFieldProps
renamed togetField
. - BC Break: minimum version of supported dependencies bumped, most notably React now >=16.8 (for Hooks support).
- BC Break:
TypedForm
class components reimplemented using Hooks under the hood, so using aref
to access props will no longer work (not that this was an official API). - BC Break: Type exports renamed to singular:
FieldProps
->FieldProp
TypedFieldProps
->TypedFieldProp
- Added new
useForm
React Hook, saving from the component hierarchy nesting burden of HOCs and Render Props (and providing cleaner types support). - Added
values
andreset
to the FormProp. handleSubmit
is now async and returns a boolean, so you canawait
it.