@anri1214/dynamic-forms-mui 0.1.7 → 0.1.8
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 +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @anri1214/dynamic-forms-mui
|
|
2
2
|
|
|
3
3
|
Type-safe declarative form builder for React with Material-UI.
|
|
4
4
|
|
|
@@ -20,7 +20,7 @@ Define your forms with a JSON schema — get fully validated, accessible MUI for
|
|
|
20
20
|
## Installation
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npm install @
|
|
23
|
+
npm install @anri1214/dynamic-forms-mui
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### Peer Dependencies
|
|
@@ -34,8 +34,8 @@ npm install react react-dom @mui/material @mui/icons-material @emotion/react @em
|
|
|
34
34
|
### 1. Wrap your app with `DynamicFormsProvider`
|
|
35
35
|
|
|
36
36
|
```tsx
|
|
37
|
-
import { DynamicFormsProvider } from '@
|
|
38
|
-
import type { ApiClient } from '@
|
|
37
|
+
import { DynamicFormsProvider } from '@anri1214/dynamic-forms-mui'
|
|
38
|
+
import type { ApiClient } from '@anri1214/dynamic-forms-mui'
|
|
39
39
|
|
|
40
40
|
// Adapt your HTTP client to the ApiClient interface
|
|
41
41
|
const apiClient: ApiClient = {
|
|
@@ -57,7 +57,7 @@ function App() {
|
|
|
57
57
|
### 2. Define a form schema
|
|
58
58
|
|
|
59
59
|
```tsx
|
|
60
|
-
import type { FormSchema } from '@
|
|
60
|
+
import type { FormSchema } from '@anri1214/dynamic-forms-mui'
|
|
61
61
|
|
|
62
62
|
const schema: FormSchema = {
|
|
63
63
|
sections: [
|
|
@@ -86,8 +86,8 @@ const schema: FormSchema = {
|
|
|
86
86
|
### 3. Render the form
|
|
87
87
|
|
|
88
88
|
```tsx
|
|
89
|
-
import { DynamicForm } from '@
|
|
90
|
-
import type { LabelMap } from '@
|
|
89
|
+
import { DynamicForm } from '@anri1214/dynamic-forms-mui'
|
|
90
|
+
import type { LabelMap } from '@anri1214/dynamic-forms-mui'
|
|
91
91
|
|
|
92
92
|
function ContactPage() {
|
|
93
93
|
const handleSubmit = (data: Record<string, unknown>, labelMap: LabelMap) => {
|
|
@@ -237,8 +237,8 @@ companies: {
|
|
|
237
237
|
Replace any default MUI component with your own:
|
|
238
238
|
|
|
239
239
|
```tsx
|
|
240
|
-
import { DynamicFormsProvider } from '@
|
|
241
|
-
import type { DFTextFieldProps } from '@
|
|
240
|
+
import { DynamicFormsProvider } from '@anri1214/dynamic-forms-mui'
|
|
241
|
+
import type { DFTextFieldProps } from '@anri1214/dynamic-forms-mui'
|
|
242
242
|
|
|
243
243
|
function MyTextField(props: DFTextFieldProps) {
|
|
244
244
|
return <input className="my-input" {...props} />
|
|
@@ -323,7 +323,7 @@ Override the global `apiClient` for a specific form:
|
|
|
323
323
|
Register custom field components for new field types:
|
|
324
324
|
|
|
325
325
|
```tsx
|
|
326
|
-
import { registerFieldComponent } from '@
|
|
326
|
+
import { registerFieldComponent } from '@anri1214/dynamic-forms-mui'
|
|
327
327
|
|
|
328
328
|
registerFieldComponent('rating', MyRatingField)
|
|
329
329
|
```
|
|
@@ -382,10 +382,10 @@ The label map includes all currently loaded options for fields with `options`, `
|
|
|
382
382
|
|
|
383
383
|
## AI Assistant Integration (MCP)
|
|
384
384
|
|
|
385
|
-
This library has a companion MCP server — **@
|
|
385
|
+
This library has a companion MCP server — **@anri1214/dynamic-forms-mui-mcp** — that lets AI assistants (Cursor, Claude Code, VS Code Copilot) understand the `FormSchema` structure and help generate correct form configurations.
|
|
386
386
|
|
|
387
387
|
```bash
|
|
388
|
-
npx @
|
|
388
|
+
npx @anri1214/dynamic-forms-mui-mcp
|
|
389
389
|
```
|
|
390
390
|
|
|
391
391
|
The MCP server provides:
|
|
@@ -395,7 +395,7 @@ The MCP server provides:
|
|
|
395
395
|
- **Backend endpoint generation** — produce API endpoints in any language/framework
|
|
396
396
|
- **Version-aware** — serves documentation matching your installed library version
|
|
397
397
|
|
|
398
|
-
See [@
|
|
398
|
+
See [@anri1214/dynamic-forms-mui-mcp README](../dynamic-forms-mui-mcp/README.md) for setup instructions.
|
|
399
399
|
|
|
400
400
|
## License
|
|
401
401
|
|