@machinemetrics/mm-react-components 0.2.3-1 → 0.2.3-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +96 -30
  2. package/agent-docs/agent-documentation-reference.md +247 -0
  3. package/agent-docs/ai-agent-guide.md +554 -0
  4. package/agent-docs/ai-agent-init-guide.md +461 -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 +96 -30
  13. package/dist/components/ui/alert-dialog.d.ts +15 -0
  14. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  15. package/dist/components/ui/alert.d.ts +10 -0
  16. package/dist/components/ui/alert.d.ts.map +1 -0
  17. package/dist/components/ui/avatar.d.ts +7 -0
  18. package/dist/components/ui/avatar.d.ts.map +1 -0
  19. package/dist/components/ui/breadcrumb.d.ts +12 -0
  20. package/dist/components/ui/breadcrumb.d.ts.map +1 -0
  21. package/dist/components/ui/button.d.ts +1 -1
  22. package/dist/components/ui/button.d.ts.map +1 -1
  23. package/dist/components/ui/card.d.ts +10 -0
  24. package/dist/components/ui/card.d.ts.map +1 -0
  25. package/dist/components/ui/chart.d.ts +41 -0
  26. package/dist/components/ui/chart.d.ts.map +1 -0
  27. package/dist/components/ui/form.d.ts +25 -0
  28. package/dist/components/ui/form.d.ts.map +1 -0
  29. package/dist/components/ui/progress.d.ts +1 -0
  30. package/dist/components/ui/progress.d.ts.map +1 -1
  31. package/dist/components/ui/separator.d.ts +5 -0
  32. package/dist/components/ui/separator.d.ts.map +1 -0
  33. package/dist/components/ui/sonner.d.ts +4 -0
  34. package/dist/components/ui/sonner.d.ts.map +1 -0
  35. package/dist/components/ui/textarea.d.ts +4 -0
  36. package/dist/components/ui/textarea.d.ts.map +1 -0
  37. package/dist/docs/GETTING_STARTED.md +293 -0
  38. package/dist/index.d.ts +14 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/lib/mm-react-components.css +1 -0
  41. package/dist/main.d.ts +0 -1
  42. package/dist/main.d.ts.map +1 -1
  43. package/dist/mm-react-components.es.js +10964 -927
  44. package/dist/mm-react-components.es.js.map +1 -1
  45. package/dist/mm-react-components.umd.js +27 -9
  46. package/dist/mm-react-components.umd.js.map +1 -1
  47. package/dist/preview/AlertDialogPreview.d.ts +2 -0
  48. package/dist/preview/AlertDialogPreview.d.ts.map +1 -0
  49. package/dist/preview/AlertPreview.d.ts +2 -0
  50. package/dist/preview/AlertPreview.d.ts.map +1 -0
  51. package/dist/preview/AvatarPreview.d.ts +2 -0
  52. package/dist/preview/AvatarPreview.d.ts.map +1 -0
  53. package/dist/preview/BreadcrumbPreview.d.ts +2 -0
  54. package/dist/preview/BreadcrumbPreview.d.ts.map +1 -0
  55. package/dist/preview/CardPreview.d.ts +2 -0
  56. package/dist/preview/CardPreview.d.ts.map +1 -0
  57. package/dist/preview/ChartPreview.d.ts +2 -0
  58. package/dist/preview/ChartPreview.d.ts.map +1 -0
  59. package/dist/preview/CheckboxPreview.d.ts.map +1 -1
  60. package/dist/preview/DataTablePreview.d.ts.map +1 -1
  61. package/dist/preview/FormPreview.d.ts +2 -0
  62. package/dist/preview/FormPreview.d.ts.map +1 -0
  63. package/dist/preview/InputPreview.d.ts.map +1 -1
  64. package/dist/preview/LabelPreview.d.ts.map +1 -1
  65. package/dist/preview/RadioGroupPreview.d.ts.map +1 -1
  66. package/dist/preview/SeparatorPreview.d.ts +2 -0
  67. package/dist/preview/SeparatorPreview.d.ts.map +1 -0
  68. package/dist/preview/SonnerPreview.d.ts +2 -0
  69. package/dist/preview/SonnerPreview.d.ts.map +1 -0
  70. package/dist/preview/TabsPreview.d.ts.map +1 -1
  71. package/dist/preview/TextareaPreview.d.ts +2 -0
  72. package/dist/preview/TextareaPreview.d.ts.map +1 -0
  73. package/dist/preview/data-table/data-table-preview_column-content.d.ts +1 -1
  74. package/dist/preview/data-table/data-table-preview_column-content.d.ts.map +1 -1
  75. package/dist/preview/page-header/PageHeaderPreview.d.ts.map +1 -1
  76. package/dist/scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.config.json +512 -0
  77. package/dist/scripts/chakra-to-shadcn-migrator/lib/args.js +63 -0
  78. package/dist/scripts/chakra-to-shadcn-migrator/lib/colors.js +14 -0
  79. package/dist/scripts/chakra-to-shadcn-migrator/lib/config.js +15 -0
  80. package/dist/scripts/chakra-to-shadcn-migrator/lib/deps.js +125 -0
  81. package/dist/scripts/chakra-to-shadcn-migrator/lib/file-io.js +44 -0
  82. package/dist/scripts/chakra-to-shadcn-migrator/lib/render.js +89 -0
  83. package/dist/scripts/chakra-to-shadcn-migrator/lib/transform.js +550 -0
  84. package/dist/scripts/chakra-to-shadcn-migrator/package.json +11 -0
  85. package/dist/scripts/init.cjs +208 -0
  86. package/dist/scripts/npx-init.cjs +409 -0
  87. package/dist/tailwind.base.config.js +88 -0
  88. package/dist/themes/carbide.css +187 -32
  89. package/package.json +58 -10
  90. package/src/index.css +99 -498
  91. package/dist/index.css +0 -536
  92. package/dist/tailwind.config.export.js +0 -153
  93. package/dist/themes/complete.css +0 -8
  94. package/scripts/README.md +0 -171
  95. package/scripts/chakra-to-shadcn-migrator/README.md +0 -107
  96. package/src/themes/carbide.css +0 -1257
  97. package/src/themes/complete.css +0 -8
  98. package/tailwind.config.export.js +0 -153
  99. /package/{scripts → dist/scripts}/chakra-to-shadcn-migrator/bin/chakra-to-shadcn.js +0 -0
@@ -0,0 +1,208 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * MM React Components - Zero-Config Init Script
5
+ *
6
+ * Simple initialization script for the MachineMetrics React Components library
7
+ * Uses the zero-config approach with pre-compiled CSS (no build tools needed)
8
+ */
9
+
10
+ /* eslint-disable no-undef */
11
+
12
+ const { execSync } = require('child_process');
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+ const readline = require('readline');
16
+
17
+ // Colors for console output
18
+ const colors = {
19
+ reset: '\x1b[0m',
20
+ bright: '\x1b[1m',
21
+ green: '\x1b[32m',
22
+ blue: '\x1b[34m',
23
+ cyan: '\x1b[36m',
24
+ yellow: '\x1b[33m',
25
+ };
26
+
27
+ function log(message, color = 'reset') {
28
+ console.log(`${colors[color]}${message}${colors.reset}`);
29
+ }
30
+
31
+ function detectChakraUI() {
32
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
33
+ if (!fs.existsSync(packageJsonPath)) {
34
+ return false;
35
+ }
36
+
37
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
38
+ const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
39
+
40
+ return (
41
+ deps['@chakra-ui/react'] ||
42
+ deps['@chakra-ui/core'] ||
43
+ deps['@chakra-ui/system']
44
+ );
45
+ }
46
+
47
+ function askQuestion(question) {
48
+ const rl = readline.createInterface({
49
+ input: process.stdin,
50
+ output: process.stdout,
51
+ });
52
+
53
+ return new Promise((resolve) => {
54
+ rl.question(question, (answer) => {
55
+ rl.close();
56
+ resolve(answer);
57
+ });
58
+ });
59
+ }
60
+
61
+ async function main() {
62
+ log('šŸš€ MM React Components - Zero-Config Setup', 'bright');
63
+ log(
64
+ 'Installing MachineMetrics React Components with pre-compiled CSS...\n',
65
+ 'blue',
66
+ );
67
+
68
+ try {
69
+ // Check for Chakra UI before installation
70
+ const hasChakra = detectChakraUI();
71
+
72
+ // Install the component library
73
+ log('šŸ“¦ Installing MM React Components...', 'cyan');
74
+ execSync('npm install @machinemetrics/mm-react-components@beta', {
75
+ stdio: 'inherit',
76
+ });
77
+ log('āœ… MM React Components installed', 'green');
78
+
79
+ log('\nšŸ’” Zero-config mode: No build tools needed!', 'yellow');
80
+ log(' Using pre-compiled CSS (118 KB, 18 KB gzipped)\n', 'cyan');
81
+
82
+ // Create simple CSS import (zero-config approach)
83
+ const srcPath = path.join(process.cwd(), 'src');
84
+ const indexCssPath = path.join(srcPath, 'index.css');
85
+
86
+ // Ensure src directory exists
87
+ if (!fs.existsSync(srcPath)) {
88
+ fs.mkdirSync(srcPath, { recursive: true });
89
+ log('āœ… Created src/ directory', 'green');
90
+ }
91
+
92
+ if (fs.existsSync(indexCssPath)) {
93
+ const cssContent = fs.readFileSync(indexCssPath, 'utf8');
94
+ if (!cssContent.includes('@machinemetrics/mm-react-components')) {
95
+ const newCssContent = `/* MM React Components - Pre-compiled CSS (zero-config) */
96
+ @import '@machinemetrics/mm-react-components/styles';
97
+
98
+ ${cssContent}`;
99
+ fs.writeFileSync(indexCssPath, newCssContent);
100
+ log('āœ… Added MM styles import to existing index.css', 'green');
101
+ } else {
102
+ log('āœ… MM styles import already present in index.css', 'green');
103
+ }
104
+ } else {
105
+ const cssContent = `/* MM React Components - Pre-compiled CSS (zero-config) */
106
+ @import '@machinemetrics/mm-react-components/styles';
107
+ `;
108
+
109
+ fs.writeFileSync(indexCssPath, cssContent);
110
+ log('āœ… Created index.css with MM styles import', 'green');
111
+ }
112
+
113
+ // Success message
114
+ log('\nšŸŽ‰ Zero-Config Setup Complete!', 'green');
115
+ log('\nšŸ“š Next steps:', 'bright');
116
+ log(' 1. Add Carbide class to your root element:');
117
+ log(' document.documentElement.classList.add("carbide")', 'cyan');
118
+ log(' 2. Import components:');
119
+ log(
120
+ ' import { Button, Input } from "@machinemetrics/mm-react-components"',
121
+ 'cyan',
122
+ );
123
+ log(' 3. Use components - everything is pre-styled and ready!');
124
+
125
+ log('\nāœ… What you got:', 'bright');
126
+ log(' • Pre-compiled CSS with all Tailwind utilities');
127
+ log(' • Carbide industrial theme');
128
+ log(' • Dark mode support');
129
+ log(' • All component styles (focus, hover, etc.)');
130
+ log(' • Google Fonts included');
131
+
132
+ log('\nšŸ’” No build tools needed!', 'yellow');
133
+ log(' This is a zero-config setup - everything just works!');
134
+
135
+ log('\nšŸ“– Advanced setup (optional):', 'bright');
136
+ log(' Want custom Tailwind config? See docs/DEPENDENCIES.md');
137
+ log(' For theme-only CSS, see docs/CSS_EXPORTS.md');
138
+
139
+ // Offer Chakra migration if detected
140
+ if (hasChakra) {
141
+ log('\nšŸ”„ Chakra UI Detected!', 'yellow');
142
+ log(
143
+ ' We can help you migrate from Chakra UI to MM React Components\n',
144
+ 'cyan',
145
+ );
146
+
147
+ const answer = await askQuestion(
148
+ ' Would you like to run the Chakra UI migration now? (y/N): ',
149
+ );
150
+
151
+ if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
152
+ log('\nšŸ”„ Starting Chakra UI migration...', 'cyan');
153
+
154
+ const migrationScriptPath = path.join(
155
+ __dirname,
156
+ 'chakra-to-shadcn-migrator',
157
+ 'bin',
158
+ 'chakra-to-shadcn.js',
159
+ );
160
+
161
+ if (fs.existsSync(migrationScriptPath)) {
162
+ try {
163
+ execSync(`node "${migrationScriptPath}" --apply`, {
164
+ stdio: 'inherit',
165
+ });
166
+ log('\nāœ… Chakra UI migration complete!', 'green');
167
+ } catch (error) {
168
+ log('\nāš ļø Migration encountered issues', 'yellow');
169
+ log(` ${error.message}`, 'yellow');
170
+ log(
171
+ ' You can run it manually: node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js',
172
+ 'cyan',
173
+ );
174
+ }
175
+ } else {
176
+ log(
177
+ '\nāš ļø Migration script not found at expected location',
178
+ 'yellow',
179
+ );
180
+ log(
181
+ ' Clone the repo to access migration tools: https://github.com/machinemetrics/mm-react-components',
182
+ 'cyan',
183
+ );
184
+ }
185
+ } else {
186
+ log('\n No problem! You can migrate later with:', 'cyan');
187
+ log(
188
+ ' node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply',
189
+ 'cyan',
190
+ );
191
+ }
192
+ }
193
+
194
+ log('\nšŸš€ Happy coding!', 'cyan');
195
+ } catch (error) {
196
+ log(`āŒ Setup failed: ${error.message}`, 'red');
197
+ process.exit(1);
198
+ }
199
+ }
200
+
201
+ if (require.main === module) {
202
+ main().catch((error) => {
203
+ log(`āŒ Setup failed: ${error.message}`, 'red');
204
+ process.exit(1);
205
+ });
206
+ }
207
+
208
+ module.exports = { main };
@@ -0,0 +1,409 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * MM React Components - NPX Initialization Script
5
+ *
6
+ * This script is designed to be run via npx only
7
+ * Usage: npx @machinemetrics/mm-react-components init
8
+ */
9
+
10
+ /* eslint-disable no-undef, no-unused-vars */
11
+
12
+ const { execSync } = require('child_process');
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+ const readline = require('readline');
16
+
17
+ // Read the version from package.json
18
+ const packageJsonPath = path.join(__dirname, '..', 'package.json');
19
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
20
+ const version = packageJson.version;
21
+
22
+ // Colors for console output
23
+ const colors = {
24
+ reset: '\x1b[0m',
25
+ bright: '\x1b[1m',
26
+ green: '\x1b[32m',
27
+ blue: '\x1b[34m',
28
+ cyan: '\x1b[36m',
29
+ yellow: '\x1b[33m',
30
+ red: '\x1b[31m',
31
+ };
32
+
33
+ function log(message, color = 'reset') {
34
+ console.log(`${colors[color]}${message}${colors.reset}`);
35
+ }
36
+
37
+ function logWarning(message) {
38
+ log(`āš ļø ${message}`, 'yellow');
39
+ }
40
+
41
+ function detectChakraUI() {
42
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
43
+ if (!fs.existsSync(packageJsonPath)) {
44
+ return false;
45
+ }
46
+
47
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
48
+ const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
49
+
50
+ return (
51
+ deps['@chakra-ui/react'] ||
52
+ deps['@chakra-ui/core'] ||
53
+ deps['@chakra-ui/system']
54
+ );
55
+ }
56
+
57
+ function askQuestion(question) {
58
+ const rl = readline.createInterface({
59
+ input: process.stdin,
60
+ output: process.stdout,
61
+ });
62
+
63
+ return new Promise((resolve) => {
64
+ rl.question(question, (answer) => {
65
+ rl.close();
66
+ resolve(answer);
67
+ });
68
+ });
69
+ }
70
+
71
+ function checkReactProject() {
72
+ const packageJsonPath = path.join(process.cwd(), 'package.json');
73
+
74
+ if (!fs.existsSync(packageJsonPath)) {
75
+ log(
76
+ 'āŒ No package.json found. Please run this script from your React project root.',
77
+ 'red',
78
+ );
79
+ process.exit(1);
80
+ }
81
+
82
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
83
+
84
+ if (!packageJson.dependencies?.react && !packageJson.devDependencies?.react) {
85
+ log(
86
+ "āŒ React not found in dependencies. Please ensure you're in a React project.",
87
+ 'red',
88
+ );
89
+ process.exit(1);
90
+ }
91
+
92
+ return packageJson;
93
+ }
94
+
95
+ async function main() {
96
+ log('šŸš€ MM React Components - NPX Setup', 'bright');
97
+ log(
98
+ 'Setting up MachineMetrics React Components in your project...\n',
99
+ 'blue',
100
+ );
101
+
102
+ try {
103
+ // Check if we're in a React project
104
+ checkReactProject();
105
+ log('āœ… React project detected', 'green');
106
+
107
+ // Check for Chakra UI before installation
108
+ const hasChakra = detectChakraUI();
109
+
110
+ // Install the component library
111
+ log(`šŸ“¦ Installing MM React Components v${version}...`, 'cyan');
112
+ execSync(`npm install @machinemetrics/mm-react-components@beta`, {
113
+ stdio: 'inherit',
114
+ });
115
+ log('āœ… MM React Components installed', 'green');
116
+
117
+ log('\nšŸ’” Zero-config mode: No build tools needed!', 'yellow');
118
+ log(' Using pre-compiled CSS (118 KB, 18 KB gzipped)\n', 'cyan');
119
+
120
+ // Check React version compatibility
121
+ log('šŸ” Checking React version compatibility...', 'cyan');
122
+ try {
123
+ const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8'));
124
+ const reactVersion =
125
+ packageJson.dependencies?.react || packageJson.devDependencies?.react;
126
+
127
+ if (reactVersion && reactVersion.includes('18')) {
128
+ log(
129
+ 'āš ļø React 18 detected - upgrading to React 19 for compatibility',
130
+ 'yellow',
131
+ );
132
+ execSync(
133
+ 'npm install react@^19.1.1 react-dom@^19.1.1 react-scripts@latest',
134
+ { stdio: 'inherit' },
135
+ );
136
+ log('āœ… React upgraded to v19 with compatible react-scripts', 'green');
137
+ } else if (reactVersion && reactVersion.includes('19')) {
138
+ log(
139
+ 'āœ… React 19 detected - checking react-scripts compatibility',
140
+ 'green',
141
+ );
142
+ // Check if react-scripts needs updating for React 19
143
+ try {
144
+ const packageJson = JSON.parse(
145
+ fs.readFileSync('package.json', 'utf8'),
146
+ );
147
+ const scriptsVersion = packageJson.dependencies?.['react-scripts'];
148
+ if (scriptsVersion && scriptsVersion.includes('5.0')) {
149
+ log(
150
+ 'āš ļø Updating react-scripts for React 19 compatibility',
151
+ 'yellow',
152
+ );
153
+ execSync('npm install react-scripts@latest', { stdio: 'inherit' });
154
+ log('āœ… react-scripts updated', 'green');
155
+ }
156
+ } catch (_error) {
157
+ log('āš ļø Could not check react-scripts version', 'yellow');
158
+ }
159
+ } else {
160
+ log(
161
+ 'āš ļø Unknown React version - attempting to install React 19',
162
+ 'yellow',
163
+ );
164
+ execSync(
165
+ 'npm install react@^19.1.1 react-dom@^19.1.1 react-scripts@latest',
166
+ { stdio: 'inherit' },
167
+ );
168
+ log('āœ… React 19 installed', 'green');
169
+ }
170
+ } catch (_error) {
171
+ log('āš ļø Could not check React version, continuing...', 'yellow');
172
+ }
173
+
174
+ // Setup CSS (zero-config approach)
175
+ const srcPath = path.join(process.cwd(), 'src');
176
+ const indexCssPath = path.join(srcPath, 'index.css');
177
+
178
+ // Ensure src directory exists
179
+ if (!fs.existsSync(srcPath)) {
180
+ fs.mkdirSync(srcPath, { recursive: true });
181
+ log('āœ… Created src/ directory', 'green');
182
+ }
183
+
184
+ // Setup CSS with pre-compiled styles
185
+ const cssContent = `/* MM React Components - Pre-compiled CSS (zero-config) */
186
+ @import '@machinemetrics/mm-react-components/styles';
187
+ `;
188
+
189
+ if (fs.existsSync(indexCssPath)) {
190
+ const existingContent = fs.readFileSync(indexCssPath, 'utf8');
191
+ if (!existingContent.includes('@machinemetrics/mm-react-components')) {
192
+ fs.writeFileSync(indexCssPath, cssContent + '\n' + existingContent);
193
+ log('āœ… Added MM styles import to existing index.css', 'green');
194
+ } else {
195
+ log('āœ… MM styles import already present in index.css', 'green');
196
+ }
197
+ } else {
198
+ fs.writeFileSync(indexCssPath, cssContent);
199
+ log('āœ… Created index.css with MM styles import', 'green');
200
+ }
201
+
202
+ // Create example component
203
+ const examplesDir = path.join(process.cwd(), 'mm-components-examples');
204
+ if (!fs.existsSync(examplesDir)) {
205
+ fs.mkdirSync(examplesDir);
206
+ }
207
+
208
+ const exampleComponent = `import React from 'react';
209
+ import { Button, Input, Label, Card, CardHeader, CardTitle, CardDescription, CardContent } from '@machinemetrics/mm-react-components';
210
+
211
+ export function MMComponentsExample() {
212
+ return (
213
+ <div className="carbide p-8 space-y-6">
214
+ <h1 className="text-3xl font-bold">MM React Components</h1>
215
+
216
+ {/* Button Examples */}
217
+ <div className="space-y-4">
218
+ <h2 className="text-xl font-semibold">Buttons</h2>
219
+ <div className="flex gap-4">
220
+ <Button>Default</Button>
221
+ <Button variant="secondary">Secondary</Button>
222
+ <Button variant="outline">Outline</Button>
223
+ <Button variant="destructive">Destructive</Button>
224
+ </div>
225
+ </div>
226
+
227
+ {/* Form Example */}
228
+ <div className="space-y-4">
229
+ <h2 className="text-xl font-semibold">Form Components</h2>
230
+ <div className="w-96 space-y-4">
231
+ <div>
232
+ <Label htmlFor="machine-name">Machine Name</Label>
233
+ <Input id="machine-name" placeholder="Enter machine name" />
234
+ </div>
235
+ <Button>Save Configuration</Button>
236
+ </div>
237
+ </div>
238
+
239
+ {/* Card Example using actual Card components */}
240
+ <div className="space-y-4">
241
+ <h2 className="text-xl font-semibold">Card Components</h2>
242
+ <Card className="w-96">
243
+ <CardHeader>
244
+ <CardTitle>Machine Status</CardTitle>
245
+ <CardDescription>CNC-101 • Floor 1, Bay A</CardDescription>
246
+ </CardHeader>
247
+ <CardContent>
248
+ <div className="space-y-2">
249
+ <div className="flex justify-between">
250
+ <span className="text-sm text-muted-foreground">Status</span>
251
+ <span className="text-sm font-medium">Running</span>
252
+ </div>
253
+ <div className="flex justify-between">
254
+ <span className="text-sm text-muted-foreground">Uptime</span>
255
+ <span className="text-sm font-medium">127h 45m</span>
256
+ </div>
257
+ </div>
258
+ <div className="mt-4">
259
+ <Button>View Details</Button>
260
+ </div>
261
+ </CardContent>
262
+ </Card>
263
+ </div>
264
+ </div>
265
+ );
266
+ }`;
267
+
268
+ fs.writeFileSync(
269
+ path.join(examplesDir, 'MMComponentsExample.tsx'),
270
+ exampleComponent,
271
+ );
272
+ log('āœ… Created example component', 'green');
273
+
274
+ // Create JavaScript theme activation example
275
+ const themeActivationExample = `// MM React Components - Zero Config Setup
276
+ // The CSS is already imported via @import in index.css
277
+
278
+ // Activate the Carbide industrial theme by adding the class to your root element
279
+
280
+ // Option 1: Add to HTML (recommended)
281
+ // In your index.html or App component:
282
+ // <div className="carbide">
283
+ // <App />
284
+ // </div>
285
+
286
+ // Option 2: JavaScript activation
287
+ // Add this to your main entry file (e.g., src/main.tsx or src/index.tsx):
288
+ document.documentElement.classList.add('carbide');
289
+
290
+ // The carbide theme provides:
291
+ // • Industrial-appropriate colors and styling
292
+ // • Dark mode support
293
+ // • Enhanced focus states for accessibility
294
+ // • Pre-compiled Tailwind utilities
295
+
296
+ // No build tools needed!`;
297
+
298
+ fs.writeFileSync(
299
+ path.join(examplesDir, 'theme-activation.js'),
300
+ themeActivationExample,
301
+ );
302
+ log('āœ… Created theme activation example', 'green');
303
+
304
+ // Success message
305
+ log(`\nšŸŽ‰ Zero-Config Setup Complete!`, 'green');
306
+ log('\nšŸ“š What was installed:', 'bright');
307
+ log(` • @machinemetrics/mm-react-components@${version}`);
308
+ log(' • Pre-compiled CSS with all styles');
309
+ log(' • Example component in mm-components-examples/');
310
+ log(' • Theme activation example in mm-components-examples/');
311
+
312
+ log('\nāœ… What you got:', 'bright');
313
+ log(' • Pre-compiled CSS with all Tailwind utilities');
314
+ log(' • Carbide industrial theme');
315
+ log(' • Dark mode support');
316
+ log(' • All component styles (focus, hover, etc.)');
317
+ log(' • Google Fonts included');
318
+
319
+ log('\nšŸ’” No build tools needed!', 'yellow');
320
+ log(' This is a zero-config setup - everything just works!');
321
+
322
+ log('\nšŸš€ Next steps:', 'bright');
323
+ log(' 1. Add Carbide class to your root element:');
324
+ log(' document.documentElement.classList.add("carbide")', 'cyan');
325
+ log(' 2. Import components:');
326
+ log(
327
+ ' import { Button, Input } from "@machinemetrics/mm-react-components"',
328
+ 'cyan',
329
+ );
330
+ log(' 3. Check out the example:');
331
+ log(' ./mm-components-examples/MMComponentsExample.tsx', 'cyan');
332
+ log(' 4. Use components - everything is pre-styled and ready!');
333
+
334
+ log('\nšŸ“– Documentation:', 'bright');
335
+ log(' • Getting Started: docs/GETTING_STARTED.md');
336
+ log(' • CSS Options: docs/CSS_EXPORTS.md');
337
+ log(' • Dependencies: docs/DEPENDENCIES.md');
338
+ log(' • GitHub: https://github.com/machinemetrics/mm-react-components');
339
+
340
+ // Offer Chakra migration if detected
341
+ if (hasChakra) {
342
+ log('\nšŸ”„ Chakra UI Detected!', 'yellow');
343
+ log(
344
+ ' We can help you migrate from Chakra UI to MM React Components\n',
345
+ 'cyan',
346
+ );
347
+
348
+ const answer = await askQuestion(
349
+ ' Would you like to run the Chakra UI migration now? (y/N): ',
350
+ );
351
+
352
+ if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
353
+ log('\nšŸ”„ Starting Chakra UI migration...', 'cyan');
354
+
355
+ const migrationScriptPath = path.join(
356
+ __dirname,
357
+ 'chakra-to-shadcn-migrator',
358
+ 'bin',
359
+ 'chakra-to-shadcn.js',
360
+ );
361
+
362
+ if (fs.existsSync(migrationScriptPath)) {
363
+ try {
364
+ execSync(`node "${migrationScriptPath}" --apply`, {
365
+ stdio: 'inherit',
366
+ });
367
+ log('\nāœ… Chakra UI migration complete!', 'green');
368
+ } catch (error) {
369
+ log('\nāš ļø Migration encountered issues', 'yellow');
370
+ log(` ${error.message}`, 'yellow');
371
+ log(
372
+ ' You can run it manually: node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js',
373
+ 'cyan',
374
+ );
375
+ }
376
+ } else {
377
+ log(
378
+ '\nāš ļø Migration script not found at expected location',
379
+ 'yellow',
380
+ );
381
+ log(
382
+ ' Clone the repo to access migration tools: https://github.com/machinemetrics/mm-react-components',
383
+ 'cyan',
384
+ );
385
+ }
386
+ } else {
387
+ log('\n No problem! You can migrate later with:', 'cyan');
388
+ log(
389
+ ' node scripts/chakra-to-shadcn-migrator/chakra-to-shadcn.js --apply',
390
+ 'cyan',
391
+ );
392
+ }
393
+ }
394
+
395
+ log('\nšŸš€ Happy coding!', 'cyan');
396
+ } catch (error) {
397
+ log(`āŒ Setup failed: ${error.message}`, 'red');
398
+ process.exit(1);
399
+ }
400
+ }
401
+
402
+ if (require.main === module) {
403
+ main().catch((error) => {
404
+ log(`āŒ Setup failed: ${error.message}`, 'red');
405
+ process.exit(1);
406
+ });
407
+ }
408
+
409
+ module.exports = { main };
@@ -0,0 +1,88 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ export default {
3
+ darkMode: 'class',
4
+ content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
5
+ theme: {
6
+ extend: {
7
+ colors: {
8
+ background: 'var(--background)',
9
+ foreground: 'var(--foreground)',
10
+ card: 'var(--card)',
11
+ 'card-foreground': 'var(--card-foreground)',
12
+ popover: 'var(--popover)',
13
+ 'popover-foreground': 'var(--popover-foreground)',
14
+ primary: 'var(--primary)',
15
+ 'primary-foreground': 'var(--primary-foreground)',
16
+ secondary: 'var(--secondary)',
17
+ 'secondary-foreground': 'var(--secondary-foreground)',
18
+ muted: 'var(--muted)',
19
+ 'muted-foreground': 'var(--muted-foreground)',
20
+ accent: 'var(--accent)',
21
+ 'accent-foreground': 'var(--accent-foreground)',
22
+ destructive: 'var(--destructive)',
23
+ border: 'var(--border)',
24
+ input: 'var(--input)',
25
+ 'bg-input': 'var(--bg-input)',
26
+ 'border-input': 'var(--border-input)',
27
+ ring: 'var(--ring)',
28
+ },
29
+ borderRadius: {
30
+ sm: 'var(--radius-sm)',
31
+ md: 'var(--radius-md)',
32
+ lg: 'var(--radius-lg)',
33
+ xl: 'var(--radius-xl)',
34
+ },
35
+ fontFamily: {
36
+ sans: [
37
+ 'Inter',
38
+ 'ui-sans-serif',
39
+ 'system-ui',
40
+ '-apple-system',
41
+ 'BlinkMacSystemFont',
42
+ 'Segoe UI',
43
+ 'Roboto',
44
+ 'Helvetica Neue',
45
+ 'Arial',
46
+ 'Noto Sans',
47
+ 'sans-serif',
48
+ 'Apple Color Emoji',
49
+ 'Segoe UI Emoji',
50
+ 'Segoe UI Symbol',
51
+ 'Noto Color Emoji',
52
+ ],
53
+ },
54
+ fontWeight: {
55
+ normal: '400',
56
+ medium: '500',
57
+ semibold: '600',
58
+ bold: 'var(--font-weight-bold)',
59
+ },
60
+ keyframes: {
61
+ 'collapsible-down': {
62
+ from: { height: '0' },
63
+ to: { height: 'var(--radix-collapsible-content-height)' },
64
+ },
65
+ 'collapsible-up': {
66
+ from: { height: 'var(--radix-collapsible-content-height)' },
67
+ to: { height: '0' },
68
+ },
69
+ 'accordion-down': {
70
+ from: { height: '0' },
71
+ to: { height: 'var(--radix-accordion-content-height)' },
72
+ },
73
+ 'accordion-up': {
74
+ from: { height: 'var(--radix-accordion-content-height)' },
75
+ to: { height: '0' },
76
+ },
77
+ },
78
+ animation: {
79
+ 'collapsible-down':
80
+ 'collapsible-down 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
81
+ 'collapsible-up': 'collapsible-up 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
82
+ 'accordion-down': 'accordion-down 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
83
+ 'accordion-up': 'accordion-up 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
84
+ },
85
+ },
86
+ },
87
+ plugins: [],
88
+ };