formaze 2.0.4 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ **Latest version has been released.**
2
+
1
3
  # Formaze: An Easy Form Builder for React
2
4
 
3
5
  Formaze is a flexible and customizable form builder for React built with `React Hook Form`, `Zod`, and `TailwindCSS`. It provides an easy way to build forms with custom validation schemas and handles complex form validation logic efficiently with proper type-safety.
@@ -93,19 +95,19 @@ const formSchema = makeFormSchema({
93
95
  password: {
94
96
  type: "password",
95
97
  minLength: {
96
- value: 8,
97
- message: "Password must be at least 8 characters",
98
+ value: 8,
99
+ message: "Password must be at least 8 characters",
98
100
  },
99
101
  maxLength: {
100
- value: 16,
101
- message: "Password must be less than 16 characters",
102
+ value: 16,
103
+ message: "Password must be less than 16 characters",
102
104
  },
103
105
  },
104
106
  username: {
105
107
  type: "string",
106
108
  regex: {
107
- value: /^[a-z0-9]{3,}$/ /* only lowercase letters and numbers */,
108
- message: "Username must contains lowercase letters and numbers",
109
+ value: /^[a-z0-9]{3,}$/ /* only lowercase letters and numbers */,
110
+ message: "Username must contains lowercase letters and numbers",
109
111
  },
110
112
  customMessage: "Username must not be empty",
111
113
  },
@@ -183,9 +185,7 @@ import "formaze/dist/style.css";
183
185
 
184
186
  .form-control .form-field-error-text {
185
187
  color: rgb(220, 38, 38);
186
- font-size: 0.875rem;
187
- }
188
-
188
+ font-size: 0.875rem;
189
189
  /* or */
190
190
 
191
191
  .form-control .form-field-error {
@@ -372,7 +372,9 @@ This schema can then be passed to the Form component returned by `createFormVali
372
372
 
373
373
  ## Changes
374
374
 
375
- 1. The `createFormValidator` has been changed and now it is accepting an argument which is a type of zod schema generated through `makeFormSchema` or directly from `Zod` and the rest of the logic will be the same as before.
375
+ 1. **(Latest) So after a long time i updated this package, as React upgraded its version, i was aware that the previous version of this package would give version compatibility errors. But now it is fixed**.
376
+
377
+ 2. The `createFormValidator` has been changed and now it is accepting an argument which is a type of zod schema generated through `makeFormSchema` or directly from `Zod` and the rest of the logic will be the same as before.
376
378
 
377
379
  In order to give proper type support for JavaScript projects and to simplify the defining process this change has been made.
378
380
 
@@ -388,8 +390,8 @@ const Form = createFormValidator<typeof formSchema>(); ❌
388
390
  const Form = createFormValidator(formSchema); ✔
389
391
  ```
390
392
 
391
- 2. The Form component generated through `createFormValidator` method is now accepting an optional `mode` prop which you can read [about](#props-of-the-returned-form-component) here, and the `schema` prop of this Form component is now optional (**NOTE: In future version this prop will be deprecated. As of now this prop is no longer needed.**).
393
+ 3. The Form component generated through `createFormValidator` method is now accepting an optional `mode` prop which you can read [about](#props-of-the-returned-form-component) here, and the `schema` prop of this Form component is now optional (**NOTE: In future version this prop will be deprecated. As of now this prop is no longer needed.**).
392
394
 
393
- 3. The name of the `useFormSchema` has been changed to `makeFormSchema`, as per React rules we cannot use hooks outside of a React Component and this naming convention was preventing it from being used outside of a React Component, but now it's been taken into consideration. You can now use it anywhere you want.
395
+ 4. The name of the `useFormSchema` has been changed to `makeFormSchema`, as per React rules we cannot use hooks outside of a React Component and this naming convention was preventing it from being used outside of a React Component, but now it's been taken into consideration. You can now use it anywhere you want.
394
396
 
395
397
  ## (That's it!)