@thesage/ui 0.1.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.
Files changed (51) hide show
  1. package/.claude/CLAUDE.md +224 -0
  2. package/README.md +96 -61
  3. package/dist/dates.d.mts +20 -0
  4. package/dist/dates.d.ts +20 -0
  5. package/dist/dates.js +230 -0
  6. package/dist/dates.js.map +1 -0
  7. package/dist/dates.mjs +193 -0
  8. package/dist/dates.mjs.map +1 -0
  9. package/dist/dnd.d.mts +126 -0
  10. package/dist/dnd.d.ts +126 -0
  11. package/dist/dnd.js +274 -0
  12. package/dist/dnd.js.map +1 -0
  13. package/dist/dnd.mjs +250 -0
  14. package/dist/dnd.mjs.map +1 -0
  15. package/dist/forms.d.mts +38 -0
  16. package/dist/forms.d.ts +38 -0
  17. package/dist/forms.js +198 -0
  18. package/dist/forms.js.map +1 -0
  19. package/dist/forms.mjs +159 -0
  20. package/dist/forms.mjs.map +1 -0
  21. package/dist/hooks.js +6 -5
  22. package/dist/hooks.js.map +1 -1
  23. package/dist/hooks.mjs +6 -5
  24. package/dist/hooks.mjs.map +1 -1
  25. package/dist/index.d.mts +484 -352
  26. package/dist/index.d.ts +484 -352
  27. package/dist/index.js +2674 -2092
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +2548 -1966
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/providers.js +6 -5
  32. package/dist/providers.js.map +1 -1
  33. package/dist/providers.mjs +6 -5
  34. package/dist/providers.mjs.map +1 -1
  35. package/dist/tables.d.mts +10 -0
  36. package/dist/tables.d.ts +10 -0
  37. package/dist/tables.js +248 -0
  38. package/dist/tables.js.map +1 -0
  39. package/dist/tables.mjs +218 -0
  40. package/dist/tables.mjs.map +1 -0
  41. package/dist/utils.js +2 -1
  42. package/dist/utils.js.map +1 -1
  43. package/dist/utils.mjs +2 -1
  44. package/dist/utils.mjs.map +1 -1
  45. package/dist/webgl.d.mts +104 -0
  46. package/dist/webgl.d.ts +104 -0
  47. package/dist/webgl.js +226 -0
  48. package/dist/webgl.js.map +1 -0
  49. package/dist/webgl.mjs +195 -0
  50. package/dist/webgl.mjs.map +1 -0
  51. package/package.json +146 -16
@@ -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/README.md CHANGED
@@ -6,36 +6,58 @@
6
6
  [![License](https://img.shields.io/npm/l/@thesage/ui?color=blue&style=flat-square)](https://github.com/shalomormsby/ecosystem/blob/main/LICENSE)
7
7
  [![Downloads](https://img.shields.io/npm/dt/@thesage/ui?color=teal&style=flat-square)](https://www.npmjs.com/package/@thesage/ui)
8
8
 
9
- **The Design Engine for the Solopreneur.**
9
+ **Sage Make it Lovable.**
10
10
 
11
- [Documentation](https://thesage.dev) [Components](https://thesage.dev/components) [GitHub](https://github.com/shalomormsby/ecosystem)
11
+ Components that feel alive. Themes with real personality. Motion your users control. Designed for humans. Fluent with AI.
12
+
13
+ [Documentation](https://thesage.dev) | [Components](https://thesage.dev/components) | [GitHub](https://github.com/shalomormsby/ecosystem)
12
14
 
13
15
  </div>
14
16
 
15
17
  ---
16
18
 
17
- **Sage Design Engine** is not just a component library—it's a systematic design engine built for speed, consistency, and beauty. Built on top of **Radix UI** for headless accessibility and **Tailwind CSS** for styling, it provides a comprehensive suite of 45+ polished components that work together seamlessly.
19
+ **Sage Design Engine** is a component library and design system built on **Radix UI** primitives and **Tailwind CSS**. 48+ accessible components, three distinct themes with runtime switching, and a user-controlled motion system all wired through a 4-layer design token architecture.
20
+
21
+ ## Features
18
22
 
19
- ## Features
23
+ - **Accessible by default** — Built on WAI-ARIA standards via Radix UI. Keyboard navigable, screen reader compatible, WCAG AA contrast.
24
+ - **Three themes, real personality** — Studio (professional), Terra (organic), Volt (electric). Runtime switching via CSS variables, light and dark modes each.
25
+ - **User-controlled motion** — A 0–10 intensity scale that respects `prefers-reduced-motion`. Intensity 0 works perfectly — no degraded experience.
26
+ - **Modular imports** — Core stays lean. Heavy features (forms, dates, tables, drag-and-drop, WebGL) ship as optional subpath exports — install only what you use.
27
+ - **Type safe** — Written in TypeScript with full type inference. React 19 ref-as-prop pattern throughout.
28
+ - **Design token system** — Colors, typography, spacing, motion, and syntax tokens. Change one primary color, everything updates.
20
29
 
21
- - **🎨 Systematic Design**: Powered by a robust design token system (colors, typography, spacing).
22
- - **♿ Fully Accessible**: Built on WAI-ARIA standards via Radix UI primitives.
23
- - **🌗 Mode Aware**: First-class support for light and dark modes with automatic color harmonization.
24
- - **🧩 Composable**: Components designed to fit together like LEGO blocks.
25
- - **🛠️ Type Safe**: Written in TypeScript with full type inference.
30
+ ## Installation
26
31
 
27
- ## 🚀 Installation
32
+ ```bash
33
+ pnpm add @thesage/ui
34
+ ```
28
35
 
29
- ### 1. Install Dependencies
30
- Sage Design Engine is built on Tailwind CSS. You need to install the package and its peer dependencies.
36
+ Sage requires **Tailwind CSS** as a styling engine:
31
37
 
32
38
  ```bash
33
- pnpm add @thesage/ui @thesage/tokens @thesage/hooks lucide-react clsx tailwind-merge
34
39
  pnpm add -D tailwindcss@^3.4 postcss autoprefixer
35
40
  ```
36
41
 
37
- ### 2. Configure Tailwind
38
- Update your `tailwind.config.js` contents to use the preset and scan the component definitions.
42
+ ### Optional subpath exports
43
+
44
+ Install peer dependencies only for the features you need:
45
+
46
+ ```bash
47
+ # Forms (react-hook-form + zod validation)
48
+ pnpm add react-hook-form @hookform/resolvers zod
49
+
50
+ # Date picker
51
+ pnpm add react-day-picker date-fns
52
+
53
+ # Data tables
54
+ pnpm add @tanstack/react-table
55
+
56
+ # Drag and drop
57
+ pnpm add @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities
58
+ ```
59
+
60
+ ### Configure Tailwind
39
61
 
40
62
  ```js
41
63
  /** @type {import('tailwindcss').Config} */
@@ -45,69 +67,82 @@ module.exports = {
45
67
  "./src/**/*.{ts,tsx}",
46
68
  "./node_modules/@thesage/ui/dist/**/*.{js,ts,jsx,tsx}"
47
69
  ],
48
- theme: {
49
- extend: {},
50
- },
51
- plugins: [],
52
70
  }
53
71
  ```
54
72
 
55
- ### 3. Import Styles
56
- Import the global CSS file (which contains the theme variables) in your root entry file (e.g., `main.tsx` or `App.tsx`).
73
+ ### Import styles
57
74
 
58
75
  ```tsx
59
76
  import '@thesage/ui/globals.css';
60
77
  ```
61
78
 
62
- ## 💻 Usage
63
-
64
- Sage Design Engine components are designed to be dropped into any React application.
79
+ ## Usage
65
80
 
66
81
  ```tsx
67
- import { Button, Card, Text, Heading } from '@thesage/ui';
82
+ import { Button, Card, ThemeProvider } from '@thesage/ui';
68
83
 
69
- export default function WelcomeCard() {
84
+ export default function App() {
70
85
  return (
71
- <Card className="max-w-md p-6">
72
- <Heading level={3} className="mb-2">Welcome to Sage</Heading>
73
- <Text variant="muted" className="mb-4">
74
- Build faster with components that look premium out of the box.
75
- </Text>
76
- <div className="flex gap-2">
77
- <Button variant="primary">Get Started</Button>
78
- <Button variant="ghost">Documentation</Button>
79
- </div>
80
- </Card>
86
+ <ThemeProvider theme="studio" defaultMode="system">
87
+ <Card className="max-w-md p-6">
88
+ <h3 className="mb-2 text-lg font-semibold">Welcome to Sage</h3>
89
+ <p className="mb-4 text-muted-foreground">
90
+ Build beautifully with components that feel premium out of the box.
91
+ </p>
92
+ <div className="flex gap-2">
93
+ <Button>Get Started</Button>
94
+ <Button variant="ghost">Documentation</Button>
95
+ </div>
96
+ </Card>
97
+ </ThemeProvider>
81
98
  );
82
99
  }
83
100
  ```
84
101
 
85
- ## 🖌️ Theming
86
-
87
- Sage Design Engine uses a 4-layer token system. Changing a single primary color automatically updates buttons, focus rings, and chart colors across your entire application.
102
+ ### Subpath imports
88
103
 
89
104
  ```tsx
90
- // Example: Customizing the theme
91
- import { ThemeProvider } from '@thesage/ui';
92
-
93
- export default function App({ children }) {
94
- return (
95
- <ThemeProvider theme="sage" defaultMode="system">
96
- {children}
97
- </ThemeProvider>
98
- );
99
- }
105
+ import { useMotionPreference, useTheme } from '@thesage/ui/hooks'
106
+ import { ThemeProvider } from '@thesage/ui/providers'
107
+ import { cn } from '@thesage/ui/utils'
108
+
109
+ // Optional feature imports
110
+ import { Form, FormField } from '@thesage/ui/forms'
111
+ import { DatePicker } from '@thesage/ui/dates'
112
+ import { DataTable } from '@thesage/ui/tables'
113
+ import { SortableList } from '@thesage/ui/dnd'
100
114
  ```
101
115
 
102
- ## 📦 Component Categories
103
-
104
- - **Actions**: Button, Toggle, ToggleGroup
105
- - **Forms**: Input, Select, Checkbox, Switch, Slider, Form
106
- - **Navigation**: Tabs, Menubar, Breadcrumb, Pagination
107
- - **Overlays**: Dialog, Sheet, Popover, Tooltip, Toast
108
- - **Data Display**: Card, Avatar, Badge, Table, ScrollArea
109
- - **Feedback**: Alert, Progress, Skeleton, Sonner
110
-
111
- ## 📄 License
112
-
113
- MIT © [Shalom Ormsby](https://github.com/shalomormsby)
116
+ ## Component categories
117
+
118
+ | Category | Examples |
119
+ |----------|----------|
120
+ | **Actions** | Button, Toggle, ToggleGroup |
121
+ | **Forms** | Input, Select, Checkbox, Switch, Slider, SearchBar |
122
+ | **Navigation** | Tabs, Menubar, Breadcrumb, Pagination, NavigationMenu |
123
+ | **Overlays** | Dialog, Sheet, Popover, Tooltip, ContextMenu, HoverCard |
124
+ | **Data Display** | Card, Avatar, Badge, Table, ScrollArea, Carousel |
125
+ | **Feedback** | Alert, Progress, Skeleton, Toast (Sonner) |
126
+ | **Layout** | Accordion, Separator, ResizablePanels, Collapsible |
127
+ | **Features** | Customizer, ThemeSwitcher |
128
+
129
+ ## Bundle size
130
+
131
+ Core and optional entry points are independently tracked via [size-limit](https://github.com/ai/size-limit):
132
+
133
+ | Entry point | Brotli size |
134
+ |-------------|-------------|
135
+ | Core | ~146 KB |
136
+ | Hooks | ~40 KB |
137
+ | Providers | ~60 KB |
138
+ | Tokens | ~70 KB |
139
+ | Utils | ~25 KB |
140
+ | Forms | ~9.4 KB |
141
+ | Dates | ~29 KB |
142
+ | Tables | ~8.3 KB |
143
+ | DnD | ~8.3 KB |
144
+ | WebGL | ~1.1 KB |
145
+
146
+ ## License
147
+
148
+ MIT &copy; [Shalom Ormsby](https://github.com/shalomormsby)
@@ -0,0 +1,20 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { DayPicker } from 'react-day-picker';
4
+
5
+ type CalendarProps = React.ComponentProps<typeof DayPicker>;
6
+ declare function Calendar({ className, classNames, showOutsideDays, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
7
+ declare namespace Calendar {
8
+ var displayName: string;
9
+ }
10
+
11
+ interface DatePickerProps {
12
+ date?: Date;
13
+ onDateChange?: (date: Date | undefined) => void;
14
+ placeholder?: string;
15
+ className?: string;
16
+ disabled?: boolean;
17
+ }
18
+ declare function DatePicker({ date, onDateChange, placeholder, className, disabled, }: DatePickerProps): react_jsx_runtime.JSX.Element;
19
+
20
+ export { Calendar, type CalendarProps, DatePicker, type DatePickerProps };
@@ -0,0 +1,20 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { DayPicker } from 'react-day-picker';
4
+
5
+ type CalendarProps = React.ComponentProps<typeof DayPicker>;
6
+ declare function Calendar({ className, classNames, showOutsideDays, ...props }: CalendarProps): react_jsx_runtime.JSX.Element;
7
+ declare namespace Calendar {
8
+ var displayName: string;
9
+ }
10
+
11
+ interface DatePickerProps {
12
+ date?: Date;
13
+ onDateChange?: (date: Date | undefined) => void;
14
+ placeholder?: string;
15
+ className?: string;
16
+ disabled?: boolean;
17
+ }
18
+ declare function DatePicker({ date, onDateChange, placeholder, className, disabled, }: DatePickerProps): react_jsx_runtime.JSX.Element;
19
+
20
+ export { Calendar, type CalendarProps, DatePicker, type DatePickerProps };