@codeswayam/ui 1.0.0 → 1.1.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 +323 -597
- package/dist/components/layout/GlobalFooter.d.ts.map +1 -1
- package/dist/components/layout/GlobalFooter.js +24 -43
- package/dist/components/layout/GlobalNavbar.d.ts.map +1 -1
- package/dist/components/layout/GlobalNavbar.js +2 -39
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,597 +1,323 @@
|
|
|
1
|
-
# @codeswayam/ui
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
} from
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
</
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
<
|
|
182
|
-
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
<Dialog>
|
|
325
|
-
<DialogTrigger>Open Dialog</DialogTrigger>
|
|
326
|
-
<DialogContent>
|
|
327
|
-
<DialogHeader>
|
|
328
|
-
<DialogTitle>Dialog Title</DialogTitle>
|
|
329
|
-
<DialogDescription>Description</DialogDescription>
|
|
330
|
-
</DialogHeader>
|
|
331
|
-
Dialog content
|
|
332
|
-
</DialogContent>
|
|
333
|
-
</Dialog>
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
#### Alert Dialog
|
|
337
|
-
Confirmation dialog
|
|
338
|
-
|
|
339
|
-
```tsx
|
|
340
|
-
import {
|
|
341
|
-
AlertDialog,
|
|
342
|
-
AlertDialogAction,
|
|
343
|
-
AlertDialogCancel,
|
|
344
|
-
AlertDialogContent,
|
|
345
|
-
AlertDialogDescription,
|
|
346
|
-
AlertDialogHeader,
|
|
347
|
-
AlertDialogTitle,
|
|
348
|
-
AlertDialogTrigger
|
|
349
|
-
} from '@codeswayam/ui'
|
|
350
|
-
|
|
351
|
-
<AlertDialog>
|
|
352
|
-
<AlertDialogTrigger>Delete</AlertDialogTrigger>
|
|
353
|
-
<AlertDialogContent>
|
|
354
|
-
<AlertDialogHeader>
|
|
355
|
-
<AlertDialogTitle>Are you sure?</AlertDialogTitle>
|
|
356
|
-
<AlertDialogDescription>
|
|
357
|
-
This action cannot be undone
|
|
358
|
-
</AlertDialogDescription>
|
|
359
|
-
</AlertDialogHeader>
|
|
360
|
-
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
361
|
-
<AlertDialogAction>Delete</AlertDialogAction>
|
|
362
|
-
</AlertDialogContent>
|
|
363
|
-
</AlertDialog>
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
#### Popover
|
|
367
|
-
Floating content popover
|
|
368
|
-
|
|
369
|
-
```tsx
|
|
370
|
-
import {
|
|
371
|
-
Popover,
|
|
372
|
-
PopoverContent,
|
|
373
|
-
PopoverTrigger
|
|
374
|
-
} from '@codeswayam/ui'
|
|
375
|
-
|
|
376
|
-
<Popover>
|
|
377
|
-
<PopoverTrigger>Open</PopoverTrigger>
|
|
378
|
-
<PopoverContent>
|
|
379
|
-
Popover content
|
|
380
|
-
</PopoverContent>
|
|
381
|
-
</Popover>
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
#### Dropdown Menu
|
|
385
|
-
Dropdown menu
|
|
386
|
-
|
|
387
|
-
```tsx
|
|
388
|
-
import {
|
|
389
|
-
DropdownMenu,
|
|
390
|
-
DropdownMenuContent,
|
|
391
|
-
DropdownMenuItem,
|
|
392
|
-
DropdownMenuSeparator,
|
|
393
|
-
DropdownMenuTrigger
|
|
394
|
-
} from '@codeswayam/ui'
|
|
395
|
-
|
|
396
|
-
<DropdownMenu>
|
|
397
|
-
<DropdownMenuTrigger>Menu</DropdownMenuTrigger>
|
|
398
|
-
<DropdownMenuContent>
|
|
399
|
-
<DropdownMenuItem>Profile</DropdownMenuItem>
|
|
400
|
-
<DropdownMenuSeparator />
|
|
401
|
-
<DropdownMenuItem>Logout</DropdownMenuItem>
|
|
402
|
-
</DropdownMenuContent>
|
|
403
|
-
</DropdownMenu>
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
### Navigation Components
|
|
407
|
-
|
|
408
|
-
#### Tabs
|
|
409
|
-
Tabbed interface
|
|
410
|
-
|
|
411
|
-
```tsx
|
|
412
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@codeswayam/ui'
|
|
413
|
-
|
|
414
|
-
<Tabs defaultValue=\"tab1\">
|
|
415
|
-
<TabsList>
|
|
416
|
-
<TabsTrigger value=\"tab1\">Tab 1</TabsTrigger>
|
|
417
|
-
<TabsTrigger value=\"tab2\">Tab 2</TabsTrigger>
|
|
418
|
-
</TabsList>
|
|
419
|
-
<TabsContent value=\"tab1\">Content 1</TabsContent>
|
|
420
|
-
<TabsContent value=\"tab2\">Content 2</TabsContent>
|
|
421
|
-
</Tabs>
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### Feedback Components
|
|
425
|
-
|
|
426
|
-
#### Toast
|
|
427
|
-
Toast notification
|
|
428
|
-
|
|
429
|
-
```tsx
|
|
430
|
-
import { useToast } from '@codeswayam/ui/hooks'
|
|
431
|
-
|
|
432
|
-
const { toast } = useToast()
|
|
433
|
-
|
|
434
|
-
toast({
|
|
435
|
-
title: 'Success',
|
|
436
|
-
description: 'Operation completed',
|
|
437
|
-
variant: 'default'
|
|
438
|
-
})
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
#### Progress
|
|
442
|
-
Progress bar
|
|
443
|
-
|
|
444
|
-
```tsx
|
|
445
|
-
import { Progress } from '@codeswayam/ui'
|
|
446
|
-
|
|
447
|
-
<Progress value={65} />
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
#### Skeleton
|
|
451
|
-
Loading skeleton
|
|
452
|
-
|
|
453
|
-
```tsx
|
|
454
|
-
import { Skeleton } from '@codeswayam/ui'
|
|
455
|
-
|
|
456
|
-
<Skeleton className=\"h-12 w-12 rounded-full\" />
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
---
|
|
460
|
-
|
|
461
|
-
## 🎨 Styling & Customization
|
|
462
|
-
|
|
463
|
-
### Tailwind CSS Classes
|
|
464
|
-
|
|
465
|
-
```tsx
|
|
466
|
-
<Button className=\"custom-class\">
|
|
467
|
-
Custom Button
|
|
468
|
-
</Button>
|
|
469
|
-
```
|
|
470
|
-
|
|
471
|
-
### Theme Customization
|
|
472
|
-
|
|
473
|
-
```tsx
|
|
474
|
-
// Extend tailwind config
|
|
475
|
-
const config: Config = {
|
|
476
|
-
theme: {
|
|
477
|
-
extend: {
|
|
478
|
-
colors: {
|
|
479
|
-
brand: '#your-color'
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
### Dark Mode
|
|
487
|
-
|
|
488
|
-
Components automatically support dark mode:
|
|
489
|
-
|
|
490
|
-
```tsx
|
|
491
|
-
// Enable dark mode in HTML
|
|
492
|
-
<html className=\"dark\">
|
|
493
|
-
<body>...</body>
|
|
494
|
-
</html>
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
---
|
|
498
|
-
|
|
499
|
-
## 🔗 Component Props
|
|
500
|
-
|
|
501
|
-
### Common Props
|
|
502
|
-
|
|
503
|
-
Most components accept:
|
|
504
|
-
- `className` - Tailwind CSS classes
|
|
505
|
-
- `disabled` - Disable component
|
|
506
|
-
- `aria-*` - Accessibility attributes
|
|
507
|
-
|
|
508
|
-
---
|
|
509
|
-
|
|
510
|
-
## 🧪 Testing
|
|
511
|
-
|
|
512
|
-
```tsx
|
|
513
|
-
import { render, screen } from '@testing-library/react'
|
|
514
|
-
import { Button } from '@codeswayam/ui'
|
|
515
|
-
|
|
516
|
-
test('button renders', () => {
|
|
517
|
-
render(<Button>Click me</Button>)
|
|
518
|
-
expect(screen.getByRole('button')).toBeInTheDocument()
|
|
519
|
-
})
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
---
|
|
523
|
-
|
|
524
|
-
## 📖 Storybook
|
|
525
|
-
|
|
526
|
-
View all components in Storybook:
|
|
527
|
-
|
|
528
|
-
```bash
|
|
529
|
-
npm run storybook
|
|
530
|
-
```
|
|
531
|
-
|
|
532
|
-
---
|
|
533
|
-
|
|
534
|
-
## ♿ Accessibility
|
|
535
|
-
|
|
536
|
-
All components are built with accessibility in mind:
|
|
537
|
-
- Keyboard navigation
|
|
538
|
-
- Screen reader support
|
|
539
|
-
- ARIA labels
|
|
540
|
-
- Focus management
|
|
541
|
-
- Color contrast
|
|
542
|
-
|
|
543
|
-
---
|
|
544
|
-
|
|
545
|
-
## 📋 Component Checklist
|
|
546
|
-
|
|
547
|
-
Essential components:
|
|
548
|
-
- [x] Button
|
|
549
|
-
- [x] Input
|
|
550
|
-
- [x] Card
|
|
551
|
-
- [x] Dialog
|
|
552
|
-
- [x] Select
|
|
553
|
-
- [x] Tabs
|
|
554
|
-
- [x] Badge
|
|
555
|
-
- [x] Table
|
|
556
|
-
- [x] Toast
|
|
557
|
-
- [x] Checkbox
|
|
558
|
-
- [x] Radio
|
|
559
|
-
- [x] Switch
|
|
560
|
-
- [x] Textarea
|
|
561
|
-
- [x] Progress
|
|
562
|
-
- [x] Skeleton
|
|
563
|
-
- [x] Dropdown Menu
|
|
564
|
-
- [x] Popover
|
|
565
|
-
- [x] Alert Dialog
|
|
566
|
-
|
|
567
|
-
---
|
|
568
|
-
|
|
569
|
-
## 🤝 Contributing
|
|
570
|
-
|
|
571
|
-
### Adding New Components
|
|
572
|
-
|
|
573
|
-
1. Create component in `src/components/`
|
|
574
|
-
2. Export from `src/index.ts`
|
|
575
|
-
3. Add Storybook story
|
|
576
|
-
4. Document usage
|
|
577
|
-
5. Test accessibility
|
|
578
|
-
|
|
579
|
-
---
|
|
580
|
-
|
|
581
|
-
## 📄 License
|
|
582
|
-
|
|
583
|
-
ISC License
|
|
584
|
-
|
|
585
|
-
---
|
|
586
|
-
|
|
587
|
-
## 🔗 Related Packages
|
|
588
|
-
|
|
589
|
-
- [@codeswayam/api-client](../api-client/README.md) - API client
|
|
590
|
-
- [@codeswayam/auth](../auth-client/README.md) - Auth utilities
|
|
591
|
-
- [@shared/database](../database/README.md) - Database utilities
|
|
592
|
-
|
|
593
|
-
---
|
|
594
|
-
|
|
595
|
-
**Last Updated**: April 2026
|
|
596
|
-
|
|
597
|
-
For more information, see the main [README.md](../../README.md)
|
|
1
|
+
# @codeswayam/ui
|
|
2
|
+
|
|
3
|
+
**Version:** 1.1.0
|
|
4
|
+
|
|
5
|
+
Shared React UI component library for all CodeSwayam SaaS applications. Built on Radix UI primitives with Tailwind CSS. Includes base components, SaaS-specific components, layout components, and design tokens.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @codeswayam/ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Peer dependencies:** `react >= 18`, `react-dom >= 18`, `next >= 13`
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Setup
|
|
20
|
+
|
|
21
|
+
Include the package source in your app's Tailwind config so styles are picked up:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
// tailwind.config.js
|
|
25
|
+
module.exports = {
|
|
26
|
+
content: [
|
|
27
|
+
"./src/**/*.{ts,tsx}",
|
|
28
|
+
"./node_modules/@codeswayam/ui/dist/**/*.{js,mjs}",
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Import the global CSS tokens in your root layout:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// app/layout.tsx
|
|
37
|
+
import "@codeswayam/ui/dist/globals.css"; // design tokens + base styles
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Utility
|
|
43
|
+
|
|
44
|
+
### `cn(...inputs)`
|
|
45
|
+
|
|
46
|
+
Merges Tailwind classes with conflict resolution via `clsx` + `tailwind-merge`.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { cn } from "@codeswayam/ui";
|
|
50
|
+
|
|
51
|
+
cn("px-4 py-2", isActive && "bg-primary", "px-6");
|
|
52
|
+
// → "py-2 bg-primary px-6"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Base Components
|
|
58
|
+
|
|
59
|
+
### `<Button>`
|
|
60
|
+
|
|
61
|
+
Built with `class-variance-authority` and Radix `Slot` for polymorphic rendering.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Button } from "@codeswayam/ui";
|
|
65
|
+
|
|
66
|
+
<Button variant="default" size="default">Click me</Button>
|
|
67
|
+
<Button variant="outline" size="sm">Cancel</Button>
|
|
68
|
+
<Button variant="destructive">Delete</Button>
|
|
69
|
+
<Button variant="ghost" size="icon"><TrashIcon /></Button>
|
|
70
|
+
|
|
71
|
+
// Render as a link using asChild
|
|
72
|
+
<Button asChild variant="default">
|
|
73
|
+
<a href="/dashboard">Go to Dashboard</a>
|
|
74
|
+
</Button>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Variants:** `default`, `destructive`, `outline`, `secondary`, `ghost`, `link`
|
|
78
|
+
**Sizes:** `default`, `sm`, `lg`, `icon`
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### `<Card>` family
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@codeswayam/ui";
|
|
86
|
+
|
|
87
|
+
<Card>
|
|
88
|
+
<CardHeader>
|
|
89
|
+
<CardTitle>Plan Overview</CardTitle>
|
|
90
|
+
<CardDescription>Your current subscription details</CardDescription>
|
|
91
|
+
</CardHeader>
|
|
92
|
+
<CardContent>
|
|
93
|
+
<p>Pro Plan — ₹499/month</p>
|
|
94
|
+
</CardContent>
|
|
95
|
+
<CardFooter>
|
|
96
|
+
<Button>Manage Plan</Button>
|
|
97
|
+
</CardFooter>
|
|
98
|
+
</Card>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### `<Badge>`
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { Badge } from "@codeswayam/ui";
|
|
107
|
+
|
|
108
|
+
<Badge variant="default">Active</Badge>
|
|
109
|
+
<Badge variant="secondary">Beta</Badge>
|
|
110
|
+
<Badge variant="destructive">Expired</Badge>
|
|
111
|
+
<Badge variant="outline">Free</Badge>
|
|
112
|
+
<Badge variant="success">Paid</Badge>
|
|
113
|
+
<Badge variant="warning">Pending</Badge>
|
|
114
|
+
<Badge variant="info">Info</Badge>
|
|
115
|
+
<Badge variant="purple">AI</Badge>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Variants:** `default`, `secondary`, `destructive`, `outline`, `success`, `warning`, `info`, `purple`
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### `<Input>`
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { Input } from "@codeswayam/ui";
|
|
126
|
+
|
|
127
|
+
<Input type="email" placeholder="Enter your email" />
|
|
128
|
+
<Input type="password" disabled />
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### `<Label>`
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import { Label } from "@codeswayam/ui";
|
|
137
|
+
|
|
138
|
+
<Label htmlFor="email">Email Address</Label>
|
|
139
|
+
<Input id="email" type="email" />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### `<Avatar>`, `<AvatarImage>`, `<AvatarFallback>`
|
|
145
|
+
|
|
146
|
+
Built on Radix Avatar with automatic fallback to initials.
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { Avatar, AvatarImage, AvatarFallback } from "@codeswayam/ui";
|
|
150
|
+
|
|
151
|
+
<Avatar className="h-10 w-10 rounded-lg">
|
|
152
|
+
<AvatarImage src={user.image} alt={user.name} />
|
|
153
|
+
<AvatarFallback className="bg-primary/10 text-primary font-bold">
|
|
154
|
+
{initials}
|
|
155
|
+
</AvatarFallback>
|
|
156
|
+
</Avatar>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### `<DropdownMenu>` and sub-components
|
|
162
|
+
|
|
163
|
+
Full Radix DropdownMenu with all primitives exported.
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import {
|
|
167
|
+
DropdownMenu,
|
|
168
|
+
DropdownMenuTrigger,
|
|
169
|
+
DropdownMenuContent,
|
|
170
|
+
DropdownMenuItem,
|
|
171
|
+
DropdownMenuLabel,
|
|
172
|
+
DropdownMenuSeparator,
|
|
173
|
+
DropdownMenuGroup,
|
|
174
|
+
DropdownMenuShortcut,
|
|
175
|
+
} from "@codeswayam/ui";
|
|
176
|
+
|
|
177
|
+
<DropdownMenu>
|
|
178
|
+
<DropdownMenuTrigger asChild>
|
|
179
|
+
<Button variant="ghost">Options</Button>
|
|
180
|
+
</DropdownMenuTrigger>
|
|
181
|
+
<DropdownMenuContent align="end">
|
|
182
|
+
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
183
|
+
<DropdownMenuSeparator />
|
|
184
|
+
<DropdownMenuItem onClick={handleProfile}>Profile</DropdownMenuItem>
|
|
185
|
+
<DropdownMenuItem onClick={handleLogout} className="text-destructive">
|
|
186
|
+
Sign Out
|
|
187
|
+
</DropdownMenuItem>
|
|
188
|
+
</DropdownMenuContent>
|
|
189
|
+
</DropdownMenu>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## SaaS Components
|
|
195
|
+
|
|
196
|
+
### `<UserMenu>`
|
|
197
|
+
|
|
198
|
+
High-end user profile dropdown for SaaS navigation bars. Shows avatar, name, email, and action items (Profile Settings, Security, Sign Out).
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { UserMenu } from "@codeswayam/ui";
|
|
202
|
+
|
|
203
|
+
<UserMenu
|
|
204
|
+
user={{ name: "Niteesh", email: "niteesh@example.com", image: "/avatar.jpg" }}
|
|
205
|
+
onLogout={handleLogout}
|
|
206
|
+
onProfileClick={() => router.push("/settings")}
|
|
207
|
+
onSecurityClick={() => router.push("/settings/security")}
|
|
208
|
+
/>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
| Prop | Type | Description |
|
|
212
|
+
|------|------|-------------|
|
|
213
|
+
| `user` | `{ name?, email, image? } \| null` | User to display. Renders nothing if null |
|
|
214
|
+
| `onLogout` | `() => void` | Called when "Sign Out" is clicked |
|
|
215
|
+
| `onProfileClick` | `() => void` | Called when "Profile Settings" is clicked |
|
|
216
|
+
| `onSecurityClick` | `() => void` | Called when "Security" is clicked |
|
|
217
|
+
| `className` | `string` | Additional CSS classes |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### `<AppLogo>`
|
|
222
|
+
|
|
223
|
+
Standard CodeSwayam app logo for consistency across platforms.
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
import { AppLogo } from "@codeswayam/ui";
|
|
227
|
+
|
|
228
|
+
<AppLogo /> // Icon + "CodeSwayam" text
|
|
229
|
+
<AppLogo showText={false} /> // Icon only
|
|
230
|
+
<AppLogo className="scale-90" />
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
| Prop | Type | Default | Description |
|
|
234
|
+
|------|------|---------|-------------|
|
|
235
|
+
| `showText` | `boolean` | `true` | Whether to show the "CodeSwayam" text |
|
|
236
|
+
| `className` | `string` | — | Additional CSS classes |
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
### `<StatusBadge>`
|
|
241
|
+
|
|
242
|
+
Smart subscription status badge with automatic color coding.
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import { StatusBadge } from "@codeswayam/ui";
|
|
246
|
+
|
|
247
|
+
<StatusBadge status="active" /> // Green — "Active"
|
|
248
|
+
<StatusBadge status="pending_cancellation" /> // Amber — "Pending Cancel"
|
|
249
|
+
<StatusBadge status="canceled" /> // Red — "Canceled"
|
|
250
|
+
<StatusBadge status="past_due" /> // Red — "Past Due"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
| Prop | Type | Description |
|
|
254
|
+
|------|------|-------------|
|
|
255
|
+
| `status` | `"active" \| "past_due" \| "canceled" \| "pending_cancellation" \| string` | Subscription status |
|
|
256
|
+
| `className` | `string` | Additional CSS classes |
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Layout Components
|
|
261
|
+
|
|
262
|
+
### `<GlobalNavbar>`
|
|
263
|
+
|
|
264
|
+
Responsive marketing navbar for public-facing pages. Auto-hides on app routes (`/app/*`, `/dashboard/*`). Includes scroll-aware blur effect, desktop nav links, and mobile slide-in menu.
|
|
265
|
+
|
|
266
|
+
```tsx
|
|
267
|
+
import { GlobalNavbar } from "@codeswayam/ui";
|
|
268
|
+
|
|
269
|
+
// In your root layout — renders only on public pages
|
|
270
|
+
export default function RootLayout({ children }) {
|
|
271
|
+
return (
|
|
272
|
+
<>
|
|
273
|
+
<GlobalNavbar />
|
|
274
|
+
{children}
|
|
275
|
+
</>
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
- Transparent on load, blurred dark background on scroll
|
|
281
|
+
- Auth links route to `NEXT_PUBLIC_AUTH_URL` or `localhost:3003` in dev
|
|
282
|
+
- Full-screen mobile menu with slide animation
|
|
283
|
+
- Hidden automatically on `/app` and `/dashboard` routes
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
### `<GlobalFooter>`
|
|
288
|
+
|
|
289
|
+
Standard marketing footer for public pages.
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
import { GlobalFooter } from "@codeswayam/ui";
|
|
293
|
+
|
|
294
|
+
<GlobalFooter />
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Full Export List
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
// Base
|
|
303
|
+
Button, buttonVariants
|
|
304
|
+
Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter
|
|
305
|
+
Badge, badgeVariants
|
|
306
|
+
Input
|
|
307
|
+
Label
|
|
308
|
+
Avatar, AvatarImage, AvatarFallback
|
|
309
|
+
DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem,
|
|
310
|
+
DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel,
|
|
311
|
+
DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup,
|
|
312
|
+
DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent,
|
|
313
|
+
DropdownMenuSubTrigger, DropdownMenuRadioGroup
|
|
314
|
+
|
|
315
|
+
// SaaS
|
|
316
|
+
UserMenu, AppLogo, StatusBadge
|
|
317
|
+
|
|
318
|
+
// Layout
|
|
319
|
+
GlobalNavbar, GlobalFooter
|
|
320
|
+
|
|
321
|
+
// Utils
|
|
322
|
+
cn
|
|
323
|
+
```
|