@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.
- package/README.md +89 -30
- package/agent-docs/agent-documentation-reference.md +364 -0
- package/agent-docs/ai-agent-guide.md +558 -0
- package/agent-docs/ai-agent-init-guide.md +465 -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 +89 -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.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/command.d.ts +19 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/data-table/TableView.d.ts +1 -1
- package/dist/components/ui/data-table/TableView.d.ts.map +1 -1
- package/dist/components/ui/data-table/cards/ResponsiveTable.d.ts +1 -1
- package/dist/components/ui/data-table/cards/ResponsiveTable.d.ts.map +1 -1
- package/dist/components/ui/data-table/cards/RowCard.d.ts +2 -1
- package/dist/components/ui/data-table/cards/RowCard.d.ts.map +1 -1
- package/dist/components/ui/data-table/index.d.ts +3 -1
- package/dist/components/ui/data-table/index.d.ts.map +1 -1
- package/dist/components/ui/data-table/pagination.d.ts +3 -1
- package/dist/components/ui/data-table/pagination.d.ts.map +1 -1
- package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts +7 -0
- package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/CellContent.d.ts +7 -0
- package/dist/components/ui/data-table/parts/CellContent.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/ColGroup.d.ts +7 -0
- package/dist/components/ui/data-table/parts/ColGroup.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/SortableHeader.d.ts +13 -0
- package/dist/components/ui/data-table/parts/SortableHeader.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/TableBody.d.ts +11 -0
- package/dist/components/ui/data-table/parts/TableBody.d.ts.map +1 -0
- package/dist/components/ui/data-table/parts/TableHeader.d.ts +15 -0
- package/dist/components/ui/data-table/parts/TableHeader.d.ts.map +1 -0
- package/dist/components/ui/data-table/toolbar/DataTableToolbar.d.ts +2 -1
- package/dist/components/ui/data-table/toolbar/DataTableToolbar.d.ts.map +1 -1
- package/dist/components/ui/data-table/types.d.ts +33 -10
- package/dist/components/ui/data-table/types.d.ts.map +1 -1
- package/dist/components/ui/data-table/useTableController.d.ts +12 -1
- package/dist/components/ui/data-table/useTableController.d.ts.map +1 -1
- package/dist/components/ui/data-table/utils.d.ts +2 -0
- package/dist/components/ui/data-table/utils.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +36 -0
- package/dist/components/ui/date-picker.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/form.d.ts +25 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/HeroMetricCard.d.ts +4 -0
- package/dist/components/ui/hero-metric-card/HeroMetricCard.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/HeroMetricCardItem.d.ts +4 -0
- package/dist/components/ui/hero-metric-card/HeroMetricCardItem.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/constants.d.ts +13 -0
- package/dist/components/ui/hero-metric-card/constants.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/grid.d.ts +4 -0
- package/dist/components/ui/hero-metric-card/grid.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/hooks.d.ts +6 -0
- package/dist/components/ui/hero-metric-card/hooks.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/index.d.ts +5 -0
- package/dist/components/ui/hero-metric-card/index.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/parsing.d.ts +11 -0
- package/dist/components/ui/hero-metric-card/parsing.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/refs.d.ts +3 -0
- package/dist/components/ui/hero-metric-card/refs.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/trend.d.ts +4 -0
- package/dist/components/ui/hero-metric-card/trend.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/types.d.ts +60 -0
- package/dist/components/ui/hero-metric-card/types.d.ts.map +1 -0
- package/dist/components/ui/hero-metric-card/utils.d.ts +10 -0
- package/dist/components/ui/hero-metric-card/utils.d.ts.map +1 -0
- package/dist/components/ui/pagination.d.ts +14 -0
- package/dist/components/ui/pagination.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/simple-pagination.d.ts +8 -0
- package/dist/components/ui/simple-pagination.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/spinner-carbide.d.ts +5 -0
- package/dist/components/ui/spinner-carbide.d.ts.map +1 -0
- package/dist/components/ui/spinner.d.ts +4 -0
- package/dist/components/ui/spinner.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 +13 -5
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/mm-react-components.css +1 -0
- package/dist/main.d.ts +1 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/mm-react-components.es.js +16740 -7065
- package/dist/mm-react-components.es.js.map +1 -1
- package/dist/mm-react-components.umd.js +28 -11
- 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/ColorsPreview.d.ts +7 -0
- package/dist/preview/ColorsPreview.d.ts.map +1 -0
- package/dist/preview/CommandPreview.d.ts +2 -0
- package/dist/preview/CommandPreview.d.ts.map +1 -0
- package/dist/preview/DataTablePreview.d.ts.map +1 -1
- package/dist/preview/DatePickerPreview.d.ts +2 -0
- package/dist/preview/DatePickerPreview.d.ts.map +1 -0
- package/dist/preview/DateRangePickerPreview.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/HeroMetricCardPreview.d.ts +2 -0
- package/dist/preview/HeroMetricCardPreview.d.ts.map +1 -0
- package/dist/preview/PaginationPreview.d.ts +2 -0
- package/dist/preview/PaginationPreview.d.ts.map +1 -0
- 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/SpinnerPreview.d.ts +2 -0
- package/dist/preview/SpinnerPreview.d.ts.map +1 -0
- package/dist/preview/TextareaPreview.d.ts +2 -0
- package/dist/preview/TextareaPreview.d.ts.map +1 -0
- package/dist/scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.config.json +577 -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 +216 -0
- package/dist/scripts/npx-init.cjs +418 -0
- package/dist/tailwind.base.config.js +89 -0
- package/dist/themes/carbide.css +369 -91
- package/package.json +40 -10
- package/src/index.css +111 -498
- package/dist/index.css +0 -536
- package/dist/themes/base.css +0 -536
- 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/base.css +0 -536
- package/src/themes/carbide.css +0 -1257
- 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,466 @@
|
|
|
1
|
+
# Component Mapping Reference for AI Agents
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This reference provides detailed mappings between Chakra UI components and MachineMetrics React Components for AI agents performing automated migrations.
|
|
6
|
+
|
|
7
|
+
## Direct Component Mappings
|
|
8
|
+
|
|
9
|
+
### Basic UI Components
|
|
10
|
+
|
|
11
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
12
|
+
| ----------- | -------------- | ------------------------------------- | ------------------ |
|
|
13
|
+
| `Badge` | `Badge` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
14
|
+
| `Button` | `Button` | `@machinemetrics/mm-react-components` | API compatible |
|
|
15
|
+
| `Input` | `Input` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
16
|
+
| `Label` | `Label` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
17
|
+
| `Checkbox` | `Checkbox` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
18
|
+
| `Switch` | `Switch` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
19
|
+
| `Slider` | `Slider` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
20
|
+
| `Toggle` | `Toggle` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
21
|
+
| `Skeleton` | `Skeleton` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
22
|
+
| `Progress` | `Progress` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
23
|
+
| `Separator` | `Separator` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
24
|
+
| `Textarea` | `Textarea` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
25
|
+
|
|
26
|
+
### Form Components
|
|
27
|
+
|
|
28
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
29
|
+
| ----------------- | ----------------- | ------------------------------------- | ------------------ |
|
|
30
|
+
| `FormLabel` | `Label` | `@machinemetrics/mm-react-components` | Renamed component |
|
|
31
|
+
| `Radio` | `RadioGroupItem` | `@machinemetrics/mm-react-components` | Different API |
|
|
32
|
+
| `RadioGroup` | `RadioGroup` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
33
|
+
| `Form` | `Form` | `@machinemetrics/mm-react-components` | New component |
|
|
34
|
+
| `FormField` | `FormField` | `@machinemetrics/mm-react-components` | New component |
|
|
35
|
+
| `FormItem` | `FormItem` | `@machinemetrics/mm-react-components` | New component |
|
|
36
|
+
| `FormControl` | `FormControl` | `@machinemetrics/mm-react-components` | New component |
|
|
37
|
+
| `FormDescription` | `FormDescription` | `@machinemetrics/mm-react-components` | New component |
|
|
38
|
+
| `FormMessage` | `FormMessage` | `@machinemetrics/mm-react-components` | New component |
|
|
39
|
+
|
|
40
|
+
### Layout Components (Manual Replacement Required)
|
|
41
|
+
|
|
42
|
+
| Chakra UI | Replacement | Tailwind Classes | Notes |
|
|
43
|
+
| ------------ | ----------- | ------------------------------------------------------ | -------------------------------- |
|
|
44
|
+
| `Box` | `<div>` | Custom classes | Add appropriate Tailwind classes |
|
|
45
|
+
| `Flex` | `<div>` | `flex` | Add flex-related classes |
|
|
46
|
+
| `VStack` | `<div>` | `flex flex-col gap-4` | Adjust spacing as needed |
|
|
47
|
+
| `HStack` | `<div>` | `flex flex-row gap-4` | Adjust spacing as needed |
|
|
48
|
+
| `Stack` | `<div>` | `flex flex-col gap-4` | Adjust direction/spacing |
|
|
49
|
+
| `Container` | `<div>` | `container mx-auto px-4` | Adjust max-width |
|
|
50
|
+
| `Center` | `<div>` | `flex items-center justify-center` | Direct replacement |
|
|
51
|
+
| `SimpleGrid` | `<div>` | `grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4` | Adjust columns |
|
|
52
|
+
|
|
53
|
+
### Typography Components (Manual Replacement Required)
|
|
54
|
+
|
|
55
|
+
| Chakra UI | Replacement | Tailwind Classes | Notes |
|
|
56
|
+
| --------- | --------------------- | -------------------------------- | ----------------- |
|
|
57
|
+
| `Heading` | `<h1>`, `<h2>`, etc. | `font-semibold`, `text-lg`, etc. | Use semantic HTML |
|
|
58
|
+
| `Text` | `<p>`, `<span>`, etc. | Custom classes | Use semantic HTML |
|
|
59
|
+
|
|
60
|
+
### Modal/Dialog Components
|
|
61
|
+
|
|
62
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
63
|
+
| -------------- | --------------- | ------------------------------------- | ------------------- |
|
|
64
|
+
| `Modal` | `Dialog` | `@machinemetrics/mm-react-components` | Renamed component |
|
|
65
|
+
| `ModalOverlay` | `DialogOverlay` | `@machinemetrics/mm-react-components` | Renamed component |
|
|
66
|
+
| `ModalContent` | `DialogContent` | `@machinemetrics/mm-react-components` | Renamed component |
|
|
67
|
+
| `ModalHeader` | `DialogHeader` | `@machinemetrics/mm-react-components` | Renamed component |
|
|
68
|
+
| `ModalFooter` | `DialogFooter` | `@machinemetrics/mm-react-components` | Renamed component |
|
|
69
|
+
| `ModalBody` | `DialogContent` | `@machinemetrics/mm-react-components` | Merged with content |
|
|
70
|
+
| `AlertDialog` | `AlertDialog` | `@machinemetrics/mm-react-components` | New component |
|
|
71
|
+
|
|
72
|
+
### Navigation Components
|
|
73
|
+
|
|
74
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
75
|
+
| ------------ | -------------- | ------------------------------------- | ------------------ |
|
|
76
|
+
| `Menu` | `DropdownMenu` | `@machinemetrics/mm-react-components` | Renamed component |
|
|
77
|
+
| `Tabs` | `Tabs` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
78
|
+
| `Breadcrumb` | `Breadcrumb` | `@machinemetrics/mm-react-components` | New component |
|
|
79
|
+
|
|
80
|
+
### Data Display Components
|
|
81
|
+
|
|
82
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
83
|
+
| --------- | -------------- | ------------------------------------- | ------------------ |
|
|
84
|
+
| `Table` | `Table` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
85
|
+
| `Card` | `Card` | `@machinemetrics/mm-react-components` | New component |
|
|
86
|
+
| `Avatar` | `Avatar` | `@machinemetrics/mm-react-components` | New component |
|
|
87
|
+
| `Tooltip` | `Tooltip` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
88
|
+
| `Popover` | `Popover` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
89
|
+
|
|
90
|
+
### Feedback Components
|
|
91
|
+
|
|
92
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
93
|
+
| --------- | -------------- | ------------------------------------- | -------------------- |
|
|
94
|
+
| `Alert` | `Alert` | `@machinemetrics/mm-react-components` | New component |
|
|
95
|
+
| `Toast` | `Toaster` | `@machinemetrics/mm-react-components` | New component |
|
|
96
|
+
| `Spinner` | Custom | Tailwind classes | Use Tailwind spinner |
|
|
97
|
+
|
|
98
|
+
### Overlay Components
|
|
99
|
+
|
|
100
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
101
|
+
| --------- | -------------- | ------------------------------------- | ------------------------- |
|
|
102
|
+
| `Drawer` | `Drawer` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
103
|
+
| `Sheet` | `Sheet` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
104
|
+
| `Portal` | Custom | React Portal | Use React Portal directly |
|
|
105
|
+
|
|
106
|
+
### Disclosure Components
|
|
107
|
+
|
|
108
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
109
|
+
| ----------- | -------------- | ------------------------------------- | ------------------ |
|
|
110
|
+
| `Collapse` | `Collapsible` | `@machinemetrics/mm-react-components` | Renamed component |
|
|
111
|
+
| `Accordion` | `Accordion` | `@machinemetrics/mm-react-components` | Direct replacement |
|
|
112
|
+
|
|
113
|
+
### New Components (Recently Added)
|
|
114
|
+
|
|
115
|
+
| Chakra UI | MachineMetrics | Import | Notes |
|
|
116
|
+
| ----------------- | -------------------------------------- | ------------------------------------- | ------------- |
|
|
117
|
+
| `Calendar` | `Calendar` | `@machinemetrics/mm-react-components` | New component |
|
|
118
|
+
| `DateRangePicker` | `DateRangePicker` | `@machinemetrics/mm-react-components` | New component |
|
|
119
|
+
| `Chart` | `ChartContainer`, `ChartTooltip`, etc. | `@machinemetrics/mm-react-components` | New component |
|
|
120
|
+
| `Dropzone` | `Dropzone` | `@machinemetrics/mm-react-components` | New component |
|
|
121
|
+
| `SearchInput` | `SearchInput` | `@machinemetrics/mm-react-components` | New component |
|
|
122
|
+
|
|
123
|
+
## Compound Component Mappings
|
|
124
|
+
|
|
125
|
+
### Modal/Dialog Structure
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
// Chakra UI Structure
|
|
129
|
+
<Modal>
|
|
130
|
+
<ModalOverlay />
|
|
131
|
+
<ModalContent>
|
|
132
|
+
<ModalHeader>
|
|
133
|
+
<ModalTitle>Title</ModalTitle>
|
|
134
|
+
<ModalDescription>Description</ModalDescription>
|
|
135
|
+
</ModalHeader>
|
|
136
|
+
<ModalBody>Content</ModalBody>
|
|
137
|
+
<ModalFooter>
|
|
138
|
+
<ModalCloseButton />
|
|
139
|
+
<Button>Action</Button>
|
|
140
|
+
</ModalFooter>
|
|
141
|
+
</ModalContent>
|
|
142
|
+
</Modal>
|
|
143
|
+
|
|
144
|
+
// MachineMetrics Structure
|
|
145
|
+
<Dialog>
|
|
146
|
+
<DialogTrigger>Open</DialogTrigger>
|
|
147
|
+
<DialogContent>
|
|
148
|
+
<DialogHeader>
|
|
149
|
+
<DialogTitle>Title</DialogTitle>
|
|
150
|
+
<DialogDescription>Description</DialogDescription>
|
|
151
|
+
</DialogHeader>
|
|
152
|
+
Content
|
|
153
|
+
<DialogFooter>
|
|
154
|
+
<DialogClose>Close</DialogClose>
|
|
155
|
+
<Button>Action</Button>
|
|
156
|
+
</DialogFooter>
|
|
157
|
+
</DialogContent>
|
|
158
|
+
</Dialog>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Drawer Structure
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
// Chakra UI Structure
|
|
165
|
+
<Drawer>
|
|
166
|
+
<DrawerOverlay />
|
|
167
|
+
<DrawerContent>
|
|
168
|
+
<DrawerHeader>
|
|
169
|
+
<DrawerTitle>Title</DrawerTitle>
|
|
170
|
+
<DrawerDescription>Description</DrawerDescription>
|
|
171
|
+
</DrawerHeader>
|
|
172
|
+
<DrawerBody>Content</DrawerBody>
|
|
173
|
+
<DrawerFooter>
|
|
174
|
+
<DrawerCloseButton />
|
|
175
|
+
<Button>Action</Button>
|
|
176
|
+
</DrawerFooter>
|
|
177
|
+
</DrawerContent>
|
|
178
|
+
</Drawer>
|
|
179
|
+
|
|
180
|
+
// MachineMetrics Structure
|
|
181
|
+
<Drawer>
|
|
182
|
+
<DrawerTrigger>Open</DrawerTrigger>
|
|
183
|
+
<DrawerContent>
|
|
184
|
+
<DrawerHeader>
|
|
185
|
+
<DrawerTitle>Title</DrawerTitle>
|
|
186
|
+
<DrawerDescription>Description</DrawerDescription>
|
|
187
|
+
</DrawerHeader>
|
|
188
|
+
Content
|
|
189
|
+
<DrawerFooter>
|
|
190
|
+
<DrawerClose>Close</DrawerClose>
|
|
191
|
+
<Button>Action</Button>
|
|
192
|
+
</DrawerFooter>
|
|
193
|
+
</DrawerContent>
|
|
194
|
+
</Drawer>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Accordion Structure
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
// Chakra UI Structure
|
|
201
|
+
<Accordion>
|
|
202
|
+
<AccordionItem>
|
|
203
|
+
<AccordionButton>Header</AccordionButton>
|
|
204
|
+
<AccordionPanel>Content</AccordionPanel>
|
|
205
|
+
</AccordionItem>
|
|
206
|
+
</Accordion>
|
|
207
|
+
|
|
208
|
+
// MachineMetrics Structure
|
|
209
|
+
<Accordion>
|
|
210
|
+
<AccordionItem>
|
|
211
|
+
<AccordionTrigger>Header</AccordionTrigger>
|
|
212
|
+
<AccordionContent>Content</AccordionContent>
|
|
213
|
+
</AccordionItem>
|
|
214
|
+
</Accordion>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Card Structure
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
// Chakra UI Structure
|
|
221
|
+
<Card>
|
|
222
|
+
<CardHeader>Header</CardHeader>
|
|
223
|
+
<CardBody>Content</CardBody>
|
|
224
|
+
<CardFooter>Footer</CardFooter>
|
|
225
|
+
</Card>
|
|
226
|
+
|
|
227
|
+
// MachineMetrics Structure
|
|
228
|
+
<Card>
|
|
229
|
+
<CardHeader>
|
|
230
|
+
<CardTitle>Title</CardTitle>
|
|
231
|
+
<CardDescription>Description</CardDescription>
|
|
232
|
+
</CardHeader>
|
|
233
|
+
<CardContent>Content</CardContent>
|
|
234
|
+
<CardFooter>Footer</CardFooter>
|
|
235
|
+
</Card>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Form Structure
|
|
239
|
+
|
|
240
|
+
```tsx
|
|
241
|
+
// Chakra UI Structure
|
|
242
|
+
<Form>
|
|
243
|
+
<FormControl>
|
|
244
|
+
<FormLabel>Label</FormLabel>
|
|
245
|
+
<Input />
|
|
246
|
+
<FormErrorMessage>Error</FormErrorMessage>
|
|
247
|
+
</FormControl>
|
|
248
|
+
</Form>
|
|
249
|
+
|
|
250
|
+
// MachineMetrics Structure
|
|
251
|
+
<Form>
|
|
252
|
+
<FormField>
|
|
253
|
+
<FormItem>
|
|
254
|
+
<FormLabel>Label</FormLabel>
|
|
255
|
+
<FormControl>
|
|
256
|
+
<Input />
|
|
257
|
+
</FormControl>
|
|
258
|
+
<FormMessage>Error</FormMessage>
|
|
259
|
+
</FormItem>
|
|
260
|
+
</FormField>
|
|
261
|
+
</Form>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Icon Mappings
|
|
265
|
+
|
|
266
|
+
### Common Icons
|
|
267
|
+
|
|
268
|
+
| Chakra UI | Lucide React | Notes |
|
|
269
|
+
| ------------------ | ---------------- | ---------------------- |
|
|
270
|
+
| `AddIcon` | `Plus` | Add/create actions |
|
|
271
|
+
| `DeleteIcon` | `Trash2` | Delete actions |
|
|
272
|
+
| `EditIcon` | `Edit` | Edit actions |
|
|
273
|
+
| `SearchIcon` | `Search` | Search actions |
|
|
274
|
+
| `CloseIcon` | `X` | Close actions |
|
|
275
|
+
| `ChevronDownIcon` | `ChevronDown` | Dropdown indicators |
|
|
276
|
+
| `ChevronUpIcon` | `ChevronUp` | Dropdown indicators |
|
|
277
|
+
| `ChevronLeftIcon` | `ChevronLeft` | Navigation |
|
|
278
|
+
| `ChevronRightIcon` | `ChevronRight` | Navigation |
|
|
279
|
+
| `ArrowBackIcon` | `ArrowLeft` | Back navigation |
|
|
280
|
+
| `ArrowForwardIcon` | `ArrowRight` | Forward navigation |
|
|
281
|
+
| `ExternalLinkIcon` | `ExternalLink` | External links |
|
|
282
|
+
| `DownloadIcon` | `Download` | Download actions |
|
|
283
|
+
| `UploadIcon` | `Upload` | Upload actions |
|
|
284
|
+
| `CopyIcon` | `Copy` | Copy actions |
|
|
285
|
+
| `CheckIcon` | `Check` | Success/check actions |
|
|
286
|
+
| `WarningIcon` | `AlertTriangle` | Warning indicators |
|
|
287
|
+
| `InfoIcon` | `Info` | Information indicators |
|
|
288
|
+
| `StarIcon` | `Star` | Rating/favorites |
|
|
289
|
+
| `HeartIcon` | `Heart` | Favorites/likes |
|
|
290
|
+
| `SettingsIcon` | `Settings` | Settings/configuration |
|
|
291
|
+
| `MenuIcon` | `Menu` | Menu/hamburger |
|
|
292
|
+
| `MoreIcon` | `MoreHorizontal` | More options |
|
|
293
|
+
|
|
294
|
+
## Prop Mappings
|
|
295
|
+
|
|
296
|
+
### Common Props
|
|
297
|
+
|
|
298
|
+
| Chakra UI | MachineMetrics | Notes |
|
|
299
|
+
| ------------- | -------------- | ---------------- |
|
|
300
|
+
| `size` | `size` | Same API |
|
|
301
|
+
| `variant` | `variant` | Same API |
|
|
302
|
+
| `colorScheme` | `variant` | Different naming |
|
|
303
|
+
| `isDisabled` | `disabled` | Different naming |
|
|
304
|
+
| `isLoading` | `loading` | Different naming |
|
|
305
|
+
| `isOpen` | `open` | Different naming |
|
|
306
|
+
| `onClose` | `onOpenChange` | Different naming |
|
|
307
|
+
| `placement` | `side` | Different naming |
|
|
308
|
+
| `spacing` | `gap` | Different naming |
|
|
309
|
+
| `direction` | `orientation` | Different naming |
|
|
310
|
+
|
|
311
|
+
### Size Mappings
|
|
312
|
+
|
|
313
|
+
| Chakra UI | MachineMetrics | Notes |
|
|
314
|
+
| --------- | -------------- | ---------------- |
|
|
315
|
+
| `xs` | `sm` | Extra small |
|
|
316
|
+
| `sm` | `sm` | Small |
|
|
317
|
+
| `md` | `default` | Medium (default) |
|
|
318
|
+
| `lg` | `lg` | Large |
|
|
319
|
+
| `xl` | `lg` | Extra large |
|
|
320
|
+
|
|
321
|
+
### Variant Mappings
|
|
322
|
+
|
|
323
|
+
| Chakra UI | MachineMetrics | Notes |
|
|
324
|
+
| --------- | -------------- | ----------------- |
|
|
325
|
+
| `solid` | `default` | Primary variant |
|
|
326
|
+
| `outline` | `outline` | Outline variant |
|
|
327
|
+
| `ghost` | `ghost` | Ghost variant |
|
|
328
|
+
| `link` | `link` | Link variant |
|
|
329
|
+
| `subtle` | `secondary` | Secondary variant |
|
|
330
|
+
|
|
331
|
+
## Styling Mappings
|
|
332
|
+
|
|
333
|
+
### Spacing
|
|
334
|
+
|
|
335
|
+
| Chakra UI | Tailwind CSS | Notes |
|
|
336
|
+
| --------- | ------------ | ------------------ |
|
|
337
|
+
| `p={4}` | `p-4` | Padding |
|
|
338
|
+
| `m={4}` | `m-4` | Margin |
|
|
339
|
+
| `px={4}` | `px-4` | Horizontal padding |
|
|
340
|
+
| `py={4}` | `py-4` | Vertical padding |
|
|
341
|
+
| `gap={4}` | `gap-4` | Gap |
|
|
342
|
+
|
|
343
|
+
### Colors
|
|
344
|
+
|
|
345
|
+
| Chakra UI | Tailwind CSS | Notes |
|
|
346
|
+
| ------------------------ | ----------------- | ---------------- |
|
|
347
|
+
| `bg="blue.500"` | `bg-blue-500` | Background color |
|
|
348
|
+
| `color="white"` | `text-white` | Text color |
|
|
349
|
+
| `borderColor="gray.300"` | `border-gray-300` | Border color |
|
|
350
|
+
|
|
351
|
+
### Layout
|
|
352
|
+
|
|
353
|
+
| Chakra UI | Tailwind CSS | Notes |
|
|
354
|
+
| -------------------- | ---------------- | --------------- |
|
|
355
|
+
| `display="flex"` | `flex` | Display flex |
|
|
356
|
+
| `direction="column"` | `flex-col` | Flex direction |
|
|
357
|
+
| `align="center"` | `items-center` | Align items |
|
|
358
|
+
| `justify="center"` | `justify-center` | Justify content |
|
|
359
|
+
| `wrap="wrap"` | `flex-wrap` | Flex wrap |
|
|
360
|
+
|
|
361
|
+
### Responsive
|
|
362
|
+
|
|
363
|
+
| Chakra UI | Tailwind CSS | Notes |
|
|
364
|
+
| ----------------------------------------- | --------------- | ------------------ |
|
|
365
|
+
| `display={{ base: 'block', md: 'flex' }}` | `block md:flex` | Responsive display |
|
|
366
|
+
| `p={{ base: 2, md: 4 }}` | `p-2 md:p-4` | Responsive padding |
|
|
367
|
+
|
|
368
|
+
## Migration Patterns
|
|
369
|
+
|
|
370
|
+
### 1. Import Updates
|
|
371
|
+
|
|
372
|
+
```tsx
|
|
373
|
+
// Before
|
|
374
|
+
import { Button, Input, Modal, Box, Flex } from '@chakra-ui/react';
|
|
375
|
+
import { AddIcon } from '@chakra-ui/icons';
|
|
376
|
+
|
|
377
|
+
// After
|
|
378
|
+
import { Button, Input, Dialog } from '@machinemetrics/mm-react-components';
|
|
379
|
+
import { Plus } from 'lucide-react';
|
|
380
|
+
// Layout components become generic HTML elements
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### 2. Component Updates
|
|
384
|
+
|
|
385
|
+
```tsx
|
|
386
|
+
// Before
|
|
387
|
+
<Modal isOpen={isOpen} onClose={onClose}>
|
|
388
|
+
<ModalOverlay />
|
|
389
|
+
<ModalContent>
|
|
390
|
+
<ModalHeader>Title</ModalHeader>
|
|
391
|
+
<ModalBody>Content</ModalBody>
|
|
392
|
+
</ModalContent>
|
|
393
|
+
</Modal>
|
|
394
|
+
|
|
395
|
+
// After
|
|
396
|
+
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
|
397
|
+
<DialogTrigger>Open</DialogTrigger>
|
|
398
|
+
<DialogContent>
|
|
399
|
+
<DialogHeader>
|
|
400
|
+
<DialogTitle>Title</DialogTitle>
|
|
401
|
+
</DialogHeader>
|
|
402
|
+
Content
|
|
403
|
+
</DialogContent>
|
|
404
|
+
</Dialog>
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### 3. Layout Updates
|
|
408
|
+
|
|
409
|
+
```tsx
|
|
410
|
+
// Before
|
|
411
|
+
<Box p={4} bg="gray.100">
|
|
412
|
+
<Flex direction="column" gap={4}>
|
|
413
|
+
<VStack spacing={4}>
|
|
414
|
+
Content
|
|
415
|
+
</VStack>
|
|
416
|
+
</Flex>
|
|
417
|
+
</Box>
|
|
418
|
+
|
|
419
|
+
// After
|
|
420
|
+
<div className="p-4 bg-gray-100">
|
|
421
|
+
<div className="flex flex-col gap-4">
|
|
422
|
+
<div className="flex flex-col gap-4">
|
|
423
|
+
Content
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
</div>
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### 4. Icon Updates
|
|
430
|
+
|
|
431
|
+
```tsx
|
|
432
|
+
// Before
|
|
433
|
+
<Button>
|
|
434
|
+
<AddIcon />
|
|
435
|
+
Add Item
|
|
436
|
+
</Button>
|
|
437
|
+
|
|
438
|
+
// After
|
|
439
|
+
<Button>
|
|
440
|
+
<Plus />
|
|
441
|
+
Add Item
|
|
442
|
+
</Button>
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
## Error Handling
|
|
446
|
+
|
|
447
|
+
### Common Migration Errors
|
|
448
|
+
|
|
449
|
+
1. **Missing Imports**: Ensure all MachineMetrics components are imported
|
|
450
|
+
2. **Layout Issues**: Replace layout components with HTML + Tailwind
|
|
451
|
+
3. **Icon Issues**: Update icon imports to Lucide React
|
|
452
|
+
4. **Prop Issues**: Update prop names according to mapping table
|
|
453
|
+
5. **Styling Issues**: Convert Chakra props to Tailwind classes
|
|
454
|
+
|
|
455
|
+
### Validation Steps
|
|
456
|
+
|
|
457
|
+
1. Check all imports are updated
|
|
458
|
+
2. Verify layout components are replaced
|
|
459
|
+
3. Confirm icons are updated
|
|
460
|
+
4. Test component functionality
|
|
461
|
+
5. Verify styling is preserved
|
|
462
|
+
6. Check for console errors
|
|
463
|
+
|
|
464
|
+
## Conclusion
|
|
465
|
+
|
|
466
|
+
This reference provides comprehensive mappings for migrating from Chakra UI to MachineMetrics React Components. Use this as a guide for automated migration tools and manual conversion processes.
|