create-modoock-app 2.4.0 → 2.6.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.
- package/package.json +1 -1
- package/template/app/(main)/components/_shared.tsx +219 -3
- package/template/app/(main)/components/agenda/page.tsx +48 -0
- package/template/app/(main)/components/avatar/page.tsx +106 -0
- package/template/app/(main)/components/badges/page.tsx +1 -1
- package/template/app/(main)/components/barres-de-metrique/page.tsx +1 -1
- package/template/app/(main)/components/boutons/page.tsx +14 -7
- package/template/app/(main)/components/champs/page.tsx +2 -2
- package/template/app/(main)/components/date-picker/page.tsx +48 -0
- package/template/app/(main)/components/icones/page.tsx +1 -1
- package/template/app/(main)/components/modale/page.tsx +1 -1
- package/template/app/(main)/components/onglets/page.tsx +1 -1
- package/template/app/(main)/components/page.tsx +18 -0
- package/template/app/(main)/components/tableau/page.tsx +1 -1
- package/template/app/(main)/design-system/page.tsx +3 -3
- package/template/app/globals.css +3 -5
- package/template/components/layout/side-nav.tsx +240 -105
- package/template/next.config.ts +12 -0
- package/template/package-lock.json +28 -15
- package/template/package.json +2 -2
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
Agenda,
|
|
5
|
+
AGENDA_STATUS_OPTIONS,
|
|
4
6
|
Badge,
|
|
5
7
|
ClickableButton,
|
|
8
|
+
DatePicker,
|
|
9
|
+
DateRangePicker,
|
|
10
|
+
DateTimePicker,
|
|
6
11
|
Icon,
|
|
7
12
|
Loader,
|
|
8
13
|
Modal,
|
|
@@ -13,8 +18,14 @@ import {
|
|
|
13
18
|
SelectWithSearch,
|
|
14
19
|
Tabs,
|
|
15
20
|
} from "@modoock/components";
|
|
16
|
-
import type {
|
|
17
|
-
|
|
21
|
+
import type {
|
|
22
|
+
AgendaEvent,
|
|
23
|
+
AgendaView,
|
|
24
|
+
CardAction,
|
|
25
|
+
Column,
|
|
26
|
+
DateRangeValue,
|
|
27
|
+
} from "@modoock/components";
|
|
28
|
+
import { useEffect, useMemo, useState, type ReactNode } from "react";
|
|
18
29
|
|
|
19
30
|
export const noop = () => undefined;
|
|
20
31
|
|
|
@@ -116,7 +127,7 @@ export const COLUMNS: Column<AppUser>[] = [
|
|
|
116
127
|
|
|
117
128
|
export function CodeBlock({ code }: { code: string }) {
|
|
118
129
|
return (
|
|
119
|
-
<pre className="mt-component overflow-x-auto rounded-large border border-border bg-surface-muted p-component
|
|
130
|
+
<pre className="mt-component overflow-x-auto rounded-large border border-border bg-surface-muted p-component text-small text-foreground">
|
|
120
131
|
<code>{code}</code>
|
|
121
132
|
</pre>
|
|
122
133
|
);
|
|
@@ -360,6 +371,211 @@ export function SelectorsDemo() {
|
|
|
360
371
|
);
|
|
361
372
|
}
|
|
362
373
|
|
|
374
|
+
function atDay(base: Date, dayOffset: number, hour: number, minute = 0): Date {
|
|
375
|
+
const d = new Date(base.getFullYear(), base.getMonth(), base.getDate() + dayOffset);
|
|
376
|
+
d.setHours(hour, minute, 0, 0);
|
|
377
|
+
return d;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function buildDemoAgendaEvents(anchor: Date): AgendaEvent[] {
|
|
381
|
+
return [
|
|
382
|
+
{
|
|
383
|
+
id: "1",
|
|
384
|
+
title: "Amine Berrada",
|
|
385
|
+
subtitle: "Dr. El Fassi — Salle A",
|
|
386
|
+
kind: "Consultation",
|
|
387
|
+
status: "confirmed",
|
|
388
|
+
startAt: atDay(anchor, 0, 9, 0),
|
|
389
|
+
endAt: atDay(anchor, 0, 9, 45),
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
id: "2",
|
|
393
|
+
title: "Sarah El Fassi",
|
|
394
|
+
subtitle: "Dr. Amrani — Salle B",
|
|
395
|
+
kind: "Suivi",
|
|
396
|
+
status: "planned",
|
|
397
|
+
startAt: atDay(anchor, 0, 11, 0),
|
|
398
|
+
endAt: atDay(anchor, 0, 11, 30),
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
id: "3",
|
|
402
|
+
title: "Youssef Amrani",
|
|
403
|
+
subtitle: "Dr. El Fassi — Salle A",
|
|
404
|
+
kind: "Consultation",
|
|
405
|
+
status: "delayed",
|
|
406
|
+
startAt: atDay(anchor, 1, 10, 0),
|
|
407
|
+
endAt: atDay(anchor, 1, 10, 45),
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
id: "4",
|
|
411
|
+
title: "Leïla Benkirane",
|
|
412
|
+
subtitle: "Dr. Tazi — Box 2",
|
|
413
|
+
kind: "Contrôle",
|
|
414
|
+
status: "completed",
|
|
415
|
+
startAt: atDay(anchor, -2, 14, 0),
|
|
416
|
+
endAt: atDay(anchor, -2, 14, 30),
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
id: "5",
|
|
420
|
+
title: "Karim Tazi",
|
|
421
|
+
subtitle: "Dr. Amrani — Salle B",
|
|
422
|
+
kind: "Consultation",
|
|
423
|
+
status: "cancelled",
|
|
424
|
+
startAt: atDay(anchor, 2, 15, 0),
|
|
425
|
+
endAt: atDay(anchor, 2, 15, 45),
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
id: "6",
|
|
429
|
+
title: "Nadia Chraibi",
|
|
430
|
+
subtitle: "Dr. El Fassi — Salle A",
|
|
431
|
+
kind: "Suivi",
|
|
432
|
+
status: "confirmed",
|
|
433
|
+
startAt: atDay(anchor, 3, 9, 30),
|
|
434
|
+
endAt: atDay(anchor, 3, 10, 15),
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
id: "7",
|
|
438
|
+
title: "Omar Alaoui",
|
|
439
|
+
subtitle: "Dr. Tazi — Box 1",
|
|
440
|
+
kind: "Consultation",
|
|
441
|
+
status: "planned",
|
|
442
|
+
startAt: atDay(anchor, 0, 16, 0),
|
|
443
|
+
endAt: atDay(anchor, 0, 16, 45),
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
id: "8",
|
|
447
|
+
title: "Imane Ait Mbarek",
|
|
448
|
+
subtitle: "Dr. Amrani — Salle B",
|
|
449
|
+
kind: "Contrôle",
|
|
450
|
+
status: "confirmed",
|
|
451
|
+
startAt: atDay(anchor, 5, 11, 0),
|
|
452
|
+
endAt: atDay(anchor, 5, 11, 30),
|
|
453
|
+
},
|
|
454
|
+
];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const AGENDA_KIND_OPTIONS = [
|
|
458
|
+
{ value: "all", label: "Tous les types" },
|
|
459
|
+
{ value: "Consultation", label: "Consultation" },
|
|
460
|
+
{ value: "Suivi", label: "Suivi" },
|
|
461
|
+
{ value: "Contrôle", label: "Contrôle" },
|
|
462
|
+
];
|
|
463
|
+
|
|
464
|
+
export function AgendaDemo() {
|
|
465
|
+
const [view, setView] = useState<AgendaView>("month");
|
|
466
|
+
const [anchorDate, setAnchorDate] = useState(() => new Date());
|
|
467
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
468
|
+
const [statusFilter, setStatusFilter] = useState<string[]>([]);
|
|
469
|
+
const [kindFilter, setKindFilter] = useState("all");
|
|
470
|
+
const [selected, setSelected] = useState<AgendaEvent | null>(null);
|
|
471
|
+
const [createdSlot, setCreatedSlot] = useState<Date | null>(null);
|
|
472
|
+
|
|
473
|
+
const allEvents = useMemo(
|
|
474
|
+
() => buildDemoAgendaEvents(new Date()),
|
|
475
|
+
[],
|
|
476
|
+
);
|
|
477
|
+
|
|
478
|
+
const events = useMemo(() => {
|
|
479
|
+
return allEvents.filter((event) => {
|
|
480
|
+
if (statusFilter.length > 0 && !statusFilter.includes(event.status ?? "")) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
if (kindFilter !== "all" && event.kind !== kindFilter) return false;
|
|
484
|
+
return true;
|
|
485
|
+
});
|
|
486
|
+
}, [allEvents, statusFilter, kindFilter]);
|
|
487
|
+
|
|
488
|
+
return (
|
|
489
|
+
<div className="flex flex-col gap-component">
|
|
490
|
+
<Agenda
|
|
491
|
+
events={events}
|
|
492
|
+
view={view}
|
|
493
|
+
onViewChange={setView}
|
|
494
|
+
anchorDate={anchorDate}
|
|
495
|
+
onAnchorDateChange={setAnchorDate}
|
|
496
|
+
searchQuery={searchQuery}
|
|
497
|
+
onSearchChange={setSearchQuery}
|
|
498
|
+
searchPlaceholder="Patient, praticien, titre…"
|
|
499
|
+
statusOptions={AGENDA_STATUS_OPTIONS}
|
|
500
|
+
onSelectEvent={setSelected}
|
|
501
|
+
onCreateSlot={setCreatedSlot}
|
|
502
|
+
filters={
|
|
503
|
+
<>
|
|
504
|
+
<div className="w-[10.5rem]">
|
|
505
|
+
<Select
|
|
506
|
+
label="Type"
|
|
507
|
+
options={AGENDA_KIND_OPTIONS}
|
|
508
|
+
value={kindFilter}
|
|
509
|
+
onChange={setKindFilter}
|
|
510
|
+
placeholder="Tous les types"
|
|
511
|
+
/>
|
|
512
|
+
</div>
|
|
513
|
+
<div className="w-[12rem]">
|
|
514
|
+
<SelectFilter
|
|
515
|
+
label="Statut"
|
|
516
|
+
options={AGENDA_STATUS_OPTIONS}
|
|
517
|
+
values={statusFilter}
|
|
518
|
+
onChange={setStatusFilter}
|
|
519
|
+
placeholder="Tous les statuts"
|
|
520
|
+
/>
|
|
521
|
+
</div>
|
|
522
|
+
</>
|
|
523
|
+
}
|
|
524
|
+
/>
|
|
525
|
+
|
|
526
|
+
{selected ? (
|
|
527
|
+
<p className="text-small text-muted-foreground">
|
|
528
|
+
Sélection : <span className="text-foreground">{selected.title}</span>
|
|
529
|
+
{selected.kind ? ` — ${selected.kind}` : ""}
|
|
530
|
+
{selected.status ? ` (${selected.status})` : ""}
|
|
531
|
+
</p>
|
|
532
|
+
) : null}
|
|
533
|
+
{createdSlot ? (
|
|
534
|
+
<p className="text-small text-muted-foreground">
|
|
535
|
+
Créneau demandé :{" "}
|
|
536
|
+
<span className="text-foreground">
|
|
537
|
+
{createdSlot.toLocaleString("fr-FR")}
|
|
538
|
+
</span>
|
|
539
|
+
</p>
|
|
540
|
+
) : null}
|
|
541
|
+
</div>
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export function DatePickersDemo() {
|
|
546
|
+
const [date, setDate] = useState<Date | null>(new Date());
|
|
547
|
+
const [dateTime, setDateTime] = useState<Date | null>(() => {
|
|
548
|
+
const next = new Date();
|
|
549
|
+
next.setHours(14, 30, 0, 0);
|
|
550
|
+
return next;
|
|
551
|
+
});
|
|
552
|
+
const [range, setRange] = useState<DateRangeValue>({
|
|
553
|
+
from: null,
|
|
554
|
+
to: null,
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
return (
|
|
558
|
+
<div className="grid gap-component md:grid-cols-2">
|
|
559
|
+
<DemoCard title="DatePicker" description="Une seule date.">
|
|
560
|
+
<DatePicker label="Date" value={date} onChange={setDate} />
|
|
561
|
+
</DemoCard>
|
|
562
|
+
<DemoCard title="DateTimePicker" description="Date et heure.">
|
|
563
|
+
<DateTimePicker
|
|
564
|
+
label="Date et heure"
|
|
565
|
+
value={dateTime}
|
|
566
|
+
onChange={setDateTime}
|
|
567
|
+
/>
|
|
568
|
+
</DemoCard>
|
|
569
|
+
<DemoCard
|
|
570
|
+
title="DateRangePicker"
|
|
571
|
+
description="Période du… au… (deux clics)."
|
|
572
|
+
>
|
|
573
|
+
<DateRangePicker label="Période" value={range} onChange={setRange} />
|
|
574
|
+
</DemoCard>
|
|
575
|
+
</div>
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
|
|
363
579
|
export function TabsDemo() {
|
|
364
580
|
return (
|
|
365
581
|
<Tabs
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { AgendaDemo, CodeBlock, ShowcaseShell } from "../_shared";
|
|
4
|
+
|
|
5
|
+
export default function AgendaPage() {
|
|
6
|
+
return (
|
|
7
|
+
<ShowcaseShell
|
|
8
|
+
title="Agenda"
|
|
9
|
+
subtitle="Mois, semaine et liste"
|
|
10
|
+
usage="Passez events, view et anchorDate. En vue Liste, un filtre de période (DateRangePicker) est intégré — contrôlable via listRange / onListRangeChange. La barre expose aussi la recherche et le slot filters. Cliquez un jour vide pour onCreateSlot, un événement pour onSelectEvent."
|
|
11
|
+
importCode={`import { Agenda, AGENDA_STATUS_OPTIONS } from "@modoock/components";`}
|
|
12
|
+
>
|
|
13
|
+
<div className="mb-section">
|
|
14
|
+
<p className="mb-inline text-label uppercase tracking-[0.12em] text-muted-foreground">
|
|
15
|
+
Exemple de base
|
|
16
|
+
</p>
|
|
17
|
+
<CodeBlock
|
|
18
|
+
code={`const [view, setView] = useState("month");
|
|
19
|
+
const [anchorDate, setAnchorDate] = useState(new Date());
|
|
20
|
+
const [listRange, setListRange] = useState({ from: null, to: null });
|
|
21
|
+
const [q, setQ] = useState("");
|
|
22
|
+
|
|
23
|
+
<Agenda
|
|
24
|
+
events={events}
|
|
25
|
+
view={view}
|
|
26
|
+
onViewChange={setView}
|
|
27
|
+
anchorDate={anchorDate}
|
|
28
|
+
onAnchorDateChange={setAnchorDate}
|
|
29
|
+
listRange={listRange}
|
|
30
|
+
onListRangeChange={setListRange}
|
|
31
|
+
searchQuery={q}
|
|
32
|
+
onSearchChange={setQ}
|
|
33
|
+
statusOptions={AGENDA_STATUS_OPTIONS}
|
|
34
|
+
onSelectEvent={handleSelect}
|
|
35
|
+
onCreateSlot={handleCreate}
|
|
36
|
+
filters={
|
|
37
|
+
<>
|
|
38
|
+
<Select options={kinds} value={kind} onChange={setKind} />
|
|
39
|
+
<SelectFilter options={statuses} values={status} onChange={setStatus} />
|
|
40
|
+
</>
|
|
41
|
+
}
|
|
42
|
+
/>`}
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
<AgendaDemo />
|
|
46
|
+
</ShowcaseShell>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Avatar, AvatarGroup } from "@modoock/components";
|
|
4
|
+
import { DemoCard, ShowcaseShell } from "../_shared";
|
|
5
|
+
|
|
6
|
+
export default function AvatarPage() {
|
|
7
|
+
return (
|
|
8
|
+
<ShowcaseShell
|
|
9
|
+
title="Avatar"
|
|
10
|
+
subtitle="Image, initiales et groupe"
|
|
11
|
+
usage="Utilisez Avatar pour représenter une personne ou une entité. Passez src pour une photo, name ou initials pour le repli textuel. AvatarGroup empile plusieurs avatars avec un débordement « +N »."
|
|
12
|
+
importCode={`import { Avatar, AvatarGroup } from "@modoock/components";`}
|
|
13
|
+
>
|
|
14
|
+
<div className="grid gap-component md:grid-cols-2">
|
|
15
|
+
<DemoCard
|
|
16
|
+
title="Tailles"
|
|
17
|
+
code={`<Avatar name="Amine Berrada" size="sm" />
|
|
18
|
+
<Avatar name="Amine Berrada" size="md" />
|
|
19
|
+
<Avatar name="Amine Berrada" size="lg" />
|
|
20
|
+
<Avatar name="Amine Berrada" size="xl" />`}
|
|
21
|
+
>
|
|
22
|
+
<div className="flex flex-wrap items-end gap-component">
|
|
23
|
+
<Avatar name="Amine Berrada" size="sm" variant="primary" />
|
|
24
|
+
<Avatar name="Amine Berrada" size="md" variant="primary" />
|
|
25
|
+
<Avatar name="Amine Berrada" size="lg" variant="primary" />
|
|
26
|
+
<Avatar name="Amine Berrada" size="xl" variant="primary" />
|
|
27
|
+
</div>
|
|
28
|
+
</DemoCard>
|
|
29
|
+
|
|
30
|
+
<DemoCard
|
|
31
|
+
title="Variants"
|
|
32
|
+
code={`<Avatar name="AB" variant="default" />
|
|
33
|
+
<Avatar name="AB" variant="primary" />
|
|
34
|
+
<Avatar name="AB" variant="success" />
|
|
35
|
+
<Avatar name="AB" variant="info" />`}
|
|
36
|
+
>
|
|
37
|
+
<div className="flex flex-wrap gap-inline">
|
|
38
|
+
<Avatar name="Default" variant="default" />
|
|
39
|
+
<Avatar name="Primary" variant="primary" />
|
|
40
|
+
<Avatar name="Success" variant="success" />
|
|
41
|
+
<Avatar name="Warning" variant="warning" />
|
|
42
|
+
<Avatar name="Danger" variant="danger" />
|
|
43
|
+
<Avatar name="Info" variant="info" />
|
|
44
|
+
<Avatar name="Accent" variant="accent" />
|
|
45
|
+
</div>
|
|
46
|
+
</DemoCard>
|
|
47
|
+
|
|
48
|
+
<DemoCard
|
|
49
|
+
title="Image et repli"
|
|
50
|
+
description="Photo, initiales, ou icône si aucune donnée."
|
|
51
|
+
code={`<Avatar
|
|
52
|
+
src="/photos/amine.jpg"
|
|
53
|
+
name="Amine Berrada"
|
|
54
|
+
/>
|
|
55
|
+
<Avatar name="Sarah El Fassi" variant="info" />
|
|
56
|
+
<Avatar />`}
|
|
57
|
+
>
|
|
58
|
+
<div className="flex flex-wrap items-center gap-component">
|
|
59
|
+
<Avatar
|
|
60
|
+
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=96&h=96&fit=crop"
|
|
61
|
+
name="Sarah El Fassi"
|
|
62
|
+
/>
|
|
63
|
+
<Avatar name="Youssef Amrani" variant="info" />
|
|
64
|
+
<Avatar initials="KB" variant="accent" />
|
|
65
|
+
<Avatar />
|
|
66
|
+
</div>
|
|
67
|
+
</DemoCard>
|
|
68
|
+
|
|
69
|
+
<DemoCard
|
|
70
|
+
title="Statut"
|
|
71
|
+
code={`<Avatar name="Amine" status="online" />
|
|
72
|
+
<Avatar name="Sarah" status="busy" />
|
|
73
|
+
<Avatar name="Karim" status="away" />
|
|
74
|
+
<Avatar name="Nadia" status="offline" />`}
|
|
75
|
+
>
|
|
76
|
+
<div className="flex flex-wrap gap-component">
|
|
77
|
+
<Avatar name="Amine Berrada" variant="primary" status="online" />
|
|
78
|
+
<Avatar name="Sarah El Fassi" variant="info" status="busy" />
|
|
79
|
+
<Avatar name="Karim Tazi" variant="warning" status="away" />
|
|
80
|
+
<Avatar name="Nadia Chraibi" variant="default" status="offline" />
|
|
81
|
+
</div>
|
|
82
|
+
</DemoCard>
|
|
83
|
+
|
|
84
|
+
<DemoCard
|
|
85
|
+
title="Groupe"
|
|
86
|
+
description="Empilement avec débordement."
|
|
87
|
+
code={`<AvatarGroup max={3}>
|
|
88
|
+
<Avatar name="Amine Berrada" variant="primary" />
|
|
89
|
+
<Avatar name="Sarah El Fassi" variant="info" />
|
|
90
|
+
<Avatar name="Youssef Amrani" variant="success" />
|
|
91
|
+
<Avatar name="Leïla Benkirane" variant="accent" />
|
|
92
|
+
<Avatar name="Karim Tazi" variant="warning" />
|
|
93
|
+
</AvatarGroup>`}
|
|
94
|
+
>
|
|
95
|
+
<AvatarGroup max={3} size="md">
|
|
96
|
+
<Avatar name="Amine Berrada" variant="primary" />
|
|
97
|
+
<Avatar name="Sarah El Fassi" variant="info" />
|
|
98
|
+
<Avatar name="Youssef Amrani" variant="success" />
|
|
99
|
+
<Avatar name="Leïla Benkirane" variant="accent" />
|
|
100
|
+
<Avatar name="Karim Tazi" variant="warning" />
|
|
101
|
+
</AvatarGroup>
|
|
102
|
+
</DemoCard>
|
|
103
|
+
</div>
|
|
104
|
+
</ShowcaseShell>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
@@ -9,7 +9,7 @@ export default function BadgesPage() {
|
|
|
9
9
|
title="Badges"
|
|
10
10
|
subtitle={
|
|
11
11
|
<>
|
|
12
|
-
Composant <code className="
|
|
12
|
+
Composant <code className="">Badge</code>
|
|
13
13
|
</>
|
|
14
14
|
}
|
|
15
15
|
usage="Utilisez Badge pour un statut ou une étiquette courte. Le variant porte la sémantique (succès, danger, info…)."
|
|
@@ -9,7 +9,7 @@ export default function BarresDeMetriquePage() {
|
|
|
9
9
|
title="Barres de métrique"
|
|
10
10
|
subtitle={
|
|
11
11
|
<>
|
|
12
|
-
Composant <code className="
|
|
12
|
+
Composant <code className="">MetricBar</code>
|
|
13
13
|
</>
|
|
14
14
|
}
|
|
15
15
|
usage="Affichez une progression numérique (0–100) avec un ton sémantique. Idéal pour indicateurs compacts dans une fiche ou un résumé."
|
|
@@ -9,7 +9,7 @@ export default function BoutonsPage() {
|
|
|
9
9
|
title="Boutons"
|
|
10
10
|
subtitle={
|
|
11
11
|
<>
|
|
12
|
-
Composant <code className="
|
|
12
|
+
Composant <code className="">ClickableButton</code>
|
|
13
13
|
</>
|
|
14
14
|
}
|
|
15
15
|
usage="Utilisez ClickableButton pour toute action déclenchée par l’utilisateur. Choisissez le variant selon l’importance (primaire, secondaire, danger…) et évitez un élément HTML button brut."
|
|
@@ -19,9 +19,9 @@ export default function BoutonsPage() {
|
|
|
19
19
|
<DemoCard
|
|
20
20
|
title="Variants"
|
|
21
21
|
code={`<ClickableButton>Primary</ClickableButton>
|
|
22
|
-
<ClickableButton variant="secondary">Secondary</ClickableButton>
|
|
23
|
-
<ClickableButton variant="ghost">Ghost</ClickableButton>
|
|
24
|
-
<ClickableButton variant="danger">Danger</ClickableButton>`}
|
|
22
|
+
<ClickableButton variant="secondary">Secondary</ClickableButton>
|
|
23
|
+
<ClickableButton variant="ghost">Ghost</ClickableButton>
|
|
24
|
+
<ClickableButton variant="danger">Danger</ClickableButton>`}
|
|
25
25
|
>
|
|
26
26
|
<div className="flex flex-wrap gap-inline">
|
|
27
27
|
<ClickableButton>Primary</ClickableButton>
|
|
@@ -47,7 +47,11 @@ export default function BoutonsPage() {
|
|
|
47
47
|
<ClickableButton size="sm">Small</ClickableButton>
|
|
48
48
|
<ClickableButton size="md">Medium</ClickableButton>
|
|
49
49
|
<ClickableButton size="lg">Large</ClickableButton>
|
|
50
|
-
<ClickableButton
|
|
50
|
+
<ClickableButton
|
|
51
|
+
size="icon"
|
|
52
|
+
variant="secondary"
|
|
53
|
+
aria-label="Actualiser"
|
|
54
|
+
>
|
|
51
55
|
<Icon name="RefreshCw" size="small" aria-hidden="true" />
|
|
52
56
|
</ClickableButton>
|
|
53
57
|
</div>
|
|
@@ -82,7 +86,7 @@ export default function BoutonsPage() {
|
|
|
82
86
|
<ClickableButton
|
|
83
87
|
disabled
|
|
84
88
|
variant="danger"
|
|
85
|
-
leftIcon={<Icon name="
|
|
89
|
+
leftIcon={<Icon name="Trash" size="small" />}
|
|
86
90
|
>
|
|
87
91
|
Supprimer
|
|
88
92
|
</ClickableButton>
|
|
@@ -125,7 +129,10 @@ export default function BoutonsPage() {
|
|
|
125
129
|
Créer un nouveau projet
|
|
126
130
|
</ClickableButton>`}
|
|
127
131
|
>
|
|
128
|
-
<ClickableButton
|
|
132
|
+
<ClickableButton
|
|
133
|
+
fullWidth
|
|
134
|
+
leftIcon={<Icon name="Plus" size="small" />}
|
|
135
|
+
>
|
|
129
136
|
Créer un nouveau projet
|
|
130
137
|
</ClickableButton>
|
|
131
138
|
</DemoCard>
|
|
@@ -9,8 +9,8 @@ export default function ChampsPage() {
|
|
|
9
9
|
title="Champs de saisie"
|
|
10
10
|
subtitle={
|
|
11
11
|
<>
|
|
12
|
-
Composants <code className="
|
|
13
|
-
<code className="
|
|
12
|
+
Composants <code className="">Input</code> et{" "}
|
|
13
|
+
<code className="">Textarea</code>
|
|
14
14
|
</>
|
|
15
15
|
}
|
|
16
16
|
usage="Utilisez Input pour une saisie courte et Textarea pour un texte long. Préférez ces composants à un champ HTML brut : libellé, aide, erreur et compteur sont déjà prévus."
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { CodeBlock, DatePickersDemo, ShowcaseShell } from "../_shared";
|
|
4
|
+
|
|
5
|
+
export default function DatePickerPage() {
|
|
6
|
+
return (
|
|
7
|
+
<ShowcaseShell
|
|
8
|
+
title="Sélecteurs de date"
|
|
9
|
+
subtitle="Date, date et heure, plage"
|
|
10
|
+
usage="Utilisez DatePicker pour une date seule, DateTimePicker lorsqu’une heure est nécessaire, et DateRangePicker pour une période (début → fin). Passez value et onChange ; les textes d’interface sont en français."
|
|
11
|
+
importCode={`import {
|
|
12
|
+
DatePicker,
|
|
13
|
+
DateTimePicker,
|
|
14
|
+
DateRangePicker,
|
|
15
|
+
} from "@modoock/components";`}
|
|
16
|
+
>
|
|
17
|
+
<div className="mb-section">
|
|
18
|
+
<p className="mb-inline text-label uppercase tracking-[0.12em] text-muted-foreground">
|
|
19
|
+
Exemple de base
|
|
20
|
+
</p>
|
|
21
|
+
<CodeBlock
|
|
22
|
+
code={`const [date, setDate] = useState<Date | null>(null);
|
|
23
|
+
const [dateTime, setDateTime] = useState<Date | null>(null);
|
|
24
|
+
const [range, setRange] = useState({ from: null, to: null });
|
|
25
|
+
|
|
26
|
+
<DatePicker
|
|
27
|
+
label="Date"
|
|
28
|
+
value={date}
|
|
29
|
+
onChange={setDate}
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<DateTimePicker
|
|
33
|
+
label="Date et heure"
|
|
34
|
+
value={dateTime}
|
|
35
|
+
onChange={setDateTime}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
<DateRangePicker
|
|
39
|
+
label="Période"
|
|
40
|
+
value={range}
|
|
41
|
+
onChange={setRange}
|
|
42
|
+
/>`}
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
<DatePickersDemo />
|
|
46
|
+
</ShowcaseShell>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -9,7 +9,7 @@ export default function IconesPage() {
|
|
|
9
9
|
title="Icônes"
|
|
10
10
|
subtitle={
|
|
11
11
|
<>
|
|
12
|
-
Composant <code className="
|
|
12
|
+
Composant <code className="">Icon</code>
|
|
13
13
|
</>
|
|
14
14
|
}
|
|
15
15
|
usage="Passez toujours par Icon (noms Lucide). Choisissez size et variant du Design System — ne pas importer lucide-react directement dans les pages."
|
|
@@ -8,7 +8,7 @@ export default function ModalePage() {
|
|
|
8
8
|
title="Modale"
|
|
9
9
|
subtitle={
|
|
10
10
|
<>
|
|
11
|
-
Composant <code className="
|
|
11
|
+
Composant <code className="">Modal</code>
|
|
12
12
|
</>
|
|
13
13
|
}
|
|
14
14
|
usage="Ouvrez une modale pour une confirmation ou un formulaire court. Contrôlez open / onClose ; primaryAction et secondaryAction construisent le pied de page."
|
|
@@ -8,7 +8,7 @@ export default function OngletsPage() {
|
|
|
8
8
|
title="Onglets"
|
|
9
9
|
subtitle={
|
|
10
10
|
<>
|
|
11
|
-
Composant <code className="
|
|
11
|
+
Composant <code className="">Tabs</code>
|
|
12
12
|
</>
|
|
13
13
|
}
|
|
14
14
|
usage="Organisez un contenu en panneaux exclusifs. Un seul onglet actif à la fois ; le rendu enfant reçoit la valeur active."
|
|
@@ -38,12 +38,30 @@ const CATALOG: {
|
|
|
38
38
|
description: "Étiquettes de statut et variants.",
|
|
39
39
|
icon: "Tag",
|
|
40
40
|
},
|
|
41
|
+
{
|
|
42
|
+
href: "/components/avatar",
|
|
43
|
+
title: "Avatar",
|
|
44
|
+
description: "Photo, initiales, statut et groupe.",
|
|
45
|
+
icon: "CircleUserRound",
|
|
46
|
+
},
|
|
41
47
|
{
|
|
42
48
|
href: "/components/selecteurs",
|
|
43
49
|
title: "Sélecteurs",
|
|
44
50
|
description: "Select, multi-select, recherche et filtre.",
|
|
45
51
|
icon: "ListFilter",
|
|
46
52
|
},
|
|
53
|
+
{
|
|
54
|
+
href: "/components/date-picker",
|
|
55
|
+
title: "Sélecteurs de date",
|
|
56
|
+
description: "Date, date et heure, plage du… au….",
|
|
57
|
+
icon: "Calendar",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
href: "/components/agenda",
|
|
61
|
+
title: "Agenda",
|
|
62
|
+
description: "Vues mois, semaine et liste avec filtres.",
|
|
63
|
+
icon: "CalendarDays",
|
|
64
|
+
},
|
|
47
65
|
{
|
|
48
66
|
href: "/components/onglets",
|
|
49
67
|
title: "Onglets",
|
|
@@ -16,7 +16,7 @@ export default function TableauPage() {
|
|
|
16
16
|
title="Tableau"
|
|
17
17
|
subtitle={
|
|
18
18
|
<>
|
|
19
|
-
Composant <code className="
|
|
19
|
+
Composant <code className="">Table</code>
|
|
20
20
|
</>
|
|
21
21
|
}
|
|
22
22
|
usage="Une liste = une entité. Passez columns et data ; rowsPerPage active la pagination. Sur mobile, le tableau se transforme en cartes. Une seule table visible à la fois."
|
|
@@ -26,7 +26,7 @@ function Section({
|
|
|
26
26
|
}) {
|
|
27
27
|
return (
|
|
28
28
|
<section id={id} className="scroll-mt-component border-b border-border">
|
|
29
|
-
<div className="container
|
|
29
|
+
<div className="page-container py-major-section">
|
|
30
30
|
<div className="mb-section">
|
|
31
31
|
<p className="mb-inline text-label uppercase tracking-[0.12em] text-muted-foreground">
|
|
32
32
|
{number}
|
|
@@ -60,7 +60,7 @@ function TokenCard({
|
|
|
60
60
|
{children}
|
|
61
61
|
<div className="mt-component">
|
|
62
62
|
<p className="text-component-title text-foreground">{title}</p>
|
|
63
|
-
<p className="mt-micro
|
|
63
|
+
<p className="mt-micro text-small text-muted-foreground">
|
|
64
64
|
{value}
|
|
65
65
|
</p>
|
|
66
66
|
{description && (
|
|
@@ -87,7 +87,7 @@ function ColorSwatch({
|
|
|
87
87
|
<div className={`h-28 w-full ${className}`} />
|
|
88
88
|
<div className="p-component">
|
|
89
89
|
<p className="text-body-medium text-foreground">{name}</p>
|
|
90
|
-
<p className="mt-micro
|
|
90
|
+
<p className="mt-micro text-small text-muted-foreground">
|
|
91
91
|
{value}
|
|
92
92
|
</p>
|
|
93
93
|
</div>
|
package/template/app/globals.css
CHANGED
|
@@ -93,9 +93,9 @@
|
|
|
93
93
|
|
|
94
94
|
/* Radius */
|
|
95
95
|
|
|
96
|
-
--radius-small: 0.
|
|
97
|
-
--radius-medium: 0.
|
|
98
|
-
--radius-large:
|
|
96
|
+
--radius-small: 0.25rem; /* Used for compact UI elements. (Ex: small controls, tags and badges.) */
|
|
97
|
+
--radius-medium: 0.50rem; /* Used for standard interactive components. (Ex: buttons, inputs, selects and dropdowns.) */
|
|
98
|
+
--radius-large: 0.70rem; /* Used for larger containers and surfaces. (Ex: cards, panels and major content blocks.) */
|
|
99
99
|
--radius-full: 9999rem; /* Used for fully rounded elements. (Ex: pills, badges, avatars and circular buttons.) */
|
|
100
100
|
|
|
101
101
|
/* Layout */
|
|
@@ -250,8 +250,6 @@
|
|
|
250
250
|
|
|
251
251
|
@utility page-container {
|
|
252
252
|
width: 100%;
|
|
253
|
-
max-width: var(--container-content);
|
|
254
|
-
margin-inline: auto;
|
|
255
253
|
padding-inline: var(--page-padding-mobile);
|
|
256
254
|
}
|
|
257
255
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useRef,
|
|
6
|
+
useState,
|
|
7
|
+
type KeyboardEvent as ReactKeyboardEvent,
|
|
8
|
+
} from "react";
|
|
4
9
|
import Image from "next/image";
|
|
5
10
|
import { usePathname, useRouter } from "next/navigation";
|
|
6
11
|
import { Icon } from "@modoock/components";
|
|
@@ -9,6 +14,7 @@ import { scrollAppMainToIdWhenReady } from "@/lib/scroll-to-section";
|
|
|
9
14
|
|
|
10
15
|
const MD_NAV = "(min-width: 56rem)";
|
|
11
16
|
const DESKTOP_NAV = "(min-width: 1024px)";
|
|
17
|
+
const APP_VERSION = "2.5.1";
|
|
12
18
|
const FOCUSABLE_SELECTOR =
|
|
13
19
|
"a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex='-1'])";
|
|
14
20
|
|
|
@@ -38,7 +44,10 @@ const NAV_ITEMS: NavItem[] = [
|
|
|
38
44
|
{ label: "Suite", href: "/documentation#suite" },
|
|
39
45
|
],
|
|
40
46
|
},
|
|
41
|
-
{
|
|
47
|
+
{
|
|
48
|
+
label: "Design System",
|
|
49
|
+
href: "/design-system",
|
|
50
|
+
icon: "Palette",
|
|
42
51
|
children: [
|
|
43
52
|
{ label: "Couleurs", href: "/design-system#colors" },
|
|
44
53
|
{ label: "Typographie", href: "/design-system#typography" },
|
|
@@ -57,12 +66,16 @@ const NAV_ITEMS: NavItem[] = [
|
|
|
57
66
|
href: "/components",
|
|
58
67
|
icon: "Puzzle",
|
|
59
68
|
children: [
|
|
69
|
+
{ label: "Catalogue", href: "/components" },
|
|
60
70
|
{ label: "Champs de saisie", href: "/components/champs" },
|
|
61
71
|
{ label: "Boutons", href: "/components/boutons" },
|
|
62
72
|
{ label: "Icônes", href: "/components/icones" },
|
|
63
73
|
{ label: "Loader", href: "/components/loader" },
|
|
64
74
|
{ label: "Badges", href: "/components/badges" },
|
|
75
|
+
{ label: "Avatar", href: "/components/avatar" },
|
|
65
76
|
{ label: "Sélecteurs", href: "/components/selecteurs" },
|
|
77
|
+
{ label: "Sélecteurs de date", href: "/components/date-picker" },
|
|
78
|
+
{ label: "Agenda", href: "/components/agenda" },
|
|
66
79
|
{ label: "Onglets", href: "/components/onglets" },
|
|
67
80
|
{ label: "Modale", href: "/components/modale" },
|
|
68
81
|
{ label: "Barres de métrique", href: "/components/barres-de-metrique" },
|
|
@@ -81,6 +94,19 @@ function hashOf(href: string) {
|
|
|
81
94
|
return i === -1 ? "" : href.slice(i);
|
|
82
95
|
}
|
|
83
96
|
|
|
97
|
+
function itemMatchesRoute(item: NavItem, pathname: string): boolean {
|
|
98
|
+
if (pathname === item.href) return true;
|
|
99
|
+
if (item.href !== "/" && pathname.startsWith(`${item.href}/`)) return true;
|
|
100
|
+
return (item.children ?? []).some((child) => pathOf(child.href) === pathname);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function findActiveGroupHref(pathname: string): string | null {
|
|
104
|
+
const match = NAV_ITEMS.find(
|
|
105
|
+
(item) => item.children?.length && itemMatchesRoute(item, pathname),
|
|
106
|
+
);
|
|
107
|
+
return match?.href ?? null;
|
|
108
|
+
}
|
|
109
|
+
|
|
84
110
|
interface SideNavProps {
|
|
85
111
|
collapsed: boolean;
|
|
86
112
|
onCollapsedChange: (collapsed: boolean) => void;
|
|
@@ -90,7 +116,7 @@ export default function SideNav({
|
|
|
90
116
|
collapsed,
|
|
91
117
|
onCollapsedChange,
|
|
92
118
|
}: SideNavProps) {
|
|
93
|
-
const [
|
|
119
|
+
const [openGroup, setOpenGroup] = useState<string | null>(null);
|
|
94
120
|
const [hash, setHash] = useState("");
|
|
95
121
|
const [isMdUp, setIsMdUp] = useState(true);
|
|
96
122
|
const navRef = useRef<HTMLElement>(null);
|
|
@@ -122,6 +148,12 @@ export default function SideNav({
|
|
|
122
148
|
};
|
|
123
149
|
}, [onCollapsedChange]);
|
|
124
150
|
|
|
151
|
+
// Keep the section that owns the current route open (accordion).
|
|
152
|
+
useEffect(() => {
|
|
153
|
+
const activeGroup = findActiveGroupHref(pathname);
|
|
154
|
+
if (activeGroup) setOpenGroup(activeGroup);
|
|
155
|
+
}, [pathname]);
|
|
156
|
+
|
|
125
157
|
useEffect(() => {
|
|
126
158
|
if (!drawerOpen) return;
|
|
127
159
|
const main = document.getElementById("app-main");
|
|
@@ -146,7 +178,9 @@ export default function SideNav({
|
|
|
146
178
|
const trapDrawerTab = (event: ReactKeyboardEvent<HTMLElement>) => {
|
|
147
179
|
if (!drawerOpen || event.key !== "Tab") return;
|
|
148
180
|
const focusables = navRef.current
|
|
149
|
-
? Array.from(
|
|
181
|
+
? Array.from(
|
|
182
|
+
navRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),
|
|
183
|
+
)
|
|
150
184
|
: [];
|
|
151
185
|
if (focusables.length === 0) return;
|
|
152
186
|
const first = focusables[0];
|
|
@@ -161,6 +195,12 @@ export default function SideNav({
|
|
|
161
195
|
}
|
|
162
196
|
};
|
|
163
197
|
|
|
198
|
+
const closeMobileDrawer = () => {
|
|
199
|
+
if (!window.matchMedia(DESKTOP_NAV).matches) {
|
|
200
|
+
onCollapsedChange(true);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
164
204
|
const handleNavigate = (href: string) => {
|
|
165
205
|
router.push(href);
|
|
166
206
|
const sectionHash = hashOf(href);
|
|
@@ -168,13 +208,29 @@ export default function SideNav({
|
|
|
168
208
|
setHash(sectionHash);
|
|
169
209
|
scrollAppMainToIdWhenReady(sectionHash.slice(1));
|
|
170
210
|
}
|
|
171
|
-
|
|
172
|
-
onCollapsedChange(true);
|
|
173
|
-
}
|
|
211
|
+
closeMobileDrawer();
|
|
174
212
|
};
|
|
175
213
|
|
|
214
|
+
/** Accordion: open this group and close every other. */
|
|
176
215
|
const toggleGroup = (href: string) => {
|
|
177
|
-
|
|
216
|
+
setOpenGroup((prev) => (prev === href ? null : href));
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const handleParentClick = (item: NavItem) => {
|
|
220
|
+
const hasChildren = Boolean(item.children?.length);
|
|
221
|
+
|
|
222
|
+
if (hasChildren) {
|
|
223
|
+
// Collapsed rail: open the menu first, then expand that group.
|
|
224
|
+
if (!showLabels) {
|
|
225
|
+
onCollapsedChange(false);
|
|
226
|
+
setOpenGroup(item.href);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
toggleGroup(item.href);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
handleNavigate(item.href);
|
|
178
234
|
};
|
|
179
235
|
|
|
180
236
|
return (
|
|
@@ -200,115 +256,194 @@ export default function SideNav({
|
|
|
200
256
|
}`}
|
|
201
257
|
aria-label="Menu principal"
|
|
202
258
|
>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
>
|
|
209
|
-
{showLabels ? (
|
|
210
|
-
<Image
|
|
211
|
-
src="/identity/full_logo_white.svg"
|
|
212
|
-
alt="Modoock"
|
|
213
|
-
width={168}
|
|
214
|
-
height={46}
|
|
215
|
-
className="h-9 w-auto"
|
|
216
|
-
priority
|
|
217
|
-
/>
|
|
218
|
-
) : null}
|
|
219
|
-
<button
|
|
220
|
-
type="button"
|
|
221
|
-
onClick={() => onCollapsedChange(!collapsed)}
|
|
222
|
-
aria-label={collapsed ? "Ouvrir le menu" : "Fermer le menu"}
|
|
223
|
-
className="grid size-8 place-items-center rounded-small text-white/80 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current"
|
|
259
|
+
{/* Header */}
|
|
260
|
+
<div
|
|
261
|
+
className={`flex items-center border-b border-white/10 p-4 ${
|
|
262
|
+
showLabels ? "justify-between" : "justify-center"
|
|
263
|
+
}`}
|
|
224
264
|
>
|
|
225
|
-
{
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
265
|
+
{showLabels ? (
|
|
266
|
+
<Image
|
|
267
|
+
src="/identity/full_logo_white.svg"
|
|
268
|
+
alt="Modoock"
|
|
269
|
+
width={168}
|
|
270
|
+
height={46}
|
|
271
|
+
className="h-9 w-auto"
|
|
272
|
+
priority
|
|
273
|
+
/>
|
|
274
|
+
) : null}
|
|
275
|
+
<button
|
|
276
|
+
type="button"
|
|
277
|
+
onClick={() => onCollapsedChange(!collapsed)}
|
|
278
|
+
aria-label={collapsed ? "Ouvrir le menu" : "Fermer le menu"}
|
|
279
|
+
className="grid size-8 place-items-center rounded-small text-white/80 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current"
|
|
280
|
+
>
|
|
281
|
+
{collapsed ? (
|
|
282
|
+
<Icon name="PanelLeftOpen" aria-hidden="true" />
|
|
283
|
+
) : (
|
|
284
|
+
<Icon name="PanelLeftClose" aria-hidden="true" />
|
|
285
|
+
)}
|
|
286
|
+
</button>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
{/* Navigation */}
|
|
290
|
+
<div className="nav-scrollbar flex flex-1 flex-col gap-1 overflow-y-auto overscroll-contain px-2 py-2">
|
|
291
|
+
{NAV_ITEMS.map((item) => {
|
|
292
|
+
const hasChildren = Boolean(item.children?.length);
|
|
293
|
+
const isRouteActive = itemMatchesRoute(item, pathname);
|
|
294
|
+
const isOpen = openGroup === item.href;
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
<div key={item.href} className="flex flex-col gap-1">
|
|
298
|
+
<button
|
|
299
|
+
type="button"
|
|
300
|
+
onClick={() => handleParentClick(item)}
|
|
301
|
+
title={
|
|
302
|
+
hasChildren && !showLabels
|
|
303
|
+
? `${item.label} — ouvrir le menu`
|
|
304
|
+
: item.label
|
|
305
|
+
}
|
|
306
|
+
aria-label={showLabels ? undefined : item.label}
|
|
307
|
+
aria-expanded={
|
|
308
|
+
hasChildren && showLabels ? isOpen : undefined
|
|
309
|
+
}
|
|
310
|
+
aria-haspopup={hasChildren ? "true" : undefined}
|
|
311
|
+
className={`flex items-center gap-3 rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current ${
|
|
312
|
+
isRouteActive
|
|
313
|
+
? "bg-white/15 text-white"
|
|
314
|
+
: "text-white/80 hover:bg-white/10 hover:text-white"
|
|
315
|
+
} ${showLabels ? "" : "justify-center"}`}
|
|
316
|
+
>
|
|
317
|
+
<Icon name={item.icon} aria-hidden="true" />
|
|
318
|
+
{showLabels ? (
|
|
319
|
+
<>
|
|
320
|
+
<span className="min-w-0 flex-1 truncate">
|
|
321
|
+
{item.label}
|
|
322
|
+
</span>
|
|
323
|
+
{hasChildren ? (
|
|
324
|
+
<Icon
|
|
325
|
+
name="ChevronDown"
|
|
326
|
+
aria-hidden="true"
|
|
327
|
+
className={`ml-auto transition-transform duration-200 motion-reduce:transition-none ${
|
|
328
|
+
isOpen ? "rotate-180" : ""
|
|
329
|
+
}`}
|
|
330
|
+
/>
|
|
331
|
+
) : null}
|
|
332
|
+
</>
|
|
333
|
+
) : null}
|
|
334
|
+
</button>
|
|
232
335
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
336
|
+
{hasChildren && showLabels ? (
|
|
337
|
+
<div
|
|
338
|
+
className={`grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none ${
|
|
339
|
+
isOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
340
|
+
}`}
|
|
341
|
+
>
|
|
342
|
+
<div className="min-h-0 overflow-hidden">
|
|
343
|
+
<div
|
|
344
|
+
className="ml-5 flex flex-col gap-0.5 border-l border-white/20 py-1 pl-2"
|
|
345
|
+
role="group"
|
|
346
|
+
aria-label={item.label}
|
|
347
|
+
>
|
|
348
|
+
{item.children!.map((child) => {
|
|
349
|
+
const childHash = hashOf(child.href);
|
|
350
|
+
const isChildActive = childHash
|
|
351
|
+
? pathname === pathOf(child.href) &&
|
|
352
|
+
hash === childHash
|
|
353
|
+
: pathname === child.href;
|
|
354
|
+
return (
|
|
355
|
+
<button
|
|
356
|
+
key={child.href}
|
|
357
|
+
type="button"
|
|
358
|
+
onClick={() => handleNavigate(child.href)}
|
|
359
|
+
title={child.label}
|
|
360
|
+
className={`relative flex items-center rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white ${
|
|
361
|
+
isChildActive
|
|
362
|
+
? "bg-white/15 text-white"
|
|
363
|
+
: "text-white/70 hover:bg-white/10 hover:text-white"
|
|
364
|
+
}`}
|
|
365
|
+
>
|
|
366
|
+
{isChildActive ? (
|
|
367
|
+
<span
|
|
368
|
+
className="absolute top-1/2 left-0 h-4 w-0.5 -translate-y-1/2 rounded-full bg-white"
|
|
369
|
+
aria-hidden="true"
|
|
370
|
+
/>
|
|
371
|
+
) : null}
|
|
372
|
+
<span className="truncate">{child.label}</span>
|
|
373
|
+
</button>
|
|
374
|
+
);
|
|
375
|
+
})}
|
|
376
|
+
</div>
|
|
377
|
+
</div>
|
|
378
|
+
</div>
|
|
379
|
+
) : null}
|
|
380
|
+
</div>
|
|
242
381
|
);
|
|
243
|
-
|
|
244
|
-
|
|
382
|
+
})}
|
|
383
|
+
</div>
|
|
245
384
|
|
|
246
|
-
|
|
247
|
-
|
|
385
|
+
{/* Footer */}
|
|
386
|
+
<div
|
|
387
|
+
className={`mt-auto border-t border-white/10 ${
|
|
388
|
+
showLabels ? "p-3" : "p-2"
|
|
389
|
+
}`}
|
|
390
|
+
>
|
|
391
|
+
{showLabels ? (
|
|
392
|
+
<div className="flex flex-col gap-2">
|
|
248
393
|
<button
|
|
249
394
|
type="button"
|
|
250
|
-
onClick={() =>
|
|
251
|
-
|
|
252
|
-
toggleGroup(item.href);
|
|
253
|
-
}
|
|
254
|
-
handleNavigate(item.href);
|
|
255
|
-
}}
|
|
256
|
-
title={item.label}
|
|
257
|
-
aria-label={showLabels ? undefined : item.label}
|
|
258
|
-
aria-expanded={hasChildren && showLabels ? isOpen : undefined}
|
|
259
|
-
className={`flex items-center gap-3 rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0 [&_svg]:text-current ${
|
|
260
|
-
isActive
|
|
261
|
-
? "bg-white/15 text-white"
|
|
262
|
-
: "text-white/80 hover:bg-white/10 hover:text-white"
|
|
263
|
-
} ${showLabels ? "" : "justify-center"}`}
|
|
395
|
+
onClick={() => handleNavigate("/documentation")}
|
|
396
|
+
className="flex items-center gap-3 rounded-small px-2 py-2 text-left transition-colors hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0"
|
|
264
397
|
>
|
|
265
|
-
<
|
|
266
|
-
{showLabels ? <span className="truncate">{item.label}</span> : null}
|
|
267
|
-
{hasChildren && showLabels ? (
|
|
398
|
+
<span className="grid size-9 place-items-center rounded-full bg-white/15">
|
|
268
399
|
<Icon
|
|
269
|
-
name="
|
|
400
|
+
name="CircleQuestionMark"
|
|
401
|
+
size="small"
|
|
402
|
+
variant="white"
|
|
270
403
|
aria-hidden="true"
|
|
271
|
-
className={`ml-auto transition-transform ${
|
|
272
|
-
isOpen ? "rotate-180" : ""
|
|
273
|
-
}`}
|
|
274
404
|
/>
|
|
275
|
-
|
|
405
|
+
</span>
|
|
406
|
+
<span className="min-w-0 flex-1">
|
|
407
|
+
<span className="block truncate text-body-medium text-white">
|
|
408
|
+
Aide
|
|
409
|
+
</span>
|
|
410
|
+
<span className="block truncate text-small text-white/60">
|
|
411
|
+
Documentation
|
|
412
|
+
</span>
|
|
413
|
+
</span>
|
|
414
|
+
<Icon
|
|
415
|
+
name="ChevronRight"
|
|
416
|
+
size="small"
|
|
417
|
+
aria-hidden="true"
|
|
418
|
+
className="text-white/50"
|
|
419
|
+
/>
|
|
276
420
|
</button>
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
<
|
|
280
|
-
|
|
281
|
-
const childHash = hashOf(child.href);
|
|
282
|
-
const isChildActive = childHash
|
|
283
|
-
? pathname === pathOf(child.href) && hash === childHash
|
|
284
|
-
: pathname === child.href;
|
|
285
|
-
return (
|
|
286
|
-
<button
|
|
287
|
-
key={child.href}
|
|
288
|
-
type="button"
|
|
289
|
-
onClick={() => handleNavigate(child.href)}
|
|
290
|
-
title={child.label}
|
|
291
|
-
className={`flex items-center rounded-small px-3 py-2 text-left text-body-medium transition-colors focus-visible:ring-2 focus-visible:ring-white ${
|
|
292
|
-
isChildActive
|
|
293
|
-
? "bg-white/15 text-white"
|
|
294
|
-
: "text-white/70 hover:bg-white/10 hover:text-white"
|
|
295
|
-
}`}
|
|
296
|
-
>
|
|
297
|
-
<span className="truncate">{child.label}</span>
|
|
298
|
-
</button>
|
|
299
|
-
);
|
|
300
|
-
})}
|
|
301
|
-
</div>
|
|
302
|
-
) : null}
|
|
421
|
+
<div className="flex items-center justify-between px-2 text-small text-white/50">
|
|
422
|
+
<span>Modoock</span>
|
|
423
|
+
<span className="tabular-nums">v{APP_VERSION}</span>
|
|
424
|
+
</div>
|
|
303
425
|
</div>
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
426
|
+
) : (
|
|
427
|
+
<div className="flex flex-col items-center gap-1">
|
|
428
|
+
<button
|
|
429
|
+
type="button"
|
|
430
|
+
onClick={() => handleNavigate("/documentation")}
|
|
431
|
+
title="Aide"
|
|
432
|
+
aria-label="Aide — Documentation"
|
|
433
|
+
className="grid size-10 place-items-center rounded-small text-white/80 transition-colors hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-white [&_svg]:shrink-0"
|
|
434
|
+
>
|
|
435
|
+
<Icon
|
|
436
|
+
name="CircleQuestionMark"
|
|
437
|
+
variant="white"
|
|
438
|
+
aria-hidden="true"
|
|
439
|
+
/>
|
|
440
|
+
</button>
|
|
441
|
+
<span className="text-[10px] tabular-nums text-white/40">
|
|
442
|
+
v{APP_VERSION}
|
|
443
|
+
</span>
|
|
444
|
+
</div>
|
|
445
|
+
)}
|
|
446
|
+
</div>
|
|
312
447
|
</nav>
|
|
313
448
|
</>
|
|
314
449
|
);
|
package/template/next.config.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import { networkInterfaces } from "node:os";
|
|
3
4
|
|
|
5
|
+
/** Monorepo root — local `file:../../components` lives outside create-modoock-app/. */
|
|
6
|
+
const monorepoRoot = path.join(__dirname, "../..");
|
|
7
|
+
|
|
4
8
|
function lanHostnames(): string[] {
|
|
5
9
|
const hosts = new Set<string>();
|
|
6
10
|
for (const addrs of Object.values(networkInterfaces())) {
|
|
@@ -16,6 +20,14 @@ function lanHostnames(): string[] {
|
|
|
16
20
|
|
|
17
21
|
const nextConfig: NextConfig = {
|
|
18
22
|
allowedDevOrigins: lanHostnames(),
|
|
23
|
+
// Linked `@modoock/components` lives outside create-modoock-app/; widen FS root.
|
|
24
|
+
outputFileTracingRoot: monorepoRoot,
|
|
25
|
+
experimental: {
|
|
26
|
+
externalDir: true,
|
|
27
|
+
},
|
|
28
|
+
turbopack: {
|
|
29
|
+
root: monorepoRoot,
|
|
30
|
+
},
|
|
19
31
|
};
|
|
20
32
|
|
|
21
33
|
export default nextConfig;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"name": "modoock-projects-boilerplate",
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@modoock/components": "
|
|
12
|
-
"@modoock/knowledge-base": "
|
|
11
|
+
"@modoock/components": "file:../../components",
|
|
12
|
+
"@modoock/knowledge-base": "file:../../knowlage-base",
|
|
13
13
|
"lucide-react": "^1.31.0",
|
|
14
14
|
"next": "16.3.1",
|
|
15
15
|
"react": "19.2.8",
|
|
@@ -27,6 +27,28 @@
|
|
|
27
27
|
"typescript": "^5"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
+
"../../components": {
|
|
31
|
+
"name": "@modoock/components",
|
|
32
|
+
"version": "2.2.0",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/react": "^19",
|
|
36
|
+
"@types/react-dom": "^19",
|
|
37
|
+
"react": "^19",
|
|
38
|
+
"react-dom": "^19",
|
|
39
|
+
"typescript": "^5"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"lucide-react": ">=1",
|
|
43
|
+
"react": ">=18",
|
|
44
|
+
"react-dom": ">=18"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"../../knowlage-base": {
|
|
48
|
+
"name": "@modoock/knowledge-base",
|
|
49
|
+
"version": "1.2.0",
|
|
50
|
+
"license": "MIT"
|
|
51
|
+
},
|
|
30
52
|
"node_modules/@alloc/quick-lru": {
|
|
31
53
|
"version": "5.3.0",
|
|
32
54
|
"resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.3.0.tgz",
|
|
@@ -1275,21 +1297,12 @@
|
|
|
1275
1297
|
}
|
|
1276
1298
|
},
|
|
1277
1299
|
"node_modules/@modoock/components": {
|
|
1278
|
-
"
|
|
1279
|
-
"
|
|
1280
|
-
"integrity": "sha512-axUKsz5skMaAZH1i/WNcEZaz2Hcl2KZz+GHmbOcD6WFUvvAXeq21qxEAznFfYg+Cdd/3tAjOMT8g+3+JhhP7Fg==",
|
|
1281
|
-
"license": "MIT",
|
|
1282
|
-
"peerDependencies": {
|
|
1283
|
-
"lucide-react": ">=1",
|
|
1284
|
-
"react": ">=18",
|
|
1285
|
-
"react-dom": ">=18"
|
|
1286
|
-
}
|
|
1300
|
+
"resolved": "../../components",
|
|
1301
|
+
"link": true
|
|
1287
1302
|
},
|
|
1288
1303
|
"node_modules/@modoock/knowledge-base": {
|
|
1289
|
-
"
|
|
1290
|
-
"
|
|
1291
|
-
"integrity": "sha512-zYnVmZ+0QiEJkTopfiD5jQhZU1IRtiO+EwBRBveeALYLeAPOwrZc8HiNs0PlCCv2fo3zaDXfQweiA0MKt69T0w==",
|
|
1292
|
-
"license": "MIT"
|
|
1304
|
+
"resolved": "../../knowlage-base",
|
|
1305
|
+
"link": true
|
|
1293
1306
|
},
|
|
1294
1307
|
"node_modules/@napi-rs/wasm-runtime": {
|
|
1295
1308
|
"version": "1.2.5",
|
package/template/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"sg:scan": "ast-grep scan"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@modoock/components": "
|
|
15
|
-
"@modoock/knowledge-base": "
|
|
14
|
+
"@modoock/components": "file:../../components",
|
|
15
|
+
"@modoock/knowledge-base": "file:../../knowlage-base",
|
|
16
16
|
"lucide-react": "^1.31.0",
|
|
17
17
|
"next": "16.3.1",
|
|
18
18
|
"react": "19.2.8",
|