xertica-ui 2.5.2 → 2.5.3

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.
@@ -1,1322 +1,1321 @@
1
- import React, { useState } from 'react';
2
- import {
3
- Button,
4
- Input,
5
- Label,
6
- Card,
7
- CardHeader,
8
- CardTitle,
9
- CardDescription,
10
- CardContent,
11
- CardFooter,
12
- Tabs,
13
- TabsContent,
14
- TabsList,
15
- TabsTrigger,
16
- Badge,
17
- Alert,
18
- AlertDescription,
19
- AlertTitle,
20
- Checkbox,
21
- RadioGroup,
22
- RadioGroupItem,
23
- Switch,
24
- Select,
25
- SelectContent,
26
- SelectItem,
27
- SelectTrigger,
28
- SelectValue,
29
- Textarea,
30
- Progress,
31
- Separator,
32
- Table,
33
- TableBody,
34
- TableCell,
35
- TableHead,
36
- TableHeader,
37
- TableRow,
38
- Slider,
39
- ScrollArea,
40
- Dialog,
41
- DialogTrigger,
42
- DialogContent,
43
- DialogHeader,
44
- DialogTitle,
45
- DialogDescription,
46
- DialogFooter,
47
- AlertDialog,
48
- AlertDialogTrigger,
49
- AlertDialogContent,
50
- AlertDialogHeader,
51
- AlertDialogTitle,
52
- AlertDialogDescription,
53
- AlertDialogFooter,
54
- AlertDialogAction,
55
- AlertDialogCancel,
56
- Pagination,
57
- PaginationContent,
58
- PaginationItem,
59
- PaginationLink,
60
- PaginationNext,
61
- PaginationPrevious,
62
- PaginationEllipsis,
63
- Stepper,
64
- Step,
65
- TreeView,
66
- RichTextEditor,
67
- usePagination,
68
- useStepper,
69
- } from 'xertica-ui/ui';
70
- import { Header, Sidebar } from 'xertica-ui/layout';
71
- import { useLayout, useTheme } from 'xertica-ui/hooks';
72
- import { toast } from 'sonner';
73
- import { Link } from 'react-router-dom';
74
- import { Trans, useTranslation } from 'react-i18next';
75
- import {
76
- Settings,
77
- User,
78
- Mail,
79
- Phone,
80
- Calendar,
81
- Search,
82
- PanelLeft,
83
- Home,
84
- Users,
85
- Plus,
86
- Trash2,
87
- Archive,
88
- ArrowRightLeft,
89
- FileEdit,
90
- Clock,
91
- Map,
92
- } from 'lucide-react';
93
-
94
- export function TemplateContent() {
95
- const { t } = useTranslation();
96
-
97
- // ── TreeView demo data (built inside the component so labels react to language switches) ──
98
- const treeData = [
99
- {
100
- id: 'components',
101
- label: t('templates.enhanced.treeView.nodes.components'),
102
- children: [
103
- {
104
- id: 'ui',
105
- label: t('templates.enhanced.treeView.nodes.ui'),
106
- children: [
107
- { id: 'button', label: t('templates.enhanced.treeView.nodes.button') },
108
- { id: 'input', label: t('templates.enhanced.treeView.nodes.input') },
109
- { id: 'pagination', label: t('templates.enhanced.treeView.nodes.pagination') },
110
- ],
111
- },
112
- {
113
- id: 'layout',
114
- label: t('templates.enhanced.treeView.nodes.layout'),
115
- children: [
116
- { id: 'sidebar', label: t('templates.enhanced.treeView.nodes.sidebar') },
117
- { id: 'header', label: t('templates.enhanced.treeView.nodes.header') },
118
- ],
119
- },
120
- ],
121
- },
122
- {
123
- id: 'hooks',
124
- label: t('templates.enhanced.treeView.nodes.hooks'),
125
- // Hook identifiers stay as code — not translated.
126
- children: [
127
- { id: 'use-pagination', label: 'usePagination' },
128
- { id: 'use-stepper', label: 'useStepper' },
129
- { id: 'use-tree-view', label: 'useTreeView' },
130
- ],
131
- },
132
- ];
133
- const { sidebarExpanded, sidebarWidth } = useLayout();
134
- const { disableDarkMode } = useTheme();
135
- const [progress, setProgress] = useState(45);
136
- const [sliderValue, setSliderValue] = useState([50]);
137
- const [switchEnabled, setSwitchEnabled] = useState(false);
138
- const [richText, setRichText] = useState('');
139
-
140
- // Dialog demo inputs (controlled so they re-localise on language switch).
141
- // Seeded lazily from `t(...)` so the initial value reflects the current
142
- // language at first render; subsequent language switches don't overwrite
143
- // user edits.
144
- const [dialogName, setDialogName] = useState(() => t('templates.dialogs.nameDefaultValue'));
145
- const [dialogUsername, setDialogUsername] = useState(() =>
146
- t('templates.dialogs.usernameDefaultValue')
147
- );
148
-
149
- // ── Pagination demo ─────────────────────────────────────────────────────────
150
- const { currentPage, totalPages, items, next, prev, goTo, canGoPrev, canGoNext } = usePagination({
151
- totalItems: 120,
152
- pageSize: 10,
153
- });
154
-
155
- // ── Stepper demo ────────────────────────────────────────────────────────────
156
- const {
157
- currentStep,
158
- next: stepNext,
159
- prev: stepPrev,
160
- isFirstStep,
161
- isLastStep,
162
- } = useStepper({ totalSteps: 3 });
163
-
164
- const handleFormSubmit = (e: React.FormEvent) => {
165
- e.preventDefault();
166
- toast.success(t('templates.formSubmitSuccess'));
167
- };
168
-
169
- return (
170
- <div
171
- style={{
172
- paddingLeft: sidebarExpanded ? `${sidebarWidth}px` : '80px',
173
- }}
174
- className="flex-1 flex flex-col overflow-hidden transition-all duration-300"
175
- >
176
- <Header
177
- showThemeToggle={true}
178
- showLanguageSelector={true}
179
- breadcrumbs={[
180
- { label: t('nav.designSystem'), href: '/home' },
181
- { label: t('templates.breadcrumb') },
182
- ]}
183
- renderLink={(href: string, props: any) => <Link to={href} {...props} />}
184
- />
185
-
186
- <main className="flex-1 overflow-hidden bg-muted">
187
- <ScrollArea className="h-full">
188
- <div className="p-5 sm:p-4 md:p-6">
189
- <div className="max-w-6xl mx-auto space-y-8">
190
- <div className="space-y-2">
191
- <h2>{t('templates.title')}</h2>
192
- <p className="text-muted-foreground">{t('templates.subtitle')}</p>
193
- </div>
194
-
195
- {/* Alert Examples */}
196
- <section>
197
- <h3 className="mb-4">{t('templates.sections.alerts')}</h3>
198
- <div className="grid gap-4 md:grid-cols-2">
199
- <Alert variant="info">
200
- <AlertTitle>{t('templates.alerts.infoTitle')}</AlertTitle>
201
- <AlertDescription>{t('templates.alerts.infoDescription')}</AlertDescription>
202
- </Alert>
203
-
204
- <Alert variant="destructive">
205
- <AlertTitle>{t('templates.alerts.errorTitle')}</AlertTitle>
206
- <AlertDescription>{t('templates.alerts.errorDescription')}</AlertDescription>
207
- </Alert>
208
-
209
- <Alert variant="success">
210
- <AlertTitle>{t('templates.alerts.successTitle')}</AlertTitle>
211
- <AlertDescription>{t('templates.alerts.successDescription')}</AlertDescription>
212
- </Alert>
213
-
214
- <Alert variant="warning">
215
- <AlertTitle>{t('templates.alerts.warningTitle')}</AlertTitle>
216
- <AlertDescription>{t('templates.alerts.warningDescription')}</AlertDescription>
217
- </Alert>
218
- </div>
219
- </section>
220
-
221
- <Separator className="my-8" />
222
-
223
- {/* Cards & Tabs */}
224
- <section>
225
- <h3 className="mb-4">{t('templates.sections.cardsAndTabs')}</h3>
226
-
227
- <Tabs defaultValue="overview" className="w-full">
228
- <TabsList className="grid w-full grid-cols-4">
229
- <TabsTrigger value="overview">{t('templates.tabs.overview')}</TabsTrigger>
230
- <TabsTrigger value="forms">{t('templates.tabs.forms')}</TabsTrigger>
231
- <TabsTrigger value="data">{t('templates.tabs.data')}</TabsTrigger>
232
- <TabsTrigger value="settings">{t('templates.tabs.settings')}</TabsTrigger>
233
- </TabsList>
234
-
235
- {/* Overview Tab */}
236
- <TabsContent value="overview" className="space-y-4">
237
- <div className="grid gap-4 md:grid-cols-3">
238
- <Card>
239
- <CardHeader>
240
- <CardTitle>{t('stats.totalUsers')}</CardTitle>
241
- <CardDescription>{t('stats.last30Days')}</CardDescription>
242
- </CardHeader>
243
- <CardContent>
244
- <div className="text-foreground">
245
- <span className="[font-size:var(--text-stats)] [font-weight:var(--font-weight-bold)]">
246
- {t('templates.overview.totalUsersDemoValue')}
247
- </span>
248
- <Badge variant="default" className="ml-2">
249
- +12%
250
- </Badge>
251
- </div>
252
- </CardContent>
253
- </Card>
254
-
255
- <Card>
256
- <CardHeader>
257
- <CardTitle>{t('stats.totalRevenue')}</CardTitle>
258
- <CardDescription>{t('stats.currentMonth')}</CardDescription>
259
- </CardHeader>
260
- <CardContent>
261
- <div className="text-foreground">
262
- <span className="[font-size:var(--text-stats)] [font-weight:var(--font-weight-bold)]">
263
- {t('templates.overview.revenueDemoValue')}
264
- </span>
265
- <Badge variant="secondary" className="ml-2">
266
- +8%
267
- </Badge>
268
- </div>
269
- </CardContent>
270
- </Card>
271
-
272
- <Card>
273
- <CardHeader>
274
- <CardTitle>{t('stats.conversionRate')}</CardTitle>
275
- <CardDescription>{t('stats.currentWeek')}</CardDescription>
276
- </CardHeader>
277
- <CardContent>
278
- <div className="text-foreground">
279
- <span className="[font-size:var(--text-stats)] [font-weight:var(--font-weight-bold)]">
280
- {t('templates.overview.conversionRateDemoValue')}
281
- </span>
282
- <Badge variant="outline" className="ml-2">
283
- -2%
284
- </Badge>
285
- </div>
286
- </CardContent>
287
- </Card>
288
- </div>
289
-
290
- <Card>
291
- <CardHeader>
292
- <CardTitle>{t('templates.overview.progressTitle')}</CardTitle>
293
- <CardDescription>
294
- {t('templates.overview.progressDescription')}
295
- </CardDescription>
296
- </CardHeader>
297
- <CardContent className="space-y-6">
298
- <div className="space-y-2">
299
- <div className="flex items-center justify-between">
300
- <Label>{t('templates.overview.projectProgress')}</Label>
301
- <span className="[font-size:var(--text-small)] text-muted-foreground">
302
- {progress}%
303
- </span>
304
- </div>
305
- <Progress value={progress} className="w-full" />
306
- <div className="flex gap-2">
307
- <Button
308
- size="sm"
309
- onClick={() => setProgress(Math.max(0, progress - 10))}
310
- >
311
- -10%
312
- </Button>
313
- <Button
314
- size="sm"
315
- onClick={() => setProgress(Math.min(100, progress + 10))}
316
- >
317
- +10%
318
- </Button>
319
- </div>
320
- </div>
321
-
322
- <Separator />
323
-
324
- <div className="space-y-2">
325
- <div className="flex items-center justify-between">
326
- <Label>{t('templates.overview.volume')}</Label>
327
- <span className="[font-size:var(--text-small)] text-muted-foreground">
328
- {sliderValue[0]}%
329
- </span>
330
- </div>
331
- <Slider
332
- value={sliderValue}
333
- onValueChange={setSliderValue}
334
- min={0}
335
- max={100}
336
- step={1}
337
- className="w-full"
338
- />
339
- </div>
340
- </CardContent>
341
- </Card>
342
- </TabsContent>
343
-
344
- {/* Forms Tab */}
345
- <TabsContent value="forms" className="space-y-4">
346
- <Card>
347
- <CardHeader>
348
- <CardTitle>{t('templates.forms.registrationTitle')}</CardTitle>
349
- <CardDescription>
350
- {t('templates.forms.registrationDescription')}
351
- </CardDescription>
352
- </CardHeader>
353
- <CardContent>
354
- <form onSubmit={handleFormSubmit} className="space-y-4">
355
- <div className="grid gap-4 md:grid-cols-2">
356
- <div className="space-y-2">
357
- <Label htmlFor="firstName">{t('templates.forms.firstName')}</Label>
358
- <Input
359
- id="firstName"
360
- placeholder={t('templates.forms.firstNamePlaceholder')}
361
- />
362
- </div>
363
- <div className="space-y-2">
364
- <Label htmlFor="lastName">{t('templates.forms.lastName')}</Label>
365
- <Input
366
- id="lastName"
367
- placeholder={t('templates.forms.lastNamePlaceholder')}
368
- />
369
- </div>
370
- </div>
371
-
372
- <div className="space-y-2">
373
- <Label htmlFor="email">{t('templates.forms.email')}</Label>
374
- <div className="relative">
375
- <Mail className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
376
- <Input
377
- id="email"
378
- type="email"
379
- placeholder={t('templates.forms.emailPlaceholder')}
380
- className="pl-10"
381
- />
382
- </div>
383
- </div>
384
-
385
- <div className="space-y-2">
386
- <Label htmlFor="phone">{t('templates.forms.phone')}</Label>
387
- <div className="relative">
388
- <Phone className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
389
- <Input
390
- id="phone"
391
- type="tel"
392
- placeholder={t('templates.forms.phonePlaceholder')}
393
- className="pl-10"
394
- />
395
- </div>
396
- </div>
397
-
398
- <div className="space-y-2">
399
- <Label htmlFor="role">{t('templates.forms.role')}</Label>
400
- <Select>
401
- <SelectTrigger id="role">
402
- <SelectValue placeholder={t('templates.forms.rolePlaceholder')} />
403
- </SelectTrigger>
404
- <SelectContent>
405
- <SelectItem value="developer">
406
- {t('templates.forms.roles.developer')}
407
- </SelectItem>
408
- <SelectItem value="designer">
409
- {t('templates.forms.roles.designer')}
410
- </SelectItem>
411
- <SelectItem value="manager">
412
- {t('templates.forms.roles.manager')}
413
- </SelectItem>
414
- <SelectItem value="analyst">
415
- {t('templates.forms.roles.analyst')}
416
- </SelectItem>
417
- </SelectContent>
418
- </Select>
419
- </div>
420
-
421
- <div className="space-y-2">
422
- <Label htmlFor="bio">{t('templates.forms.bio')}</Label>
423
- <Textarea
424
- id="bio"
425
- placeholder={t('templates.forms.bioPlaceholder')}
426
- rows={4}
427
- />
428
- </div>
429
-
430
- <Separator />
431
-
432
- <div className="space-y-4">
433
- <h4>{t('templates.forms.preferences')}</h4>
434
-
435
- <div className="space-y-3">
436
- <div className="flex items-center space-x-2">
437
- <Checkbox id="newsletter" />
438
- <Label htmlFor="newsletter" className="font-normal">
439
- {t('templates.forms.newsletter')}
440
- </Label>
441
- </div>
442
-
443
- <div className="flex items-center space-x-2">
444
- <Checkbox id="notifications" />
445
- <Label htmlFor="notifications" className="font-normal">
446
- {t('templates.forms.pushNotifications')}
447
- </Label>
448
- </div>
449
-
450
- <div className="flex items-center space-x-2">
451
- <Checkbox id="updates" />
452
- <Label htmlFor="updates" className="font-normal">
453
- {t('templates.forms.featureUpdates')}
454
- </Label>
455
- </div>
456
- </div>
457
-
458
- <Separator />
459
-
460
- <div className="space-y-3">
461
- <Label>{t('templates.forms.accountType')}</Label>
462
- <RadioGroup defaultValue="personal">
463
- <div className="flex items-center space-x-2">
464
- <RadioGroupItem value="personal" id="personal" />
465
- <Label htmlFor="personal" className="font-normal">
466
- {t('templates.forms.accountPersonal')}
467
- </Label>
468
- </div>
469
- <div className="flex items-center space-x-2">
470
- <RadioGroupItem value="business" id="business" />
471
- <Label htmlFor="business" className="font-normal">
472
- {t('templates.forms.accountBusiness')}
473
- </Label>
474
- </div>
475
- <div className="flex items-center space-x-2">
476
- <RadioGroupItem value="enterprise" id="enterprise" />
477
- <Label htmlFor="enterprise" className="font-normal">
478
- {t('templates.forms.accountEnterprise')}
479
- </Label>
480
- </div>
481
- </RadioGroup>
482
- </div>
483
- </div>
484
- </form>
485
- </CardContent>
486
- <CardFooter className="flex justify-between">
487
- <Button variant="outline">{t('templates.forms.cancel')}</Button>
488
- <Button onClick={handleFormSubmit}>
489
- {t('templates.forms.createAccount')}
490
- </Button>
491
- </CardFooter>
492
- </Card>
493
- </TabsContent>
494
-
495
- {/* Data Tab */}
496
- <TabsContent value="data" className="space-y-4">
497
- <Card>
498
- <CardHeader>
499
- <CardTitle>{t('templates.data.title')}</CardTitle>
500
- <CardDescription>{t('templates.data.description')}</CardDescription>
501
- </CardHeader>
502
- <CardContent>
503
- <div className="mb-4">
504
- <div className="relative">
505
- <Search className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
506
- <Input
507
- placeholder={t('templates.data.searchPlaceholder')}
508
- className="pl-10"
509
- />
510
- </div>
511
- </div>
512
-
513
- <div className="rounded-[var(--radius-lg)] border border-border overflow-hidden">
514
- <Table>
515
- <TableHeader>
516
- <TableRow>
517
- <TableHead>{t('templates.data.headers.name')}</TableHead>
518
- <TableHead>{t('templates.data.headers.email')}</TableHead>
519
- <TableHead>{t('templates.data.headers.role')}</TableHead>
520
- <TableHead>{t('templates.data.headers.status')}</TableHead>
521
- <TableHead className="text-right">
522
- {t('templates.data.headers.actions')}
523
- </TableHead>
524
- </TableRow>
525
- </TableHeader>
526
- <TableBody>
527
- <TableRow>
528
- <TableCell>Ana Silva</TableCell>
529
- <TableCell>{`ana.silva@${t('templates.data.demoEmailDomain')}`}</TableCell>
530
- <TableCell>{t('templates.data.roles.developerFemale')}</TableCell>
531
- <TableCell>
532
- <Badge variant="default">
533
- {t('templates.data.status.active')}
534
- </Badge>
535
- </TableCell>
536
- <TableCell className="text-right">
537
- <Button variant="ghost" size="sm">
538
- {t('templates.data.edit')}
539
- </Button>
540
- </TableCell>
541
- </TableRow>
542
- <TableRow>
543
- <TableCell>Bruno Costa</TableCell>
544
- <TableCell>{`bruno.costa@${t('templates.data.demoEmailDomain')}`}</TableCell>
545
- <TableCell>{t('templates.data.roles.designer')}</TableCell>
546
- <TableCell>
547
- <Badge variant="default">
548
- {t('templates.data.status.active')}
549
- </Badge>
550
- </TableCell>
551
- <TableCell className="text-right">
552
- <Button variant="ghost" size="sm">
553
- {t('templates.data.edit')}
554
- </Button>
555
- </TableCell>
556
- </TableRow>
557
- <TableRow>
558
- <TableCell>Carla Oliveira</TableCell>
559
- <TableCell>{`carla.oliveira@${t('templates.data.demoEmailDomain')}`}</TableCell>
560
- <TableCell>{t('templates.data.roles.manager')}</TableCell>
561
- <TableCell>
562
- <Badge variant="secondary">
563
- {t('templates.data.status.away')}
564
- </Badge>
565
- </TableCell>
566
- <TableCell className="text-right">
567
- <Button variant="ghost" size="sm">
568
- {t('templates.data.edit')}
569
- </Button>
570
- </TableCell>
571
- </TableRow>
572
- <TableRow>
573
- <TableCell>Diego Santos</TableCell>
574
- <TableCell>{`diego.santos@${t('templates.data.demoEmailDomain')}`}</TableCell>
575
- <TableCell>{t('templates.data.roles.analyst')}</TableCell>
576
- <TableCell>
577
- <Badge variant="outline">
578
- {t('templates.data.status.inactive')}
579
- </Badge>
580
- </TableCell>
581
- <TableCell className="text-right">
582
- <Button variant="ghost" size="sm">
583
- {t('templates.data.edit')}
584
- </Button>
585
- </TableCell>
586
- </TableRow>
587
- </TableBody>
588
- </Table>
589
- </div>
590
- </CardContent>
591
- <CardFooter className="flex justify-between items-center">
592
- <p className="text-muted-foreground">
593
- {t('templates.data.showing', { count: 4, total: 127 })}
594
- </p>
595
- <div className="flex gap-2">
596
- <Button variant="outline" size="sm">
597
- {t('templates.data.previous')}
598
- </Button>
599
- <Button variant="outline" size="sm">
600
- {t('templates.data.next')}
601
- </Button>
602
- </div>
603
- </CardFooter>
604
- </Card>
605
- </TabsContent>
606
-
607
- {/* Settings Tab */}
608
- <TabsContent value="settings" className="space-y-4">
609
- <Card>
610
- <CardHeader>
611
- <CardTitle>{t('templates.settings.title')}</CardTitle>
612
- <CardDescription>{t('templates.settings.description')}</CardDescription>
613
- </CardHeader>
614
- <CardContent className="space-y-6">
615
- {!disableDarkMode && (
616
- <>
617
- <div className="flex items-center justify-between">
618
- <div className="space-y-1">
619
- <Label>{t('templates.settings.darkMode')}</Label>
620
- <p className="text-muted-foreground">
621
- {t('templates.settings.darkModeDescription')}
622
- </p>
623
- </div>
624
- <Switch checked={switchEnabled} onCheckedChange={setSwitchEnabled} />
625
- </div>
626
-
627
- <Separator />
628
- </>
629
- )}
630
-
631
- <div className="flex items-center justify-between">
632
- <div className="space-y-1">
633
- <Label>{t('templates.settings.emailNotifications')}</Label>
634
- <p className="text-muted-foreground">
635
- {t('templates.settings.emailNotificationsDescription')}
636
- </p>
637
- </div>
638
- <Switch defaultChecked />
639
- </div>
640
-
641
- <Separator />
642
-
643
- <div className="flex items-center justify-between">
644
- <div className="space-y-1">
645
- <Label>{t('templates.settings.pushNotifications')}</Label>
646
- <p className="text-muted-foreground">
647
- {t('templates.settings.pushNotificationsDescription')}
648
- </p>
649
- </div>
650
- <Switch />
651
- </div>
652
-
653
- <Separator />
654
-
655
- <div className="space-y-3">
656
- <Label>{t('templates.settings.language')}</Label>
657
- <Select defaultValue="pt-br">
658
- <SelectTrigger>
659
- <SelectValue />
660
- </SelectTrigger>
661
- <SelectContent>
662
- <SelectItem value="pt-br">
663
- {t('templates.settings.languages.ptBR')}
664
- </SelectItem>
665
- <SelectItem value="en">
666
- {t('templates.settings.languages.en')}
667
- </SelectItem>
668
- <SelectItem value="es">
669
- {t('templates.settings.languages.es')}
670
- </SelectItem>
671
- </SelectContent>
672
- </Select>
673
- </div>
674
-
675
- <Separator />
676
-
677
- <div className="space-y-3">
678
- <Label>{t('templates.settings.timezone')}</Label>
679
- <Select defaultValue="america-sao-paulo">
680
- <SelectTrigger>
681
- <SelectValue />
682
- </SelectTrigger>
683
- <SelectContent>
684
- <SelectItem value="america-sao-paulo">
685
- {t('templates.settings.timezones.saoPaulo')}
686
- </SelectItem>
687
- <SelectItem value="america-new-york">
688
- {t('templates.settings.timezones.newYork')}
689
- </SelectItem>
690
- <SelectItem value="europe-london">
691
- {t('templates.settings.timezones.london')}
692
- </SelectItem>
693
- </SelectContent>
694
- </Select>
695
- </div>
696
- </CardContent>
697
- <CardFooter className="flex justify-between">
698
- <Button variant="outline">{t('templates.settings.restoreDefaults')}</Button>
699
- <Button>{t('templates.settings.saveChanges')}</Button>
700
- </CardFooter>
701
- </Card>
702
- </TabsContent>
703
- </Tabs>
704
- </section>
705
-
706
- <Separator className="my-8" />
707
-
708
- {/* Button Variants */}
709
- <section>
710
- <h3 className="mb-4">{t('templates.sections.buttons')}</h3>
711
- <Card>
712
- <CardHeader>
713
- <CardTitle>{t('templates.buttons.title')}</CardTitle>
714
- <CardDescription>{t('templates.buttons.description')}</CardDescription>
715
- </CardHeader>
716
- <CardContent className="space-y-6">
717
- <div className="space-y-3">
718
- <Label>{t('templates.buttons.variants')}</Label>
719
- <div className="flex flex-wrap gap-3">
720
- <Button variant="default">
721
- {t('templates.buttons.variantLabels.default')}
722
- </Button>
723
- <Button variant="secondary">
724
- {t('templates.buttons.variantLabels.secondary')}
725
- </Button>
726
- <Button variant="outline">
727
- {t('templates.buttons.variantLabels.outline')}
728
- </Button>
729
- <Button variant="ghost">
730
- {t('templates.buttons.variantLabels.ghost')}
731
- </Button>
732
- <Button variant="link">{t('templates.buttons.variantLabels.link')}</Button>
733
- <Button variant="destructive">
734
- {t('templates.buttons.variantLabels.destructive')}
735
- </Button>
736
- </div>
737
- </div>
738
-
739
- <Separator />
740
-
741
- <div className="space-y-3">
742
- <Label>{t('templates.buttons.sizes')}</Label>
743
- <div className="flex flex-wrap items-center gap-3">
744
- <Button size="sm">{t('templates.buttons.sizeLabels.small')}</Button>
745
- <Button size="default">{t('templates.buttons.sizeLabels.default')}</Button>
746
- <Button size="lg">{t('templates.buttons.sizeLabels.large')}</Button>
747
- <Button size="icon">
748
- <Settings className="h-4 w-4" />
749
- </Button>
750
- </div>
751
- </div>
752
-
753
- <Separator />
754
-
755
- <div className="space-y-3">
756
- <Label>{t('templates.buttons.withIcons')}</Label>
757
- <div className="flex flex-wrap gap-3">
758
- <Button>
759
- <User className="mr-2 h-4 w-4" />
760
- {t('templates.buttons.profile')}
761
- </Button>
762
- <Button variant="secondary">
763
- <Mail className="mr-2 h-4 w-4" />
764
- {t('templates.buttons.messages')}
765
- </Button>
766
- <Button variant="outline">
767
- <Calendar className="mr-2 h-4 w-4" />
768
- {t('templates.buttons.schedule')}
769
- </Button>
770
- </div>
771
- </div>
772
-
773
- <Separator />
774
-
775
- <div className="space-y-3">
776
- <Label>{t('templates.buttons.states')}</Label>
777
- <div className="flex flex-wrap gap-3">
778
- <Button disabled>{t('templates.buttons.disabled')}</Button>
779
- <Button variant="outline" disabled>
780
- {t('templates.buttons.outlineDisabled')}
781
- </Button>
782
- </div>
783
- </div>
784
- </CardContent>
785
- </Card>
786
- </section>
787
-
788
- <Separator className="my-8" />
789
-
790
- {/* Badges */}
791
- <section>
792
- <h3 className="mb-4">{t('templates.sections.badges')}</h3>
793
- <Card>
794
- <CardHeader>
795
- <CardTitle>{t('templates.badges.title')}</CardTitle>
796
- <CardDescription>{t('templates.badges.description')}</CardDescription>
797
- </CardHeader>
798
- <CardContent>
799
- <div className="flex flex-wrap gap-3">
800
- <Badge variant="default">{t('templates.badges.labels.default')}</Badge>
801
- <Badge variant="secondary">{t('templates.badges.labels.secondary')}</Badge>
802
- <Badge variant="outline">{t('templates.badges.labels.outline')}</Badge>
803
- <Badge variant="destructive">
804
- {t('templates.badges.labels.destructive')}
805
- </Badge>
806
- <Badge className="bg-success text-success-foreground">
807
- {t('templates.badges.labels.success')}
808
- </Badge>
809
- <Badge className="bg-warning text-warning-foreground">
810
- {t('templates.badges.labels.warning')}
811
- </Badge>
812
- <Badge className="bg-info text-info-foreground">
813
- {t('templates.badges.labels.info')}
814
- </Badge>
815
- </div>
816
- </CardContent>
817
- </Card>
818
- </section>
819
-
820
- <Separator className="my-8" />
821
-
822
- {/* Dialogs */}
823
- <section>
824
- <h3 className="mb-4">{t('templates.sections.dialogs')}</h3>
825
- <div className="grid gap-4 md:grid-cols-2">
826
- <Card>
827
- <CardHeader>
828
- <CardTitle>{t('templates.dialogs.dialogTitle')}</CardTitle>
829
- <CardDescription>{t('templates.dialogs.dialogDescription')}</CardDescription>
830
- </CardHeader>
831
- <CardContent className="flex justify-center py-6">
832
- <Dialog>
833
- <DialogTrigger asChild>
834
- <Button variant="outline">{t('templates.dialogs.editProfile')}</Button>
835
- </DialogTrigger>
836
- <DialogContent className="sm:max-w-[425px]">
837
- <DialogHeader>
838
- <DialogTitle>{t('templates.dialogs.editProfile')}</DialogTitle>
839
- <DialogDescription>
840
- {t('templates.dialogs.editProfileDescription')}
841
- </DialogDescription>
842
- </DialogHeader>
843
- <div className="grid gap-4 py-4">
844
- <div className="grid grid-cols-4 items-center gap-4">
845
- <Label htmlFor="name" className="text-right">
846
- {t('templates.dialogs.name')}
847
- </Label>
848
- <Input
849
- id="name"
850
- value={dialogName}
851
- onChange={e => setDialogName(e.target.value)}
852
- className="col-span-3"
853
- />
854
- </div>
855
- <div className="grid grid-cols-4 items-center gap-4">
856
- <Label htmlFor="username" className="text-right">
857
- {t('templates.dialogs.username')}
858
- </Label>
859
- <Input
860
- id="username"
861
- value={dialogUsername}
862
- onChange={e => setDialogUsername(e.target.value)}
863
- className="col-span-3"
864
- />
865
- </div>
866
- </div>
867
- <DialogFooter>
868
- <Button type="submit">{t('templates.dialogs.update')}</Button>
869
- </DialogFooter>
870
- </DialogContent>
871
- </Dialog>
872
- </CardContent>
873
- </Card>
874
-
875
- <Card>
876
- <CardHeader>
877
- <CardTitle>{t('templates.dialogs.alertDialogTitle')}</CardTitle>
878
- <CardDescription>
879
- {t('templates.dialogs.alertDialogDescription')}
880
- </CardDescription>
881
- </CardHeader>
882
- <CardContent className="flex justify-center py-6">
883
- <AlertDialog>
884
- <AlertDialogTrigger asChild>
885
- <Button variant="destructive">
886
- {t('templates.dialogs.deleteAccount')}
887
- </Button>
888
- </AlertDialogTrigger>
889
- <AlertDialogContent className="sm:max-w-[425px]">
890
- <AlertDialogHeader>
891
- <AlertDialogTitle>{t('templates.dialogs.areYouSure')}</AlertDialogTitle>
892
- <AlertDialogDescription>
893
- {t('templates.dialogs.deleteWarning')}
894
- </AlertDialogDescription>
895
- </AlertDialogHeader>
896
- <AlertDialogFooter>
897
- <AlertDialogCancel>{t('templates.dialogs.cancel')}</AlertDialogCancel>
898
- <AlertDialogAction className="bg-destructive text-destructive-foreground hover:bg-destructive/90">
899
- {t('templates.dialogs.continue')}
900
- </AlertDialogAction>
901
- </AlertDialogFooter>
902
- </AlertDialogContent>
903
- </AlertDialog>
904
- </CardContent>
905
- </Card>
906
- </div>
907
- </section>
908
-
909
- <Separator className="my-8" />
910
-
911
- {/* Sidebar Variations */}
912
- <section>
913
- <h3 className="mb-4">{t('templates.sections.sidebarVariations')}</h3>
914
- <Card>
915
- <CardHeader>
916
- <CardTitle>{t('templates.sidebar.title')}</CardTitle>
917
- <CardDescription>{t('templates.sidebar.description')}</CardDescription>
918
- </CardHeader>
919
- <CardContent>
920
- <Tabs defaultValue="assistant" className="w-full">
921
- <TabsList className="mb-4">
922
- <TabsTrigger value="assistant">
923
- {t('templates.sidebar.assistantMode')}
924
- </TabsTrigger>
925
- <TabsTrigger value="default">
926
- {t('templates.sidebar.defaultMode')}
927
- </TabsTrigger>
928
- </TabsList>
929
-
930
- <TabsContent value="assistant">
931
- <div
932
- className="relative h-[600px] border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
933
- style={{ transform: 'translateZ(0)' }}
934
- >
935
- <Sidebar
936
- expanded={true}
937
- width={sidebarWidth}
938
- onToggle={() => {}}
939
- user={{ email: 'admin@xertica.com' }}
940
- onLogout={() => toast(t('templates.sidebar.logoutToast'))}
941
- location={{ pathname: '/assistant/current' }}
942
- navigate={() => {}}
943
- variant="assistant"
944
- search={{
945
- show: true,
946
- placeholder: t('templates.sidebar.searchTopicsPlaceholder'),
947
- }}
948
- fixedArea={{
949
- show: true,
950
- content: (
951
- <Button className="w-full bg-sidebar-primary hover:bg-sidebar-primary/90 text-sidebar-primary-foreground shadow-lg font-bold border-none transition-all duration-300 transform hover:scale-[1.02] active:scale-[0.98]">
952
- <Plus className="w-4 h-4 mr-2" />
953
- {t('templates.sidebar.newConversation')}
954
- </Button>
955
- ),
956
- }}
957
- navigationGroups={[
958
- {
959
- id: 'recent',
960
- label: t('templates.sidebar.recent'),
961
- icon: Clock,
962
- items: [
963
- {
964
- path: '/assistant/refatoracao',
965
- label: t('templates.sidebar.items.sidebarRefactor'),
966
- icon: PanelLeft,
967
- description: t(
968
- 'templates.sidebar.items.sidebarRefactorDescription'
969
- ),
970
- actions: [
971
- {
972
- label: t('templates.sidebar.actions.rename'),
973
- icon: FileEdit,
974
- onClick: () =>
975
- toast(t('templates.sidebar.actions.renameToast')),
976
- },
977
- {
978
- label: t('templates.sidebar.actions.move'),
979
- icon: ArrowRightLeft,
980
- children: [
981
- {
982
- label: t('templates.sidebar.actions.moveActive'),
983
- onClick: () =>
984
- toast(t('templates.sidebar.actions.moveActiveToast')),
985
- },
986
- {
987
- label: t('templates.sidebar.actions.moveMonitoring'),
988
- onClick: () =>
989
- toast(
990
- t('templates.sidebar.actions.moveMonitoringToast')
991
- ),
992
- },
993
- {
994
- label: t('templates.sidebar.actions.moveArchive'),
995
- onClick: () =>
996
- toast(
997
- t('templates.sidebar.actions.moveArchiveToast')
998
- ),
999
- },
1000
- ],
1001
- },
1002
- {
1003
- label: t('templates.sidebar.actions.clear'),
1004
- icon: Trash2,
1005
- onClick: () =>
1006
- toast(t('templates.sidebar.actions.clearToast')),
1007
- variant: 'destructive',
1008
- },
1009
- ],
1010
- },
1011
- ],
1012
- },
1013
- {
1014
- id: 'projects',
1015
- label: t('templates.sidebar.constructionMonitoring'),
1016
- icon: Map,
1017
- actions: [
1018
- {
1019
- label: t('templates.sidebar.actions.newCategory'),
1020
- icon: Plus,
1021
- onClick: () =>
1022
- toast(t('templates.sidebar.actions.newCategoryToast')),
1023
- },
1024
- {
1025
- label: t('templates.sidebar.actions.archiveGroup'),
1026
- icon: Archive,
1027
- onClick: () =>
1028
- toast(t('templates.sidebar.actions.archiveGroupToast')),
1029
- },
1030
- ],
1031
- items: [
1032
- {
1033
- path: '/assistant/br163',
1034
- label: t('templates.sidebar.items.br163Restoration'),
1035
- icon: () => (
1036
- <div className="w-2 h-2 rounded-full bg-yellow-500" />
1037
- ),
1038
- description: (
1039
- <div className="space-y-1.5 min-w-[160px]">
1040
- <Progress
1041
- value={67}
1042
- className="h-1.5 bg-sidebar-foreground/10"
1043
- />
1044
- <div className="flex justify-between items-center text-[10px] text-sidebar-foreground/60">
1045
- <span>{t('templates.sidebar.items.br163Location')}</span>
1046
- <span>67%</span>
1047
- </div>
1048
- </div>
1049
- ),
1050
- },
1051
- ],
1052
- },
1053
- ]}
1054
- />
1055
- <div
1056
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
1057
- style={{ left: `${sidebarWidth}px` }}
1058
- >
1059
- <p className="text-muted-foreground text-center">
1060
- {t('templates.sidebar.assistantContent')}
1061
- </p>
1062
- </div>
1063
- </div>
1064
- </TabsContent>
1065
-
1066
- <TabsContent value="default">
1067
- <div
1068
- className="relative h-[600px] border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
1069
- style={{ transform: 'translateZ(0)' }}
1070
- >
1071
- <Sidebar
1072
- expanded={true}
1073
- width={sidebarWidth}
1074
- onToggle={() => {}}
1075
- user={{
1076
- name: 'Ariel Santos',
1077
- email: 'admin@xertica.com',
1078
- avatar: 'https://github.com/shadcn.png',
1079
- }}
1080
- onLogout={() => toast(t('templates.sidebar.logoutToast'))}
1081
- onSettingsClick={() =>
1082
- toast(t('templates.sidebar.settingsClickedToast'))
1083
- }
1084
- location={{ pathname: '/home' }}
1085
- navigate={() => {}}
1086
- variant="default"
1087
- routes={[
1088
- {
1089
- path: '/home',
1090
- label: t('templates.sidebar.routes.home'),
1091
- icon: Home,
1092
- },
1093
- {
1094
- path: '/dashboard',
1095
- label: t('templates.sidebar.routes.dashboard'),
1096
- icon: Users,
1097
- },
1098
- {
1099
- path: '/settings',
1100
- label: t('templates.sidebar.routes.settings'),
1101
- icon: Settings,
1102
- },
1103
- ]}
1104
- />
1105
- <div
1106
- className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
1107
- style={{ left: `${sidebarWidth}px` }}
1108
- >
1109
- <p className="text-muted-foreground text-center">
1110
- {t('templates.sidebar.defaultContent')}
1111
- </p>
1112
- </div>
1113
- </div>
1114
- </TabsContent>
1115
- </Tabs>
1116
- </CardContent>
1117
- </Card>
1118
- </section>
1119
-
1120
- <Separator className="my-8" />
1121
-
1122
- {/* ── v2.2.1 Components ──────────────────────────────────── */}
1123
- <Separator className="my-8" />
1124
-
1125
- <section>
1126
- <h3 className="mb-4">{t('templates.sections.enhancedComponents')}</h3>
1127
- <div className="space-y-6">
1128
- {/* Pagination com disabled */}
1129
- <Card>
1130
- <CardHeader>
1131
- <CardTitle>{t('templates.enhanced.pagination.title')}</CardTitle>
1132
- <CardDescription>
1133
- <Trans
1134
- i18nKey="templates.enhanced.pagination.description"
1135
- components={{ code: <code className="bg-muted px-1 rounded text-xs" /> }}
1136
- />
1137
- </CardDescription>
1138
- </CardHeader>
1139
- <CardContent className="space-y-4">
1140
- <p className="text-sm text-muted-foreground">
1141
- {t('templates.enhanced.pagination.pageOfTotal', {
1142
- current: currentPage,
1143
- total: totalPages,
1144
- })}
1145
- </p>
1146
- <Pagination>
1147
- <PaginationContent>
1148
- <PaginationItem>
1149
- <PaginationPrevious
1150
- href="#"
1151
- onClick={e => {
1152
- e.preventDefault();
1153
- prev();
1154
- }}
1155
- disabled={!canGoPrev}
1156
- />
1157
- </PaginationItem>
1158
- {items.map(item =>
1159
- item.type === 'ellipsis' ? (
1160
- <PaginationItem key={item.key}>
1161
- <PaginationEllipsis />
1162
- </PaginationItem>
1163
- ) : (
1164
- <PaginationItem key={item.page}>
1165
- <PaginationLink
1166
- href="#"
1167
- isActive={item.page === currentPage}
1168
- onClick={e => {
1169
- e.preventDefault();
1170
- goTo(item.page);
1171
- }}
1172
- >
1173
- {item.page}
1174
- </PaginationLink>
1175
- </PaginationItem>
1176
- )
1177
- )}
1178
- <PaginationItem>
1179
- <PaginationNext
1180
- href="#"
1181
- onClick={e => {
1182
- e.preventDefault();
1183
- next();
1184
- }}
1185
- disabled={!canGoNext}
1186
- />
1187
- </PaginationItem>
1188
- </PaginationContent>
1189
- </Pagination>
1190
- </CardContent>
1191
- </Card>
1192
-
1193
- {/* Stepper com ARIA */}
1194
- <Card>
1195
- <CardHeader>
1196
- <CardTitle>{t('templates.enhanced.stepper.title')}</CardTitle>
1197
- <CardDescription>
1198
- <Trans
1199
- i18nKey="templates.enhanced.stepper.description"
1200
- components={{ code: <code className="bg-muted px-1 rounded text-xs" /> }}
1201
- />
1202
- </CardDescription>
1203
- </CardHeader>
1204
- <CardContent className="space-y-4">
1205
- <Stepper currentStep={currentStep}>
1206
- <Step
1207
- step={1}
1208
- label={t('templates.enhanced.stepper.step1Label')}
1209
- description={t('templates.enhanced.stepper.step1Description')}
1210
- />
1211
- <Step
1212
- step={2}
1213
- label={t('templates.enhanced.stepper.step2Label')}
1214
- description={t('templates.enhanced.stepper.step2Description')}
1215
- />
1216
- <Step
1217
- step={3}
1218
- label={t('templates.enhanced.stepper.step3Label')}
1219
- description={t('templates.enhanced.stepper.step3Description')}
1220
- />
1221
- </Stepper>
1222
- <div className="flex gap-2 pt-2">
1223
- <Button
1224
- variant="outline"
1225
- size="sm"
1226
- onClick={stepPrev}
1227
- disabled={isFirstStep}
1228
- >
1229
- {t('templates.enhanced.stepper.previous')}
1230
- </Button>
1231
- <Button size="sm" onClick={stepNext} disabled={isLastStep}>
1232
- {isLastStep
1233
- ? t('templates.enhanced.stepper.finish')
1234
- : t('templates.enhanced.stepper.next')}
1235
- </Button>
1236
- </div>
1237
- </CardContent>
1238
- </Card>
1239
-
1240
- {/* TreeView com ariaLabel */}
1241
- <Card>
1242
- <CardHeader>
1243
- <CardTitle>{t('templates.enhanced.treeView.title')}</CardTitle>
1244
- <CardDescription>
1245
- <Trans
1246
- i18nKey="templates.enhanced.treeView.description"
1247
- components={{ code: <code className="bg-muted px-1 rounded text-xs" /> }}
1248
- />
1249
- </CardDescription>
1250
- </CardHeader>
1251
- <CardContent>
1252
- <TreeView
1253
- data={treeData}
1254
- aria-label={t('templates.enhanced.treeView.ariaLabel')}
1255
- defaultExpanded={['components', 'ui']}
1256
- onNodeSelect={node =>
1257
- console.log(
1258
- t('templates.enhanced.treeView.selectedConsoleLog'),
1259
- node.label
1260
- )
1261
- }
1262
- className="max-w-xs border border-border rounded-[var(--radius-lg)] p-2"
1263
- />
1264
- </CardContent>
1265
- </Card>
1266
-
1267
- {/* RichTextEditor sem Auto-save */}
1268
- <Card>
1269
- <CardHeader>
1270
- <CardTitle>{t('templates.enhanced.richText.title')}</CardTitle>
1271
- <CardDescription>
1272
- <Trans
1273
- i18nKey="templates.enhanced.richText.description"
1274
- components={{ code: <code className="bg-muted px-1 rounded text-xs" /> }}
1275
- />
1276
- </CardDescription>
1277
- </CardHeader>
1278
- <CardContent className="h-64">
1279
- <RichTextEditor
1280
- value={richText}
1281
- onChange={setRichText}
1282
- placeholder={t('templates.enhanced.richText.placeholder')}
1283
- showWordCount
1284
- showCharacterCount
1285
- allowSearch={false}
1286
- />
1287
- </CardContent>
1288
- </Card>
1289
- </div>
1290
- </section>
1291
-
1292
- {/* Footer Note */}
1293
- <Card className="mt-8">
1294
- <CardHeader>
1295
- <CardTitle>{t('templates.footer.title')}</CardTitle>
1296
- <CardDescription>{t('templates.footer.subtitle')}</CardDescription>
1297
- </CardHeader>
1298
- <CardContent className="space-y-4">
1299
- <p className="text-muted-foreground">
1300
- {t('templates.footer.descriptionPart1')}
1301
- <code className="bg-muted px-2 py-1 rounded-[var(--radius-sm)] [font-size:var(--text-small)]">
1302
- xertica-ui
1303
- </code>
1304
- {t('templates.footer.descriptionPart2')}
1305
- </p>
1306
- <Alert variant="info">
1307
- <AlertTitle>{t('templates.footer.tipTitle')}</AlertTitle>
1308
- <AlertDescription>
1309
- {t('templates.footer.tipDescriptionPart1')}
1310
- <code className="bg-muted px-1 rounded">styles/xertica/tokens.css</code>
1311
- {t('templates.footer.tipDescriptionPart2')}
1312
- </AlertDescription>
1313
- </Alert>
1314
- </CardContent>
1315
- </Card>
1316
- </div>
1317
- </div>
1318
- </ScrollArea>
1319
- </main>
1320
- </div>
1321
- );
1322
- }
1
+ import React, { useState } from 'react';
2
+ import {
3
+ Button,
4
+ Input,
5
+ Label,
6
+ Card,
7
+ CardHeader,
8
+ CardTitle,
9
+ CardDescription,
10
+ CardContent,
11
+ CardFooter,
12
+ Tabs,
13
+ TabsContent,
14
+ TabsList,
15
+ TabsTrigger,
16
+ Badge,
17
+ Alert,
18
+ AlertDescription,
19
+ AlertTitle,
20
+ Checkbox,
21
+ RadioGroup,
22
+ RadioGroupItem,
23
+ Switch,
24
+ Select,
25
+ SelectContent,
26
+ SelectItem,
27
+ SelectTrigger,
28
+ SelectValue,
29
+ Textarea,
30
+ Progress,
31
+ Separator,
32
+ Table,
33
+ TableBody,
34
+ TableCell,
35
+ TableHead,
36
+ TableHeader,
37
+ TableRow,
38
+ Slider,
39
+ Dialog,
40
+ DialogTrigger,
41
+ DialogContent,
42
+ DialogHeader,
43
+ DialogTitle,
44
+ DialogDescription,
45
+ DialogFooter,
46
+ AlertDialog,
47
+ AlertDialogTrigger,
48
+ AlertDialogContent,
49
+ AlertDialogHeader,
50
+ AlertDialogTitle,
51
+ AlertDialogDescription,
52
+ AlertDialogFooter,
53
+ AlertDialogAction,
54
+ AlertDialogCancel,
55
+ Pagination,
56
+ PaginationContent,
57
+ PaginationItem,
58
+ PaginationLink,
59
+ PaginationNext,
60
+ PaginationPrevious,
61
+ PaginationEllipsis,
62
+ Stepper,
63
+ Step,
64
+ TreeView,
65
+ RichTextEditor,
66
+ usePagination,
67
+ useStepper,
68
+ } from 'xertica-ui/ui';
69
+ import { Header, Sidebar } from 'xertica-ui/layout';
70
+ import { useLayout, useTheme } from 'xertica-ui/hooks';
71
+ import { toast } from 'sonner';
72
+ import { Link } from 'react-router-dom';
73
+ import { Trans, useTranslation } from 'react-i18next';
74
+ import {
75
+ Settings,
76
+ User,
77
+ Mail,
78
+ Phone,
79
+ Calendar,
80
+ Search,
81
+ PanelLeft,
82
+ Home,
83
+ Users,
84
+ Plus,
85
+ Trash2,
86
+ Archive,
87
+ ArrowRightLeft,
88
+ FileEdit,
89
+ Clock,
90
+ Map,
91
+ } from 'lucide-react';
92
+
93
+ export function TemplateContent() {
94
+ const { t } = useTranslation();
95
+
96
+ // ── TreeView demo data (built inside the component so labels react to language switches) ──
97
+ const treeData = [
98
+ {
99
+ id: 'components',
100
+ label: t('templates.enhanced.treeView.nodes.components'),
101
+ children: [
102
+ {
103
+ id: 'ui',
104
+ label: t('templates.enhanced.treeView.nodes.ui'),
105
+ children: [
106
+ { id: 'button', label: t('templates.enhanced.treeView.nodes.button') },
107
+ { id: 'input', label: t('templates.enhanced.treeView.nodes.input') },
108
+ { id: 'pagination', label: t('templates.enhanced.treeView.nodes.pagination') },
109
+ ],
110
+ },
111
+ {
112
+ id: 'layout',
113
+ label: t('templates.enhanced.treeView.nodes.layout'),
114
+ children: [
115
+ { id: 'sidebar', label: t('templates.enhanced.treeView.nodes.sidebar') },
116
+ { id: 'header', label: t('templates.enhanced.treeView.nodes.header') },
117
+ ],
118
+ },
119
+ ],
120
+ },
121
+ {
122
+ id: 'hooks',
123
+ label: t('templates.enhanced.treeView.nodes.hooks'),
124
+ // Hook identifiers stay as code — not translated.
125
+ children: [
126
+ { id: 'use-pagination', label: 'usePagination' },
127
+ { id: 'use-stepper', label: 'useStepper' },
128
+ { id: 'use-tree-view', label: 'useTreeView' },
129
+ ],
130
+ },
131
+ ];
132
+ const { sidebarExpanded, sidebarWidth } = useLayout();
133
+ const { disableDarkMode } = useTheme();
134
+ const [progress, setProgress] = useState(45);
135
+ const [sliderValue, setSliderValue] = useState([50]);
136
+ const [switchEnabled, setSwitchEnabled] = useState(false);
137
+ const [richText, setRichText] = useState('');
138
+
139
+ // Dialog demo inputs (controlled so they re-localise on language switch).
140
+ // Seeded lazily from `t(...)` so the initial value reflects the current
141
+ // language at first render; subsequent language switches don't overwrite
142
+ // user edits.
143
+ const [dialogName, setDialogName] = useState(() => t('templates.dialogs.nameDefaultValue'));
144
+ const [dialogUsername, setDialogUsername] = useState(() =>
145
+ t('templates.dialogs.usernameDefaultValue')
146
+ );
147
+
148
+ // ── Pagination demo ─────────────────────────────────────────────────────────
149
+ const { currentPage, totalPages, items, next, prev, goTo, canGoPrev, canGoNext } = usePagination({
150
+ totalItems: 120,
151
+ pageSize: 10,
152
+ });
153
+
154
+ // ── Stepper demo ────────────────────────────────────────────────────────────
155
+ const {
156
+ currentStep,
157
+ next: stepNext,
158
+ prev: stepPrev,
159
+ isFirstStep,
160
+ isLastStep,
161
+ } = useStepper({ totalSteps: 3 });
162
+
163
+ const handleFormSubmit = (e: React.FormEvent) => {
164
+ e.preventDefault();
165
+ toast.success(t('templates.formSubmitSuccess'));
166
+ };
167
+
168
+ return (
169
+ <div
170
+ style={{
171
+ paddingLeft: sidebarExpanded ? `${sidebarWidth}px` : '80px',
172
+ }}
173
+ className="flex-1 flex flex-col overflow-hidden transition-all duration-300"
174
+ >
175
+ <Header
176
+ showThemeToggle={true}
177
+ showLanguageSelector={true}
178
+ breadcrumbs={[
179
+ { label: t('nav.designSystem'), href: '/home' },
180
+ { label: t('templates.breadcrumb') },
181
+ ]}
182
+ renderLink={(href: string, props: any) => <Link to={href} {...props} />}
183
+ />
184
+
185
+ <main className="flex-1 overflow-hidden bg-muted">
186
+ <div className="h-full" style={{ overflowY: 'auto', overflowX: 'hidden' }}>
187
+ <div className="p-5 sm:p-4 md:p-6">
188
+ <div className="max-w-6xl mx-auto space-y-8">
189
+ <div className="space-y-2">
190
+ <h2>{t('templates.title')}</h2>
191
+ <p className="text-muted-foreground">{t('templates.subtitle')}</p>
192
+ </div>
193
+
194
+ {/* Alert Examples */}
195
+ <section>
196
+ <h3 className="mb-4">{t('templates.sections.alerts')}</h3>
197
+ <div className="grid gap-4 md:grid-cols-2">
198
+ <Alert variant="info">
199
+ <AlertTitle>{t('templates.alerts.infoTitle')}</AlertTitle>
200
+ <AlertDescription>{t('templates.alerts.infoDescription')}</AlertDescription>
201
+ </Alert>
202
+
203
+ <Alert variant="destructive">
204
+ <AlertTitle>{t('templates.alerts.errorTitle')}</AlertTitle>
205
+ <AlertDescription>{t('templates.alerts.errorDescription')}</AlertDescription>
206
+ </Alert>
207
+
208
+ <Alert variant="success">
209
+ <AlertTitle>{t('templates.alerts.successTitle')}</AlertTitle>
210
+ <AlertDescription>{t('templates.alerts.successDescription')}</AlertDescription>
211
+ </Alert>
212
+
213
+ <Alert variant="warning">
214
+ <AlertTitle>{t('templates.alerts.warningTitle')}</AlertTitle>
215
+ <AlertDescription>{t('templates.alerts.warningDescription')}</AlertDescription>
216
+ </Alert>
217
+ </div>
218
+ </section>
219
+
220
+ <Separator className="my-8" />
221
+
222
+ {/* Cards & Tabs */}
223
+ <section>
224
+ <h3 className="mb-4">{t('templates.sections.cardsAndTabs')}</h3>
225
+
226
+ <Tabs defaultValue="overview" className="w-full">
227
+ <TabsList className="grid w-full grid-cols-4">
228
+ <TabsTrigger value="overview">{t('templates.tabs.overview')}</TabsTrigger>
229
+ <TabsTrigger value="forms">{t('templates.tabs.forms')}</TabsTrigger>
230
+ <TabsTrigger value="data">{t('templates.tabs.data')}</TabsTrigger>
231
+ <TabsTrigger value="settings">{t('templates.tabs.settings')}</TabsTrigger>
232
+ </TabsList>
233
+
234
+ {/* Overview Tab */}
235
+ <TabsContent value="overview" className="space-y-4">
236
+ <div className="grid gap-4 md:grid-cols-3">
237
+ <Card>
238
+ <CardHeader>
239
+ <CardTitle>{t('stats.totalUsers')}</CardTitle>
240
+ <CardDescription>{t('stats.last30Days')}</CardDescription>
241
+ </CardHeader>
242
+ <CardContent>
243
+ <div className="text-foreground">
244
+ <span className="[font-size:var(--text-stats)] [font-weight:var(--font-weight-bold)]">
245
+ {t('templates.overview.totalUsersDemoValue')}
246
+ </span>
247
+ <Badge variant="default" className="ml-2">
248
+ +12%
249
+ </Badge>
250
+ </div>
251
+ </CardContent>
252
+ </Card>
253
+
254
+ <Card>
255
+ <CardHeader>
256
+ <CardTitle>{t('stats.totalRevenue')}</CardTitle>
257
+ <CardDescription>{t('stats.currentMonth')}</CardDescription>
258
+ </CardHeader>
259
+ <CardContent>
260
+ <div className="text-foreground">
261
+ <span className="[font-size:var(--text-stats)] [font-weight:var(--font-weight-bold)]">
262
+ {t('templates.overview.revenueDemoValue')}
263
+ </span>
264
+ <Badge variant="secondary" className="ml-2">
265
+ +8%
266
+ </Badge>
267
+ </div>
268
+ </CardContent>
269
+ </Card>
270
+
271
+ <Card>
272
+ <CardHeader>
273
+ <CardTitle>{t('stats.conversionRate')}</CardTitle>
274
+ <CardDescription>{t('stats.currentWeek')}</CardDescription>
275
+ </CardHeader>
276
+ <CardContent>
277
+ <div className="text-foreground">
278
+ <span className="[font-size:var(--text-stats)] [font-weight:var(--font-weight-bold)]">
279
+ {t('templates.overview.conversionRateDemoValue')}
280
+ </span>
281
+ <Badge variant="outline" className="ml-2">
282
+ -2%
283
+ </Badge>
284
+ </div>
285
+ </CardContent>
286
+ </Card>
287
+ </div>
288
+
289
+ <Card>
290
+ <CardHeader>
291
+ <CardTitle>{t('templates.overview.progressTitle')}</CardTitle>
292
+ <CardDescription>
293
+ {t('templates.overview.progressDescription')}
294
+ </CardDescription>
295
+ </CardHeader>
296
+ <CardContent className="space-y-6">
297
+ <div className="space-y-2">
298
+ <div className="flex items-center justify-between">
299
+ <Label>{t('templates.overview.projectProgress')}</Label>
300
+ <span className="[font-size:var(--text-small)] text-muted-foreground">
301
+ {progress}%
302
+ </span>
303
+ </div>
304
+ <Progress value={progress} className="w-full" />
305
+ <div className="flex gap-2">
306
+ <Button
307
+ size="sm"
308
+ onClick={() => setProgress(Math.max(0, progress - 10))}
309
+ >
310
+ -10%
311
+ </Button>
312
+ <Button
313
+ size="sm"
314
+ onClick={() => setProgress(Math.min(100, progress + 10))}
315
+ >
316
+ +10%
317
+ </Button>
318
+ </div>
319
+ </div>
320
+
321
+ <Separator />
322
+
323
+ <div className="space-y-2">
324
+ <div className="flex items-center justify-between">
325
+ <Label>{t('templates.overview.volume')}</Label>
326
+ <span className="[font-size:var(--text-small)] text-muted-foreground">
327
+ {sliderValue[0]}%
328
+ </span>
329
+ </div>
330
+ <Slider
331
+ value={sliderValue}
332
+ onValueChange={setSliderValue}
333
+ min={0}
334
+ max={100}
335
+ step={1}
336
+ className="w-full"
337
+ />
338
+ </div>
339
+ </CardContent>
340
+ </Card>
341
+ </TabsContent>
342
+
343
+ {/* Forms Tab */}
344
+ <TabsContent value="forms" className="space-y-4">
345
+ <Card>
346
+ <CardHeader>
347
+ <CardTitle>{t('templates.forms.registrationTitle')}</CardTitle>
348
+ <CardDescription>
349
+ {t('templates.forms.registrationDescription')}
350
+ </CardDescription>
351
+ </CardHeader>
352
+ <CardContent>
353
+ <form onSubmit={handleFormSubmit} className="space-y-4">
354
+ <div className="grid gap-4 md:grid-cols-2">
355
+ <div className="space-y-2">
356
+ <Label htmlFor="firstName">{t('templates.forms.firstName')}</Label>
357
+ <Input
358
+ id="firstName"
359
+ placeholder={t('templates.forms.firstNamePlaceholder')}
360
+ />
361
+ </div>
362
+ <div className="space-y-2">
363
+ <Label htmlFor="lastName">{t('templates.forms.lastName')}</Label>
364
+ <Input
365
+ id="lastName"
366
+ placeholder={t('templates.forms.lastNamePlaceholder')}
367
+ />
368
+ </div>
369
+ </div>
370
+
371
+ <div className="space-y-2">
372
+ <Label htmlFor="email">{t('templates.forms.email')}</Label>
373
+ <div className="relative">
374
+ <Mail className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
375
+ <Input
376
+ id="email"
377
+ type="email"
378
+ placeholder={t('templates.forms.emailPlaceholder')}
379
+ className="pl-10"
380
+ />
381
+ </div>
382
+ </div>
383
+
384
+ <div className="space-y-2">
385
+ <Label htmlFor="phone">{t('templates.forms.phone')}</Label>
386
+ <div className="relative">
387
+ <Phone className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
388
+ <Input
389
+ id="phone"
390
+ type="tel"
391
+ placeholder={t('templates.forms.phonePlaceholder')}
392
+ className="pl-10"
393
+ />
394
+ </div>
395
+ </div>
396
+
397
+ <div className="space-y-2">
398
+ <Label htmlFor="role">{t('templates.forms.role')}</Label>
399
+ <Select>
400
+ <SelectTrigger id="role">
401
+ <SelectValue placeholder={t('templates.forms.rolePlaceholder')} />
402
+ </SelectTrigger>
403
+ <SelectContent>
404
+ <SelectItem value="developer">
405
+ {t('templates.forms.roles.developer')}
406
+ </SelectItem>
407
+ <SelectItem value="designer">
408
+ {t('templates.forms.roles.designer')}
409
+ </SelectItem>
410
+ <SelectItem value="manager">
411
+ {t('templates.forms.roles.manager')}
412
+ </SelectItem>
413
+ <SelectItem value="analyst">
414
+ {t('templates.forms.roles.analyst')}
415
+ </SelectItem>
416
+ </SelectContent>
417
+ </Select>
418
+ </div>
419
+
420
+ <div className="space-y-2">
421
+ <Label htmlFor="bio">{t('templates.forms.bio')}</Label>
422
+ <Textarea
423
+ id="bio"
424
+ placeholder={t('templates.forms.bioPlaceholder')}
425
+ rows={4}
426
+ />
427
+ </div>
428
+
429
+ <Separator />
430
+
431
+ <div className="space-y-4">
432
+ <h4>{t('templates.forms.preferences')}</h4>
433
+
434
+ <div className="space-y-3">
435
+ <div className="flex items-center space-x-2">
436
+ <Checkbox id="newsletter" />
437
+ <Label htmlFor="newsletter" className="font-normal">
438
+ {t('templates.forms.newsletter')}
439
+ </Label>
440
+ </div>
441
+
442
+ <div className="flex items-center space-x-2">
443
+ <Checkbox id="notifications" />
444
+ <Label htmlFor="notifications" className="font-normal">
445
+ {t('templates.forms.pushNotifications')}
446
+ </Label>
447
+ </div>
448
+
449
+ <div className="flex items-center space-x-2">
450
+ <Checkbox id="updates" />
451
+ <Label htmlFor="updates" className="font-normal">
452
+ {t('templates.forms.featureUpdates')}
453
+ </Label>
454
+ </div>
455
+ </div>
456
+
457
+ <Separator />
458
+
459
+ <div className="space-y-3">
460
+ <Label>{t('templates.forms.accountType')}</Label>
461
+ <RadioGroup defaultValue="personal">
462
+ <div className="flex items-center space-x-2">
463
+ <RadioGroupItem value="personal" id="personal" />
464
+ <Label htmlFor="personal" className="font-normal">
465
+ {t('templates.forms.accountPersonal')}
466
+ </Label>
467
+ </div>
468
+ <div className="flex items-center space-x-2">
469
+ <RadioGroupItem value="business" id="business" />
470
+ <Label htmlFor="business" className="font-normal">
471
+ {t('templates.forms.accountBusiness')}
472
+ </Label>
473
+ </div>
474
+ <div className="flex items-center space-x-2">
475
+ <RadioGroupItem value="enterprise" id="enterprise" />
476
+ <Label htmlFor="enterprise" className="font-normal">
477
+ {t('templates.forms.accountEnterprise')}
478
+ </Label>
479
+ </div>
480
+ </RadioGroup>
481
+ </div>
482
+ </div>
483
+ </form>
484
+ </CardContent>
485
+ <CardFooter className="flex justify-between">
486
+ <Button variant="outline">{t('templates.forms.cancel')}</Button>
487
+ <Button onClick={handleFormSubmit}>
488
+ {t('templates.forms.createAccount')}
489
+ </Button>
490
+ </CardFooter>
491
+ </Card>
492
+ </TabsContent>
493
+
494
+ {/* Data Tab */}
495
+ <TabsContent value="data" className="space-y-4">
496
+ <Card>
497
+ <CardHeader>
498
+ <CardTitle>{t('templates.data.title')}</CardTitle>
499
+ <CardDescription>{t('templates.data.description')}</CardDescription>
500
+ </CardHeader>
501
+ <CardContent>
502
+ <div className="mb-4">
503
+ <div className="relative">
504
+ <Search className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
505
+ <Input
506
+ placeholder={t('templates.data.searchPlaceholder')}
507
+ className="pl-10"
508
+ />
509
+ </div>
510
+ </div>
511
+
512
+ <div className="rounded-[var(--radius-lg)] border border-border overflow-hidden">
513
+ <Table>
514
+ <TableHeader>
515
+ <TableRow>
516
+ <TableHead>{t('templates.data.headers.name')}</TableHead>
517
+ <TableHead>{t('templates.data.headers.email')}</TableHead>
518
+ <TableHead>{t('templates.data.headers.role')}</TableHead>
519
+ <TableHead>{t('templates.data.headers.status')}</TableHead>
520
+ <TableHead className="text-right">
521
+ {t('templates.data.headers.actions')}
522
+ </TableHead>
523
+ </TableRow>
524
+ </TableHeader>
525
+ <TableBody>
526
+ <TableRow>
527
+ <TableCell>Ana Silva</TableCell>
528
+ <TableCell>{`ana.silva@${t('templates.data.demoEmailDomain')}`}</TableCell>
529
+ <TableCell>{t('templates.data.roles.developerFemale')}</TableCell>
530
+ <TableCell>
531
+ <Badge variant="default">
532
+ {t('templates.data.status.active')}
533
+ </Badge>
534
+ </TableCell>
535
+ <TableCell className="text-right">
536
+ <Button variant="ghost" size="sm">
537
+ {t('templates.data.edit')}
538
+ </Button>
539
+ </TableCell>
540
+ </TableRow>
541
+ <TableRow>
542
+ <TableCell>Bruno Costa</TableCell>
543
+ <TableCell>{`bruno.costa@${t('templates.data.demoEmailDomain')}`}</TableCell>
544
+ <TableCell>{t('templates.data.roles.designer')}</TableCell>
545
+ <TableCell>
546
+ <Badge variant="default">
547
+ {t('templates.data.status.active')}
548
+ </Badge>
549
+ </TableCell>
550
+ <TableCell className="text-right">
551
+ <Button variant="ghost" size="sm">
552
+ {t('templates.data.edit')}
553
+ </Button>
554
+ </TableCell>
555
+ </TableRow>
556
+ <TableRow>
557
+ <TableCell>Carla Oliveira</TableCell>
558
+ <TableCell>{`carla.oliveira@${t('templates.data.demoEmailDomain')}`}</TableCell>
559
+ <TableCell>{t('templates.data.roles.manager')}</TableCell>
560
+ <TableCell>
561
+ <Badge variant="secondary">
562
+ {t('templates.data.status.away')}
563
+ </Badge>
564
+ </TableCell>
565
+ <TableCell className="text-right">
566
+ <Button variant="ghost" size="sm">
567
+ {t('templates.data.edit')}
568
+ </Button>
569
+ </TableCell>
570
+ </TableRow>
571
+ <TableRow>
572
+ <TableCell>Diego Santos</TableCell>
573
+ <TableCell>{`diego.santos@${t('templates.data.demoEmailDomain')}`}</TableCell>
574
+ <TableCell>{t('templates.data.roles.analyst')}</TableCell>
575
+ <TableCell>
576
+ <Badge variant="outline">
577
+ {t('templates.data.status.inactive')}
578
+ </Badge>
579
+ </TableCell>
580
+ <TableCell className="text-right">
581
+ <Button variant="ghost" size="sm">
582
+ {t('templates.data.edit')}
583
+ </Button>
584
+ </TableCell>
585
+ </TableRow>
586
+ </TableBody>
587
+ </Table>
588
+ </div>
589
+ </CardContent>
590
+ <CardFooter className="flex justify-between items-center">
591
+ <p className="text-muted-foreground">
592
+ {t('templates.data.showing', { count: 4, total: 127 })}
593
+ </p>
594
+ <div className="flex gap-2">
595
+ <Button variant="outline" size="sm">
596
+ {t('templates.data.previous')}
597
+ </Button>
598
+ <Button variant="outline" size="sm">
599
+ {t('templates.data.next')}
600
+ </Button>
601
+ </div>
602
+ </CardFooter>
603
+ </Card>
604
+ </TabsContent>
605
+
606
+ {/* Settings Tab */}
607
+ <TabsContent value="settings" className="space-y-4">
608
+ <Card>
609
+ <CardHeader>
610
+ <CardTitle>{t('templates.settings.title')}</CardTitle>
611
+ <CardDescription>{t('templates.settings.description')}</CardDescription>
612
+ </CardHeader>
613
+ <CardContent className="space-y-6">
614
+ {!disableDarkMode && (
615
+ <>
616
+ <div className="flex items-center justify-between">
617
+ <div className="space-y-1">
618
+ <Label>{t('templates.settings.darkMode')}</Label>
619
+ <p className="text-muted-foreground">
620
+ {t('templates.settings.darkModeDescription')}
621
+ </p>
622
+ </div>
623
+ <Switch checked={switchEnabled} onCheckedChange={setSwitchEnabled} />
624
+ </div>
625
+
626
+ <Separator />
627
+ </>
628
+ )}
629
+
630
+ <div className="flex items-center justify-between">
631
+ <div className="space-y-1">
632
+ <Label>{t('templates.settings.emailNotifications')}</Label>
633
+ <p className="text-muted-foreground">
634
+ {t('templates.settings.emailNotificationsDescription')}
635
+ </p>
636
+ </div>
637
+ <Switch defaultChecked />
638
+ </div>
639
+
640
+ <Separator />
641
+
642
+ <div className="flex items-center justify-between">
643
+ <div className="space-y-1">
644
+ <Label>{t('templates.settings.pushNotifications')}</Label>
645
+ <p className="text-muted-foreground">
646
+ {t('templates.settings.pushNotificationsDescription')}
647
+ </p>
648
+ </div>
649
+ <Switch />
650
+ </div>
651
+
652
+ <Separator />
653
+
654
+ <div className="space-y-3">
655
+ <Label>{t('templates.settings.language')}</Label>
656
+ <Select defaultValue="pt-br">
657
+ <SelectTrigger>
658
+ <SelectValue />
659
+ </SelectTrigger>
660
+ <SelectContent>
661
+ <SelectItem value="pt-br">
662
+ {t('templates.settings.languages.ptBR')}
663
+ </SelectItem>
664
+ <SelectItem value="en">
665
+ {t('templates.settings.languages.en')}
666
+ </SelectItem>
667
+ <SelectItem value="es">
668
+ {t('templates.settings.languages.es')}
669
+ </SelectItem>
670
+ </SelectContent>
671
+ </Select>
672
+ </div>
673
+
674
+ <Separator />
675
+
676
+ <div className="space-y-3">
677
+ <Label>{t('templates.settings.timezone')}</Label>
678
+ <Select defaultValue="america-sao-paulo">
679
+ <SelectTrigger>
680
+ <SelectValue />
681
+ </SelectTrigger>
682
+ <SelectContent>
683
+ <SelectItem value="america-sao-paulo">
684
+ {t('templates.settings.timezones.saoPaulo')}
685
+ </SelectItem>
686
+ <SelectItem value="america-new-york">
687
+ {t('templates.settings.timezones.newYork')}
688
+ </SelectItem>
689
+ <SelectItem value="europe-london">
690
+ {t('templates.settings.timezones.london')}
691
+ </SelectItem>
692
+ </SelectContent>
693
+ </Select>
694
+ </div>
695
+ </CardContent>
696
+ <CardFooter className="flex justify-between">
697
+ <Button variant="outline">{t('templates.settings.restoreDefaults')}</Button>
698
+ <Button>{t('templates.settings.saveChanges')}</Button>
699
+ </CardFooter>
700
+ </Card>
701
+ </TabsContent>
702
+ </Tabs>
703
+ </section>
704
+
705
+ <Separator className="my-8" />
706
+
707
+ {/* Button Variants */}
708
+ <section>
709
+ <h3 className="mb-4">{t('templates.sections.buttons')}</h3>
710
+ <Card>
711
+ <CardHeader>
712
+ <CardTitle>{t('templates.buttons.title')}</CardTitle>
713
+ <CardDescription>{t('templates.buttons.description')}</CardDescription>
714
+ </CardHeader>
715
+ <CardContent className="space-y-6">
716
+ <div className="space-y-3">
717
+ <Label>{t('templates.buttons.variants')}</Label>
718
+ <div className="flex flex-wrap gap-3">
719
+ <Button variant="default">
720
+ {t('templates.buttons.variantLabels.default')}
721
+ </Button>
722
+ <Button variant="secondary">
723
+ {t('templates.buttons.variantLabels.secondary')}
724
+ </Button>
725
+ <Button variant="outline">
726
+ {t('templates.buttons.variantLabels.outline')}
727
+ </Button>
728
+ <Button variant="ghost">
729
+ {t('templates.buttons.variantLabels.ghost')}
730
+ </Button>
731
+ <Button variant="link">{t('templates.buttons.variantLabels.link')}</Button>
732
+ <Button variant="destructive">
733
+ {t('templates.buttons.variantLabels.destructive')}
734
+ </Button>
735
+ </div>
736
+ </div>
737
+
738
+ <Separator />
739
+
740
+ <div className="space-y-3">
741
+ <Label>{t('templates.buttons.sizes')}</Label>
742
+ <div className="flex flex-wrap items-center gap-3">
743
+ <Button size="sm">{t('templates.buttons.sizeLabels.small')}</Button>
744
+ <Button size="default">{t('templates.buttons.sizeLabels.default')}</Button>
745
+ <Button size="lg">{t('templates.buttons.sizeLabels.large')}</Button>
746
+ <Button size="icon">
747
+ <Settings className="h-4 w-4" />
748
+ </Button>
749
+ </div>
750
+ </div>
751
+
752
+ <Separator />
753
+
754
+ <div className="space-y-3">
755
+ <Label>{t('templates.buttons.withIcons')}</Label>
756
+ <div className="flex flex-wrap gap-3">
757
+ <Button>
758
+ <User className="mr-2 h-4 w-4" />
759
+ {t('templates.buttons.profile')}
760
+ </Button>
761
+ <Button variant="secondary">
762
+ <Mail className="mr-2 h-4 w-4" />
763
+ {t('templates.buttons.messages')}
764
+ </Button>
765
+ <Button variant="outline">
766
+ <Calendar className="mr-2 h-4 w-4" />
767
+ {t('templates.buttons.schedule')}
768
+ </Button>
769
+ </div>
770
+ </div>
771
+
772
+ <Separator />
773
+
774
+ <div className="space-y-3">
775
+ <Label>{t('templates.buttons.states')}</Label>
776
+ <div className="flex flex-wrap gap-3">
777
+ <Button disabled>{t('templates.buttons.disabled')}</Button>
778
+ <Button variant="outline" disabled>
779
+ {t('templates.buttons.outlineDisabled')}
780
+ </Button>
781
+ </div>
782
+ </div>
783
+ </CardContent>
784
+ </Card>
785
+ </section>
786
+
787
+ <Separator className="my-8" />
788
+
789
+ {/* Badges */}
790
+ <section>
791
+ <h3 className="mb-4">{t('templates.sections.badges')}</h3>
792
+ <Card>
793
+ <CardHeader>
794
+ <CardTitle>{t('templates.badges.title')}</CardTitle>
795
+ <CardDescription>{t('templates.badges.description')}</CardDescription>
796
+ </CardHeader>
797
+ <CardContent>
798
+ <div className="flex flex-wrap gap-3">
799
+ <Badge variant="default">{t('templates.badges.labels.default')}</Badge>
800
+ <Badge variant="secondary">{t('templates.badges.labels.secondary')}</Badge>
801
+ <Badge variant="outline">{t('templates.badges.labels.outline')}</Badge>
802
+ <Badge variant="destructive">
803
+ {t('templates.badges.labels.destructive')}
804
+ </Badge>
805
+ <Badge className="bg-success text-success-foreground">
806
+ {t('templates.badges.labels.success')}
807
+ </Badge>
808
+ <Badge className="bg-warning text-warning-foreground">
809
+ {t('templates.badges.labels.warning')}
810
+ </Badge>
811
+ <Badge className="bg-info text-info-foreground">
812
+ {t('templates.badges.labels.info')}
813
+ </Badge>
814
+ </div>
815
+ </CardContent>
816
+ </Card>
817
+ </section>
818
+
819
+ <Separator className="my-8" />
820
+
821
+ {/* Dialogs */}
822
+ <section>
823
+ <h3 className="mb-4">{t('templates.sections.dialogs')}</h3>
824
+ <div className="grid gap-4 md:grid-cols-2">
825
+ <Card>
826
+ <CardHeader>
827
+ <CardTitle>{t('templates.dialogs.dialogTitle')}</CardTitle>
828
+ <CardDescription>{t('templates.dialogs.dialogDescription')}</CardDescription>
829
+ </CardHeader>
830
+ <CardContent className="flex justify-center py-6">
831
+ <Dialog>
832
+ <DialogTrigger asChild>
833
+ <Button variant="outline">{t('templates.dialogs.editProfile')}</Button>
834
+ </DialogTrigger>
835
+ <DialogContent className="sm:max-w-[425px]">
836
+ <DialogHeader>
837
+ <DialogTitle>{t('templates.dialogs.editProfile')}</DialogTitle>
838
+ <DialogDescription>
839
+ {t('templates.dialogs.editProfileDescription')}
840
+ </DialogDescription>
841
+ </DialogHeader>
842
+ <div className="grid gap-4 py-4">
843
+ <div className="grid grid-cols-4 items-center gap-4">
844
+ <Label htmlFor="name" className="text-right">
845
+ {t('templates.dialogs.name')}
846
+ </Label>
847
+ <Input
848
+ id="name"
849
+ value={dialogName}
850
+ onChange={e => setDialogName(e.target.value)}
851
+ className="col-span-3"
852
+ />
853
+ </div>
854
+ <div className="grid grid-cols-4 items-center gap-4">
855
+ <Label htmlFor="username" className="text-right">
856
+ {t('templates.dialogs.username')}
857
+ </Label>
858
+ <Input
859
+ id="username"
860
+ value={dialogUsername}
861
+ onChange={e => setDialogUsername(e.target.value)}
862
+ className="col-span-3"
863
+ />
864
+ </div>
865
+ </div>
866
+ <DialogFooter>
867
+ <Button type="submit">{t('templates.dialogs.update')}</Button>
868
+ </DialogFooter>
869
+ </DialogContent>
870
+ </Dialog>
871
+ </CardContent>
872
+ </Card>
873
+
874
+ <Card>
875
+ <CardHeader>
876
+ <CardTitle>{t('templates.dialogs.alertDialogTitle')}</CardTitle>
877
+ <CardDescription>
878
+ {t('templates.dialogs.alertDialogDescription')}
879
+ </CardDescription>
880
+ </CardHeader>
881
+ <CardContent className="flex justify-center py-6">
882
+ <AlertDialog>
883
+ <AlertDialogTrigger asChild>
884
+ <Button variant="destructive">
885
+ {t('templates.dialogs.deleteAccount')}
886
+ </Button>
887
+ </AlertDialogTrigger>
888
+ <AlertDialogContent className="sm:max-w-[425px]">
889
+ <AlertDialogHeader>
890
+ <AlertDialogTitle>{t('templates.dialogs.areYouSure')}</AlertDialogTitle>
891
+ <AlertDialogDescription>
892
+ {t('templates.dialogs.deleteWarning')}
893
+ </AlertDialogDescription>
894
+ </AlertDialogHeader>
895
+ <AlertDialogFooter>
896
+ <AlertDialogCancel>{t('templates.dialogs.cancel')}</AlertDialogCancel>
897
+ <AlertDialogAction className="bg-destructive text-destructive-foreground hover:bg-destructive/90">
898
+ {t('templates.dialogs.continue')}
899
+ </AlertDialogAction>
900
+ </AlertDialogFooter>
901
+ </AlertDialogContent>
902
+ </AlertDialog>
903
+ </CardContent>
904
+ </Card>
905
+ </div>
906
+ </section>
907
+
908
+ <Separator className="my-8" />
909
+
910
+ {/* Sidebar Variations */}
911
+ <section>
912
+ <h3 className="mb-4">{t('templates.sections.sidebarVariations')}</h3>
913
+ <Card>
914
+ <CardHeader>
915
+ <CardTitle>{t('templates.sidebar.title')}</CardTitle>
916
+ <CardDescription>{t('templates.sidebar.description')}</CardDescription>
917
+ </CardHeader>
918
+ <CardContent>
919
+ <Tabs defaultValue="assistant" className="w-full">
920
+ <TabsList className="mb-4">
921
+ <TabsTrigger value="assistant">
922
+ {t('templates.sidebar.assistantMode')}
923
+ </TabsTrigger>
924
+ <TabsTrigger value="default">
925
+ {t('templates.sidebar.defaultMode')}
926
+ </TabsTrigger>
927
+ </TabsList>
928
+
929
+ <TabsContent value="assistant">
930
+ <div
931
+ className="relative h-[600px] border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
932
+ style={{ transform: 'translateZ(0)' }}
933
+ >
934
+ <Sidebar
935
+ expanded={true}
936
+ width={sidebarWidth}
937
+ onToggle={() => {}}
938
+ user={{ email: 'admin@xertica.com' }}
939
+ onLogout={() => toast(t('templates.sidebar.logoutToast'))}
940
+ location={{ pathname: '/assistant/current' }}
941
+ navigate={() => {}}
942
+ variant="assistant"
943
+ search={{
944
+ show: true,
945
+ placeholder: t('templates.sidebar.searchTopicsPlaceholder'),
946
+ }}
947
+ fixedArea={{
948
+ show: true,
949
+ content: (
950
+ <Button className="w-full bg-sidebar-primary hover:bg-sidebar-primary/90 text-sidebar-primary-foreground shadow-lg font-bold border-none transition-all duration-300 transform hover:scale-[1.02] active:scale-[0.98]">
951
+ <Plus className="w-4 h-4 mr-2" />
952
+ {t('templates.sidebar.newConversation')}
953
+ </Button>
954
+ ),
955
+ }}
956
+ navigationGroups={[
957
+ {
958
+ id: 'recent',
959
+ label: t('templates.sidebar.recent'),
960
+ icon: Clock,
961
+ items: [
962
+ {
963
+ path: '/assistant/refatoracao',
964
+ label: t('templates.sidebar.items.sidebarRefactor'),
965
+ icon: PanelLeft,
966
+ description: t(
967
+ 'templates.sidebar.items.sidebarRefactorDescription'
968
+ ),
969
+ actions: [
970
+ {
971
+ label: t('templates.sidebar.actions.rename'),
972
+ icon: FileEdit,
973
+ onClick: () =>
974
+ toast(t('templates.sidebar.actions.renameToast')),
975
+ },
976
+ {
977
+ label: t('templates.sidebar.actions.move'),
978
+ icon: ArrowRightLeft,
979
+ children: [
980
+ {
981
+ label: t('templates.sidebar.actions.moveActive'),
982
+ onClick: () =>
983
+ toast(t('templates.sidebar.actions.moveActiveToast')),
984
+ },
985
+ {
986
+ label: t('templates.sidebar.actions.moveMonitoring'),
987
+ onClick: () =>
988
+ toast(
989
+ t('templates.sidebar.actions.moveMonitoringToast')
990
+ ),
991
+ },
992
+ {
993
+ label: t('templates.sidebar.actions.moveArchive'),
994
+ onClick: () =>
995
+ toast(
996
+ t('templates.sidebar.actions.moveArchiveToast')
997
+ ),
998
+ },
999
+ ],
1000
+ },
1001
+ {
1002
+ label: t('templates.sidebar.actions.clear'),
1003
+ icon: Trash2,
1004
+ onClick: () =>
1005
+ toast(t('templates.sidebar.actions.clearToast')),
1006
+ variant: 'destructive',
1007
+ },
1008
+ ],
1009
+ },
1010
+ ],
1011
+ },
1012
+ {
1013
+ id: 'projects',
1014
+ label: t('templates.sidebar.constructionMonitoring'),
1015
+ icon: Map,
1016
+ actions: [
1017
+ {
1018
+ label: t('templates.sidebar.actions.newCategory'),
1019
+ icon: Plus,
1020
+ onClick: () =>
1021
+ toast(t('templates.sidebar.actions.newCategoryToast')),
1022
+ },
1023
+ {
1024
+ label: t('templates.sidebar.actions.archiveGroup'),
1025
+ icon: Archive,
1026
+ onClick: () =>
1027
+ toast(t('templates.sidebar.actions.archiveGroupToast')),
1028
+ },
1029
+ ],
1030
+ items: [
1031
+ {
1032
+ path: '/assistant/br163',
1033
+ label: t('templates.sidebar.items.br163Restoration'),
1034
+ icon: () => (
1035
+ <div className="w-2 h-2 rounded-full bg-yellow-500" />
1036
+ ),
1037
+ description: (
1038
+ <div className="space-y-1.5 min-w-[160px]">
1039
+ <Progress
1040
+ value={67}
1041
+ className="h-1.5 bg-sidebar-foreground/10"
1042
+ />
1043
+ <div className="flex justify-between items-center text-[10px] text-sidebar-foreground/60">
1044
+ <span>{t('templates.sidebar.items.br163Location')}</span>
1045
+ <span>67%</span>
1046
+ </div>
1047
+ </div>
1048
+ ),
1049
+ },
1050
+ ],
1051
+ },
1052
+ ]}
1053
+ />
1054
+ <div
1055
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
1056
+ style={{ left: `${sidebarWidth}px` }}
1057
+ >
1058
+ <p className="text-muted-foreground text-center">
1059
+ {t('templates.sidebar.assistantContent')}
1060
+ </p>
1061
+ </div>
1062
+ </div>
1063
+ </TabsContent>
1064
+
1065
+ <TabsContent value="default">
1066
+ <div
1067
+ className="relative h-[600px] border rounded-[var(--radius-lg)] bg-muted/20 overflow-hidden"
1068
+ style={{ transform: 'translateZ(0)' }}
1069
+ >
1070
+ <Sidebar
1071
+ expanded={true}
1072
+ width={sidebarWidth}
1073
+ onToggle={() => {}}
1074
+ user={{
1075
+ name: 'Ariel Santos',
1076
+ email: 'admin@xertica.com',
1077
+ avatar: 'https://github.com/shadcn.png',
1078
+ }}
1079
+ onLogout={() => toast(t('templates.sidebar.logoutToast'))}
1080
+ onSettingsClick={() =>
1081
+ toast(t('templates.sidebar.settingsClickedToast'))
1082
+ }
1083
+ location={{ pathname: '/home' }}
1084
+ navigate={() => {}}
1085
+ variant="default"
1086
+ routes={[
1087
+ {
1088
+ path: '/home',
1089
+ label: t('templates.sidebar.routes.home'),
1090
+ icon: Home,
1091
+ },
1092
+ {
1093
+ path: '/dashboard',
1094
+ label: t('templates.sidebar.routes.dashboard'),
1095
+ icon: Users,
1096
+ },
1097
+ {
1098
+ path: '/settings',
1099
+ label: t('templates.sidebar.routes.settings'),
1100
+ icon: Settings,
1101
+ },
1102
+ ]}
1103
+ />
1104
+ <div
1105
+ className="absolute inset-y-0 right-0 p-8 flex items-center justify-center transition-all duration-300"
1106
+ style={{ left: `${sidebarWidth}px` }}
1107
+ >
1108
+ <p className="text-muted-foreground text-center">
1109
+ {t('templates.sidebar.defaultContent')}
1110
+ </p>
1111
+ </div>
1112
+ </div>
1113
+ </TabsContent>
1114
+ </Tabs>
1115
+ </CardContent>
1116
+ </Card>
1117
+ </section>
1118
+
1119
+ <Separator className="my-8" />
1120
+
1121
+ {/* ── v2.2.1 Components ──────────────────────────────────── */}
1122
+ <Separator className="my-8" />
1123
+
1124
+ <section>
1125
+ <h3 className="mb-4">{t('templates.sections.enhancedComponents')}</h3>
1126
+ <div className="space-y-6">
1127
+ {/* Pagination com disabled */}
1128
+ <Card>
1129
+ <CardHeader>
1130
+ <CardTitle>{t('templates.enhanced.pagination.title')}</CardTitle>
1131
+ <CardDescription>
1132
+ <Trans
1133
+ i18nKey="templates.enhanced.pagination.description"
1134
+ components={{ code: <code className="bg-muted px-1 rounded text-xs" /> }}
1135
+ />
1136
+ </CardDescription>
1137
+ </CardHeader>
1138
+ <CardContent className="space-y-4">
1139
+ <p className="text-sm text-muted-foreground">
1140
+ {t('templates.enhanced.pagination.pageOfTotal', {
1141
+ current: currentPage,
1142
+ total: totalPages,
1143
+ })}
1144
+ </p>
1145
+ <Pagination>
1146
+ <PaginationContent>
1147
+ <PaginationItem>
1148
+ <PaginationPrevious
1149
+ href="#"
1150
+ onClick={e => {
1151
+ e.preventDefault();
1152
+ prev();
1153
+ }}
1154
+ disabled={!canGoPrev}
1155
+ />
1156
+ </PaginationItem>
1157
+ {items.map(item =>
1158
+ item.type === 'ellipsis' ? (
1159
+ <PaginationItem key={item.key}>
1160
+ <PaginationEllipsis />
1161
+ </PaginationItem>
1162
+ ) : (
1163
+ <PaginationItem key={item.page}>
1164
+ <PaginationLink
1165
+ href="#"
1166
+ isActive={item.page === currentPage}
1167
+ onClick={e => {
1168
+ e.preventDefault();
1169
+ goTo(item.page);
1170
+ }}
1171
+ >
1172
+ {item.page}
1173
+ </PaginationLink>
1174
+ </PaginationItem>
1175
+ )
1176
+ )}
1177
+ <PaginationItem>
1178
+ <PaginationNext
1179
+ href="#"
1180
+ onClick={e => {
1181
+ e.preventDefault();
1182
+ next();
1183
+ }}
1184
+ disabled={!canGoNext}
1185
+ />
1186
+ </PaginationItem>
1187
+ </PaginationContent>
1188
+ </Pagination>
1189
+ </CardContent>
1190
+ </Card>
1191
+
1192
+ {/* Stepper com ARIA */}
1193
+ <Card>
1194
+ <CardHeader>
1195
+ <CardTitle>{t('templates.enhanced.stepper.title')}</CardTitle>
1196
+ <CardDescription>
1197
+ <Trans
1198
+ i18nKey="templates.enhanced.stepper.description"
1199
+ components={{ code: <code className="bg-muted px-1 rounded text-xs" /> }}
1200
+ />
1201
+ </CardDescription>
1202
+ </CardHeader>
1203
+ <CardContent className="space-y-4">
1204
+ <Stepper currentStep={currentStep}>
1205
+ <Step
1206
+ step={1}
1207
+ label={t('templates.enhanced.stepper.step1Label')}
1208
+ description={t('templates.enhanced.stepper.step1Description')}
1209
+ />
1210
+ <Step
1211
+ step={2}
1212
+ label={t('templates.enhanced.stepper.step2Label')}
1213
+ description={t('templates.enhanced.stepper.step2Description')}
1214
+ />
1215
+ <Step
1216
+ step={3}
1217
+ label={t('templates.enhanced.stepper.step3Label')}
1218
+ description={t('templates.enhanced.stepper.step3Description')}
1219
+ />
1220
+ </Stepper>
1221
+ <div className="flex gap-2 pt-2">
1222
+ <Button
1223
+ variant="outline"
1224
+ size="sm"
1225
+ onClick={stepPrev}
1226
+ disabled={isFirstStep}
1227
+ >
1228
+ {t('templates.enhanced.stepper.previous')}
1229
+ </Button>
1230
+ <Button size="sm" onClick={stepNext} disabled={isLastStep}>
1231
+ {isLastStep
1232
+ ? t('templates.enhanced.stepper.finish')
1233
+ : t('templates.enhanced.stepper.next')}
1234
+ </Button>
1235
+ </div>
1236
+ </CardContent>
1237
+ </Card>
1238
+
1239
+ {/* TreeView com ariaLabel */}
1240
+ <Card>
1241
+ <CardHeader>
1242
+ <CardTitle>{t('templates.enhanced.treeView.title')}</CardTitle>
1243
+ <CardDescription>
1244
+ <Trans
1245
+ i18nKey="templates.enhanced.treeView.description"
1246
+ components={{ code: <code className="bg-muted px-1 rounded text-xs" /> }}
1247
+ />
1248
+ </CardDescription>
1249
+ </CardHeader>
1250
+ <CardContent>
1251
+ <TreeView
1252
+ data={treeData}
1253
+ aria-label={t('templates.enhanced.treeView.ariaLabel')}
1254
+ defaultExpanded={['components', 'ui']}
1255
+ onNodeSelect={node =>
1256
+ console.log(
1257
+ t('templates.enhanced.treeView.selectedConsoleLog'),
1258
+ node.label
1259
+ )
1260
+ }
1261
+ className="max-w-xs border border-border rounded-[var(--radius-lg)] p-2"
1262
+ />
1263
+ </CardContent>
1264
+ </Card>
1265
+
1266
+ {/* RichTextEditor sem Auto-save */}
1267
+ <Card>
1268
+ <CardHeader>
1269
+ <CardTitle>{t('templates.enhanced.richText.title')}</CardTitle>
1270
+ <CardDescription>
1271
+ <Trans
1272
+ i18nKey="templates.enhanced.richText.description"
1273
+ components={{ code: <code className="bg-muted px-1 rounded text-xs" /> }}
1274
+ />
1275
+ </CardDescription>
1276
+ </CardHeader>
1277
+ <CardContent className="h-64">
1278
+ <RichTextEditor
1279
+ value={richText}
1280
+ onChange={setRichText}
1281
+ placeholder={t('templates.enhanced.richText.placeholder')}
1282
+ showWordCount
1283
+ showCharacterCount
1284
+ allowSearch={false}
1285
+ />
1286
+ </CardContent>
1287
+ </Card>
1288
+ </div>
1289
+ </section>
1290
+
1291
+ {/* Footer Note */}
1292
+ <Card className="mt-8">
1293
+ <CardHeader>
1294
+ <CardTitle>{t('templates.footer.title')}</CardTitle>
1295
+ <CardDescription>{t('templates.footer.subtitle')}</CardDescription>
1296
+ </CardHeader>
1297
+ <CardContent className="space-y-4">
1298
+ <p className="text-muted-foreground">
1299
+ {t('templates.footer.descriptionPart1')}
1300
+ <code className="bg-muted px-2 py-1 rounded-[var(--radius-sm)] [font-size:var(--text-small)]">
1301
+ xertica-ui
1302
+ </code>
1303
+ {t('templates.footer.descriptionPart2')}
1304
+ </p>
1305
+ <Alert variant="info">
1306
+ <AlertTitle>{t('templates.footer.tipTitle')}</AlertTitle>
1307
+ <AlertDescription>
1308
+ {t('templates.footer.tipDescriptionPart1')}
1309
+ <code className="bg-muted px-1 rounded">styles/xertica/tokens.css</code>
1310
+ {t('templates.footer.tipDescriptionPart2')}
1311
+ </AlertDescription>
1312
+ </Alert>
1313
+ </CardContent>
1314
+ </Card>
1315
+ </div>
1316
+ </div>
1317
+ </div>
1318
+ </main>
1319
+ </div>
1320
+ );
1321
+ }