@vllnt/ui 0.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/LICENSE +21 -0
- package/README.md +312 -0
- package/dist/chunk-XRV5RSYH.js +568 -0
- package/dist/flow-diagram-N3EHM6VB.js +1 -0
- package/dist/index.d.ts +1835 -0
- package/dist/index.js +8551 -0
- package/dist/tailwind-preset.d.ts +5 -0
- package/dist/tailwind-preset.js +87 -0
- package/package.json +143 -0
- package/styles.css +92 -0
- package/themes/default.css +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 vllnt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# @vllnt/ui
|
|
2
|
+
|
|
3
|
+
React component library — 93 components built on Radix UI primitives, Tailwind CSS, and CVA.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @vllnt/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Peer Dependencies
|
|
12
|
+
|
|
13
|
+
Required:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add react react-dom tailwindcss
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Optional (only if using ThemeProvider, NavbarSaas, or other Next.js-specific components):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add next next-themes
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Setup
|
|
26
|
+
|
|
27
|
+
### 1. Tailwind Preset
|
|
28
|
+
|
|
29
|
+
The library provides a Tailwind preset that includes all required theme colors, animations, and utilities.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
// tailwind.config.ts
|
|
33
|
+
import uiPreset from "@vllnt/ui/tailwind-preset";
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
presets: [uiPreset],
|
|
37
|
+
content: [
|
|
38
|
+
"./src/**/*.{ts,tsx}",
|
|
39
|
+
// The preset auto-includes @vllnt/ui content paths
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The preset configures:
|
|
45
|
+
- **Colors**: `primary`, `secondary`, `muted`, `accent`, `destructive`, `background`, `foreground`, `card`, `popover`, `border`, `input`, `ring` — all as `hsl(var(--name))` for theming
|
|
46
|
+
- **Border radius**: `lg`, `md`, `sm` via `--radius` CSS variable
|
|
47
|
+
- **Animations**: `accordion-down`, `accordion-up`, `shimmer`
|
|
48
|
+
- **Font**: `mono` family via `--font-mono` variable
|
|
49
|
+
- **Dark mode**: class-based (`darkMode: ["class"]`)
|
|
50
|
+
- **Plugin**: `tailwindcss-animate`
|
|
51
|
+
|
|
52
|
+
### 2. Import Styles
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// app/layout.tsx or your main entry
|
|
56
|
+
import "@vllnt/ui/styles.css";
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This imports Tailwind base/components/utilities + default theme variables + safe-area utilities.
|
|
60
|
+
|
|
61
|
+
### 3. Use Components
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Button, Card, Badge } from "@vllnt/ui";
|
|
65
|
+
|
|
66
|
+
export function Example() {
|
|
67
|
+
return (
|
|
68
|
+
<Card>
|
|
69
|
+
<Badge variant="secondary">New</Badge>
|
|
70
|
+
<Button variant="default">Click me</Button>
|
|
71
|
+
</Card>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Exports
|
|
77
|
+
|
|
78
|
+
| Import Path | What |
|
|
79
|
+
|-------------|------|
|
|
80
|
+
| `@vllnt/ui` | All components, types, and utilities |
|
|
81
|
+
| `@vllnt/ui/tailwind-preset` | Tailwind CSS preset config |
|
|
82
|
+
| `@vllnt/ui/styles.css` | Full styles (Tailwind base + theme variables + utilities) |
|
|
83
|
+
| `@vllnt/ui/themes/default.css` | Theme CSS variables only (no Tailwind base) |
|
|
84
|
+
|
|
85
|
+
## Theming
|
|
86
|
+
|
|
87
|
+
All colors use HSL CSS variables. Override them after importing styles:
|
|
88
|
+
|
|
89
|
+
```css
|
|
90
|
+
/* Light theme */
|
|
91
|
+
:root {
|
|
92
|
+
--background: 0 0% 100%;
|
|
93
|
+
--foreground: 0 0% 3.9%;
|
|
94
|
+
--primary: 222.2 47.4% 11.2%;
|
|
95
|
+
--primary-foreground: 210 40% 98%;
|
|
96
|
+
--secondary: 210 40% 96.1%;
|
|
97
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
98
|
+
--muted: 210 40% 96.1%;
|
|
99
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
|
100
|
+
--accent: 210 40% 96.1%;
|
|
101
|
+
--accent-foreground: 222.2 47.4% 11.2%;
|
|
102
|
+
--destructive: 0 84.2% 60.2%;
|
|
103
|
+
--destructive-foreground: 0 0% 98%;
|
|
104
|
+
--border: 214.3 31.8% 91.4%;
|
|
105
|
+
--input: 214.3 31.8% 91.4%;
|
|
106
|
+
--ring: 222.2 84% 4.9%;
|
|
107
|
+
--radius: 0.5rem;
|
|
108
|
+
--card: 0 0% 100%;
|
|
109
|
+
--card-foreground: 0 0% 3.9%;
|
|
110
|
+
--popover: 0 0% 100%;
|
|
111
|
+
--popover-foreground: 0 0% 3.9%;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Dark theme (applied via class="dark" on html/body) */
|
|
115
|
+
.dark {
|
|
116
|
+
--background: 0 0% 3.9%;
|
|
117
|
+
--foreground: 0 0% 98%;
|
|
118
|
+
/* ... override other variables */
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Use `@vllnt/ui/themes/default.css` instead of `@vllnt/ui/styles.css` if you only want the variables without Tailwind base layer styles.
|
|
123
|
+
|
|
124
|
+
## Component Patterns
|
|
125
|
+
|
|
126
|
+
All components follow these conventions:
|
|
127
|
+
|
|
128
|
+
- **`React.forwardRef`** — every component forwards refs
|
|
129
|
+
- **`React.ComponentPropsWithoutRef`** — extends native HTML element props
|
|
130
|
+
- **`cn()` utility** — merges Tailwind classes via `clsx` + `tailwind-merge`
|
|
131
|
+
- **CVA variants** — variant props defined with `class-variance-authority`
|
|
132
|
+
- **Radix primitives** — accessible behavior (focus, keyboard, ARIA) via Radix UI
|
|
133
|
+
- **Slot support** — `asChild` prop via `@radix-ui/react-slot` for render delegation
|
|
134
|
+
|
|
135
|
+
### Variant Pattern
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { Button } from "@vllnt/ui";
|
|
139
|
+
|
|
140
|
+
// Button variants: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link"
|
|
141
|
+
// Button sizes: "default" | "sm" | "lg" | "icon"
|
|
142
|
+
<Button variant="outline" size="sm">Small Outline</Button>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Composition Pattern
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import {
|
|
149
|
+
Dialog,
|
|
150
|
+
DialogTrigger,
|
|
151
|
+
DialogContent,
|
|
152
|
+
DialogHeader,
|
|
153
|
+
DialogTitle,
|
|
154
|
+
DialogDescription,
|
|
155
|
+
} from "@vllnt/ui";
|
|
156
|
+
|
|
157
|
+
<Dialog>
|
|
158
|
+
<DialogTrigger asChild>
|
|
159
|
+
<Button>Open</Button>
|
|
160
|
+
</DialogTrigger>
|
|
161
|
+
<DialogContent>
|
|
162
|
+
<DialogHeader>
|
|
163
|
+
<DialogTitle>Title</DialogTitle>
|
|
164
|
+
<DialogDescription>Description</DialogDescription>
|
|
165
|
+
</DialogHeader>
|
|
166
|
+
</DialogContent>
|
|
167
|
+
</Dialog>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Components
|
|
171
|
+
|
|
172
|
+
### Form Controls
|
|
173
|
+
|
|
174
|
+
| Component | Import | Notes |
|
|
175
|
+
|-----------|--------|-------|
|
|
176
|
+
| `Button` | `{ Button, buttonVariants }` | Variants: default, destructive, outline, secondary, ghost, link. Sizes: default, sm, lg, icon |
|
|
177
|
+
| `Input` | `{ Input }` | Standard text input |
|
|
178
|
+
| `Textarea` | `{ Textarea }` | Multi-line text input |
|
|
179
|
+
| `Checkbox` | `{ Checkbox }` | Radix checkbox |
|
|
180
|
+
| `RadioGroup` | `{ RadioGroup, RadioGroupItem }` | Radix radio group |
|
|
181
|
+
| `Select` | `{ Select, SelectTrigger, SelectValue, SelectContent, SelectItem, ... }` | Radix select |
|
|
182
|
+
| `Slider` | `{ Slider }` | Radix slider |
|
|
183
|
+
| `Switch` | `{ Switch }` | Radix switch |
|
|
184
|
+
| `Toggle` | `{ Toggle, toggleVariants }` | Radix toggle |
|
|
185
|
+
| `ToggleGroup` | `{ ToggleGroup, ToggleGroupItem }` | Radix toggle group |
|
|
186
|
+
| `InputOTP` | `{ InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }` | OTP input via `input-otp` |
|
|
187
|
+
| `Label` | `{ Label }` | Radix label |
|
|
188
|
+
| `Calendar` | `{ Calendar }` | Date picker via `react-day-picker` |
|
|
189
|
+
|
|
190
|
+
### Layout
|
|
191
|
+
|
|
192
|
+
| Component | Import | Notes |
|
|
193
|
+
|-----------|--------|-------|
|
|
194
|
+
| `Card` | `{ Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter }` | Content container |
|
|
195
|
+
| `AspectRatio` | `{ AspectRatio }` | Radix aspect ratio |
|
|
196
|
+
| `ScrollArea` | `{ ScrollArea, ScrollBar }` | Radix scroll area |
|
|
197
|
+
| `Separator` | `{ Separator }` | Radix separator |
|
|
198
|
+
| `ResizablePanel` | `{ ResizablePanel, ResizablePanelGroup, ResizableHandle }` | Via `react-resizable-panels` |
|
|
199
|
+
| `Collapsible` | `{ Collapsible, CollapsibleTrigger, CollapsibleContent }` | Radix collapsible |
|
|
200
|
+
| `Carousel` | `{ Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext }` | Via `embla-carousel-react` |
|
|
201
|
+
| `Tabs` | `{ Tabs, TabsList, TabsTrigger, TabsContent }` | Tabbed content |
|
|
202
|
+
| `Accordion` | `{ Accordion, AccordionItem, AccordionTrigger, AccordionContent }` | Collapsible sections |
|
|
203
|
+
|
|
204
|
+
### Feedback & Overlays
|
|
205
|
+
|
|
206
|
+
| Component | Import | Notes |
|
|
207
|
+
|-----------|--------|-------|
|
|
208
|
+
| `Dialog` | `{ Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose }` | Radix modal dialog |
|
|
209
|
+
| `AlertDialog` | `{ AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel }` | Confirmation dialog |
|
|
210
|
+
| `Sheet` | `{ Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription, SheetFooter, SheetClose }` | Slide-out panel |
|
|
211
|
+
| `Drawer` | `{ Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, DrawerFooter, DrawerClose }` | Bottom drawer via `vaul` |
|
|
212
|
+
| `Popover` | `{ Popover, PopoverTrigger, PopoverContent }` | Radix popover |
|
|
213
|
+
| `Tooltip` | `{ Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }` | Radix tooltip (wrap app in `TooltipProvider`) |
|
|
214
|
+
| `HoverCard` | `{ HoverCard, HoverCardTrigger, HoverCardContent }` | Radix hover card |
|
|
215
|
+
| `Toast` | `{ toast, Toaster }` | Toast notifications via `sonner`. Add `<Toaster />` to layout, trigger with `toast()` |
|
|
216
|
+
| `Alert` | `{ Alert, AlertTitle, AlertDescription, alertVariants }` | Static alert banner |
|
|
217
|
+
| `Badge` | `{ Badge, badgeVariants }` | Inline status label. Variants: default, secondary, destructive, outline |
|
|
218
|
+
| `Skeleton` | `{ Skeleton }` | Loading placeholder |
|
|
219
|
+
| `Spinner` | `{ Spinner }` | Loading spinner |
|
|
220
|
+
|
|
221
|
+
### Navigation
|
|
222
|
+
|
|
223
|
+
| Component | Import | Notes |
|
|
224
|
+
|-----------|--------|-------|
|
|
225
|
+
| `Command` | `{ Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator }` | Command palette via `cmdk` |
|
|
226
|
+
| `DropdownMenu` | `{ DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, ... }` | Radix dropdown |
|
|
227
|
+
| `ContextMenu` | `{ ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ... }` | Radix right-click menu |
|
|
228
|
+
| `Menubar` | `{ Menubar, MenubarMenu, MenubarTrigger, MenubarContent, MenubarItem, ... }` | Radix menu bar |
|
|
229
|
+
| `NavigationMenu` | `{ NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink }` | Radix nav menu |
|
|
230
|
+
| `Breadcrumb` | `{ Breadcrumb }` | Breadcrumb navigation |
|
|
231
|
+
| `Pagination` | `{ Pagination }` | Page navigation |
|
|
232
|
+
|
|
233
|
+
### Data Display
|
|
234
|
+
|
|
235
|
+
| Component | Import | Notes |
|
|
236
|
+
|-----------|--------|-------|
|
|
237
|
+
| `Table` | `{ Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption, TableFooter }` | Data table (use with `@tanstack/react-table` for sorting/filtering) |
|
|
238
|
+
| `Avatar` | `{ Avatar, AvatarImage, AvatarFallback }` | Radix avatar |
|
|
239
|
+
| `AreaChart` | `{ AreaChart }` | Chart component |
|
|
240
|
+
| `BarChart` | `{ BarChart }` | Chart component |
|
|
241
|
+
| `LineChart` | `{ LineChart }` | Chart component |
|
|
242
|
+
| `CodeBlock` | `{ CodeBlock }` | Syntax-highlighted code via `react-syntax-highlighter` |
|
|
243
|
+
| `FlowDiagram` | `{ FlowDiagram }` | Flow diagram via `@xyflow/react` |
|
|
244
|
+
| `TableOfContents` | `{ TableOfContents }` | Page table of contents |
|
|
245
|
+
|
|
246
|
+
### App Components
|
|
247
|
+
|
|
248
|
+
| Component | Import | Notes |
|
|
249
|
+
|-----------|--------|-------|
|
|
250
|
+
| `ThemeProvider` | `{ ThemeProvider }` | Requires `next-themes`. Wrap app root |
|
|
251
|
+
| `ThemeToggle` | `{ ThemeToggle }` | Light/dark mode toggle. Requires `ThemeProvider` |
|
|
252
|
+
| `LangProvider` | `{ LangProvider }` | Language context provider |
|
|
253
|
+
| `NavbarSaas` | `{ NavbarSaas }` | Full-featured SaaS navbar. Requires `next` |
|
|
254
|
+
| `Sidebar` | `{ Sidebar }` | Collapsible sidebar |
|
|
255
|
+
| `SidebarProvider` | `{ SidebarProvider, useSidebar }` | Sidebar state management |
|
|
256
|
+
| `SidebarToggle` | `{ SidebarToggle }` | Sidebar expand/collapse button |
|
|
257
|
+
| `SearchBar` | `{ SearchBar }` | Search input with filtering |
|
|
258
|
+
| `SearchDialog` | `{ SearchDialog }` | Full-screen search dialog |
|
|
259
|
+
|
|
260
|
+
### Content & Tutorial
|
|
261
|
+
|
|
262
|
+
| Component | Import | Notes |
|
|
263
|
+
|-----------|--------|-------|
|
|
264
|
+
| `MDXContent` | `{ MDXContent }` | MDX renderer |
|
|
265
|
+
| `TutorialMDX` | `{ TutorialMDX, mdxComponents }` | Tutorial MDX with custom components |
|
|
266
|
+
| `Callout` | `{ Callout }` | Info/warning/error callout box |
|
|
267
|
+
| `ProTip` | `{ ProTip, CommonMistake }` | Tip and mistake callouts |
|
|
268
|
+
| `Quiz` | `{ Quiz }` | Interactive quiz |
|
|
269
|
+
| `Exercise` | `{ Exercise }` | Interactive exercise |
|
|
270
|
+
| `StepByStep` | `{ StepByStep, Step }` | Numbered step guide |
|
|
271
|
+
| `CodePlayground` | `{ CodePlayground, FileTree }` | Code editor with file tree |
|
|
272
|
+
| `Terminal` | `{ Terminal, SimpleTerminal }` | Terminal emulator UI |
|
|
273
|
+
| `VideoEmbed` | `{ VideoEmbed }` | Responsive video embed |
|
|
274
|
+
|
|
275
|
+
## Utilities
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
import { cn } from "@vllnt/ui";
|
|
279
|
+
|
|
280
|
+
// Merge Tailwind classes (clsx + tailwind-merge)
|
|
281
|
+
<div className={cn("p-4 bg-primary", isActive && "bg-accent", className)} />
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
import { useDebounce } from "@vllnt/ui";
|
|
286
|
+
|
|
287
|
+
const debouncedValue = useDebounce(searchTerm, 300);
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Types
|
|
291
|
+
|
|
292
|
+
```tsx
|
|
293
|
+
import type {
|
|
294
|
+
Content,
|
|
295
|
+
ContentMeta,
|
|
296
|
+
ContentProgress,
|
|
297
|
+
ContentSection,
|
|
298
|
+
DifficultyLevel,
|
|
299
|
+
UISupportedLanguage,
|
|
300
|
+
} from "@vllnt/ui";
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Requirements
|
|
304
|
+
|
|
305
|
+
- React >= 18.0.0
|
|
306
|
+
- Tailwind CSS >= 3.0.0
|
|
307
|
+
- Next.js >= 14.0.0 (optional — only for `ThemeProvider`, `NavbarSaas`, `LangProvider`)
|
|
308
|
+
- `next-themes` >= 0.4.0 (optional — only for `ThemeProvider`, `ThemeToggle`)
|
|
309
|
+
|
|
310
|
+
## License
|
|
311
|
+
|
|
312
|
+
MIT
|