@machinemetrics/mm-react-components 0.2.3-2 → 0.2.3-21

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 (169) hide show
  1. package/README.md +89 -30
  2. package/agent-docs/agent-documentation-reference.md +364 -0
  3. package/agent-docs/ai-agent-guide.md +558 -0
  4. package/agent-docs/ai-agent-init-guide.md +465 -0
  5. package/agent-docs/chakra-migration-readme.md +265 -0
  6. package/agent-docs/chakra-migration-troubleshooting.md +649 -0
  7. package/agent-docs/component-mapping-reference.md +466 -0
  8. package/agent-docs/init-readme.md +283 -0
  9. package/agent-docs/init-troubleshooting.md +550 -0
  10. package/agent-docs/setup-reference.md +365 -0
  11. package/dist/App.d.ts.map +1 -1
  12. package/dist/README.md +89 -30
  13. package/dist/components/ui/alert-dialog.d.ts +15 -0
  14. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  15. package/dist/components/ui/alert.d.ts +10 -0
  16. package/dist/components/ui/alert.d.ts.map +1 -0
  17. package/dist/components/ui/avatar.d.ts +7 -0
  18. package/dist/components/ui/avatar.d.ts.map +1 -0
  19. package/dist/components/ui/breadcrumb.d.ts +12 -0
  20. package/dist/components/ui/breadcrumb.d.ts.map +1 -0
  21. package/dist/components/ui/button.d.ts.map +1 -1
  22. package/dist/components/ui/card.d.ts +10 -0
  23. package/dist/components/ui/card.d.ts.map +1 -0
  24. package/dist/components/ui/chart.d.ts +41 -0
  25. package/dist/components/ui/chart.d.ts.map +1 -0
  26. package/dist/components/ui/command.d.ts +19 -0
  27. package/dist/components/ui/command.d.ts.map +1 -0
  28. package/dist/components/ui/data-table/TableView.d.ts +1 -1
  29. package/dist/components/ui/data-table/TableView.d.ts.map +1 -1
  30. package/dist/components/ui/data-table/cards/ResponsiveTable.d.ts +1 -1
  31. package/dist/components/ui/data-table/cards/ResponsiveTable.d.ts.map +1 -1
  32. package/dist/components/ui/data-table/cards/RowCard.d.ts +2 -1
  33. package/dist/components/ui/data-table/cards/RowCard.d.ts.map +1 -1
  34. package/dist/components/ui/data-table/index.d.ts +3 -1
  35. package/dist/components/ui/data-table/index.d.ts.map +1 -1
  36. package/dist/components/ui/data-table/pagination.d.ts +3 -1
  37. package/dist/components/ui/data-table/pagination.d.ts.map +1 -1
  38. package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts +7 -0
  39. package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts.map +1 -0
  40. package/dist/components/ui/data-table/parts/CellContent.d.ts +7 -0
  41. package/dist/components/ui/data-table/parts/CellContent.d.ts.map +1 -0
  42. package/dist/components/ui/data-table/parts/ColGroup.d.ts +7 -0
  43. package/dist/components/ui/data-table/parts/ColGroup.d.ts.map +1 -0
  44. package/dist/components/ui/data-table/parts/SortableHeader.d.ts +13 -0
  45. package/dist/components/ui/data-table/parts/SortableHeader.d.ts.map +1 -0
  46. package/dist/components/ui/data-table/parts/TableBody.d.ts +11 -0
  47. package/dist/components/ui/data-table/parts/TableBody.d.ts.map +1 -0
  48. package/dist/components/ui/data-table/parts/TableHeader.d.ts +15 -0
  49. package/dist/components/ui/data-table/parts/TableHeader.d.ts.map +1 -0
  50. package/dist/components/ui/data-table/toolbar/DataTableToolbar.d.ts +2 -1
  51. package/dist/components/ui/data-table/toolbar/DataTableToolbar.d.ts.map +1 -1
  52. package/dist/components/ui/data-table/types.d.ts +33 -10
  53. package/dist/components/ui/data-table/types.d.ts.map +1 -1
  54. package/dist/components/ui/data-table/useTableController.d.ts +12 -1
  55. package/dist/components/ui/data-table/useTableController.d.ts.map +1 -1
  56. package/dist/components/ui/data-table/utils.d.ts +2 -0
  57. package/dist/components/ui/data-table/utils.d.ts.map +1 -1
  58. package/dist/components/ui/date-picker.d.ts +36 -0
  59. package/dist/components/ui/date-picker.d.ts.map +1 -0
  60. package/dist/components/ui/dropdown-menu.d.ts +1 -1
  61. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  62. package/dist/components/ui/form.d.ts +25 -0
  63. package/dist/components/ui/form.d.ts.map +1 -0
  64. package/dist/components/ui/hero-metric-card/HeroMetricCard.d.ts +4 -0
  65. package/dist/components/ui/hero-metric-card/HeroMetricCard.d.ts.map +1 -0
  66. package/dist/components/ui/hero-metric-card/HeroMetricCardItem.d.ts +4 -0
  67. package/dist/components/ui/hero-metric-card/HeroMetricCardItem.d.ts.map +1 -0
  68. package/dist/components/ui/hero-metric-card/constants.d.ts +13 -0
  69. package/dist/components/ui/hero-metric-card/constants.d.ts.map +1 -0
  70. package/dist/components/ui/hero-metric-card/grid.d.ts +4 -0
  71. package/dist/components/ui/hero-metric-card/grid.d.ts.map +1 -0
  72. package/dist/components/ui/hero-metric-card/hooks.d.ts +6 -0
  73. package/dist/components/ui/hero-metric-card/hooks.d.ts.map +1 -0
  74. package/dist/components/ui/hero-metric-card/index.d.ts +5 -0
  75. package/dist/components/ui/hero-metric-card/index.d.ts.map +1 -0
  76. package/dist/components/ui/hero-metric-card/parsing.d.ts +11 -0
  77. package/dist/components/ui/hero-metric-card/parsing.d.ts.map +1 -0
  78. package/dist/components/ui/hero-metric-card/refs.d.ts +3 -0
  79. package/dist/components/ui/hero-metric-card/refs.d.ts.map +1 -0
  80. package/dist/components/ui/hero-metric-card/trend.d.ts +4 -0
  81. package/dist/components/ui/hero-metric-card/trend.d.ts.map +1 -0
  82. package/dist/components/ui/hero-metric-card/types.d.ts +60 -0
  83. package/dist/components/ui/hero-metric-card/types.d.ts.map +1 -0
  84. package/dist/components/ui/hero-metric-card/utils.d.ts +10 -0
  85. package/dist/components/ui/hero-metric-card/utils.d.ts.map +1 -0
  86. package/dist/components/ui/pagination.d.ts +14 -0
  87. package/dist/components/ui/pagination.d.ts.map +1 -0
  88. package/dist/components/ui/progress.d.ts +1 -0
  89. package/dist/components/ui/progress.d.ts.map +1 -1
  90. package/dist/components/ui/separator.d.ts +5 -0
  91. package/dist/components/ui/separator.d.ts.map +1 -0
  92. package/dist/components/ui/simple-pagination.d.ts +8 -0
  93. package/dist/components/ui/simple-pagination.d.ts.map +1 -0
  94. package/dist/components/ui/sonner.d.ts +4 -0
  95. package/dist/components/ui/sonner.d.ts.map +1 -0
  96. package/dist/components/ui/spinner-carbide.d.ts +5 -0
  97. package/dist/components/ui/spinner-carbide.d.ts.map +1 -0
  98. package/dist/components/ui/spinner.d.ts +4 -0
  99. package/dist/components/ui/spinner.d.ts.map +1 -0
  100. package/dist/components/ui/textarea.d.ts +4 -0
  101. package/dist/components/ui/textarea.d.ts.map +1 -0
  102. package/dist/docs/GETTING_STARTED.md +13 -5
  103. package/dist/index.d.ts +22 -0
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/lib/mm-react-components.css +1 -0
  106. package/dist/main.d.ts +1 -2
  107. package/dist/main.d.ts.map +1 -1
  108. package/dist/mm-react-components.es.js +16740 -7065
  109. package/dist/mm-react-components.es.js.map +1 -1
  110. package/dist/mm-react-components.umd.js +28 -11
  111. package/dist/mm-react-components.umd.js.map +1 -1
  112. package/dist/preview/AlertDialogPreview.d.ts +2 -0
  113. package/dist/preview/AlertDialogPreview.d.ts.map +1 -0
  114. package/dist/preview/AlertPreview.d.ts +2 -0
  115. package/dist/preview/AlertPreview.d.ts.map +1 -0
  116. package/dist/preview/AvatarPreview.d.ts +2 -0
  117. package/dist/preview/AvatarPreview.d.ts.map +1 -0
  118. package/dist/preview/BreadcrumbPreview.d.ts +2 -0
  119. package/dist/preview/BreadcrumbPreview.d.ts.map +1 -0
  120. package/dist/preview/CardPreview.d.ts +2 -0
  121. package/dist/preview/CardPreview.d.ts.map +1 -0
  122. package/dist/preview/ChartPreview.d.ts +2 -0
  123. package/dist/preview/ChartPreview.d.ts.map +1 -0
  124. package/dist/preview/ColorsPreview.d.ts +7 -0
  125. package/dist/preview/ColorsPreview.d.ts.map +1 -0
  126. package/dist/preview/CommandPreview.d.ts +2 -0
  127. package/dist/preview/CommandPreview.d.ts.map +1 -0
  128. package/dist/preview/DataTablePreview.d.ts.map +1 -1
  129. package/dist/preview/DatePickerPreview.d.ts +2 -0
  130. package/dist/preview/DatePickerPreview.d.ts.map +1 -0
  131. package/dist/preview/DateRangePickerPreview.d.ts.map +1 -1
  132. package/dist/preview/FormPreview.d.ts +2 -0
  133. package/dist/preview/FormPreview.d.ts.map +1 -0
  134. package/dist/preview/HeroMetricCardPreview.d.ts +2 -0
  135. package/dist/preview/HeroMetricCardPreview.d.ts.map +1 -0
  136. package/dist/preview/PaginationPreview.d.ts +2 -0
  137. package/dist/preview/PaginationPreview.d.ts.map +1 -0
  138. package/dist/preview/SeparatorPreview.d.ts +2 -0
  139. package/dist/preview/SeparatorPreview.d.ts.map +1 -0
  140. package/dist/preview/SonnerPreview.d.ts +2 -0
  141. package/dist/preview/SonnerPreview.d.ts.map +1 -0
  142. package/dist/preview/SpinnerPreview.d.ts +2 -0
  143. package/dist/preview/SpinnerPreview.d.ts.map +1 -0
  144. package/dist/preview/TextareaPreview.d.ts +2 -0
  145. package/dist/preview/TextareaPreview.d.ts.map +1 -0
  146. package/dist/scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.config.json +577 -0
  147. package/dist/scripts/chakra-to-shadcn-migrator/lib/args.js +63 -0
  148. package/dist/scripts/chakra-to-shadcn-migrator/lib/colors.js +14 -0
  149. package/dist/scripts/chakra-to-shadcn-migrator/lib/config.js +15 -0
  150. package/dist/scripts/chakra-to-shadcn-migrator/lib/deps.js +125 -0
  151. package/dist/scripts/chakra-to-shadcn-migrator/lib/file-io.js +44 -0
  152. package/dist/scripts/chakra-to-shadcn-migrator/lib/render.js +89 -0
  153. package/dist/scripts/chakra-to-shadcn-migrator/lib/transform.js +550 -0
  154. package/dist/scripts/chakra-to-shadcn-migrator/package.json +11 -0
  155. package/dist/scripts/init.cjs +216 -0
  156. package/dist/scripts/npx-init.cjs +418 -0
  157. package/dist/tailwind.base.config.js +89 -0
  158. package/dist/themes/carbide.css +369 -91
  159. package/package.json +40 -10
  160. package/src/index.css +111 -498
  161. package/dist/index.css +0 -536
  162. package/dist/themes/base.css +0 -536
  163. package/dist/themes/complete.css +0 -8
  164. package/scripts/README.md +0 -171
  165. package/scripts/chakra-to-shadcn-migrator/README.md +0 -107
  166. package/src/themes/base.css +0 -536
  167. package/src/themes/carbide.css +0 -1257
  168. package/src/themes/complete.css +0 -8
  169. /package/{scripts → dist/scripts}/chakra-to-shadcn-migrator/bin/chakra-to-shadcn.js +0 -0
@@ -0,0 +1,558 @@
1
+ # AI Agent Guide: Chakra UI to MachineMetrics React Components Migration
2
+
3
+ ## Overview
4
+
5
+ This guide provides AI agents with comprehensive instructions for migrating Chakra UI components to the MachineMetrics React Components library.
6
+
7
+ **Important:** MachineMetrics React Components is built on **[shadcn/ui](https://ui.shadcn.com/)**, which uses Radix UI primitives and Tailwind CSS. This means you're migrating from Chakra UI → shadcn/ui-based components with the Carbide industrial theme.
8
+
9
+ This guide includes automated script usage, manual conversion procedures, and troubleshooting guidance.
10
+
11
+ ## Quick Start
12
+
13
+ ### 1. Automated Migration (Preferred)
14
+
15
+ ```bash
16
+ # Run the migration script
17
+ node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply
18
+ ```
19
+
20
+ ### 2. Manual Migration (When Script Fails)
21
+
22
+ If the automated script fails, follow the manual conversion guide below.
23
+
24
+ ## Configuration File Reference
25
+
26
+ The migration configuration is located at `scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.config.json` and contains:
27
+
28
+ - **Dependencies to Remove**: Chakra UI packages to uninstall
29
+ - **Dependencies to Add**: New packages required for MachineMetrics components
30
+ - **Component Mappings**: Direct component replacements
31
+ - **Compound Components**: Complex component structure mappings
32
+ - **Manual Migration Instructions**: Fallback conversion steps
33
+
34
+ ## Component Migration Mappings
35
+
36
+ ### Layout Components (Manual Replacement Required)
37
+
38
+ | Chakra Component | Replacement | Notes |
39
+ | ---------------- | ------------------------------------------------------------------------ | ---------------------------------- |
40
+ | `Box` | `<div>` | Add appropriate Tailwind classes |
41
+ | `Flex` | `<div className="flex">` | Add flex-related Tailwind classes |
42
+ | `VStack` | `<div className="flex flex-col gap-4">` | Adjust spacing as needed |
43
+ | `HStack` | `<div className="flex flex-row gap-4">` | Adjust spacing as needed |
44
+ | `Stack` | `<div className="flex flex-col gap-4">` | Adjust direction/spacing as needed |
45
+ | `Container` | `<div className="container mx-auto px-4">` | Adjust max-width as needed |
46
+ | `Center` | `<div className="flex items-center justify-center">` | - |
47
+ | `SimpleGrid` | `<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">` | Adjust columns as needed |
48
+
49
+ ### Typography Components (Manual Replacement Required)
50
+
51
+ | Chakra Component | Replacement | Notes |
52
+ | ---------------- | ---------------------------- | -------------------------------------------------- |
53
+ | `Heading` | `<h1>`, `<h2>`, `<h3>`, etc. | Use semantic HTML with Tailwind typography classes |
54
+ | `Text` | `<p>`, `<span>`, etc. | Use semantic HTML with Tailwind typography classes |
55
+
56
+ ### Form Components (Manual Replacement Required)
57
+
58
+ | Chakra Component | Replacement | Notes |
59
+ | ---------------- | ----------------------- | --------------------------------------------- |
60
+ | `Field` | `<div>` wrapper | Use shadcn/ui form components for inputs |
61
+ | `NumberInput` | `<input type="number">` | Add Tailwind classes, or use shadcn/ui Input |
62
+ | `Slider` | `<input type="range">` | Add Tailwind classes, or use shadcn/ui Slider |
63
+ | `NativeSelect` | `<select>` | Add Tailwind classes, or use shadcn/ui Select |
64
+
65
+ ### UI Components (Direct Mappings Available)
66
+
67
+ | Chakra Component | MachineMetrics Component | Import Path |
68
+ | ---------------- | ------------------------ | ------------------------------------- |
69
+ | `Badge` | `Badge` | `@machinemetrics/mm-react-components` |
70
+ | `Button` | `Button` | `@machinemetrics/mm-react-components` |
71
+ | `Modal` | `Dialog` | `@machinemetrics/mm-react-components` |
72
+ | `Input` | `Input` | `@machinemetrics/mm-react-components` |
73
+ | `Menu` | `DropdownMenu` | `@machinemetrics/mm-react-components` |
74
+ | `Select` | `Select` | `@machinemetrics/mm-react-components` |
75
+ | `Table` | `Table` | `@machinemetrics/mm-react-components` |
76
+ | `Tabs` | `Tabs` | `@machinemetrics/mm-react-components` |
77
+ | `Tooltip` | `Tooltip` | `@machinemetrics/mm-react-components` |
78
+ | `Drawer` | `Drawer` | `@machinemetrics/mm-react-components` |
79
+ | `Switch` | `Switch` | `@machinemetrics/mm-react-components` |
80
+ | `Checkbox` | `Checkbox` | `@machinemetrics/mm-react-components` |
81
+ | `Radio` | `RadioGroupItem` | `@machinemetrics/mm-react-components` |
82
+ | `RadioGroup` | `RadioGroup` | `@machinemetrics/mm-react-components` |
83
+ | `Label` | `Label` | `@machinemetrics/mm-react-components` |
84
+ | `FormLabel` | `Label` | `@machinemetrics/mm-react-components` |
85
+ | `Sheet` | `Sheet` | `@machinemetrics/mm-react-components` |
86
+ | `Skeleton` | `Skeleton` | `@machinemetrics/mm-react-components` |
87
+ | `Collapse` | `Collapsible` | `@machinemetrics/mm-react-components` |
88
+ | `Accordion` | `Accordion` | `@machinemetrics/mm-react-components` |
89
+ | `Progress` | `Progress` | `@machinemetrics/mm-react-components` |
90
+ | `Slider` | `Slider` | `@machinemetrics/mm-react-components` |
91
+ | `Popover` | `Popover` | `@machinemetrics/mm-react-components` |
92
+
93
+ ### New Components (Recently Added)
94
+
95
+ | Chakra Component | MachineMetrics Component | Import Path |
96
+ | ----------------- | -------------------------------------- | ------------------------------------- |
97
+ | `Alert` | `Alert` | `@machinemetrics/mm-react-components` |
98
+ | `AlertDialog` | `AlertDialog` | `@machinemetrics/mm-react-components` |
99
+ | `Avatar` | `Avatar` | `@machinemetrics/mm-react-components` |
100
+ | `Breadcrumb` | `Breadcrumb` | `@machinemetrics/mm-react-components` |
101
+ | `Calendar` | `Calendar` | `@machinemetrics/mm-react-components` |
102
+ | `DateRangePicker` | `DateRangePicker` | `@machinemetrics/mm-react-components` |
103
+ | `Form` | `Form` | `@machinemetrics/mm-react-components` |
104
+ | `Separator` | `Separator` | `@machinemetrics/mm-react-components` |
105
+ | `Textarea` | `Textarea` | `@machinemetrics/mm-react-components` |
106
+ | `Toaster` | `Toaster` | `@machinemetrics/mm-react-components` |
107
+ | `Chart` | `ChartContainer`, `ChartTooltip`, etc. | `@machinemetrics/mm-react-components` |
108
+ | `Dropzone` | `Dropzone` | `@machinemetrics/mm-react-components` |
109
+ | `SearchInput` | `SearchInput` | `@machinemetrics/mm-react-components` |
110
+
111
+ ## Compound Component Mappings
112
+
113
+ ### Modal/Dialog Components
114
+
115
+ ```tsx
116
+ // Chakra UI
117
+ <Modal>
118
+ <ModalOverlay />
119
+ <ModalContent>
120
+ <ModalHeader>Title</ModalHeader>
121
+ <ModalBody>Content</ModalBody>
122
+ <ModalFooter>Footer</ModalFooter>
123
+ </ModalContent>
124
+ </Modal>
125
+
126
+ // MachineMetrics Components
127
+ <Dialog>
128
+ <DialogTrigger>Open</DialogTrigger>
129
+ <DialogContent>
130
+ <DialogHeader>
131
+ <DialogTitle>Title</DialogTitle>
132
+ </DialogHeader>
133
+ Content
134
+ <DialogFooter>Footer</DialogFooter>
135
+ </DialogContent>
136
+ </Dialog>
137
+ ```
138
+
139
+ ### Drawer Components
140
+
141
+ ```tsx
142
+ // Chakra UI
143
+ <Drawer>
144
+ <DrawerOverlay />
145
+ <DrawerContent>
146
+ <DrawerHeader>Title</DrawerHeader>
147
+ <DrawerBody>Content</DrawerBody>
148
+ <DrawerFooter>Footer</DrawerFooter>
149
+ </DrawerContent>
150
+ </Drawer>
151
+
152
+ // MachineMetrics Components
153
+ <Drawer>
154
+ <DrawerTrigger>Open</DrawerTrigger>
155
+ <DrawerContent>
156
+ <DrawerHeader>
157
+ <DrawerTitle>Title</DrawerTitle>
158
+ </DrawerHeader>
159
+ Content
160
+ <DrawerFooter>Footer</DrawerFooter>
161
+ </DrawerContent>
162
+ </Drawer>
163
+ ```
164
+
165
+ ### Accordion Components
166
+
167
+ ```tsx
168
+ // Chakra UI
169
+ <Accordion>
170
+ <AccordionItem>
171
+ <AccordionButton>Header</AccordionButton>
172
+ <AccordionPanel>Content</AccordionPanel>
173
+ </AccordionItem>
174
+ </Accordion>
175
+
176
+ // MachineMetrics Components
177
+ <Accordion>
178
+ <AccordionItem>
179
+ <AccordionTrigger>Header</AccordionTrigger>
180
+ <AccordionContent>Content</AccordionContent>
181
+ </AccordionItem>
182
+ </Accordion>
183
+ ```
184
+
185
+ ### Card Components
186
+
187
+ ```tsx
188
+ // Chakra UI
189
+ <Card>
190
+ <CardHeader>Header</CardHeader>
191
+ <CardBody>Content</CardBody>
192
+ <CardFooter>Footer</CardFooter>
193
+ </Card>
194
+
195
+ // MachineMetrics Components
196
+ <Card>
197
+ <CardHeader>
198
+ <CardTitle>Title</CardTitle>
199
+ <CardDescription>Description</CardDescription>
200
+ </CardHeader>
201
+ <CardContent>Content</CardContent>
202
+ <CardFooter>Footer</CardFooter>
203
+ </Card>
204
+ ```
205
+
206
+ ## Manual Conversion Process
207
+
208
+ ### Step 1: Update Dependencies
209
+
210
+ ```bash
211
+ # Remove Chakra UI packages
212
+ npm uninstall @chakra-ui/react @chakra-ui/icons @chakra-ui/system @emotion/react @emotion/styled
213
+
214
+ # Install MachineMetrics components
215
+ npm install @machinemetrics/mm-react-components
216
+
217
+ # Install additional dependencies
218
+ npm install class-variance-authority tailwind-merge lucide-react
219
+ npm install react-day-picker date-fns recharts react-dropzone sonner vaul
220
+ npm install @radix-ui/react-avatar @radix-ui/react-breadcrumb @radix-ui/react-calendar
221
+ npm install @radix-ui/react-alert-dialog @radix-ui/react-separator @radix-ui/react-form
222
+ npm install @radix-ui/react-textarea @radix-ui/react-toast
223
+
224
+ # Install dev dependencies
225
+ npm install -D tailwindcss postcss autoprefixer
226
+ ```
227
+
228
+ ### Step 2: Update Theme Configuration
229
+
230
+ ```tsx
231
+ // Remove ChakraProvider from your app root
232
+ // Before
233
+ import { ChakraProvider } from '@chakra-ui/react';
234
+
235
+ function App() {
236
+ return (
237
+ <ChakraProvider>
238
+ <YourApp />
239
+ </ChakraProvider>
240
+ );
241
+ }
242
+
243
+ // After
244
+ import '@machinemetrics/mm-react-components/themes/carbide';
245
+
246
+ function App() {
247
+ return (
248
+ <div className="carbide">
249
+ <YourApp />
250
+ </div>
251
+ );
252
+ }
253
+ ```
254
+
255
+ ### Step 3: Update Component Imports
256
+
257
+ ```tsx
258
+ // Before
259
+ import { Button, Input, Modal, Box, Flex } from '@chakra-ui/react';
260
+
261
+ // After
262
+ import { Button, Input, Dialog } from '@machinemetrics/mm-react-components';
263
+ // Layout components become generic HTML elements with Tailwind classes
264
+ ```
265
+
266
+ ### Step 4: Convert Layout Components
267
+
268
+ ```tsx
269
+ // Before
270
+ <Box p={4} bg="gray.100">
271
+ <Flex direction="column" gap={4}>
272
+ <VStack spacing={4}>
273
+ <HStack spacing={2}>
274
+ Content
275
+ </HStack>
276
+ </VStack>
277
+ </Flex>
278
+ </Box>
279
+
280
+ // After
281
+ <div className="p-4 bg-gray-100">
282
+ <div className="flex flex-col gap-4">
283
+ <div className="flex flex-col gap-4">
284
+ <div className="flex flex-row gap-2">
285
+ Content
286
+ </div>
287
+ </div>
288
+ </div>
289
+ </div>
290
+ ```
291
+
292
+ ### Step 5: Convert Typography Components
293
+
294
+ ```tsx
295
+ // Before
296
+ <Heading size="lg" color="blue.500">
297
+ Title
298
+ </Heading>
299
+ <Text fontSize="sm" color="gray.600">
300
+ Description
301
+ </Text>
302
+
303
+ // After
304
+ <h2 className="text-lg font-semibold text-blue-500">
305
+ Title
306
+ </h2>
307
+ <p className="text-sm text-gray-600">
308
+ Description
309
+ </p>
310
+ ```
311
+
312
+ ### Step 6: Convert Form Components
313
+
314
+ ```tsx
315
+ // Before
316
+ <Field>
317
+ <FormLabel>Name</FormLabel>
318
+ <Input placeholder="Enter name" />
319
+ </Field>
320
+
321
+ // After
322
+ <div>
323
+ <Label>Name</Label>
324
+ <Input placeholder="Enter name" />
325
+ </div>
326
+ ```
327
+
328
+ ### Step 7: Convert UI Components
329
+
330
+ ```tsx
331
+ // Before
332
+ <Modal isOpen={isOpen} onClose={onClose}>
333
+ <ModalOverlay />
334
+ <ModalContent>
335
+ <ModalHeader>Title</ModalHeader>
336
+ <ModalBody>Content</ModalBody>
337
+ <ModalFooter>
338
+ <Button onClick={onClose}>Close</Button>
339
+ </ModalFooter>
340
+ </ModalContent>
341
+ </Modal>
342
+
343
+ // After
344
+ <Dialog open={isOpen} onOpenChange={setIsOpen}>
345
+ <DialogTrigger>Open</DialogTrigger>
346
+ <DialogContent>
347
+ <DialogHeader>
348
+ <DialogTitle>Title</DialogTitle>
349
+ </DialogHeader>
350
+ Content
351
+ <DialogFooter>
352
+ <Button onClick={() => setIsOpen(false)}>Close</Button>
353
+ </DialogFooter>
354
+ </DialogContent>
355
+ </Dialog>
356
+ ```
357
+
358
+ ## Icon Migration
359
+
360
+ ### Replace Chakra Icons with Lucide React
361
+
362
+ ```tsx
363
+ // Before
364
+ import { AddIcon, DeleteIcon } from '@chakra-ui/icons'
365
+
366
+ // After
367
+ import { Plus, Trash2 } from 'lucide-react'
368
+
369
+ // Usage remains the same
370
+ <Button>
371
+ <AddIcon />
372
+ Add Item
373
+ </Button>
374
+
375
+ <Button>
376
+ <Plus />
377
+ Add Item
378
+ </Button>
379
+ ```
380
+
381
+ ## Common Migration Patterns
382
+
383
+ ### 1. Spacing and Layout
384
+
385
+ ```tsx
386
+ // Chakra UI spacing
387
+ <Box p={4} m={2} gap={4}>
388
+
389
+ // Tailwind CSS spacing
390
+ <div className="p-4 m-2 gap-4">
391
+ ```
392
+
393
+ ### 2. Colors
394
+
395
+ ```tsx
396
+ // Chakra UI colors
397
+ <Box bg="blue.500" color="white">
398
+
399
+ // Tailwind CSS colors
400
+ <div className="bg-blue-500 text-white">
401
+ ```
402
+
403
+ ### 3. Responsive Design
404
+
405
+ ```tsx
406
+ // Chakra UI responsive
407
+ <Box display={{ base: 'block', md: 'flex' }}>
408
+
409
+ // Tailwind CSS responsive
410
+ <div className="block md:flex">
411
+ ```
412
+
413
+ ### 4. State Management
414
+
415
+ ```tsx
416
+ // Chakra UI state
417
+ const [isOpen, setIsOpen] = useState(false);
418
+
419
+ // MachineMetrics state (same pattern)
420
+ const [isOpen, setIsOpen] = useState(false);
421
+ ```
422
+
423
+ ## Troubleshooting Common Issues
424
+
425
+ ### 1. Missing Dependencies
426
+
427
+ **Error**: `Module not found: Can't resolve '@machinemetrics/mm-react-components'`
428
+
429
+ **Solution**: Install the package
430
+
431
+ ```bash
432
+ npm install @machinemetrics/mm-react-components
433
+ ```
434
+
435
+ ### 2. Theme Not Applied
436
+
437
+ **Error**: Components don't have the expected styling
438
+
439
+ **Solution**: Ensure theme is imported and applied
440
+
441
+ ```tsx
442
+ import '@machinemetrics/mm-react-components/themes/carbide';
443
+
444
+ // Add to your app root
445
+ <div className="carbide">
446
+ <YourApp />
447
+ </div>;
448
+ ```
449
+
450
+ ### 3. Layout Components Not Working
451
+
452
+ **Error**: Layout components like `Box`, `Flex` not found
453
+
454
+ **Solution**: Replace with generic HTML elements and Tailwind classes
455
+
456
+ ```tsx
457
+ // Instead of <Box>, use <div>
458
+ // Instead of <Flex>, use <div className="flex">
459
+ ```
460
+
461
+ ### 4. Icons Not Displaying
462
+
463
+ **Error**: Icons not showing after migration
464
+
465
+ **Solution**: Update icon imports to Lucide React
466
+
467
+ ```tsx
468
+ // Before
469
+ import { AddIcon } from '@chakra-ui/icons';
470
+
471
+ // After
472
+ import { Plus } from 'lucide-react';
473
+ ```
474
+
475
+ ### 5. Form Components Not Working
476
+
477
+ **Error**: Form components not functioning properly
478
+
479
+ **Solution**: Use the new Form components from MachineMetrics
480
+
481
+ ```tsx
482
+ import {
483
+ Form,
484
+ FormField,
485
+ FormItem,
486
+ FormLabel,
487
+ FormControl,
488
+ } from '@machinemetrics/mm-react-components';
489
+ ```
490
+
491
+ ## Validation Checklist
492
+
493
+ After migration, verify:
494
+
495
+ - [ ] All Chakra UI imports removed
496
+ - [ ] MachineMetrics components imported correctly
497
+ - [ ] Theme applied with `carbide` class
498
+ - [ ] Layout components converted to HTML + Tailwind
499
+ - [ ] Icons updated to Lucide React
500
+ - [ ] Form components working correctly
501
+ - [ ] Modal/Dialog components functioning
502
+ - [ ] Styling matches original design
503
+ - [ ] No console errors
504
+ - [ ] All functionality preserved
505
+
506
+ ## Advanced Migration Scenarios
507
+
508
+ ### Custom Chakra Components
509
+
510
+ If you have custom components built on Chakra UI:
511
+
512
+ 1. Identify the base Chakra component used
513
+ 2. Replace with equivalent MachineMetrics component
514
+ 3. Update styling to use Tailwind classes
515
+ 4. Test functionality thoroughly
516
+
517
+ ### Complex Layout Migrations
518
+
519
+ For complex layouts:
520
+
521
+ 1. Break down into smaller components
522
+ 2. Convert each part individually
523
+ 3. Use Tailwind's flexbox and grid utilities
524
+ 4. Test responsive behavior
525
+
526
+ ### Animation Migrations
527
+
528
+ For animations:
529
+
530
+ 1. Replace Chakra's `Fade`, `Slide` with CSS transitions
531
+ 2. Use Tailwind's animation utilities
532
+ 3. Consider Framer Motion for complex animations
533
+
534
+ ## Support and Resources
535
+
536
+ - **Documentation**: [MachineMetrics Components Docs](https://components.machinemetrics.com)
537
+ - **GitHub**: [Component Library Repository](https://github.com/machinemetrics/mm-react-components)
538
+ - **Issues**: Report migration issues on GitHub
539
+ - **Community**: Join the MachineMetrics developer community
540
+
541
+ ## Migration Script Usage
542
+
543
+ The automated migration script can be run with:
544
+
545
+ ```bash
546
+ # Preview changes (dry run)
547
+ node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js
548
+
549
+ # Apply changes
550
+ node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply
551
+
552
+ # With verbose output
553
+ node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply --verbose
554
+ ```
555
+
556
+ ## Conclusion
557
+
558
+ This guide provides comprehensive instructions for migrating from Chakra UI to MachineMetrics React Components. The automated script handles most cases, but manual conversion may be necessary for complex scenarios. Always test thoroughly after migration to ensure functionality is preserved.