myoperator-ui 0.0.25 → 0.0.27
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 +91 -49
- package/dist/index.js +0 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# myOperator UI
|
|
2
2
|
|
|
3
|
-
CLI for adding myOperator UI components to your React project.
|
|
3
|
+
CLI for adding myOperator UI components to your React project. Works with both standalone projects and projects that use Bootstrap or other CSS frameworks.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -20,8 +20,7 @@ This will:
|
|
|
20
20
|
- Create a `components.json` configuration file
|
|
21
21
|
- Set up the utils file with the `cn` helper
|
|
22
22
|
- Create the components directory
|
|
23
|
-
- Create/update your global CSS with
|
|
24
|
-
- Create/update `tailwind.config.js` with theme color mappings
|
|
23
|
+
- Create/update your global CSS with Tailwind imports
|
|
25
24
|
- Create/update `postcss.config.js` with the correct Tailwind CSS PostCSS plugin
|
|
26
25
|
|
|
27
26
|
### Add components
|
|
@@ -48,8 +47,59 @@ npx myoperator-ui add button --overwrite
|
|
|
48
47
|
|
|
49
48
|
# Custom path
|
|
50
49
|
npx myoperator-ui add button -p src/ui
|
|
50
|
+
|
|
51
|
+
# Check version
|
|
52
|
+
npx myoperator-ui --version
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Bootstrap Compatibility
|
|
56
|
+
|
|
57
|
+
myOperator UI automatically detects if your project uses Bootstrap and configures Tailwind CSS to avoid conflicts.
|
|
58
|
+
|
|
59
|
+
### How it works
|
|
60
|
+
|
|
61
|
+
When Bootstrap is detected, the CLI:
|
|
62
|
+
|
|
63
|
+
1. **Uses selective Tailwind imports** - Imports only theme and utilities, skipping Preflight (Tailwind's CSS reset) which would override Bootstrap's base styles
|
|
64
|
+
|
|
65
|
+
2. **No class name conflicts** - Tailwind utility classes like `bg-[#343E55]`, `flex`, `p-4` don't overlap with Bootstrap classes like `btn`, `container`, `row`
|
|
66
|
+
|
|
67
|
+
### Generated CSS for Bootstrap projects
|
|
68
|
+
|
|
69
|
+
```css
|
|
70
|
+
/* Selective imports to avoid Preflight conflicts with Bootstrap */
|
|
71
|
+
@layer theme, base, components, utilities;
|
|
72
|
+
@import "tailwindcss/theme.css" layer(theme);
|
|
73
|
+
@import "tailwindcss/utilities.css" layer(utilities);
|
|
74
|
+
|
|
75
|
+
/* Tell Tailwind to scan component files for utility classes */
|
|
76
|
+
@source "./components/**/*.{js,ts,jsx,tsx}";
|
|
77
|
+
@source "./lib/**/*.{js,ts,jsx,tsx}";
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Note on Prefixes
|
|
81
|
+
|
|
82
|
+
Tailwind CSS v4's `prefix()` option only works with the full `@import "tailwindcss"` which includes Preflight. Since Bootstrap compatibility requires skipping Preflight, prefixes are not available for Bootstrap projects.
|
|
83
|
+
|
|
84
|
+
## Tailwind CSS Version Support
|
|
85
|
+
|
|
86
|
+
### Tailwind CSS v4 (default)
|
|
87
|
+
|
|
88
|
+
For v4 projects, the CLI generates CSS-based configuration:
|
|
89
|
+
|
|
90
|
+
```css
|
|
91
|
+
@import "tailwindcss";
|
|
92
|
+
|
|
93
|
+
@theme {
|
|
94
|
+
--color-primary: hsl(222.2 47.4% 11.2%);
|
|
95
|
+
/* ... */
|
|
96
|
+
}
|
|
51
97
|
```
|
|
52
98
|
|
|
99
|
+
### Tailwind CSS v3
|
|
100
|
+
|
|
101
|
+
For v3 projects, the CLI generates the traditional configuration with `tailwind.config.js` and CSS variables.
|
|
102
|
+
|
|
53
103
|
## Available Components
|
|
54
104
|
|
|
55
105
|
- `button` - A customizable button with variants, sizes, icons, and loading state
|
|
@@ -57,7 +107,7 @@ npx myoperator-ui add button -p src/ui
|
|
|
57
107
|
## Requirements
|
|
58
108
|
|
|
59
109
|
- React 18+
|
|
60
|
-
- Tailwind CSS
|
|
110
|
+
- Tailwind CSS v3 or v4
|
|
61
111
|
- TypeScript (recommended)
|
|
62
112
|
|
|
63
113
|
## Dependencies
|
|
@@ -68,54 +118,25 @@ Components use these packages:
|
|
|
68
118
|
- `clsx`
|
|
69
119
|
- `tailwind-merge`
|
|
70
120
|
- `lucide-react`
|
|
71
|
-
- `tailwindcss-animate`
|
|
72
|
-
|
|
73
|
-
## CSS Variables & Theming
|
|
74
|
-
|
|
75
|
-
Components use CSS variables for theming. The `init` command automatically sets up these variables in your global CSS file.
|
|
76
|
-
|
|
77
|
-
### Theme Colors
|
|
78
|
-
|
|
79
|
-
The following semantic colors are available:
|
|
80
121
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
| `--background` | Page background |
|
|
84
|
-
| `--foreground` | Default text color |
|
|
85
|
-
| `--primary` | Primary brand color |
|
|
86
|
-
| `--secondary` | Secondary color |
|
|
87
|
-
| `--destructive` | Error/danger color |
|
|
88
|
-
| `--muted` | Muted backgrounds |
|
|
89
|
-
| `--accent` | Accent color |
|
|
90
|
-
| `--border` | Border color |
|
|
91
|
-
| `--ring` | Focus ring color |
|
|
92
|
-
|
|
93
|
-
### Dark Mode
|
|
94
|
-
|
|
95
|
-
Dark mode is supported via the `.dark` class on the root element. The CSS variables automatically switch to dark theme values.
|
|
96
|
-
|
|
97
|
-
### Customizing Theme
|
|
98
|
-
|
|
99
|
-
To customize colors, edit the CSS variables in your global CSS file:
|
|
100
|
-
|
|
101
|
-
```css
|
|
102
|
-
:root {
|
|
103
|
-
--primary: 222.2 47.4% 11.2%;
|
|
104
|
-
--destructive: 0 84.2% 60.2%;
|
|
105
|
-
/* ... other variables */
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Colors use HSL format without the `hsl()` wrapper (e.g., `222.2 47.4% 11.2%`).
|
|
122
|
+
For Tailwind v3, you'll also need:
|
|
123
|
+
- `tailwindcss-animate`
|
|
110
124
|
|
|
111
125
|
## PostCSS Configuration
|
|
112
126
|
|
|
113
|
-
This CLI automatically sets up the correct PostCSS configuration for Tailwind CSS.
|
|
127
|
+
This CLI automatically sets up the correct PostCSS configuration for Tailwind CSS.
|
|
114
128
|
|
|
115
|
-
###
|
|
129
|
+
### For Tailwind v4
|
|
116
130
|
|
|
117
131
|
```javascript
|
|
118
|
-
// postcss.config.js
|
|
132
|
+
// postcss.config.js (ESM)
|
|
133
|
+
export default {
|
|
134
|
+
plugins: {
|
|
135
|
+
'@tailwindcss/postcss': {},
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// postcss.config.js (CommonJS)
|
|
119
140
|
module.exports = {
|
|
120
141
|
plugins: {
|
|
121
142
|
'@tailwindcss/postcss': {},
|
|
@@ -129,8 +150,6 @@ If you see this error:
|
|
|
129
150
|
|
|
130
151
|
```
|
|
131
152
|
[plugin:vite:css] [postcss] It looks like you're trying to use `tailwindcss` directly as a PostCSS plugin.
|
|
132
|
-
The PostCSS plugin has moved to a separate package, so to continue using Tailwind CSS with PostCSS
|
|
133
|
-
you'll need to install `@tailwindcss/postcss` and update your PostCSS configuration.
|
|
134
153
|
```
|
|
135
154
|
|
|
136
155
|
**Fix it by:**
|
|
@@ -140,9 +159,32 @@ you'll need to install `@tailwindcss/postcss` and update your PostCSS configurat
|
|
|
140
159
|
npm install -D @tailwindcss/postcss
|
|
141
160
|
```
|
|
142
161
|
|
|
143
|
-
2.
|
|
162
|
+
2. Run `npx myoperator-ui init` to automatically create the correct configuration
|
|
163
|
+
|
|
164
|
+
## Troubleshooting
|
|
165
|
+
|
|
166
|
+
### Button styles not applying
|
|
167
|
+
|
|
168
|
+
Make sure you've installed the required dependencies:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
npm install clsx tailwind-merge class-variance-authority @radix-ui/react-slot lucide-react
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Styles conflict with Bootstrap
|
|
175
|
+
|
|
176
|
+
If you're seeing Bootstrap styles override your components, make sure:
|
|
177
|
+
|
|
178
|
+
1. You ran `npx myoperator-ui init` after adding Bootstrap
|
|
179
|
+
2. The CSS file has selective imports (not `@import "tailwindcss"`)
|
|
180
|
+
|
|
181
|
+
### Version mismatch
|
|
144
182
|
|
|
145
|
-
|
|
183
|
+
To ensure you're using the latest version:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npx --yes myoperator-ui@latest init
|
|
187
|
+
```
|
|
146
188
|
|
|
147
189
|
## License
|
|
148
190
|
|
package/dist/index.js
CHANGED
|
@@ -398,14 +398,6 @@ var CSS_VARIABLES_V3 = `@tailwind base;
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
@layer base {
|
|
402
|
-
* {
|
|
403
|
-
@apply border-border;
|
|
404
|
-
}
|
|
405
|
-
body {
|
|
406
|
-
@apply bg-background text-foreground;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
401
|
`;
|
|
410
402
|
var getTailwindConfig = (prefix) => `/** @type {import('tailwindcss').Config} */
|
|
411
403
|
export default {
|