umwd-components 0.1.710 → 0.1.712
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/dist/node_modules/base64-js/index.js +1 -1
- package/dist/node_modules/ieee754/index.js +1 -1
- package/dist/src/data/loaders/e-commerce/getAllCustomers.js +1 -1
- package/dist/src/data/loaders/e-commerce/getAllInvoices.js +1 -1
- package/dist/src/data/loaders/e-commerce/getTableProducts.js +1 -1
- package/dist/src/data/loaders/e-commerce/iros/getAllIros.js +1 -1
- package/dist/src/data/loaders/logistics/getTableIpos.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/data/loaders/e-commerce/getAllCustomers.d.ts +4 -1
- package/dist/types/data/loaders/e-commerce/getAllInvoices.d.ts +9 -1
- package/dist/types/data/loaders/e-commerce/getAllOpos.d.ts +5 -1
- package/dist/types/data/loaders/e-commerce/getTableProducts.d.ts +9 -1
- package/dist/types/data/loaders/e-commerce/iros/getAllIros.d.ts +8 -1
- package/dist/types/data/loaders/logistics/getTableIpos.d.ts +9 -1
- package/dist/types/lib/utils.d.ts +10 -0
- package/package.json +1 -1
- package/src/app/page.tsx +2 -0
- package/src/data/loaders/e-commerce/getAllCustomers.ts +16 -8
- package/src/data/loaders/e-commerce/getAllInvoices.ts +20 -3
- package/src/data/loaders/e-commerce/getAllOpos.ts +6 -1
- package/src/data/loaders/e-commerce/getTableProducts.ts +14 -7
- package/src/data/loaders/e-commerce/iros/getAllIros.ts +10 -1
- package/src/data/loaders/logistics/getTableIpos.ts +13 -6
- package/src/lib/utils.ts +10 -0
- package/.ai/action-patterns.md +0 -170
- package/.ai/form-patterns.instruction.md +0 -0
- package/.ai/form-patterns.md +0 -198
- package/.ai/form-patterns.prompt.md +0 -0
- package/.ai/instructions/form-patterns.instructions.md +0 -150
- package/.ai/prompts/form-patterns.prompt.md +0 -171
- package/.ai/prompts/update-form-and-actions.prompt.md +0 -20
- package/.vscode/settings.json +0 -7
package/.ai/form-patterns.md
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
# Form Patterns
|
|
2
|
-
|
|
3
|
-
## Snackbar Usage in Forms
|
|
4
|
-
|
|
5
|
-
### Setup
|
|
6
|
-
|
|
7
|
-
1. Import the Snackbar context:
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
import { useSnackbar } from "../../../context/common/SnackbarContext";
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
2. Initialize form state with severity:
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
const INITIAL_STATE = {
|
|
17
|
-
zodErrors: null,
|
|
18
|
-
strapiErrors: null,
|
|
19
|
-
data: null,
|
|
20
|
-
message: null,
|
|
21
|
-
severity: null,
|
|
22
|
-
};
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
3. Get the handleAddMessage function from useSnackbar:
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
const { handleAddMessage } = useSnackbar();
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Implementation Pattern
|
|
32
|
-
|
|
33
|
-
1. Message Handling:
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (formState?.message) {
|
|
38
|
-
handleAddMessage({
|
|
39
|
-
message: formState.message,
|
|
40
|
-
severity: formState.severity || "error",
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
if (formState.severity === "success") {
|
|
44
|
-
revalidateCallback && revalidateCallback();
|
|
45
|
-
handleClose && handleClose();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, [formState?.message]);
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
2. Error Handling:
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (formState?.strapiErrors) {
|
|
56
|
-
handleAddMessage({
|
|
57
|
-
message: formState.strapiErrors.message || "Error performing action",
|
|
58
|
-
severity: formState.severity || "error",
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}, [formState?.strapiErrors]);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Props Interface
|
|
65
|
-
|
|
66
|
-
Forms using this pattern should extend their props interface with:
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
& {
|
|
70
|
-
sx?: SxProps;
|
|
71
|
-
revalidateCallback?: () => void;
|
|
72
|
-
handleClose?: () => void;
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Box Component Styling
|
|
77
|
-
|
|
78
|
-
When using this pattern, wrap your form in a Box component with consistent
|
|
79
|
-
styling:
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
<Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Key Features
|
|
86
|
-
|
|
87
|
-
1. **Severity Fallback**: Always provides a fallback to "error" if severity is
|
|
88
|
-
not specified
|
|
89
|
-
2. **Success Handling**: On success (severity === "success"):
|
|
90
|
-
- Triggers revalidation if revalidateCallback is provided
|
|
91
|
-
- Closes form if handleClose is provided
|
|
92
|
-
3. **Error Messages**: Provides fallback error messages for strapiErrors
|
|
93
|
-
4. **Consistent Styling**: Uses consistent Box wrapper with padding and sx prop
|
|
94
|
-
spreading
|
|
95
|
-
|
|
96
|
-
### Form Layout Pattern
|
|
97
|
-
|
|
98
|
-
1. **Title Section**:
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
<Grid item xs={12}>
|
|
102
|
-
<Stack spacing={2}>
|
|
103
|
-
<Typography variant="h3" component={"h1"}>
|
|
104
|
-
Form Title Here
|
|
105
|
-
</Typography>
|
|
106
|
-
</Stack>
|
|
107
|
-
</Grid>
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
2. **Action Buttons**:
|
|
111
|
-
|
|
112
|
-
- Place at bottom of form
|
|
113
|
-
- Cancel button is optional (only shown if handleClose provided)
|
|
114
|
-
- Use consistent button layout with space-between
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
<Grid item xs={12}>
|
|
118
|
-
<Stack direction={"row"} justifyContent={"space-between"}>
|
|
119
|
-
{handleClose && (
|
|
120
|
-
<Button onClick={handleClose} variant="outlined">
|
|
121
|
-
Cancel
|
|
122
|
-
</Button>
|
|
123
|
-
)}
|
|
124
|
-
<SubmitButton text="Submit" loadingText="Loading..." variant="contained" />
|
|
125
|
-
</Stack>
|
|
126
|
-
</Grid>
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
3. **Messages and Alerts**:
|
|
130
|
-
|
|
131
|
-
- Use Snackbar for all notifications instead of inline Alerts
|
|
132
|
-
- Remove StrapiErrors component as errors are shown in Snackbar
|
|
133
|
-
- Success messages automatically close the form and revalidate data
|
|
134
|
-
|
|
135
|
-
### Form Action Setup
|
|
136
|
-
|
|
137
|
-
1. Action Binding Pattern:
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
// For actions that require an ID or other parameters
|
|
141
|
-
const boundAction = actionFunction.bind(null, entityId);
|
|
142
|
-
const [formState, formAction] = useFormState(boundAction, INITIAL_STATE);
|
|
143
|
-
|
|
144
|
-
// Example with type:
|
|
145
|
-
const updateEntityWithIdAction = updateEntityAction.bind(null, entity.id);
|
|
146
|
-
const [formState, formAction] = useFormState(updateEntityWithIdAction, INITIAL_STATE);
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
This pattern ensures:
|
|
150
|
-
|
|
151
|
-
- Clean separation of entity ID from form data
|
|
152
|
-
- Consistent action parameter order
|
|
153
|
-
- Type safety for bound parameters
|
|
154
|
-
- Clear distinction between entity parameters and form data
|
|
155
|
-
|
|
156
|
-
### Example Usage
|
|
157
|
-
|
|
158
|
-
```typescript
|
|
159
|
-
export default function ExampleForm({
|
|
160
|
-
sx,
|
|
161
|
-
revalidateCallback,
|
|
162
|
-
handleClose,
|
|
163
|
-
...props
|
|
164
|
-
}: ExampleFormProps & { sx?: SxProps }) {
|
|
165
|
-
const [formState, formAction] = useFormState(exampleAction, INITIAL_STATE);
|
|
166
|
-
const { handleAddMessage } = useSnackbar();
|
|
167
|
-
|
|
168
|
-
// Message handling effect
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
if (formState?.message) {
|
|
171
|
-
handleAddMessage({
|
|
172
|
-
message: formState.message,
|
|
173
|
-
severity: formState.severity || "error",
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
if (formState.severity === "success") {
|
|
177
|
-
revalidateCallback && revalidateCallback();
|
|
178
|
-
handleClose && handleClose();
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}, [formState?.message]);
|
|
182
|
-
|
|
183
|
-
// Error handling effect
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
if (formState?.strapiErrors) {
|
|
186
|
-
handleAddMessage({
|
|
187
|
-
message: formState.strapiErrors.message || "Error in form submission",
|
|
188
|
-
severity: formState.severity || "error",
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
}, [formState?.strapiErrors]);
|
|
192
|
-
return (
|
|
193
|
-
<Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
|
|
194
|
-
<form action={formAction}>{/* Form content */}</form>
|
|
195
|
-
</Box>
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
```
|
|
File without changes
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
applyTo: "/**/*Form.tsx"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Form Implementation Instructions
|
|
6
|
-
|
|
7
|
-
## Basic Form Setup
|
|
8
|
-
|
|
9
|
-
1. Add required imports:
|
|
10
|
-
|
|
11
|
-
```typescript
|
|
12
|
-
import { useSnackbar } from "../../../context/common/SnackbarContext";
|
|
13
|
-
import { useFormState } from "react-dom";
|
|
14
|
-
import { SxProps } from "@mui/material/styles";
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. Include standard props interface:
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
interface FormProps {
|
|
21
|
-
sx?: SxProps;
|
|
22
|
-
revalidateCallback?: () => void;
|
|
23
|
-
handleClose?: () => void;
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
3. Initialize form state:
|
|
28
|
-
|
|
29
|
-
```typescript
|
|
30
|
-
const INITIAL_STATE = {
|
|
31
|
-
zodErrors: null,
|
|
32
|
-
strapiErrors: null,
|
|
33
|
-
data: null,
|
|
34
|
-
message: null,
|
|
35
|
-
severity: null,
|
|
36
|
-
};
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
4. Setup form action binding:
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
// For forms that operate on an entity
|
|
43
|
-
const boundAction = actionFunction.bind(null, entity.id);
|
|
44
|
-
const [formState, formAction] = useFormState(boundAction, INITIAL_STATE);
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Note: Always bind entity IDs and other fixed parameters to the action, rather than including them in the form data.
|
|
48
|
-
|
|
49
|
-
## Required Form Structure
|
|
50
|
-
|
|
51
|
-
1. **Base Structure**:
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
<Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
|
|
55
|
-
<form action={formAction}>
|
|
56
|
-
<Grid container spacing={2}>
|
|
57
|
-
{/* Form content */}
|
|
58
|
-
</Grid>
|
|
59
|
-
</form>
|
|
60
|
-
</Box>
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
2. **Title Section**:
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
<Grid item xs={12}>
|
|
67
|
-
<Stack spacing={2}>
|
|
68
|
-
<Typography variant="h3" component={"h1"}>
|
|
69
|
-
Form Title Here
|
|
70
|
-
</Typography>
|
|
71
|
-
<Typography variant="body2">Optional description text</Typography>
|
|
72
|
-
</Stack>
|
|
73
|
-
</Grid>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
3. **Action Buttons**:
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
<Grid item xs={12}>
|
|
80
|
-
<Stack direction={"row"} justifyContent={"space-between"}>
|
|
81
|
-
{handleClose && (
|
|
82
|
-
<Button onClick={handleClose} variant="outlined">
|
|
83
|
-
Cancel
|
|
84
|
-
</Button>
|
|
85
|
-
)}
|
|
86
|
-
<SubmitButton text="Submit" loadingText="Loading..." variant="contained" />
|
|
87
|
-
</Stack>
|
|
88
|
-
</Grid>
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Message Handling Implementation
|
|
92
|
-
|
|
93
|
-
1. Add snackbar message handling:
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
const { handleAddMessage } = useSnackbar();
|
|
97
|
-
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
if (formState?.message) {
|
|
100
|
-
handleAddMessage({
|
|
101
|
-
message: formState.message,
|
|
102
|
-
severity: formState.severity || "error",
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
if (formState.severity === "success") {
|
|
106
|
-
revalidateCallback && revalidateCallback();
|
|
107
|
-
handleClose && handleClose();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}, [formState?.message]);
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
2. Add error handling:
|
|
114
|
-
|
|
115
|
-
```typescript
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
if (formState?.strapiErrors) {
|
|
118
|
-
handleAddMessage({
|
|
119
|
-
message: formState.strapiErrors.message || "Error performing action",
|
|
120
|
-
severity: formState.severity || "error",
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}, [formState?.strapiErrors]);
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Best Practices
|
|
127
|
-
|
|
128
|
-
1. **Form Layout**:
|
|
129
|
-
|
|
130
|
-
- Use Grid system with `spacing={2}`
|
|
131
|
-
- Group related fields in Stack components
|
|
132
|
-
- Use consistent spacing throughout the form
|
|
133
|
-
|
|
134
|
-
2. **Error Handling**:
|
|
135
|
-
|
|
136
|
-
- Always provide fallback error messages
|
|
137
|
-
- Use Snackbar for notifications instead of inline alerts
|
|
138
|
-
- Handle both form validation and API errors
|
|
139
|
-
|
|
140
|
-
3. **Success Handling**:
|
|
141
|
-
|
|
142
|
-
- Close form on success if handleClose is provided
|
|
143
|
-
- Trigger revalidation if revalidateCallback is provided
|
|
144
|
-
- Show success message through Snackbar
|
|
145
|
-
|
|
146
|
-
4. **Accessibility**:
|
|
147
|
-
|
|
148
|
-
- Use semantic HTML elements
|
|
149
|
-
- Include proper ARIA labels
|
|
150
|
-
- Maintain heading hierarchy with h1 for form title
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
mode: "agent"
|
|
3
|
-
tools: []
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Form Pattern AI Assistant Guide
|
|
7
|
-
|
|
8
|
-
## Form Creation and Modification
|
|
9
|
-
|
|
10
|
-
When assisting with form creation or modification, ensure the following patterns
|
|
11
|
-
are followed:
|
|
12
|
-
|
|
13
|
-
### Structure Validation
|
|
14
|
-
|
|
15
|
-
1. **Base Component Structure**
|
|
16
|
-
|
|
17
|
-
- Verify form is wrapped in a Box component with proper sx prop handling
|
|
18
|
-
- Check Grid container with spacing={2} is used
|
|
19
|
-
- Ensure form sections follow standard layout pattern
|
|
20
|
-
|
|
21
|
-
2. **Required Sections**
|
|
22
|
-
|
|
23
|
-
- Title section with h3/h1 Typography
|
|
24
|
-
- Properly grouped form fields
|
|
25
|
-
- Action buttons section at bottom
|
|
26
|
-
|
|
27
|
-
### Implementation Checks
|
|
28
|
-
|
|
29
|
-
1. **State Management**
|
|
30
|
-
|
|
31
|
-
- Verify INITIAL_STATE includes all required fields
|
|
32
|
-
- Check useFormState implementation
|
|
33
|
-
- Validate form action setup
|
|
34
|
-
- Ensure entity IDs are bound to action using bind pattern
|
|
35
|
-
|
|
36
|
-
2. **Message Handling**
|
|
37
|
-
|
|
38
|
-
- Confirm Snackbar context is properly imported and used
|
|
39
|
-
- Verify message handling useEffect is implemented
|
|
40
|
-
- Check error handling useEffect is present
|
|
41
|
-
|
|
42
|
-
3. **Props Interface**
|
|
43
|
-
|
|
44
|
-
- Ensure required props (sx, revalidateCallback, handleClose) are included
|
|
45
|
-
- Verify props are properly typed
|
|
46
|
-
- Check optional props are marked as such
|
|
47
|
-
|
|
48
|
-
### Common Fixes
|
|
49
|
-
|
|
50
|
-
When updating forms to match the pattern:
|
|
51
|
-
|
|
52
|
-
1. **Structure Fixes**
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
// Convert from
|
|
56
|
-
<div>
|
|
57
|
-
<form>...</form>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
// To
|
|
61
|
-
<Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
|
|
62
|
-
<form action={formAction}>
|
|
63
|
-
<Grid container spacing={2}>
|
|
64
|
-
...
|
|
65
|
-
</Grid>
|
|
66
|
-
</form>
|
|
67
|
-
</Box>
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
2. **Message Handling Fixes**
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
// Remove inline alerts
|
|
74
|
-
<Alert severity="error">{error}</Alert>;
|
|
75
|
-
|
|
76
|
-
// Use Snackbar context instead
|
|
77
|
-
handleAddMessage({
|
|
78
|
-
message: error,
|
|
79
|
-
severity: "error",
|
|
80
|
-
});
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
3. **Button Layout Fixes**
|
|
84
|
-
|
|
85
|
-
```typescript
|
|
86
|
-
// Convert from
|
|
87
|
-
<div>
|
|
88
|
-
<Button>Cancel</Button>
|
|
89
|
-
<Button>Submit</Button>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
// To
|
|
93
|
-
<Stack direction={"row"} justifyContent={"space-between"}>
|
|
94
|
-
{handleClose && (
|
|
95
|
-
<Button onClick={handleClose} variant="outlined">
|
|
96
|
-
Cancel
|
|
97
|
-
</Button>
|
|
98
|
-
)}
|
|
99
|
-
<SubmitButton text="Submit" loadingText="Loading..." variant="contained" />
|
|
100
|
-
</Stack>
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
4. **Action Binding Fixes**
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
// Convert from
|
|
107
|
-
const [formState, formAction] = useFormState(
|
|
108
|
-
(prevState, formData) => updateAction(id, prevState, formData),
|
|
109
|
-
INITIAL_STATE
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
// To
|
|
113
|
-
const boundAction = updateAction.bind(null, id);
|
|
114
|
-
const [formState, formAction] = useFormState(boundAction, INITIAL_STATE);
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Response Guidelines
|
|
118
|
-
|
|
119
|
-
When helping users with forms:
|
|
120
|
-
|
|
121
|
-
1. **Analysis Phase**
|
|
122
|
-
|
|
123
|
-
- Review current form implementation
|
|
124
|
-
- Identify missing pattern elements
|
|
125
|
-
- List required changes
|
|
126
|
-
|
|
127
|
-
2. **Implementation Phase**
|
|
128
|
-
|
|
129
|
-
- Make changes in logical groups (structure, handlers, props)
|
|
130
|
-
- Maintain existing form functionality
|
|
131
|
-
- Preserve custom business logic
|
|
132
|
-
|
|
133
|
-
3. **Validation Phase**
|
|
134
|
-
|
|
135
|
-
- Verify pattern compliance
|
|
136
|
-
- Check for proper error handling
|
|
137
|
-
- Ensure success scenarios are handled
|
|
138
|
-
|
|
139
|
-
4. **Documentation**
|
|
140
|
-
|
|
141
|
-
- Explain changes made
|
|
142
|
-
- Highlight any pattern deviations (if necessary)
|
|
143
|
-
- Provide reasoning for modifications
|
|
144
|
-
|
|
145
|
-
## Form Best Practices Enforcement
|
|
146
|
-
|
|
147
|
-
When reviewing or modifying forms, enforce these best practices:
|
|
148
|
-
|
|
149
|
-
1. **Consistent Error Handling**
|
|
150
|
-
|
|
151
|
-
- Use Snackbar for all notifications
|
|
152
|
-
- Provide fallback error messages
|
|
153
|
-
- Handle both validation and API errors
|
|
154
|
-
|
|
155
|
-
2. **Proper Success Handling**
|
|
156
|
-
|
|
157
|
-
- Close form on success when appropriate
|
|
158
|
-
- Trigger data revalidation when needed
|
|
159
|
-
- Show success notifications
|
|
160
|
-
|
|
161
|
-
3. **Accessibility**
|
|
162
|
-
|
|
163
|
-
- Maintain proper heading hierarchy
|
|
164
|
-
- Use semantic HTML elements
|
|
165
|
-
- Include necessary ARIA labels
|
|
166
|
-
|
|
167
|
-
4. **Code Organization**
|
|
168
|
-
|
|
169
|
-
- Group related form fields
|
|
170
|
-
- Maintain consistent spacing
|
|
171
|
-
- Use appropriate MUI components
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
mode: "agent"
|
|
3
|
-
tools: []
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Apply form patterns and actions to update forms in the codebase.
|
|
7
|
-
|
|
8
|
-
Take the documentation from [form-patterns.md](../form-patterns.md) and read it
|
|
9
|
-
carefully. make sure the Form component matches the patterns described there.
|
|
10
|
-
|
|
11
|
-
Then within this Form component find the actions it uses and make sure these are
|
|
12
|
-
updated according to the documentation in
|
|
13
|
-
[action-patterns.md](../action-patterns.md)
|
|
14
|
-
|
|
15
|
-
- Respect comments by previous devs (me) and do not remove them unless they are
|
|
16
|
-
no longer relevant.
|
|
17
|
-
|
|
18
|
-
- Do not change the currently used texts, often they are by the client, you
|
|
19
|
-
might however leave suggestions for improvement in comments, these are
|
|
20
|
-
appriciated.
|