@digilogiclabs/saas-factory-ui 0.7.3 → 0.10.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 CHANGED
@@ -206,10 +206,24 @@ The library supports CSS custom properties for consistent theming:
206
206
 
207
207
  ### 🌐 Web-Specific Components
208
208
 
209
+ - `Alert` - Contextual feedback messages
210
+ - `Avatar` - User profile pictures and initials
209
211
  - `Badge` - Status indicators and counts
212
+ - `Checkbox` - Boolean input controls
213
+ - `DataTable` - Sortable data tables with pagination support
214
+ - `Dialog` - Modal dialogs and overlays
215
+ - `DropdownMenu` - Contextual action menus
216
+ - `Form` - Form validation and state management
210
217
  - `Input` - Text input fields with validation
211
218
  - `Label` - Accessible form labels
219
+ - `Modal` - Simple modal wrapper component
220
+ - `Pagination` - Data navigation with page controls
221
+ - `Progress` - Progress indicators and loading bars
222
+ - `Select` - Dropdown selection controls
212
223
  - `Skeleton` - Loading state placeholders
224
+ - `Tabs` - Tabbed content navigation
225
+ - `Toast` - Notification messages
226
+ - `Tooltip` - Contextual help and information
213
227
 
214
228
  ### 📱 Native-Specific Components
215
229
 
@@ -345,6 +359,317 @@ See [MIGRATION.md](MIGRATION.md) for detailed upgrade instructions.
345
359
  - Storybook documentation
346
360
  - Performance optimizations
347
361
 
362
+ ## 📖 Component Examples
363
+
364
+ ### DataTable with Pagination
365
+
366
+ ```tsx
367
+ import { DataTable, Pagination, PaginationInfo } from '@digilogiclabs/saas-factory-ui';
368
+
369
+ interface User {
370
+ id: number;
371
+ name: string;
372
+ email: string;
373
+ role: string;
374
+ status: 'active' | 'inactive';
375
+ }
376
+
377
+ const columns = [
378
+ { key: 'name', header: 'Name' },
379
+ { key: 'email', header: 'Email' },
380
+ { key: 'role', header: 'Role' },
381
+ {
382
+ key: 'status',
383
+ header: 'Status',
384
+ render: (value: string) => (
385
+ <Badge variant={value === 'active' ? 'default' : 'secondary'}>
386
+ {value}
387
+ </Badge>
388
+ )
389
+ }
390
+ ];
391
+
392
+ function UserTable() {
393
+ const [users, setUsers] = useState<User[]>([]);
394
+ const [currentPage, setCurrentPage] = useState(1);
395
+ const itemsPerPage = 10;
396
+
397
+ const totalPages = Math.ceil(users.length / itemsPerPage);
398
+ const paginatedUsers = users.slice(
399
+ (currentPage - 1) * itemsPerPage,
400
+ currentPage * itemsPerPage
401
+ );
402
+
403
+ return (
404
+ <div className="space-y-4">
405
+ <DataTable
406
+ data={paginatedUsers}
407
+ columns={columns}
408
+ onRowClick={(user) => console.log('Selected user:', user)}
409
+ />
410
+
411
+ <div className="flex items-center justify-between">
412
+ <PaginationInfo
413
+ currentPage={currentPage}
414
+ totalPages={totalPages}
415
+ totalItems={users.length}
416
+ itemsPerPage={itemsPerPage}
417
+ />
418
+
419
+ <Pagination
420
+ currentPage={currentPage}
421
+ totalPages={totalPages}
422
+ onPageChange={setCurrentPage}
423
+ />
424
+ </div>
425
+ </div>
426
+ );
427
+ }
428
+ ```
429
+
430
+ ### Modal with Form
431
+
432
+ ```tsx
433
+ import { Modal, Button, Input, Label } from '@digilogiclabs/saas-factory-ui';
434
+
435
+ function CreateUserModal() {
436
+ const [isOpen, setIsOpen] = useState(false);
437
+ const [formData, setFormData] = useState({ name: '', email: '' });
438
+
439
+ const handleSubmit = (e: React.FormEvent) => {
440
+ e.preventDefault();
441
+ // Handle form submission
442
+ console.log('Creating user:', formData);
443
+ setIsOpen(false);
444
+ };
445
+
446
+ return (
447
+ <>
448
+ <Button onClick={() => setIsOpen(true)}>
449
+ Create User
450
+ </Button>
451
+
452
+ <Modal
453
+ isOpen={isOpen}
454
+ onClose={() => setIsOpen(false)}
455
+ title="Create New User"
456
+ description="Add a new user to your organization"
457
+ >
458
+ <form onSubmit={handleSubmit} className="space-y-4">
459
+ <div>
460
+ <Label htmlFor="name">Name</Label>
461
+ <Input
462
+ id="name"
463
+ value={formData.name}
464
+ onChange={(e) => setFormData(prev => ({ ...prev, name: e.target.value }))}
465
+ placeholder="Enter user name"
466
+ />
467
+ </div>
468
+
469
+ <div>
470
+ <Label htmlFor="email">Email</Label>
471
+ <Input
472
+ id="email"
473
+ type="email"
474
+ value={formData.email}
475
+ onChange={(e) => setFormData(prev => ({ ...prev, email: e.target.value }))}
476
+ placeholder="Enter email address"
477
+ />
478
+ </div>
479
+
480
+ <div className="flex justify-end space-x-2">
481
+ <Button variant="outline" onClick={() => setIsOpen(false)}>
482
+ Cancel
483
+ </Button>
484
+ <Button type="submit">
485
+ Create User
486
+ </Button>
487
+ </div>
488
+ </form>
489
+ </Modal>
490
+ </>
491
+ );
492
+ }
493
+ ```
494
+
495
+ ### Dropdown Menu with Actions
496
+
497
+ ```tsx
498
+ import {
499
+ DropdownMenu,
500
+ DropdownMenuTrigger,
501
+ DropdownMenuContent,
502
+ DropdownMenuItem,
503
+ DropdownMenuSeparator,
504
+ Button
505
+ } from '@digilogiclabs/saas-factory-ui';
506
+ import { MoreHorizontal, Edit, Trash, Eye } from 'lucide-react';
507
+
508
+ function ActionsDropdown({ item }: { item: any }) {
509
+ return (
510
+ <DropdownMenu>
511
+ <DropdownMenuTrigger asChild>
512
+ <Button variant="ghost" size="sm">
513
+ <MoreHorizontal className="h-4 w-4" />
514
+ </Button>
515
+ </DropdownMenuTrigger>
516
+
517
+ <DropdownMenuContent align="end">
518
+ <DropdownMenuItem onClick={() => console.log('View', item)}>
519
+ <Eye className="mr-2 h-4 w-4" />
520
+ View Details
521
+ </DropdownMenuItem>
522
+
523
+ <DropdownMenuItem onClick={() => console.log('Edit', item)}>
524
+ <Edit className="mr-2 h-4 w-4" />
525
+ Edit
526
+ </DropdownMenuItem>
527
+
528
+ <DropdownMenuSeparator />
529
+
530
+ <DropdownMenuItem
531
+ onClick={() => console.log('Delete', item)}
532
+ className="text-destructive"
533
+ >
534
+ <Trash className="mr-2 h-4 w-4" />
535
+ Delete
536
+ </DropdownMenuItem>
537
+ </DropdownMenuContent>
538
+ </DropdownMenu>
539
+ );
540
+ }
541
+ ```
542
+
543
+ ### Tooltip Usage
544
+
545
+ ```tsx
546
+ import { Tooltip, Button } from '@digilogiclabs/saas-factory-ui';
547
+ import { HelpCircle } from 'lucide-react';
548
+
549
+ function HelpButton() {
550
+ return (
551
+ <Tooltip content="Click here to get help with this feature">
552
+ <Button variant="ghost" size="sm">
553
+ <HelpCircle className="h-4 w-4" />
554
+ </Button>
555
+ </Tooltip>
556
+ );
557
+ }
558
+
559
+ // Complex tooltip with custom content
560
+ function ComplexTooltip() {
561
+ return (
562
+ <Tooltip
563
+ content={
564
+ <div className="space-y-1">
565
+ <p className="font-semibold">Keyboard Shortcut</p>
566
+ <p className="text-xs">Press <kbd className="px-1 py-0.5 bg-muted rounded">Ctrl+K</kbd> to open</p>
567
+ </div>
568
+ }
569
+ side="right"
570
+ >
571
+ <Button>Search</Button>
572
+ </Tooltip>
573
+ );
574
+ }
575
+ ```
576
+
577
+ ### Card Composition
578
+
579
+ ```tsx
580
+ import { Card, Badge, Button, Avatar } from '@digilogiclabs/saas-factory-ui';
581
+
582
+ function UserProfileCard({ user }: { user: User }) {
583
+ return (
584
+ <Card className="p-6">
585
+ <div className="flex items-start justify-between">
586
+ <div className="flex items-center space-x-4">
587
+ <Avatar>
588
+ <img src={user.avatar} alt={user.name} />
589
+ </Avatar>
590
+
591
+ <div>
592
+ <h3 className="font-semibold text-lg">{user.name}</h3>
593
+ <p className="text-muted-foreground">{user.email}</p>
594
+ </div>
595
+ </div>
596
+
597
+ <Badge variant={user.status === 'active' ? 'default' : 'secondary'}>
598
+ {user.status}
599
+ </Badge>
600
+ </div>
601
+
602
+ <div className="mt-4 pt-4 border-t">
603
+ <div className="flex justify-between items-center">
604
+ <span className="text-sm text-muted-foreground">
605
+ Role: {user.role}
606
+ </span>
607
+
608
+ <div className="space-x-2">
609
+ <Button variant="outline" size="sm">
610
+ Edit
611
+ </Button>
612
+ <Button size="sm">
613
+ View Profile
614
+ </Button>
615
+ </div>
616
+ </div>
617
+ </div>
618
+ </Card>
619
+ );
620
+ }
621
+ ```
622
+
623
+ ## 🎨 Theming Guide
624
+
625
+ ### Custom Theme Configuration
626
+
627
+ Create a custom theme by extending the default CSS variables:
628
+
629
+ ```css
630
+ /* custom-theme.css */
631
+ :root {
632
+ /* Primary colors */
633
+ --primary: 262 83% 58%; /* Purple */
634
+ --primary-foreground: 0 0% 98%;
635
+
636
+ /* Secondary colors */
637
+ --secondary: 220 14% 96%;
638
+ --secondary-foreground: 220 9% 46%;
639
+
640
+ /* Accent colors */
641
+ --accent: 262 83% 58%;
642
+ --accent-foreground: 0 0% 98%;
643
+
644
+ /* Custom border radius */
645
+ --radius: 0.75rem;
646
+ }
647
+
648
+ /* Dark mode overrides */
649
+ .dark {
650
+ --primary: 262 83% 58%;
651
+ --primary-foreground: 0 0% 98%;
652
+ --background: 224 71% 4%;
653
+ --foreground: 213 31% 91%;
654
+ }
655
+ ```
656
+
657
+ ### Component Customization
658
+
659
+ ```tsx
660
+ // Custom button with your brand colors
661
+ <Button className="bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600">
662
+ Gradient Button
663
+ </Button>
664
+
665
+ // Custom card with shadow
666
+ <Card className="shadow-xl border-0 bg-gradient-to-br from-white to-gray-50">
667
+ <div className="p-6">
668
+ Custom styled card
669
+ </div>
670
+ </Card>
671
+ ```
672
+
348
673
  ## 📝 TypeScript Support
349
674
 
350
675
  Full TypeScript support with platform-specific types: