Skip to content

Releases: jucian0/createform

v4.0.0

04 Jun 21:56
Compare
Choose a tag to compare

New release v4.0.0 ๐Ÿš€ ๐Ÿš€ ๐Ÿฅณ

Features

loadData

The loadData feature allows you to retrieve form values from an external API and set them as the initial values of a form.

Example usage:

const useLoginForm = createForm<Form>({
  initialValues: {
    email: "",
  },
  mode: "onSubmit",
  loadData: async (id)=> {
    try {
      return await getFormValues();
    } catch (e) {
      return {};
    }
  },
});

onSubmit

TheonSubmit feature enables you to submit a form.

Example usage:

const useLoginForm = createForm<Form>({
  initialValues: {
    email: "",
  },
  mode: "onSubmit",
  onSubmit: values =>{
    // post or update
}
});

Please note that the above code is just an example, and you may need to adapt it to your specific use case.

V3.5.0

23 May 02:19
Compare
Choose a tag to compare

New release v3.5.0 ๐Ÿš€ ๐Ÿš€

Feature

useForm() - This hook enables the seamless creation of forms in a native and intuitive manner.

  const { register, errors, getErrors, setFieldValue, getValues } = useForm({
    initialValues: data,
    onSubmit,
 });

  function onSubmit(e: typeof data) {
    console.log(e);
  }

  return (
      <form {...register()}>
          <Input name="name" />
         <button>Submit</button>
         <button typw="reset">Reset</button>
     </form>
}

v3.4.0

17 May 02:02
Compare
Choose a tag to compare

v3.4.0 ๐Ÿš€ ๐Ÿš€ ๐ŸŽ‰

Feature

  • Add formReset function.

v3.3.25

01 May 02:56
Compare
Choose a tag to compare

New release v3.3.25 ๐Ÿš€ ๐Ÿš€

3.3.25 (2023-05-01)

Bug Fixes

  • createform: fix register params types (a4dd3d4)
  • types: adding typed field name for register, setField error ,value,touched functions (6e8d923)
  • types: adding typed field name for register, setField error ,value,touched functions (e62fe4f)

v3.3.7

31 Mar 02:29
Compare
Choose a tag to compare

New release v3.3.7 ๐Ÿš€ ๐Ÿš€

3.3.7 (2023-03-31)

Bug Fixes

  • createform: fixing undefined value displaying in the input (29ec68e)
  • createform: update yup version, and fix Validate to work with yup v1 (d0873dd)

v3.3.3

10 Feb 01:36
Compare
Choose a tag to compare

3.3.3

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

Fix

  • Fix useSyncExternalStore integration for server rendering.

V3.3.1

01 Feb 11:23
Compare
Choose a tag to compare

3.3.0

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

What's Changed

  • Update internal JSDoc to improve DX.
  • From useform to Createform

New feature

  • Add inline validation.
<input
  {...register({
    type: 'email',
    name: 'email',
    validate: yup.string().email().required(), //or zod
  })}
/>

V3.2.4

24 Jan 15:44
Compare
Choose a tag to compare

3.2.4

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

What's Changed

  • Update internal approach to emit event when update the form state.
  • Add handleReset method, working in the same way of handleSubmit.
  • Replace useEffect, and useState to useSyncExternalStore to update the form state.

3.1.0

20 Sep 01:56
c385e56
Compare
Choose a tag to compare

V3.1.0

React updated to 18.0.2
React DOM updated to 18.0.2

v3.0.0

23 Jan 01:47
4093b00
Compare
Choose a tag to compare

3.0.0 (2022-01-23)

Features

  • createform: new function to create a form (289df80)
  • debounce: add a debounce function (bbd5a63)
  • exception: add new exception handle (b8fe654)
  • fieldutild: add functions to deal with fields and their references (f07080a)
  • hooks: remove old implementation (e049371)
  • objectutils: dot-prop implementation (a1ad34a)
  • package.json: remove unused packages (da2c669)
  • store: add Store to keep the form state (7f17381)
  • types: add new types (63b5de2)
  • types: add new types to new implementation (49c9c76)
  • utils: remove old implementation (788a910)
  • validate: add Validate function to deal with errors (ccf09fd)
  • wrapper: wrapper component allow to use custom fields (16f46ee)

Tests

BREAKING CHANGES

  • wrapper: Wrapper is the new way to register a custom component
  • createform: Changes the way to create a form
  • tests: This change introduce createForm function, this function is the new way to create
    forms.