-
-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathapp.tsx
More file actions
600 lines (561 loc) · 22.7 KB
/
Copy pathapp.tsx
File metadata and controls
600 lines (561 loc) · 22.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
import { Component } from '@geajs/core'
import Accordion from '@geajs/ui/accordion'
import { Alert, AlertTitle, AlertDescription } from '@geajs/ui/alert'
import Avatar from '@geajs/ui/avatar'
import Badge from '@geajs/ui/badge'
import Button from '@geajs/ui/button'
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from '@geajs/ui/card'
import Checkbox from '@geajs/ui/checkbox'
import Clipboard from '@geajs/ui/clipboard'
import Collapsible from '@geajs/ui/collapsible'
import Combobox from '@geajs/ui/combobox'
import Dialog from '@geajs/ui/dialog'
import FileUpload from '@geajs/ui/file-upload'
import HoverCard from '@geajs/ui/hover-card'
import Input from '@geajs/ui/input'
import Label from '@geajs/ui/label'
import Menu from '@geajs/ui/menu'
import NumberInput from '@geajs/ui/number-input'
import Pagination from '@geajs/ui/pagination'
import PinInput from '@geajs/ui/pin-input'
import Popover from '@geajs/ui/popover'
import Progress from '@geajs/ui/progress'
import RadioGroup from '@geajs/ui/radio-group'
import RatingGroup from '@geajs/ui/rating-group'
import Select from '@geajs/ui/select'
import Separator from '@geajs/ui/separator'
import Skeleton from '@geajs/ui/skeleton'
import Slider from '@geajs/ui/slider'
import Switch from '@geajs/ui/switch'
import Tabs from '@geajs/ui/tabs'
import TagsInput from '@geajs/ui/tags-input'
import Textarea from '@geajs/ui/textarea'
import { Toaster, ToastStore } from '@geajs/ui/toast'
import ToggleGroup from '@geajs/ui/toggle-group'
import Tooltip from '@geajs/ui/tooltip'
export default class App extends Component {
template() {
return (
<div class="showcase">
<div class="showcase-hero">
<h1>gea-ui</h1>
<p>Accessible UI components for Gea, powered by Zag.js and Tailwind CSS.</p>
</div>
<div class="showcase-nav">
<a href="#general">General</a>
<a href="#data-display">Data Display</a>
<a href="#data-entry">Data Entry</a>
<a href="#feedback">Feedback</a>
<a href="#navigation">Navigation</a>
<a href="#overlay">Overlay</a>
<a href="#disclosure">Disclosure</a>
</div>
<Separator class="mb-8" />
{/* ======== GENERAL ======== */}
<div class="category" id="general">
<h2 class="category-title">General</h2>
<p class="category-desc">Basic building blocks for any interface.</p>
<div class="component-grid">
<div class="component-card">
<div class="component-card-header">
<h3>Button</h3>
<p>Triggers actions. 6 variants, 4 sizes.</p>
</div>
<div class="component-card-body">
<div class="inline">
<Button>Default</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="destructive">Destructive</Button>
</div>
<div class="inline">
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="link">Link</Button>
</div>
<div class="inline">
<Button size="sm">Small</Button>
<Button>Default</Button>
<Button size="lg">Large</Button>
<Button size="icon">+</Button>
</div>
<Button disabled>Disabled</Button>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Badge</h3>
<p>Status indicator or label. 4 variants.</p>
</div>
<div class="component-card-body centered">
<div class="inline">
<Badge>Default</Badge>
<Badge variant="secondary">Secondary</Badge>
<Badge variant="destructive">Destructive</Badge>
<Badge variant="outline">Outline</Badge>
</div>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Separator</h3>
<p>Visual divider between content sections.</p>
</div>
<div class="component-card-body">
<p style={{ fontSize: '0.875rem' }}>Content above</p>
<Separator />
<p style={{ fontSize: '0.875rem' }}>Content below</p>
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', height: 24 }}>
<span style={{ fontSize: '0.875rem' }}>Left</span>
<Separator orientation="vertical" />
<span style={{ fontSize: '0.875rem' }}>Right</span>
</div>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Skeleton</h3>
<p>Loading placeholder with pulse animation.</p>
</div>
<div class="component-card-body">
<div style={{ display: 'flex', gap: '0.75rem', alignItems: 'center' }}>
<Skeleton class="h-10 w-10 rounded-full" />
<div style={{ flex: 1 }}>
<Skeleton class="h-4 w-3/4 mb-1.5" />
<Skeleton class="h-3 w-1/2" />
</div>
</div>
<Skeleton class="h-24 w-full rounded-lg" />
</div>
</div>
</div>
</div>
{/* ======== DATA DISPLAY ======== */}
<div class="category" id="data-display">
<h2 class="category-title">Data Display</h2>
<p class="category-desc">Present information clearly and consistently.</p>
<div class="component-grid">
<div class="component-card">
<div class="component-card-header">
<h3>Card</h3>
<p>Container with header, content, and footer sections.</p>
</div>
<div class="component-card-body">
<Card>
<CardHeader>
<CardTitle>Notifications</CardTitle>
<CardDescription>You have 3 unread messages.</CardDescription>
</CardHeader>
<CardContent>
<p style={{ fontSize: '0.875rem' }}>Card body content goes here.</p>
</CardContent>
<CardFooter>
<Button size="sm" variant="outline">
View All
</Button>
</CardFooter>
</Card>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Avatar</h3>
<p>User image with fallback initials.</p>
</div>
<div class="component-card-body centered">
<div class="inline">
<Avatar name="Armagan Amcalar" />
<Avatar name="John Doe" />
<Avatar name="Sofia Davis" />
<Avatar name="?" />
</div>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Alert</h3>
<p>Contextual feedback messages.</p>
</div>
<div class="component-card-body">
<Alert>
<AlertTitle>Heads up!</AlertTitle>
<AlertDescription>You can add components to your app using the CLI.</AlertDescription>
</Alert>
<Alert variant="destructive">
<AlertTitle>Error</AlertTitle>
<AlertDescription>Your session has expired.</AlertDescription>
</Alert>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Progress</h3>
<p>Visual indicator of completion percentage.</p>
</div>
<div class="component-card-body">
<Progress label="Upload" value={33} />
<Progress label="Processing" value={66} />
<Progress label="Complete" value={100} />
</div>
</div>
</div>
</div>
{/* ======== DATA ENTRY ======== */}
<div class="category" id="data-entry">
<h2 class="category-title">Data Entry</h2>
<p class="category-desc">Form controls and user input components.</p>
<div class="component-grid">
<div class="component-card">
<div class="component-card-header">
<h3>Input</h3>
<p>Text input field with label support.</p>
</div>
<div class="component-card-body">
<div style={{ display: 'flex', flexDirection: 'column', gap: '0.25rem' }}>
<Label htmlFor="sc-email">Email</Label>
<Input inputId="sc-email" type="email" placeholder="you@example.com" />
</div>
<Input placeholder="Disabled" disabled />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Textarea</h3>
<p>Multi-line text input.</p>
</div>
<div class="component-card-body">
<Textarea placeholder="Write a message..." rows={3} />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Select</h3>
<p>Dropdown selection with keyboard navigation.</p>
</div>
<div class="component-card-body">
<Select
label="Framework"
placeholder="Pick one..."
items={[
{ value: 'gea', label: 'Gea' },
{ value: 'react', label: 'React' },
{ value: 'vue', label: 'Vue' },
{ value: 'solid', label: 'SolidJS' },
]}
/>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Combobox</h3>
<p>Searchable select with type-ahead filtering.</p>
</div>
<div class="component-card-body">
<Combobox
label="Country"
items={[
{ value: 'us', label: 'United States' },
{ value: 'uk', label: 'United Kingdom' },
{ value: 'de', label: 'Germany' },
{ value: 'fr', label: 'France' },
{ value: 'jp', label: 'Japan' },
{ value: 'tr', label: 'Turkey' },
]}
/>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Switch</h3>
<p>Boolean toggle control.</p>
</div>
<div class="component-card-body centered">
<Switch label="Airplane Mode" />
<Switch label="Dark Mode" defaultChecked />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Checkbox</h3>
<p>Multi-select form control.</p>
</div>
<div class="component-card-body">
<Checkbox label="Accept terms and conditions" />
<Checkbox label="Subscribe to newsletter" defaultChecked />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Radio Group</h3>
<p>Single selection from a set of options.</p>
</div>
<div class="component-card-body">
<RadioGroup
label="Plan"
defaultValue="pro"
items={[
{ value: 'free', label: 'Free' },
{ value: 'pro', label: 'Pro' },
{ value: 'enterprise', label: 'Enterprise' },
]}
/>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Slider</h3>
<p>Range input with thumb control.</p>
</div>
<div class="component-card-body">
<Slider label="Volume" defaultValue={[65]} min={0} max={100} />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Number Input</h3>
<p>Numeric input with increment/decrement.</p>
</div>
<div class="component-card-body">
<NumberInput label="Quantity" defaultValue="5" min={0} max={99} />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Pin Input</h3>
<p>Segmented code/OTP entry.</p>
</div>
<div class="component-card-body centered">
<PinInput count={4} type="numeric" placeholder="○" />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Tags Input</h3>
<p>Add/remove tags with keyboard.</p>
</div>
<div class="component-card-body">
<TagsInput label="Tags" placeholder="Add tag..." defaultValue={['gea', 'ui', 'zag']} />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Rating Group</h3>
<p>Star rating selection.</p>
</div>
<div class="component-card-body centered">
<RatingGroup count={5} defaultValue={3} />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Toggle Group</h3>
<p>Grouped toggle buttons.</p>
</div>
<div class="component-card-body centered">
<ToggleGroup
multiple
items={[
{ value: 'bold', label: 'B' },
{ value: 'italic', label: 'I' },
{ value: 'underline', label: 'U' },
]}
/>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>File Upload</h3>
<p>Drag-and-drop or click to upload files.</p>
</div>
<div class="component-card-body">
<FileUpload maxFiles={3} />
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Clipboard</h3>
<p>Copy-to-clipboard with visual feedback.</p>
</div>
<div class="component-card-body">
<Clipboard value="npm install @geajs/ui" />
</div>
</div>
</div>
</div>
{/* ======== FEEDBACK ======== */}
<div class="category" id="feedback">
<h2 class="category-title">Feedback</h2>
<p class="category-desc">Communicate status and results to users.</p>
<div class="component-grid">
<div class="component-card">
<div class="component-card-header">
<h3>Toast</h3>
<p>Temporary notifications that auto-dismiss.</p>
</div>
<div class="component-card-body">
<div class="inline">
<Button
size="sm"
click={() => ToastStore.success({ title: 'Saved!', description: 'Changes saved.' })}
>
Success
</Button>
<Button
size="sm"
variant="destructive"
click={() => ToastStore.error({ title: 'Error', description: 'Something failed.' })}
>
Error
</Button>
<Button
size="sm"
variant="outline"
click={() => ToastStore.info({ title: 'Tip', description: 'Try keyboard shortcuts.' })}
>
Info
</Button>
</div>
</div>
</div>
</div>
</div>
{/* ======== NAVIGATION ======== */}
<div class="category" id="navigation">
<h2 class="category-title">Navigation</h2>
<p class="category-desc">Help users move through your application.</p>
<div class="component-grid">
<div class="component-card">
<div class="component-card-header">
<h3>Tabs</h3>
<p>Organize content into switchable panels.</p>
</div>
<div class="component-card-body">
<Tabs
defaultValue="account"
items={[
{ value: 'account', label: 'Account', content: 'Account settings panel.' },
{ value: 'password', label: 'Password', content: 'Password settings panel.' },
{ value: 'team', label: 'Team', content: 'Team management panel.' },
]}
/>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Pagination</h3>
<p>Navigate through paged content.</p>
</div>
<div class="component-card-body centered">
<Pagination count={100} defaultPageSize={10} />
</div>
</div>
</div>
</div>
{/* ======== OVERLAY ======== */}
<div class="category" id="overlay">
<h2 class="category-title">Overlay</h2>
<p class="category-desc">Floating content layers triggered by user interaction.</p>
<div class="component-grid">
<div class="component-card">
<div class="component-card-header">
<h3>Dialog</h3>
<p>Modal window with focus trap and backdrop.</p>
</div>
<div class="component-card-body centered">
<Dialog title="Confirm" description="Are you sure?" triggerLabel="Open Dialog">
<p style={{ fontSize: '0.875rem', marginTop: '0.5rem' }}>Dialog body here.</p>
</Dialog>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Menu</h3>
<p>Dropdown action menu.</p>
</div>
<div class="component-card-body centered">
<Menu
triggerLabel="Open Menu"
items={[
{ value: 'edit', label: 'Edit' },
{ value: 'copy', label: 'Copy' },
{ type: 'separator' },
{ value: 'delete', label: 'Delete' },
]}
/>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Popover</h3>
<p>Anchored floating panel.</p>
</div>
<div class="component-card-body centered">
<Popover triggerLabel="Open Popover" title="Settings" description="Panel settings.">
<p style={{ fontSize: '0.875rem' }}>Content here.</p>
</Popover>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Tooltip</h3>
<p>Contextual info on hover.</p>
</div>
<div class="component-card-body centered">
<Tooltip content="This is a tooltip">
<Button variant="outline">Hover me</Button>
</Tooltip>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Hover Card</h3>
<p>Rich preview on hover.</p>
</div>
<div class="component-card-body centered">
<HoverCard triggerLabel="@geajs">
<p style={{ fontWeight: 600, fontSize: '0.875rem' }}>Gea Framework</p>
<p style={{ fontSize: '0.8rem', color: 'hsl(var(--muted-foreground))' }}>Reactive UI framework.</p>
</HoverCard>
</div>
</div>
</div>
</div>
{/* ======== DISCLOSURE ======== */}
<div class="category" id="disclosure">
<h2 class="category-title">Disclosure</h2>
<p class="category-desc">Show and hide content sections.</p>
<div class="component-grid">
<div class="component-card">
<div class="component-card-header">
<h3>Accordion</h3>
<p>Expandable content sections.</p>
</div>
<div class="component-card-body">
<Accordion
collapsible
items={[
{ value: 'a', label: 'What is gea-ui?', content: 'A component library for Gea.' },
{ value: 'b', label: 'Is it accessible?', content: 'Yes, powered by Zag.js.' },
]}
/>
</div>
</div>
<div class="component-card">
<div class="component-card-header">
<h3>Collapsible</h3>
<p>Single toggle section.</p>
</div>
<div class="component-card-body">
<Collapsible label="Show Details">
<p style={{ fontSize: '0.875rem', padding: '0.5rem 0' }}>Hidden content revealed.</p>
</Collapsible>
</div>
</div>
</div>
</div>
<Separator class="my-6" />
<p class="footer-note">gea-ui — {35} components. Built with Gea, Zag.js, and Tailwind CSS.</p>
<Toaster />
</div>
)
}
}