create-modoock-app 2.6.0 → 2.7.1
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/dist/commands/update.js +118 -78
- package/dist/constants.js +8 -1
- package/dist/utils/metadata.js +26 -4
- package/package.json +1 -1
- package/template/app/(main)/components/graphiques/page.tsx +219 -0
- package/template/app/(main)/components/infobulle/page.tsx +99 -0
- package/template/app/(main)/components/interrupteur/page.tsx +92 -0
- package/template/app/(main)/components/page.tsx +30 -0
- package/template/app/(main)/components/tiroir/page.tsx +100 -0
- package/template/app/(main)/components/toasts/page.tsx +165 -0
- package/template/app/globals.css +2 -2
- package/template/app/layout.tsx +2 -0
- package/template/components/layout/header.tsx +337 -6
- package/template/components/layout/index.ts +1 -0
- package/template/components/layout/side-nav.tsx +5 -0
- package/template/components/layout/toaster-host.tsx +8 -0
- package/template/package-lock.json +398 -3
- package/template/package.json +2 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Switch } from "@modoock/components";
|
|
5
|
+
import { DemoCard, ShowcaseShell } from "../_shared";
|
|
6
|
+
|
|
7
|
+
export default function InterrupteurPage() {
|
|
8
|
+
const [notifications, setNotifications] = useState(true);
|
|
9
|
+
const [newsletter, setNewsletter] = useState(false);
|
|
10
|
+
const [compact, setCompact] = useState(true);
|
|
11
|
+
const [disabledOn, setDisabledOn] = useState(true);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<ShowcaseShell
|
|
15
|
+
title="Interrupteur"
|
|
16
|
+
subtitle={
|
|
17
|
+
<>
|
|
18
|
+
Composant <code className="font-mono">Switch</code>
|
|
19
|
+
</>
|
|
20
|
+
}
|
|
21
|
+
usage="Utilisez Switch pour une option binaire (activé / désactivé). Le label est obligatoire. Contrôlez checked et onCheckedChange."
|
|
22
|
+
importCode={`import { Switch } from "@modoock/components";
|
|
23
|
+
|
|
24
|
+
const [on, setOn] = useState(false);
|
|
25
|
+
|
|
26
|
+
<Switch
|
|
27
|
+
checked={on}
|
|
28
|
+
onCheckedChange={setOn}
|
|
29
|
+
label="Notifications"
|
|
30
|
+
description="Recevoir les alertes importantes."
|
|
31
|
+
/>`}
|
|
32
|
+
>
|
|
33
|
+
<div className="grid gap-component md:grid-cols-2">
|
|
34
|
+
<DemoCard
|
|
35
|
+
title="États"
|
|
36
|
+
description="Activé, désactivé et désactivé (non interactif)."
|
|
37
|
+
code={`<Switch
|
|
38
|
+
checked={notifications}
|
|
39
|
+
onCheckedChange={setNotifications}
|
|
40
|
+
label="Notifications"
|
|
41
|
+
description="Recevoir les alertes importantes."
|
|
42
|
+
/>`}
|
|
43
|
+
>
|
|
44
|
+
<div className="flex flex-col gap-component">
|
|
45
|
+
<Switch
|
|
46
|
+
checked={notifications}
|
|
47
|
+
onCheckedChange={setNotifications}
|
|
48
|
+
label="Notifications"
|
|
49
|
+
description="Recevoir les alertes importantes."
|
|
50
|
+
/>
|
|
51
|
+
<Switch
|
|
52
|
+
checked={newsletter}
|
|
53
|
+
onCheckedChange={setNewsletter}
|
|
54
|
+
label="Newsletter"
|
|
55
|
+
description="Actualités produit une fois par mois."
|
|
56
|
+
/>
|
|
57
|
+
<Switch
|
|
58
|
+
checked={disabledOn}
|
|
59
|
+
onCheckedChange={setDisabledOn}
|
|
60
|
+
label="Option verrouillée"
|
|
61
|
+
description="Non modifiable pour le moment."
|
|
62
|
+
disabled
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
</DemoCard>
|
|
66
|
+
|
|
67
|
+
<DemoCard
|
|
68
|
+
title="Tailles"
|
|
69
|
+
code={`<Switch size="sm" … />
|
|
70
|
+
<Switch size="md" … />`}
|
|
71
|
+
>
|
|
72
|
+
<div className="flex flex-col gap-component">
|
|
73
|
+
<Switch
|
|
74
|
+
size="sm"
|
|
75
|
+
checked={compact}
|
|
76
|
+
onCheckedChange={setCompact}
|
|
77
|
+
label="Compact"
|
|
78
|
+
description="Taille sm."
|
|
79
|
+
/>
|
|
80
|
+
<Switch
|
|
81
|
+
size="md"
|
|
82
|
+
checked={compact}
|
|
83
|
+
onCheckedChange={setCompact}
|
|
84
|
+
label="Standard"
|
|
85
|
+
description="Taille md (défaut)."
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
</DemoCard>
|
|
89
|
+
</div>
|
|
90
|
+
</ShowcaseShell>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -20,6 +20,18 @@ const CATALOG: {
|
|
|
20
20
|
description: "Variants, tailles, chargement et icônes.",
|
|
21
21
|
icon: "SquareMousePointer",
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
href: "/components/interrupteur",
|
|
25
|
+
title: "Interrupteur",
|
|
26
|
+
description: "Bascule activé / désactivé.",
|
|
27
|
+
icon: "ToggleRight",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
href: "/components/infobulle",
|
|
31
|
+
title: "Infobulle",
|
|
32
|
+
description: "Aide courte au survol ou au focus.",
|
|
33
|
+
icon: "MessageCircle",
|
|
34
|
+
},
|
|
23
35
|
{
|
|
24
36
|
href: "/components/icones",
|
|
25
37
|
title: "Icônes",
|
|
@@ -74,12 +86,30 @@ const CATALOG: {
|
|
|
74
86
|
description: "Dialogue avec actions primaire et secondaire.",
|
|
75
87
|
icon: "AppWindow",
|
|
76
88
|
},
|
|
89
|
+
{
|
|
90
|
+
href: "/components/tiroir",
|
|
91
|
+
title: "Tiroir",
|
|
92
|
+
description: "Panneau glissant depuis les quatre bords.",
|
|
93
|
+
icon: "PanelRight",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
href: "/components/toasts",
|
|
97
|
+
title: "Toasts",
|
|
98
|
+
description: "Notifications éphémères et variants.",
|
|
99
|
+
icon: "Bell",
|
|
100
|
+
},
|
|
77
101
|
{
|
|
78
102
|
href: "/components/barres-de-metrique",
|
|
79
103
|
title: "Barres de métrique",
|
|
80
104
|
description: "Progression visuelle par ton.",
|
|
81
105
|
icon: "ChartColumnIncreasing",
|
|
82
106
|
},
|
|
107
|
+
{
|
|
108
|
+
href: "/components/graphiques",
|
|
109
|
+
title: "Graphiques",
|
|
110
|
+
description: "Courbes, barres, donut et sparkline.",
|
|
111
|
+
icon: "ChartLine",
|
|
112
|
+
},
|
|
83
113
|
{
|
|
84
114
|
href: "/components/stepper",
|
|
85
115
|
title: "Stepper",
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { ClickableButton, Drawer } from "@modoock/components";
|
|
5
|
+
import type { DrawerSide } from "@modoock/components";
|
|
6
|
+
import { DemoCard, ShowcaseShell } from "../_shared";
|
|
7
|
+
|
|
8
|
+
const SIDES: { side: DrawerSide; label: string }[] = [
|
|
9
|
+
{ side: "bottom", label: "Bas → haut" },
|
|
10
|
+
{ side: "top", label: "Haut" },
|
|
11
|
+
{ side: "right", label: "Droite" },
|
|
12
|
+
{ side: "left", label: "Gauche" },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
function DrawerSidesDemo() {
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
const [side, setSide] = useState<DrawerSide>("bottom");
|
|
18
|
+
|
|
19
|
+
const openSide = (next: DrawerSide) => {
|
|
20
|
+
setSide(next);
|
|
21
|
+
setOpen(true);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<div className="flex flex-wrap gap-inline">
|
|
27
|
+
{SIDES.map((item) => (
|
|
28
|
+
<ClickableButton
|
|
29
|
+
key={item.side}
|
|
30
|
+
type="button"
|
|
31
|
+
variant="secondary"
|
|
32
|
+
onClick={() => openSide(item.side)}
|
|
33
|
+
>
|
|
34
|
+
{item.label}
|
|
35
|
+
</ClickableButton>
|
|
36
|
+
))}
|
|
37
|
+
</div>
|
|
38
|
+
<Drawer
|
|
39
|
+
open={open}
|
|
40
|
+
side={side}
|
|
41
|
+
title="Détails"
|
|
42
|
+
onClose={() => setOpen(false)}
|
|
43
|
+
primaryAction={{
|
|
44
|
+
label: "Enregistrer",
|
|
45
|
+
onClick: () => setOpen(false),
|
|
46
|
+
}}
|
|
47
|
+
secondaryAction={{
|
|
48
|
+
label: "Annuler",
|
|
49
|
+
onClick: () => setOpen(false),
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<p className="text-body text-muted-foreground">
|
|
53
|
+
Panneau glissant depuis le bord{" "}
|
|
54
|
+
<span className="text-foreground">
|
|
55
|
+
{SIDES.find((item) => item.side === side)?.label.toLowerCase() ??
|
|
56
|
+
"bas"}
|
|
57
|
+
</span>
|
|
58
|
+
. Fermez avec Escape, le bouton ou l'overlay.
|
|
59
|
+
</p>
|
|
60
|
+
</Drawer>
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default function TiroirPage() {
|
|
66
|
+
return (
|
|
67
|
+
<ShowcaseShell
|
|
68
|
+
title="Tiroir"
|
|
69
|
+
subtitle={
|
|
70
|
+
<>
|
|
71
|
+
Composant <code className="font-mono">Drawer</code>
|
|
72
|
+
</>
|
|
73
|
+
}
|
|
74
|
+
usage="Utilisez Drawer pour un panneau contextuel ancré à un bord (filtres, détail, formulaire). Contrôlez open / onClose et side (left, right, top, bottom). Même comportement que Modal pour le focus, Escape et le scroll."
|
|
75
|
+
importCode={`import { Drawer, ClickableButton } from "@modoock/components";`}
|
|
76
|
+
>
|
|
77
|
+
<div className="grid gap-component md:grid-cols-2">
|
|
78
|
+
<DemoCard
|
|
79
|
+
title="Quatre côtés"
|
|
80
|
+
description="Focus piégé, fermeture Escape, overlay, overscroll contenu."
|
|
81
|
+
code={`const [open, setOpen] = useState(false);
|
|
82
|
+
const [side, setSide] = useState<DrawerSide>("bottom");
|
|
83
|
+
|
|
84
|
+
<Drawer
|
|
85
|
+
open={open}
|
|
86
|
+
side={side}
|
|
87
|
+
title="Détails"
|
|
88
|
+
onClose={() => setOpen(false)}
|
|
89
|
+
primaryAction={{ label: "Enregistrer", onClick: () => setOpen(false) }}
|
|
90
|
+
secondaryAction={{ label: "Annuler", onClick: () => setOpen(false) }}
|
|
91
|
+
>
|
|
92
|
+
…
|
|
93
|
+
</Drawer>`}
|
|
94
|
+
>
|
|
95
|
+
<DrawerSidesDemo />
|
|
96
|
+
</DemoCard>
|
|
97
|
+
</div>
|
|
98
|
+
</ShowcaseShell>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { ClickableButton, toast } from "@modoock/components";
|
|
4
|
+
import { DemoCard, ShowcaseShell } from "../_shared";
|
|
5
|
+
|
|
6
|
+
export default function ToastsPage() {
|
|
7
|
+
return (
|
|
8
|
+
<ShowcaseShell
|
|
9
|
+
title="Toasts"
|
|
10
|
+
subtitle={
|
|
11
|
+
<>
|
|
12
|
+
Composants <code className="font-mono">Toaster</code> et{" "}
|
|
13
|
+
<code className="font-mono">toast</code>
|
|
14
|
+
</>
|
|
15
|
+
}
|
|
16
|
+
usage="Montez <Toaster /> une seule fois dans le layout. Déclenchez une notification avec toast.success(title, description) ou toast({ title, description, variant }). Le titre et la description sont obligatoires. Les textes doivent rester en français."
|
|
17
|
+
importCode={`import { Toaster, toast } from "@modoock/components";
|
|
18
|
+
|
|
19
|
+
// layout
|
|
20
|
+
<Toaster position="bottom-right" />
|
|
21
|
+
|
|
22
|
+
// action
|
|
23
|
+
toast.success(
|
|
24
|
+
"Enregistrement réussi",
|
|
25
|
+
"Le dossier a été mis à jour.",
|
|
26
|
+
);`}
|
|
27
|
+
>
|
|
28
|
+
<div className="grid gap-component md:grid-cols-2">
|
|
29
|
+
<DemoCard
|
|
30
|
+
title="Variants"
|
|
31
|
+
description="Succès, info, avertissement, erreur et message neutre."
|
|
32
|
+
code={`toast.success(
|
|
33
|
+
"Enregistrement réussi",
|
|
34
|
+
"Le dossier a été mis à jour.",
|
|
35
|
+
);
|
|
36
|
+
toast.info(
|
|
37
|
+
"Synchronisation…",
|
|
38
|
+
"Les données sont en cours de mise à jour.",
|
|
39
|
+
);
|
|
40
|
+
toast.warning(
|
|
41
|
+
"Champs incomplets",
|
|
42
|
+
"Vérifiez les champs obligatoires.",
|
|
43
|
+
);
|
|
44
|
+
toast.danger(
|
|
45
|
+
"Échec de l’enregistrement",
|
|
46
|
+
"Réessayez ou contactez le support.",
|
|
47
|
+
);
|
|
48
|
+
toast.message(
|
|
49
|
+
"Brouillon conservé",
|
|
50
|
+
"Vous pourrez le reprendre plus tard.",
|
|
51
|
+
);`}
|
|
52
|
+
>
|
|
53
|
+
<div className="flex flex-wrap gap-inline">
|
|
54
|
+
<ClickableButton
|
|
55
|
+
type="button"
|
|
56
|
+
variant="secondary"
|
|
57
|
+
onClick={() =>
|
|
58
|
+
toast.success(
|
|
59
|
+
"Enregistrement réussi",
|
|
60
|
+
"Le dossier a été mis à jour.",
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
>
|
|
64
|
+
Succès
|
|
65
|
+
</ClickableButton>
|
|
66
|
+
<ClickableButton
|
|
67
|
+
type="button"
|
|
68
|
+
variant="secondary"
|
|
69
|
+
onClick={() =>
|
|
70
|
+
toast.info(
|
|
71
|
+
"Synchronisation…",
|
|
72
|
+
"Les données sont en cours de mise à jour.",
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
>
|
|
76
|
+
Info
|
|
77
|
+
</ClickableButton>
|
|
78
|
+
<ClickableButton
|
|
79
|
+
type="button"
|
|
80
|
+
variant="secondary"
|
|
81
|
+
onClick={() =>
|
|
82
|
+
toast.warning(
|
|
83
|
+
"Champs incomplets",
|
|
84
|
+
"Vérifiez les champs obligatoires.",
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
Avertissement
|
|
89
|
+
</ClickableButton>
|
|
90
|
+
<ClickableButton
|
|
91
|
+
type="button"
|
|
92
|
+
variant="secondary"
|
|
93
|
+
onClick={() =>
|
|
94
|
+
toast.danger(
|
|
95
|
+
"Échec de l’enregistrement",
|
|
96
|
+
"Réessayez ou contactez le support.",
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
>
|
|
100
|
+
Erreur
|
|
101
|
+
</ClickableButton>
|
|
102
|
+
<ClickableButton
|
|
103
|
+
type="button"
|
|
104
|
+
variant="secondary"
|
|
105
|
+
onClick={() =>
|
|
106
|
+
toast.message(
|
|
107
|
+
"Brouillon conservé",
|
|
108
|
+
"Vous pourrez le reprendre plus tard.",
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
>
|
|
112
|
+
Neutre
|
|
113
|
+
</ClickableButton>
|
|
114
|
+
</div>
|
|
115
|
+
</DemoCard>
|
|
116
|
+
|
|
117
|
+
<DemoCard
|
|
118
|
+
title="Durée"
|
|
119
|
+
description="duration: 0 garde le toast ouvert jusqu’à fermeture manuelle."
|
|
120
|
+
code={`toast({
|
|
121
|
+
title: "Dossier mis à jour",
|
|
122
|
+
description: "Les modifications sont visibles pour l’équipe.",
|
|
123
|
+
variant: "success",
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
toast.info(
|
|
127
|
+
"Action requise",
|
|
128
|
+
"Validez le document avant de continuer.",
|
|
129
|
+
{ duration: 0 },
|
|
130
|
+
);`}
|
|
131
|
+
>
|
|
132
|
+
<div className="flex flex-wrap gap-inline">
|
|
133
|
+
<ClickableButton
|
|
134
|
+
type="button"
|
|
135
|
+
variant="secondary"
|
|
136
|
+
onClick={() =>
|
|
137
|
+
toast({
|
|
138
|
+
title: "Dossier mis à jour",
|
|
139
|
+
description:
|
|
140
|
+
"Les modifications sont visibles pour l’équipe.",
|
|
141
|
+
variant: "success",
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
Objet toast
|
|
146
|
+
</ClickableButton>
|
|
147
|
+
<ClickableButton
|
|
148
|
+
type="button"
|
|
149
|
+
variant="secondary"
|
|
150
|
+
onClick={() =>
|
|
151
|
+
toast.info(
|
|
152
|
+
"Action requise",
|
|
153
|
+
"Validez le document avant de continuer.",
|
|
154
|
+
{ duration: 0 },
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
>
|
|
158
|
+
Persistant
|
|
159
|
+
</ClickableButton>
|
|
160
|
+
</div>
|
|
161
|
+
</DemoCard>
|
|
162
|
+
</div>
|
|
163
|
+
</ShowcaseShell>
|
|
164
|
+
);
|
|
165
|
+
}
|
package/template/app/globals.css
CHANGED
package/template/app/layout.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./globals.css";
|
|
2
2
|
import type { Metadata, Viewport } from "next";
|
|
3
3
|
import { Montserrat } from "next/font/google";
|
|
4
|
+
import { ToasterHost } from "@/components/layout";
|
|
4
5
|
|
|
5
6
|
const montserrat = Montserrat({
|
|
6
7
|
variable: "--font-montserrat",
|
|
@@ -22,6 +23,7 @@ export default function RootLayout({ children }: LayoutProps<"/">) {
|
|
|
22
23
|
<html lang="fr" className={`${montserrat.className} antialiased`}>
|
|
23
24
|
<body className="flex h-screen overflow-hidden bg-background">
|
|
24
25
|
{children}
|
|
26
|
+
<ToasterHost />
|
|
25
27
|
</body>
|
|
26
28
|
</html>
|
|
27
29
|
);
|