shadcn-zod-formkit 1.0.4 → 1.1.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
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- 📦 A React library for creating **dynamic forms** with **Zod validations**, supporting multiple input types: text, number, email, switch, color, date, select, file, and OTP.
7
+ 📦 A React library for creating **dynamic forms** with **Zod validations**, supporting multiple input types: text, number, email, switch, color, date, select, file, OTP and others.
8
8
 
9
9
  ---
10
10
 
@@ -26,7 +26,7 @@ yarn add shadcn-zod-formkit
26
26
  You need installa shadcn basic components
27
27
  ```typescript
28
28
  # Add Shadcn Basics
29
- npx shadcn@latest add accordion alert badge button calendar card checkbox dialog popover form input label select sonner tooltip switch textarea input-otp collapsible input-group radio-group slider
29
+ npx shadcn@latest add accordion alert badge button calendar card checkbox dialog popover form input label select sonner tooltip switch textarea input-otp collapsible input-group radio-group slider button-group
30
30
  ```
31
31
 
32
32
 
@@ -44,6 +44,8 @@ import {
44
44
  TextInputType
45
45
  } from "shadcn-zod-formkit";
46
46
 
47
+ import { Mail, User } from 'lucide-react';
48
+
47
49
  export default function Home() {
48
50
  // Record From DB example (User),
49
51
  // record is used for define default values
@@ -58,6 +60,7 @@ export default function Home() {
58
60
 
59
61
  return (
60
62
  <DynamicForm
63
+ formTitle="Title Form"
61
64
  fields={mockFields}
62
65
  record={record}
63
66
  onSubmit={(data) => console.log("📤 Resultado final:", data)}
@@ -68,14 +71,26 @@ export default function Home() {
68
71
  const mockFields: Array<FieldProps |FieldProps[]> = [
69
72
  {
70
73
  name: "username",
71
- label: "Nombre de usuario",
72
- inputType: InputTypes.TEXT,
73
- ZodTypeAny: z .string().min(3).max(20),
74
+ label: "Username",
75
+ inputType: InputTypes.TEXT_GROUP,
76
+ inputGroupConfig:{
77
+ autoValidIcons: true,
78
+ iconsLeft: [User]
79
+ },
80
+ zodType: z.string().min(3).max(20),
74
81
  },
75
82
  {
76
83
  name: "email",
77
- label: "Correo electrónico",
78
- inputType: InputTypes.TEXT,
84
+ label: "Email",
85
+ inputType: InputTypes.TEXT_GROUP,
86
+ inputGroupConfig:{
87
+ autoValidIcons: true,
88
+ iconsLeft: [Mail],
89
+ },
90
+ zodType: z
91
+ .string()
92
+ .email("Invalid Email")
93
+ .optional(),
79
94
  },
80
95
  ]
81
96
  ```
@@ -96,11 +111,16 @@ const mockFields: Array<FieldProps |FieldProps[]> = [
96
111
  | **Switch List** | `InputTypes.GROUPED_SWITCH_LIST` |
97
112
  | **Radio Group** | `InputTypes.RADIO_GROUP` |
98
113
  | **Tags** | `InputTypes.TAGS` |
114
+ | **Input Date Time** | `InputTypes.DATE_TIME` |
115
+ | **Input Time** | `InputTypes.TIME` |
116
+ | **Upload Multi File** | `InputTypes.FILE_MULTI_UPLOAD` |
117
+ | **Button Group** | `InputTypes.BUTTON_GROUP` |
118
+
99
119
 
100
120
 
101
121
  ## ✅ Features
102
122
  - Fully dynamic fields array support.
103
- - Multiple input types (text, email, number, color, date, select, switch, file, OTP).
123
+ - Multiple input types (text, email, number, color, date, select, switch, file, OTP, and others).
104
124
  - Zod validation integration for robust form validation.
105
125
  - Supports default values via record prop.
106
126
  - Works seamlessly with React 18+ and TypeScript.
@@ -108,4 +128,11 @@ const mockFields: Array<FieldProps |FieldProps[]> = [
108
128
  ## 💡 Tips
109
129
  - Use peerDependencies for React to avoid version conflicts.
110
130
  - Wrap your forms inside a "use client" component if using Next.js App Router.
111
- - Combine multiple FieldProps in arrays for grouped fields (like age + color).
131
+ - Combine multiple FieldProps in arrays for grouped fields (like age + color).
132
+
133
+ ## 🧠 Acknowledgements
134
+ - React - A JavaScript library for building user interfaces.
135
+ - Next.js - The React framework for production.
136
+ - Tailwind CSS - A utility-first CSS framework for creating custom designs.
137
+ - Zod - TypeScript-first schema declaration and validation.
138
+