@agenticindiedev/ui 0.2.3 → 0.3.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/README.md +258 -54
- package/dist/index.cjs +15 -15
- package/dist/index.d.ts +248 -0
- package/dist/index.js +5465 -4039
- package/dist/styles.css +407 -394
- package/dist/tailwind.preset.js +91 -0
- package/dist/themes/dark.scss +57 -0
- package/dist/themes/light.scss +57 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -2,10 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
A modern React component library built with TypeScript, Tailwind CSS v4, Radix UI, and shadcn/ui patterns.
|
|
4
4
|
|
|
5
|
+
📖 **[View Storybook Documentation](https://agenticindiedev.github.io/ui/)**
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
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();
|
|
9
82
|
```
|
|
10
83
|
|
|
11
84
|
## Setup
|
|
@@ -28,18 +101,6 @@ bun dev
|
|
|
28
101
|
|
|
29
102
|
This launches Storybook at `http://localhost:6006` where you can preview and develop components.
|
|
30
103
|
|
|
31
|
-
### 3. Component Gallery
|
|
32
|
-
|
|
33
|
-
View the component gallery (demo page) locally:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
cd demo
|
|
37
|
-
bun install
|
|
38
|
-
bun run dev
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
This launches the demo gallery at `http://localhost:3000` showcasing all components using the built library.
|
|
42
|
-
|
|
43
104
|
## Scripts
|
|
44
105
|
|
|
45
106
|
| Command | Description |
|
|
@@ -80,30 +141,205 @@ function App() {
|
|
|
80
141
|
|
|
81
142
|
## Customization
|
|
82
143
|
|
|
83
|
-
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:
|
|
84
221
|
|
|
85
222
|
```tsx
|
|
86
223
|
<Button
|
|
87
224
|
variant="primary"
|
|
88
|
-
className="bg-
|
|
225
|
+
className="bg-purple-500 hover:bg-purple-600 text-white"
|
|
89
226
|
>
|
|
90
|
-
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
|
|
91
235
|
</Button>
|
|
92
236
|
```
|
|
93
237
|
|
|
94
|
-
###
|
|
238
|
+
### Method 3: Create Custom Theme File
|
|
95
239
|
|
|
96
|
-
|
|
240
|
+
For a complete custom theme, create your own CSS file:
|
|
97
241
|
|
|
98
242
|
```css
|
|
243
|
+
/* my-custom-theme.css */
|
|
244
|
+
@import 'tailwindcss';
|
|
245
|
+
|
|
99
246
|
:root {
|
|
100
|
-
--primary:
|
|
101
|
-
--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%;
|
|
102
312
|
/* ... */
|
|
103
313
|
}
|
|
104
314
|
```
|
|
105
315
|
|
|
106
|
-
|
|
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
|
+
```
|
|
107
343
|
|
|
108
344
|
## Components
|
|
109
345
|
|
|
@@ -269,24 +505,6 @@ src/
|
|
|
269
505
|
└── index.ts # Public exports
|
|
270
506
|
```
|
|
271
507
|
|
|
272
|
-
## Migration from DaisyUI
|
|
273
|
-
|
|
274
|
-
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.
|
|
275
|
-
|
|
276
|
-
### Breaking Changes
|
|
277
|
-
|
|
278
|
-
- DaisyUI classes are no longer available
|
|
279
|
-
- Components now use CSS variables for theming instead of DaisyUI themes
|
|
280
|
-
- Some component APIs have been updated to match shadcn/ui patterns
|
|
281
|
-
|
|
282
|
-
### Benefits
|
|
283
|
-
|
|
284
|
-
- ✅ Better accessibility (Radix UI primitives)
|
|
285
|
-
- ✅ Full TypeScript support
|
|
286
|
-
- ✅ More customization options
|
|
287
|
-
- ✅ Better performance
|
|
288
|
-
- ✅ Active maintenance and updates
|
|
289
|
-
|
|
290
508
|
## Storybook
|
|
291
509
|
|
|
292
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.
|
|
@@ -294,7 +512,7 @@ This project uses [Storybook](https://storybook.js.org/) for component developme
|
|
|
294
512
|
### Viewing Storybook
|
|
295
513
|
|
|
296
514
|
- **Local Development**: Run `bun dev` to start Storybook at `http://localhost:6006`
|
|
297
|
-
- **Online**: View the deployed Storybook
|
|
515
|
+
- **Online**: View the deployed Storybook at [https://agenticindiedev.github.io/ui/](https://agenticindiedev.github.io/ui/) (automatically deployed on push to main)
|
|
298
516
|
|
|
299
517
|
### Storybook Features
|
|
300
518
|
|
|
@@ -304,27 +522,13 @@ This project uses [Storybook](https://storybook.js.org/) for component developme
|
|
|
304
522
|
- Auto-generated documentation
|
|
305
523
|
- Dark mode support
|
|
306
524
|
|
|
307
|
-
## Demo Gallery
|
|
308
|
-
|
|
309
|
-
A standalone demo gallery is available in the `demo/` directory. This showcases all components using the published library in a simple, clean interface.
|
|
310
|
-
|
|
311
|
-
### Running the Demo
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
cd demo
|
|
315
|
-
bun install
|
|
316
|
-
bun run dev
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
The demo gallery will be available at `http://localhost:3000`.
|
|
320
|
-
|
|
321
525
|
## GitHub Pages Deployment
|
|
322
526
|
|
|
323
527
|
Storybook is automatically deployed to GitHub Pages on every push to the `main` branch via GitHub Actions. The workflow:
|
|
324
528
|
|
|
325
529
|
1. Builds Storybook using `bun run build-storybook`
|
|
326
530
|
2. Deploys the static build to the `gh-pages` branch
|
|
327
|
-
3. Makes it available at
|
|
531
|
+
3. Makes it available at [https://agenticindiedev.github.io/ui/](https://agenticindiedev.github.io/ui/)
|
|
328
532
|
|
|
329
533
|
## License
|
|
330
534
|
|