formaze 1.0.9 → 2.0.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.
Files changed (2) hide show
  1. package/README.md +17 -18
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # Formaze: A stomizable Form Validation package for React
1
+ # Formaze: A Customizable Form Validation package for React
2
2
 
3
- Formaze is a flexible and customizable form validation package for react built with `React Hook Form`, `Zod`, and `TailwindCSS`. It provides an easy way to define form validation schemas and handles complex form validation logic efficiently with proper type-safety.
3
+ Formaze is a flexible and customizable form validation package for React built with `React Hook Form`, `Zod`, and `TailwindCSS`. It provides an easy way to define form validation schemas and handles complex form validation logic efficiently with proper type-safety.
4
4
 
5
5
  - Supports multiple field types such as `string`, `email`, `password`, `number`, `date`, and `boolean`.
6
- - Efficient utilization of zod's built-in validation like `min`, `max`, `regex`, and `optional`.
6
+ - Efficient utilization of Zod's built-in validation like `min`, `max`, `regex`, and `optional`.
7
7
  - Custom error messages.
8
8
 
9
9
  ## Installation
@@ -23,7 +23,7 @@ npm install formaze
23
23
  // "use client"
24
24
  import { z } from "zod";
25
25
  import { makeFormSchema, createFormValidator } from "formaze";
26
- /* pre-styled css (you can check the styling guide below) */
26
+ /* pre-styled CSS (you can check the styling guide below) */
27
27
  import "formaze/dist/style.css";
28
28
 
29
29
  // create the validation schema
@@ -82,7 +82,7 @@ export function MyForm() {
82
82
 
83
83
  ## Define Validation Schema
84
84
 
85
- The makeFormSchema method allows you to define validation rules for each field in the form. You can specify field types (`string`, `email`, `password`, `number`, `date`, `boolean`) along with their specific validation constraints like `minLength`, `maxLength`, `min`, `max`, `regex`, and `optional`.
85
+ The makeFormSchema method allows you to define validation rules for each field in the form. You can specify field types (`string`, `email`, `password`, `number`, `date`, `boolean`) along with specific validation constraints like `minLength`, `maxLength`, `min`, `max`, `regex`, and `optional`.
86
86
 
87
87
  ```js
88
88
  const formSchema = makeFormSchema({
@@ -116,7 +116,7 @@ email: {
116
116
  });
117
117
  ```
118
118
 
119
- Though, you can directly use `zod` to define schema as well and pass it to the Form props created through `createFormValidator` method.
119
+ You can also directly use `Zod` to define schema as well and pass it to the Form props created through `createFormValidator` method.
120
120
 
121
121
  ```tsx
122
122
  import { z } from "zod";
@@ -145,16 +145,15 @@ You can specify the following validation options for each field:
145
145
 
146
146
  - For Tailwind (pre-styled)
147
147
 
148
- Follow the [Official Tailwind Docs](https://tailwindcss.com/docs/installation/framework-guides) for initializing project with vite or next.js
148
+ Follow the [Official Tailwind Docs](https://tailwindcss.com/docs/installation/framework-guides) for initializing project with vite or next.js.
149
149
 
150
- You can add your own styles or import the below css (styled with tailwind css) file into the main or App component or the component where the form is being used
150
+ You can add your own styles or import the CSS below (styled with TailwindCSS) file into the main or App component or the component where the form is being used.
151
151
 
152
152
  ```js
153
153
  import "formaze/dist/style.css";
154
154
  ```
155
155
 
156
- - For Pure CSS
157
- Here are the css classes with default styles, add it into main css file
156
+ - For Pure CSS, here are the CSS classes with default styles, add them to your main CSS file
158
157
 
159
158
  ```css
160
159
  .form-control {
@@ -196,7 +195,7 @@ import "formaze/dist/style.css";
196
195
 
197
196
  ## For Next.js (app router)
198
197
 
199
- You just have to add `"use client"` directive at the top of your file where you are using this form and its related methods
198
+ You just need to add `"use client"` directive at the top of your file where you are using this form and its related methods
200
199
 
201
200
  ```tsx
202
201
  "use client";
@@ -222,7 +221,7 @@ The createFormValidator function accepts an argument which is a type of zod sche
222
221
  - Type: `T` (A Zod schema) (optional)
223
222
 
224
223
  - Description:
225
- This optional schema prop is a schema used to define the structure and validation rules for the form. This schema determines the expected fields, their types, and any validation logic, such as required fields, minimum/maximum values, regex patterns, etc. **NOTE: In future version this prop will be deprecated. As of now this prop is no longer needed.**
224
+ This optional schema prop defines the structure and validation rules for the form. This schema determines the expected fields, their types, and any validation logic, such as required fields, minimum/maximum values, regex etc. **NOTE: In future version this prop will be deprecated. As of now this prop is no longer needed.**
226
225
 
227
226
  - Example:
228
227
 
@@ -291,9 +290,9 @@ const defaultValues = {
291
290
  - Type: `React.ReactNode`
292
291
 
293
292
  - Description:
294
- The children prop accepts form inputs and other JSX elements to be rendered inside the Form component. It specifically expects components like Form.Input, which is designed to integrate with the form's validation logic. The Form.Input component handles binding form fields to the Zod schema, ensuring that validation rules are properly applied.
293
+ The children prop accepts form inputs and other JSX elements to be rendered inside the Form component. It specifically expects components like `Form.Input`, which is designed to integrate with the form's validation logic. The `Form.Input` component handles binding form fields to the Zod schema, ensuring that validation rules are properly applied.
295
294
 
296
- You can include Form.Input for each form field, along with any other elements like buttons or additional form elements. The Form.Input automatically manages validation states based on the schema.
295
+ You can include `Form.Input` for each form field, along with any other elements like buttons or additional form elements. The `Form.Input` automatically manages validation states based on the schema.
297
296
 
298
297
  - Example:
299
298
 
@@ -326,15 +325,15 @@ The Form.Input component is a form input field that is connected to a Zod-based
326
325
 
327
326
  **Props:**
328
327
 
329
- - name: `keyof z.infer<T>`
328
+ name: `keyof z.infer<T>`
330
329
  - Description:
331
330
  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.
332
331
 
333
- - label: `string` (optional)
332
+ label: `string` (optional)
334
333
  - Description:
335
334
  A label for the form field. This is used for displaying a descriptive text for the input field.
336
335
 
337
- - ...props: `React.HTMLAttributes<HTMLInputElement>`
336
+ ...props: `React.InputHTMLAttributes<HTMLInputElement>`
338
337
  - Description:
339
338
  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.
340
339
 
@@ -372,7 +371,7 @@ This schema can then be passed to the Form component returned by `createFormVali
372
371
 
373
372
  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.
374
373
 
375
- In order to give proper type support for JavaScript project and to simplify the defining process this change has been made.
374
+ In order to give proper type support for JavaScript projects and to simplify the defining process this change has been made.
376
375
 
377
376
  **From this**
378
377
  ```tsx
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.9",
6
+ "version": "2.0.0",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "react",