create-lego-one 2.0.12 → 2.0.13
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/dist/index.cjs +34 -0
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
- package/template/.cursor/rules/rules.mdc +639 -0
- package/template/.dockerignore +58 -0
- package/template/.env.example +18 -0
- package/template/.eslintignore +5 -0
- package/template/.eslintrc.js +28 -0
- package/template/.prettierignore +6 -0
- package/template/.prettierrc +11 -0
- package/template/CLAUDE.md +634 -0
- package/template/Dockerfile +67 -0
- package/template/PROMPT.md +457 -0
- package/template/README.md +325 -0
- package/template/docker-compose.yml +48 -0
- package/template/docker-entrypoint.sh +23 -0
- package/template/docs/checkpoints/.template.md +64 -0
- package/template/docs/checkpoints/framework/01-infrastructure-setup.md +132 -0
- package/template/docs/checkpoints/framework/02-pocketbase-setup.md +155 -0
- package/template/docs/checkpoints/framework/03-host-kernel.md +170 -0
- package/template/docs/checkpoints/framework/04-auth-system.md +163 -0
- package/template/docs/checkpoints/framework/phase-05-multitenancy-rbac.md +223 -0
- package/template/docs/checkpoints/framework/phase-06-ui-components.md +260 -0
- package/template/docs/checkpoints/framework/phase-07-communication-system.md +276 -0
- package/template/docs/checkpoints/framework/phase-08-plugin-system.md +91 -0
- package/template/docs/checkpoints/framework/phase-09-dashboard-plugin.md +111 -0
- package/template/docs/checkpoints/framework/phase-10-todo-plugin.md +169 -0
- package/template/docs/checkpoints/framework/phase-11-testing.md +264 -0
- package/template/docs/checkpoints/framework/phase-12-deployment.md +294 -0
- package/template/docs/checkpoints/framework/phase-13-documentation.md +312 -0
- package/template/docs/framework/plans/00-index.md +164 -0
- package/template/docs/framework/plans/01-infrastructure-setup.md +855 -0
- package/template/docs/framework/plans/02-pocketbase-setup.md +1374 -0
- package/template/docs/framework/plans/03-host-kernel.md +1518 -0
- package/template/docs/framework/plans/04-auth-system.md +1466 -0
- package/template/docs/framework/plans/05-multitenancy-rbac.md +1527 -0
- package/template/docs/framework/plans/06-ui-components.md +1478 -0
- package/template/docs/framework/plans/07-communication-system.md +1106 -0
- package/template/docs/framework/plans/08-plugin-system.md +1179 -0
- package/template/docs/framework/plans/09-dashboard-plugin.md +1137 -0
- package/template/docs/framework/plans/10-todo-plugin.md +1343 -0
- package/template/docs/framework/plans/11-testing.md +935 -0
- package/template/docs/framework/plans/12-deployment.md +896 -0
- package/template/docs/framework/prompts/0-boilerplate-modernjs.md +151 -0
- package/template/docs/framework/research/00-modernjs-audit.md +488 -0
- package/template/docs/framework/research/01-system-blueprint.md +721 -0
- package/template/docs/framework/research/02-data-migration-protocol.md +699 -0
- package/template/docs/framework/research/03-host-setup.md +714 -0
- package/template/docs/framework/research/04-plugin-architecture.md +645 -0
- package/template/docs/framework/research/05-slot-injection-pattern.md +671 -0
- package/template/docs/framework/research/06-cli-strategy.md +615 -0
- package/template/docs/framework/research/07-deployment.md +629 -0
- package/template/docs/framework/research/README.md +282 -0
- package/template/docs/framework/setup/00-index.md +210 -0
- package/template/docs/framework/setup/01-framework-structure.md +308 -0
- package/template/docs/framework/setup/02-development-workflow.md +405 -0
- package/template/docs/framework/setup/03-environment-setup.md +215 -0
- package/template/docs/framework/setup/04-kernel-architecture.md +499 -0
- package/template/docs/framework/setup/05-plugin-system.md +620 -0
- package/template/docs/framework/setup/06-communication-patterns.md +451 -0
- package/template/docs/framework/setup/07-plugin-development.md +582 -0
- package/template/docs/framework/setup/08-component-library.md +658 -0
- package/template/docs/framework/setup/09-data-integration.md +609 -0
- package/template/docs/framework/setup/10-auth-rbac.md +497 -0
- package/template/docs/framework/setup/11-hooks-api.md +393 -0
- package/template/docs/framework/setup/12-components-api.md +665 -0
- package/template/docs/framework/setup/13-deployment-guide.md +566 -0
- package/template/docs/framework/setup/README.md +548 -0
- package/template/host/package.json +1 -1
- package/template/nginx.conf +72 -0
- package/template/package.json +1 -1
- package/template/packages/plugins/@lego/plugin-dashboard/package.json +1 -1
- package/template/packages/plugins/@lego/plugin-todo/package.json +1 -1
- package/template/pocketbase/CHANGELOG.md +911 -0
- package/template/pocketbase/LICENSE.md +17 -0
- package/template/scripts/create-plugin.js +221 -0
- package/template/scripts/deploy.sh +56 -0
- package/template/tsconfig.base.json +26 -0
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
# Components API Reference
|
|
2
|
+
|
|
3
|
+
**UI Component Library**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Lego-One provides a set of reusable UI components built with Radix UI primitives and styled with Tailwind CSS. All components support dark mode and follow accessibility best practices.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Components are available via `@lego/kernel/components`:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { Button, Input, Card } from '@lego/kernel/components';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Form Components
|
|
24
|
+
|
|
25
|
+
### Button
|
|
26
|
+
|
|
27
|
+
A versatile button component with multiple variants and sizes.
|
|
28
|
+
|
|
29
|
+
**Import:**
|
|
30
|
+
```typescript
|
|
31
|
+
import { Button } from '@lego/kernel/components';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Props:**
|
|
35
|
+
```typescript
|
|
36
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
37
|
+
variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link';
|
|
38
|
+
size?: 'default' | 'sm' | 'lg' | 'icon';
|
|
39
|
+
asChild?: boolean;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Variants:**
|
|
44
|
+
- `default` - Primary action button (blue)
|
|
45
|
+
- `destructive` - Dangerous actions (red)
|
|
46
|
+
- `outline` - Secondary action with border
|
|
47
|
+
- `secondary` - Alternative secondary action
|
|
48
|
+
- `ghost` - Minimal styling, hover background
|
|
49
|
+
- `link` - Text link style
|
|
50
|
+
|
|
51
|
+
**Sizes:**
|
|
52
|
+
- `default` - 40px height (h-10)
|
|
53
|
+
- `sm` - 36px height (h-9)
|
|
54
|
+
- `lg` - 44px height (h-11)
|
|
55
|
+
- `icon` - Square button (40px x 40px)
|
|
56
|
+
|
|
57
|
+
**Examples:**
|
|
58
|
+
```tsx
|
|
59
|
+
<Button>Click me</Button>
|
|
60
|
+
<Button variant="destructive">Delete</Button>
|
|
61
|
+
<Button variant="outline" size="sm">Cancel</Button>
|
|
62
|
+
<Button size="icon"><Icon /></Button>
|
|
63
|
+
<Button disabled>Disabled</Button>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Input
|
|
69
|
+
|
|
70
|
+
A text input field with consistent styling.
|
|
71
|
+
|
|
72
|
+
**Import:**
|
|
73
|
+
```typescript
|
|
74
|
+
import { Input } from '@lego/kernel/components';
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Props:**
|
|
78
|
+
```typescript
|
|
79
|
+
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Examples:**
|
|
83
|
+
```tsx
|
|
84
|
+
<Input placeholder="Enter email..." />
|
|
85
|
+
<Input type="password" placeholder="Password" />
|
|
86
|
+
<Input disabled value="Disabled" />
|
|
87
|
+
<Input className="w-full" />
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### Label
|
|
93
|
+
|
|
94
|
+
Form label with proper accessibility.
|
|
95
|
+
|
|
96
|
+
**Import:**
|
|
97
|
+
```typescript
|
|
98
|
+
import { Label } from '@lego/kernel/components';
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Props:**
|
|
102
|
+
```typescript
|
|
103
|
+
interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Examples:**
|
|
107
|
+
```tsx
|
|
108
|
+
<Label htmlFor="email">Email</Label>
|
|
109
|
+
<Input id="email" type="email" />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### Select
|
|
115
|
+
|
|
116
|
+
Dropdown select component using Radix UI.
|
|
117
|
+
|
|
118
|
+
**Import:**
|
|
119
|
+
```typescript
|
|
120
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@lego/kernel/components';
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Examples:**
|
|
124
|
+
```tsx
|
|
125
|
+
<Select>
|
|
126
|
+
<SelectTrigger>
|
|
127
|
+
<SelectValue placeholder="Select option" />
|
|
128
|
+
</SelectTrigger>
|
|
129
|
+
<SelectContent>
|
|
130
|
+
<SelectItem value="1">Option 1</SelectItem>
|
|
131
|
+
<SelectItem value="2">Option 2</SelectItem>
|
|
132
|
+
<SelectItem value="3">Option 3</SelectItem>
|
|
133
|
+
</SelectContent>
|
|
134
|
+
</Select>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### Switch
|
|
140
|
+
|
|
141
|
+
Toggle switch component.
|
|
142
|
+
|
|
143
|
+
**Import:**
|
|
144
|
+
```typescript
|
|
145
|
+
import { Switch } from '@lego/kernel/components';
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Props:**
|
|
149
|
+
```typescript
|
|
150
|
+
interface SwitchProps extends React.ComponentProps<typeof SwitchPrimitive.Root> {}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Examples:**
|
|
154
|
+
```tsx
|
|
155
|
+
<Switch checked={enabled} onCheckedChange={setEnabled} />
|
|
156
|
+
<Switch disabled />
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Layout Components
|
|
162
|
+
|
|
163
|
+
### Card
|
|
164
|
+
|
|
165
|
+
Container component with header, content, and footer sections.
|
|
166
|
+
|
|
167
|
+
**Import:**
|
|
168
|
+
```typescript
|
|
169
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@lego/kernel/components';
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Examples:**
|
|
173
|
+
```tsx
|
|
174
|
+
<Card>
|
|
175
|
+
<CardHeader>
|
|
176
|
+
<CardTitle>Card Title</CardTitle>
|
|
177
|
+
<CardDescription>Card description goes here</CardDescription>
|
|
178
|
+
</CardHeader>
|
|
179
|
+
<CardContent>
|
|
180
|
+
<p>Card content</p>
|
|
181
|
+
</CardContent>
|
|
182
|
+
<CardFooter>
|
|
183
|
+
<Button>Action</Button>
|
|
184
|
+
</CardFooter>
|
|
185
|
+
</Card>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### Separator
|
|
191
|
+
|
|
192
|
+
Visual separator/divider line.
|
|
193
|
+
|
|
194
|
+
**Import:**
|
|
195
|
+
```typescript
|
|
196
|
+
import { Separator } from '@lego/kernel/components';
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Props:**
|
|
200
|
+
```typescript
|
|
201
|
+
interface SeparatorProps extends React.ComponentProps<typeof SeparatorPrimitive.Root> {}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Orientation:**
|
|
205
|
+
- `horizontal` (default)
|
|
206
|
+
- `vertical`
|
|
207
|
+
|
|
208
|
+
**Examples:**
|
|
209
|
+
```tsx
|
|
210
|
+
<Separator />
|
|
211
|
+
<Separator orientation="vertical" className="h-8" />
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### ScrollArea
|
|
217
|
+
|
|
218
|
+
Custom scrollable container with styled scrollbars.
|
|
219
|
+
|
|
220
|
+
**Import:**
|
|
221
|
+
```typescript
|
|
222
|
+
import { ScrollArea } from '@lego/kernel/components';
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Examples:**
|
|
226
|
+
```tsx
|
|
227
|
+
<ScrollArea className="h-96">
|
|
228
|
+
<div className="p-4">
|
|
229
|
+
{/* Long content */}
|
|
230
|
+
</div>
|
|
231
|
+
</ScrollArea>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Feedback Components
|
|
237
|
+
|
|
238
|
+
### Alert
|
|
239
|
+
|
|
240
|
+
Notification alert with different severity levels.
|
|
241
|
+
|
|
242
|
+
**Import:**
|
|
243
|
+
```typescript
|
|
244
|
+
import { Alert, AlertDescription, AlertTitle } from '@lego/kernel/components';
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Variants:**
|
|
248
|
+
- `default` - Neutral info
|
|
249
|
+
- `destructive` - Error/warning
|
|
250
|
+
|
|
251
|
+
**Examples:**
|
|
252
|
+
```tsx
|
|
253
|
+
<Alert>
|
|
254
|
+
<AlertCircle className="h-4 w-4" />
|
|
255
|
+
<AlertTitle>Info</AlertTitle>
|
|
256
|
+
<AlertDescription>This is an informational message.</AlertDescription>
|
|
257
|
+
</Alert>
|
|
258
|
+
|
|
259
|
+
<Alert variant="destructive">
|
|
260
|
+
<AlertTitle>Error</AlertTitle>
|
|
261
|
+
<AlertDescription>Something went wrong.</AlertDescription>
|
|
262
|
+
</Alert>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
### Badge
|
|
268
|
+
|
|
269
|
+
Small status or label indicator.
|
|
270
|
+
|
|
271
|
+
**Import:**
|
|
272
|
+
```typescript
|
|
273
|
+
import { Badge } from '@lego/kernel/components';
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Props:**
|
|
277
|
+
```typescript
|
|
278
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
279
|
+
variant?: 'default' | 'secondary' | 'destructive' | 'outline';
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Examples:**
|
|
284
|
+
```tsx
|
|
285
|
+
<Badge>Default</Badge>
|
|
286
|
+
<Badge variant="secondary">Secondary</Badge>
|
|
287
|
+
<Badge variant="destructive">Error</Badge>
|
|
288
|
+
<Badge variant="outline">Outline</Badge>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
### Progress
|
|
294
|
+
|
|
295
|
+
Progress bar indicator.
|
|
296
|
+
|
|
297
|
+
**Import:**
|
|
298
|
+
```typescript
|
|
299
|
+
import { Progress } from '@lego/kernel/components';
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Examples:**
|
|
303
|
+
```tsx
|
|
304
|
+
<Progress value={33} />
|
|
305
|
+
<Progress value={66} className="w-96" />
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
### Skeleton
|
|
311
|
+
|
|
312
|
+
Loading placeholder content.
|
|
313
|
+
|
|
314
|
+
**Import:**
|
|
315
|
+
```typescript
|
|
316
|
+
import { Skeleton } from '@lego/kernel/components';
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**Examples:**
|
|
320
|
+
```tsx
|
|
321
|
+
<Skeleton className="h-12 w-12 rounded-full" />
|
|
322
|
+
<Skeleton className="h-4 w-64" />
|
|
323
|
+
<Skeleton className="h-96 w-full" />
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
### Toast
|
|
329
|
+
|
|
330
|
+
Notification toast messages.
|
|
331
|
+
|
|
332
|
+
**Import:**
|
|
333
|
+
```typescript
|
|
334
|
+
import { useToast } from '@lego/kernel/components';
|
|
335
|
+
import { ToastProvider, Toast, ToastTitle, ToastDescription } from '@lego/kernel/components';
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
**Usage:**
|
|
339
|
+
```tsx
|
|
340
|
+
function App() {
|
|
341
|
+
return (
|
|
342
|
+
<ToastProvider>
|
|
343
|
+
{/* Your app */}
|
|
344
|
+
<Toaster />
|
|
345
|
+
</ToastProvider>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function MyComponent() {
|
|
350
|
+
const { toast } = useToast();
|
|
351
|
+
|
|
352
|
+
return (
|
|
353
|
+
<Button onClick={() => {
|
|
354
|
+
toast({
|
|
355
|
+
title: 'Success',
|
|
356
|
+
description: 'Operation completed successfully',
|
|
357
|
+
});
|
|
358
|
+
}}>
|
|
359
|
+
Show Toast
|
|
360
|
+
</Button>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## Navigation Components
|
|
368
|
+
|
|
369
|
+
### Tabs
|
|
370
|
+
|
|
371
|
+
Tabbed content interface.
|
|
372
|
+
|
|
373
|
+
**Import:**
|
|
374
|
+
```typescript
|
|
375
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@lego/kernel/components';
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**Examples:**
|
|
379
|
+
```tsx
|
|
380
|
+
<Tabs defaultValue="tab1">
|
|
381
|
+
<TabsList>
|
|
382
|
+
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
|
383
|
+
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
|
|
384
|
+
<TabsTrigger value="tab3">Tab 3</TabsTrigger>
|
|
385
|
+
</TabsList>
|
|
386
|
+
<TabsContent value="tab1">
|
|
387
|
+
Content 1
|
|
388
|
+
</TabsContent>
|
|
389
|
+
<TabsContent value="tab2">
|
|
390
|
+
Content 2
|
|
391
|
+
</TabsContent>
|
|
392
|
+
<TabsContent value="tab3">
|
|
393
|
+
Content 3
|
|
394
|
+
</TabsContent>
|
|
395
|
+
</Tabs>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
### Dropdown Menu
|
|
401
|
+
|
|
402
|
+
Context menu or dropdown menu.
|
|
403
|
+
|
|
404
|
+
**Import:**
|
|
405
|
+
```typescript
|
|
406
|
+
import {
|
|
407
|
+
DropdownMenu,
|
|
408
|
+
DropdownMenuTrigger,
|
|
409
|
+
DropdownMenuContent,
|
|
410
|
+
DropdownMenuItem,
|
|
411
|
+
DropdownMenuLabel,
|
|
412
|
+
DropdownMenuSeparator,
|
|
413
|
+
} from '@lego/kernel/components';
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Examples:**
|
|
417
|
+
```tsx
|
|
418
|
+
<DropdownMenu>
|
|
419
|
+
<DropdownMenuTrigger asChild>
|
|
420
|
+
<Button variant="ghost">Menu</Button>
|
|
421
|
+
</DropdownMenuTrigger>
|
|
422
|
+
<DropdownMenuContent>
|
|
423
|
+
<DropdownMenuLabel>My Account</DropdownMenuLabel>
|
|
424
|
+
<DropdownMenuSeparator />
|
|
425
|
+
<DropdownMenuItem>Profile</DropdownMenuItem>
|
|
426
|
+
<DropdownMenuItem>Settings</DropdownMenuItem>
|
|
427
|
+
<DropdownMenuSeparator />
|
|
428
|
+
<DropdownMenuItem>Logout</DropdownMenuItem>
|
|
429
|
+
</DropdownMenuContent>
|
|
430
|
+
</DropdownMenu>
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Display Components
|
|
436
|
+
|
|
437
|
+
### Avatar
|
|
438
|
+
|
|
439
|
+
User avatar with image and fallback.
|
|
440
|
+
|
|
441
|
+
**Import:**
|
|
442
|
+
```typescript
|
|
443
|
+
import { Avatar, AvatarImage, AvatarFallback } from '@lego/kernel/components';
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Examples:**
|
|
447
|
+
```tsx
|
|
448
|
+
<Avatar>
|
|
449
|
+
<AvatarImage src="/avatar.jpg" alt="User" />
|
|
450
|
+
<AvatarFallback>JD</AvatarFallback>
|
|
451
|
+
</Avatar>
|
|
452
|
+
|
|
453
|
+
<Avatar>
|
|
454
|
+
<AvatarFallback className="bg-primary text-primary-foreground">
|
|
455
|
+
<User className="h-4 w-4" />
|
|
456
|
+
</AvatarFallback>
|
|
457
|
+
</Avatar>
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
### Table
|
|
463
|
+
|
|
464
|
+
Data table with consistent styling.
|
|
465
|
+
|
|
466
|
+
**Import:**
|
|
467
|
+
```typescript
|
|
468
|
+
import {
|
|
469
|
+
Table,
|
|
470
|
+
TableHeader,
|
|
471
|
+
TableBody,
|
|
472
|
+
TableFooter,
|
|
473
|
+
TableHead,
|
|
474
|
+
TableRow,
|
|
475
|
+
TableCell,
|
|
476
|
+
} from '@lego/kernel/components';
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**Examples:**
|
|
480
|
+
```tsx
|
|
481
|
+
<Table>
|
|
482
|
+
<TableHeader>
|
|
483
|
+
<TableRow>
|
|
484
|
+
<TableHead>Name</TableHead>
|
|
485
|
+
<TableHead>Email</TableHead>
|
|
486
|
+
<TableHead>Status</TableHead>
|
|
487
|
+
</TableRow>
|
|
488
|
+
</TableHeader>
|
|
489
|
+
<TableBody>
|
|
490
|
+
<TableRow>
|
|
491
|
+
<TableCell>John Doe</TableCell>
|
|
492
|
+
<TableCell>john@example.com</TableCell>
|
|
493
|
+
<TableCell>Active</TableCell>
|
|
494
|
+
</TableRow>
|
|
495
|
+
</TableBody>
|
|
496
|
+
</Table>
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## Overlay Components
|
|
502
|
+
|
|
503
|
+
### Dialog
|
|
504
|
+
|
|
505
|
+
Modal dialog component.
|
|
506
|
+
|
|
507
|
+
**Import:**
|
|
508
|
+
```typescript
|
|
509
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '@lego/kernel/components';
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
**Examples:**
|
|
513
|
+
```tsx
|
|
514
|
+
<Dialog>
|
|
515
|
+
<DialogTrigger asChild>
|
|
516
|
+
<Button>Open Dialog</Button>
|
|
517
|
+
</DialogTrigger>
|
|
518
|
+
<DialogContent>
|
|
519
|
+
<DialogHeader>
|
|
520
|
+
<DialogTitle>Are you sure?</DialogTitle>
|
|
521
|
+
<DialogDescription>
|
|
522
|
+
This action cannot be undone.
|
|
523
|
+
</DialogDescription>
|
|
524
|
+
</DialogHeader>
|
|
525
|
+
<DialogFooter>
|
|
526
|
+
<Button variant="outline">Cancel</Button>
|
|
527
|
+
<Button>Confirm</Button>
|
|
528
|
+
</DialogFooter>
|
|
529
|
+
</DialogContent>
|
|
530
|
+
</Dialog>
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
### Popover
|
|
536
|
+
|
|
537
|
+
Floating popover content.
|
|
538
|
+
|
|
539
|
+
**Import:**
|
|
540
|
+
```typescript
|
|
541
|
+
import { Popover, PopoverContent, PopoverTrigger } from '@lego/kernel/components';
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
**Examples:**
|
|
545
|
+
```tsx
|
|
546
|
+
<Popover>
|
|
547
|
+
<PopoverTrigger asChild>
|
|
548
|
+
<Button variant="ghost">Trigger</Button>
|
|
549
|
+
</PopoverTrigger>
|
|
550
|
+
<PopoverContent>
|
|
551
|
+
<div className="grid gap-4">
|
|
552
|
+
<h4 className="font-medium">Popover Content</h4>
|
|
553
|
+
<p className="text-sm text-muted-foreground">
|
|
554
|
+
Additional information here.
|
|
555
|
+
</p>
|
|
556
|
+
</div>
|
|
557
|
+
</PopoverContent>
|
|
558
|
+
</Popover>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
### Tooltip
|
|
564
|
+
|
|
565
|
+
Hover tooltip for additional context.
|
|
566
|
+
|
|
567
|
+
**Import:**
|
|
568
|
+
```typescript
|
|
569
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@lego/kernel/components';
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
**Usage:**
|
|
573
|
+
```tsx
|
|
574
|
+
// Wrap your app in TooltipProvider once
|
|
575
|
+
function App() {
|
|
576
|
+
return (
|
|
577
|
+
<TooltipProvider>
|
|
578
|
+
{/* Your app */}
|
|
579
|
+
</TooltipProvider>
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// Use tooltips
|
|
584
|
+
<Tooltip>
|
|
585
|
+
<TooltipTrigger>Hover me</TooltipTrigger>
|
|
586
|
+
<TooltipContent>
|
|
587
|
+
<p>Additional information</p>
|
|
588
|
+
</TooltipContent>
|
|
589
|
+
</Tooltip>
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
---
|
|
593
|
+
|
|
594
|
+
## Utility Components
|
|
595
|
+
|
|
596
|
+
### useToast Hook
|
|
597
|
+
|
|
598
|
+
Programmatically show toast notifications.
|
|
599
|
+
|
|
600
|
+
```typescript
|
|
601
|
+
const { toast } = useToast();
|
|
602
|
+
|
|
603
|
+
toast({
|
|
604
|
+
title: 'Success',
|
|
605
|
+
description: 'File uploaded successfully',
|
|
606
|
+
variant: 'default', // or 'destructive'
|
|
607
|
+
});
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
---
|
|
611
|
+
|
|
612
|
+
## Theming
|
|
613
|
+
|
|
614
|
+
All components support CSS variables for theming:
|
|
615
|
+
|
|
616
|
+
```css
|
|
617
|
+
:root {
|
|
618
|
+
--background: 0 0% 100%;
|
|
619
|
+
--foreground: 222.2 84% 4.9%;
|
|
620
|
+
--primary: 221.2 83.2% 53.3%;
|
|
621
|
+
--primary-foreground: 210 40% 98%;
|
|
622
|
+
--secondary: 210 40% 96.1%;
|
|
623
|
+
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
624
|
+
--muted: 210 40% 96.1%;
|
|
625
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
|
626
|
+
--accent: 210 40% 96.1%;
|
|
627
|
+
--accent-foreground: 222.2 47.4% 11.2%;
|
|
628
|
+
--destructive: 0 84.2% 60.2%;
|
|
629
|
+
--destructive-foreground: 210 40% 98%;
|
|
630
|
+
--border: 214.3 31.8% 91.4%;
|
|
631
|
+
--input: 214.3 31.8% 91.4%;
|
|
632
|
+
--ring: 221.2 83.2% 53.3%;
|
|
633
|
+
--radius: 0.5rem;
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
Dark mode support is built-in via the `dark:` class prefix.
|
|
638
|
+
|
|
639
|
+
---
|
|
640
|
+
|
|
641
|
+
## Accessibility
|
|
642
|
+
|
|
643
|
+
All components follow WCAG 2.1 AA guidelines:
|
|
644
|
+
|
|
645
|
+
- Keyboard navigation support
|
|
646
|
+
- ARIA attributes included
|
|
647
|
+
- Focus management
|
|
648
|
+
- Screen reader support
|
|
649
|
+
- High contrast mode support
|
|
650
|
+
|
|
651
|
+
---
|
|
652
|
+
|
|
653
|
+
## Best Practices
|
|
654
|
+
|
|
655
|
+
1. **Always provide labels** for form inputs
|
|
656
|
+
2. **Use semantic HTML** when building custom components
|
|
657
|
+
3. **Test keyboard navigation** in your application
|
|
658
|
+
4. **Provide sufficient color contrast** for text
|
|
659
|
+
5. **Include loading states** for async actions
|
|
660
|
+
6. **Handle errors gracefully** with user feedback
|
|
661
|
+
7. **Use consistent spacing** via spacing scale
|
|
662
|
+
|
|
663
|
+
---
|
|
664
|
+
|
|
665
|
+
**Next:** Read [`13-deployment-guide.md`](./13-deployment-guide.md) for deployment instructions.
|