react-form-dto 0.0.9 β†’ 1.0.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 +117 -31
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,31 +1,43 @@
1
1
  # React Form DTO
2
2
 
3
- **Schema-first, DTO-driven form builder for React and Material UI (MUI v7)**
3
+ ![npm](https://img.shields.io/npm/v/react-form-dto)
4
+ ![license](https://img.shields.io/npm/l/react-form-dto)
5
+ ![typescript](https://img.shields.io/badge/TypeScript-Strict-blue)
6
+ ![mui](https://img.shields.io/badge/MUI-v7-blue)
4
7
 
5
- React Form DTO helps you build complex, responsive, and accessible forms using declarative JSON/TypeScript DTOs instead of verbose JSX. It is designed for enterprise-grade applications, internal tools, admin panels, and workflows where forms are dynamic, configurable, and data-driven.
8
+ **Schema-first, DTO-driven form framework for React and Material UI (MUI v7)**
9
+
10
+ React Form DTO is a **high-level form framework** for building complex, dynamic, and enterprise-scale forms using declarative JSON or TypeScript DTOsβ€”rather than verbose, repetitive JSX.
11
+
12
+ It is designed for **schema-driven UIs**, backend-configured workflows, admin panels, and internal tools where forms must be **configurable, scalable, and predictable**.
6
13
 
7
14
  ---
8
15
 
9
16
  ## Why React Form DTO?
10
17
 
11
- Most form libraries focus on low-level state management. React Form DTO operates at a **higher abstraction level**.
18
+ Most form libraries solve **state management**.
19
+ React Form DTO solves **form architecture**.
20
+
21
+ It operates at a higher abstraction level where **layout, validation, rendering, and behavior** are defined in a single schema.
12
22
 
13
- **Use this library when:**
23
+ ### Use this library when:
14
24
 
15
- - Your forms are generated from backend schemas or configurations
16
- - You want to avoid duplicating UI logic across applications
17
- - You need imperative control over form state (wizards, modals, async flows)
18
- - Your project is built on Material UI
25
+ - Forms are generated from backend schemas or configuration APIs
26
+ - UI logic must be reused across multiple applications
27
+ - Forms are large, dynamic, or conditional
28
+ - You need imperative control (wizards, modals, async flows)
29
+ - Your design system is based on Material UI
19
30
 
20
- **Key advantages:**
31
+ ### Key Advantages
21
32
 
22
33
  - πŸ“„ **DTO-first design** – define forms entirely in JSON or TypeScript
23
- - 🎨 **Material UI v7 native** – consistent design & accessibility
24
- - 🧱 **Composable architecture** – Form β†’ Section β†’ Field
25
- - 🎯 **Imperative API** – programmatic access via refs
26
- - πŸ”€ **Conditional rendering** – show/hide fields dynamically
27
- - 🧩 **Custom renderers** – plug in your own components
28
- - πŸ›‘οΈ **Strong TypeScript typing** – predictable, safe APIs
34
+ - 🎨 **Material UI v7 native** – accessibility and consistency by default
35
+ - 🧱 **Composable structure** – Form β†’ Section β†’ Field
36
+ - 🎯 **Imperative API** – programmatic control via refs
37
+ - πŸ”€ **Conditional rendering** – dynamic visibility and logic
38
+ - 🧩 **Extensible renderers** – plug in custom components
39
+ - πŸ›‘οΈ **Strong TypeScript typing** – safe, predictable APIs
40
+ - πŸš€ **Enterprise-ready** – optimized for large, config-driven forms
29
41
 
30
42
  ---
31
43
 
@@ -33,22 +45,43 @@ Most form libraries focus on low-level state management. React Form DTO operates
33
45
 
34
46
  | Feature | React Form DTO | React Hook Form | Formik |
35
47
  |------|---------------|----------------|--------|
36
- | Schema/DTO driven | βœ… Native | ❌ Manual | ❌ Manual |
48
+ | Schema / DTO driven | βœ… Native | ❌ Manual | ❌ Manual |
37
49
  | MUI-first | βœ… Yes | ⚠️ Partial | ⚠️ Partial |
38
50
  | Imperative API | βœ… First-class | ⚠️ Limited | ⚠️ Limited |
39
51
  | Large dynamic forms | βœ… Excellent | ⚠️ Medium | ❌ Poor |
40
52
  | Boilerplate | βœ… Minimal | ❌ High | ❌ High |
41
53
 
42
- > React Form DTO is **not a replacement** for React Hook Form. It is a higher-level abstraction for schema-driven UI generation.
54
+ > **Note:** React Form DTO is **not a replacement** for React Hook Form.
55
+ > It is a **higher-level abstraction** for schema-driven UI generation.
56
+
57
+ ---
58
+
59
+ ## What This Library Is Not
60
+
61
+ - ❌ A low-level form state library
62
+ - ❌ A visual form builder
63
+ - ❌ A replacement for small hand-crafted forms
64
+ - ❌ A design system
65
+
66
+ React Form DTO excels when **forms are data, not components**.
67
+
68
+ ---
69
+
70
+ ## Documentation & Demo
71
+
72
+ - πŸ“˜ **Documentation:** See full DTO reference, APIs, and advanced examples [Documentation](https://shakir-afridi.github.io/react-form-dto/docs)
73
+ - πŸ“— **Storybook:** Interactive component playground and live demos [Live Demo](https://shakir-afridi.github.io/react-form-dto/storybook)
43
74
 
44
75
  ---
45
76
 
46
77
  ## Installation
47
78
 
48
79
  ```bash
49
- git clone https://github.com/Shakir-Afridi/react-form-dto.git
50
- cd react-form-dto
51
- npm install
80
+ npm install react-form-dto
81
+ # or
82
+ yarn add react-form-dto
83
+ # or
84
+ pnpm add react-form-dto
52
85
  ```
53
86
 
54
87
  ### Requirements
@@ -59,7 +92,25 @@ npm install
59
92
 
60
93
  ---
61
94
 
62
- ## Minimal Example
95
+ ## Core Concepts
96
+
97
+ ### DTO as Source of Truth
98
+
99
+ All structure, layout, validation, and behavior live in a single schema.
100
+
101
+ ### Stateless Rendering
102
+
103
+ The UI is derived entirely from the DTO and internal state.
104
+
105
+ ### Imperative Escape Hatch
106
+
107
+ Refs enable workflows that declarative-only approaches struggle with.
108
+
109
+ ### Renderer Isolation
110
+
111
+ Field logic is decoupled from presentation, enabling customization.
112
+
113
+ ## Quick Start
63
114
 
64
115
  ```tsx
65
116
  import { FormBuilder, type FormBuilderHandle } from 'react-form-dto';
@@ -201,12 +252,14 @@ const profileForm: FormDTO = {
201
252
  - `date`
202
253
  - `email`
203
254
  - `password`
255
+ - `textarea`
204
256
 
205
257
  ### Selection Inputs
206
258
 
207
259
  - `select`
208
260
  - `autocomplete`
209
261
  - `multi-autocomplete`
262
+ - `radio`
210
263
 
211
264
  ### Boolean Inputs
212
265
 
@@ -395,14 +448,23 @@ validations: {
395
448
 
396
449
  ---
397
450
 
398
- ## Documentation & Demo
451
+ ## Real-World Enterprise Usage
399
452
 
400
- - πŸ“˜ **Documentation:** See full DTO reference, APIs, and advanced examples [Documentation](https://shakir-afridi.github.io/react-form-dto/docs)
401
- - πŸ“— **Storybook:** Interactive component playground and live demos [Live Demo](https://shakir-afridi.github.io/react-form-dto/storybook)
453
+ ```text
454
+ Backend β†’ returns FormDTO
455
+ Frontend β†’ renders form dynamically
456
+ Backend updates β†’ UI changes without redeploy
457
+ ```
458
+
459
+ This enables:
460
+
461
+ - Backend-driven workflows
462
+ - Feature flags via schemas
463
+ - Faster iteration without frontend releases
402
464
 
403
465
  ---
404
466
 
405
- ## Ideal Use Cases
467
+ ## Other Use Cases
406
468
 
407
469
  - Admin dashboards
408
470
  - Internal enterprise tools
@@ -412,6 +474,23 @@ validations: {
412
474
 
413
475
  ---
414
476
 
477
+ ## Performance Characteristics
478
+
479
+ - Independent field rendering
480
+ - Section-level isolation
481
+ - Optimized for 100+ field forms
482
+ - No unnecessary re-renders across sections
483
+
484
+ ---
485
+
486
+ ## Incremental Adoption Strategy
487
+
488
+ - Use React Form DTO for large dynamic forms
489
+ - Keep React Hook Form for small custom forms
490
+ - Share validation logic between both
491
+
492
+ ---
493
+
415
494
  ## Roadmap (Suggested)
416
495
 
417
496
  - Field registry API (`registerFieldType`)
@@ -423,11 +502,18 @@ validations: {
423
502
 
424
503
  ## 🀝 Contributing
425
504
 
426
- - Fork the repo
427
- - Create a feature branch (`git checkout -b feature/my-feature`)
428
- - Commit changes (`git commit -m "Add my feature"`)
429
- - Push to branch (`git push origin feature/my-feature`)
430
- - Open a Pull Request
505
+ Contributions are welcome and encouraged.
506
+
507
+ 1. Fork the repository
508
+ 2. Create a feature branch
509
+ `git checkout -b feature/my-feature`
510
+ 3. Commit your changes
511
+ `git commit -m "Add my feature"`
512
+ 4. Push to the branch
513
+ `git push origin feature/my-feature`
514
+ 5. Open a Pull Request
515
+
516
+ Please keep changes focused and well-documented.
431
517
 
432
518
  ---
433
519
 
@@ -437,4 +523,4 @@ MIT
437
523
 
438
524
  ---
439
525
 
440
- **React Form DTO β€” Schema-first forms for Material UI**
526
+ **React Form DTO β€” Schema-first forms for Material UI**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-form-dto",
3
3
  "description": "A React library for building forms using DTOs with MUI and TypeScript.",
4
- "version": "0.0.9",
4
+ "version": "1.0.1",
5
5
  "main": "dist/react-form-dto.umd.js",
6
6
  "module": "dist/react-form-dto.es.js",
7
7
  "types": "dist/index.d.ts",