formaze 1.0.7 → 1.0.8

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.
Files changed (2) hide show
  1. package/README.md +18 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -204,12 +204,15 @@ You just have to add `"use client"` directive at the top of your file where you
204
204
 
205
205
  ### `createFormValidator`
206
206
 
207
- **argument**:
208
- - formSchema: `T` (A Zod schema generated through useFormSchema or directly from Zod)
207
+ The createFormValidator function accepts an argument which is a type of zod schema and returns a Form component with built-in form validation using Zod and React Hook Form. It simplifies the creation of forms that adhere to a Zod schema for type-safe validation.
209
208
 
210
- The createFormValidator function returns a Form component with built-in form validation using Zod and React Hook Form. It simplifies the creation of forms that adhere to a Zod schema for type-safe validation.
209
+ #### Argument
211
210
 
212
- **Returned Form Component Props**:
211
+ **formSchema: `T`**
212
+
213
+ - Type: `T` (A Zod schema generated through useFormSchema or directly from Zod)
214
+
215
+ **Props of the Returned Form Component**:
213
216
 
214
217
  **schema: `T`**
215
218
 
@@ -226,7 +229,7 @@ const schema = useFormSchema({
226
229
  password: { type: "string", minLength: { value: 8 } },
227
230
  });
228
231
 
229
- const Form = createFormValidator(formSchema);
232
+ const Form = createFormValidator(schema);
230
233
 
231
234
  <Form schema={schema} onSubmit={handleSubmit} />;
232
235
  ```
@@ -303,14 +306,17 @@ The Form.Input component is a form input field that is connected to a Zod-based
303
306
 
304
307
  **Props:**
305
308
 
306
- - name: `keyof z.infer<T>`
307
- The name of the form field, which should correspond to one of the keys in the Zod schema used in the form. This connects the input to the form's validation logic.
309
+ - name: `keyof z.infer<T>`
310
+ - Description:
311
+ The name of the form field, which should correspond to one of the keys in the Zod schema used in the form. This connects the input to the form's validation logic.
308
312
 
309
- - label: `string` (optional)
310
- A label for the form field. This is used for displaying a descriptive text for the input field.
313
+ - label: `string` (optional)
314
+ - Description:
315
+ A label for the form field. This is used for displaying a descriptive text for the input field.
311
316
 
312
- - ...props: `React.HTMLAttributes<HTMLInputElement>`
313
- Any additional props that can be passed to an HTML input element. These props allow you to customize the input field, such as adding a placeholder, className, type, etc.
317
+ - ...props: `React.HTMLAttributes<HTMLInputElement>`
318
+ - Description:
319
+ Any additional props that can be passed to an HTML input element. These props allow you to customize the input field, such as adding a placeholder, className, type, etc.
314
320
 
315
321
  ### `useFormSchema`
316
322
 
@@ -344,7 +350,7 @@ This schema can then be passed to the Form component returned by `createFormVali
344
350
 
345
351
  ## Changes
346
352
 
347
- The `createFormValidator` has been changed to accept an arugument which is type of zod schema generated through useFormSchema or Zod and the rest of the logic will be the same as before.
353
+ The `createFormValidator` has been changed to accept an argument which is a type of zod schema generated through useFormSchema or directly from Zod and the rest of the logic will be the same as before.
348
354
 
349
355
  In order to give proper type support for JavaScript project and to simplify the defining process this change has been made.
350
356
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "An easy form validation package for react, built by using React hook form and zod library",
4
4
  "main": "dist/formaze.js",
5
5
  "types": "dist/index.d.ts",
6
- "version": "1.0.7",
6
+ "version": "1.0.8",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "react",