Skip to content

Releases: zackify/validify

5.7.4

30 Dec 03:02
6adbbcd
Compare
Choose a tag to compare
  • Added unit test for rule validation.

If field 1 depends on field 2, and field 2 is changed, make sure field 1 is re-validated when the other field changes.

5.7.3

27 Dec 22:16
Compare
Choose a tag to compare

Switch rules back to partial, TS doesn't always check the full value unfortunately.

Ex:

rules={{email: []}}

will pass the type check even though it says the array must have a rule function in it. And it sometimes allows extra properties inside of the rules object, even though hovering over it confirms the type should only have the values inside of it.

5.7.2

27 Dec 22:10
Compare
Choose a tag to compare

Better rules type definition to prevent incorrect rules

5.7.1

27 Dec 21:57
Compare
Choose a tag to compare

Fix rule type typo

5.7.0

27 Dec 21:25
Compare
Choose a tag to compare
  • Added ability to use the form without rules, if you just want it to manage state, the rules prop may now be omitted

  • Added better TS support with generics:

type TestValues = {
  email: string;
  date1?: string;
  name?: string;
};

export const TestForm = ({ onSubmit, noRules }: Props) => {
  let [values, setValues] = useState<TestValues>({ email: 'test' });

  return (
    <Form
      values={values}
      onValues={setValues}
      rules={{
          email: [required, email],
          date1: [greaterThanDate2],
          name: [required],
      }}
    >

If you pass a rule that doesn't match a key from TestValues TS will error as expected!

5.6.1

27 Dec 19:12
Compare
Choose a tag to compare
  • add cjs build for old environments

5.6.0

27 Dec 18:00
c0df1df
Compare
Choose a tag to compare
  • Add TS types for the user facing code
  • Add 100% code coverage

5.5.0-beta4

23 Dec 21:02
Compare
Choose a tag to compare
5.5.0-beta4 Pre-release
Pre-release
  • TS types for root from / rules
  • Automate build process with gh actions
  • Write a test to confirm all is working

5.5.0-beta

23 Dec 20:30
Compare
Choose a tag to compare
5.5.0-beta Pre-release
Pre-release

-beta release, testing new ci automation + tests + typescript types

5.3.0-beta

07 Aug 22:18
Compare
Choose a tag to compare
5.3.0-beta Pre-release
Pre-release
  • Add support for nested objects:
let [values, setValues] = useState({
  address: { city: 'test city' }
  email: '[email protected]'
})

return <Form
        values={values}
        onValues={setValues}
        rules={{
          'address.city': [(value: string) => (value.length < 3 ? 'Test' : 'Test 2')],
        }}
      >
        <Input label="Email" name="email" />
        <Input label="Street Address" name="address.street" />
</Form>