react-smart-fields 1.1.0 โ†’ 1.1.2

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 +105 -7
  2. package/package.json +5 -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,101 @@ 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:** Pratik Panchal
168
+ **GitHub:** [@Pratikpanchal25](https://github.com/Pratikpanchal25)
169
+
170
+ ---
171
+
172
+ ## ๐Ÿ“„ License
173
+
174
+ MIT โ€” Free to use, modify and distribute.
175
+
176
+ ---
177
+
178
+ ## ๐Ÿ›  Contributing
179
+
180
+ Pull requests are welcome! If you find bugs, feel free to [open an issue](https://github.com/ShubhamNakum/DynamicFields/issues).
181
+
182
+ ---
183
+
184
+ ## Keywords: DynamicFields, className merge, field styling, custom CSS, override default styles
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.2",
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",
@@ -10,6 +10,10 @@
10
10
  "scripts": {
11
11
  "build": "tsc"
12
12
  },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/Pratikpanchal25/react-smart-fields"
16
+ },
13
17
  "dependencies": {
14
18
  "csstype": "^3.1.3",
15
19
  "js-tokens": "^4.0.0",