@agenticindiedev/ui 0.2.4 → 0.3.1
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 +254 -26
- package/dist/index.cjs +9 -9
- package/dist/index.d.ts +36 -0
- package/dist/index.js +1713 -1664
- package/dist/styles.css +53 -413
- package/dist/tailwind.preset.js +91 -0
- package/dist/themes/dark.scss +57 -0
- package/dist/themes/light.scss +57 -0
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -8,6 +8,77 @@ A modern React component library built with TypeScript, Tailwind CSS v4, Radix U
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
bun add @agenticindiedev/ui
|
|
11
|
+
# or
|
|
12
|
+
npm install @agenticindiedev/ui
|
|
13
|
+
# or
|
|
14
|
+
yarn add @agenticindiedev/ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
Get started in 3 simple steps:
|
|
20
|
+
|
|
21
|
+
### 1. Add Tailwind Preset
|
|
22
|
+
|
|
23
|
+
Add the preset to your `tailwind.config.ts`:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import type { Config } from 'tailwindcss';
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
presets: [require('@agenticindiedev/ui/tailwind.preset')],
|
|
30
|
+
// Your other Tailwind config...
|
|
31
|
+
} satisfies Config;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2. Import Theme CSS
|
|
35
|
+
|
|
36
|
+
Choose a theme and import it (this replaces the need for `styles.css`):
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
// Light theme (off-white) - includes Tailwind and theme variables
|
|
40
|
+
import '@agenticindiedev/ui/themes/light.scss';
|
|
41
|
+
|
|
42
|
+
// OR Dark theme (gray) - includes Tailwind and theme variables
|
|
43
|
+
import '@agenticindiedev/ui/themes/dark.scss';
|
|
44
|
+
|
|
45
|
+
// Note: Import only ONE theme file, not both styles.css and a theme file
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. Use Components
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
import { Button, Card, CardHeader, CardContent } from '@agenticindiedev/ui';
|
|
52
|
+
|
|
53
|
+
function App() {
|
|
54
|
+
return (
|
|
55
|
+
<Card>
|
|
56
|
+
<CardHeader>Welcome</CardHeader>
|
|
57
|
+
<CardContent>
|
|
58
|
+
<Button variant="primary">Click me</Button>
|
|
59
|
+
</CardContent>
|
|
60
|
+
</Card>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
That's it! Your components are ready to use and look great out of the box.
|
|
66
|
+
|
|
67
|
+
### Theme Switching
|
|
68
|
+
|
|
69
|
+
You can switch themes programmatically:
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { setTheme, getTheme, initTheme } from '@agenticindiedev/ui';
|
|
73
|
+
|
|
74
|
+
// Initialize theme on app load
|
|
75
|
+
initTheme();
|
|
76
|
+
|
|
77
|
+
// Switch themes
|
|
78
|
+
setTheme('dark'); // or 'light'
|
|
79
|
+
|
|
80
|
+
// Get current theme
|
|
81
|
+
const currentTheme = getTheme();
|
|
11
82
|
```
|
|
12
83
|
|
|
13
84
|
## Setup
|
|
@@ -70,30 +141,205 @@ function App() {
|
|
|
70
141
|
|
|
71
142
|
## Customization
|
|
72
143
|
|
|
73
|
-
All components accept a `className` prop that merges seamlessly with existing styles
|
|
144
|
+
The library provides multiple ways to customize components to match your design system. All components accept a `className` prop that merges seamlessly with existing styles.
|
|
145
|
+
|
|
146
|
+
### Method 1: CSS Variables (Global Theming)
|
|
147
|
+
|
|
148
|
+
The easiest way to customize colors globally is by overriding CSS variables. This affects all components using those color tokens.
|
|
149
|
+
|
|
150
|
+
**Example: Customize Button Primary Color**
|
|
151
|
+
|
|
152
|
+
```css
|
|
153
|
+
/* In your global CSS file (e.g., globals.css, app.css) */
|
|
154
|
+
:root {
|
|
155
|
+
/* Change primary color to green */
|
|
156
|
+
--primary: 142 76% 36%;
|
|
157
|
+
--primary-foreground: 0 0% 100%;
|
|
158
|
+
|
|
159
|
+
/* Or use any color you want */
|
|
160
|
+
--primary: 262 83% 58%; /* Purple */
|
|
161
|
+
--primary: 0 72% 51%; /* Red */
|
|
162
|
+
--primary: 217 91% 60%; /* Blue */
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
All buttons with `variant="primary"` will now use your custom color:
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
<Button variant="primary">My Custom Green Button</Button>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Available CSS Variables:**
|
|
173
|
+
|
|
174
|
+
```css
|
|
175
|
+
:root {
|
|
176
|
+
/* Background & Text */
|
|
177
|
+
--background: 0 0% 100%;
|
|
178
|
+
--foreground: 222.2 47.4% 11.2%;
|
|
179
|
+
|
|
180
|
+
/* Primary Colors */
|
|
181
|
+
--primary: 199.1 89.1% 48.2%;
|
|
182
|
+
--primary-foreground: 210 40% 98%;
|
|
183
|
+
|
|
184
|
+
/* Secondary Colors */
|
|
185
|
+
--secondary: 210 40% 96.1%;
|
|
186
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
187
|
+
|
|
188
|
+
/* Accent Colors */
|
|
189
|
+
--accent: 210 40% 96.1%;
|
|
190
|
+
--accent-foreground: 222.2 47.4% 11.2%;
|
|
191
|
+
|
|
192
|
+
/* Destructive (Error) Colors */
|
|
193
|
+
--destructive: 0 84.2% 60.2%;
|
|
194
|
+
--destructive-foreground: 210 40% 98%;
|
|
195
|
+
|
|
196
|
+
/* Muted Colors */
|
|
197
|
+
--muted: 210 40% 96.1%;
|
|
198
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
|
199
|
+
|
|
200
|
+
/* Borders & Inputs */
|
|
201
|
+
--border: 214.3 31.8% 91.4%;
|
|
202
|
+
--input: 214.3 31.8% 91.4%;
|
|
203
|
+
--ring: 199.1 89.1% 48.2%;
|
|
204
|
+
|
|
205
|
+
/* Card Colors */
|
|
206
|
+
--card: 0 0% 100%;
|
|
207
|
+
--card-foreground: 222.2 47.4% 11.2%;
|
|
208
|
+
|
|
209
|
+
/* Popover Colors */
|
|
210
|
+
--popover: 0 0% 100%;
|
|
211
|
+
--popover-foreground: 222.2 47.4% 11.2%;
|
|
212
|
+
|
|
213
|
+
/* Border Radius */
|
|
214
|
+
--radius: 0.5rem;
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Method 2: Component-Specific Customization (className)
|
|
219
|
+
|
|
220
|
+
For one-off customizations, use the `className` prop to override styles:
|
|
74
221
|
|
|
75
222
|
```tsx
|
|
76
223
|
<Button
|
|
77
224
|
variant="primary"
|
|
78
|
-
className="bg-
|
|
225
|
+
className="bg-purple-500 hover:bg-purple-600 text-white"
|
|
79
226
|
>
|
|
80
|
-
Custom
|
|
227
|
+
Custom Purple Button
|
|
228
|
+
</Button>
|
|
229
|
+
|
|
230
|
+
<Button
|
|
231
|
+
variant="outline"
|
|
232
|
+
className="border-2 border-pink-500 text-pink-600 hover:bg-pink-50"
|
|
233
|
+
>
|
|
234
|
+
Custom Pink Outline Button
|
|
81
235
|
</Button>
|
|
82
236
|
```
|
|
83
237
|
|
|
84
|
-
###
|
|
238
|
+
### Method 3: Create Custom Theme File
|
|
85
239
|
|
|
86
|
-
|
|
240
|
+
For a complete custom theme, create your own CSS file:
|
|
87
241
|
|
|
88
242
|
```css
|
|
243
|
+
/* my-custom-theme.css */
|
|
244
|
+
@import 'tailwindcss';
|
|
245
|
+
|
|
89
246
|
:root {
|
|
90
|
-
--primary:
|
|
91
|
-
--primary-foreground:
|
|
247
|
+
--primary: 142 76% 36%; /* Your brand green */
|
|
248
|
+
--primary-foreground: 0 0% 100%;
|
|
249
|
+
--secondary: 210 20% 96%;
|
|
250
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
251
|
+
/* ... define all your colors */
|
|
252
|
+
--radius: 0.75rem; /* Custom border radius */
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@keyframes accordion-down {
|
|
256
|
+
from {
|
|
257
|
+
height: 0;
|
|
258
|
+
}
|
|
259
|
+
to {
|
|
260
|
+
height: var(--radix-accordion-content-height);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
@keyframes accordion-up {
|
|
265
|
+
from {
|
|
266
|
+
height: var(--radix-accordion-content-height);
|
|
267
|
+
}
|
|
268
|
+
to {
|
|
269
|
+
height: 0;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Then import it instead of the default theme:
|
|
275
|
+
|
|
276
|
+
```tsx
|
|
277
|
+
import './my-custom-theme.css';
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Method 4: Tailwind Config Override
|
|
281
|
+
|
|
282
|
+
You can also extend colors in your `tailwind.config.ts`:
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
import type { Config } from 'tailwindcss';
|
|
286
|
+
|
|
287
|
+
export default {
|
|
288
|
+
presets: [require('@agenticindiedev/ui/tailwind.preset')],
|
|
289
|
+
theme: {
|
|
290
|
+
extend: {
|
|
291
|
+
colors: {
|
|
292
|
+
// Override or extend colors
|
|
293
|
+
primary: {
|
|
294
|
+
DEFAULT: '#10b981', // Your custom green
|
|
295
|
+
foreground: '#ffffff',
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
} satisfies Config;
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Dark Mode Customization
|
|
304
|
+
|
|
305
|
+
Dark mode is supported via the `dark` class on your HTML element. Customize dark mode colors:
|
|
306
|
+
|
|
307
|
+
```css
|
|
308
|
+
.dark {
|
|
309
|
+
--primary: 142 76% 50%; /* Lighter green for dark mode */
|
|
310
|
+
--background: 222.2 47.4% 11.2%;
|
|
311
|
+
--foreground: 210 40% 98%;
|
|
92
312
|
/* ... */
|
|
93
313
|
}
|
|
94
314
|
```
|
|
95
315
|
|
|
96
|
-
|
|
316
|
+
### Examples: Button Color Customization
|
|
317
|
+
|
|
318
|
+
**Change all primary buttons to green:**
|
|
319
|
+
|
|
320
|
+
```css
|
|
321
|
+
:root {
|
|
322
|
+
--primary: 142 76% 36%;
|
|
323
|
+
--primary-foreground: 0 0% 100%;
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Change a single button:**
|
|
328
|
+
|
|
329
|
+
```tsx
|
|
330
|
+
<Button className="bg-green-500 hover:bg-green-600">Green Button</Button>
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
**Create a custom variant:**
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
<Button
|
|
337
|
+
variant="outline"
|
|
338
|
+
className="border-green-500 text-green-600 hover:bg-green-50"
|
|
339
|
+
>
|
|
340
|
+
Green Outline
|
|
341
|
+
</Button>
|
|
342
|
+
```
|
|
97
343
|
|
|
98
344
|
## Components
|
|
99
345
|
|
|
@@ -259,24 +505,6 @@ src/
|
|
|
259
505
|
└── index.ts # Public exports
|
|
260
506
|
```
|
|
261
507
|
|
|
262
|
-
## Migration from DaisyUI
|
|
263
|
-
|
|
264
|
-
If you were using DaisyUI, note that this package has migrated to shadcn/ui patterns with Radix UI primitives. The API remains similar, but components now use Radix UI for better accessibility and TypeScript support.
|
|
265
|
-
|
|
266
|
-
### Breaking Changes
|
|
267
|
-
|
|
268
|
-
- DaisyUI classes are no longer available
|
|
269
|
-
- Components now use CSS variables for theming instead of DaisyUI themes
|
|
270
|
-
- Some component APIs have been updated to match shadcn/ui patterns
|
|
271
|
-
|
|
272
|
-
### Benefits
|
|
273
|
-
|
|
274
|
-
- ✅ Better accessibility (Radix UI primitives)
|
|
275
|
-
- ✅ Full TypeScript support
|
|
276
|
-
- ✅ More customization options
|
|
277
|
-
- ✅ Better performance
|
|
278
|
-
- ✅ Active maintenance and updates
|
|
279
|
-
|
|
280
508
|
## Storybook
|
|
281
509
|
|
|
282
510
|
This project uses [Storybook](https://storybook.js.org/) for component development and documentation. All components have corresponding `.stories.tsx` files that demonstrate their usage, variants, and interactive examples.
|