create-modoock-app 2.5.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/avatar/page.tsx +106 -0
- package/template/app/(main)/components/page.tsx +6 -0
- package/template/app/(main)/design-system/page.tsx +1 -1
- package/template/app/globals.css +0 -2
- package/template/components/layout/side-nav.tsx +238 -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
|
@@ -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
|
+
}
|
|
@@ -38,6 +38,12 @@ 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",
|
|
@@ -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}
|
package/template/app/globals.css
CHANGED
|
@@ -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,11 +66,13 @@ 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" },
|
|
66
77
|
{ label: "Sélecteurs de date", href: "/components/date-picker" },
|
|
67
78
|
{ label: "Agenda", href: "/components/agenda" },
|
|
@@ -83,6 +94,19 @@ function hashOf(href: string) {
|
|
|
83
94
|
return i === -1 ? "" : href.slice(i);
|
|
84
95
|
}
|
|
85
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
|
+
|
|
86
110
|
interface SideNavProps {
|
|
87
111
|
collapsed: boolean;
|
|
88
112
|
onCollapsedChange: (collapsed: boolean) => void;
|
|
@@ -92,7 +116,7 @@ export default function SideNav({
|
|
|
92
116
|
collapsed,
|
|
93
117
|
onCollapsedChange,
|
|
94
118
|
}: SideNavProps) {
|
|
95
|
-
const [
|
|
119
|
+
const [openGroup, setOpenGroup] = useState<string | null>(null);
|
|
96
120
|
const [hash, setHash] = useState("");
|
|
97
121
|
const [isMdUp, setIsMdUp] = useState(true);
|
|
98
122
|
const navRef = useRef<HTMLElement>(null);
|
|
@@ -124,6 +148,12 @@ export default function SideNav({
|
|
|
124
148
|
};
|
|
125
149
|
}, [onCollapsedChange]);
|
|
126
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
|
+
|
|
127
157
|
useEffect(() => {
|
|
128
158
|
if (!drawerOpen) return;
|
|
129
159
|
const main = document.getElementById("app-main");
|
|
@@ -148,7 +178,9 @@ export default function SideNav({
|
|
|
148
178
|
const trapDrawerTab = (event: ReactKeyboardEvent<HTMLElement>) => {
|
|
149
179
|
if (!drawerOpen || event.key !== "Tab") return;
|
|
150
180
|
const focusables = navRef.current
|
|
151
|
-
? Array.from(
|
|
181
|
+
? Array.from(
|
|
182
|
+
navRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),
|
|
183
|
+
)
|
|
152
184
|
: [];
|
|
153
185
|
if (focusables.length === 0) return;
|
|
154
186
|
const first = focusables[0];
|
|
@@ -163,6 +195,12 @@ export default function SideNav({
|
|
|
163
195
|
}
|
|
164
196
|
};
|
|
165
197
|
|
|
198
|
+
const closeMobileDrawer = () => {
|
|
199
|
+
if (!window.matchMedia(DESKTOP_NAV).matches) {
|
|
200
|
+
onCollapsedChange(true);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
166
204
|
const handleNavigate = (href: string) => {
|
|
167
205
|
router.push(href);
|
|
168
206
|
const sectionHash = hashOf(href);
|
|
@@ -170,13 +208,29 @@ export default function SideNav({
|
|
|
170
208
|
setHash(sectionHash);
|
|
171
209
|
scrollAppMainToIdWhenReady(sectionHash.slice(1));
|
|
172
210
|
}
|
|
173
|
-
|
|
174
|
-
onCollapsedChange(true);
|
|
175
|
-
}
|
|
211
|
+
closeMobileDrawer();
|
|
176
212
|
};
|
|
177
213
|
|
|
214
|
+
/** Accordion: open this group and close every other. */
|
|
178
215
|
const toggleGroup = (href: string) => {
|
|
179
|
-
|
|
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);
|
|
180
234
|
};
|
|
181
235
|
|
|
182
236
|
return (
|
|
@@ -202,115 +256,194 @@ export default function SideNav({
|
|
|
202
256
|
}`}
|
|
203
257
|
aria-label="Menu principal"
|
|
204
258
|
>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
>
|
|
211
|
-
{showLabels ? (
|
|
212
|
-
<Image
|
|
213
|
-
src="/identity/full_logo_white.svg"
|
|
214
|
-
alt="Modoock"
|
|
215
|
-
width={168}
|
|
216
|
-
height={46}
|
|
217
|
-
className="h-9 w-auto"
|
|
218
|
-
priority
|
|
219
|
-
/>
|
|
220
|
-
) : null}
|
|
221
|
-
<button
|
|
222
|
-
type="button"
|
|
223
|
-
onClick={() => onCollapsedChange(!collapsed)}
|
|
224
|
-
aria-label={collapsed ? "Ouvrir le menu" : "Fermer le menu"}
|
|
225
|
-
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
|
+
}`}
|
|
226
264
|
>
|
|
227
|
-
{
|
|
228
|
-
<
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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>
|
|
234
335
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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>
|
|
244
381
|
);
|
|
245
|
-
|
|
246
|
-
|
|
382
|
+
})}
|
|
383
|
+
</div>
|
|
247
384
|
|
|
248
|
-
|
|
249
|
-
|
|
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">
|
|
250
393
|
<button
|
|
251
394
|
type="button"
|
|
252
|
-
onClick={() =>
|
|
253
|
-
|
|
254
|
-
toggleGroup(item.href);
|
|
255
|
-
}
|
|
256
|
-
handleNavigate(item.href);
|
|
257
|
-
}}
|
|
258
|
-
title={item.label}
|
|
259
|
-
aria-label={showLabels ? undefined : item.label}
|
|
260
|
-
aria-expanded={hasChildren && showLabels ? isOpen : undefined}
|
|
261
|
-
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 ${
|
|
262
|
-
isActive
|
|
263
|
-
? "bg-white/15 text-white"
|
|
264
|
-
: "text-white/80 hover:bg-white/10 hover:text-white"
|
|
265
|
-
} ${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"
|
|
266
397
|
>
|
|
267
|
-
<
|
|
268
|
-
{showLabels ? <span className="truncate">{item.label}</span> : null}
|
|
269
|
-
{hasChildren && showLabels ? (
|
|
398
|
+
<span className="grid size-9 place-items-center rounded-full bg-white/15">
|
|
270
399
|
<Icon
|
|
271
|
-
name="
|
|
400
|
+
name="CircleQuestionMark"
|
|
401
|
+
size="small"
|
|
402
|
+
variant="white"
|
|
272
403
|
aria-hidden="true"
|
|
273
|
-
className={`ml-auto transition-transform ${
|
|
274
|
-
isOpen ? "rotate-180" : ""
|
|
275
|
-
}`}
|
|
276
404
|
/>
|
|
277
|
-
|
|
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
|
+
/>
|
|
278
420
|
</button>
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
<
|
|
282
|
-
|
|
283
|
-
const childHash = hashOf(child.href);
|
|
284
|
-
const isChildActive = childHash
|
|
285
|
-
? pathname === pathOf(child.href) && hash === childHash
|
|
286
|
-
: pathname === child.href;
|
|
287
|
-
return (
|
|
288
|
-
<button
|
|
289
|
-
key={child.href}
|
|
290
|
-
type="button"
|
|
291
|
-
onClick={() => handleNavigate(child.href)}
|
|
292
|
-
title={child.label}
|
|
293
|
-
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 ${
|
|
294
|
-
isChildActive
|
|
295
|
-
? "bg-white/15 text-white"
|
|
296
|
-
: "text-white/70 hover:bg-white/10 hover:text-white"
|
|
297
|
-
}`}
|
|
298
|
-
>
|
|
299
|
-
<span className="truncate">{child.label}</span>
|
|
300
|
-
</button>
|
|
301
|
-
);
|
|
302
|
-
})}
|
|
303
|
-
</div>
|
|
304
|
-
) : 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>
|
|
305
425
|
</div>
|
|
306
|
-
)
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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>
|
|
314
447
|
</nav>
|
|
315
448
|
</>
|
|
316
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",
|