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