@machinemetrics/mm-react-components 0.2.3-3 → 0.2.3-6
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 +6 -25
- package/dist/README.md +6 -25
- package/dist/components/ui/progress.d.ts +1 -0
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/docs/GETTING_STARTED.md +3 -5
- package/dist/main.d.ts +1 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/mm-react-components.es.js.map +1 -1
- package/dist/mm-react-components.umd.js.map +1 -1
- package/dist/scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.config.json +536 -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 +105 -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/style.css +1 -0
- package/dist/tailwind.base.config.js +88 -0
- package/package.json +18 -8
- package/scripts/README.md +112 -112
- package/scripts/init.cjs +159 -0
- package/src/index.css +99 -489
- package/src/themes/carbide.css +379 -32
- package/dist/index.css +0 -527
- package/dist/themes/base.css +0 -536
- package/dist/themes/carbide.css +0 -1257
- package/dist/themes/complete.css +0 -8
- package/scripts/chakra-to-shadcn-migrator/README.md +0 -107
- package/src/themes/base.css +0 -536
- package/src/themes/complete.css +0 -8
- /package/{scripts → dist/scripts}/chakra-to-shadcn-migrator/bin/chakra-to-shadcn.js +0 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependenciesToRemove": [
|
|
3
|
+
"@chakra-ui/react",
|
|
4
|
+
"@chakra-ui/icons",
|
|
5
|
+
"@chakra-ui/system",
|
|
6
|
+
"@emotion/react",
|
|
7
|
+
"@emotion/styled"
|
|
8
|
+
],
|
|
9
|
+
"dependenciesToAdd": {
|
|
10
|
+
"@machinemetrics/mm-react-components": "beta",
|
|
11
|
+
"class-variance-authority": "^1.0.0",
|
|
12
|
+
"tailwind-merge": "^2.5.4",
|
|
13
|
+
"lucide-react": "^0.469.0",
|
|
14
|
+
"react-day-picker": "^8.10.1",
|
|
15
|
+
"date-fns": "^3.6.0",
|
|
16
|
+
"recharts": "^2.12.7",
|
|
17
|
+
"react-dropzone": "^14.2.3",
|
|
18
|
+
"sonner": "^1.4.41",
|
|
19
|
+
"vaul": "^0.9.0",
|
|
20
|
+
"@radix-ui/react-avatar": "^1.1.1",
|
|
21
|
+
"@radix-ui/react-breadcrumb": "^1.1.0",
|
|
22
|
+
"@radix-ui/react-calendar": "^1.0.0",
|
|
23
|
+
"@radix-ui/react-alert-dialog": "^1.1.2",
|
|
24
|
+
"@radix-ui/react-separator": "^1.1.0",
|
|
25
|
+
"@radix-ui/react-form": "^0.1.0",
|
|
26
|
+
"@radix-ui/react-textarea": "^1.0.0",
|
|
27
|
+
"@radix-ui/react-toast": "^1.2.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependenciesToAdd": {
|
|
30
|
+
"tailwindcss": "^3.4.15",
|
|
31
|
+
"postcss": "^8.4.49",
|
|
32
|
+
"autoprefixer": "^10.4.20"
|
|
33
|
+
},
|
|
34
|
+
"providerInstructions": [
|
|
35
|
+
"Remove <ChakraProvider> wrapper from your app root (usually in src/index.tsx or src/main.tsx).",
|
|
36
|
+
"Import the Carbide theme CSS: import '@machinemetrics/mm-react-components/themes/carbide' in your main entry file (e.g., src/index.tsx or src/main.tsx).",
|
|
37
|
+
"Add the Carbide theme class to your app root element: <div className=\"carbide\"> to enable Carbide theming.",
|
|
38
|
+
"For dark mode support, add both classes: <div className=\"carbide dark\">",
|
|
39
|
+
"Remove Chakra-specific theme files and configurations.",
|
|
40
|
+
"Update any custom Chakra theme tokens to use Tailwind CSS custom properties instead."
|
|
41
|
+
],
|
|
42
|
+
"manualMigrationComponents": {
|
|
43
|
+
"layoutComponents": [
|
|
44
|
+
"Box → Replace with <div> element and add appropriate Tailwind classes",
|
|
45
|
+
"Flex → Replace with <div className='flex'> and add flex-related Tailwind classes",
|
|
46
|
+
"VStack → Replace with <div className='flex flex-col gap-4'> and adjust spacing as needed",
|
|
47
|
+
"HStack → Replace with <div className='flex flex-row gap-4'> and adjust spacing as needed",
|
|
48
|
+
"Stack → Replace with <div className='flex flex-col gap-4'> and adjust direction/spacing as needed",
|
|
49
|
+
"Container → Replace with <div className='container mx-auto px-4'> and adjust max-width as needed",
|
|
50
|
+
"Center → Replace with <div className='flex items-center justify-center'>",
|
|
51
|
+
"SimpleGrid → Replace with <div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4'> and adjust columns as needed"
|
|
52
|
+
],
|
|
53
|
+
"typographyComponents": [
|
|
54
|
+
"Heading → Replace with semantic heading elements (h1, h2, h3, etc.) and add Tailwind typography classes",
|
|
55
|
+
"Text → Replace with semantic text elements (p, span, etc.) and add Tailwind typography classes"
|
|
56
|
+
],
|
|
57
|
+
"formComponents": [
|
|
58
|
+
"Field → Replace with <div> wrapper and use shadcn/ui form components for inputs",
|
|
59
|
+
"NumberInput → Replace with <input type='number'> and add Tailwind classes, or use shadcn/ui Input component",
|
|
60
|
+
"Slider → Replace with <input type='range'> and add Tailwind classes, or use shadcn/ui Slider component",
|
|
61
|
+
"NativeSelect → Replace with <select> and add Tailwind classes, or use shadcn/ui Select component"
|
|
62
|
+
],
|
|
63
|
+
"uiComponents": [
|
|
64
|
+
"IconButton → Replace with <button> and add icon + Tailwind classes, or use shadcn/ui Button with icon variant",
|
|
65
|
+
"Card → Replace with <div className='rounded-lg border bg-card p-6'> and add shadcn/ui Card component",
|
|
66
|
+
"Alert → Replace with <div className='rounded-md border p-4'> and add shadcn/ui Alert component",
|
|
67
|
+
"Portal → Replace with <div> and use React Portal or shadcn/ui Portal component",
|
|
68
|
+
"Separator → Replace with <hr className='border-t'> and add shadcn/ui Separator component",
|
|
69
|
+
"Progress → Replace with <div className='w-full bg-gray-200 rounded-full h-2'> and add shadcn/ui Progress component",
|
|
70
|
+
"Spinner → Replace with <div className='animate-spin rounded-full h-4 w-4 border-b-2 border-gray-900'> and add shadcn/ui Spinner component",
|
|
71
|
+
"Icon → Replace with Lucide React icons and add appropriate Tailwind classes",
|
|
72
|
+
"Avatar → Replace with shadcn/ui Avatar component",
|
|
73
|
+
"Breadcrumb → Replace with shadcn/ui Breadcrumb component",
|
|
74
|
+
"Calendar → Replace with shadcn/ui Calendar component",
|
|
75
|
+
"DateRangePicker → Replace with shadcn/ui DateRangePicker component",
|
|
76
|
+
"Form → Replace with shadcn/ui Form components (Form, FormField, FormItem, etc.)",
|
|
77
|
+
"Textarea → Replace with shadcn/ui Textarea component",
|
|
78
|
+
"Toaster → Replace with shadcn/ui Toaster component",
|
|
79
|
+
"AlertDialog → Replace with shadcn/ui AlertDialog component",
|
|
80
|
+
"Chart → Replace with shadcn/ui Chart components (ChartContainer, ChartTooltip, etc.)",
|
|
81
|
+
"Dropzone → Replace with shadcn/ui Dropzone component",
|
|
82
|
+
"SearchInput → Replace with shadcn/ui SearchInput component"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
"migrationInstructions": {
|
|
86
|
+
"layoutComponents": [
|
|
87
|
+
"Layout components (Box, Flex, VStack, HStack, Stack, Container, Center, SimpleGrid) are replaced with generic JSX elements and Tailwind CSS classes.",
|
|
88
|
+
"Box → <div> with appropriate Tailwind classes",
|
|
89
|
+
"Flex → <div className='flex'> with flex-related Tailwind classes",
|
|
90
|
+
"VStack → <div className='flex flex-col gap-4'> (adjust spacing as needed)",
|
|
91
|
+
"HStack → <div className='flex flex-row gap-4'> (adjust spacing as needed)",
|
|
92
|
+
"Stack → <div className='flex flex-col gap-4'> (adjust direction/spacing as needed)",
|
|
93
|
+
"Container → <div className='container mx-auto px-4'> (adjust max-width as needed)",
|
|
94
|
+
"Center → <div className='flex items-center justify-center'>",
|
|
95
|
+
"SimpleGrid → <div className='grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4'> (adjust columns as needed)"
|
|
96
|
+
],
|
|
97
|
+
"typographyComponents": [
|
|
98
|
+
"Typography components (Heading, Text) are replaced with semantic HTML elements and Tailwind typography classes.",
|
|
99
|
+
"Heading → <h1>, <h2>, <h3>, etc. with appropriate Tailwind typography classes",
|
|
100
|
+
"Text → <p>, <span>, etc. with appropriate Tailwind typography classes",
|
|
101
|
+
"Use Tailwind's typography scale (text-sm, text-base, text-lg, etc.) for sizing"
|
|
102
|
+
],
|
|
103
|
+
"formComponents": [
|
|
104
|
+
"Form components (Field, NumberInput, Slider, NativeSelect) are replaced with native HTML elements and Tailwind classes.",
|
|
105
|
+
"Field → <div> wrapper with shadcn/ui form components for inputs",
|
|
106
|
+
"NumberInput → <input type='number'> with Tailwind classes, or use shadcn/ui Input",
|
|
107
|
+
"Slider → <input type='range'> with Tailwind classes, or use shadcn/ui Slider",
|
|
108
|
+
"NativeSelect → <select> with Tailwind classes, or use shadcn/ui Select"
|
|
109
|
+
],
|
|
110
|
+
"uiComponents": [
|
|
111
|
+
"UI components (IconButton, Card, Alert, Portal, Separator, Progress, Spinner, Icon, Avatar, Breadcrumb, Calendar, DateRangePicker, Form, Textarea, Toaster, AlertDialog, Chart, Dropzone, SearchInput) are replaced with shadcn/ui components or generic JSX elements and Tailwind classes.",
|
|
112
|
+
"IconButton → <button> with icon + Tailwind classes, or use shadcn/ui Button with icon variant",
|
|
113
|
+
"Card → <div className='rounded-lg border bg-card p-6'> and add shadcn/ui Card component",
|
|
114
|
+
"Alert → <div className='rounded-md border p-4'> and add shadcn/ui Alert component",
|
|
115
|
+
"Portal → <div> and use React Portal or shadcn/ui Portal component",
|
|
116
|
+
"Separator → <hr className='border-t'> and add shadcn/ui Separator component",
|
|
117
|
+
"Progress → <div className='w-full bg-gray-200 rounded-full h-2'> and add shadcn/ui Progress component",
|
|
118
|
+
"Spinner → <div className='animate-spin rounded-full h-4 w-4 border-b-2 border-gray-900'> and add shadcn/ui Spinner component",
|
|
119
|
+
"Icon → Lucide React icons with appropriate Tailwind classes",
|
|
120
|
+
"Avatar → shadcn/ui Avatar component",
|
|
121
|
+
"Breadcrumb → shadcn/ui Breadcrumb component",
|
|
122
|
+
"Calendar → shadcn/ui Calendar component",
|
|
123
|
+
"DateRangePicker → shadcn/ui DateRangePicker component",
|
|
124
|
+
"Form → shadcn/ui Form components (Form, FormField, FormItem, FormLabel, FormControl, FormDescription, FormMessage)",
|
|
125
|
+
"Textarea → shadcn/ui Textarea component",
|
|
126
|
+
"Toaster → shadcn/ui Toaster component",
|
|
127
|
+
"AlertDialog → shadcn/ui AlertDialog component",
|
|
128
|
+
"Chart → shadcn/ui Chart components (ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle)",
|
|
129
|
+
"Dropzone → shadcn/ui Dropzone component",
|
|
130
|
+
"SearchInput → shadcn/ui SearchInput component"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"moduleMappings": {
|
|
134
|
+
"@chakra-ui/react": {
|
|
135
|
+
"jsxSpecifiers": {
|
|
136
|
+
"Box": { "tag": "div", "class": "" },
|
|
137
|
+
"Flex": { "tag": "div", "class": "flex" },
|
|
138
|
+
"VStack": { "tag": "div", "class": "flex flex-col gap-4" },
|
|
139
|
+
"HStack": { "tag": "div", "class": "flex flex-row gap-4" },
|
|
140
|
+
"Stack": { "tag": "div", "class": "flex flex-col gap-4" },
|
|
141
|
+
"Container": { "tag": "div", "class": "container mx-auto px-4" },
|
|
142
|
+
"Center": { "tag": "div", "class": "flex items-center justify-center" },
|
|
143
|
+
"SimpleGrid": { "tag": "div", "class": "grid gap-4" },
|
|
144
|
+
"Heading": { "tag": "h2", "class": "font-semibold" },
|
|
145
|
+
"Text": { "tag": "p", "class": "" },
|
|
146
|
+
"Portal": { "tag": "div", "class": "" },
|
|
147
|
+
"Separator": { "tag": "hr", "class": "border-t" },
|
|
148
|
+
"IconButton": {
|
|
149
|
+
"tag": "button",
|
|
150
|
+
"class": "inline-flex items-center justify-center"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"specifiers": {
|
|
154
|
+
"Badge": {
|
|
155
|
+
"module": "@machinemetrics/mm-react-components",
|
|
156
|
+
"import": "Badge"
|
|
157
|
+
},
|
|
158
|
+
"Button": {
|
|
159
|
+
"module": "@machinemetrics/mm-react-components",
|
|
160
|
+
"import": "Button"
|
|
161
|
+
},
|
|
162
|
+
"Modal": {
|
|
163
|
+
"module": "@machinemetrics/mm-react-components",
|
|
164
|
+
"import": "Dialog"
|
|
165
|
+
},
|
|
166
|
+
"Input": {
|
|
167
|
+
"module": "@machinemetrics/mm-react-components",
|
|
168
|
+
"import": "Input"
|
|
169
|
+
},
|
|
170
|
+
"Menu": {
|
|
171
|
+
"module": "@machinemetrics/mm-react-components",
|
|
172
|
+
"import": "DropdownMenu"
|
|
173
|
+
},
|
|
174
|
+
"Select": {
|
|
175
|
+
"module": "@machinemetrics/mm-react-components",
|
|
176
|
+
"import": "Select"
|
|
177
|
+
},
|
|
178
|
+
"Table": {
|
|
179
|
+
"module": "@machinemetrics/mm-react-components",
|
|
180
|
+
"import": "Table"
|
|
181
|
+
},
|
|
182
|
+
"Tabs": {
|
|
183
|
+
"module": "@machinemetrics/mm-react-components",
|
|
184
|
+
"import": "Tabs"
|
|
185
|
+
},
|
|
186
|
+
"Tooltip": {
|
|
187
|
+
"module": "@machinemetrics/mm-react-components",
|
|
188
|
+
"import": "Tooltip"
|
|
189
|
+
},
|
|
190
|
+
"Drawer": {
|
|
191
|
+
"module": "@machinemetrics/mm-react-components",
|
|
192
|
+
"import": "Drawer"
|
|
193
|
+
},
|
|
194
|
+
"Switch": {
|
|
195
|
+
"module": "@machinemetrics/mm-react-components",
|
|
196
|
+
"import": "Switch"
|
|
197
|
+
},
|
|
198
|
+
"Checkbox": {
|
|
199
|
+
"module": "@machinemetrics/mm-react-components",
|
|
200
|
+
"import": "Checkbox"
|
|
201
|
+
},
|
|
202
|
+
"Radio": {
|
|
203
|
+
"module": "@machinemetrics/mm-react-components",
|
|
204
|
+
"import": "RadioGroupItem"
|
|
205
|
+
},
|
|
206
|
+
"RadioGroup": {
|
|
207
|
+
"module": "@machinemetrics/mm-react-components",
|
|
208
|
+
"import": "RadioGroup"
|
|
209
|
+
},
|
|
210
|
+
"Label": {
|
|
211
|
+
"module": "@machinemetrics/mm-react-components",
|
|
212
|
+
"import": "Label"
|
|
213
|
+
},
|
|
214
|
+
"FormLabel": {
|
|
215
|
+
"module": "@machinemetrics/mm-react-components",
|
|
216
|
+
"import": "Label"
|
|
217
|
+
},
|
|
218
|
+
"Sheet": {
|
|
219
|
+
"module": "@machinemetrics/mm-react-components",
|
|
220
|
+
"import": "Sheet"
|
|
221
|
+
},
|
|
222
|
+
"Skeleton": {
|
|
223
|
+
"module": "@machinemetrics/mm-react-components",
|
|
224
|
+
"import": "Skeleton"
|
|
225
|
+
},
|
|
226
|
+
"Collapse": {
|
|
227
|
+
"module": "@machinemetrics/mm-react-components",
|
|
228
|
+
"import": "Collapsible"
|
|
229
|
+
},
|
|
230
|
+
"Collapsible": {
|
|
231
|
+
"module": "@machinemetrics/mm-react-components",
|
|
232
|
+
"import": "Collapsible"
|
|
233
|
+
},
|
|
234
|
+
"Accordion": {
|
|
235
|
+
"module": "@machinemetrics/mm-react-components",
|
|
236
|
+
"import": "Accordion"
|
|
237
|
+
},
|
|
238
|
+
"DataTable": {
|
|
239
|
+
"module": "@machinemetrics/mm-react-components",
|
|
240
|
+
"import": "DataTable"
|
|
241
|
+
},
|
|
242
|
+
"Progress": {
|
|
243
|
+
"module": "@machinemetrics/mm-react-components",
|
|
244
|
+
"import": "Progress"
|
|
245
|
+
},
|
|
246
|
+
"Slider": {
|
|
247
|
+
"module": "@machinemetrics/mm-react-components",
|
|
248
|
+
"import": "Slider"
|
|
249
|
+
},
|
|
250
|
+
"Popover": {
|
|
251
|
+
"module": "@machinemetrics/mm-react-components",
|
|
252
|
+
"import": "Popover"
|
|
253
|
+
},
|
|
254
|
+
"PopoverTrigger": {
|
|
255
|
+
"module": "@machinemetrics/mm-react-components",
|
|
256
|
+
"import": "PopoverTrigger"
|
|
257
|
+
},
|
|
258
|
+
"PopoverContent": {
|
|
259
|
+
"module": "@machinemetrics/mm-react-components",
|
|
260
|
+
"import": "PopoverContent"
|
|
261
|
+
},
|
|
262
|
+
"PopoverAnchor": {
|
|
263
|
+
"module": "@machinemetrics/mm-react-components",
|
|
264
|
+
"import": "PopoverAnchor"
|
|
265
|
+
},
|
|
266
|
+
"ModalOverlay": {
|
|
267
|
+
"module": "@machinemetrics/mm-react-components",
|
|
268
|
+
"import": "DialogOverlay"
|
|
269
|
+
},
|
|
270
|
+
"ModalContent": {
|
|
271
|
+
"module": "@machinemetrics/mm-react-components",
|
|
272
|
+
"import": "DialogContent"
|
|
273
|
+
},
|
|
274
|
+
"ModalHeader": {
|
|
275
|
+
"module": "@machinemetrics/mm-react-components",
|
|
276
|
+
"import": "DialogHeader"
|
|
277
|
+
},
|
|
278
|
+
"ModalFooter": {
|
|
279
|
+
"module": "@machinemetrics/mm-react-components",
|
|
280
|
+
"import": "DialogFooter"
|
|
281
|
+
},
|
|
282
|
+
"ModalBody": {
|
|
283
|
+
"module": "@machinemetrics/mm-react-components",
|
|
284
|
+
"import": "DialogContent"
|
|
285
|
+
},
|
|
286
|
+
"DrawerOverlay": {
|
|
287
|
+
"module": "@machinemetrics/mm-react-components",
|
|
288
|
+
"import": "DrawerOverlay"
|
|
289
|
+
},
|
|
290
|
+
"DrawerContent": {
|
|
291
|
+
"module": "@machinemetrics/mm-react-components",
|
|
292
|
+
"import": "DrawerContent"
|
|
293
|
+
},
|
|
294
|
+
"DrawerHeader": {
|
|
295
|
+
"module": "@machinemetrics/mm-react-components",
|
|
296
|
+
"import": "DrawerHeader"
|
|
297
|
+
},
|
|
298
|
+
"DrawerFooter": {
|
|
299
|
+
"module": "@machinemetrics/mm-react-components",
|
|
300
|
+
"import": "DrawerFooter"
|
|
301
|
+
},
|
|
302
|
+
"DrawerCloseButton": {
|
|
303
|
+
"module": "@machinemetrics/mm-react-components",
|
|
304
|
+
"import": "DrawerClose"
|
|
305
|
+
},
|
|
306
|
+
"AccordionItem": {
|
|
307
|
+
"module": "@machinemetrics/mm-react-components",
|
|
308
|
+
"import": "AccordionItem"
|
|
309
|
+
},
|
|
310
|
+
"AccordionButton": {
|
|
311
|
+
"module": "@machinemetrics/mm-react-components",
|
|
312
|
+
"import": "AccordionTrigger"
|
|
313
|
+
},
|
|
314
|
+
"AccordionPanel": {
|
|
315
|
+
"module": "@machinemetrics/mm-react-components",
|
|
316
|
+
"import": "AccordionContent"
|
|
317
|
+
},
|
|
318
|
+
"Alert": {
|
|
319
|
+
"module": "@machinemetrics/mm-react-components",
|
|
320
|
+
"import": "Alert"
|
|
321
|
+
},
|
|
322
|
+
"AlertDialog": {
|
|
323
|
+
"module": "@machinemetrics/mm-react-components",
|
|
324
|
+
"import": "AlertDialog"
|
|
325
|
+
},
|
|
326
|
+
"Avatar": {
|
|
327
|
+
"module": "@machinemetrics/mm-react-components",
|
|
328
|
+
"import": "Avatar"
|
|
329
|
+
},
|
|
330
|
+
"Breadcrumb": {
|
|
331
|
+
"module": "@machinemetrics/mm-react-components",
|
|
332
|
+
"import": "Breadcrumb"
|
|
333
|
+
},
|
|
334
|
+
"Calendar": {
|
|
335
|
+
"module": "@machinemetrics/mm-react-components",
|
|
336
|
+
"import": "Calendar"
|
|
337
|
+
},
|
|
338
|
+
"DateRangePicker": {
|
|
339
|
+
"module": "@machinemetrics/mm-react-components",
|
|
340
|
+
"import": "DateRangePicker"
|
|
341
|
+
},
|
|
342
|
+
"Form": {
|
|
343
|
+
"module": "@machinemetrics/mm-react-components",
|
|
344
|
+
"import": "Form"
|
|
345
|
+
},
|
|
346
|
+
"FormField": {
|
|
347
|
+
"module": "@machinemetrics/mm-react-components",
|
|
348
|
+
"import": "FormField"
|
|
349
|
+
},
|
|
350
|
+
"FormItem": {
|
|
351
|
+
"module": "@machinemetrics/mm-react-components",
|
|
352
|
+
"import": "FormItem"
|
|
353
|
+
},
|
|
354
|
+
"FormControl": {
|
|
355
|
+
"module": "@machinemetrics/mm-react-components",
|
|
356
|
+
"import": "FormControl"
|
|
357
|
+
},
|
|
358
|
+
"FormDescription": {
|
|
359
|
+
"module": "@machinemetrics/mm-react-components",
|
|
360
|
+
"import": "FormDescription"
|
|
361
|
+
},
|
|
362
|
+
"FormMessage": {
|
|
363
|
+
"module": "@machinemetrics/mm-react-components",
|
|
364
|
+
"import": "FormMessage"
|
|
365
|
+
},
|
|
366
|
+
"Separator": {
|
|
367
|
+
"module": "@machinemetrics/mm-react-components",
|
|
368
|
+
"import": "Separator"
|
|
369
|
+
},
|
|
370
|
+
"Textarea": {
|
|
371
|
+
"module": "@machinemetrics/mm-react-components",
|
|
372
|
+
"import": "Textarea"
|
|
373
|
+
},
|
|
374
|
+
"Toaster": {
|
|
375
|
+
"module": "@machinemetrics/mm-react-components",
|
|
376
|
+
"import": "Toaster"
|
|
377
|
+
},
|
|
378
|
+
"ChartContainer": {
|
|
379
|
+
"module": "@machinemetrics/mm-react-components",
|
|
380
|
+
"import": "ChartContainer"
|
|
381
|
+
},
|
|
382
|
+
"ChartTooltip": {
|
|
383
|
+
"module": "@machinemetrics/mm-react-components",
|
|
384
|
+
"import": "ChartTooltip"
|
|
385
|
+
},
|
|
386
|
+
"ChartTooltipContent": {
|
|
387
|
+
"module": "@machinemetrics/mm-react-components",
|
|
388
|
+
"import": "ChartTooltipContent"
|
|
389
|
+
},
|
|
390
|
+
"ChartLegend": {
|
|
391
|
+
"module": "@machinemetrics/mm-react-components",
|
|
392
|
+
"import": "ChartLegend"
|
|
393
|
+
},
|
|
394
|
+
"ChartLegendContent": {
|
|
395
|
+
"module": "@machinemetrics/mm-react-components",
|
|
396
|
+
"import": "ChartLegendContent"
|
|
397
|
+
},
|
|
398
|
+
"ChartStyle": {
|
|
399
|
+
"module": "@machinemetrics/mm-react-components",
|
|
400
|
+
"import": "ChartStyle"
|
|
401
|
+
},
|
|
402
|
+
"Dropzone": {
|
|
403
|
+
"module": "@machinemetrics/mm-react-components",
|
|
404
|
+
"import": "Dropzone"
|
|
405
|
+
},
|
|
406
|
+
"DropzoneContent": {
|
|
407
|
+
"module": "@machinemetrics/mm-react-components",
|
|
408
|
+
"import": "DropzoneContent"
|
|
409
|
+
},
|
|
410
|
+
"DropzoneEmptyState": {
|
|
411
|
+
"module": "@machinemetrics/mm-react-components",
|
|
412
|
+
"import": "DropzoneEmptyState"
|
|
413
|
+
},
|
|
414
|
+
"SearchInput": {
|
|
415
|
+
"module": "@machinemetrics/mm-react-components",
|
|
416
|
+
"import": "SearchInput"
|
|
417
|
+
},
|
|
418
|
+
"LabeledSlider": {
|
|
419
|
+
"module": "@machinemetrics/mm-react-components",
|
|
420
|
+
"import": "LabeledSlider"
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"compoundComponents": {
|
|
424
|
+
"Alert.Root": { "tag": "div", "class": "rounded-md border p-4" },
|
|
425
|
+
"Alert.Indicator": { "remove": true },
|
|
426
|
+
"Alert.Content": { "tag": "div", "class": "flex-1" },
|
|
427
|
+
"Alert.Title": { "tag": "h5", "class": "font-medium mb-1" },
|
|
428
|
+
"Alert.Description": { "tag": "div", "class": "text-sm" },
|
|
429
|
+
"Modal": { "component": "Dialog" },
|
|
430
|
+
"Dialog.Root": { "component": "Dialog" },
|
|
431
|
+
"Dialog.Backdrop": { "remove": true },
|
|
432
|
+
"Dialog.Positioner": { "unwrap": true },
|
|
433
|
+
"Dialog.Content": { "component": "DialogContent" },
|
|
434
|
+
"Dialog.Header": { "component": "DialogHeader" },
|
|
435
|
+
"Dialog.Title": { "component": "DialogTitle" },
|
|
436
|
+
"Dialog.Description": { "component": "DialogDescription" },
|
|
437
|
+
"Dialog.Body": { "unwrap": true },
|
|
438
|
+
"Dialog.Footer": { "component": "DialogFooter" },
|
|
439
|
+
"Dialog.CloseTrigger": { "component": "DialogClose" },
|
|
440
|
+
"Drawer.Root": { "component": "Drawer" },
|
|
441
|
+
"Drawer.Trigger": { "component": "DrawerTrigger" },
|
|
442
|
+
"Drawer.CloseTrigger": { "component": "DrawerClose" },
|
|
443
|
+
"Drawer.Portal": { "component": "DrawerPortal" },
|
|
444
|
+
"Drawer.Overlay": { "component": "DrawerOverlay" },
|
|
445
|
+
"Drawer.Content": { "component": "DrawerContent" },
|
|
446
|
+
"Drawer.Header": { "component": "DrawerHeader" },
|
|
447
|
+
"Drawer.Footer": { "component": "DrawerFooter" },
|
|
448
|
+
"Drawer.Title": { "component": "DrawerTitle" },
|
|
449
|
+
"Drawer.Description": { "component": "DrawerDescription" },
|
|
450
|
+
"Drawer.Handle": { "component": "DrawerHandle" },
|
|
451
|
+
"Collapse": { "component": "Collapsible" },
|
|
452
|
+
"Accordion.Root": { "component": "Accordion" },
|
|
453
|
+
"Accordion.Item": { "component": "AccordionItem" },
|
|
454
|
+
"Accordion.Trigger": { "component": "AccordionTrigger" },
|
|
455
|
+
"Accordion.Content": { "component": "AccordionContent" },
|
|
456
|
+
"Tabs.Root": { "component": "Tabs" },
|
|
457
|
+
"Tabs.List": { "component": "TabsList" },
|
|
458
|
+
"Tabs.Trigger": { "component": "TabsTrigger" },
|
|
459
|
+
"Tabs.Content": { "component": "TabsContent" },
|
|
460
|
+
"Tabs.Indicator": { "remove": true },
|
|
461
|
+
"Table.Root": { "component": "Table" },
|
|
462
|
+
"Table.Header": { "component": "TableHeader" },
|
|
463
|
+
"Table.Body": { "component": "TableBody" },
|
|
464
|
+
"Table.Row": { "component": "TableRow" },
|
|
465
|
+
"Table.ColumnHeader": { "component": "TableHead" },
|
|
466
|
+
"Table.Cell": { "component": "TableCell" },
|
|
467
|
+
"Table.Footer": { "component": "TableFooter" },
|
|
468
|
+
"Menu.Root": { "component": "DropdownMenu" },
|
|
469
|
+
"Menu.Trigger": { "component": "DropdownMenuTrigger" },
|
|
470
|
+
"Menu.Content": { "component": "DropdownMenuContent" },
|
|
471
|
+
"Menu.Item": { "component": "DropdownMenuItem" },
|
|
472
|
+
"Menu.Separator": { "component": "DropdownMenuSeparator" },
|
|
473
|
+
"Menu.ItemGroup": { "unwrap": true },
|
|
474
|
+
"Menu.ItemGroupLabel": { "component": "DropdownMenuLabel" },
|
|
475
|
+
"Popover.Root": { "component": "Popover" },
|
|
476
|
+
"Popover.Trigger": { "component": "PopoverTrigger" },
|
|
477
|
+
"Popover.Content": { "component": "PopoverContent" },
|
|
478
|
+
"Popover.Anchor": { "component": "PopoverAnchor" },
|
|
479
|
+
"AlertDialog.Root": { "component": "AlertDialog" },
|
|
480
|
+
"AlertDialog.Trigger": { "component": "AlertDialogTrigger" },
|
|
481
|
+
"AlertDialog.Content": { "component": "AlertDialogContent" },
|
|
482
|
+
"AlertDialog.Header": { "component": "AlertDialogHeader" },
|
|
483
|
+
"AlertDialog.Footer": { "component": "AlertDialogFooter" },
|
|
484
|
+
"AlertDialog.Title": { "component": "AlertDialogTitle" },
|
|
485
|
+
"AlertDialog.Description": { "component": "AlertDialogDescription" },
|
|
486
|
+
"AlertDialog.Action": { "component": "AlertDialogAction" },
|
|
487
|
+
"AlertDialog.Cancel": { "component": "AlertDialogCancel" },
|
|
488
|
+
"AlertDialog.Overlay": { "component": "AlertDialogOverlay" },
|
|
489
|
+
"AlertDialog.Portal": { "component": "AlertDialogPortal" },
|
|
490
|
+
"Avatar.Root": { "component": "Avatar" },
|
|
491
|
+
"Avatar.Image": { "component": "AvatarImage" },
|
|
492
|
+
"Avatar.Fallback": { "component": "AvatarFallback" },
|
|
493
|
+
"Breadcrumb.Root": { "component": "Breadcrumb" },
|
|
494
|
+
"Breadcrumb.List": { "component": "BreadcrumbList" },
|
|
495
|
+
"Breadcrumb.Item": { "component": "BreadcrumbItem" },
|
|
496
|
+
"Breadcrumb.Link": { "component": "BreadcrumbLink" },
|
|
497
|
+
"Breadcrumb.Page": { "component": "BreadcrumbPage" },
|
|
498
|
+
"Breadcrumb.Separator": { "component": "BreadcrumbSeparator" },
|
|
499
|
+
"Breadcrumb.Ellipsis": { "component": "BreadcrumbEllipsis" },
|
|
500
|
+
"Card.Root": { "component": "Card" },
|
|
501
|
+
"Card.Header": { "component": "CardHeader" },
|
|
502
|
+
"Card.Title": { "component": "CardTitle" },
|
|
503
|
+
"Card.Description": { "component": "CardDescription" },
|
|
504
|
+
"Card.Content": { "component": "CardContent" },
|
|
505
|
+
"Card.Footer": { "component": "CardFooter" },
|
|
506
|
+
"Form.Root": { "component": "Form" },
|
|
507
|
+
"Form.Field": { "component": "FormField" },
|
|
508
|
+
"Form.Item": { "component": "FormItem" },
|
|
509
|
+
"Form.Label": { "component": "FormLabel" },
|
|
510
|
+
"Form.Control": { "component": "FormControl" },
|
|
511
|
+
"Form.Description": { "component": "FormDescription" },
|
|
512
|
+
"Form.Message": { "component": "FormMessage" }
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
"@chakra-ui/icons": {
|
|
516
|
+
"default": {
|
|
517
|
+
"module": "lucide-react"
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
"postSteps": [
|
|
522
|
+
"Run npm install to sync dependencies.",
|
|
523
|
+
"Execute npx tailwindcss init -p if the project does not already have Tailwind/PostCSS configuration.",
|
|
524
|
+
"Review and update any custom Chakra theme tokens to use Tailwind CSS custom properties.",
|
|
525
|
+
"Update icon imports from @chakra-ui/icons to lucide-react throughout your codebase.",
|
|
526
|
+
"MANUAL MIGRATION REQUIRED: Replace the following Chakra components with generic JSX elements and Tailwind classes:",
|
|
527
|
+
" - Layout: Box, Flex, VStack, HStack, Stack, Container, Center, SimpleGrid",
|
|
528
|
+
" - Typography: Heading, Text",
|
|
529
|
+
" - Form: Field, NumberInput, Slider, NativeSelect",
|
|
530
|
+
" - UI: IconButton, Card, Alert, Portal, Separator, Progress, Spinner, Icon, Avatar, Breadcrumb, Calendar, DateRangePicker, Form, Textarea, Toaster, AlertDialog, Chart, Dropzone, SearchInput",
|
|
531
|
+
"See the manualMigrationComponents section in the config for specific replacement instructions.",
|
|
532
|
+
"Test all manually migrated components to ensure proper styling and functionality.",
|
|
533
|
+
"Run npm run lint && npm run test to verify the migration.",
|
|
534
|
+
"Consider creating a design system documentation for the new component APIs."
|
|
535
|
+
]
|
|
536
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import process from 'process';
|
|
2
|
+
import { colorize } from './colors.js';
|
|
3
|
+
|
|
4
|
+
export function parseArgs(argv) {
|
|
5
|
+
const args = { project: '.', apply: false, includeTests: false, source: [] };
|
|
6
|
+
const tokens = [...argv];
|
|
7
|
+
while (tokens.length) {
|
|
8
|
+
const token = tokens.shift();
|
|
9
|
+
switch (token) {
|
|
10
|
+
case '--project':
|
|
11
|
+
case '-p':
|
|
12
|
+
args.project = tokens.shift() ?? args.project;
|
|
13
|
+
break;
|
|
14
|
+
case '--config':
|
|
15
|
+
case '-c':
|
|
16
|
+
args.config = tokens.shift();
|
|
17
|
+
break;
|
|
18
|
+
case '--apply':
|
|
19
|
+
args.apply = true;
|
|
20
|
+
break;
|
|
21
|
+
case '--include-tests':
|
|
22
|
+
args.includeTests = true;
|
|
23
|
+
break;
|
|
24
|
+
case '--source': {
|
|
25
|
+
const next = tokens.shift();
|
|
26
|
+
if (!next) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
'--source requires a comma separated list of directories or glob patterns.',
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
args.source = next
|
|
32
|
+
.split(',')
|
|
33
|
+
.map((segment) => segment.trim())
|
|
34
|
+
.filter(Boolean);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case '--help':
|
|
38
|
+
case '-h':
|
|
39
|
+
printHelp();
|
|
40
|
+
process.exit(0);
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
if (token.startsWith('--')) {
|
|
44
|
+
console.warn(colorize(`Warning: unknown option ${token}`, 'yellow'));
|
|
45
|
+
}
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return args;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function printHelp() {
|
|
53
|
+
console.log(
|
|
54
|
+
`chakra-to-shadcn [options]\n\n` +
|
|
55
|
+
`Options:\n` +
|
|
56
|
+
` -p, --project <path> Project root (defaults to current directory)\n` +
|
|
57
|
+
` -c, --config <path> Path to chakra-to-shadcn.config.json\n` +
|
|
58
|
+
` --apply Apply safe automated edits\n` +
|
|
59
|
+
` --include-tests Include __tests__/ and *.test.* files while scanning\n` +
|
|
60
|
+
` --source <globs> Comma separated list of folders/globs to scan\n` +
|
|
61
|
+
` -h, --help Show this message\n`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const colors = {
|
|
2
|
+
reset: '\u001b[0m',
|
|
3
|
+
cyan: '\u001b[36m',
|
|
4
|
+
green: '\u001b[32m',
|
|
5
|
+
yellow: '\u001b[33m',
|
|
6
|
+
red: '\u001b[31m',
|
|
7
|
+
bold: '\u001b[1m',
|
|
8
|
+
gray: '\u001b[90m',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const colorize = (value, color) =>
|
|
12
|
+
`${colors[color] ?? ''}${value}${colors.reset}`;
|
|
13
|
+
|
|
14
|
+
export const bold = (value) => `${colors.bold}${value}${colors.reset}`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
export function resolveConfig(projectRoot, override) {
|
|
5
|
+
if (override) {
|
|
6
|
+
const explicit = path.resolve(process.cwd(), override);
|
|
7
|
+
return fs.existsSync(explicit) ? explicit : undefined;
|
|
8
|
+
}
|
|
9
|
+
const defaultPath = path.join(projectRoot, 'chakra-to-shadcn.config.json');
|
|
10
|
+
return fs.existsSync(defaultPath) ? defaultPath : undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function loadJson(file) {
|
|
14
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
15
|
+
}
|