create-modoock-app 2.5.0 → 2.7.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.
@@ -0,0 +1,99 @@
1
+ "use client";
2
+
3
+ import { ClickableButton, Icon, Tooltip } from "@modoock/components";
4
+ import { DemoCard, ShowcaseShell } from "../_shared";
5
+
6
+ export default function InfobullePage() {
7
+ return (
8
+ <ShowcaseShell
9
+ title="Infobulle"
10
+ subtitle={
11
+ <>
12
+ Composant <code className="font-mono">Tooltip</code>
13
+ </>
14
+ }
15
+ usage="Utilisez Tooltip pour une aide courte au survol ou au focus. Ce n’est pas un substitut au label : un bouton icône garde son aria-label. Préférez une aide visible quand l’information est importante."
16
+ importCode={`import { Tooltip, ClickableButton } from "@modoock/components";
17
+
18
+ <Tooltip content="Enregistrer le dossier">
19
+ <ClickableButton type="button" variant="secondary">
20
+ Enregistrer
21
+ </ClickableButton>
22
+ </Tooltip>`}
23
+ >
24
+ <div className="grid gap-component md:grid-cols-2">
25
+ <DemoCard
26
+ title="Basique"
27
+ code={`<Tooltip content="Enregistrer le dossier">
28
+ <ClickableButton type="button" variant="secondary">
29
+ Enregistrer
30
+ </ClickableButton>
31
+ </Tooltip>`}
32
+ >
33
+ <Tooltip content="Enregistrer le dossier">
34
+ <ClickableButton type="button" variant="secondary">
35
+ Enregistrer
36
+ </ClickableButton>
37
+ </Tooltip>
38
+ </DemoCard>
39
+
40
+ <DemoCard
41
+ title="Bouton icône"
42
+ description="Conservez aria-label ; le tooltip complète seulement."
43
+ code={`<Tooltip content="Actualiser la liste">
44
+ <ClickableButton
45
+ type="button"
46
+ variant="secondary"
47
+ size="icon"
48
+ aria-label="Actualiser la liste"
49
+ >
50
+ <Icon name="RefreshCw" aria-hidden="true" />
51
+ </ClickableButton>
52
+ </Tooltip>`}
53
+ >
54
+ <Tooltip content="Actualiser la liste">
55
+ <ClickableButton
56
+ type="button"
57
+ variant="secondary"
58
+ size="icon"
59
+ aria-label="Actualiser la liste"
60
+ >
61
+ <Icon name="RefreshCw" aria-hidden="true" />
62
+ </ClickableButton>
63
+ </Tooltip>
64
+ </DemoCard>
65
+
66
+ <DemoCard
67
+ title="Positions"
68
+ code={`<Tooltip side="top" content="Haut" … />
69
+ <Tooltip side="right" content="Droite" … />
70
+ <Tooltip side="bottom" content="Bas" … />
71
+ <Tooltip side="left" content="Gauche" … />`}
72
+ >
73
+ <div className="flex flex-wrap items-center justify-center gap-component py-section">
74
+ <Tooltip side="top" content="Au-dessus">
75
+ <ClickableButton type="button" variant="secondary">
76
+ Haut
77
+ </ClickableButton>
78
+ </Tooltip>
79
+ <Tooltip side="right" content="À droite">
80
+ <ClickableButton type="button" variant="secondary">
81
+ Droite
82
+ </ClickableButton>
83
+ </Tooltip>
84
+ <Tooltip side="bottom" content="En dessous">
85
+ <ClickableButton type="button" variant="secondary">
86
+ Bas
87
+ </ClickableButton>
88
+ </Tooltip>
89
+ <Tooltip side="left" content="À gauche">
90
+ <ClickableButton type="button" variant="secondary">
91
+ Gauche
92
+ </ClickableButton>
93
+ </Tooltip>
94
+ </div>
95
+ </DemoCard>
96
+ </div>
97
+ </ShowcaseShell>
98
+ );
99
+ }
@@ -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",
@@ -38,6 +50,12 @@ const CATALOG: {
38
50
  description: "Étiquettes de statut et variants.",
39
51
  icon: "Tag",
40
52
  },
53
+ {
54
+ href: "/components/avatar",
55
+ title: "Avatar",
56
+ description: "Photo, initiales, statut et groupe.",
57
+ icon: "CircleUserRound",
58
+ },
41
59
  {
42
60
  href: "/components/selecteurs",
43
61
  title: "Sélecteurs",
@@ -68,12 +86,30 @@ const CATALOG: {
68
86
  description: "Dialogue avec actions primaire et secondaire.",
69
87
  icon: "AppWindow",
70
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
+ },
71
101
  {
72
102
  href: "/components/barres-de-metrique",
73
103
  title: "Barres de métrique",
74
104
  description: "Progression visuelle par ton.",
75
105
  icon: "ChartColumnIncreasing",
76
106
  },
107
+ {
108
+ href: "/components/graphiques",
109
+ title: "Graphiques",
110
+ description: "Courbes, barres, donut et sparkline.",
111
+ icon: "ChartLine",
112
+ },
77
113
  {
78
114
  href: "/components/stepper",
79
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&apos;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
+ }
@@ -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-system py-major-section">
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}
@@ -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
 
@@ -306,8 +304,8 @@
306
304
  padding-block: var(--spacing-control);
307
305
  outline: none;
308
306
  transition:
309
- border-color 150ms ease,
310
- background-color 150ms ease;
307
+ border-color 200ms ease,
308
+ background-color 200ms ease;
311
309
  }
312
310
 
313
311
  .ds-input::placeholder {
@@ -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
  );