@machinemetrics/mm-react-components 0.2.3-1 → 0.2.3-11
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 +96 -30
- package/agent-docs/agent-documentation-reference.md +247 -0
- package/agent-docs/ai-agent-guide.md +554 -0
- package/agent-docs/ai-agent-init-guide.md +461 -0
- package/agent-docs/chakra-migration-readme.md +265 -0
- package/agent-docs/chakra-migration-troubleshooting.md +649 -0
- package/agent-docs/component-mapping-reference.md +466 -0
- package/agent-docs/init-readme.md +283 -0
- package/agent-docs/init-troubleshooting.md +550 -0
- package/agent-docs/setup-reference.md +365 -0
- package/dist/App.d.ts.map +1 -1
- package/dist/README.md +96 -30
- package/dist/components/ui/alert-dialog.d.ts +15 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +12 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/chart.d.ts +41 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/form.d.ts +25 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/progress.d.ts +1 -0
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/docs/GETTING_STARTED.md +293 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/mm-react-components.css +1 -0
- package/dist/main.d.ts +0 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/mm-react-components.es.js +10964 -927
- package/dist/mm-react-components.es.js.map +1 -1
- package/dist/mm-react-components.umd.js +27 -9
- package/dist/mm-react-components.umd.js.map +1 -1
- package/dist/preview/AlertDialogPreview.d.ts +2 -0
- package/dist/preview/AlertDialogPreview.d.ts.map +1 -0
- package/dist/preview/AlertPreview.d.ts +2 -0
- package/dist/preview/AlertPreview.d.ts.map +1 -0
- package/dist/preview/AvatarPreview.d.ts +2 -0
- package/dist/preview/AvatarPreview.d.ts.map +1 -0
- package/dist/preview/BreadcrumbPreview.d.ts +2 -0
- package/dist/preview/BreadcrumbPreview.d.ts.map +1 -0
- package/dist/preview/CardPreview.d.ts +2 -0
- package/dist/preview/CardPreview.d.ts.map +1 -0
- package/dist/preview/ChartPreview.d.ts +2 -0
- package/dist/preview/ChartPreview.d.ts.map +1 -0
- package/dist/preview/CheckboxPreview.d.ts.map +1 -1
- package/dist/preview/DataTablePreview.d.ts.map +1 -1
- package/dist/preview/FormPreview.d.ts +2 -0
- package/dist/preview/FormPreview.d.ts.map +1 -0
- package/dist/preview/InputPreview.d.ts.map +1 -1
- package/dist/preview/LabelPreview.d.ts.map +1 -1
- package/dist/preview/RadioGroupPreview.d.ts.map +1 -1
- package/dist/preview/SeparatorPreview.d.ts +2 -0
- package/dist/preview/SeparatorPreview.d.ts.map +1 -0
- package/dist/preview/SonnerPreview.d.ts +2 -0
- package/dist/preview/SonnerPreview.d.ts.map +1 -0
- package/dist/preview/TabsPreview.d.ts.map +1 -1
- package/dist/preview/TextareaPreview.d.ts +2 -0
- package/dist/preview/TextareaPreview.d.ts.map +1 -0
- package/dist/preview/data-table/data-table-preview_column-content.d.ts +1 -1
- package/dist/preview/data-table/data-table-preview_column-content.d.ts.map +1 -1
- package/dist/preview/page-header/PageHeaderPreview.d.ts.map +1 -1
- package/dist/scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.config.json +512 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/args.js +63 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/colors.js +14 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/config.js +15 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/deps.js +125 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/file-io.js +44 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/render.js +89 -0
- package/dist/scripts/chakra-to-shadcn-migrator/lib/transform.js +550 -0
- package/dist/scripts/chakra-to-shadcn-migrator/package.json +11 -0
- package/dist/scripts/init.cjs +208 -0
- package/dist/scripts/npx-init.cjs +409 -0
- package/dist/tailwind.base.config.js +88 -0
- package/dist/themes/carbide.css +187 -32
- package/package.json +58 -10
- package/src/index.css +99 -498
- package/dist/index.css +0 -536
- package/dist/tailwind.config.export.js +0 -153
- package/dist/themes/complete.css +0 -8
- package/scripts/README.md +0 -171
- package/scripts/chakra-to-shadcn-migrator/README.md +0 -107
- package/src/themes/carbide.css +0 -1257
- package/src/themes/complete.css +0 -8
- package/tailwind.config.export.js +0 -153
- /package/{scripts → dist/scripts}/chakra-to-shadcn-migrator/bin/chakra-to-shadcn.js +0 -0
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
# Troubleshooting Guide: Chakra UI to MachineMetrics Migration
|
|
2
|
+
|
|
3
|
+
## Common Issues and Solutions
|
|
4
|
+
|
|
5
|
+
### 1. Import Errors
|
|
6
|
+
|
|
7
|
+
#### Error: `Module not found: Can't resolve '@machinemetrics/mm-react-components'`
|
|
8
|
+
|
|
9
|
+
**Cause**: Package not installed or incorrect import path.
|
|
10
|
+
|
|
11
|
+
**Solution**:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @machinemetrics/mm-react-components
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Verification**:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Button, Input } from '@machinemetrics/mm-react-components';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### Error: `Module not found: Can't resolve 'lucide-react'`
|
|
24
|
+
|
|
25
|
+
**Cause**: Lucide React not installed for icon replacements.
|
|
26
|
+
|
|
27
|
+
**Solution**:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install lucide-react
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Verification**:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { Plus, Trash2 } from 'lucide-react';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Error: `Module not found: Can't resolve '@radix-ui/react-*'`
|
|
40
|
+
|
|
41
|
+
**Cause**: Missing Radix UI dependencies for specific components.
|
|
42
|
+
|
|
43
|
+
**Solution**:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Install required Radix UI packages
|
|
47
|
+
npm install @radix-ui/react-avatar @radix-ui/react-breadcrumb @radix-ui/react-calendar
|
|
48
|
+
npm install @radix-ui/react-alert-dialog @radix-ui/react-separator @radix-ui/react-form
|
|
49
|
+
npm install @radix-ui/react-textarea @radix-ui/react-toast
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. Theme and Styling Issues
|
|
53
|
+
|
|
54
|
+
#### Issue: Components don't have expected styling
|
|
55
|
+
|
|
56
|
+
**Cause**: Carbide theme not imported or applied.
|
|
57
|
+
|
|
58
|
+
**Solution**:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
// Import theme in your main entry file
|
|
62
|
+
import '@machinemetrics/mm-react-components/themes/carbide';
|
|
63
|
+
|
|
64
|
+
// Apply theme class to your app root
|
|
65
|
+
function App() {
|
|
66
|
+
return (
|
|
67
|
+
<div className="carbide">
|
|
68
|
+
<YourApp />
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Issue: Dark mode not working
|
|
75
|
+
|
|
76
|
+
**Cause**: Dark mode class not applied.
|
|
77
|
+
|
|
78
|
+
**Solution**:
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
// Apply both theme and dark mode classes
|
|
82
|
+
<div className="carbide dark">
|
|
83
|
+
<YourApp />
|
|
84
|
+
</div>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Issue: Custom colors not working
|
|
88
|
+
|
|
89
|
+
**Cause**: Using Chakra color tokens instead of Tailwind classes.
|
|
90
|
+
|
|
91
|
+
**Solution**:
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
// Before (Chakra)
|
|
95
|
+
<Box bg="blue.500" color="white">
|
|
96
|
+
|
|
97
|
+
// After (Tailwind)
|
|
98
|
+
<div className="bg-blue-500 text-white">
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 3. Layout Component Issues
|
|
102
|
+
|
|
103
|
+
#### Error: `Box is not defined`
|
|
104
|
+
|
|
105
|
+
**Cause**: Layout components need manual replacement.
|
|
106
|
+
|
|
107
|
+
**Solution**:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
// Before
|
|
111
|
+
<Box p={4} bg="gray.100">
|
|
112
|
+
Content
|
|
113
|
+
</Box>
|
|
114
|
+
|
|
115
|
+
// After
|
|
116
|
+
<div className="p-4 bg-gray-100">
|
|
117
|
+
Content
|
|
118
|
+
</div>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Error: `Flex is not defined`
|
|
122
|
+
|
|
123
|
+
**Cause**: Flex component needs manual replacement.
|
|
124
|
+
|
|
125
|
+
**Solution**:
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
// Before
|
|
129
|
+
<Flex direction="column" gap={4}>
|
|
130
|
+
Content
|
|
131
|
+
</Flex>
|
|
132
|
+
|
|
133
|
+
// After
|
|
134
|
+
<div className="flex flex-col gap-4">
|
|
135
|
+
Content
|
|
136
|
+
</div>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### Error: `VStack is not defined`
|
|
140
|
+
|
|
141
|
+
**Cause**: VStack component needs manual replacement.
|
|
142
|
+
|
|
143
|
+
**Solution**:
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
// Before
|
|
147
|
+
<VStack spacing={4}>
|
|
148
|
+
Content
|
|
149
|
+
</VStack>
|
|
150
|
+
|
|
151
|
+
// After
|
|
152
|
+
<div className="flex flex-col gap-4">
|
|
153
|
+
Content
|
|
154
|
+
</div>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 4. Component API Issues
|
|
158
|
+
|
|
159
|
+
#### Error: `Modal is not defined`
|
|
160
|
+
|
|
161
|
+
**Cause**: Modal component renamed to Dialog.
|
|
162
|
+
|
|
163
|
+
**Solution**:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
// Before
|
|
167
|
+
import { Modal, ModalOverlay, ModalContent } from '@chakra-ui/react';
|
|
168
|
+
|
|
169
|
+
// After
|
|
170
|
+
import {
|
|
171
|
+
Dialog,
|
|
172
|
+
DialogTrigger,
|
|
173
|
+
DialogContent,
|
|
174
|
+
} from '@machinemetrics/mm-react-components';
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Error: `Menu is not defined`
|
|
178
|
+
|
|
179
|
+
**Cause**: Menu component renamed to DropdownMenu.
|
|
180
|
+
|
|
181
|
+
**Solution**:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
// Before
|
|
185
|
+
import { Menu, MenuButton, MenuList, MenuItem } from '@chakra-ui/react';
|
|
186
|
+
|
|
187
|
+
// After
|
|
188
|
+
import {
|
|
189
|
+
DropdownMenu,
|
|
190
|
+
DropdownMenuTrigger,
|
|
191
|
+
DropdownMenuContent,
|
|
192
|
+
DropdownMenuItem,
|
|
193
|
+
} from '@machinemetrics/mm-react-components';
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Error: `FormLabel is not defined`
|
|
197
|
+
|
|
198
|
+
**Cause**: FormLabel component renamed to Label.
|
|
199
|
+
|
|
200
|
+
**Solution**:
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
// Before
|
|
204
|
+
import { FormLabel } from '@chakra-ui/react';
|
|
205
|
+
|
|
206
|
+
// After
|
|
207
|
+
import { Label } from '@machinemetrics/mm-react-components';
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 5. Icon Issues
|
|
211
|
+
|
|
212
|
+
#### Error: `AddIcon is not defined`
|
|
213
|
+
|
|
214
|
+
**Cause**: Chakra icons replaced with Lucide React.
|
|
215
|
+
|
|
216
|
+
**Solution**:
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
// Before
|
|
220
|
+
import { AddIcon, DeleteIcon } from '@chakra-ui/icons';
|
|
221
|
+
|
|
222
|
+
// After
|
|
223
|
+
import { Plus, Trash2 } from 'lucide-react';
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
#### Issue: Icons not displaying
|
|
227
|
+
|
|
228
|
+
**Cause**: Icon component not properly imported or used.
|
|
229
|
+
|
|
230
|
+
**Solution**:
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
// Ensure proper import
|
|
234
|
+
import { Plus } from 'lucide-react';
|
|
235
|
+
|
|
236
|
+
// Use as JSX element
|
|
237
|
+
<Button>
|
|
238
|
+
<Plus className="w-4 h-4" />
|
|
239
|
+
Add Item
|
|
240
|
+
</Button>;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### 6. Form Component Issues
|
|
244
|
+
|
|
245
|
+
#### Error: Form components not working
|
|
246
|
+
|
|
247
|
+
**Cause**: Form API changed significantly.
|
|
248
|
+
|
|
249
|
+
**Solution**:
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
// Before (Chakra)
|
|
253
|
+
<FormControl>
|
|
254
|
+
<FormLabel>Name</FormLabel>
|
|
255
|
+
<Input />
|
|
256
|
+
<FormErrorMessage>Error</FormErrorMessage>
|
|
257
|
+
</FormControl>
|
|
258
|
+
|
|
259
|
+
// After (MachineMetrics)
|
|
260
|
+
<FormField>
|
|
261
|
+
<FormItem>
|
|
262
|
+
<FormLabel>Name</FormLabel>
|
|
263
|
+
<FormControl>
|
|
264
|
+
<Input />
|
|
265
|
+
</FormControl>
|
|
266
|
+
<FormMessage>Error</FormMessage>
|
|
267
|
+
</FormItem>
|
|
268
|
+
</FormField>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Issue: Form validation not working
|
|
272
|
+
|
|
273
|
+
**Cause**: Form validation API changed.
|
|
274
|
+
|
|
275
|
+
**Solution**:
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
// Use the new Form component structure
|
|
279
|
+
import {
|
|
280
|
+
Form,
|
|
281
|
+
FormField,
|
|
282
|
+
FormItem,
|
|
283
|
+
FormLabel,
|
|
284
|
+
FormControl,
|
|
285
|
+
FormMessage,
|
|
286
|
+
} from '@machinemetrics/mm-react-components';
|
|
287
|
+
|
|
288
|
+
// Implement with proper form structure
|
|
289
|
+
<Form>
|
|
290
|
+
<FormField>
|
|
291
|
+
<FormItem>
|
|
292
|
+
<FormLabel>Field Label</FormLabel>
|
|
293
|
+
<FormControl>
|
|
294
|
+
<Input />
|
|
295
|
+
</FormControl>
|
|
296
|
+
<FormMessage />
|
|
297
|
+
</FormItem>
|
|
298
|
+
</FormField>
|
|
299
|
+
</Form>;
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### 7. State Management Issues
|
|
303
|
+
|
|
304
|
+
#### Issue: Modal state not working
|
|
305
|
+
|
|
306
|
+
**Cause**: Modal state API changed.
|
|
307
|
+
|
|
308
|
+
**Solution**:
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
// Before (Chakra)
|
|
312
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
313
|
+
|
|
314
|
+
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
315
|
+
Content
|
|
316
|
+
</Modal>
|
|
317
|
+
|
|
318
|
+
// After (MachineMetrics)
|
|
319
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
320
|
+
|
|
321
|
+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
|
322
|
+
<DialogTrigger>Open</DialogTrigger>
|
|
323
|
+
<DialogContent>
|
|
324
|
+
Content
|
|
325
|
+
</DialogContent>
|
|
326
|
+
</Dialog>
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
#### Issue: Drawer state not working
|
|
330
|
+
|
|
331
|
+
**Cause**: Drawer state API changed.
|
|
332
|
+
|
|
333
|
+
**Solution**:
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
// Before (Chakra)
|
|
337
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
338
|
+
|
|
339
|
+
<Drawer isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
340
|
+
Content
|
|
341
|
+
</Drawer>
|
|
342
|
+
|
|
343
|
+
// After (MachineMetrics)
|
|
344
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
345
|
+
|
|
346
|
+
<Drawer open={isOpen} onOpenChange={setIsOpen}>
|
|
347
|
+
<DrawerTrigger>Open</DrawerTrigger>
|
|
348
|
+
<DrawerContent>
|
|
349
|
+
Content
|
|
350
|
+
</DrawerContent>
|
|
351
|
+
</Drawer>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### 8. Styling Issues
|
|
355
|
+
|
|
356
|
+
#### Issue: Spacing not working
|
|
357
|
+
|
|
358
|
+
**Cause**: Chakra spacing props not converted to Tailwind.
|
|
359
|
+
|
|
360
|
+
**Solution**:
|
|
361
|
+
|
|
362
|
+
```tsx
|
|
363
|
+
// Before (Chakra)
|
|
364
|
+
<Box p={4} m={2} gap={4}>
|
|
365
|
+
|
|
366
|
+
// After (Tailwind)
|
|
367
|
+
<div className="p-4 m-2 gap-4">
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
#### Issue: Colors not working
|
|
371
|
+
|
|
372
|
+
**Cause**: Chakra color tokens not converted to Tailwind.
|
|
373
|
+
|
|
374
|
+
**Solution**:
|
|
375
|
+
|
|
376
|
+
```tsx
|
|
377
|
+
// Before (Chakra)
|
|
378
|
+
<Box bg="blue.500" color="white">
|
|
379
|
+
|
|
380
|
+
// After (Tailwind)
|
|
381
|
+
<div className="bg-blue-500 text-white">
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
#### Issue: Responsive design not working
|
|
385
|
+
|
|
386
|
+
**Cause**: Chakra responsive props not converted to Tailwind.
|
|
387
|
+
|
|
388
|
+
**Solution**:
|
|
389
|
+
|
|
390
|
+
```tsx
|
|
391
|
+
// Before (Chakra)
|
|
392
|
+
<Box display={{ base: 'block', md: 'flex' }}>
|
|
393
|
+
|
|
394
|
+
// After (Tailwind)
|
|
395
|
+
<div className="block md:flex">
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### 9. Animation Issues
|
|
399
|
+
|
|
400
|
+
#### Issue: Animations not working
|
|
401
|
+
|
|
402
|
+
**Cause**: Chakra animations not available in MachineMetrics.
|
|
403
|
+
|
|
404
|
+
**Solution**:
|
|
405
|
+
|
|
406
|
+
```tsx
|
|
407
|
+
// Use Tailwind animations or CSS transitions
|
|
408
|
+
<div className="transition-all duration-300 ease-in-out">Content</div>
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
#### Issue: Fade animations not working
|
|
412
|
+
|
|
413
|
+
**Cause**: Chakra Fade component not available.
|
|
414
|
+
|
|
415
|
+
**Solution**:
|
|
416
|
+
|
|
417
|
+
```tsx
|
|
418
|
+
// Use CSS transitions with conditional classes
|
|
419
|
+
<div
|
|
420
|
+
className={`transition-opacity duration-300 ${isVisible ? 'opacity-100' : 'opacity-0'}`}
|
|
421
|
+
>
|
|
422
|
+
Content
|
|
423
|
+
</div>
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### 10. Build Issues
|
|
427
|
+
|
|
428
|
+
#### Error: Build fails with missing dependencies
|
|
429
|
+
|
|
430
|
+
**Cause**: Missing required dependencies.
|
|
431
|
+
|
|
432
|
+
**Solution**:
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
# Install all required dependencies
|
|
436
|
+
npm install @machinemetrics/mm-react-components
|
|
437
|
+
npm install class-variance-authority tailwind-merge lucide-react
|
|
438
|
+
npm install react-day-picker date-fns recharts react-dropzone sonner vaul
|
|
439
|
+
npm install @radix-ui/react-avatar @radix-ui/react-breadcrumb @radix-ui/react-calendar
|
|
440
|
+
npm install @radix-ui/react-alert-dialog @radix-ui/react-separator @radix-ui/react-form
|
|
441
|
+
npm install @radix-ui/react-textarea @radix-ui/react-toast
|
|
442
|
+
npm install -D tailwindcss postcss autoprefixer
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
#### Error: TypeScript errors
|
|
446
|
+
|
|
447
|
+
**Cause**: Type definitions not found.
|
|
448
|
+
|
|
449
|
+
**Solution**:
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
# Install TypeScript definitions
|
|
453
|
+
npm install -D @types/react @types/react-dom
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
#### Error: Tailwind CSS not working
|
|
457
|
+
|
|
458
|
+
**Cause**: Tailwind CSS not configured.
|
|
459
|
+
|
|
460
|
+
**Solution**:
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
# Initialize Tailwind CSS
|
|
464
|
+
npx tailwindcss init -p
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
**Update tailwind.config.js**:
|
|
468
|
+
|
|
469
|
+
```javascript
|
|
470
|
+
module.exports = {
|
|
471
|
+
content: ['./src/**/*.{js,ts,jsx,tsx}'],
|
|
472
|
+
theme: {
|
|
473
|
+
extend: {},
|
|
474
|
+
},
|
|
475
|
+
plugins: [],
|
|
476
|
+
};
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### 11. Performance Issues
|
|
480
|
+
|
|
481
|
+
#### Issue: Bundle size increased
|
|
482
|
+
|
|
483
|
+
**Cause**: Additional dependencies added.
|
|
484
|
+
|
|
485
|
+
**Solution**:
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# Analyze bundle size
|
|
489
|
+
npm run build -- --analyze
|
|
490
|
+
|
|
491
|
+
# Use tree shaking for unused components
|
|
492
|
+
import { Button } from '@machinemetrics/mm-react-components'
|
|
493
|
+
// Instead of
|
|
494
|
+
import * as Components from '@machinemetrics/mm-react-components'
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
#### Issue: Slow build times
|
|
498
|
+
|
|
499
|
+
**Cause**: Additional dependencies and processing.
|
|
500
|
+
|
|
501
|
+
**Solution**:
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
# Use build caching
|
|
505
|
+
npm run build -- --cache
|
|
506
|
+
|
|
507
|
+
# Optimize imports
|
|
508
|
+
import { Button, Input } from '@machinemetrics/mm-react-components'
|
|
509
|
+
// Instead of importing entire library
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### 12. Testing Issues
|
|
513
|
+
|
|
514
|
+
#### Issue: Tests failing after migration
|
|
515
|
+
|
|
516
|
+
**Cause**: Component APIs changed.
|
|
517
|
+
|
|
518
|
+
**Solution**:
|
|
519
|
+
|
|
520
|
+
```tsx
|
|
521
|
+
// Update test imports
|
|
522
|
+
import { render, screen } from '@testing-library/react';
|
|
523
|
+
import { Button } from '@machinemetrics/mm-react-components';
|
|
524
|
+
|
|
525
|
+
// Update test selectors
|
|
526
|
+
// Before
|
|
527
|
+
screen.getByRole('button', { name: /add/i });
|
|
528
|
+
|
|
529
|
+
// After (if API changed)
|
|
530
|
+
screen.getByRole('button', { name: /add/i });
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
#### Issue: Visual regression tests failing
|
|
534
|
+
|
|
535
|
+
**Cause**: Component styling changed.
|
|
536
|
+
|
|
537
|
+
**Solution**:
|
|
538
|
+
|
|
539
|
+
```bash
|
|
540
|
+
# Update visual test baselines
|
|
541
|
+
npm run test:visual -- --update-snapshots
|
|
542
|
+
|
|
543
|
+
# Review and approve changes
|
|
544
|
+
npm run test:visual -- --review
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
## Debugging Tools
|
|
548
|
+
|
|
549
|
+
### 1. Console Debugging
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
// Add debug logging
|
|
553
|
+
console.log('Component props:', props);
|
|
554
|
+
console.log('Component state:', state);
|
|
555
|
+
|
|
556
|
+
// Use React DevTools
|
|
557
|
+
// Install React DevTools browser extension
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
### 2. Network Debugging
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
# Check network requests
|
|
564
|
+
# Open browser DevTools > Network tab
|
|
565
|
+
# Look for failed requests or missing resources
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
### 3. Build Debugging
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
# Verbose build output
|
|
572
|
+
npm run build -- --verbose
|
|
573
|
+
|
|
574
|
+
# Check for specific errors
|
|
575
|
+
npm run build 2>&1 | grep -i error
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### 4. Dependency Debugging
|
|
579
|
+
|
|
580
|
+
```bash
|
|
581
|
+
# Check installed packages
|
|
582
|
+
npm list
|
|
583
|
+
|
|
584
|
+
# Check for version conflicts
|
|
585
|
+
npm ls --depth=0
|
|
586
|
+
|
|
587
|
+
# Check for missing dependencies
|
|
588
|
+
npm audit
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
## Prevention Strategies
|
|
592
|
+
|
|
593
|
+
### 1. Gradual Migration
|
|
594
|
+
|
|
595
|
+
```tsx
|
|
596
|
+
// Migrate components one at a time
|
|
597
|
+
// Start with simple components (Button, Input)
|
|
598
|
+
// Then move to complex components (Modal, Form)
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
### 2. Testing Strategy
|
|
602
|
+
|
|
603
|
+
```tsx
|
|
604
|
+
// Write tests before migration
|
|
605
|
+
// Test component functionality
|
|
606
|
+
// Test visual appearance
|
|
607
|
+
// Test responsive behavior
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### 3. Documentation
|
|
611
|
+
|
|
612
|
+
```tsx
|
|
613
|
+
// Document migration decisions
|
|
614
|
+
// Keep track of component mappings
|
|
615
|
+
// Note any customizations needed
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### 4. Code Review
|
|
619
|
+
|
|
620
|
+
```tsx
|
|
621
|
+
// Review all migration changes
|
|
622
|
+
// Ensure functionality is preserved
|
|
623
|
+
// Verify styling is correct
|
|
624
|
+
// Check for performance issues
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
## Getting Help
|
|
628
|
+
|
|
629
|
+
### 1. Documentation
|
|
630
|
+
|
|
631
|
+
- [MachineMetrics Components Docs](https://components.machinemetrics.com)
|
|
632
|
+
- [Component API Reference](https://components.machinemetrics.com/api)
|
|
633
|
+
- [Migration Guide](https://components.machinemetrics.com/migration)
|
|
634
|
+
|
|
635
|
+
### 2. Community Support
|
|
636
|
+
|
|
637
|
+
- [GitHub Issues](https://github.com/machinemetrics/mm-react-components/issues)
|
|
638
|
+
- [Discord Community](https://discord.gg/machinemetrics)
|
|
639
|
+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/machinemetrics)
|
|
640
|
+
|
|
641
|
+
### 3. Professional Support
|
|
642
|
+
|
|
643
|
+
- [MachineMetrics Support](https://support.machinemetrics.com)
|
|
644
|
+
- [Enterprise Support](https://enterprise.machinemetrics.com)
|
|
645
|
+
- [Consulting Services](https://consulting.machinemetrics.com)
|
|
646
|
+
|
|
647
|
+
## Conclusion
|
|
648
|
+
|
|
649
|
+
This troubleshooting guide covers the most common issues encountered during Chakra UI to MachineMetrics migration. Follow the solutions provided and use the debugging tools to resolve any issues. For additional help, refer to the documentation or contact support.
|