@thesage/ui 1.0.0 → 1.0.1
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/.claude/CLAUDE.md +224 -0
- package/package.json +2 -1
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# @thesage/ui — AI Context
|
|
2
|
+
|
|
3
|
+
> 92 accessible React components | Radix UI + Tailwind CSS | 3 themes | TypeScript strict mode | MIT
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @thesage/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Provider Hierarchy (Required)
|
|
12
|
+
|
|
13
|
+
Wrap your app root in this exact order:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { ThemeProvider, TooltipProvider } from '@thesage/ui/providers'
|
|
17
|
+
import { Toaster } from '@thesage/ui'
|
|
18
|
+
import '@thesage/ui/globals.css'
|
|
19
|
+
|
|
20
|
+
export default function RootLayout({ children }) {
|
|
21
|
+
return (
|
|
22
|
+
<ThemeProvider defaultTheme="studio" defaultMode="system">
|
|
23
|
+
<TooltipProvider>
|
|
24
|
+
{children}
|
|
25
|
+
<Toaster />
|
|
26
|
+
</TooltipProvider>
|
|
27
|
+
</ThemeProvider>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Import Patterns
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
// Main exports (most common)
|
|
36
|
+
import { Button, Card, Input, Dialog, Badge } from '@thesage/ui'
|
|
37
|
+
|
|
38
|
+
// Subpath exports
|
|
39
|
+
import { useMotionPreference, useTheme } from '@thesage/ui/hooks'
|
|
40
|
+
import { ThemeProvider, TooltipProvider } from '@thesage/ui/providers'
|
|
41
|
+
import { cn } from '@thesage/ui/utils'
|
|
42
|
+
import { spacing, typography } from '@thesage/ui/tokens'
|
|
43
|
+
|
|
44
|
+
// Heavy/optional features (require peer dependencies)
|
|
45
|
+
import { Form, FormField, FormItem } from '@thesage/ui/forms' // react-hook-form + zod
|
|
46
|
+
import { Calendar, DatePicker } from '@thesage/ui/dates' // date-fns + react-day-picker
|
|
47
|
+
import { DataTable } from '@thesage/ui/tables' // @tanstack/react-table
|
|
48
|
+
import { DragDrop } from '@thesage/ui/dnd' // @dnd-kit/*
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Themes
|
|
52
|
+
|
|
53
|
+
Three themes, each with light and dark modes:
|
|
54
|
+
- **Studio** — Professional, balanced (default)
|
|
55
|
+
- **Terra** — Calm, organic, warm earth tones
|
|
56
|
+
- **Volt** — Bold, electric, cyberpunk neon
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { useTheme } from '@thesage/ui/hooks'
|
|
60
|
+
const { theme, setTheme, mode, setMode } = useTheme()
|
|
61
|
+
setTheme('volt')
|
|
62
|
+
setMode('dark')
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Styling Rules
|
|
66
|
+
|
|
67
|
+
- Use CSS variables: `bg-background`, `text-foreground`, `border-border`
|
|
68
|
+
- NEVER hardcode colors: no `bg-white`, `text-black`, `bg-neutral-100`
|
|
69
|
+
- All components accept `className` for Tailwind overrides
|
|
70
|
+
- Merge classes with `cn()`: `import { cn } from '@thesage/ui/utils'`
|
|
71
|
+
|
|
72
|
+
## Motion
|
|
73
|
+
|
|
74
|
+
Every animation MUST respect user preferences:
|
|
75
|
+
```tsx
|
|
76
|
+
import { useMotionPreference } from '@thesage/ui/hooks'
|
|
77
|
+
const { shouldAnimate, scale } = useMotionPreference()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Component Categories
|
|
81
|
+
|
|
82
|
+
| Category | Count | Import | Examples |
|
|
83
|
+
|----------|-------|--------|----------|
|
|
84
|
+
| Actions | 5 | `@thesage/ui` | Button, Toggle, ToggleGroup, Link, Magnetic |
|
|
85
|
+
| Forms | 18 | `@thesage/ui` | Input, Textarea, Select, Checkbox, Switch, Slider, Combobox, RadioGroup, Label, SearchBar |
|
|
86
|
+
| Navigation | 7 | `@thesage/ui` | Tabs, Breadcrumb, Pagination, NavigationMenu, Menubar, Command |
|
|
87
|
+
| Overlays | 8 | `@thesage/ui` | Dialog, AlertDialog, Popover, Tooltip, HoverCard, ContextMenu, DropdownMenu, Drawer |
|
|
88
|
+
| Feedback | 6 | `@thesage/ui` | Alert, Toaster/toast, Progress, Skeleton, Spinner |
|
|
89
|
+
| Data Display | 14 | `@thesage/ui` | Card, Badge, Avatar, Table, Carousel, AspectRatio, Collapsible, CodeBlock |
|
|
90
|
+
| Layout | 8 | `@thesage/ui` | Accordion, Separator, ScrollArea, ResizablePanel, Sheet |
|
|
91
|
+
| Features | 3 | `@thesage/ui` | CustomizerPanel, ThemeSwitcher |
|
|
92
|
+
|
|
93
|
+
## High-Frequency Component Quick Reference
|
|
94
|
+
|
|
95
|
+
### Button
|
|
96
|
+
```tsx
|
|
97
|
+
<Button variant="default|destructive|outline|secondary|ghost|link" size="sm|default|lg|icon">
|
|
98
|
+
Label
|
|
99
|
+
</Button>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Card
|
|
103
|
+
```tsx
|
|
104
|
+
<Card>
|
|
105
|
+
<CardHeader><CardTitle>Title</CardTitle><CardDescription>Desc</CardDescription></CardHeader>
|
|
106
|
+
<CardContent>Body</CardContent>
|
|
107
|
+
<CardFooter>Actions</CardFooter>
|
|
108
|
+
</Card>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Dialog
|
|
112
|
+
```tsx
|
|
113
|
+
<Dialog>
|
|
114
|
+
<DialogTrigger asChild><Button>Open</Button></DialogTrigger>
|
|
115
|
+
<DialogContent>
|
|
116
|
+
<DialogHeader><DialogTitle>Title</DialogTitle><DialogDescription>Desc</DialogDescription></DialogHeader>
|
|
117
|
+
Body
|
|
118
|
+
<DialogFooter><Button>Confirm</Button></DialogFooter>
|
|
119
|
+
</DialogContent>
|
|
120
|
+
</Dialog>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Input
|
|
124
|
+
```tsx
|
|
125
|
+
<Input type="email" placeholder="Enter email" disabled={false} />
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Select
|
|
129
|
+
```tsx
|
|
130
|
+
<Select value={val} onValueChange={setVal}>
|
|
131
|
+
<SelectTrigger><SelectValue placeholder="Pick one" /></SelectTrigger>
|
|
132
|
+
<SelectContent>
|
|
133
|
+
<SelectItem value="a">Option A</SelectItem>
|
|
134
|
+
<SelectItem value="b">Option B</SelectItem>
|
|
135
|
+
</SelectContent>
|
|
136
|
+
</Select>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Tabs
|
|
140
|
+
```tsx
|
|
141
|
+
<Tabs defaultValue="tab1">
|
|
142
|
+
<TabsList>
|
|
143
|
+
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
|
144
|
+
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
|
|
145
|
+
</TabsList>
|
|
146
|
+
<TabsContent value="tab1">Content 1</TabsContent>
|
|
147
|
+
<TabsContent value="tab2">Content 2</TabsContent>
|
|
148
|
+
</Tabs>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Badge
|
|
152
|
+
```tsx
|
|
153
|
+
<Badge variant="default|secondary|destructive|outline">Label</Badge>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Alert
|
|
157
|
+
```tsx
|
|
158
|
+
<Alert variant="default|destructive">
|
|
159
|
+
<AlertTitle>Heading</AlertTitle>
|
|
160
|
+
<AlertDescription>Message</AlertDescription>
|
|
161
|
+
</Alert>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Form (react-hook-form integration)
|
|
165
|
+
```tsx
|
|
166
|
+
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from '@thesage/ui/forms'
|
|
167
|
+
|
|
168
|
+
<Form {...form}>
|
|
169
|
+
<FormField control={form.control} name="email" render={({ field }) => (
|
|
170
|
+
<FormItem>
|
|
171
|
+
<FormLabel>Email</FormLabel>
|
|
172
|
+
<FormControl><Input {...field} /></FormControl>
|
|
173
|
+
<FormMessage />
|
|
174
|
+
</FormItem>
|
|
175
|
+
)} />
|
|
176
|
+
</Form>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Bundle Size (minified + brotli)
|
|
180
|
+
|
|
181
|
+
| Entrypoint | Size | Peer Deps Required |
|
|
182
|
+
|------------|------|--------------------|
|
|
183
|
+
| `@thesage/ui` (core) | 146 KB | None |
|
|
184
|
+
| `@thesage/ui/dates` | 29 KB | date-fns, react-day-picker |
|
|
185
|
+
| `@thesage/ui/tokens` | 11 KB | None |
|
|
186
|
+
| `@thesage/ui/utils` | 10 KB | None |
|
|
187
|
+
| `@thesage/ui/forms` | 9 KB | react-hook-form, zod |
|
|
188
|
+
| `@thesage/ui/tables` | 8 KB | @tanstack/react-table |
|
|
189
|
+
| `@thesage/ui/dnd` | 8 KB | @dnd-kit/* |
|
|
190
|
+
| `@thesage/ui/providers` | 8 KB | None |
|
|
191
|
+
| `@thesage/ui/hooks` | 6 KB | None |
|
|
192
|
+
| `@thesage/ui/webgl` | 1 KB | framer-motion |
|
|
193
|
+
|
|
194
|
+
`sideEffects: false` enables tree-shaking. Heavy features isolated behind subpath exports.
|
|
195
|
+
|
|
196
|
+
## Third-Party Pairings
|
|
197
|
+
|
|
198
|
+
For gaps SDE doesn't cover, these libraries integrate well:
|
|
199
|
+
|
|
200
|
+
| Need | Library | Install |
|
|
201
|
+
|------|---------|---------|
|
|
202
|
+
| Rich Text Editor | Tiptap | `@tiptap/react @tiptap/starter-kit` |
|
|
203
|
+
| File Upload | react-dropzone | `react-dropzone` |
|
|
204
|
+
| Charts | Recharts | `recharts` |
|
|
205
|
+
| Color Picker | react-colorful | `react-colorful` |
|
|
206
|
+
| Markdown | react-markdown | `react-markdown remark-gfm` |
|
|
207
|
+
| Virtualized Lists | @tanstack/react-virtual | `@tanstack/react-virtual` |
|
|
208
|
+
| State Machines | XState | `xstate @xstate/react` |
|
|
209
|
+
|
|
210
|
+
**Already integrated as optional peer deps:** @tanstack/react-table (`/tables`), react-hook-form + zod (`/forms`), date-fns + react-day-picker (`/dates`), @dnd-kit (`/dnd`), framer-motion, lucide-react.
|
|
211
|
+
|
|
212
|
+
**Integration pattern:** Wrap in SDE Card/Dialog, use `cn()` for class merging, pull colors from CSS variables (`var(--color-primary)`) to stay theme-aware.
|
|
213
|
+
|
|
214
|
+
## Full API Reference
|
|
215
|
+
|
|
216
|
+
For complete props, variants, and examples for all 92 components:
|
|
217
|
+
- Web: https://thesage.dev/llms-full.txt
|
|
218
|
+
- MCP Server: `npx @thesage/mcp` (tools: list_components, search_components, get_component)
|
|
219
|
+
|
|
220
|
+
## Resources
|
|
221
|
+
|
|
222
|
+
- Docs: https://thesage.dev/docs
|
|
223
|
+
- GitHub: https://github.com/shalomormsby/ecosystem
|
|
224
|
+
- NPM: https://www.npmjs.com/package/@thesage/ui
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thesage/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Sage Design Engine — Make it Lovable. 48+ accessible components, three themes, user-controlled motion.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
+
".claude",
|
|
23
24
|
"README.md"
|
|
24
25
|
],
|
|
25
26
|
"exports": {
|