@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
package/scripts/README.md DELETED
@@ -1,171 +0,0 @@
1
- # Scripts Directory
2
-
3
- This directory contains scripts for maintaining shadcn/ui components and visual regression tests.
4
-
5
- ## Component Creation Script
6
-
7
- ### Create New Component
8
-
9
- ```bash
10
- npm run create-component <component-name>
11
- ```
12
-
13
- Creates a new shadcn/ui component with automatic linting, formatting, and preview generation.
14
-
15
- **Options:**
16
-
17
- - `--skip-preview` - Skip generating preview component
18
- - `--skip-lint` - Skip running ESLint fixes
19
- - `--skip-format` - Skip running Prettier formatting
20
- - `--skip-tests` - Skip generating Playwright tests
21
- - `--help` - Show help message
22
-
23
- **Examples:**
24
-
25
- ```bash
26
- npm run create-component card
27
- npm run create-component dialog --skip-preview
28
- npm run create-component select --skip-lint --skip-format
29
- npm run create-component button --skip-tests
30
- ```
31
-
32
- **Workflow:**
33
-
34
- 1. Add component using shadcn CLI
35
- 2. Apply ESLint fixes (unless --skip-lint)
36
- 3. Apply Prettier formatting (unless --skip-format)
37
- 4. Generate preview component (unless --skip-preview)
38
- 5. Generate Playwright tests (unless --skip-tests)
39
- 6. Update main index.ts exports
40
-
41
- ## Component Update Scripts
42
-
43
- ### TypeScript Version
44
-
45
- ```bash
46
- npm run update-components
47
- ```
48
-
49
- ### Bash Version
50
-
51
- ```bash
52
- npm run update-components:bash
53
- ```
54
-
55
- ## Visual Test Generation Scripts
56
-
57
- ### Generate Missing Tests (Default)
58
-
59
- ```bash
60
- npm run generate-visual-tests
61
- ```
62
-
63
- Only generates tests for components that don't have test files yet. Existing tests are preserved.
64
-
65
- ### Generate All Tests (Overwrite)
66
-
67
- ```bash
68
- npm run generate-visual-tests:overwrite
69
- ```
70
-
71
- Regenerates all test files, overwriting existing ones. Useful after template changes or major updates.
72
-
73
- ## What the Component Update Scripts Do
74
-
75
- Both component update scripts will:
76
-
77
- 1. **Scan** `src/components/ui/` for all installed components
78
- 2. **Filter** out custom components (like `theme-toggle`)
79
- 3. **Update** each remaining component using `npx shadcn@latest add <component> --yes --overwrite`
80
- 4. **Report** a summary of what was updated, skipped, or failed
81
-
82
- The scripts automatically discover components from your folder - no need to maintain a hardcoded list!
83
-
84
- ## What the Visual Test Generation Scripts Do
85
-
86
- The visual test generation script will:
87
-
88
- 1. **Scan** all preview routes in `src/App.tsx` for component previews
89
- 2. **Check** existing test files in `tests/visual/`
90
- 3. **Generate** Playwright test files using TypeScript templates from `scripts/templates/`
91
- 4. **Smart Wait Logic**: Automatically adds table-specific wait conditions for data table components
92
- 5. **Skip or Overwrite**: Either skip existing tests (default) or overwrite them (with `--overwrite`)
93
- 6. **Report** a summary of generated, skipped, and total test files
94
-
95
- ### Generated Test Types
96
-
97
- Each component gets tests for:
98
-
99
- - **Main Component Screenshot**: Captures the component in its default state
100
- - **Mobile Responsive Screenshot**: Tests the component at mobile viewport (375x667)
101
-
102
- ## Features
103
-
104
- ### Component Creation Script
105
-
106
- - ✅ **Smart Component Detection**: Automatically detects component structure and exports
107
- - ✅ **Intelligent Preview Generation**: Creates appropriate preview components based on component type
108
- - ✅ **Special Component Handling**: Custom preview templates for complex components (card, dialog, etc.)
109
- - ✅ **Automatic Linting**: Applies ESLint fixes after component creation
110
- - ✅ **Automatic Formatting**: Applies Prettier formatting for consistent code style
111
- - ✅ **Playwright Test Generation**: Automatically generates visual regression tests
112
- - ✅ **Export Management**: Automatically updates index.ts with new component exports
113
- - ✅ **Error Handling**: Comprehensive error handling with detailed progress reporting
114
- - ✅ **Flexible Options**: Skip any step with command-line flags
115
- - ✅ **Help Documentation**: Built-in help with usage examples
116
-
117
- ### Component Update Scripts
118
-
119
- - ✅ **Auto-Discovery**: Automatically finds all components in your `ui/` folder
120
- - ✅ **Smart Filtering**: Skips custom components automatically
121
- - ✅ **CLI Validation**: Let shadcn CLI determine if components are valid/updatable
122
- - ✅ **Detailed Progress**: Shows real-time updates and comprehensive summary
123
- - ✅ **Error Handling**: Reports failures and continues with other components
124
- - ✅ **Overwrite**: Uses `--overwrite` flag to ensure components are properly updated
125
-
126
- ### Visual Test Generation Scripts
127
-
128
- - ✅ **TypeScript Templates**: Uses proper `.ts` template files for full linting and type-checking
129
- - ✅ **Smart Generation**: Only generates missing tests by default, preserves existing customizations
130
- - ✅ **Overwrite Mode**: `--overwrite` flag regenerates all tests when needed
131
- - ✅ **Dynamic Wait Logic**: Automatically adapts wait conditions for data tables vs regular components
132
- - ✅ **Mobile Testing**: Includes responsive testing at mobile viewport sizes
133
- - ✅ **Route Auto-Discovery**: Automatically finds all component preview routes
134
-
135
- ## Custom Components
136
-
137
- Components listed in `CUSTOM_COMPONENTS` will be skipped during updates:
138
-
139
- - `theme-toggle` - Custom component, not from shadcn/ui
140
-
141
- To add more custom components to skip, edit the `CUSTOM_COMPONENTS` array in either script.
142
-
143
- ## Requirements
144
-
145
- ### TypeScript Version
146
-
147
- - `tsx` package (included in devDependencies)
148
- - Node.js
149
-
150
- ### Bash Version
151
-
152
- - Bash shell
153
- - `npx` command available
154
-
155
- ## Help
156
-
157
- Both scripts support `--help` flag:
158
-
159
- ```bash
160
- npm run update-components -- --help
161
- ./scripts/update-components.sh --help
162
- ```
163
-
164
- ## Troubleshooting
165
-
166
- If updates fail:
167
-
168
- 1. Ensure you have internet connection
169
- 2. Make sure `npx` can access the shadcn CLI
170
- 3. Check that `src/components/ui/` directory exists
171
- 4. Verify you're in the project root directory
@@ -1,107 +0,0 @@
1
- # chakra-to-shadcn-migrator
2
-
3
- A lightweight command-line helper that generates a step-by-step plan for migrating a React codebase from Chakra UI to a Shadcn-based component library. It can optionally apply safe, mechanical edits (dependency updates and import rewrites) whenever explicit mappings are provided.
4
-
5
- ## Features
6
-
7
- - Prints a deterministic migration checklist that covers dependency changes, provider updates, and per-file component swaps.
8
- - Detects Chakra imports across the project and maps them to their Shadcn counterparts based on a configuration file.
9
- - Optional `--apply` flag will rewrite imports and package dependencies when all referenced Chakra components have a mapping.
10
- - Built to be reusable across applications – provide a new mapping config to reuse the workflow.
11
-
12
- ## Installation
13
-
14
- Until the package is published, you can run it directly from the repository:
15
-
16
- ```bash
17
- node ../chakra-to-shadcn-migrator/bin/chakra-to-shadcn.js --project . --config chakra-to-shadcn.config.json
18
- ```
19
-
20
- Or add an npm script to your project (see the knowledge-client example below).
21
-
22
- ## Usage
23
-
24
- ```bash
25
- chakra-to-shadcn --project <path-to-project> --config <config-file> [options]
26
- ```
27
-
28
- ### Options
29
-
30
- | Flag | Description |
31
- | --- | --- |
32
- | `-p, --project` | Root directory of the application you want to migrate. Defaults to the current working directory. |
33
- | `-c, --config` | Path to a `chakra-to-shadcn.config.json` file. If omitted, the tool will look for one in the project root. |
34
- | `--apply` | Apply safe automated edits (dependency updates + import rewrites). Without this flag the tool only prints the migration plan. |
35
- | `--source` | Comma separated list of directories/glob patterns to scan for Chakra imports (defaults to `src`). |
36
- | `--include-tests` | Include `__tests__`, `*.test.*`, `*.spec.*`, and `*.stories.*` files when scanning. |
37
-
38
- ## Configuration format
39
-
40
- Place a `chakra-to-shadcn.config.json` file in your project (or supply one via `--config`). The file describes:
41
-
42
- - Packages to remove and add in `package.json`.
43
- - Human-readable provider instructions.
44
- - Module/Component mappings that tell the tool how to rewrite imports.
45
- - Post-migration reminders.
46
-
47
- ```json
48
- {
49
- "dependenciesToRemove": ["@chakra-ui/react", "@chakra-ui/icons"],
50
- "dependenciesToAdd": {"@machinemetrics/ui-shadcn": "latest"},
51
- "moduleMappings": {
52
- "@chakra-ui/react": {
53
- "default": { "module": "@machinemetrics/ui-shadcn" },
54
- "specifiers": {
55
- "Button": { "module": "@machinemetrics/ui-shadcn", "import": "Button" },
56
- "Card": { "module": "@machinemetrics/ui-shadcn/card", "import": "Card" }
57
- }
58
- }
59
- },
60
- "providerInstructions": [
61
- "Replace ChakraProvider with the UiProvider from @machinemetrics/ui-shadcn/providers in src/index.tsx."
62
- ],
63
- "postSteps": [
64
- "Run npm install",
65
- "Remove Chakra-specific theme utilities"
66
- ]
67
- }
68
- ```
69
-
70
- The `moduleMappings` section lists each Chakra package you wish to replace. For each import specifier the tool either:
71
-
72
- - Finds an explicit mapping under `specifiers`, or
73
- - Falls back to the `default` mapping.
74
-
75
- If a Chakra component has no mapping, the tool flags it as a manual follow-up instead of modifying the file.
76
-
77
- ## Example: knowledge-client
78
-
79
- The `knowledge-client/app` project contains a `chakra-to-shadcn.config.json` tailored to its component usage. Add the following npm script to run the migration helper:
80
-
81
- ```json
82
- {
83
- "scripts": {
84
- "migrate:chakra-to-shadcn": "node ../chakra-to-shadcn-migrator/bin/chakra-to-shadcn.js --project . --config chakra-to-shadcn.config.json"
85
- }
86
- }
87
- ```
88
-
89
- From inside `knowledge-client/app` run:
90
-
91
- ```bash
92
- npm run migrate:chakra-to-shadcn
93
- ```
94
-
95
- Run with `--apply` when you are ready for the tool to make the safe edits.
96
-
97
- ## Suggested workflow
98
-
99
- 1. Run the tool in dry-run mode to generate the migration plan.
100
- 2. Fix any manual follow-ups noted in the report or extend the configuration with more component mappings.
101
- 3. Re-run with `--apply` to let the tool update dependencies and rewrite the mapped imports.
102
- 4. Replace the Chakra provider/theme setup, copy any required Shadcn utility files, and execute the post-steps listed in the plan.
103
- 5. Execute your usual test suite to verify the migration.
104
-
105
- ## License
106
-
107
- MIT