finform-react-builder 1.5.15 → 1.6.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
@@ -25,7 +25,7 @@ If you have a `.npmrc` file with GitHub Packages configuration, remove the line:
25
25
  ## ✨ Features
26
26
 
27
27
  - 🎨 **Material-UI Integration** - Beautiful, responsive form components
28
- - 🔧 **Dynamic Field Rendering** - Support for text, email, password, number, select, checkbox, date, and textarea fields
28
+ - 🔧 **Dynamic Field Rendering** - text, email, password (with eye toggle), number, select, checkbox, radio, switch, autocomplete (single/multiple with checkboxes and +N more), date, textarea, image
29
29
  - ✅ **Advanced Validation** - Built-in validation with custom regex patterns and validation functions
30
30
  - 📱 **Responsive Grid System** - Flexible column-based layout system
31
31
  - 🎯 **TypeScript Support** - Full type safety and IntelliSense support
@@ -33,7 +33,9 @@ If you have a `.npmrc` file with GitHub Packages configuration, remove the line:
33
33
  - 🔄 **Real-time Validation** - Instant feedback with react-hook-form
34
34
  - 🎨 **Customizable** - Highly configurable with custom validation rules
35
35
  - 🔄 **Multi-Step Forms** - Support for step-by-step form completion with smart navigation
36
+ - 🧩 **Custom Components** - Inject any React node via `type: 'component'`
36
37
  - 💾 **Stateless Design** - Works with data from backend/config without local storage dependencies
38
+ - 📎 **Document Upload** - Drag & drop uploader with validation and preview
37
39
 
38
40
  ## 📦 Installation
39
41
 
@@ -101,6 +103,12 @@ export default App;
101
103
 
102
104
  ## 📋 Field Types
103
105
 
106
+ ### Password (with visibility toggle)
107
+ ```tsx
108
+ { name: 'password', label: 'Password', type: 'password', placeholder: 'Enter password', required: true, helperText: 'Use at least 8 characters.' }
109
+ ```
110
+ Behavior: An eye icon toggles visibility between •••• and plain text.
111
+
104
112
  ### Text Fields
105
113
  ```tsx
106
114
  {
@@ -208,6 +216,9 @@ export default App;
208
216
  ```
209
217
 
210
218
  ### Checkbox Fields
219
+ ```tsx
220
+ { name: 'agree', label: 'Agree to terms', type: 'checkbox', required: true }
221
+ ```
211
222
  ### Autocomplete (Single)
212
223
  ```tsx
213
224
  {
@@ -247,6 +258,13 @@ Behavior:
247
258
  - Only the first 2 selections are rendered as chips; if more, shows a `+N more` chip.
248
259
  - Works with API-driven data using `api_endpoint`, `value_field`, `label_field`.
249
260
 
261
+ ### Copy icon for disabled fields
262
+ For any disabled field, a small copy icon appears to the right, allowing users to copy the field value to clipboard.
263
+
264
+ ```tsx
265
+ { name: 'readonly_id', label: 'User ID', type: 'text', value: 'USR-7842-AB', disabled: true }
266
+ ```
267
+
250
268
  ### Toggle (Segmented Radios)
251
269
  ```tsx
252
270
  {
@@ -285,6 +303,11 @@ Behavior:
285
303
  ```
286
304
 
287
305
  ### Title and Section Headings
306
+ ### Custom Component Field
307
+ Render arbitrary React content inside the form layout.
308
+ ```tsx
309
+ { name: 'custom_block', type: 'component', col: 12, step: 2, content: <div>Any JSX here</div> }
310
+ ```
288
311
  ```tsx
289
312
  { name: 'formTitle', type: 'title', label: 'Create User', variant: 'h4', col: 12 }
290
313
  { name: 'detailsSection', type: 'section', label: 'Details', variant: 'h6', col: 12 }
@@ -339,6 +362,7 @@ Behavior:
339
362
  - Any validation error (including on non-required fields) disables submit.
340
363
  - Single-step forms: built-in Submit button is disabled until valid.
341
364
  - Multi-step forms: Next/Submit are disabled until the current step is valid.
365
+ - Custom buttons passed via `buttons` or `buttonGroup` are also auto-disabled when they are flow actions (Next/Submit/Save/Finish/Complete) and the step/form is invalid.
342
366
 
343
367
  Number validation example (number type):
344
368
  ```tsx
@@ -826,4 +850,55 @@ Feel free to check [issues page](https://github.com/finflow-analytics/finform/is
826
850
 
827
851
  ## 📞 Support
828
852
 
829
- If you like this project, please ⭐ star it on [GitHub](https://github.com/finflow-analytics/finform)!
853
+ If you like this project, please ⭐ star it on [GitHub](https://github.com/finflow-analytics/finform)!
854
+
855
+ ## 📦 Document Upload Component
856
+
857
+ Drag & drop upload with validation, preview, and optional submit button.
858
+
859
+ ```tsx
860
+ import { DocumentUpload } from 'finform-react-builder';
861
+
862
+ <DocumentUpload
863
+ title="Drag & Drop Files"
864
+ subtitle="Upload images or PDFs"
865
+ buttonText="Select Files"
866
+ fileSupportedText=".jpg, .jpeg, .png, .pdf up to 10MB"
867
+ config={{
868
+ id: 'kyc-docs',
869
+ fileTypes: ['image/*', 'application/pdf'],
870
+ maxSize: 10 * 1024 * 1024,
871
+ multiple: true,
872
+ required: true,
873
+ submitButton: { text: 'Upload', position: 'right' },
874
+ }}
875
+ value={files}
876
+ onChange={setFiles}
877
+ onSubmit={(files) => console.log('Submitting', files)}
878
+ />
879
+ ```
880
+
881
+ ## 🧭 Custom Stepper
882
+
883
+ Card-style stepper with titles, connectors, and progress bar.
884
+
885
+ ```tsx
886
+ <FinForm
887
+ fields={fields}
888
+ stepNavigationProps={{
889
+ stepTitles: ['Basic Information', 'Permissions Matrix', 'Review'],
890
+ }}
891
+ onSubmit={...}
892
+ />
893
+ ```
894
+
895
+ ## 📝 Helper Text
896
+
897
+ Provide guidance beneath inputs via `helperText` on any field.
898
+ ```tsx
899
+ { name: 'first_name', label: 'First Name', type: 'text', helperText: 'Only alphabets, min 2 characters.' }
900
+ ```
901
+
902
+ ## 📏 Input Size
903
+
904
+ All inputs default to MUI size "small" for compact UI.
@@ -128,6 +128,43 @@ export interface ImageField extends BaseField {
128
128
  className?: string;
129
129
  onClick?: () => void;
130
130
  defaultValue?: string;
131
+ accept?: string | string[];
132
+ onFileSelected?: (file: File) => void;
133
+ onRemove?: () => void;
134
+ onPreview?: (url: string) => void;
135
+ onSave?: (payload: {
136
+ url: string;
137
+ file?: File;
138
+ }) => void;
139
+ imagePlaceholder?: {
140
+ icon?: 'upload' | 'image';
141
+ title?: string;
142
+ subtitle?: string;
143
+ buttonText?: string;
144
+ helperText?: string;
145
+ sx?: any;
146
+ iconSx?: any;
147
+ titleSx?: any;
148
+ subtitleSx?: any;
149
+ buttonSx?: any;
150
+ helperTextSx?: any;
151
+ };
152
+ imageUploaded?: {
153
+ previewText?: string;
154
+ removeText?: string;
155
+ saveText?: string;
156
+ showSave?: boolean;
157
+ previewTitle?: string;
158
+ replaceText?: string;
159
+ closeText?: string;
160
+ cardSx?: any;
161
+ thumbnailSx?: any;
162
+ fileNameSx?: any;
163
+ fileMetaSx?: any;
164
+ previewButtonSx?: any;
165
+ removeButtonSx?: any;
166
+ saveButtonSx?: any;
167
+ };
131
168
  }
132
169
  export interface ComponentField extends BaseField {
133
170
  type: 'component';