create-modoock-app 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/cli.js +52 -0
  2. package/package.json +21 -0
  3. package/template/.cursor/agents/code-reviewer.md +25 -0
  4. package/template/.cursor/rules/agents.mdc +9 -0
  5. package/template/.cursor/rules/honey.mdc +226 -0
  6. package/template/.cursor/rules/ui.mdc +18 -0
  7. package/template/.cursor/skills/debug/SKILL.md +29 -0
  8. package/template/.dcdignore +3 -0
  9. package/template/AGENTS.md +89 -0
  10. package/template/CLAUDE.md +2 -0
  11. package/template/README.md +339 -0
  12. package/template/app/(local)/components/page.tsx +886 -0
  13. package/template/app/(local)/design-system/page.tsx +1140 -0
  14. package/template/app/(local)/layout.tsx +5 -0
  15. package/template/app/(local)/page.tsx +59 -0
  16. package/template/app/auth/layout.tsx +7 -0
  17. package/template/app/auth/login/page.tsx +76 -0
  18. package/template/app/favicon.ico +0 -0
  19. package/template/app/globals.css +365 -0
  20. package/template/app/layout.tsx +28 -0
  21. package/template/components/layout/app-layout.tsx +30 -0
  22. package/template/components/layout/header.tsx +72 -0
  23. package/template/components/layout/index.ts +3 -0
  24. package/template/components/layout/side-nav.tsx +163 -0
  25. package/template/components/shared/detail-header.tsx +39 -0
  26. package/template/components/shared/index.ts +8 -0
  27. package/template/components/shared/info-card.tsx +75 -0
  28. package/template/components/shared/summary-card.tsx +31 -0
  29. package/template/components/shared/table-section.tsx +38 -0
  30. package/template/components/shared/timeline-list.tsx +31 -0
  31. package/template/components/ui/action-stack.tsx +42 -0
  32. package/template/components/ui/badge.tsx +43 -0
  33. package/template/components/ui/button.tsx +104 -0
  34. package/template/components/ui/icon.tsx +78 -0
  35. package/template/components/ui/index.ts +28 -0
  36. package/template/components/ui/input.tsx +376 -0
  37. package/template/components/ui/loader.tsx +78 -0
  38. package/template/components/ui/metric-bar.tsx +49 -0
  39. package/template/components/ui/modal.tsx +177 -0
  40. package/template/components/ui/select.tsx +458 -0
  41. package/template/components/ui/stepper.tsx +96 -0
  42. package/template/components/ui/tab.tsx +85 -0
  43. package/template/components/ui/user-table.tsx +806 -0
  44. package/template/eslint.config.mjs +18 -0
  45. package/template/knowledge-base/design-system/components/action-stack.mdc +17 -0
  46. package/template/knowledge-base/design-system/components/badges.mdc +16 -0
  47. package/template/knowledge-base/design-system/components/buttons.mdc +21 -0
  48. package/template/knowledge-base/design-system/components/detail-header.mdc +17 -0
  49. package/template/knowledge-base/design-system/components/dropdowns.mdc +12 -0
  50. package/template/knowledge-base/design-system/components/info-list.mdc +17 -0
  51. package/template/knowledge-base/design-system/components/inputs.mdc +23 -0
  52. package/template/knowledge-base/design-system/components/menu.mdc +20 -0
  53. package/template/knowledge-base/design-system/components/modals.mdc +24 -0
  54. package/template/knowledge-base/design-system/components/selects.mdc +39 -0
  55. package/template/knowledge-base/design-system/components/stepper.mdc +18 -0
  56. package/template/knowledge-base/design-system/components/tables.mdc +59 -0
  57. package/template/knowledge-base/design-system/components/tabs.mdc +17 -0
  58. package/template/knowledge-base/design-system/components.mdc +91 -0
  59. package/template/knowledge-base/design-system/tokens.mdc +24 -0
  60. package/template/knowledge-base/examples/bad/README.md +8 -0
  61. package/template/knowledge-base/examples/good/README.md +13 -0
  62. package/template/knowledge-base/metadata/catalog.yaml +245 -0
  63. package/template/knowledge-base/patterns/components/reuse-existing.mdc +26 -0
  64. package/template/knowledge-base/patterns/data-fetching/local-data.mdc +20 -0
  65. package/template/knowledge-base/patterns/layouts/app-shell.mdc +20 -0
  66. package/template/knowledge-base/patterns/pages/data-table-page.mdc +31 -0
  67. package/template/knowledge-base/patterns/pages/workflow-page.mdc +27 -0
  68. package/template/knowledge-base/rules/accessibility/responsive.mdc +31 -0
  69. package/template/knowledge-base/rules/architecture/layout.mdc +52 -0
  70. package/template/knowledge-base/rules/architecture/single-screen.mdc +62 -0
  71. package/template/knowledge-base/rules/code-quality/jsx.mdc +19 -0
  72. package/template/knowledge-base/rules/global/naming.mdc +12 -0
  73. package/template/knowledge-base/rules/global/technology.mdc +19 -0
  74. package/template/knowledge-base/rules/global/ui-copy.mdc +20 -0
  75. package/template/knowledge-base/rules/performance/client.mdc +20 -0
  76. package/template/knowledge-base/rules/ui/information-density.mdc +36 -0
  77. package/template/knowledge-base/rules/ui/interaction.mdc +47 -0
  78. package/template/knowledge-base/rules/ui/simple-ui.mdc +58 -0
  79. package/template/knowledge-base/validation/accessibility.mdc +13 -0
  80. package/template/knowledge-base/validation/architecture.mdc +10 -0
  81. package/template/knowledge-base/validation/ast-grep/do-what-brooooooklyn-said.yml +15 -0
  82. package/template/knowledge-base/validation/ast-grep/no-nested-links.yml +12 -0
  83. package/template/knowledge-base/validation/ast-grep/rewrite-svg-attribute.yml +19 -0
  84. package/template/knowledge-base/validation/code-quality.mdc +18 -0
  85. package/template/knowledge-base/validation/performance.mdc +11 -0
  86. package/template/knowledge-base/validation/ui.mdc +26 -0
  87. package/template/next.config.ts +21 -0
  88. package/template/package-lock.json +6938 -0
  89. package/template/package.json +30 -0
  90. package/template/postcss.config.mjs +7 -0
  91. package/template/public/identity/full_logo_black.svg +27 -0
  92. package/template/public/identity/full_logo_color.svg +38 -0
  93. package/template/public/identity/full_logo_white.svg +34 -0
  94. package/template/public/identity/logo_icon_black.svg +6 -0
  95. package/template/public/identity/logo_icon_color.svg +13 -0
  96. package/template/public/identity/logo_icon_white.svg +13 -0
  97. package/template/public/login-hero.png +0 -0
  98. package/template/sgconfig.yml +11 -0
  99. package/template/tsconfig.json +43 -0
@@ -0,0 +1,886 @@
1
+ "use client";
2
+
3
+ import {
4
+ ActionStack,
5
+ Badge,
6
+ ClickableButton,
7
+ Icon,
8
+ Input,
9
+ Loader,
10
+ MetricBar,
11
+ Modal,
12
+ MultiSelect,
13
+ MultiSelectWithSearch,
14
+ Select,
15
+ SelectFilter,
16
+ SelectWithSearch,
17
+ Stepper,
18
+ Tabs,
19
+ Textarea,
20
+ UserTable,
21
+ } from "@/components/ui";
22
+ import type { CardAction, Column } from "@/components/ui";
23
+ import { useEffect, useState } from "react";
24
+ import type { ReactNode } from "react";
25
+
26
+ const noop = () => undefined;
27
+
28
+ const SELECT_OPTIONS = [
29
+ { value: "admin", label: "Administrateur" },
30
+ { value: "manager", label: "Gestionnaire" },
31
+ { value: "viewer", label: "Observateur" },
32
+ { value: "editor", label: "Éditeur" },
33
+ { value: "analyst", label: "Analyste" },
34
+ ];
35
+
36
+ const STEPPER_STEPS = ["Brouillon", "Revue", "Validation", "Publié"] as const;
37
+
38
+ type UserRole = "Administrateur" | "Gestionnaire" | "Observateur";
39
+ type UserStatus = "Actif" | "En attente" | "Suspendu";
40
+
41
+ interface AppUser {
42
+ id: number;
43
+ fullName: string;
44
+ email: string;
45
+ role: UserRole;
46
+ status: UserStatus;
47
+ joinedAt: string;
48
+ }
49
+
50
+ const ROLE_VARIANT: Record<UserRole, "primary" | "info" | "default"> = {
51
+ Administrateur: "primary",
52
+ Gestionnaire: "info",
53
+ Observateur: "default",
54
+ };
55
+
56
+ const STATUS_VARIANT: Record<UserStatus, "success" | "warning" | "danger"> = {
57
+ Actif: "success",
58
+ "En attente": "warning",
59
+ Suspendu: "danger",
60
+ };
61
+
62
+ function userRowActions(_user: AppUser): CardAction[] {
63
+ return [
64
+ { label: "Voir", icon: "Eye", onSelect: noop },
65
+ { label: "Modifier", icon: "Pencil", onSelect: noop },
66
+ { label: "Valider", icon: "CircleCheck", onSelect: noop },
67
+ { label: "Supprimer", icon: "Trash2", danger: true, onSelect: noop },
68
+ ];
69
+ }
70
+
71
+ const USERS: AppUser[] = [
72
+ { id: 1, fullName: "Amine Berrada", email: "amine.berrada@modoock.com", role: "Administrateur", status: "Actif", joinedAt: "2024-01-12" },
73
+ { id: 2, fullName: "Sarah El Fassi", email: "sarah.elfassi@modoock.com", role: "Gestionnaire", status: "Actif", joinedAt: "2024-02-03" },
74
+ { id: 3, fullName: "Youssef Amrani", email: "youssef.amrani@modoock.com", role: "Observateur", status: "En attente", joinedAt: "2024-03-18" },
75
+ { id: 4, fullName: "Leïla Benkirane", email: "leila.benkirane@modoock.com", role: "Gestionnaire", status: "Actif", joinedAt: "2024-04-25" },
76
+ { id: 5, fullName: "Karim Tazi", email: "karim.tazi@modoock.com", role: "Observateur", status: "Suspendu", joinedAt: "2024-05-09" },
77
+ { id: 6, fullName: "Nadia Chraibi", email: "nadia.chraibi@modoock.com", role: "Administrateur", status: "Actif", joinedAt: "2024-06-14" },
78
+ { id: 7, fullName: "Omar Alaoui", email: "omar.alaoui@modoock.com", role: "Gestionnaire", status: "Actif", joinedAt: "2024-07-21" },
79
+ { id: 8, fullName: "Imane Ait Mbarek", email: "imane.aitmbarek@modoock.com", role: "Gestionnaire", status: "En attente", joinedAt: "2024-08-02" },
80
+ { id: 9, fullName: "Mehdi Ouazzani", email: "mehdi.ouazzani@modoock.com", role: "Observateur", status: "Actif", joinedAt: "2024-09-30" },
81
+ { id: 10, fullName: "Salma Bennis", email: "salma.bennis@modoock.com", role: "Gestionnaire", status: "Actif", joinedAt: "2024-10-11" },
82
+ { id: 11, fullName: "Reda Lahlou", email: "reda.lahlou@modoock.com", role: "Observateur", status: "Suspendu", joinedAt: "2024-11-05" },
83
+ { id: 12, fullName: "Hajar Squalli", email: "hajar.squalli@modoock.com", role: "Administrateur", status: "Actif", joinedAt: "2025-01-20" },
84
+ { id: 13, fullName: "Anas Belkacem", email: "anas.belkacem@modoock.com", role: "Observateur", status: "En attente", joinedAt: "2025-02-27" },
85
+ { id: 14, fullName: "Meryem Haddadi", email: "meryem.haddadi@modoock.com", role: "Gestionnaire", status: "Actif", joinedAt: "2025-03-15" },
86
+ ];
87
+
88
+ const COLUMNS: Column<AppUser>[] = [
89
+ { key: "fullName", label: "Nom", sortable: true },
90
+ {
91
+ key: "email",
92
+ label: "Adresse e-mail",
93
+ sortable: true,
94
+ className: "text-body text-muted-foreground",
95
+ },
96
+ {
97
+ key: "role",
98
+ label: "Rôle",
99
+ sortable: true,
100
+ render: (user) => <Badge variant={ROLE_VARIANT[user.role]}>{user.role}</Badge>,
101
+ },
102
+ {
103
+ key: "status",
104
+ label: "Statut",
105
+ sortable: true,
106
+ render: (user) => (
107
+ <Badge variant={STATUS_VARIANT[user.status]}>{user.status}</Badge>
108
+ ),
109
+ },
110
+ {
111
+ key: "joinedAt",
112
+ label: "Date d'inscription",
113
+ sortable: true,
114
+ className: "whitespace-nowrap text-body-medium",
115
+ // Tri sur la valeur ISO (chronologique), affichage formaté.
116
+ render: (user) =>
117
+ new Date(user.joinedAt).toLocaleDateString("fr-FR", {
118
+ day: "numeric",
119
+ month: "long",
120
+ year: "numeric",
121
+ }),
122
+ },
123
+ ];
124
+
125
+ /** Démo interactive du Loader plein écran (2 s). */
126
+ function FullScreenLoaderDemo() {
127
+ const [visible, setVisible] = useState(false);
128
+
129
+ useEffect(() => {
130
+ if (!visible) return;
131
+ const timer = setTimeout(() => setVisible(false), 2000);
132
+ return () => clearTimeout(timer);
133
+ }, [visible]);
134
+
135
+ return (
136
+ <>
137
+ <ClickableButton
138
+ type="button"
139
+ variant="secondary"
140
+ onClick={() => setVisible(true)}
141
+ >
142
+ Afficher (2 s)
143
+ </ClickableButton>
144
+ {visible && <Loader fullScreen message="Chargement des données…" />}
145
+ </>
146
+ );
147
+ }
148
+
149
+ /** Démo interactive du Loader en superposition dans une carte (2 s). */
150
+ function CardLoaderDemo() {
151
+ const [loading, setLoading] = useState(false);
152
+
153
+ useEffect(() => {
154
+ if (!loading) return;
155
+ const timer = setTimeout(() => setLoading(false), 2000);
156
+ return () => clearTimeout(timer);
157
+ }, [loading]);
158
+
159
+ return (
160
+ <div className="flex flex-col gap-component">
161
+ <ClickableButton
162
+ type="button"
163
+ variant="secondary"
164
+ onClick={() => setLoading(true)}
165
+ >
166
+ Recharger (2 s)
167
+ </ClickableButton>
168
+ <div className="relative rounded-large border border-border bg-surface p-component">
169
+ <div className="space-y-component opacity-40" aria-hidden="true">
170
+ <div className="h-3 w-2/3 rounded bg-surface-muted" />
171
+ <div className="h-3 w-1/2 rounded bg-surface-muted" />
172
+ <div className="h-3 w-3/4 rounded bg-surface-muted" />
173
+ </div>
174
+ {loading && <Loader message="Rechargement…" />}
175
+ </div>
176
+ </div>
177
+ );
178
+ }
179
+
180
+ /** Démo interactive du Loader dans une modale (2 s). */
181
+ function ModalLoaderDemo() {
182
+ const [open, setOpen] = useState(false);
183
+ const [loading, setLoading] = useState(false);
184
+
185
+ const handleOpen = () => {
186
+ setOpen(true);
187
+ setLoading(true);
188
+ };
189
+
190
+ useEffect(() => {
191
+ if (!open || !loading) return;
192
+ const timer = setTimeout(() => setLoading(false), 2000);
193
+ return () => clearTimeout(timer);
194
+ }, [open, loading]);
195
+
196
+ return (
197
+ <>
198
+ <ClickableButton
199
+ type="button"
200
+ variant="secondary"
201
+ onClick={handleOpen}
202
+ >
203
+ Ouvrir la modale (2 s)
204
+ </ClickableButton>
205
+ <Modal
206
+ open={open}
207
+ title="Chargement dans une modale"
208
+ onClose={() => setOpen(false)}
209
+ primaryAction={{ label: "Fermer", onClick: () => setOpen(false) }}
210
+ >
211
+ <div className="relative min-h-40">
212
+ {loading ? (
213
+ <Loader message="Chargement des données…" />
214
+ ) : (
215
+ <div className="space-y-inline">
216
+ {["Service importé", "Utilisateurs synchronisés", "Rapport généré"].map(
217
+ (item) => (
218
+ <div
219
+ key={item}
220
+ className="flex items-center gap-inline rounded-large border border-border bg-surface-muted px-component py-control"
221
+ >
222
+ <Icon name="CircleCheck" variant="success" aria-hidden="true" />
223
+ <span className="text-body-medium text-foreground">{item}</span>
224
+ </div>
225
+ ),
226
+ )}
227
+ </div>
228
+ )}
229
+ </div>
230
+ </Modal>
231
+ </>
232
+ );
233
+ }
234
+
235
+ /** Carte de démonstration utilisée dans la vitrine des champs. */
236
+ function InputDemoCard({
237
+ title,
238
+ description,
239
+ children,
240
+ }: {
241
+ title: string;
242
+ description?: string;
243
+ children: ReactNode;
244
+ }) {
245
+ return (
246
+ <div className="rounded-large border border-border bg-surface p-card">
247
+ <p className="text-component-title text-foreground">{title}</p>
248
+ {description && (
249
+ <p className="mt-micro text-small text-muted-foreground">
250
+ {description}
251
+ </p>
252
+ )}
253
+ <div className="mt-component">{children}</div>
254
+ </div>
255
+ );
256
+ }
257
+
258
+ function ModalDemo() {
259
+ const [open, setOpen] = useState(false);
260
+
261
+ return (
262
+ <>
263
+ <ClickableButton type="button" variant="secondary" onClick={() => setOpen(true)}>
264
+ Ouvrir la modale
265
+ </ClickableButton>
266
+ <Modal
267
+ open={open}
268
+ title="Confirmation"
269
+ onClose={() => setOpen(false)}
270
+ primaryAction={{
271
+ label: "Confirmer",
272
+ onClick: () => setOpen(false),
273
+ }}
274
+ secondaryAction={{
275
+ label: "Annuler",
276
+ onClick: () => setOpen(false),
277
+ }}
278
+ >
279
+ <p className="text-body text-muted-foreground">
280
+ Cette action enregistrera les modifications. Souhaitez-vous continuer ?
281
+ </p>
282
+ </Modal>
283
+ </>
284
+ );
285
+ }
286
+
287
+ function SelectorsDemo() {
288
+ const [role, setRole] = useState("manager");
289
+ const [roles, setRoles] = useState<string[]>(["admin", "manager"]);
290
+ const [city, setCity] = useState("");
291
+ const [tags, setTags] = useState<string[]>(["viewer"]);
292
+ const [filters, setFilters] = useState<string[]>([]);
293
+
294
+ return (
295
+ <div className="mt-component grid gap-component md:grid-cols-2">
296
+ <InputDemoCard title="Select" description="Sélection simple.">
297
+ <Select
298
+ label="Rôle"
299
+ options={SELECT_OPTIONS}
300
+ value={role}
301
+ onChange={setRole}
302
+ placeholder="Choisir un rôle…"
303
+ />
304
+ </InputDemoCard>
305
+
306
+ <InputDemoCard title="MultiSelect" description="Sélection multiple avec chips.">
307
+ <MultiSelect
308
+ label="Rôles"
309
+ options={SELECT_OPTIONS}
310
+ values={roles}
311
+ onChange={setRoles}
312
+ placeholder="Choisir des rôles…"
313
+ />
314
+ </InputDemoCard>
315
+
316
+ <InputDemoCard title="SelectWithSearch" description="Liste longue avec recherche.">
317
+ <SelectWithSearch
318
+ label="Profil"
319
+ options={SELECT_OPTIONS}
320
+ value={city}
321
+ onChange={setCity}
322
+ placeholder="Rechercher un profil…"
323
+ />
324
+ </InputDemoCard>
325
+
326
+ <InputDemoCard
327
+ title="MultiSelectWithSearch"
328
+ description="Multi-sélection avec recherche."
329
+ >
330
+ <MultiSelectWithSearch
331
+ label="Profils"
332
+ options={SELECT_OPTIONS}
333
+ values={tags}
334
+ onChange={setTags}
335
+ placeholder="Rechercher…"
336
+ />
337
+ </InputDemoCard>
338
+
339
+ <InputDemoCard title="SelectFilter" description="Filtre de colonne (table).">
340
+ <SelectFilter
341
+ label="Filtrer par rôle"
342
+ options={SELECT_OPTIONS}
343
+ values={filters}
344
+ onChange={setFilters}
345
+ placeholder="Filtrer…"
346
+ />
347
+ </InputDemoCard>
348
+ </div>
349
+ );
350
+ }
351
+
352
+ function TabsDemo() {
353
+ return (
354
+ <Tabs
355
+ tabs={[
356
+ { value: "general", label: "Général" },
357
+ { value: "security", label: "Sécurité" },
358
+ { value: "notifications", label: "Notifications" },
359
+ ]}
360
+ defaultValue="general"
361
+ >
362
+ {(active) => (
363
+ <p className="text-body text-muted-foreground">
364
+ Contenu de l&apos;onglet «{" "}
365
+ {active === "general"
366
+ ? "Général"
367
+ : active === "security"
368
+ ? "Sécurité"
369
+ : "Notifications"}{" "}
370
+ ».
371
+ </p>
372
+ )}
373
+ </Tabs>
374
+ );
375
+ }
376
+
377
+ export default function CompsPage() {
378
+ // Showcase page: allow page scroll; explicit height for UserTable (md:h-full).
379
+ return (
380
+ <div className="flex flex-col">
381
+ {/* Vitrine des variantes du champ de saisie */}
382
+ <div className="page-container pt-section">
383
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
384
+ <h2 className="text-section-title text-foreground">Champs de saisie</h2>
385
+ <span className="text-small text-muted-foreground">
386
+ Variantes du composant <code className="font-mono">Input</code>
387
+ </span>
388
+ </div>
389
+ <div className="mt-component grid gap-component md:grid-cols-2">
390
+ <InputDemoCard title="Par défaut">
391
+ <Input placeholder="Saisissez du texte…" />
392
+ </InputDemoCard>
393
+
394
+ <InputDemoCard title="Avec libellé & requis">
395
+ <Input
396
+ label="Adresse e-mail"
397
+ required
398
+ placeholder="vous@exemple.com"
399
+ />
400
+ </InputDemoCard>
401
+
402
+ <InputDemoCard title="Icone à gauche">
403
+ <Input icon={<Icon name="Search" size="small" />} placeholder="Rechercher…" />
404
+ </InputDemoCard>
405
+
406
+ <InputDemoCard title="Champ désactivé">
407
+ <Input
408
+ label="Nom d'utilisateur"
409
+ disabled
410
+ defaultValue="imane.mbarek"
411
+ />
412
+ </InputDemoCard>
413
+
414
+ <InputDemoCard title="Champ valide">
415
+ <Input
416
+ label="E-mail renseigné"
417
+ state="valid"
418
+ defaultValue="imane@modoock.com"
419
+ helper="Adresse vérifiée avec succès."
420
+ />
421
+ </InputDemoCard>
422
+
423
+ <InputDemoCard title="Champ invalide avec erreur">
424
+ <Input
425
+ label="Mot de passe"
426
+ required
427
+ state="invalid"
428
+ error="Le mot de passe doit contenir au moins 8 caractères."
429
+ defaultValue="1234"
430
+ />
431
+ </InputDemoCard>
432
+
433
+ <InputDemoCard title="Mot de passe (afficher / masquer)">
434
+ <Input
435
+ label="Mot de passe"
436
+ type="password"
437
+ icon={<Icon name="Lock" size="small" />}
438
+ placeholder="••••••••"
439
+ helper="L'icône permet de révéler ou masquer la saisie."
440
+ />
441
+ </InputDemoCard>
442
+
443
+ <InputDemoCard title="Effaçable + compteur">
444
+ <Input
445
+ label="Nom complet"
446
+ clearable
447
+ counter
448
+ maxLength={50}
449
+ defaultValue="Imane Ait Mbarek"
450
+ helper="Utiliser la croix pour vider le champ."
451
+ />
452
+ </InputDemoCard>
453
+
454
+ <InputDemoCard title="Suffixe (unité)">
455
+ <Input
456
+ label="Montant"
457
+ defaultValue="1280"
458
+ trailingIcon={<Icon name="Euro" size="small" />}
459
+ />
460
+ </InputDemoCard>
461
+
462
+ <InputDemoCard title="Aide contextuelle">
463
+ <Input
464
+ label="Numéro de téléphone"
465
+ placeholder="+212 6 00 00 00 00"
466
+ helper="Format national ou international accepté."
467
+ />
468
+ </InputDemoCard>
469
+
470
+ <InputDemoCard title="Zone de texte (Textarea)">
471
+ <Textarea
472
+ label="Description"
473
+ required
474
+ counter
475
+ maxLength={200}
476
+ placeholder="Décrivez brièvement…"
477
+ helper="200 caractères maximum."
478
+ />
479
+ </InputDemoCard>
480
+ </div>
481
+ </div>
482
+
483
+ {/* Vitrine des variantes du bouton */}
484
+ <div className="page-container pt-section">
485
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
486
+ <h2 className="text-section-title text-foreground">Boutons</h2>
487
+ <span className="text-small text-muted-foreground">
488
+ Variantes du composant <code className="font-mono">ClickableButton</code>
489
+ </span>
490
+ </div>
491
+ <div className="mt-component grid gap-component md:grid-cols-2">
492
+ <InputDemoCard title="Variants">
493
+ <div className="flex flex-wrap gap-inline">
494
+ <ClickableButton>Primary</ClickableButton>
495
+ <ClickableButton variant="secondary">Secondary</ClickableButton>
496
+ <ClickableButton variant="ghost">Ghost</ClickableButton>
497
+ <ClickableButton variant="accent">Accent</ClickableButton>
498
+ <ClickableButton variant="success">Success</ClickableButton>
499
+ <ClickableButton variant="warning">Warning</ClickableButton>
500
+ <ClickableButton variant="danger">Danger</ClickableButton>
501
+ <ClickableButton variant="info">Info</ClickableButton>
502
+ </div>
503
+ </InputDemoCard>
504
+
505
+ <InputDemoCard title="Tailles">
506
+ <div className="flex flex-wrap items-center gap-inline">
507
+ <ClickableButton size="sm">Small</ClickableButton>
508
+ <ClickableButton size="md">Medium</ClickableButton>
509
+ <ClickableButton size="lg">Large</ClickableButton>
510
+ <ClickableButton size="icon" variant="secondary" aria-label="Actualiser">
511
+ <Icon name="RefreshCw" size="small" aria-hidden="true" />
512
+ </ClickableButton>
513
+ </div>
514
+ </InputDemoCard>
515
+
516
+ <InputDemoCard title="Chargement (loading)">
517
+ <div className="flex flex-wrap items-center gap-inline">
518
+ <ClickableButton loading loadingText="Enregistrement…">
519
+ Enregistrer
520
+ </ClickableButton>
521
+ <ClickableButton loading variant="secondary">
522
+ Traitement
523
+ </ClickableButton>
524
+ </div>
525
+ </InputDemoCard>
526
+
527
+ <InputDemoCard title="Désactivé (disabled)">
528
+ <div className="flex flex-wrap gap-inline">
529
+ <ClickableButton disabled>Désactivé</ClickableButton>
530
+ <ClickableButton disabled variant="secondary">
531
+ Indisponible
532
+ </ClickableButton>
533
+ <ClickableButton disabled variant="danger" leftIcon={<Icon name="Trash2" size="small" />}>
534
+ Supprimer
535
+ </ClickableButton>
536
+ </div>
537
+ </InputDemoCard>
538
+
539
+ <InputDemoCard title="Icônes (gauche / droite)">
540
+ <div className="flex flex-wrap items-center gap-inline">
541
+ <ClickableButton leftIcon={<Icon name="Plus" size="small" />}>Créer</ClickableButton>
542
+ <ClickableButton rightIcon={<Icon name="ArrowRight" size="small" />} variant="secondary">
543
+ Continuer
544
+ </ClickableButton>
545
+ <ClickableButton
546
+ leftIcon={<Icon name="Save" size="small" />}
547
+ rightIcon={<Icon name="Download" size="small" />}
548
+ variant="accent"
549
+ >
550
+ Exporter
551
+ </ClickableButton>
552
+ </div>
553
+ </InputDemoCard>
554
+
555
+ <InputDemoCard title="Largeur pleine (fullWidth)">
556
+ <ClickableButton fullWidth leftIcon={<Icon name="Plus" size="small" />}>
557
+ Créer un nouveau projet
558
+ </ClickableButton>
559
+ </InputDemoCard>
560
+ </div>
561
+ </div>
562
+
563
+ {/* Vitrine des variantes du composant Icon */}
564
+ <div className="page-container pt-section">
565
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
566
+ <h2 className="text-section-title text-foreground">Icônes</h2>
567
+ <span className="text-small text-muted-foreground">
568
+ Variantes du composant <code className="font-mono">Icon</code>
569
+ </span>
570
+ </div>
571
+ <div className="mt-component grid gap-component md:grid-cols-2">
572
+ <InputDemoCard title="Défaut" description='variant="default" — couleur foreground.'>
573
+ <div className="flex h-20 items-center justify-center rounded-large bg-surface-muted">
574
+ <Icon name="Search" size="large" />
575
+ </div>
576
+ </InputDemoCard>
577
+
578
+ <InputDemoCard title="Muté" description='variant="muted" — couleur muted-foreground.'>
579
+ <div className="flex h-20 items-center justify-center rounded-large bg-surface-muted">
580
+ <Icon name="Info" size="large" variant="muted" />
581
+ </div>
582
+ </InputDemoCard>
583
+
584
+ <InputDemoCard title="Primaire" description='variant="primary" — couleur primary.'>
585
+ <div className="flex h-20 items-center justify-center rounded-large bg-primary-light">
586
+ <Icon name="ArrowRight" size="large" variant="primary" />
587
+ </div>
588
+ </InputDemoCard>
589
+
590
+ <InputDemoCard title="Succès" description='variant="success" — couleur success.'>
591
+ <div className="flex h-20 items-center justify-center rounded-large bg-surface-muted">
592
+ <Icon name="Check" size="large" variant="success" />
593
+ </div>
594
+ </InputDemoCard>
595
+
596
+ <InputDemoCard title="Avertissement" description='variant="warning" — couleur warning.'>
597
+ <div className="flex h-20 items-center justify-center rounded-large bg-surface-muted">
598
+ <Icon name="Info" size="large" variant="warning" />
599
+ </div>
600
+ </InputDemoCard>
601
+
602
+ <InputDemoCard title="Danger" description='variant="danger" — couleur danger.'>
603
+ <div className="flex h-20 items-center justify-center rounded-large bg-surface-muted">
604
+ <Icon name="X" size="large" variant="danger" />
605
+ </div>
606
+ </InputDemoCard>
607
+
608
+ <InputDemoCard
609
+ title="Sur fond coloré"
610
+ description='variant="white" — icône blanche sur une surface colorée.'
611
+ >
612
+ <div className="flex h-20 items-center justify-center rounded-large bg-primary">
613
+ <Icon name="Plus" size="large" variant="white" />
614
+ </div>
615
+ </InputDemoCard>
616
+
617
+ <InputDemoCard title="Tailles">
618
+ <div className="flex h-20 items-end justify-center gap-inline">
619
+ <Icon name="Search" size="small" />
620
+ <Icon name="Search" size="default" />
621
+ <Icon name="Search" size="large" />
622
+ <Icon name="Search" size="display" />
623
+ </div>
624
+ </InputDemoCard>
625
+ </div>
626
+ </div>
627
+
628
+ {/* Vitrine du composant Loader */}
629
+ <div className="page-container pt-section">
630
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
631
+ <h2 className="text-section-title text-foreground">Loader</h2>
632
+ <span className="text-small text-muted-foreground">
633
+ Chargement réutilisable — plein écran, overlay ou inline
634
+ </span>
635
+ </div>
636
+ <div className="mt-component grid gap-component md:grid-cols-2">
637
+ <InputDemoCard
638
+ title="Inline"
639
+ description='variant="inline" — bloc centré dans le flux.'
640
+ >
641
+ <div className="flex h-24 items-center justify-center rounded-large bg-surface-muted">
642
+ <Loader variant="inline" message="Chargement de l'historique…" />
643
+ </div>
644
+ </InputDemoCard>
645
+
646
+ <InputDemoCard
647
+ title="Overlay"
648
+ description="Superposition dans un parent relatif — modale, carte…"
649
+ >
650
+ <div className="relative h-24 overflow-hidden rounded-large bg-surface-muted">
651
+ <div className="space-y-component opacity-40" aria-hidden="true">
652
+ <div className="h-3 w-2/3 rounded bg-background" />
653
+ <div className="h-3 w-1/2 rounded bg-background" />
654
+ <div className="h-3 w-3/4 rounded bg-background" />
655
+ </div>
656
+ <Loader message="Enregistrement en cours…" />
657
+ </div>
658
+ </InputDemoCard>
659
+
660
+ <InputDemoCard
661
+ title="Plein écran"
662
+ description="Couvre toute la page pendant le chargement des données."
663
+ >
664
+ <div className="flex h-24 items-center justify-center rounded-large bg-surface-muted">
665
+ <FullScreenLoaderDemo />
666
+ </div>
667
+ </InputDemoCard>
668
+
669
+ <InputDemoCard
670
+ title="Dans une carte"
671
+ description="Superposition dans un parent relatif — rechargement de 2 s."
672
+ >
673
+ <CardLoaderDemo />
674
+ </InputDemoCard>
675
+
676
+ <InputDemoCard
677
+ title="Dans une modale"
678
+ description="Le Loader couvre le corps de la modale pendant 2 s, puis le contenu apparaît."
679
+ >
680
+ <ModalLoaderDemo />
681
+ </InputDemoCard>
682
+
683
+ <InputDemoCard title="Tailles">
684
+ <div className="flex h-24 items-end justify-center gap-component">
685
+ <Loader size="small" variant="inline" />
686
+ <Loader size="default" variant="inline" />
687
+ <Loader size="large" variant="inline" />
688
+ <Loader size="display" variant="inline" />
689
+ </div>
690
+ </InputDemoCard>
691
+ </div>
692
+ </div>
693
+
694
+
695
+ {/* Vitrine Badge */}
696
+ <div className="page-container pt-section">
697
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
698
+ <h2 className="text-section-title text-foreground">Badges</h2>
699
+ <span className="text-small text-muted-foreground">
700
+ Variantes du composant <code className="font-mono">Badge</code>
701
+ </span>
702
+ </div>
703
+ <div className="mt-component grid gap-component md:grid-cols-2">
704
+ <InputDemoCard title="Variants">
705
+ <div className="flex flex-wrap gap-inline">
706
+ <Badge>Default</Badge>
707
+ <Badge variant="primary">Primary</Badge>
708
+ <Badge variant="secondary">Secondary</Badge>
709
+ <Badge variant="success">Success</Badge>
710
+ <Badge variant="warning">Warning</Badge>
711
+ <Badge variant="danger">Danger</Badge>
712
+ <Badge variant="info">Info</Badge>
713
+ <Badge variant="accent">Accent</Badge>
714
+ </div>
715
+ </InputDemoCard>
716
+ </div>
717
+ </div>
718
+
719
+ {/* Vitrine Select */}
720
+ <div className="page-container pt-section">
721
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
722
+ <h2 className="text-section-title text-foreground">Sélecteurs</h2>
723
+ <span className="text-small text-muted-foreground">
724
+ Select, MultiSelect, recherche et filtre
725
+ </span>
726
+ </div>
727
+ <SelectorsDemo />
728
+ </div>
729
+
730
+ {/* Vitrine Tabs */}
731
+ <div className="page-container pt-section">
732
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
733
+ <h2 className="text-section-title text-foreground">Onglets</h2>
734
+ <span className="text-small text-muted-foreground">
735
+ Composant <code className="font-mono">Tabs</code>
736
+ </span>
737
+ </div>
738
+ <div className="mt-component grid gap-component md:grid-cols-2">
739
+ <InputDemoCard title="Navigation par onglets">
740
+ <TabsDemo />
741
+ </InputDemoCard>
742
+ </div>
743
+ </div>
744
+
745
+ {/* Vitrine Modal */}
746
+ <div className="page-container pt-section">
747
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
748
+ <h2 className="text-section-title text-foreground">Modale</h2>
749
+ <span className="text-small text-muted-foreground">
750
+ Composant <code className="font-mono">Modal</code>
751
+ </span>
752
+ </div>
753
+ <div className="mt-component grid gap-component md:grid-cols-2">
754
+ <InputDemoCard
755
+ title="Actions primaire / secondaire"
756
+ description="Focus piégé, fermeture Escape, scroll verrouillé."
757
+ >
758
+ <ModalDemo />
759
+ </InputDemoCard>
760
+ </div>
761
+ </div>
762
+
763
+ {/* Vitrine MetricBar */}
764
+ <div className="page-container pt-section">
765
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
766
+ <h2 className="text-section-title text-foreground">Barres de métrique</h2>
767
+ <span className="text-small text-muted-foreground">
768
+ Composant <code className="font-mono">MetricBar</code>
769
+ </span>
770
+ </div>
771
+ <div className="mt-component grid gap-component md:grid-cols-2">
772
+ <InputDemoCard title="Tons">
773
+ <div className="flex flex-col gap-component">
774
+ <MetricBar value={72} tone="primary" />
775
+ <MetricBar value={45} tone="success" />
776
+ <MetricBar value={88} tone="warning" />
777
+ <MetricBar value={20} tone="danger" />
778
+ <MetricBar value={60} tone="info" />
779
+ <MetricBar value={35} tone="accent" />
780
+ </div>
781
+ </InputDemoCard>
782
+ </div>
783
+ </div>
784
+
785
+ {/* Vitrine Stepper */}
786
+ <div className="page-container pt-section">
787
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
788
+ <h2 className="text-section-title text-foreground">Stepper</h2>
789
+ <span className="text-small text-muted-foreground">
790
+ Progression d&apos;un cycle
791
+ </span>
792
+ </div>
793
+ <div className="mt-component grid gap-component">
794
+ <InputDemoCard title="Étape en cours" description="currentIndex = 1">
795
+ <Stepper
796
+ steps={STEPPER_STEPS}
797
+ currentIndex={1}
798
+ label="Progression du dossier"
799
+ />
800
+ </InputDemoCard>
801
+ <InputDemoCard title="Terminé" description="complete = true">
802
+ <Stepper
803
+ steps={STEPPER_STEPS}
804
+ currentIndex={3}
805
+ complete
806
+ label="Progression terminée"
807
+ />
808
+ </InputDemoCard>
809
+ <InputDemoCard title="Rejeté" description="rejected = true">
810
+ <Stepper
811
+ steps={STEPPER_STEPS}
812
+ currentIndex={2}
813
+ rejected
814
+ label="Progression rejetée"
815
+ />
816
+ </InputDemoCard>
817
+ </div>
818
+ </div>
819
+
820
+ {/* Vitrine ActionStack */}
821
+ <div className="page-container pt-section">
822
+ <div className="flex flex-wrap items-baseline justify-between gap-inline">
823
+ <h2 className="text-section-title text-foreground">Pile d&apos;actions</h2>
824
+ <span className="text-small text-muted-foreground">
825
+ Composant <code className="font-mono">ActionStack</code>
826
+ </span>
827
+ </div>
828
+ <div className="mt-component grid gap-component md:grid-cols-2">
829
+ <InputDemoCard title="Actions disponibles">
830
+ <ActionStack
831
+ actions={[
832
+ {
833
+ key: "validate",
834
+ label: "Valider",
835
+ variant: "primary",
836
+ onClick: () => undefined,
837
+ },
838
+ {
839
+ key: "request",
840
+ label: "Demander des infos",
841
+ variant: "secondary",
842
+ onClick: () => undefined,
843
+ },
844
+ {
845
+ key: "reject",
846
+ label: "Rejeter",
847
+ variant: "danger",
848
+ onClick: () => undefined,
849
+ },
850
+ ]}
851
+ />
852
+ </InputDemoCard>
853
+ <InputDemoCard title="Aucune action" description="Message vide affiché.">
854
+ <ActionStack
855
+ actions={[]}
856
+ emptyMessage="Aucune action disponible pour ce dossier."
857
+ />
858
+ </InputDemoCard>
859
+ </div>
860
+ </div>
861
+
862
+ <div className="page-container flex h-[min(32rem,70dvh)] flex-col pb-section pt-section">
863
+ <div className="mb-component flex shrink-0 flex-wrap items-baseline justify-between gap-inline">
864
+ <h2 className="text-section-title text-foreground">Tableau</h2>
865
+ <span className="text-small text-muted-foreground">
866
+ Composant <code className="font-mono">UserTable</code>
867
+ </span>
868
+ </div>
869
+ <div className="min-h-0 flex-1">
870
+ <UserTable
871
+ columns={COLUMNS}
872
+ data={USERS}
873
+ rowsPerPage={8}
874
+ getRowKey={(user) => user.id}
875
+ cardActions={{
876
+ table: [
877
+ { label: "Exporter", icon: "Download", onSelect: noop },
878
+ ],
879
+ row: userRowActions,
880
+ }}
881
+ />
882
+ </div>
883
+ </div>
884
+ </div>
885
+ );
886
+ }