@dailyautomations/ui 1.1.0 → 1.4.0
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/CHANGELOG.md +100 -0
- package/INSTALLATION.md +238 -0
- package/MIGRATION.md +207 -0
- package/README.md +67 -38
- package/dist/components/common/button.js +6 -6
- package/dist/components/common/button.js.map +1 -1
- package/dist/components/dev/theme-tester.d.ts +2 -0
- package/dist/components/dev/theme-tester.d.ts.map +1 -0
- package/dist/components/dev/theme-tester.js +105 -0
- package/dist/components/dev/theme-tester.js.map +1 -0
- package/dist/components/layout/app-shell.d.ts +14 -0
- package/dist/components/layout/app-shell.d.ts.map +1 -0
- package/dist/components/layout/app-shell.js +25 -0
- package/dist/components/layout/app-shell.js.map +1 -0
- 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-dialog.js +40 -0
- package/dist/components/ui/alert-dialog.js.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/avatar.js +15 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +7 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +15 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/confirm-dialog.d.ts +16 -0
- package/dist/components/ui/confirm-dialog.d.ts.map +1 -0
- package/dist/components/ui/confirm-dialog.js +31 -0
- package/dist/components/ui/confirm-dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +51 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/empty-state.d.ts +14 -0
- package/dist/components/ui/empty-state.d.ts.map +1 -0
- package/dist/components/ui/empty-state.js +20 -0
- package/dist/components/ui/empty-state.js.map +1 -0
- package/dist/components/ui/filter-bar.d.ts +29 -0
- package/dist/components/ui/filter-bar.d.ts.map +1 -0
- package/dist/components/ui/filter-bar.js +19 -0
- package/dist/components/ui/filter-bar.js.map +1 -0
- package/dist/components/ui/loading-spinner.d.ts +19 -0
- package/dist/components/ui/loading-spinner.d.ts.map +1 -0
- package/dist/components/ui/loading-spinner.js +28 -0
- package/dist/components/ui/loading-spinner.js.map +1 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +8 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +9 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +6 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +12 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +14 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/separator.d.ts +7 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +9 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +21 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +50 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/slider.d.ts +7 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +9 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/stat-card.d.ts +23 -0
- package/dist/components/ui/stat-card.d.ts.map +1 -0
- package/dist/components/ui/stat-card.js +46 -0
- package/dist/components/ui/stat-card.js.map +1 -0
- package/dist/components/ui/switch.d.ts +7 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +9 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +11 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +28 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +18 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/config/themes.d.ts +18 -0
- package/dist/config/themes.d.ts.map +1 -0
- package/dist/config/themes.js +267 -0
- package/dist/config/themes.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/tokens/tailwind.preset.d.ts.map +1 -1
- package/dist/tokens/tailwind.preset.js.map +1 -1
- package/examples/home-page.tsx +81 -81
- package/examples/main.tsx +24 -9
- package/examples/pages/ComponentsPage.tsx +726 -0
- package/examples/pages/LandingPage.tsx +860 -0
- package/examples/pages/index.ts +2 -0
- package/examples/styles.css +215 -0
- package/package.json +30 -1
- package/src/styles/globals.css +161 -7
- package/src/styles/theme.css +89 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@dailyautomations/ui` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.2.0] - 2025-01-30
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
**Tailwind v4 Migration** - This release adopts Tailwind CSS v4's CSS-first configuration.
|
|
10
|
+
|
|
11
|
+
#### What Changed
|
|
12
|
+
|
|
13
|
+
| Before (v3) | After (v4) |
|
|
14
|
+
|-------------|------------|
|
|
15
|
+
| `@tailwind base/components/utilities` | `@import "tailwindcss"` |
|
|
16
|
+
| Theme defined in `tailwind.config.ts` via preset | Theme defined in CSS via `@theme inline` |
|
|
17
|
+
| Required `presets: [dailyPreset]` in config | No config needed - just import CSS |
|
|
18
|
+
|
|
19
|
+
#### Migration Required
|
|
20
|
+
|
|
21
|
+
If upgrading from v1.1.x, you must update your setup:
|
|
22
|
+
|
|
23
|
+
**Old setup (v3):**
|
|
24
|
+
```typescript
|
|
25
|
+
// tailwind.config.ts
|
|
26
|
+
import dailyPreset from "@dailyautomations/ui/tailwind-preset"
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
presets: [dailyPreset],
|
|
30
|
+
content: [...]
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```css
|
|
35
|
+
/* globals.css */
|
|
36
|
+
@import "@dailyautomations/ui/styles/variables.css";
|
|
37
|
+
@tailwind base;
|
|
38
|
+
@tailwind components;
|
|
39
|
+
@tailwind utilities;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**New setup (v4):**
|
|
43
|
+
```css
|
|
44
|
+
/* globals.css - this is all you need */
|
|
45
|
+
@import "tailwindcss";
|
|
46
|
+
@import "@dailyautomations/ui/styles/globals.css";
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// tailwind.config.ts - simplified, no preset needed
|
|
51
|
+
export default {
|
|
52
|
+
content: [...]
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
See [MIGRATION.md](./MIGRATION.md) for detailed upgrade instructions.
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
|
|
60
|
+
- `src/styles/globals.css` - Complete v4 setup with `@theme inline` directive
|
|
61
|
+
- `src/styles/theme.css` - Standalone theme block for custom CSS setups
|
|
62
|
+
- `./styles/theme.css` export in package.json
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- `tailwind-preset` export now shows deprecation warning (still works for v3)
|
|
67
|
+
- Updated README.md with v4 setup as primary, v3 as legacy
|
|
68
|
+
- Updated INSTALLATION.md with v4 instructions
|
|
69
|
+
|
|
70
|
+
### Deprecated
|
|
71
|
+
|
|
72
|
+
- `@dailyautomations/ui/tailwind-preset` - Use CSS imports for v4 projects
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## [1.1.0] - 2025-01-29
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
|
|
80
|
+
- Page templates and examples
|
|
81
|
+
- Initial component library release
|
|
82
|
+
|
|
83
|
+
## [1.0.1] - 2025-01-28
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- Package publishing configuration
|
|
88
|
+
|
|
89
|
+
## [1.0.0] - 2025-01-28
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
|
|
93
|
+
- Initial release
|
|
94
|
+
- Button, Card, Input, Label, Checkbox components
|
|
95
|
+
- Dialog, Select, Tabs, Toast (Radix-based)
|
|
96
|
+
- Skeleton, Spinner feedback components
|
|
97
|
+
- Animation variants for framer-motion
|
|
98
|
+
- useToast hook
|
|
99
|
+
- Tailwind preset with CSS variable-based theming
|
|
100
|
+
- Purple/orange dark theme system
|
package/INSTALLATION.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# @dailyautomations/ui Installation Guide
|
|
2
|
+
|
|
3
|
+
## Quick Start (Tailwind v4)
|
|
4
|
+
|
|
5
|
+
### 1. Install Package
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @dailyautomations/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or if using this as a local workspace package:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@dailyautomations/ui": "workspace:*"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. Install Peer Dependencies
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install tailwindcss@^4.0.0 react @radix-ui/react-slot
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 3. Import Styles
|
|
28
|
+
|
|
29
|
+
In your `app/globals.css` or main CSS entry point:
|
|
30
|
+
|
|
31
|
+
```css
|
|
32
|
+
@import "tailwindcss";
|
|
33
|
+
@import "@dailyautomations/ui/styles/globals.css";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This single import provides:
|
|
37
|
+
- All CSS custom properties (colors, radius, etc.)
|
|
38
|
+
- `@theme inline` directive for Tailwind v4
|
|
39
|
+
- Base layer styles
|
|
40
|
+
- Keyframe animations
|
|
41
|
+
|
|
42
|
+
### 4. Use the Utilities
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { cn } from "@dailyautomations/ui/utils"
|
|
46
|
+
|
|
47
|
+
export function MyComponent() {
|
|
48
|
+
return (
|
|
49
|
+
<div className={cn(
|
|
50
|
+
"bg-primary text-primary-foreground",
|
|
51
|
+
"px-4 py-2 rounded-lg",
|
|
52
|
+
"hover:bg-primary-hover"
|
|
53
|
+
)}>
|
|
54
|
+
Purple Button
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Alternative: Separate Imports
|
|
61
|
+
|
|
62
|
+
If you need more control over the CSS structure:
|
|
63
|
+
|
|
64
|
+
```css
|
|
65
|
+
@import "tailwindcss";
|
|
66
|
+
@import "@dailyautomations/ui/styles/variables.css";
|
|
67
|
+
|
|
68
|
+
/* Copy from @dailyautomations/ui/styles/theme.css */
|
|
69
|
+
@theme inline {
|
|
70
|
+
--color-primary: rgb(var(--primary));
|
|
71
|
+
--color-primary-foreground: rgb(var(--primary-foreground));
|
|
72
|
+
/* ... full theme definition */
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@layer base {
|
|
76
|
+
* { border-color: rgb(var(--border)); }
|
|
77
|
+
body {
|
|
78
|
+
background-color: rgb(var(--background));
|
|
79
|
+
color: rgb(var(--foreground));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Dark Mode Setup
|
|
85
|
+
|
|
86
|
+
### Next.js with next-themes
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install next-themes
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
// app/providers.tsx
|
|
94
|
+
"use client"
|
|
95
|
+
|
|
96
|
+
import { ThemeProvider } from "next-themes"
|
|
97
|
+
|
|
98
|
+
export function Providers({ children }) {
|
|
99
|
+
return (
|
|
100
|
+
<ThemeProvider attribute="class" defaultTheme="dark" enableSystem>
|
|
101
|
+
{children}
|
|
102
|
+
</ThemeProvider>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// app/layout.tsx
|
|
107
|
+
import { Providers } from "./providers"
|
|
108
|
+
|
|
109
|
+
export default function RootLayout({ children }) {
|
|
110
|
+
return (
|
|
111
|
+
<html lang="en" suppressHydrationWarning>
|
|
112
|
+
<body>
|
|
113
|
+
<Providers>{children}</Providers>
|
|
114
|
+
</body>
|
|
115
|
+
</html>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Dark Mode Toggle Component
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
"use client"
|
|
124
|
+
|
|
125
|
+
import { useTheme } from "next-themes"
|
|
126
|
+
import { cn } from "@dailyautomations/ui/utils"
|
|
127
|
+
|
|
128
|
+
export function ThemeToggle() {
|
|
129
|
+
const { theme, setTheme } = useTheme()
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<button
|
|
133
|
+
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
|
|
134
|
+
className={cn(
|
|
135
|
+
"px-4 py-2 rounded-lg",
|
|
136
|
+
"bg-secondary text-secondary-foreground",
|
|
137
|
+
"hover:bg-accent hover:text-accent-foreground"
|
|
138
|
+
)}
|
|
139
|
+
>
|
|
140
|
+
{theme === "dark" ? "🌞" : "🌙"}
|
|
141
|
+
</button>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Customizing the Theme
|
|
147
|
+
|
|
148
|
+
### Override Radius
|
|
149
|
+
|
|
150
|
+
```css
|
|
151
|
+
/* globals.css - after imports */
|
|
152
|
+
:root {
|
|
153
|
+
--radius: 0.5rem; /* Default is 0.625rem */
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Override Colors
|
|
158
|
+
|
|
159
|
+
```css
|
|
160
|
+
/* globals.css - after imports */
|
|
161
|
+
:root {
|
|
162
|
+
--primary: 37 99 235; /* Override to blue-600 */
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Troubleshooting
|
|
167
|
+
|
|
168
|
+
### "Cannot find module" Error
|
|
169
|
+
|
|
170
|
+
Ensure you're using the correct import paths:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
// ✅ Correct
|
|
174
|
+
import { cn } from "@dailyautomations/ui/utils"
|
|
175
|
+
|
|
176
|
+
// ❌ Wrong
|
|
177
|
+
import { cn } from "@dailyautomations/ui/lib/utils"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### CSS Variables Not Working
|
|
181
|
+
|
|
182
|
+
Make sure you've imported globals.css:
|
|
183
|
+
|
|
184
|
+
```css
|
|
185
|
+
@import "@dailyautomations/ui/styles/globals.css";
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### TypeScript Errors
|
|
189
|
+
|
|
190
|
+
Ensure TypeScript can find the types:
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
// tsconfig.json
|
|
194
|
+
{
|
|
195
|
+
"compilerOptions": {
|
|
196
|
+
"moduleResolution": "bundler"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Tailwind Classes Not Applying
|
|
202
|
+
|
|
203
|
+
1. Ensure you're using Tailwind v4
|
|
204
|
+
2. Check that globals.css is imported in your CSS entry point
|
|
205
|
+
3. Restart your dev server
|
|
206
|
+
4. Clear framework cache (e.g., `rm -rf .next`)
|
|
207
|
+
|
|
208
|
+
## Verification
|
|
209
|
+
|
|
210
|
+
Test your setup:
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
// app/page.tsx
|
|
214
|
+
import { cn } from "@dailyautomations/ui/utils"
|
|
215
|
+
|
|
216
|
+
export default function Home() {
|
|
217
|
+
return (
|
|
218
|
+
<div className="p-8 space-y-4">
|
|
219
|
+
<div className={cn(
|
|
220
|
+
"bg-primary text-primary-foreground p-4 rounded-lg"
|
|
221
|
+
)}>
|
|
222
|
+
Primary (Purple)
|
|
223
|
+
</div>
|
|
224
|
+
<div className="bg-accent text-accent-foreground p-4 rounded-lg">
|
|
225
|
+
Accent (Orange)
|
|
226
|
+
</div>
|
|
227
|
+
<div className="bg-success text-success-foreground p-4 rounded-lg">
|
|
228
|
+
Success
|
|
229
|
+
</div>
|
|
230
|
+
<div className="bg-error text-error-foreground p-4 rounded-lg">
|
|
231
|
+
Error
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
If you see colored boxes with the correct theme colors, you're ready to go!
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Migration Guide
|
|
2
|
+
|
|
3
|
+
## Upgrading to v1.2.0 (Tailwind v4)
|
|
4
|
+
|
|
5
|
+
Version 1.2.0 adopts Tailwind CSS v4's CSS-first configuration. This is a **breaking change** that requires updating your project setup.
|
|
6
|
+
|
|
7
|
+
### Why This Change?
|
|
8
|
+
|
|
9
|
+
Tailwind v4 moves configuration from JavaScript to CSS using the `@theme` directive. Benefits:
|
|
10
|
+
- Simpler setup (just import CSS)
|
|
11
|
+
- Better IDE support for theme values
|
|
12
|
+
- Faster builds
|
|
13
|
+
- No config file needed for theming
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
Ensure you have Tailwind CSS v4 installed:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install tailwindcss@^4.0.0
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Step-by-Step Migration
|
|
24
|
+
|
|
25
|
+
#### Step 1: Update Your CSS Entry Point
|
|
26
|
+
|
|
27
|
+
**Before (v3):**
|
|
28
|
+
```css
|
|
29
|
+
/* app/globals.css */
|
|
30
|
+
@import "@dailyautomations/ui/styles/variables.css";
|
|
31
|
+
@tailwind base;
|
|
32
|
+
@tailwind components;
|
|
33
|
+
@tailwind utilities;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**After (v4):**
|
|
37
|
+
```css
|
|
38
|
+
/* app/globals.css */
|
|
39
|
+
@import "tailwindcss";
|
|
40
|
+
@import "@dailyautomations/ui/styles/globals.css";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
That's it for most projects. The new `globals.css` includes:
|
|
44
|
+
- All CSS custom properties (colors, radius, etc.)
|
|
45
|
+
- `@theme inline` directive that registers colors with Tailwind
|
|
46
|
+
- Base layer styles
|
|
47
|
+
- Keyframe animations
|
|
48
|
+
|
|
49
|
+
#### Step 2: Simplify tailwind.config.ts
|
|
50
|
+
|
|
51
|
+
**Before (v3):**
|
|
52
|
+
```typescript
|
|
53
|
+
import type { Config } from "tailwindcss"
|
|
54
|
+
import dailyPreset from "@dailyautomations/ui/tailwind-preset"
|
|
55
|
+
|
|
56
|
+
const config: Config = {
|
|
57
|
+
presets: [dailyPreset],
|
|
58
|
+
content: [
|
|
59
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
60
|
+
"./node_modules/@dailyautomations/ui/dist/**/*.{js,ts,jsx,tsx}",
|
|
61
|
+
],
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default config
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**After (v4):**
|
|
68
|
+
```typescript
|
|
69
|
+
import type { Config } from "tailwindcss"
|
|
70
|
+
|
|
71
|
+
const config: Config = {
|
|
72
|
+
content: [
|
|
73
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
74
|
+
// Note: UI package content scanning may not be needed in v4
|
|
75
|
+
],
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default config
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The `presets` line is no longer needed - theme values come from CSS.
|
|
82
|
+
|
|
83
|
+
#### Step 3: Verify Your Setup
|
|
84
|
+
|
|
85
|
+
Create a test component:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
export function ThemeTest() {
|
|
89
|
+
return (
|
|
90
|
+
<div className="p-8 space-y-4 bg-background">
|
|
91
|
+
<div className="bg-primary text-primary-foreground p-4 rounded-lg">
|
|
92
|
+
Primary (Purple)
|
|
93
|
+
</div>
|
|
94
|
+
<div className="bg-accent text-accent-foreground p-4 rounded-lg">
|
|
95
|
+
Accent (Orange)
|
|
96
|
+
</div>
|
|
97
|
+
<div className="bg-card text-card-foreground p-4 rounded-lg border">
|
|
98
|
+
Card
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
If colors render correctly, migration is complete.
|
|
106
|
+
|
|
107
|
+
### Troubleshooting
|
|
108
|
+
|
|
109
|
+
#### Colors Not Working
|
|
110
|
+
|
|
111
|
+
**Symptom:** `bg-primary` shows no color or wrong color.
|
|
112
|
+
|
|
113
|
+
**Solution:** Ensure imports are in the correct order:
|
|
114
|
+
```css
|
|
115
|
+
@import "tailwindcss";
|
|
116
|
+
@import "@dailyautomations/ui/styles/globals.css";
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The `@theme` directive must come after `@import "tailwindcss"`.
|
|
120
|
+
|
|
121
|
+
#### Build Errors About @theme
|
|
122
|
+
|
|
123
|
+
**Symptom:** `Unknown at-rule @theme` error.
|
|
124
|
+
|
|
125
|
+
**Solution:** Update to Tailwind v4:
|
|
126
|
+
```bash
|
|
127
|
+
npm install tailwindcss@^4.0.0 @tailwindcss/postcss@^4.0.0
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### TypeScript Errors for Preset Import
|
|
131
|
+
|
|
132
|
+
**Symptom:** TypeScript can't find `@dailyautomations/ui/tailwind-preset`.
|
|
133
|
+
|
|
134
|
+
**Solution:** The preset still exists for v3 compatibility, but you don't need it for v4. Remove the import.
|
|
135
|
+
|
|
136
|
+
#### Next.js Cache Issues
|
|
137
|
+
|
|
138
|
+
**Symptom:** Old styles persist after migration.
|
|
139
|
+
|
|
140
|
+
**Solution:** Clear the cache:
|
|
141
|
+
```bash
|
|
142
|
+
rm -rf .next
|
|
143
|
+
npm run dev
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Staying on Tailwind v3
|
|
147
|
+
|
|
148
|
+
If you can't upgrade to Tailwind v4 yet, the old setup still works:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
// tailwind.config.ts
|
|
152
|
+
import dailyPreset from "@dailyautomations/ui/tailwind-preset"
|
|
153
|
+
|
|
154
|
+
export default {
|
|
155
|
+
presets: [dailyPreset], // Shows deprecation warning but works
|
|
156
|
+
content: [...]
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```css
|
|
161
|
+
/* globals.css */
|
|
162
|
+
@import "@dailyautomations/ui/styles/variables.css";
|
|
163
|
+
@tailwind base;
|
|
164
|
+
@tailwind components;
|
|
165
|
+
@tailwind utilities;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Note: The preset shows a deprecation warning. Plan to migrate to v4 when possible.
|
|
169
|
+
|
|
170
|
+
### Custom Theme Setup
|
|
171
|
+
|
|
172
|
+
If you need to customize the theme or can't import `globals.css` directly:
|
|
173
|
+
|
|
174
|
+
```css
|
|
175
|
+
@import "tailwindcss";
|
|
176
|
+
@import "@dailyautomations/ui/styles/variables.css";
|
|
177
|
+
|
|
178
|
+
/* Copy the @theme block from @dailyautomations/ui/styles/theme.css */
|
|
179
|
+
@theme inline {
|
|
180
|
+
--color-primary: rgb(var(--primary));
|
|
181
|
+
--color-primary-foreground: rgb(var(--primary-foreground));
|
|
182
|
+
/* ... see theme.css for complete list */
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Override specific colors after the theme block */
|
|
186
|
+
:root {
|
|
187
|
+
--primary: 37 99 235; /* Change primary to blue */
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### What's New in globals.css
|
|
192
|
+
|
|
193
|
+
The new `globals.css` provides everything in one import:
|
|
194
|
+
|
|
195
|
+
| Feature | Description |
|
|
196
|
+
|---------|-------------|
|
|
197
|
+
| `@import "tailwindcss"` | Tailwind base styles |
|
|
198
|
+
| `@import "./variables.css"` | CSS custom properties |
|
|
199
|
+
| `@theme inline { ... }` | Registers colors/radius with Tailwind |
|
|
200
|
+
| `@keyframes` | Dialog and fade animations |
|
|
201
|
+
| `@layer base` | Default border color, body styles |
|
|
202
|
+
|
|
203
|
+
### Questions?
|
|
204
|
+
|
|
205
|
+
If you encounter issues not covered here, check:
|
|
206
|
+
- [README.md](./README.md) - Full setup documentation
|
|
207
|
+
- [INSTALLATION.md](./INSTALLATION.md) - Detailed installation guide
|
package/README.md
CHANGED
|
@@ -11,41 +11,26 @@ npm install @dailyautomations/ui
|
|
|
11
11
|
## Peer Dependencies
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install react react-dom tailwindcss @radix-ui/react-slot @radix-ui/react-dialog @radix-ui/react-select @radix-ui/react-checkbox @radix-ui/react-label @radix-ui/react-tabs @radix-ui/react-toast
|
|
14
|
+
npm install react react-dom tailwindcss@^4.0.0 @radix-ui/react-slot @radix-ui/react-dialog @radix-ui/react-select @radix-ui/react-checkbox @radix-ui/react-label @radix-ui/react-tabs @radix-ui/react-toast
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
## Setup
|
|
17
|
+
## Setup (Tailwind v4)
|
|
18
18
|
|
|
19
|
-
### 1. Import the CSS
|
|
19
|
+
### 1. Import the styles in your CSS
|
|
20
20
|
|
|
21
|
-
In your
|
|
21
|
+
In your `app/globals.css` or main CSS file:
|
|
22
22
|
|
|
23
23
|
```css
|
|
24
|
-
@import "
|
|
24
|
+
@import "tailwindcss";
|
|
25
25
|
@import "@dailyautomations/ui/styles/globals.css";
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
import type { Config } from "tailwindcss"
|
|
34
|
-
import dailyPreset from "@dailyautomations/ui/tailwind-preset"
|
|
35
|
-
|
|
36
|
-
const config: Config = {
|
|
37
|
-
presets: [dailyPreset],
|
|
38
|
-
content: [
|
|
39
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
|
40
|
-
"./node_modules/@dailyautomations/ui/dist/**/*.{js,ts,jsx,tsx}",
|
|
41
|
-
],
|
|
42
|
-
// Your custom config...
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default config
|
|
46
|
-
```
|
|
28
|
+
That's it! The `globals.css` includes:
|
|
29
|
+
- CSS variables for all theme colors
|
|
30
|
+
- `@theme inline` directive for Tailwind v4
|
|
31
|
+
- Base styles and keyframe animations
|
|
47
32
|
|
|
48
|
-
###
|
|
33
|
+
### 2. Use components and utilities
|
|
49
34
|
|
|
50
35
|
```typescript
|
|
51
36
|
import { Button, Card, Input, Label } from "@dailyautomations/ui"
|
|
@@ -67,28 +52,72 @@ function MyComponent() {
|
|
|
67
52
|
}
|
|
68
53
|
```
|
|
69
54
|
|
|
55
|
+
## Alternative: Custom CSS Setup
|
|
56
|
+
|
|
57
|
+
If you need more control over your CSS structure, import the pieces separately:
|
|
58
|
+
|
|
59
|
+
```css
|
|
60
|
+
@import "tailwindcss";
|
|
61
|
+
@import "@dailyautomations/ui/styles/variables.css";
|
|
62
|
+
|
|
63
|
+
/* Copy @theme block from @dailyautomations/ui/styles/theme.css */
|
|
64
|
+
@theme inline {
|
|
65
|
+
--color-primary: rgb(var(--primary));
|
|
66
|
+
/* ... see theme.css for full list */
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Legacy Setup (Tailwind v3)
|
|
71
|
+
|
|
72
|
+
For Tailwind v3 projects, use the preset approach:
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// tailwind.config.ts
|
|
76
|
+
import type { Config } from "tailwindcss"
|
|
77
|
+
import dailyPreset from "@dailyautomations/ui/tailwind-preset"
|
|
78
|
+
|
|
79
|
+
const config: Config = {
|
|
80
|
+
presets: [dailyPreset],
|
|
81
|
+
content: [
|
|
82
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
83
|
+
"./node_modules/@dailyautomations/ui/dist/**/*.{js,ts,jsx,tsx}",
|
|
84
|
+
],
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default config
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
And import the CSS:
|
|
91
|
+
|
|
92
|
+
```css
|
|
93
|
+
@import "@dailyautomations/ui/styles/variables.css";
|
|
94
|
+
@tailwind base;
|
|
95
|
+
@tailwind components;
|
|
96
|
+
@tailwind utilities;
|
|
97
|
+
```
|
|
98
|
+
|
|
70
99
|
## Theme Colors
|
|
71
100
|
|
|
72
101
|
### Primary (Purple - Brand Identity)
|
|
73
|
-
- `bg-
|
|
74
|
-
- `text-
|
|
75
|
-
- `
|
|
102
|
+
- `bg-primary` - #8B5CF6
|
|
103
|
+
- `text-primary-foreground` - White text on primary
|
|
104
|
+
- `bg-primary-hover` - Hover state
|
|
76
105
|
|
|
77
106
|
### Accent (Orange - CTAs)
|
|
78
|
-
- `bg-
|
|
79
|
-
- `bg-
|
|
80
|
-
- `bg-
|
|
107
|
+
- `bg-accent` - #F97316 (Primary buttons)
|
|
108
|
+
- `bg-accent-hover` - Hover state
|
|
109
|
+
- `bg-accent-active` - Active state
|
|
81
110
|
|
|
82
111
|
### Background (Dark)
|
|
83
|
-
- `bg-
|
|
84
|
-
- `bg-
|
|
85
|
-
- `bg-
|
|
112
|
+
- `bg-background` - #0F0F14 (Page background)
|
|
113
|
+
- `bg-card` - Card surfaces
|
|
114
|
+
- `bg-popover` - Elevated surfaces
|
|
86
115
|
|
|
87
116
|
### Semantic Colors
|
|
88
|
-
- Success:
|
|
89
|
-
- Error:
|
|
90
|
-
- Warning:
|
|
91
|
-
- Info:
|
|
117
|
+
- Success: `bg-success`, `text-success-foreground`
|
|
118
|
+
- Error: `bg-error`, `text-error-foreground`
|
|
119
|
+
- Warning: `bg-warning`, `text-warning-foreground`
|
|
120
|
+
- Info: `bg-info`, `text-info-foreground`
|
|
92
121
|
|
|
93
122
|
## Components
|
|
94
123
|
|
|
@@ -2,15 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { cn } from "../../utils/cn";
|
|
5
|
-
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-semibold transition-all disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-
|
|
5
|
+
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-semibold transition-all disabled:pointer-events-none disabled:opacity-40 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background", {
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
|
-
default: "bg-
|
|
9
|
-
secondary: "bg-
|
|
10
|
-
outline: "border-2 border-
|
|
11
|
-
ghost: "text-
|
|
8
|
+
default: "bg-accent text-white hover:brightness-110 active:brightness-90",
|
|
9
|
+
secondary: "bg-primary text-white hover:brightness-110 active:brightness-90",
|
|
10
|
+
outline: "border-2 border-primary text-primary bg-transparent hover:bg-primary/10",
|
|
11
|
+
ghost: "text-primary hover:bg-primary/10 hover:brightness-110",
|
|
12
12
|
destructive: "bg-red-600 text-white hover:bg-red-500 active:bg-red-700",
|
|
13
|
-
link: "text-
|
|
13
|
+
link: "text-primary underline-offset-4 hover:underline hover:brightness-110",
|
|
14
14
|
},
|
|
15
15
|
size: {
|
|
16
16
|
default: "h-10 px-5 py-2",
|