All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
formz
- fix bug calling
validate
fromuseFormzContext
cause failure due to not passing current fields & values.
- fix bug calling
formz
- Submit event now triggering
stopPropagation()
method to avoid event bubbling to parent forms.
- Submit event now triggering
formz
- Split state to 2 different states to reduce re-rendering of components if they only depend on certain partial form state.
formz
- Fix bug where if
focusFirstErrorField
and a field did not pass theinputProps.ref
to the UI component, there is a.current of undefined
error.
- Fix bug where if
formz
- Add
ref
touseFormzField
underinputProps
to pass a reference to the field HTML element down to the field state. - Add
focusFirstErrorField
boolean prop toForm
component. If the form is invalid during submit, and the field has hisref
filled, the field will be focused automatically.
- Add
formz
- Add
validate
function on the formz context to allow manual triggering of validation for all fields.
- Add
-
formz
- Add
validateAll
support for a function that will allow skipping or including fields in the re-validation.
- Add
-
formz-docs
- Updated API docs with
validateAll
changes
- Updated API docs with
-
formz
- Add
validateAll
support foruseFormField
. When this attribute istrue
, whenever the field is validated, all other fields will be validated as well.
- Add
-
formz-docs
- Updated API docs with
validateAll
- Add
validate all
example
- Updated API docs with
-
formz
- Formz provider
submit
function now takes 2 arguments:(event, options)
submit
can be triggered withignoreErrors
option to force callingonSubmit
even if validation error occurred
- Formz provider
-
formz-docs
- Updated API docs with missing info about
form
andfields
- Updated API docs with missing info about
formz
- Functions
onChange
andonBlur
provided byuseFormzField.inputProps
are memoized to prevent redundant renders
- Functions
formz
- Native submit event is passed to
onSubmit
,onSubmitSuccess
andonSubmitError
- Native submit event is passed to
formz
- Validation on blur event triggered with previous value
formz
- Form submit caused error if
onSubmitSuccess
oronSubmitError
was not provided.
- Form submit caused error if
formz
- Calling
onSubmitSuccess
/onSubmitError
caused an unmounted component state change if theForm
component was unmounted during that time (for example, navigating to another page).
- Calling
formz
- When a field value as set to falsy value (
''
,0
etc.) with a native event (input
onChange for example), the value would become the event object resulting in an[Object object]
text in the input.
- When a field value as set to falsy value (
formz
- Fixed
README.md
file in thenpm
package
- Fixed
A new version of Formz
built on top of React hooks and context API with an even smaller footprint
than before!
-
formz
- Added
useFormz
hook - Added
useFormzField
hook - Added
useFormzContext
hook
- Added
-
formz-utils
(NEW PACKAGE 🎁)- Added
useFormzDebug
hook to pretty print form events to the console - Added
Field
component to allow component based usage ofuseFormzField
hook
- Added
-
formz-docs
(NEW PACKAGE 🎁)- Created documentation based on Storybook.
formz
- Removed
Formz
component - Field level validation can be only a single function now
- All validations are considered
async
- Validations can run only on
init
,blur
,change
and before submit
- Removed