@machinemetrics/mm-react-components 0.2.3-3 → 0.2.3-30

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 (266) hide show
  1. package/README.md +89 -30
  2. package/agent-docs/agent-documentation-reference.md +401 -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/shadcn/accordion.d.ts +8 -0
  14. package/dist/components/shadcn/accordion.d.ts.map +1 -0
  15. package/dist/components/shadcn/alert-dialog.d.ts +15 -0
  16. package/dist/components/shadcn/alert-dialog.d.ts.map +1 -0
  17. package/dist/components/shadcn/alert.d.ts +10 -0
  18. package/dist/components/shadcn/alert.d.ts.map +1 -0
  19. package/dist/components/shadcn/avatar.d.ts +7 -0
  20. package/dist/components/shadcn/avatar.d.ts.map +1 -0
  21. package/dist/components/shadcn/badge.d.ts +10 -0
  22. package/dist/components/shadcn/badge.d.ts.map +1 -0
  23. package/dist/components/shadcn/breadcrumb.d.ts +12 -0
  24. package/dist/components/shadcn/breadcrumb.d.ts.map +1 -0
  25. package/dist/components/shadcn/button.d.ts +11 -0
  26. package/dist/components/shadcn/button.d.ts.map +1 -0
  27. package/dist/components/shadcn/calendar.d.ts +9 -0
  28. package/dist/components/shadcn/calendar.d.ts.map +1 -0
  29. package/dist/components/shadcn/card.d.ts +10 -0
  30. package/dist/components/shadcn/card.d.ts.map +1 -0
  31. package/dist/components/shadcn/chart.d.ts +41 -0
  32. package/dist/components/shadcn/chart.d.ts.map +1 -0
  33. package/dist/components/shadcn/checkbox.d.ts +5 -0
  34. package/dist/components/shadcn/checkbox.d.ts.map +1 -0
  35. package/dist/components/shadcn/collapsible.d.ts +7 -0
  36. package/dist/components/shadcn/collapsible.d.ts.map +1 -0
  37. package/dist/components/shadcn/command.d.ts +19 -0
  38. package/dist/components/shadcn/command.d.ts.map +1 -0
  39. package/dist/components/shadcn/dialog.d.ts +16 -0
  40. package/dist/components/shadcn/dialog.d.ts.map +1 -0
  41. package/dist/components/shadcn/drawer.d.ts +14 -0
  42. package/dist/components/shadcn/drawer.d.ts.map +1 -0
  43. package/dist/components/shadcn/dropdown-menu.d.ts +26 -0
  44. package/dist/components/shadcn/dropdown-menu.d.ts.map +1 -0
  45. package/dist/components/shadcn/form.d.ts +25 -0
  46. package/dist/components/shadcn/form.d.ts.map +1 -0
  47. package/dist/components/shadcn/input.d.ts +4 -0
  48. package/dist/components/shadcn/input.d.ts.map +1 -0
  49. package/dist/components/shadcn/label.d.ts +5 -0
  50. package/dist/components/shadcn/label.d.ts.map +1 -0
  51. package/dist/components/shadcn/pagination.d.ts +14 -0
  52. package/dist/components/shadcn/pagination.d.ts.map +1 -0
  53. package/dist/components/shadcn/popover.d.ts +8 -0
  54. package/dist/components/shadcn/popover.d.ts.map +1 -0
  55. package/dist/components/shadcn/progress.d.ts +5 -0
  56. package/dist/components/shadcn/progress.d.ts.map +1 -0
  57. package/dist/components/shadcn/radio-group.d.ts +6 -0
  58. package/dist/components/shadcn/radio-group.d.ts.map +1 -0
  59. package/dist/components/shadcn/select.d.ts +16 -0
  60. package/dist/components/shadcn/select.d.ts.map +1 -0
  61. package/dist/components/shadcn/separator.d.ts +5 -0
  62. package/dist/components/shadcn/separator.d.ts.map +1 -0
  63. package/dist/components/shadcn/sheet.d.ts +14 -0
  64. package/dist/components/shadcn/sheet.d.ts.map +1 -0
  65. package/dist/components/shadcn/skeleton.d.ts +4 -0
  66. package/dist/components/shadcn/skeleton.d.ts.map +1 -0
  67. package/dist/components/shadcn/slider.d.ts +5 -0
  68. package/dist/components/shadcn/slider.d.ts.map +1 -0
  69. package/dist/components/shadcn/sonner.d.ts +4 -0
  70. package/dist/components/shadcn/sonner.d.ts.map +1 -0
  71. package/dist/components/shadcn/spinner.d.ts +4 -0
  72. package/dist/components/shadcn/spinner.d.ts.map +1 -0
  73. package/dist/components/shadcn/switch.d.ts +5 -0
  74. package/dist/components/shadcn/switch.d.ts.map +1 -0
  75. package/dist/components/shadcn/table.d.ts +11 -0
  76. package/dist/components/shadcn/table.d.ts.map +1 -0
  77. package/dist/components/shadcn/tabs.d.ts +8 -0
  78. package/dist/components/shadcn/tabs.d.ts.map +1 -0
  79. package/dist/components/shadcn/textarea.d.ts +4 -0
  80. package/dist/components/shadcn/textarea.d.ts.map +1 -0
  81. package/dist/components/shadcn/toggle.d.ts +10 -0
  82. package/dist/components/shadcn/toggle.d.ts.map +1 -0
  83. package/dist/components/shadcn/tooltip.d.ts +8 -0
  84. package/dist/components/shadcn/tooltip.d.ts.map +1 -0
  85. package/dist/components/ui/accordion.d.ts +5 -6
  86. package/dist/components/ui/accordion.d.ts.map +1 -1
  87. package/dist/components/ui/alert-dialog.d.ts +7 -11
  88. package/dist/components/ui/alert-dialog.d.ts.map +1 -1
  89. package/dist/components/ui/alert.d.ts +8 -5
  90. package/dist/components/ui/alert.d.ts.map +1 -1
  91. package/dist/components/ui/avatar.d.ts +1 -6
  92. package/dist/components/ui/avatar.d.ts.map +1 -1
  93. package/dist/components/ui/badge.d.ts +4 -3
  94. package/dist/components/ui/badge.d.ts.map +1 -1
  95. package/dist/components/ui/breadcrumb.d.ts +1 -11
  96. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  97. package/dist/components/ui/button.d.ts +6 -6
  98. package/dist/components/ui/button.d.ts.map +1 -1
  99. package/dist/components/ui/calendar.d.ts +1 -1
  100. package/dist/components/ui/calendar.d.ts.map +1 -1
  101. package/dist/components/ui/card.d.ts +1 -9
  102. package/dist/components/ui/card.d.ts.map +1 -1
  103. package/dist/components/ui/checkbox.d.ts +1 -1
  104. package/dist/components/ui/checkbox.d.ts.map +1 -1
  105. package/dist/components/ui/collapsible.d.ts +1 -6
  106. package/dist/components/ui/collapsible.d.ts.map +1 -1
  107. package/dist/components/ui/command.d.ts +19 -0
  108. package/dist/components/ui/command.d.ts.map +1 -0
  109. package/dist/components/ui/data-table/TableView.d.ts +2 -1
  110. package/dist/components/ui/data-table/TableView.d.ts.map +1 -1
  111. package/dist/components/ui/data-table/cards/ResponsiveTable.d.ts +1 -1
  112. package/dist/components/ui/data-table/cards/ResponsiveTable.d.ts.map +1 -1
  113. package/dist/components/ui/data-table/cards/RowCard.d.ts +2 -1
  114. package/dist/components/ui/data-table/cards/RowCard.d.ts.map +1 -1
  115. package/dist/components/ui/data-table/index.d.ts +3 -1
  116. package/dist/components/ui/data-table/index.d.ts.map +1 -1
  117. package/dist/components/ui/data-table/pagination.d.ts +14 -1
  118. package/dist/components/ui/data-table/pagination.d.ts.map +1 -1
  119. package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts +7 -0
  120. package/dist/components/ui/data-table/parts/BatchActionsToolbar.d.ts.map +1 -0
  121. package/dist/components/ui/data-table/parts/CellContent.d.ts +7 -0
  122. package/dist/components/ui/data-table/parts/CellContent.d.ts.map +1 -0
  123. package/dist/components/ui/data-table/parts/ColGroup.d.ts +7 -0
  124. package/dist/components/ui/data-table/parts/ColGroup.d.ts.map +1 -0
  125. package/dist/components/ui/data-table/parts/SortableHeader.d.ts +13 -0
  126. package/dist/components/ui/data-table/parts/SortableHeader.d.ts.map +1 -0
  127. package/dist/components/ui/data-table/parts/TableBody.d.ts +22 -0
  128. package/dist/components/ui/data-table/parts/TableBody.d.ts.map +1 -0
  129. package/dist/components/ui/data-table/parts/TableHeader.d.ts +15 -0
  130. package/dist/components/ui/data-table/parts/TableHeader.d.ts.map +1 -0
  131. package/dist/components/ui/data-table/toolbar/DataTableToolbar.d.ts +2 -1
  132. package/dist/components/ui/data-table/toolbar/DataTableToolbar.d.ts.map +1 -1
  133. package/dist/components/ui/data-table/types.d.ts +61 -11
  134. package/dist/components/ui/data-table/types.d.ts.map +1 -1
  135. package/dist/components/ui/data-table/useDragAndDrop.d.ts +23 -0
  136. package/dist/components/ui/data-table/useDragAndDrop.d.ts.map +1 -0
  137. package/dist/components/ui/data-table/useTableController.d.ts +24 -1
  138. package/dist/components/ui/data-table/useTableController.d.ts.map +1 -1
  139. package/dist/components/ui/data-table/utils.d.ts +2 -0
  140. package/dist/components/ui/data-table/utils.d.ts.map +1 -1
  141. package/dist/components/ui/date-picker.d.ts +36 -0
  142. package/dist/components/ui/date-picker.d.ts.map +1 -0
  143. package/dist/components/ui/dialog.d.ts +6 -10
  144. package/dist/components/ui/dialog.d.ts.map +1 -1
  145. package/dist/components/ui/drawer.d.ts +3 -11
  146. package/dist/components/ui/drawer.d.ts.map +1 -1
  147. package/dist/components/ui/dropdown-menu.d.ts +15 -23
  148. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  149. package/dist/components/ui/hero-metric-card/HeroMetricCard.d.ts +4 -0
  150. package/dist/components/ui/hero-metric-card/HeroMetricCard.d.ts.map +1 -0
  151. package/dist/components/ui/hero-metric-card/HeroMetricCardItem.d.ts +4 -0
  152. package/dist/components/ui/hero-metric-card/HeroMetricCardItem.d.ts.map +1 -0
  153. package/dist/components/ui/hero-metric-card/constants.d.ts +13 -0
  154. package/dist/components/ui/hero-metric-card/constants.d.ts.map +1 -0
  155. package/dist/components/ui/hero-metric-card/grid.d.ts +4 -0
  156. package/dist/components/ui/hero-metric-card/grid.d.ts.map +1 -0
  157. package/dist/components/ui/hero-metric-card/hooks.d.ts +6 -0
  158. package/dist/components/ui/hero-metric-card/hooks.d.ts.map +1 -0
  159. package/dist/components/ui/hero-metric-card/index.d.ts +5 -0
  160. package/dist/components/ui/hero-metric-card/index.d.ts.map +1 -0
  161. package/dist/components/ui/hero-metric-card/parsing.d.ts +11 -0
  162. package/dist/components/ui/hero-metric-card/parsing.d.ts.map +1 -0
  163. package/dist/components/ui/hero-metric-card/refs.d.ts +3 -0
  164. package/dist/components/ui/hero-metric-card/refs.d.ts.map +1 -0
  165. package/dist/components/ui/hero-metric-card/trend.d.ts +4 -0
  166. package/dist/components/ui/hero-metric-card/trend.d.ts.map +1 -0
  167. package/dist/components/ui/hero-metric-card/types.d.ts +60 -0
  168. package/dist/components/ui/hero-metric-card/types.d.ts.map +1 -0
  169. package/dist/components/ui/hero-metric-card/utils.d.ts +10 -0
  170. package/dist/components/ui/hero-metric-card/utils.d.ts.map +1 -0
  171. package/dist/components/ui/input.d.ts +3 -2
  172. package/dist/components/ui/input.d.ts.map +1 -1
  173. package/dist/components/ui/label.d.ts +1 -4
  174. package/dist/components/ui/label.d.ts.map +1 -1
  175. package/dist/components/ui/pagination.d.ts +14 -0
  176. package/dist/components/ui/pagination.d.ts.map +1 -0
  177. package/dist/components/ui/popover.d.ts +3 -5
  178. package/dist/components/ui/popover.d.ts.map +1 -1
  179. package/dist/components/ui/progress.d.ts +2 -1
  180. package/dist/components/ui/progress.d.ts.map +1 -1
  181. package/dist/components/ui/radio-group.d.ts +3 -3
  182. package/dist/components/ui/radio-group.d.ts.map +1 -1
  183. package/dist/components/ui/select.d.ts +6 -13
  184. package/dist/components/ui/select.d.ts.map +1 -1
  185. package/dist/components/ui/separator.d.ts +1 -4
  186. package/dist/components/ui/separator.d.ts.map +1 -1
  187. package/dist/components/ui/sheet-banner.d.ts +10 -0
  188. package/dist/components/ui/sheet-banner.d.ts.map +1 -0
  189. package/dist/components/ui/sheet.d.ts +18 -9
  190. package/dist/components/ui/sheet.d.ts.map +1 -1
  191. package/dist/components/ui/simple-pagination.d.ts +8 -0
  192. package/dist/components/ui/simple-pagination.d.ts.map +1 -0
  193. package/dist/components/ui/skeleton.d.ts +1 -3
  194. package/dist/components/ui/skeleton.d.ts.map +1 -1
  195. package/dist/components/ui/sonner.d.ts +2 -1
  196. package/dist/components/ui/sonner.d.ts.map +1 -1
  197. package/dist/components/ui/spinner-carbide.d.ts +5 -0
  198. package/dist/components/ui/spinner-carbide.d.ts.map +1 -0
  199. package/dist/components/ui/spinner.d.ts +2 -0
  200. package/dist/components/ui/spinner.d.ts.map +1 -0
  201. package/dist/components/ui/switch.d.ts +1 -1
  202. package/dist/components/ui/switch.d.ts.map +1 -1
  203. package/dist/components/ui/table/Table.d.ts.map +1 -1
  204. package/dist/components/ui/table.d.ts +4 -9
  205. package/dist/components/ui/table.d.ts.map +1 -1
  206. package/dist/components/ui/tabs.d.ts +16 -2
  207. package/dist/components/ui/tabs.d.ts.map +1 -1
  208. package/dist/components/ui/textarea.d.ts +1 -3
  209. package/dist/components/ui/textarea.d.ts.map +1 -1
  210. package/dist/components/ui/toggle.d.ts +1 -9
  211. package/dist/components/ui/toggle.d.ts.map +1 -1
  212. package/dist/components/ui/tooltip.d.ts +1 -7
  213. package/dist/components/ui/tooltip.d.ts.map +1 -1
  214. package/dist/docs/GETTING_STARTED.md +13 -5
  215. package/dist/index.d.ts +16 -3
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/lib/mm-react-components.css +1 -0
  218. package/dist/main.d.ts +1 -2
  219. package/dist/main.d.ts.map +1 -1
  220. package/dist/mm-react-components.es.js +8015 -5939
  221. package/dist/mm-react-components.es.js.map +1 -1
  222. package/dist/mm-react-components.umd.js +13 -13
  223. package/dist/mm-react-components.umd.js.map +1 -1
  224. package/dist/preview/ColorsPreview.d.ts +7 -0
  225. package/dist/preview/ColorsPreview.d.ts.map +1 -0
  226. package/dist/preview/CommandPreview.d.ts +2 -0
  227. package/dist/preview/CommandPreview.d.ts.map +1 -0
  228. package/dist/preview/DataTablePreview.d.ts +1 -1
  229. package/dist/preview/DataTablePreview.d.ts.map +1 -1
  230. package/dist/preview/DatePickerPreview.d.ts +2 -0
  231. package/dist/preview/DatePickerPreview.d.ts.map +1 -0
  232. package/dist/preview/DateRangePickerPreview.d.ts.map +1 -1
  233. package/dist/preview/HeroMetricCardPreview.d.ts +2 -0
  234. package/dist/preview/HeroMetricCardPreview.d.ts.map +1 -0
  235. package/dist/preview/PaginationPreview.d.ts +2 -0
  236. package/dist/preview/PaginationPreview.d.ts.map +1 -0
  237. package/dist/preview/SheetBannerPreview.d.ts +2 -0
  238. package/dist/preview/SheetBannerPreview.d.ts.map +1 -0
  239. package/dist/preview/SheetPreview.d.ts.map +1 -1
  240. package/dist/preview/SpinnerPreview.d.ts +2 -0
  241. package/dist/preview/SpinnerPreview.d.ts.map +1 -0
  242. package/dist/preview/TabsPreview.d.ts.map +1 -1
  243. package/dist/scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.config.json +577 -0
  244. package/dist/scripts/chakra-to-shadcn-migrator/lib/args.js +63 -0
  245. package/dist/scripts/chakra-to-shadcn-migrator/lib/colors.js +14 -0
  246. package/dist/scripts/chakra-to-shadcn-migrator/lib/config.js +15 -0
  247. package/dist/scripts/chakra-to-shadcn-migrator/lib/deps.js +125 -0
  248. package/dist/scripts/chakra-to-shadcn-migrator/lib/file-io.js +44 -0
  249. package/dist/scripts/chakra-to-shadcn-migrator/lib/render.js +89 -0
  250. package/dist/scripts/chakra-to-shadcn-migrator/lib/transform.js +550 -0
  251. package/dist/scripts/chakra-to-shadcn-migrator/package.json +11 -0
  252. package/dist/scripts/init.cjs +216 -0
  253. package/dist/scripts/npx-init.cjs +418 -0
  254. package/dist/tailwind.base.config.js +89 -0
  255. package/dist/themes/carbide.css +462 -88
  256. package/package.json +35 -11
  257. package/src/index.css +111 -489
  258. package/dist/index.css +0 -527
  259. package/dist/themes/base.css +0 -536
  260. package/dist/themes/complete.css +0 -8
  261. package/scripts/README.md +0 -171
  262. package/scripts/chakra-to-shadcn-migrator/README.md +0 -107
  263. package/src/themes/base.css +0 -536
  264. package/src/themes/carbide.css +0 -1257
  265. package/src/themes/complete.css +0 -8
  266. /package/{scripts → dist/scripts}/chakra-to-shadcn-migrator/bin/chakra-to-shadcn.js +0 -0
@@ -0,0 +1,465 @@
1
+ # AI Agent Guide: MachineMetrics React Components Initialization
2
+
3
+ ## 🚨 CRITICAL FOR AI AGENTS
4
+
5
+ **The library uses ZERO-CONFIG setup** - no build tools required.
6
+
7
+ - ✅ Use `/styles` import (pre-compiled CSS)
8
+ - ✅ No Tailwind/PostCSS needed
9
+ - ✅ 2 simple steps: install + CSS import
10
+ - ✅ Works immediately
11
+
12
+ ## Overview
13
+
14
+ This guide provides AI agents with comprehensive instructions for setting up the MachineMetrics React Components library.
15
+
16
+ **Library Foundation:** Built on **[shadcn/ui](https://ui.shadcn.com/)** - re-usable components using Radix UI and Tailwind CSS, enhanced with the Carbide industrial theme.
17
+
18
+ The library uses a **ZERO-CONFIG** approach - no build tools, no configuration files, just install and use.
19
+
20
+ ## Quick Start
21
+
22
+ ### 1. Automated Initialization (Recommended)
23
+
24
+ ```bash
25
+ # Run the init script via npx
26
+ npx @machinemetrics/mm-react-components init
27
+
28
+ # This installs the library and sets up the CSS import
29
+ ```
30
+
31
+ ### 2. Manual Setup (If Script Fails)
32
+
33
+ If the automated script fails, follow the manual setup guide below.
34
+
35
+ ## What the Init Script Does
36
+
37
+ The init script performs minimal automated setup:
38
+
39
+ 1. **Installs the component library** - `@machinemetrics/mm-react-components`
40
+ 2. **Creates/updates CSS import** - Adds `/styles` import with pre-compiled CSS
41
+ 3. **Done!** - No build tools, no configuration files needed
42
+
43
+ ### What's Included
44
+
45
+ The `/styles` import provides everything you need:
46
+
47
+ - ✅ All Tailwind utilities (pre-compiled)
48
+ - ✅ Carbide industrial theme
49
+ - ✅ Dark mode support
50
+ - ✅ All component styles (focus, hover, etc.)
51
+ - ✅ Google Fonts
52
+ - ✅ 118 KB CSS (18 KB gzipped)
53
+
54
+ ## Dependencies
55
+
56
+ ### Required
57
+
58
+ - `@machinemetrics/mm-react-components` - Component library
59
+ - `react` (^19.1.1) - React library
60
+ - `react-dom` (^19.1.1) - React DOM renderer
61
+
62
+ **That's it!** No build tools required.
63
+
64
+ ## Manual Setup
65
+
66
+ ### Step 1: Install the Library
67
+
68
+ ```bash
69
+ # Install the component library
70
+ npm install @machinemetrics/mm-react-components
71
+ ```
72
+
73
+ ### Step 2: Add CSS Import
74
+
75
+ Create or update your main CSS file (usually `src/index.css` or `src/main.css`):
76
+
77
+ ```css
78
+ /* MM React Components - Pre-compiled CSS */
79
+ @import '@machinemetrics/mm-react-components/styles';
80
+
81
+ /* Your existing CSS here */
82
+ ```
83
+
84
+ **That's it for setup!**
85
+
86
+ ### Step 3: Activate Carbide Theme
87
+
88
+ Add the Carbide theme class to your app root element:
89
+
90
+ ```tsx
91
+ // Option 1: Add to root component
92
+ function App() {
93
+ return (
94
+ <div className="carbide">
95
+ <YourApp />
96
+ </div>
97
+ );
98
+ }
99
+
100
+ // Option 2: Add via JavaScript (in your main entry file)
101
+ document.documentElement.classList.add('carbide');
102
+ ```
103
+
104
+ ### Step 4: Import and Use Components
105
+
106
+ ```tsx
107
+ import {
108
+ Button,
109
+ Input,
110
+ Card,
111
+ CardHeader,
112
+ CardTitle,
113
+ CardContent,
114
+ } from '@machinemetrics/mm-react-components';
115
+
116
+ function MyComponent() {
117
+ return (
118
+ <Card>
119
+ <CardHeader>
120
+ <CardTitle>Welcome to MachineMetrics Components</CardTitle>
121
+ </CardHeader>
122
+ <CardContent>
123
+ <Input placeholder="Enter your data" />
124
+ <Button>Submit</Button>
125
+ </CardContent>
126
+ </Card>
127
+ );
128
+ }
129
+ ```
130
+
131
+ **Done!** Components are ready to use.
132
+
133
+ ## Project Structure After Setup
134
+
135
+ ```
136
+ your-project/
137
+ ├── src/
138
+ │ ├── index.css (or main.css)
139
+ │ └── App.tsx (or App.jsx)
140
+ ├── tailwind.config.js
141
+ ├── postcss.config.js
142
+ ├── package.json
143
+ └── node_modules/
144
+ └── @machinemetrics/mm-react-components/
145
+ ```
146
+
147
+ ## Framework-Specific Setup
148
+
149
+ ### React with Vite
150
+
151
+ ```bash
152
+ # Create new Vite React project
153
+ npm create vite@latest my-app -- --template react-ts
154
+ cd my-app
155
+
156
+ # Run init script
157
+ npx @machinemetrics/mm-react-components init
158
+
159
+ # Start development server
160
+ npm run dev
161
+ ```
162
+
163
+ ### Next.js
164
+
165
+ ```bash
166
+ # Create new Next.js project
167
+ npx create-next-app@latest my-app --typescript --tailwind --eslint
168
+ cd my-app
169
+
170
+ # Run init script
171
+ npx @machinemetrics/mm-react-components init
172
+
173
+ # Start development server
174
+ npm run dev
175
+ ```
176
+
177
+ ### Create React App
178
+
179
+ ```bash
180
+ # Create new CRA project
181
+ npx create-react-app my-app --template typescript
182
+ cd my-app
183
+
184
+ # Run init script
185
+ npx @machinemetrics/mm-react-components init
186
+
187
+ # Start development server
188
+ npm start
189
+ ```
190
+
191
+ ## Advanced Configuration
192
+
193
+ ### Custom Tailwind Configuration
194
+
195
+ If you need to extend the Tailwind configuration:
196
+
197
+ ```javascript
198
+ /** @type {import('tailwindcss').Config} */
199
+ module.exports = {
200
+ content: [
201
+ './src/**/*.{js,ts,jsx,tsx}',
202
+ './node_modules/@machinemetrics/mm-react-components/dist/**/*.{js,ts,jsx,tsx}',
203
+ ],
204
+ theme: {
205
+ extend: {
206
+ // Your custom theme extensions
207
+ colors: {
208
+ // Custom colors
209
+ },
210
+ fontFamily: {
211
+ // Custom fonts
212
+ },
213
+ },
214
+ },
215
+ plugins: [
216
+ // Additional Tailwind plugins
217
+ ],
218
+ };
219
+ ```
220
+
221
+ ### Custom CSS Setup
222
+
223
+ For more control over CSS imports:
224
+
225
+ ```css
226
+ /* src/index.css */
227
+ @import '@machinemetrics/mm-react-components/themes/carbide';
228
+
229
+ /* Custom CSS variables */
230
+ :root {
231
+ --custom-primary: #your-color;
232
+ }
233
+
234
+ /* Custom component styles */
235
+ .my-custom-component {
236
+ /* Your styles */
237
+ }
238
+ ```
239
+
240
+ ### TypeScript Configuration
241
+
242
+ If using TypeScript, ensure your `tsconfig.json` includes the component library types:
243
+
244
+ ```json
245
+ {
246
+ "compilerOptions": {
247
+ "types": ["@machinemetrics/mm-react-components"]
248
+ }
249
+ }
250
+ ```
251
+
252
+ ## Troubleshooting Common Issues
253
+
254
+ ### Issue: Script Fails with "Command not found"
255
+
256
+ **Cause**: NPX not installed or network issues.
257
+
258
+ **Solution**:
259
+
260
+ ```bash
261
+ # Install npx globally
262
+ npm install -g npx
263
+
264
+ # Or use npm directly
265
+ npm init @machinemetrics/mm-react-components
266
+ ```
267
+
268
+ ### Issue: "Cannot find module" errors
269
+
270
+ **Cause**: Dependencies not installed correctly.
271
+
272
+ **Solution**:
273
+
274
+ ```bash
275
+ # Clear npm cache
276
+ npm cache clean --force
277
+
278
+ # Delete node_modules and package-lock.json
279
+ rm -rf node_modules package-lock.json
280
+
281
+ # Reinstall dependencies
282
+ npm install
283
+
284
+ # Run init script again
285
+ npx @machinemetrics/mm-react-components init
286
+ ```
287
+
288
+ ### Issue: Tailwind CSS not working
289
+
290
+ **Cause**: Tailwind configuration not set up correctly.
291
+
292
+ **Solution**:
293
+
294
+ ```bash
295
+ # Initialize Tailwind manually
296
+ npx tailwindcss init -p
297
+
298
+ # Update tailwind.config.js with correct content paths
299
+ # Ensure PostCSS is configured
300
+ ```
301
+
302
+ ### Issue: Components not styling correctly
303
+
304
+ **Cause**: Carbide theme not applied or CSS not imported.
305
+
306
+ **Solution**:
307
+
308
+ ```tsx
309
+ // Ensure CSS is imported in your main file
310
+ import '@machinemetrics/mm-react-components/themes/carbide';
311
+
312
+ // Ensure carbide class is applied to root element
313
+ <div className="carbide">
314
+ <YourApp />
315
+ </div>;
316
+ ```
317
+
318
+ ### Issue: Build errors with TypeScript
319
+
320
+ **Cause**: Type definitions not found.
321
+
322
+ **Solution**:
323
+
324
+ ```bash
325
+ # Install TypeScript definitions
326
+ npm install -D @types/react @types/react-dom
327
+
328
+ # Update tsconfig.json
329
+ {
330
+ "compilerOptions": {
331
+ "types": ["@machinemetrics/mm-react-components"]
332
+ }
333
+ }
334
+ ```
335
+
336
+ ### Issue: Icons not displaying
337
+
338
+ **Cause**: Lucide React not installed or imported incorrectly.
339
+
340
+ **Solution**:
341
+
342
+ ```bash
343
+ # Install Lucide React
344
+ npm install lucide-react
345
+
346
+ # Import icons correctly
347
+ import { Plus, Trash2 } from 'lucide-react';
348
+ ```
349
+
350
+ ## Validation Checklist
351
+
352
+ After setup, verify the following:
353
+
354
+ - [ ] `@machinemetrics/mm-react-components` is installed
355
+ - [ ] All peer dependencies are installed
356
+ - [ ] CSS file imports the Carbide theme
357
+ - [ ] Tailwind CSS is configured
358
+ - [ ] PostCSS is configured
359
+ - [ ] Root element has `carbide` class
360
+ - [ ] Components can be imported and used
361
+ - [ ] Icons are displaying correctly
362
+ - [ ] Build process works without errors
363
+ - [ ] Development server starts successfully
364
+
365
+ ## Testing the Setup
366
+
367
+ ### Basic Component Test
368
+
369
+ ```tsx
370
+ import {
371
+ Button,
372
+ Card,
373
+ CardContent,
374
+ CardHeader,
375
+ CardTitle,
376
+ } from '@machinemetrics/mm-react-components';
377
+
378
+ function TestComponent() {
379
+ return (
380
+ <Card>
381
+ <CardHeader>
382
+ <CardTitle>Setup Test</CardTitle>
383
+ </CardHeader>
384
+ <CardContent>
385
+ <Button>Test Button</Button>
386
+ </CardContent>
387
+ </Card>
388
+ );
389
+ }
390
+
391
+ export default TestComponent;
392
+ ```
393
+
394
+ ### Theme Test
395
+
396
+ ```tsx
397
+ // Test that the Carbide theme is working
398
+ function ThemeTest() {
399
+ return (
400
+ <div className="carbide">
401
+ <div className="bg-primary text-primary-foreground p-4 rounded">
402
+ This should have industrial styling
403
+ </div>
404
+ </div>
405
+ );
406
+ }
407
+ ```
408
+
409
+ ## Advanced Usage
410
+
411
+ ### Custom Component Integration
412
+
413
+ ```tsx
414
+ import { Button } from '@machinemetrics/mm-react-components';
415
+ import { cn } from '@machinemetrics/mm-react-components';
416
+
417
+ function CustomButton({ className, ...props }) {
418
+ return <Button className={cn('custom-styles', className)} {...props} />;
419
+ }
420
+ ```
421
+
422
+ ### Theme Customization
423
+
424
+ ```css
425
+ /* Override Carbide theme variables */
426
+ .carbide {
427
+ --primary: #your-custom-color;
428
+ --secondary: #your-custom-color;
429
+ }
430
+ ```
431
+
432
+ ### Build Optimization
433
+
434
+ ```javascript
435
+ // vite.config.js for Vite projects
436
+ export default {
437
+ optimizeDeps: {
438
+ include: ['@machinemetrics/mm-react-components'],
439
+ },
440
+ };
441
+ ```
442
+
443
+ ## Support and Resources
444
+
445
+ ### Documentation
446
+
447
+ - [Component Library Docs](https://components.machinemetrics.com)
448
+ - [API Reference](https://components.machinemetrics.com/api)
449
+ - [Getting Started Guide](https://components.machinemetrics.com/getting-started)
450
+
451
+ ### Community Support
452
+
453
+ - [GitHub Issues](https://github.com/machinemetrics/mm-react-components/issues)
454
+ - [Discord Community](https://discord.gg/machinemetrics)
455
+ - [Stack Overflow](https://stackoverflow.com/questions/tagged/machinemetrics)
456
+
457
+ ### Professional Support
458
+
459
+ - [MachineMetrics Support](https://support.machinemetrics.com)
460
+ - [Enterprise Support](https://enterprise.machinemetrics.com)
461
+ - [Consulting Services](https://consulting.machinemetrics.com)
462
+
463
+ ## Conclusion
464
+
465
+ This guide provides comprehensive instructions for setting up the MachineMetrics React Components library. The automated init script handles most cases, but manual setup may be necessary for complex scenarios or when the script fails. Always test your setup thoroughly to ensure everything is working correctly.
@@ -0,0 +1,265 @@
1
+ # Chakra UI to MachineMetrics React Components Migration
2
+
3
+ This directory contains comprehensive tools and documentation for migrating from Chakra UI to the MachineMetrics React Components library.
4
+
5
+ ## Files Overview
6
+
7
+ ### Core Files
8
+
9
+ - **`chakra-to-shadcn.config.json`** - Main migration configuration with component mappings
10
+ - **`ai-agent-guide.md`** - Comprehensive guide for AI agents performing migrations
11
+ - **`component-mapping-reference.md`** - Detailed component mapping reference
12
+ - **`chakra-migration-troubleshooting.md`** - Common issues and solutions
13
+ - **`README.md`** - This file
14
+
15
+ ## Quick Start for AI Agents
16
+
17
+ ### 1. Automated Migration (Preferred)
18
+
19
+ ```bash
20
+ # Use the migration tool
21
+ node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply
22
+ ```
23
+
24
+ ### 2. Manual Migration (When Scripts Fail)
25
+
26
+ Follow the comprehensive guide in `ai-agent-guide.md` for step-by-step manual conversion.
27
+
28
+ ## Configuration File
29
+
30
+ The `chakra-to-shadcn.config.json` file contains:
31
+
32
+ - **Dependencies to Remove**: Chakra UI packages to uninstall
33
+ - **Dependencies to Add**: New packages required for MachineMetrics components
34
+ - **Component Mappings**: Direct component replacements
35
+ - **Compound Components**: Complex component structure mappings
36
+ - **Manual Migration Instructions**: Fallback conversion steps
37
+
38
+ ## Component Mappings
39
+
40
+ ### Direct Replacements (Automated)
41
+
42
+ These components can be automatically migrated:
43
+
44
+ - `Badge` → `Badge`
45
+ - `Button` → `Button`
46
+ - `Input` → `Input`
47
+ - `Modal` → `Dialog`
48
+ - `Menu` → `DropdownMenu`
49
+ - `Select` → `Select`
50
+ - `Table` → `Table`
51
+ - `Tabs` → `Tabs`
52
+ - `Tooltip` → `Tooltip`
53
+ - `Drawer` → `Drawer`
54
+ - `Switch` → `Switch`
55
+ - `Checkbox` → `Checkbox`
56
+ - `Radio` → `RadioGroupItem`
57
+ - `RadioGroup` → `RadioGroup`
58
+ - `Label` → `Label`
59
+ - `Sheet` → `Sheet`
60
+ - `Skeleton` → `Skeleton`
61
+ - `Collapse` → `Collapsible`
62
+ - `Accordion` → `Accordion`
63
+ - `Progress` → `Progress`
64
+ - `Slider` → `Slider`
65
+ - `Popover` → `Popover`
66
+
67
+ ### New Components (Recently Added)
68
+
69
+ - `Alert` → `Alert`
70
+ - `AlertDialog` → `AlertDialog`
71
+ - `Avatar` → `Avatar`
72
+ - `Breadcrumb` → `Breadcrumb`
73
+ - `Calendar` → `Calendar`
74
+ - `DateRangePicker` → `DateRangePicker`
75
+ - `Form` → `Form`
76
+ - `Separator` → `Separator`
77
+ - `Textarea` → `Textarea`
78
+ - `Toaster` → `Toaster`
79
+ - `Chart` → `ChartContainer`, `ChartTooltip`, etc.
80
+ - `Dropzone` → `Dropzone`
81
+ - `SearchInput` → `SearchInput`
82
+
83
+ ### Manual Replacements Required
84
+
85
+ These components need manual conversion to HTML + Tailwind:
86
+
87
+ - `Box` → `<div>` with Tailwind classes
88
+ - `Flex` → `<div className="flex">` with flex classes
89
+ - `VStack` → `<div className="flex flex-col gap-4">`
90
+ - `HStack` → `<div className="flex flex-row gap-4">`
91
+ - `Stack` → `<div className="flex flex-col gap-4">`
92
+ - `Container` → `<div className="container mx-auto px-4">`
93
+ - `Center` → `<div className="flex items-center justify-center">`
94
+ - `SimpleGrid` → `<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">`
95
+ - `Heading` → `<h1>`, `<h2>`, etc. with Tailwind typography
96
+ - `Text` → `<p>`, `<span>`, etc. with Tailwind typography
97
+
98
+ ## Migration Process
99
+
100
+ ### Step 1: Update Dependencies
101
+
102
+ ```bash
103
+ # Remove Chakra UI packages
104
+ npm uninstall @chakra-ui/react @chakra-ui/icons @chakra-ui/system @emotion/react @emotion/styled
105
+
106
+ # Install MachineMetrics components
107
+ npm install @machinemetrics/mm-react-components
108
+
109
+ # Install additional dependencies
110
+ npm install class-variance-authority tailwind-merge lucide-react
111
+ npm install react-day-picker date-fns recharts react-dropzone sonner vaul
112
+ npm install @radix-ui/react-avatar @radix-ui/react-breadcrumb @radix-ui/react-calendar
113
+ npm install @radix-ui/react-alert-dialog @radix-ui/react-separator @radix-ui/react-form
114
+ npm install @radix-ui/react-textarea @radix-ui/react-toast
115
+
116
+ # Install dev dependencies
117
+ npm install -D tailwindcss postcss autoprefixer
118
+ ```
119
+
120
+ ### Step 2: Update Theme Configuration
121
+
122
+ ```tsx
123
+ // Remove ChakraProvider from your app root
124
+ // Before
125
+ import { ChakraProvider } from '@chakra-ui/react';
126
+
127
+ function App() {
128
+ return (
129
+ <ChakraProvider>
130
+ <YourApp />
131
+ </ChakraProvider>
132
+ );
133
+ }
134
+
135
+ // After
136
+ import '@machinemetrics/mm-react-components/themes/carbide';
137
+
138
+ function App() {
139
+ return (
140
+ <div className="carbide">
141
+ <YourApp />
142
+ </div>
143
+ );
144
+ }
145
+ ```
146
+
147
+ ### Step 3: Update Component Imports
148
+
149
+ ```tsx
150
+ // Before
151
+ import { Button, Input, Modal, Box, Flex } from '@chakra-ui/react';
152
+ import { AddIcon } from '@chakra-ui/icons';
153
+
154
+ // After
155
+ import { Button, Input, Dialog } from '@machinemetrics/mm-react-components';
156
+ import { Plus } from 'lucide-react';
157
+ // Layout components become generic HTML elements with Tailwind classes
158
+ ```
159
+
160
+ ### Step 4: Convert Components
161
+
162
+ ```tsx
163
+ // Before
164
+ <Modal isOpen={isOpen} onClose={onClose}>
165
+ <ModalOverlay />
166
+ <ModalContent>
167
+ <ModalHeader>Title</ModalHeader>
168
+ <ModalBody>Content</ModalBody>
169
+ </ModalContent>
170
+ </Modal>
171
+
172
+ // After
173
+ <Dialog open={isOpen} onOpenChange={setIsOpen}>
174
+ <DialogTrigger>Open</DialogTrigger>
175
+ <DialogContent>
176
+ <DialogHeader>
177
+ <DialogTitle>Title</DialogTitle>
178
+ </DialogHeader>
179
+ Content
180
+ </DialogContent>
181
+ </Dialog>
182
+ ```
183
+
184
+ ## Usage Examples
185
+
186
+ ### Basic Migration
187
+
188
+ ```bash
189
+ # Preview changes (dry run)
190
+ node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js
191
+
192
+ # Apply changes
193
+ node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply
194
+
195
+ # With verbose output
196
+ node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply --verbose
197
+ ```
198
+
199
+ ## Troubleshooting
200
+
201
+ ### Common Issues
202
+
203
+ 1. **Missing Dependencies**: Install all required packages
204
+ 2. **Theme Not Applied**: Ensure Carbide theme is imported and applied
205
+ 3. **Layout Components**: Replace with HTML + Tailwind classes
206
+ 4. **Icons Not Working**: Update to Lucide React icons
207
+ 5. **Form Components**: Use new Form component structure
208
+
209
+ ### Debugging
210
+
211
+ ```bash
212
+ # Check for errors
213
+ npm run lint
214
+
215
+ # Test components
216
+ npm run test
217
+
218
+ # Build project
219
+ npm run build
220
+ ```
221
+
222
+ ## Validation Checklist
223
+
224
+ After migration, verify:
225
+
226
+ - [ ] All Chakra UI imports removed
227
+ - [ ] MachineMetrics components imported correctly
228
+ - [ ] Theme applied with `carbide` class
229
+ - [ ] Layout components converted to HTML + Tailwind
230
+ - [ ] Icons updated to Lucide React
231
+ - [ ] Form components working correctly
232
+ - [ ] Modal/Dialog components functioning
233
+ - [ ] Styling matches original design
234
+ - [ ] No console errors
235
+ - [ ] All functionality preserved
236
+
237
+ ## Support and Resources
238
+
239
+ - **Documentation**: [MachineMetrics Components Docs](https://components.machinemetrics.com)
240
+ - **GitHub**: [Component Library Repository](https://github.com/machinemetrics/mm-react-components)
241
+ - **Issues**: Report migration issues on GitHub
242
+ - **Community**: Join the MachineMetrics developer community
243
+
244
+ ## File Descriptions
245
+
246
+ ### `chakra-to-shadcn.config.json`
247
+
248
+ Main configuration file containing all component mappings, dependencies, and migration instructions.
249
+
250
+
251
+ ### `ai-agent-guide.md`
252
+
253
+ Comprehensive guide for AI agents performing migrations. Includes step-by-step instructions, examples, and best practices.
254
+
255
+ ### `component-mapping-reference.md`
256
+
257
+ Detailed reference for all component mappings, including props, styling, and usage examples.
258
+
259
+ ### `chakra-migration-troubleshooting.md`
260
+
261
+ Common issues and solutions encountered during migration, with debugging tips and prevention strategies.
262
+
263
+ ## Conclusion
264
+
265
+ This migration toolkit provides everything needed to migrate from Chakra UI to MachineMetrics React Components. The automated tools handle most cases, but manual conversion may be necessary for complex scenarios. Always test thoroughly after migration to ensure functionality is preserved.