Releases: fabian-hiller/modular-forms
v0.1.0 (@modular-forms/preact)
- Initial release
v0.13.1 (@modular-forms/solid)
- Fix bug by adding missing
transform
property toinitializeFieldStore
util
v0.13.0 (@modular-forms/solid)
Many thanks to @RBleyenberg and @atk for contributing to this release.
- Add
transform
prop toField
component (issue #40) - Add
toCustom
transformation function - Remove unused
InitialValues
andMaybeFunction
utility type
v0.11.0 (@modular-forms/qwik)
Many thanks to @RBleyenberg and @atk for contributing to this release.
- Add
transform
prop toField
component (issue #40) - Add
toCustom
transformation function
v0.12.2 (@modular-forms/solid)
Many thanks to @kieran-mgc for contributing to this release.
- Fix sorting bug in
insert
,move
andremove
method (issue #61)
v0.12.1 (@modular-forms/solid)
Many thanks to @kieran-mgc for contributing to this release.
- Fix update bug in
getValues
method when adding new fields or array items (issue #60)
v0.10.1 (@modular-forms/qwik)
Many thanks to @kieran-mgc for contributing to this release.
- Fix sorting bug in
insert
,move
andremove
method (issue #61)
v0.10.0 (@modular-forms/qwik)
- Upgrade Qwik and Qwik City peer dependency
v0.12.0 (@modular-forms/solid)
Note: The package has been revised and refactored and it would be too complicated to mention every change here. Please create an issue if you encounter problems.
- Rename
createForm
primitive tocreateFormStore
- Add
createForm
primitive with linked components - Change
children
property ofField
component - Add
type
property toField
component - Change behaviour of controlled
<input type="number" />
- Make
value
required oninsert
andreplace
method - Remove
minFiles
,maxFiles
,minNumber
andmaxNumber
validation function
Migration guide
createForm
primitive
To improve the API design, we changed the return value of the createForm
primitive. Previously, only the store of the form was returned. Now the Form
, Field
and FieldArray
components are also returned. A complete rework of the code base made this possible without increasing the bundle size.
This change eliminates the need to add the form store to each Form
, Field
and FieldArray
component. This reduces the JSX code on your side and improves the DX.
If you want to keep the library as modular as possible with the same API design as before, we have added the
createFormStore
primitive.
You now need to make the following changes in your code:
// Change this
import { createForm, Form, Field, FieldArray } from '@modular-forms/solid';
const form = createForm();
<Form of={form} />
<Field of={form} />
<FieldArray of={form} />
// To that
import { createForm } from '@modular-forms/solid';
const [form, { Form, Field, FieldArray }] = createForm();
<Form />
<Field />
<FieldArray />
Field
component
To the Field
component we have added the type
property which defines the data type of your field. However, this only needs to be set if you want to capture something other than a string.
This change now allows you to capture any data type that the <input />
, <select />
and <textarea />
elements can return. For example, <input type="date" />
can return a date string, a date object or a number representing the date. With type
you can now freely decide which data type you need.
This new feature is fully typed and makes your form now completely type safe. It is now no longer possible to accidentally enter the wrong data type. Furthermore, TypeScript tells you if you have forgotten the type
property and helps you fill it in with autocompletion.
In most cases, no change in your code will be necessary, since for strings, as already mentioned, the type
property is optional. In all other cases, you must now add the type
property.
// Change this
<Field name="age" />
// To that
<Field name="age" type="number" />
Furthermore, we have removed the props
you need to pass to an <input />
, <select />
and <textarea />
element from the store of a field and instead passed it as the second parameter to the function of the children
property.
You now need to make the following changes in your code:
// Change this
<Field name="foo">{(field) => <input {...field.props} />}</Field>
// To that
<Field name="foo">{(field, props) => <input {...props} />}</Field>
Validation functions
As a last major change, but one that is unlikely to affect anyone, we have removed superfluous validation functions.
// Change this
minFiles(2, 'Your message')
maxFiles(4, 'Your message')
// To that
minLength(2, 'Your message')
maxLength(4, 'Your message')
// And this
minNumber(0, 'Your message')
maxNumber(10, 'Your message')
// To
minRange(0, 'Your message')
maxRange(10, 'Your message')
v0.9.0 (@modular-forms/qwik)
Many thanks to @juanpmarin for contributing to this release.
Note: The package has been refactored and not every change is listed here. Please create an issue if you encounter problems.
- Remove
active
property from RawFieldState and RawFieldArrayState type - Remove unnecessary code from
Field
component - Add log statement for unknown errors to
formAction$
(issue #50) - Remove deprecated
custom
,minFiles
,maxFiles
,minNumber
andmaxNumber
validation function - Refactor
getValues
and removegetArrayValues
method