@devalok/shilp-sutra 0.6.1 → 0.6.2
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/llms-full.txt +1753 -0
- package/llms.txt +180 -0
- package/package.json +528 -526
package/llms.txt
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# @devalok/shilp-sutra
|
|
2
|
+
|
|
3
|
+
> Radix UI + Tailwind CSS + CVA design system for Devalok apps.
|
|
4
|
+
> Built on the same primitives as shadcn/ui but with key API differences.
|
|
5
|
+
> Read this file BEFORE writing any UI code. Do NOT guess from shadcn/ui knowledge.
|
|
6
|
+
|
|
7
|
+
## Install & Setup
|
|
8
|
+
|
|
9
|
+
pnpm add @devalok/shilp-sutra
|
|
10
|
+
|
|
11
|
+
// Import components (barrel):
|
|
12
|
+
import { Button, Card, Dialog } from '@devalok/shilp-sutra'
|
|
13
|
+
|
|
14
|
+
// Import per-component (recommended for Server Components):
|
|
15
|
+
import { Button } from '@devalok/shilp-sutra/ui/button'
|
|
16
|
+
import { PageHeader } from '@devalok/shilp-sutra/composed/page-header'
|
|
17
|
+
import { TopBar } from '@devalok/shilp-sutra/shell/top-bar'
|
|
18
|
+
|
|
19
|
+
// Hooks:
|
|
20
|
+
import { useToast } from '@devalok/shilp-sutra/hooks/use-toast'
|
|
21
|
+
import { useColorMode } from '@devalok/shilp-sutra/hooks/use-color-mode'
|
|
22
|
+
|
|
23
|
+
// CSS tokens (import once at app root):
|
|
24
|
+
import '@devalok/shilp-sutra/tokens'
|
|
25
|
+
|
|
26
|
+
// Tailwind preset (in tailwind.config):
|
|
27
|
+
import shilpSutra from '@devalok/shilp-sutra/tailwind'
|
|
28
|
+
|
|
29
|
+
## CRITICAL: Differences from shadcn/ui
|
|
30
|
+
|
|
31
|
+
If you have shadcn/ui knowledge, these are the differences that WILL trip you up:
|
|
32
|
+
|
|
33
|
+
| shadcn/ui pattern | shilp-sutra equivalent | Notes |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| variant="destructive" | color="error" | Two-axis system: variant=shape, color=intent |
|
|
36
|
+
| size="default" | size="md" | All sizes: sm, md, lg (never "default") |
|
|
37
|
+
| <Select size="lg"> | <SelectTrigger size="lg"> | Size goes on trigger, NOT root |
|
|
38
|
+
| <Chip>text</Chip> | <Chip label="text" /> | Chip uses label prop, NOT children |
|
|
39
|
+
| Toast variant="destructive" | Toast color="error" | Toast uses color= not variant= |
|
|
40
|
+
| Badge variant="destructive" | Badge variant="solid" color="error" | Two-axis: variant + color |
|
|
41
|
+
| Alert + AlertTitle + AlertDescription | <Alert title="..." color="error"> | Single component, not compound |
|
|
42
|
+
| Form + FormField + FormItem + FormLabel + FormControl + FormDescription + FormMessage | FormField + Label + Input + FormHelperText + useFormField() | Simpler API, hook-based a11y wiring |
|
|
43
|
+
| Pagination | PaginationRoot | Root component name differs |
|
|
44
|
+
|
|
45
|
+
### The Two-Axis Variant System
|
|
46
|
+
|
|
47
|
+
Many components use TWO props where shadcn uses one:
|
|
48
|
+
- `variant` controls SHAPE/SURFACE: solid, outline, ghost, subtle, filled, etc.
|
|
49
|
+
- `color` controls INTENT/SEMANTICS: default, error, success, warning, info, etc.
|
|
50
|
+
|
|
51
|
+
Examples:
|
|
52
|
+
<Button variant="solid" color="error">Delete</Button> // red solid button
|
|
53
|
+
<Button variant="outline" color="error">Cancel</Button> // red outline button
|
|
54
|
+
<Badge variant="solid" color="success">Active</Badge> // green solid badge
|
|
55
|
+
<Alert variant="filled" color="warning">Warning!</Alert> // yellow filled alert
|
|
56
|
+
|
|
57
|
+
Components with two-axis system: Button, Badge, Alert, Chip, Toast, Banner, Progress, StatusBadge
|
|
58
|
+
|
|
59
|
+
## Component Quick Reference
|
|
60
|
+
|
|
61
|
+
### Inputs & Controls
|
|
62
|
+
- Button: variant(solid|default|outline|ghost|link) color(default|error) size(sm|md|lg|icon) + loading, startIcon, endIcon, asChild
|
|
63
|
+
- IconButton: icon(ReactNode, required) shape(square|circle) size(sm|md|lg) + aria-label required
|
|
64
|
+
- Input: size(sm|md|lg) state(default|error|warning|success) + startIcon, endIcon
|
|
65
|
+
- SearchInput: size(sm|md|lg) + loading, onClear
|
|
66
|
+
- NumberInput: value + onValueChange, min, max, step (controlled only)
|
|
67
|
+
- Textarea: size(sm|md|lg) state(default|error|warning|success)
|
|
68
|
+
- Checkbox: checked, onCheckedChange, error(boolean), indeterminate(boolean)
|
|
69
|
+
- Switch: checked, onCheckedChange, error(boolean)
|
|
70
|
+
- RadioGroup > RadioGroupItem(value)
|
|
71
|
+
- Select > SelectTrigger(size) > SelectValue; SelectContent > SelectItem(value)
|
|
72
|
+
- Toggle: variant(default|outline) size(sm|md|lg)
|
|
73
|
+
- ToggleGroup > ToggleGroupItem (variant/size propagate from root)
|
|
74
|
+
- SegmentedControl > SegmentedControlItem: variant(filled|tonal) size(sm|md|lg)
|
|
75
|
+
- Slider: standard Radix slider
|
|
76
|
+
|
|
77
|
+
### Feedback & Notifications
|
|
78
|
+
- Alert: variant(subtle|filled|outline) color(info|success|warning|error|neutral) + title, onDismiss
|
|
79
|
+
- Banner: color(info|success|warning|error|neutral) + title, onDismiss
|
|
80
|
+
- Toast: color(neutral|success|warning|error|info) — REQUIRES <Toaster> at layout root + useToast()
|
|
81
|
+
- Spinner: size(sm|md|lg) — renders with role="status"
|
|
82
|
+
- Progress: track size(sm|md|lg), indicator color(default|success|warning|error)
|
|
83
|
+
|
|
84
|
+
NOTIFICATION SELECTION GUIDE:
|
|
85
|
+
- Alert: inline contextual feedback within a form or page section
|
|
86
|
+
- Banner: persistent page-level notification above content
|
|
87
|
+
- Toast: transient notification triggered by user action (needs Toaster + useToast)
|
|
88
|
+
|
|
89
|
+
### Data Display
|
|
90
|
+
- Badge: variant(subtle|solid|outline) color(default|info|success|error|warning|brand|accent + 7 category colors) size(sm|md|lg) + onDismiss
|
|
91
|
+
- Chip: variant(subtle|outline) color(default|primary|success|error|warning|info + 7 category) size(sm|md|lg) label(string, REQUIRED) + onDismiss, onClick
|
|
92
|
+
- Avatar: size(xs|sm|md|lg|xl) shape(circle|square|rounded) status(online|offline|busy|away) > AvatarImage + AvatarFallback
|
|
93
|
+
- Card: variant(default|elevated|outline|flat) interactive(boolean) > CardHeader > CardTitle, CardDescription; CardContent; CardFooter
|
|
94
|
+
- Table > TableHeader > TableRow > TableHead; TableBody > TableRow > TableCell; TableFooter; TableCaption
|
|
95
|
+
- Text: variant(heading-2xl|heading-xl|heading-lg|heading-md|heading-sm|heading-xs|body-lg|body-md|body-sm|body-xs|label-lg|label-md|label-sm|label-xs|caption|overline) as(element)
|
|
96
|
+
- Code: variant(inline|block)
|
|
97
|
+
- Skeleton: variant(rectangle|circle|text) animation(pulse|shimmer|none)
|
|
98
|
+
- StatCard: title, value, description, trend, icon
|
|
99
|
+
|
|
100
|
+
### Overlays
|
|
101
|
+
- Dialog > DialogTrigger; DialogContent > DialogHeader > DialogTitle, DialogDescription; [content]; DialogFooter
|
|
102
|
+
- AlertDialog > AlertDialogTrigger; AlertDialogContent > AlertDialogHeader > AlertDialogTitle; AlertDialogFooter > AlertDialogCancel, AlertDialogAction
|
|
103
|
+
- Sheet: side(top|bottom|left|right) > SheetTrigger; SheetContent > SheetHeader > SheetTitle; [content]; SheetFooter
|
|
104
|
+
- Popover > PopoverTrigger; PopoverContent
|
|
105
|
+
- Tooltip: requires <TooltipProvider> at layout root > Tooltip > TooltipTrigger; TooltipContent
|
|
106
|
+
- HoverCard > HoverCardTrigger; HoverCardContent
|
|
107
|
+
- Collapsible > CollapsibleTrigger; CollapsibleContent
|
|
108
|
+
|
|
109
|
+
### Navigation
|
|
110
|
+
- Tabs > TabsList(variant: line|contained) > TabsTrigger(value); TabsContent(value) — variant propagates via context
|
|
111
|
+
- Accordion(type: single|multiple) > AccordionItem(value) > AccordionTrigger; AccordionContent
|
|
112
|
+
- Breadcrumb > BreadcrumbList > BreadcrumbItem > BreadcrumbLink | BreadcrumbPage; BreadcrumbSeparator
|
|
113
|
+
- PaginationRoot > PaginationContent > PaginationItem > PaginationLink(isActive) | PaginationPrevious | PaginationNext | PaginationEllipsis
|
|
114
|
+
- DropdownMenu > DropdownMenuTrigger; DropdownMenuContent > DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuCheckboxItem, DropdownMenuRadioGroup > DropdownMenuRadioItem
|
|
115
|
+
- ContextMenu > ContextMenuTrigger (right-click); ContextMenuContent > same sub-components as DropdownMenu
|
|
116
|
+
- Menubar > MenubarMenu > MenubarTrigger; MenubarContent > same sub-components
|
|
117
|
+
- NavigationMenu > NavigationMenuList > NavigationMenuItem > NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink
|
|
118
|
+
|
|
119
|
+
### Layout
|
|
120
|
+
- Stack: direction(vertical|horizontal) gap(SpacingToken|number) align, justify, wrap
|
|
121
|
+
- Container: maxWidth(default|body|full)
|
|
122
|
+
- Separator: orientation(horizontal|vertical)
|
|
123
|
+
- Sidebar: complex — see llms-full.txt for complete tree
|
|
124
|
+
|
|
125
|
+
### Form Pattern
|
|
126
|
+
- FormField: state(helper|error|warning|success) > Label + Input + FormHelperText
|
|
127
|
+
- useFormField() hook returns { state, helperTextId, required } from FormField context
|
|
128
|
+
- Wire accessibility: const { state, helperTextId } = useFormField(); then aria-describedby={helperTextId}, aria-invalid={state === 'error'}
|
|
129
|
+
|
|
130
|
+
### Composed Components
|
|
131
|
+
- PageHeader: title, subtitle, breadcrumbs[], actions(ReactNode)
|
|
132
|
+
- AvatarGroup: users[], max(number), size(sm|md|lg), showTooltip
|
|
133
|
+
- StatusBadge: status(active|pending|approved|rejected|completed|blocked|cancelled|draft) color(success|warning|error|info|neutral) size(sm|md)
|
|
134
|
+
- ContentCard: variant(default|outline|ghost) padding(default|compact|spacious|none)
|
|
135
|
+
- EmptyState: icon, title(required), description, action(ReactNode), compact
|
|
136
|
+
- PriorityIndicator: priority(LOW|MEDIUM|HIGH|URGENT) display(compact|full)
|
|
137
|
+
- SimpleTooltip: wraps Tooltip compound into single component
|
|
138
|
+
- DatePicker, DateRangePicker, DateTimePicker, TimePicker
|
|
139
|
+
- RichTextEditor, RichTextViewer
|
|
140
|
+
- CommandPalette, MemberPicker
|
|
141
|
+
- ErrorDisplay, GlobalLoading
|
|
142
|
+
- Loading skeletons: CardSkeleton, TableSkeleton, BoardSkeleton, ListSkeleton, DashboardSkeleton, etc.
|
|
143
|
+
|
|
144
|
+
### Shell Components (app-level layout)
|
|
145
|
+
- TopBar: pageTitle, user, onNavigate, onLogout, notificationSlot, mobileLogo
|
|
146
|
+
- AppSidebar: navigation tree with NavItem[], NavGroup[]
|
|
147
|
+
- BottomNavbar: mobile navigation
|
|
148
|
+
- NotificationCenter: notifications[], onDismiss, onRead
|
|
149
|
+
- AppCommandPalette: search results, user info
|
|
150
|
+
|
|
151
|
+
### Hooks
|
|
152
|
+
- useToast(): returns { toast, toasts, dismiss } — toast({ title, description, color })
|
|
153
|
+
- useColorMode(): returns { colorMode, setColorMode, toggleColorMode }
|
|
154
|
+
- useMobile(): returns boolean (true if viewport < 768px)
|
|
155
|
+
|
|
156
|
+
## Server-Safe Components (no "use client")
|
|
157
|
+
|
|
158
|
+
These can be imported directly in Next.js Server Components:
|
|
159
|
+
- UI: Text, Skeleton, Spinner, Stack, Container, Table (and sub-components), Code, VisuallyHidden
|
|
160
|
+
- Composed: ContentCard, EmptyState, PageHeader, LoadingSkeleton, PageSkeletons, PriorityIndicator, StatusBadge
|
|
161
|
+
|
|
162
|
+
Use per-component imports for server components:
|
|
163
|
+
import { Text } from '@devalok/shilp-sutra/ui/text'
|
|
164
|
+
import { PageHeader } from '@devalok/shilp-sutra/composed/page-header'
|
|
165
|
+
|
|
166
|
+
DO NOT use barrel imports in Server Components — they include "use client" components.
|
|
167
|
+
|
|
168
|
+
## Common Mistakes -- DO NOT
|
|
169
|
+
|
|
170
|
+
- DO NOT use variant="destructive" — use color="error"
|
|
171
|
+
- DO NOT use size="default" — use size="md" (or sm, lg)
|
|
172
|
+
- DO NOT put size on <Select> — put it on <SelectTrigger size="md">
|
|
173
|
+
- DO NOT use <Chip>text</Chip> — use <Chip label="text" />
|
|
174
|
+
- DO NOT use <Toast variant="..."> — use <Toast color="error">
|
|
175
|
+
- DO NOT use color="danger" — use color="error"
|
|
176
|
+
- DO NOT call toast() without <Toaster /> mounted at your layout root
|
|
177
|
+
- DO NOT use <Alert><AlertTitle>...</AlertTitle></Alert> — use <Alert title="..." />
|
|
178
|
+
- DO NOT import from barrel in Next.js Server Components — use per-component imports
|
|
179
|
+
- DO NOT use variant="secondary" on Button — use variant="outline" or variant="ghost"
|
|
180
|
+
- DO NOT put variant on individual TabsTrigger — put it on TabsList (propagates via context)
|