@reinvented/design 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 +1 -1
- package/SKILL.md +214 -0
- package/package.json +4 -3
- package/skills/apps/analytics.md +103 -0
- package/skills/apps/booking-scheduling.md +97 -0
- package/skills/apps/content-management.md +52 -0
- package/skills/apps/crm.md +80 -0
- package/skills/apps/e-commerce.md +109 -0
- package/skills/apps/education.md +79 -0
- package/skills/apps/finance.md +68 -0
- package/skills/apps/health-fitness.md +72 -0
- package/skills/apps/marketplace.md +99 -0
- package/skills/apps/messaging.md +84 -0
- package/skills/apps/portfolio-personal.md +90 -0
- package/skills/apps/project-management.md +95 -0
- package/skills/apps/saas-dashboard.md +104 -0
- package/skills/apps/social-platform.md +50 -0
- package/skills/blocks/auth.md +106 -0
- package/skills/blocks/communication.md +98 -0
- package/skills/blocks/content.md +107 -0
- package/skills/blocks/data-management.md +109 -0
- package/skills/blocks/data-viz.md +92 -0
- package/skills/blocks/ecommerce.md +126 -0
- package/skills/blocks/feedback.md +97 -0
- package/skills/blocks/filtering.md +127 -0
- package/skills/blocks/marketing.md +136 -0
- package/skills/blocks/media.md +102 -0
- package/skills/blocks/navigation.md +136 -0
- package/skills/blocks/onboarding.md +75 -0
- package/skills/blocks/profiles.md +131 -0
- package/skills/blocks/scheduling.md +117 -0
- package/skills/blocks/settings.md +102 -0
- package/skills/components/advanced-components.md +142 -0
- package/skills/components/avatar.md +92 -0
- package/skills/components/badge.md +105 -0
- package/skills/components/button.md +87 -0
- package/skills/components/card.md +144 -0
- package/skills/components/chart.md +88 -0
- package/skills/components/dialog.md +109 -0
- package/skills/components/dropdown-menu.md +117 -0
- package/skills/components/extended-components.md +187 -0
- package/skills/components/feedback.md +165 -0
- package/skills/components/form.md +112 -0
- package/skills/components/input.md +107 -0
- package/skills/components/map.md +53 -0
- package/skills/components/navigation.md +73 -0
- package/skills/components/overlay.md +77 -0
- package/skills/components/page-header.md +51 -0
- package/skills/components/select.md +175 -0
- package/skills/components/table.md +102 -0
- package/skills/components/tabs.md +105 -0
- package/skills/components/utilities.md +138 -0
- package/skills/devices/desktop.md +43 -0
- package/skills/devices/mobile.md +77 -0
- package/skills/foundation/design-principles.md +77 -0
- package/skills/foundation/design-tokens.md +121 -0
- package/skills/foundation/mockup-generation.md +118 -0
- package/skills/foundation/rules.md +54 -0
- package/skills/foundation/tailwind-usage.md +204 -0
- package/skills/layouts/dashboard.md +71 -0
- package/skills/layouts/full-page-form.md +75 -0
- package/skills/layouts/list-detail.md +70 -0
- package/skills/layouts/marketing.md +70 -0
- package/skills/layouts/responsive.md +67 -0
- package/skills/layouts/settings-page.md +106 -0
- package/skills/layouts/sidebar.md +73 -0
- package/skills/layouts/topbar.md +68 -0
- package/skills/patterns/auth.md +131 -0
- package/skills/patterns/content-display.md +164 -0
- package/skills/patterns/dashboards.md +104 -0
- package/skills/patterns/data-tables.md +113 -0
- package/skills/patterns/empty-states.md +71 -0
- package/skills/patterns/error-states.md +73 -0
- package/skills/patterns/forms.md +136 -0
- package/skills/patterns/loading-states.md +92 -0
- package/skills/patterns/navigation.md +113 -0
- package/skills/patterns/notifications.md +91 -0
- package/skills/patterns/onboarding.md +42 -0
- package/skills/patterns/search.md +55 -0
- package/skills/patterns/settings.md +132 -0
- package/skills/patterns/user-profiles.md +67 -0
- package/skills/personas/business-operator.md +114 -0
- package/skills/personas/consumer-casual.md +60 -0
- package/skills/personas/consumer-power-user.md +109 -0
- package/skills/personas/creative-professional.md +109 -0
- package/skills/personas/enterprise-admin.md +134 -0
- package/skills/visual/color-usage.md +62 -0
- package/skills/visual/dark-mode.md +50 -0
- package/skills/visual/polish-techniques.md +101 -0
- package/skills/visual/spacing-composition.md +69 -0
- package/skills/visual/transitions-animations.md +66 -0
- package/skills/visual/typography-hierarchy.md +66 -0
- package/DESIGN_GUIDE.md +0 -148
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Dialog & AlertDialog
|
|
2
|
+
|
|
3
|
+
Modal overlays for forms, confirmations, and focused interactions.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import {
|
|
7
|
+
Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogTrigger, DialogClose,
|
|
8
|
+
AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger
|
|
9
|
+
} from '@reinvented/design'
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Dialog
|
|
13
|
+
|
|
14
|
+
Use for: create/edit forms, detail views, settings, any focused task with ≤6 fields.
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
<Dialog v-model:open="showDialog">
|
|
18
|
+
<DialogTrigger as-child>
|
|
19
|
+
<Button><Plus className="w-4 h-4" /> Create Project</Button>
|
|
20
|
+
</DialogTrigger>
|
|
21
|
+
<DialogContent className="sm:max-w-md">
|
|
22
|
+
<DialogHeader>
|
|
23
|
+
<DialogTitle>Create Project</DialogTitle>
|
|
24
|
+
<DialogDescription>Add a new project to your workspace.</DialogDescription>
|
|
25
|
+
</DialogHeader>
|
|
26
|
+
<div className="space-y-4 py-4">
|
|
27
|
+
<div className="space-y-2">
|
|
28
|
+
<Label for="name">Name</Label>
|
|
29
|
+
<Input id="name" defaultValue="name" placeholder="Project name" />
|
|
30
|
+
</div>
|
|
31
|
+
<div className="space-y-2">
|
|
32
|
+
<Label for="description">Description</Label>
|
|
33
|
+
<Textarea id="description" defaultValue="description" placeholder="What is this project about?" />
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<DialogFooter>
|
|
37
|
+
<DialogClose as-child>
|
|
38
|
+
<Button variant="outline">Cancel</Button>
|
|
39
|
+
</DialogClose>
|
|
40
|
+
<Button onClick="handleCreate">Create Project</Button>
|
|
41
|
+
</DialogFooter>
|
|
42
|
+
</DialogContent>
|
|
43
|
+
</Dialog>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Dialog Sizing
|
|
47
|
+
|
|
48
|
+
| Class | Width | Use |
|
|
49
|
+
|-------|-------|-----|
|
|
50
|
+
| `sm:max-w-sm` | 384px | Simple confirmations, single-field input |
|
|
51
|
+
| `sm:max-w-md` | 448px | Standard forms (2-4 fields) |
|
|
52
|
+
| `sm:max-w-lg` | 512px | Larger forms (5-6 fields) |
|
|
53
|
+
| `sm:max-w-xl` | 576px | Complex dialogs with multiple sections |
|
|
54
|
+
| `sm:max-w-2xl` | 672px | Large content (preview panes, detailed forms) |
|
|
55
|
+
|
|
56
|
+
### Scrollable Dialog
|
|
57
|
+
|
|
58
|
+
For content that might overflow:
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<DialogScrollContent className="sm:max-w-lg">
|
|
62
|
+
<!-- Long content scrolls within the dialog -->
|
|
63
|
+
</DialogScrollContent>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## AlertDialog
|
|
67
|
+
|
|
68
|
+
Use for: all destructive/irreversible actions. The confirm button must say specifically what it does.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<AlertDialog>
|
|
72
|
+
<AlertDialogTrigger as-child>
|
|
73
|
+
<Button variant="destructive" size="sm">Delete Project</Button>
|
|
74
|
+
</AlertDialogTrigger>
|
|
75
|
+
<AlertDialogContent>
|
|
76
|
+
<AlertDialogHeader>
|
|
77
|
+
<AlertDialogTitle>Delete "Project Alpha"?</AlertDialogTitle>
|
|
78
|
+
<AlertDialogDescription>
|
|
79
|
+
This will permanently delete the project and all 24 associated tasks. This action cannot be undone.
|
|
80
|
+
</AlertDialogDescription>
|
|
81
|
+
</AlertDialogHeader>
|
|
82
|
+
<AlertDialogFooter>
|
|
83
|
+
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
84
|
+
<AlertDialogAction className="bg-destructive text-destructive-foreground hover:bg-destructive/90">
|
|
85
|
+
Delete Project
|
|
86
|
+
</AlertDialogAction>
|
|
87
|
+
</AlertDialogFooter>
|
|
88
|
+
</AlertDialogContent>
|
|
89
|
+
</AlertDialog>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### AlertDialog Rules
|
|
93
|
+
- The title should include the **name of the thing being deleted**
|
|
94
|
+
- The description should state **what will be lost** and that it's **irreversible**
|
|
95
|
+
- The confirm button must use a **specific verb**: "Delete Project", not "OK" or "Confirm"
|
|
96
|
+
- The confirm button must be styled as destructive
|
|
97
|
+
- Cancel is always the first (leftmost) button
|
|
98
|
+
|
|
99
|
+
## Decision Tree
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
Is this a destructive action (delete, remove, reset)?
|
|
103
|
+
├─ Yes → AlertDialog (always)
|
|
104
|
+
├─ No
|
|
105
|
+
│ ├─ Is this a form with ≤6 fields? → Dialog
|
|
106
|
+
│ ├─ Is this a quick selection/input? → Dialog (sm:max-w-sm)
|
|
107
|
+
│ ├─ Is this a complex form with 7+ fields? → Full page (not a dialog)
|
|
108
|
+
│ └─ Is this showing details/preview? → Dialog (sm:max-w-xl or Sheet)
|
|
109
|
+
```
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# DropdownMenu, ContextMenu, Menubar
|
|
2
|
+
|
|
3
|
+
Menu components for action lists and navigation.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, DropdownMenuGroup, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuShortcut } from '@reinvented/design'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## DropdownMenu
|
|
10
|
+
|
|
11
|
+
The standard action menu. Used for overflow actions, user menus, and contextual operations.
|
|
12
|
+
|
|
13
|
+
### Basic Menu
|
|
14
|
+
```tsx
|
|
15
|
+
<DropdownMenu>
|
|
16
|
+
<DropdownMenuTrigger as-child>
|
|
17
|
+
<Button variant="ghost" size="icon">
|
|
18
|
+
<MoreHorizontal className="w-4 h-4" />
|
|
19
|
+
</Button>
|
|
20
|
+
</DropdownMenuTrigger>
|
|
21
|
+
<DropdownMenuContent align="end">
|
|
22
|
+
<DropdownMenuItem>
|
|
23
|
+
<Pencil className="w-4 h-4" /> Edit
|
|
24
|
+
</DropdownMenuItem>
|
|
25
|
+
<DropdownMenuItem>
|
|
26
|
+
<Copy className="w-4 h-4" /> Duplicate
|
|
27
|
+
</DropdownMenuItem>
|
|
28
|
+
<DropdownMenuSeparator />
|
|
29
|
+
<DropdownMenuItem className="text-destructive">
|
|
30
|
+
<Trash2 className="w-4 h-4" /> Delete
|
|
31
|
+
</DropdownMenuItem>
|
|
32
|
+
</DropdownMenuContent>
|
|
33
|
+
</DropdownMenu>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Menu with Groups and Labels
|
|
37
|
+
```tsx
|
|
38
|
+
<DropdownMenuContent className="w-56">
|
|
39
|
+
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
40
|
+
<DropdownMenuSeparator />
|
|
41
|
+
<DropdownMenuGroup>
|
|
42
|
+
<DropdownMenuItem>
|
|
43
|
+
<User className="w-4 h-4" /> Profile
|
|
44
|
+
<DropdownMenuShortcut>⇧⌘P</DropdownMenuShortcut>
|
|
45
|
+
</DropdownMenuItem>
|
|
46
|
+
<DropdownMenuItem>
|
|
47
|
+
<Settings className="w-4 h-4" /> Settings
|
|
48
|
+
<DropdownMenuShortcut>⌘S</DropdownMenuShortcut>
|
|
49
|
+
</DropdownMenuItem>
|
|
50
|
+
</DropdownMenuGroup>
|
|
51
|
+
<DropdownMenuSeparator />
|
|
52
|
+
<DropdownMenuItem>
|
|
53
|
+
<LogOut className="w-4 h-4" /> Log out
|
|
54
|
+
</DropdownMenuItem>
|
|
55
|
+
</DropdownMenuContent>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### With Submenu
|
|
59
|
+
```tsx
|
|
60
|
+
<DropdownMenuSub>
|
|
61
|
+
<DropdownMenuSubTrigger>
|
|
62
|
+
<UserPlus className="w-4 h-4" /> Invite users
|
|
63
|
+
</DropdownMenuSubTrigger>
|
|
64
|
+
<DropdownMenuSubContent>
|
|
65
|
+
<DropdownMenuItem>Email</DropdownMenuItem>
|
|
66
|
+
<DropdownMenuItem>Slack</DropdownMenuItem>
|
|
67
|
+
</DropdownMenuSubContent>
|
|
68
|
+
</DropdownMenuSub>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Alignment
|
|
72
|
+
| Prop | When to Use |
|
|
73
|
+
|------|-------------|
|
|
74
|
+
| `align="end"` | Default — menu opens to the left of the trigger (for right-aligned triggers) |
|
|
75
|
+
| `align="start"` | Menu opens to the right of the trigger (for left-aligned triggers) |
|
|
76
|
+
|
|
77
|
+
### Common Triggers
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<!-- Three-dot menu (most common) -->
|
|
81
|
+
<Button variant="ghost" size="icon" className="h-8 w-8">
|
|
82
|
+
<MoreHorizontal className="w-4 h-4" />
|
|
83
|
+
</Button>
|
|
84
|
+
|
|
85
|
+
<!-- User avatar menu -->
|
|
86
|
+
<Button variant="ghost" className="relative h-8 w-8 rounded-full">
|
|
87
|
+
<!-- Avatar here -->
|
|
88
|
+
</Button>
|
|
89
|
+
|
|
90
|
+
<!-- Chevron down (nav menus) -->
|
|
91
|
+
<Button variant="ghost" size="sm">
|
|
92
|
+
Options <ChevronDown className="w-4 h-4" />
|
|
93
|
+
</Button>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## ContextMenu
|
|
97
|
+
|
|
98
|
+
Right-click context menu. Use sparingly — only when users expect right-click functionality.
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
<ContextMenu>
|
|
102
|
+
<ContextMenuTrigger className="...">
|
|
103
|
+
<!-- Content that can be right-clicked -->
|
|
104
|
+
</ContextMenuTrigger>
|
|
105
|
+
<ContextMenuContent>
|
|
106
|
+
<ContextMenuItem>Cut</ContextMenuItem>
|
|
107
|
+
<ContextMenuItem>Copy</ContextMenuItem>
|
|
108
|
+
<ContextMenuItem>Paste</ContextMenuItem>
|
|
109
|
+
</ContextMenuContent>
|
|
110
|
+
</ContextMenu>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Rules
|
|
114
|
+
- **Three-dot icon is `MoreHorizontal`**, not `MoreVertical`, in this design system
|
|
115
|
+
- Destructive items use `className="text-destructive"` — they are red text, not red background
|
|
116
|
+
- Always use `as-child` on `DropdownMenuTrigger` to render the child Button directly
|
|
117
|
+
- `align="end"` is standard for action menus that appear from buttons on the right side of rows
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# Extended Components
|
|
2
|
+
|
|
3
|
+
Documentation for additional standard Shadcn form, navigation, and utility components.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import {
|
|
7
|
+
Checkbox, RadioGroup, RadioGroupItem, Switch, Slider, Textarea,
|
|
8
|
+
Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator,
|
|
9
|
+
Menubar, MenubarContent, MenubarItem, MenubarMenu, MenubarSeparator, MenubarTrigger,
|
|
10
|
+
NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger,
|
|
11
|
+
Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationLast, PaginationNext, PaginationPrev,
|
|
12
|
+
Collapsible, CollapsibleContent, CollapsibleTrigger,
|
|
13
|
+
Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger,
|
|
14
|
+
Skeleton, Separator, ScrollArea, AspectRatio
|
|
15
|
+
} from '@reinvented/design'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Form Additions
|
|
19
|
+
|
|
20
|
+
### Checkbox
|
|
21
|
+
```tsx
|
|
22
|
+
<div className="flex items-center space-x-2">
|
|
23
|
+
<Checkbox id="terms" />
|
|
24
|
+
<label for="terms" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
|
25
|
+
Accept terms and conditions
|
|
26
|
+
</label>
|
|
27
|
+
</div>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### RadioGroup
|
|
31
|
+
```tsx
|
|
32
|
+
<RadioGroup default-value="comfortable">
|
|
33
|
+
<div className="flex items-center space-x-2">
|
|
34
|
+
<RadioGroupItem id="r1" value="default" />
|
|
35
|
+
<Label for="r1">Default</Label>
|
|
36
|
+
</div>
|
|
37
|
+
<div className="flex items-center space-x-2">
|
|
38
|
+
<RadioGroupItem id="r2" value="comfortable" />
|
|
39
|
+
<Label for="r2">Comfortable</Label>
|
|
40
|
+
</div>
|
|
41
|
+
</RadioGroup>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Switch
|
|
45
|
+
```tsx
|
|
46
|
+
<div className="flex items-center space-x-2">
|
|
47
|
+
<Switch id="airplane-mode" />
|
|
48
|
+
<Label for="airplane-mode">Airplane Mode</Label>
|
|
49
|
+
</div>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Slider
|
|
53
|
+
```tsx
|
|
54
|
+
<Slider :default-value="[33]" :max="100" :step="1" className="w-3/5" />
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Textarea
|
|
58
|
+
```tsx
|
|
59
|
+
<Textarea placeholder="Type your message here." className="resize-none" />
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Navigation Additions
|
|
63
|
+
|
|
64
|
+
### Breadcrumb
|
|
65
|
+
```tsx
|
|
66
|
+
<Breadcrumb>
|
|
67
|
+
<BreadcrumbList>
|
|
68
|
+
<BreadcrumbItem>
|
|
69
|
+
<BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
70
|
+
</BreadcrumbItem>
|
|
71
|
+
<BreadcrumbSeparator />
|
|
72
|
+
<BreadcrumbItem>
|
|
73
|
+
<BreadcrumbPage>Current Page</BreadcrumbPage>
|
|
74
|
+
</BreadcrumbItem>
|
|
75
|
+
</BreadcrumbList>
|
|
76
|
+
</Breadcrumb>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Menubar
|
|
80
|
+
Mac-OS style compact menu.
|
|
81
|
+
```tsx
|
|
82
|
+
<Menubar>
|
|
83
|
+
<MenubarMenu>
|
|
84
|
+
<MenubarTrigger>File</MenubarTrigger>
|
|
85
|
+
<MenubarContent>
|
|
86
|
+
<MenubarItem>New Tab</MenubarItem>
|
|
87
|
+
<MenubarSeparator />
|
|
88
|
+
<MenubarItem>Quit</MenubarItem>
|
|
89
|
+
</MenubarContent>
|
|
90
|
+
</MenubarMenu>
|
|
91
|
+
</Menubar>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### NavigationMenu
|
|
95
|
+
Radix-style navigation with animated viewports.
|
|
96
|
+
```tsx
|
|
97
|
+
<NavigationMenu>
|
|
98
|
+
<NavigationMenuList>
|
|
99
|
+
<NavigationMenuItem>
|
|
100
|
+
<NavigationMenuTrigger>Item One</NavigationMenuTrigger>
|
|
101
|
+
<NavigationMenuContent>
|
|
102
|
+
<!-- Content -->
|
|
103
|
+
</NavigationMenuContent>
|
|
104
|
+
</NavigationMenuItem>
|
|
105
|
+
</NavigationMenuList>
|
|
106
|
+
</NavigationMenu>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Pagination
|
|
110
|
+
```tsx
|
|
111
|
+
<Pagination :total="100" :sibling-count="1" show-edges :default-page="2">
|
|
112
|
+
<PaginationContent>
|
|
113
|
+
<PaginationFirst />
|
|
114
|
+
<PaginationPrev />
|
|
115
|
+
<!-- ... use template slots to generate buttons ... -->
|
|
116
|
+
<PaginationNext />
|
|
117
|
+
<PaginationLast />
|
|
118
|
+
</PaginationContent>
|
|
119
|
+
</Pagination>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Overlay Additions
|
|
123
|
+
|
|
124
|
+
### Collapsible
|
|
125
|
+
An interactive component which expands/collapses a panel.
|
|
126
|
+
```tsx
|
|
127
|
+
<Collapsible>
|
|
128
|
+
<CollapsibleTrigger as-child>
|
|
129
|
+
<Button variant="ghost">Toggle</Button>
|
|
130
|
+
</CollapsibleTrigger>
|
|
131
|
+
<CollapsibleContent>
|
|
132
|
+
Content here.
|
|
133
|
+
</CollapsibleContent>
|
|
134
|
+
</Collapsible>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Sheet
|
|
138
|
+
Slide-out sidebar modal.
|
|
139
|
+
```tsx
|
|
140
|
+
<Sheet>
|
|
141
|
+
<SheetTrigger as-child><Button>Open</Button></SheetTrigger>
|
|
142
|
+
<SheetContent side="right">
|
|
143
|
+
<SheetHeader>
|
|
144
|
+
<SheetTitle>Edit profile</SheetTitle>
|
|
145
|
+
<SheetDescription>Make changes here.</SheetDescription>
|
|
146
|
+
</SheetHeader>
|
|
147
|
+
<!-- content -->
|
|
148
|
+
</SheetContent>
|
|
149
|
+
</Sheet>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Utility Additions
|
|
153
|
+
|
|
154
|
+
### Skeleton
|
|
155
|
+
Loading placeholder visualization.
|
|
156
|
+
```tsx
|
|
157
|
+
<div className="flex items-center space-x-4">
|
|
158
|
+
<Skeleton className="h-12 w-12 rounded-full" />
|
|
159
|
+
<div className="space-y-2">
|
|
160
|
+
<Skeleton className="h-4 w-64" />
|
|
161
|
+
<Skeleton className="h-4 w-48" />
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Separator
|
|
167
|
+
Visual or semantic divider.
|
|
168
|
+
```tsx
|
|
169
|
+
<Separator className="my-4" />
|
|
170
|
+
<Separator orientation="vertical" className="h-full" />
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### ScrollArea
|
|
174
|
+
Custom scrollbars.
|
|
175
|
+
```tsx
|
|
176
|
+
<ScrollArea className="h-48 w-80 rounded-md border p-4">
|
|
177
|
+
Long content...
|
|
178
|
+
</ScrollArea>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### AspectRatio
|
|
182
|
+
Force a container's aspect ratio.
|
|
183
|
+
```tsx
|
|
184
|
+
<AspectRatio :ratio="16 / 9" className="bg-muted">
|
|
185
|
+
<img src="..." alt="..." className="object-cover" />
|
|
186
|
+
</AspectRatio>
|
|
187
|
+
```
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Feedback Components
|
|
2
|
+
|
|
3
|
+
Alert, Tooltip, Popover, HoverCard, Progress, and Toast.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { Alert, AlertTitle, AlertDescription } from '@reinvented/design'
|
|
7
|
+
import { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from '@reinvented/design'
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from '@reinvented/design'
|
|
9
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger } from '@reinvented/design'
|
|
10
|
+
import { Progress } from '@reinvented/design'
|
|
11
|
+
import { toast } from '@reinvented/design'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Alert
|
|
15
|
+
|
|
16
|
+
Inline notification banners for important messages within a page section.
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
<!-- Default (informational) -->
|
|
20
|
+
<Alert>
|
|
21
|
+
<Info className="h-4 w-4" />
|
|
22
|
+
<AlertTitle>Heads up</AlertTitle>
|
|
23
|
+
<AlertDescription>Your trial expires in 3 days. Upgrade to keep access.</AlertDescription>
|
|
24
|
+
</Alert>
|
|
25
|
+
|
|
26
|
+
<!-- Destructive (error) -->
|
|
27
|
+
<Alert variant="destructive">
|
|
28
|
+
<AlertCircle className="h-4 w-4" />
|
|
29
|
+
<AlertTitle>Error</AlertTitle>
|
|
30
|
+
<AlertDescription>Failed to load data. Please try again.</AlertDescription>
|
|
31
|
+
</Alert>
|
|
32
|
+
|
|
33
|
+
<!-- Warning -->
|
|
34
|
+
<Alert variant="warning">
|
|
35
|
+
<AlertTriangle className="h-4 w-4" />
|
|
36
|
+
<AlertTitle>Warning</AlertTitle>
|
|
37
|
+
<AlertDescription>Your connection is unstable. Changes may not be saved.</AlertDescription>
|
|
38
|
+
</Alert>
|
|
39
|
+
|
|
40
|
+
<!-- Success -->
|
|
41
|
+
<Alert variant="success">
|
|
42
|
+
<CheckCircle2 className="h-4 w-4" />
|
|
43
|
+
<AlertTitle>Success</AlertTitle>
|
|
44
|
+
<AlertDescription>Your data has been successfully exported.</AlertDescription>
|
|
45
|
+
</Alert>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Use alerts for persistent in-page messages. Use toast for ephemeral notifications.
|
|
49
|
+
|
|
50
|
+
## Tooltip
|
|
51
|
+
|
|
52
|
+
Hover hints for icons, truncated text, or abbreviated labels.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
<TooltipProvider>
|
|
56
|
+
<Tooltip>
|
|
57
|
+
<TooltipTrigger as-child>
|
|
58
|
+
<Button variant="ghost" size="icon">
|
|
59
|
+
<Settings className="w-4 h-4" />
|
|
60
|
+
</Button>
|
|
61
|
+
</TooltipTrigger>
|
|
62
|
+
<TooltipContent>
|
|
63
|
+
<p>Settings</p>
|
|
64
|
+
</TooltipContent>
|
|
65
|
+
</Tooltip>
|
|
66
|
+
</TooltipProvider>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- Always wrap in `TooltipProvider` (can wrap the entire page once)
|
|
70
|
+
- Use `as-child` on the trigger
|
|
71
|
+
- Keep tooltip text short — 1-5 words
|
|
72
|
+
- Essential for icon-only buttons (accessibility)
|
|
73
|
+
|
|
74
|
+
## Popover
|
|
75
|
+
|
|
76
|
+
Click-triggered floating panels for small forms or additional content.
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<Popover>
|
|
80
|
+
<PopoverTrigger as-child>
|
|
81
|
+
<Button variant="outline" size="sm">
|
|
82
|
+
<Filter className="w-4 h-4" /> Filter
|
|
83
|
+
</Button>
|
|
84
|
+
</PopoverTrigger>
|
|
85
|
+
<PopoverContent className="w-80" align="start">
|
|
86
|
+
<div className="space-y-4">
|
|
87
|
+
<h4 className="text-sm font-medium">Filter by</h4>
|
|
88
|
+
<!-- Filter controls -->
|
|
89
|
+
</div>
|
|
90
|
+
</PopoverContent>
|
|
91
|
+
</Popover>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Use `align="start"` or `align="end"` to control alignment relative to trigger.
|
|
95
|
+
|
|
96
|
+
## HoverCard
|
|
97
|
+
|
|
98
|
+
Rich preview on hover. Use for user profiles, link previews.
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
<HoverCard>
|
|
102
|
+
<HoverCardTrigger as-child>
|
|
103
|
+
<button className="text-sm font-medium underline decoration-dotted underline-offset-4">@sarah.chen</button>
|
|
104
|
+
</HoverCardTrigger>
|
|
105
|
+
<HoverCardContent className="w-80">
|
|
106
|
+
<div className="flex gap-4">
|
|
107
|
+
<!-- Avatar -->
|
|
108
|
+
<div className="w-10 h-10 rounded-full shrink-0 bg-gradient-to-br from-emerald-400 to-teal-600" />
|
|
109
|
+
<div className="space-y-1">
|
|
110
|
+
<h4 className="text-sm font-semibold">Sarah Chen</h4>
|
|
111
|
+
<p className="text-xs text-muted-foreground">Engineering Lead at Acme Inc.</p>
|
|
112
|
+
<p className="text-xs text-muted-foreground">Joined March 2023</p>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</HoverCardContent>
|
|
116
|
+
</HoverCard>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Progress
|
|
120
|
+
|
|
121
|
+
Progress bar for completion tracking.
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
<div className="space-y-2">
|
|
125
|
+
<div className="flex items-center justify-between text-sm">
|
|
126
|
+
<span className="font-medium">Upload progress</span>
|
|
127
|
+
<span className="text-muted-foreground">66%</span>
|
|
128
|
+
</div>
|
|
129
|
+
<Progress :model-value="66" className="h-2" />
|
|
130
|
+
</div>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Use `className="h-2"` for standard height, `className="h-1"` for subtle/compact progress bars.
|
|
134
|
+
|
|
135
|
+
## Toast
|
|
136
|
+
|
|
137
|
+
Ephemeral notifications. Import `toast` function, not a component.
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import { toast } from '@reinvented/design'
|
|
141
|
+
|
|
142
|
+
// Success
|
|
143
|
+
toast.success('Project created successfully')
|
|
144
|
+
|
|
145
|
+
// Error with retry
|
|
146
|
+
toast.error('Failed to save changes', {
|
|
147
|
+
action: { label: 'Retry', onClick: () => handleSave() }
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
// Promise-based (shows loading → success/error)
|
|
151
|
+
toast.promise(saveData(), {
|
|
152
|
+
loading: 'Saving...',
|
|
153
|
+
success: 'Changes saved!',
|
|
154
|
+
error: 'Failed to save'
|
|
155
|
+
})
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### When to Use Toast vs Alert
|
|
159
|
+
| Scenario | Use |
|
|
160
|
+
|----------|-----|
|
|
161
|
+
| Mutation success/failure | Toast |
|
|
162
|
+
| Persistent warning in page content | Alert |
|
|
163
|
+
| Action completed in background | Toast |
|
|
164
|
+
| Page-level error blocking content | Alert |
|
|
165
|
+
| Undo opportunity | Toast with action |
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Form Components
|
|
2
|
+
|
|
3
|
+
Structured form layout with validation messaging.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { Form, FormField, FormItem, FormLabel, FormControl, FormDescription, FormMessage } from '@reinvented/design'
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Form Field Pattern
|
|
10
|
+
|
|
11
|
+
The standard pattern for form fields with label, input, description, and error message:
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
<form className="space-y-4" @submit.prevent="handleSubmit">
|
|
15
|
+
<div className="space-y-2">
|
|
16
|
+
<Label for="name">Name</Label>
|
|
17
|
+
<Input id="name" defaultValue="form.name" placeholder="Your full name" />
|
|
18
|
+
<p className="text-xs text-muted-foreground">This will be displayed on your profile.</p>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div className="space-y-2">
|
|
22
|
+
<Label for="email">Email</Label>
|
|
23
|
+
<Input id="email" type="email" defaultValue="form.email" placeholder="you@example.com" />
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div className="space-y-2">
|
|
27
|
+
<Label for="role">Role</Label>
|
|
28
|
+
<Select defaultValue="form.role">
|
|
29
|
+
<SelectTrigger>
|
|
30
|
+
<SelectValue placeholder="Select a role" />
|
|
31
|
+
</SelectTrigger>
|
|
32
|
+
<SelectContent>
|
|
33
|
+
<SelectItem value="admin">Admin</SelectItem>
|
|
34
|
+
<SelectItem value="editor">Editor</SelectItem>
|
|
35
|
+
<SelectItem value="viewer">Viewer</SelectItem>
|
|
36
|
+
</SelectContent>
|
|
37
|
+
</Select>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div className="flex justify-end gap-2 pt-4">
|
|
41
|
+
<Button variant="outline" type="button">Cancel</Button>
|
|
42
|
+
<Button type="submit" :disabled="saving">
|
|
43
|
+
<Loader2 v-if="saving" className="w-4 h-4 animate-spin" />
|
|
44
|
+
{{ saving ? 'Creating...' : 'Create' }}
|
|
45
|
+
</Button>
|
|
46
|
+
</div>
|
|
47
|
+
</form>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Form Layout Patterns
|
|
51
|
+
|
|
52
|
+
### Single Column (Default)
|
|
53
|
+
```tsx
|
|
54
|
+
<div className="space-y-4 max-w-lg">
|
|
55
|
+
<!-- Fields stacked vertically with space-y-4 -->
|
|
56
|
+
</div>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Two-Column Grid
|
|
60
|
+
For wider forms on desktop:
|
|
61
|
+
```tsx
|
|
62
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
63
|
+
<div className="space-y-2">
|
|
64
|
+
<Label>First Name</Label>
|
|
65
|
+
<Input defaultValue="form.firstName" />
|
|
66
|
+
</div>
|
|
67
|
+
<div className="space-y-2">
|
|
68
|
+
<Label>Last Name</Label>
|
|
69
|
+
<Input defaultValue="form.lastName" />
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Grouped Sections
|
|
75
|
+
For forms with logical groups:
|
|
76
|
+
```tsx
|
|
77
|
+
<div className="space-y-8">
|
|
78
|
+
<div className="space-y-4">
|
|
79
|
+
<div>
|
|
80
|
+
<h3 className="text-lg font-semibold">Personal Information</h3>
|
|
81
|
+
<p className="text-sm text-muted-foreground">Your basic profile details.</p>
|
|
82
|
+
</div>
|
|
83
|
+
<!-- Fields -->
|
|
84
|
+
</div>
|
|
85
|
+
<Separator />
|
|
86
|
+
<div className="space-y-4">
|
|
87
|
+
<div>
|
|
88
|
+
<h3 className="text-lg font-semibold">Preferences</h3>
|
|
89
|
+
<p className="text-sm text-muted-foreground">Customize your experience.</p>
|
|
90
|
+
</div>
|
|
91
|
+
<!-- Fields -->
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Validation Display
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<!-- Error state on field -->
|
|
100
|
+
<div className="space-y-2">
|
|
101
|
+
<Label for="email" className="text-destructive">Email</Label>
|
|
102
|
+
<Input id="email" defaultValue="form.email" className="border-destructive focus-visible:ring-destructive" />
|
|
103
|
+
<p className="text-xs text-destructive">Please enter a valid email address.</p>
|
|
104
|
+
</div>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Rules
|
|
108
|
+
- **Field spacing**: `space-y-4` between fields, `space-y-2` within a field (label → input → message)
|
|
109
|
+
- **Submit button**: Always rightmost in the button group, always shows loading state
|
|
110
|
+
- **Cancel button**: Always `variant="outline"` and `type="button"` (prevents form submission)
|
|
111
|
+
- **Required fields**: Mark optional fields with "(optional)" in the label, not required fields with asterisks
|
|
112
|
+
- **Max width**: Forms should have `max-w-lg` or be inside a `Card` to prevent excessively wide inputs
|