react-smart-fields 1.1.0 β†’ 1.1.1

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 +106 -7
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # 🧩 DynamicFields React Component
1
+ # 🧹 DynamicFields React Component
2
2
 
3
3
  A flexible, fully-styled dynamic form generator built with **React** and **Tailwind CSS**, supporting custom input types, validation, and class overrides. Ideal for building forms quickly with full control over design and behavior.
4
4
 
@@ -6,12 +6,12 @@ A flexible, fully-styled dynamic form generator built with **React** and **Tailw
6
6
 
7
7
  ## ✨ Features
8
8
 
9
- - πŸ“¦ Supports `text`, `number`, `checkbox`, `radio`, and `select` fields
10
- - πŸ’… Fully customizable via Tailwind-compatible className props
11
- - 🧠 Built-in required field validation
12
- - 🧱 Extensible for advanced usage
13
- - πŸŒ“ Full **dark mode** support
14
- - πŸ”„ Real-time `onChange` callback with live `formData` and `errors`
9
+ * πŸ“¦ Supports `text`, `number`, `checkbox`, `radio`, and `select` fields
10
+ * πŸ’… Fully customizable via Tailwind-compatible className props
11
+ * 🧠 Built-in required field validation
12
+ * 🧱 Extensible for advanced usage
13
+ * πŸŒƒ Full **dark mode** support
14
+ * πŸ”„ Real-time `onChange` callback with live `formData` and `errors`
15
15
 
16
16
  ---
17
17
 
@@ -84,3 +84,102 @@ function App() {
84
84
  />
85
85
  );
86
86
  }
87
+ ```
88
+
89
+ ---
90
+
91
+ ## βš™οΈ Props
92
+
93
+ | Prop | Type | Required | Description |
94
+ | -------------------- | ------------------------------------- | -------- | --------------------------------- |
95
+ | `fields` | `FieldConfig[]` | βœ… Yes | List of field definitions |
96
+ | `onChange` | `(data: Record<string, any>) => void` | βœ… Yes | Callback on value change |
97
+ | `title` | `string` | ❌ No | Optional form title |
98
+ | `description` | `string` | ❌ No | Optional description |
99
+ | `className` | `string` | ❌ No | Wrapper div styling |
100
+ | `mainFieldClassName` | `string` | ❌ No | Class for the fields wrapper |
101
+ | `inputClassName` | `string` | ❌ No | Applies to `text`/`number` inputs |
102
+ | `labelClassName` | `string` | ❌ No | Applies to all labels |
103
+ | `fieldClassName` | `string` | ❌ No | Applied to each field wrapper div |
104
+ | `errorClassName` | `string` | ❌ No | Error message styling |
105
+ | `selectClassName` | `string` | ❌ No | `select` field styling |
106
+ | `checkboxClassName` | `string` | ❌ No | Checkbox input styling |
107
+ | `radioClassName` | `string` | ❌ No | Radio input styling |
108
+ | `optionClassName` | `string` | ❌ No | Dropdown option styling |
109
+
110
+ ---
111
+
112
+ ## πŸ”§ `FieldConfig` (field definition)
113
+
114
+ Each field object can contain:
115
+
116
+ | Property | Type | Required | Notes |
117
+ | ------------- | --------------------------------------------------------- | --------------------------------- | -------------------------------------- |
118
+ | `name` | `string` | βœ… Yes | Unique key |
119
+ | `label` | `string` | ❌ No | Display label |
120
+ | `type` | `"text"`, `"number"`, `"select"`, `"radio"`, `"checkbox"` | βœ… Yes | Field type |
121
+ | `required` | `boolean` | ❌ No | Show red asterisk and basic validation |
122
+ | `placeholder` | `string` | ❌ No | Placeholder (for inputs/selects) |
123
+ | `description` | `string` | ❌ No | Optional helper text |
124
+ | `options` | `{ label: string; value: any; }[]` | Required for `select` and `radio` | Dropdown/Radio values |
125
+
126
+ ---
127
+
128
+ ## 🎨 Class Mapping
129
+
130
+ Here's how classes are applied to each section:
131
+
132
+ | Section | Class Prop | Default Tailwind Example |
133
+ | ------------------- | ------------------- | ---------------------------------- |
134
+ | Wrapper div | `className` | `bg-white dark:bg-gray-900` |
135
+ | Label text | `labelClassName` | `text-gray-800 dark:text-gray-200` |
136
+ | Input fields | `inputClassName` | `bg-white dark:bg-gray-800` |
137
+ | Select dropdown | `selectClassName` | `rounded-lg` |
138
+ | Radio buttons | `radioClassName` | `rounded-full` |
139
+ | Checkbox | `checkboxClassName` | `rounded` |
140
+ | Field container div | `fieldClassName` | `w-full` |
141
+ | Dropdown options | `optionClassName` | `hover:bg-gray-100` |
142
+ | Error messages | `errorClassName` | `text-red-500` |
143
+
144
+ You can override all styles with your own Tailwind classes!
145
+
146
+ ---
147
+
148
+ ## πŸ§ͺ Advanced Usage: Custom Styling Per Field
149
+
150
+ You can add `inputClassName`, `labelClassName`, or `className` inside each field:
151
+
152
+ ```ts
153
+ {
154
+ name: "email",
155
+ label: "Email",
156
+ type: "text",
157
+ inputClassName: "border-purple-500",
158
+ labelClassName: "text-purple-700 font-semibold",
159
+ className: "mb-6",
160
+ }
161
+ ```
162
+
163
+ ---
164
+
165
+ ## πŸ§‘β€πŸ’» Author
166
+
167
+ **Name:** Shubham Nakum
168
+ **GitHub:** [@ShubhamNakum](https://github.com/ShubhamNakum)
169
+ **Website:** [https://shubhamnakum.in](https://shubhamnakum.in) *(Optional link)*
170
+
171
+ ---
172
+
173
+ ## πŸ“„ License
174
+
175
+ MIT β€” Free to use, modify and distribute.
176
+
177
+ ---
178
+
179
+ ## πŸ›  Contributing
180
+
181
+ Pull requests are welcome! If you find bugs, feel free to [open an issue](https://github.com/ShubhamNakum/DynamicFields/issues).
182
+
183
+ ---
184
+
185
+ > This component is built to be your plug-and-play form builder. Customize it. Theme it. Extend it. It’s yours.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-smart-fields",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "> A flexible, customizable, and developer-friendly component to generate dynamic form fields in React. Supports all HTML inputs, validation, and styling out of the box.",
5
5
  "license": "MIT",
6
6
  "author": "Pratik Panchal",