@designa8/vibedesign-v6 1.6.7
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/README.md +66 -0
- package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
- package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
- package/dist/index.cjs +3231 -0
- package/dist/index.js +3201 -0
- package/dist/styles.css +1810 -0
- package/package.json +109 -0
- package/src/atoms/AppLayout/AppLayout.tsx +537 -0
- package/src/atoms/AppLayout/index.ts +2 -0
- package/src/atoms/AppLayout/preview.tsx +75 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +399 -0
- package/src/atoms/AppSidebar/index.ts +2 -0
- package/src/atoms/AppSidebar/preview.tsx +214 -0
- package/src/atoms/AuthScreen/AuthScreen.tsx +226 -0
- package/src/atoms/AuthScreen/index.ts +2 -0
- package/src/atoms/AuthScreen/preview.tsx +10 -0
- package/src/atoms/Button/Button.tsx +71 -0
- package/src/atoms/Button/index.ts +2 -0
- package/src/atoms/Button/preview.tsx +71 -0
- package/src/atoms/ChatScreen/ChatScreen.tsx +629 -0
- package/src/atoms/ChatScreen/index.ts +2 -0
- package/src/atoms/ChatScreen/preview.tsx +239 -0
- package/src/atoms/Chip/Chip.tsx +121 -0
- package/src/atoms/Chip/index.ts +2 -0
- package/src/atoms/Chip/preview.tsx +99 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +95 -0
- package/src/atoms/FilterTabBar/index.ts +2 -0
- package/src/atoms/FilterTabBar/preview.tsx +92 -0
- package/src/atoms/Input/Input.tsx +139 -0
- package/src/atoms/Input/index.ts +2 -0
- package/src/atoms/Input/preview.tsx +97 -0
- package/src/atoms/Modal/Modal.tsx +144 -0
- package/src/atoms/Modal/index.ts +2 -0
- package/src/atoms/Modal/preview.tsx +111 -0
- package/src/atoms/NavItem/NavItem.tsx +316 -0
- package/src/atoms/NavItem/index.ts +2 -0
- package/src/atoms/NavItem/preview.tsx +125 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +626 -0
- package/src/atoms/PromptInputBar/index.ts +2 -0
- package/src/atoms/PromptInputBar/preview.tsx +85 -0
- package/src/atoms/TopNavbar/TopNavbar.tsx +400 -0
- package/src/atoms/TopNavbar/index.ts +2 -0
- package/src/atoms/TopNavbar/preview.tsx +117 -0
- package/src/atoms/UpgradeCard/UpgradeCard.tsx +65 -0
- package/src/atoms/UpgradeCard/index.ts +2 -0
- package/src/atoms/UpgradeCard/preview.tsx +25 -0
- package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +216 -0
- package/src/atoms/WorkspaceMenu/index.ts +2 -0
- package/src/atoms/WorkspaceMenu/preview.tsx +44 -0
- package/src/index.ts +16 -0
- package/src/tokens.css +165 -0
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
|
|
4
|
+
export interface NavItemShortcut {
|
|
5
|
+
/** E.g. "⌘" */
|
|
6
|
+
modifier?: string;
|
|
7
|
+
/** E.g. "K" */
|
|
8
|
+
key: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface NavItemSubItem {
|
|
12
|
+
/** Unique identifier for the sub-item */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Label text */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Optional delete callback — when provided a trash icon appears on hover */
|
|
17
|
+
onDelete?: (id: string) => void;
|
|
18
|
+
/** Optional click callback — when provided the label becomes a clickable button */
|
|
19
|
+
onClick?: (id: string) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface NavItemProps extends React.HTMLAttributes<HTMLElement> {
|
|
23
|
+
/** Icon rendered as an inline SVG or any ReactNode */
|
|
24
|
+
icon?: React.ReactNode;
|
|
25
|
+
/** Nav item label */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Whether this item is currently active/selected */
|
|
28
|
+
active?: boolean;
|
|
29
|
+
/** Optional keyboard shortcut displayed on the right */
|
|
30
|
+
shortcut?: NavItemShortcut;
|
|
31
|
+
/** Structured sub-items with optional per-item delete */
|
|
32
|
+
subItems?: NavItemSubItem[];
|
|
33
|
+
/** Freeform children — displayed as an indented nested list (legacy) */
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
/** Whether sub-items / children are expanded (controlled) */
|
|
36
|
+
expanded?: boolean;
|
|
37
|
+
/** Callback fired when the chevron / expand area is clicked */
|
|
38
|
+
onExpandToggle?: () => void;
|
|
39
|
+
/** When true, hides the label and shortcut — shows icon only (collapsed sidebar mode) */
|
|
40
|
+
iconOnly?: boolean;
|
|
41
|
+
/** Callback when the item is clicked */
|
|
42
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const ChevronDownIcon = () => (
|
|
46
|
+
<svg
|
|
47
|
+
viewBox="0 0 24 24"
|
|
48
|
+
fill="none"
|
|
49
|
+
stroke="currentColor"
|
|
50
|
+
strokeWidth="2"
|
|
51
|
+
strokeLinecap="round"
|
|
52
|
+
strokeLinejoin="round"
|
|
53
|
+
aria-hidden="true"
|
|
54
|
+
style={{ width: "14px", height: "14px", flexShrink: 0 }}
|
|
55
|
+
>
|
|
56
|
+
<polyline points="6 9 12 15 18 9" />
|
|
57
|
+
</svg>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const TrashIcon = () => (
|
|
61
|
+
<svg
|
|
62
|
+
viewBox="0 0 24 24"
|
|
63
|
+
fill="none"
|
|
64
|
+
stroke="currentColor"
|
|
65
|
+
strokeWidth="1.75"
|
|
66
|
+
strokeLinecap="round"
|
|
67
|
+
strokeLinejoin="round"
|
|
68
|
+
aria-hidden="true"
|
|
69
|
+
style={{ width: "14px", height: "14px", flexShrink: 0 }}
|
|
70
|
+
>
|
|
71
|
+
<polyline points="3 6 5 6 21 6" />
|
|
72
|
+
<path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" />
|
|
73
|
+
<path d="M10 11v6M14 11v6" />
|
|
74
|
+
<path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" />
|
|
75
|
+
</svg>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
interface SubItemRowProps {
|
|
79
|
+
item: NavItemSubItem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const SubItemRow = ({ item }: SubItemRowProps) => {
|
|
83
|
+
const [hovered, setHovered] = React.useState(false);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<li
|
|
87
|
+
className="list-none flex items-center gap-xs"
|
|
88
|
+
onMouseEnter={() => setHovered(true)}
|
|
89
|
+
onMouseLeave={() => setHovered(false)}
|
|
90
|
+
>
|
|
91
|
+
{item.onClick ? (
|
|
92
|
+
<Button
|
|
93
|
+
variant="ghost"
|
|
94
|
+
size="sm"
|
|
95
|
+
className="!flex-1 !justify-start !px-sm !py-xxs !text-body-sm !text-body !rounded-sm !cursor-pointer hover:!text-ink"
|
|
96
|
+
onClick={() => item.onClick!(item.id)}
|
|
97
|
+
>
|
|
98
|
+
{item.label}
|
|
99
|
+
</Button>
|
|
100
|
+
) : (
|
|
101
|
+
<span className="flex-1 truncate px-sm py-xxs text-body-sm text-body rounded-sm cursor-default select-none">
|
|
102
|
+
{item.label}
|
|
103
|
+
</span>
|
|
104
|
+
)}
|
|
105
|
+
{item.onDelete && (
|
|
106
|
+
<Button
|
|
107
|
+
variant="ghost"
|
|
108
|
+
size="sm"
|
|
109
|
+
aria-label={`Delete ${item.label}`}
|
|
110
|
+
onClick={(e) => {
|
|
111
|
+
e.stopPropagation();
|
|
112
|
+
item.onDelete!(item.id);
|
|
113
|
+
}}
|
|
114
|
+
className={[
|
|
115
|
+
"!p-xxs !rounded-xs !text-muted !min-w-0 transition-opacity duration-200 ease-in-out",
|
|
116
|
+
"hover:!text-semantic-error",
|
|
117
|
+
hovered ? "opacity-100" : "opacity-0",
|
|
118
|
+
].join(" ")}
|
|
119
|
+
tabIndex={hovered ? 0 : -1}
|
|
120
|
+
>
|
|
121
|
+
<TrashIcon />
|
|
122
|
+
</Button>
|
|
123
|
+
)}
|
|
124
|
+
</li>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const NavItem = React.forwardRef<HTMLLIElement, NavItemProps>(
|
|
129
|
+
(
|
|
130
|
+
{
|
|
131
|
+
icon,
|
|
132
|
+
label,
|
|
133
|
+
active = false,
|
|
134
|
+
shortcut,
|
|
135
|
+
subItems,
|
|
136
|
+
children,
|
|
137
|
+
expanded,
|
|
138
|
+
onExpandToggle,
|
|
139
|
+
iconOnly = false,
|
|
140
|
+
onClick,
|
|
141
|
+
className,
|
|
142
|
+
...rest
|
|
143
|
+
},
|
|
144
|
+
ref,
|
|
145
|
+
) => {
|
|
146
|
+
const hasSubItems = subItems && subItems.length > 0;
|
|
147
|
+
const hasChildren = React.Children.count(children) > 0;
|
|
148
|
+
const isExpandable = hasSubItems || hasChildren;
|
|
149
|
+
const contentRef = React.useRef<HTMLDivElement>(null);
|
|
150
|
+
const [mounted, setMounted] = React.useState(Boolean(expanded));
|
|
151
|
+
const [visible, setVisible] = React.useState(Boolean(expanded));
|
|
152
|
+
const [contentHeight, setContentHeight] = React.useState(0);
|
|
153
|
+
|
|
154
|
+
React.useEffect(() => {
|
|
155
|
+
if (expanded) {
|
|
156
|
+
setMounted(true);
|
|
157
|
+
const raf = requestAnimationFrame(() => {
|
|
158
|
+
if (contentRef.current) {
|
|
159
|
+
setContentHeight(contentRef.current.scrollHeight);
|
|
160
|
+
}
|
|
161
|
+
requestAnimationFrame(() => setVisible(true));
|
|
162
|
+
});
|
|
163
|
+
return () => cancelAnimationFrame(raf);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (contentRef.current) {
|
|
167
|
+
setContentHeight(contentRef.current.scrollHeight);
|
|
168
|
+
}
|
|
169
|
+
setVisible(false);
|
|
170
|
+
const timer = window.setTimeout(() => setMounted(false), 220);
|
|
171
|
+
return () => window.clearTimeout(timer);
|
|
172
|
+
}, [expanded, subItems, children]);
|
|
173
|
+
|
|
174
|
+
React.useEffect(() => {
|
|
175
|
+
if (!mounted || !contentRef.current) return;
|
|
176
|
+
|
|
177
|
+
const measure = () => setContentHeight(contentRef.current?.scrollHeight ?? 0);
|
|
178
|
+
measure();
|
|
179
|
+
|
|
180
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
181
|
+
const observer = new ResizeObserver(measure);
|
|
182
|
+
observer.observe(contentRef.current);
|
|
183
|
+
return () => observer.disconnect();
|
|
184
|
+
}, [mounted, subItems, children]);
|
|
185
|
+
|
|
186
|
+
const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
|
|
187
|
+
if (isExpandable && onExpandToggle) {
|
|
188
|
+
onExpandToggle();
|
|
189
|
+
}
|
|
190
|
+
onClick?.(e);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<li
|
|
195
|
+
ref={ref}
|
|
196
|
+
className={["list-none", className].filter(Boolean).join(" ")}
|
|
197
|
+
{...(rest as React.HTMLAttributes<HTMLLIElement>)}
|
|
198
|
+
>
|
|
199
|
+
<Button
|
|
200
|
+
variant="ghost"
|
|
201
|
+
size="sm"
|
|
202
|
+
aria-current={active ? "page" : undefined}
|
|
203
|
+
aria-expanded={isExpandable ? expanded : undefined}
|
|
204
|
+
aria-label={iconOnly ? label : undefined}
|
|
205
|
+
title={iconOnly ? label : undefined}
|
|
206
|
+
onClick={handleClick}
|
|
207
|
+
className={[
|
|
208
|
+
iconOnly
|
|
209
|
+
? "!w-full !justify-center !px-xs !py-xs !rounded-md"
|
|
210
|
+
: "!w-full !justify-start !px-sm !py-xs !rounded-md !gap-sm !font-weight-body-md",
|
|
211
|
+
active ? "!bg-primary-disabled !text-primary" : "",
|
|
212
|
+
]
|
|
213
|
+
.filter(Boolean)
|
|
214
|
+
.join(" ")}
|
|
215
|
+
>
|
|
216
|
+
{icon && (
|
|
217
|
+
<span
|
|
218
|
+
aria-hidden="true"
|
|
219
|
+
className={[
|
|
220
|
+
"flex-shrink-0",
|
|
221
|
+
active ? "text-primary" : "text-muted",
|
|
222
|
+
].join(" ")}
|
|
223
|
+
style={{
|
|
224
|
+
width: "18px",
|
|
225
|
+
height: "18px",
|
|
226
|
+
display: "flex",
|
|
227
|
+
alignItems: "center",
|
|
228
|
+
justifyContent: "center",
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
{icon}
|
|
232
|
+
</span>
|
|
233
|
+
)}
|
|
234
|
+
|
|
235
|
+
{!iconOnly && (
|
|
236
|
+
<span
|
|
237
|
+
className={[
|
|
238
|
+
"flex-1 text-left text-body-sm",
|
|
239
|
+
active ? "text-primary" : "text-ink",
|
|
240
|
+
].join(" ")}
|
|
241
|
+
>
|
|
242
|
+
{label}
|
|
243
|
+
</span>
|
|
244
|
+
)}
|
|
245
|
+
|
|
246
|
+
{!iconOnly && shortcut && !isExpandable && (
|
|
247
|
+
<span className="flex items-center gap-xs ml-auto" aria-hidden="true">
|
|
248
|
+
{shortcut.modifier && (
|
|
249
|
+
<kbd
|
|
250
|
+
className="inline-flex items-center justify-center px-xs py-xxs text-caption text-muted border border-hairline rounded-xs bg-surface-soft"
|
|
251
|
+
style={{ minWidth: "22px", height: "22px" }}
|
|
252
|
+
>
|
|
253
|
+
{shortcut.modifier}
|
|
254
|
+
</kbd>
|
|
255
|
+
)}
|
|
256
|
+
<kbd
|
|
257
|
+
className="inline-flex items-center justify-center px-xs py-xxs text-caption text-muted border border-hairline rounded-xs bg-surface-soft"
|
|
258
|
+
style={{ minWidth: "22px", height: "22px" }}
|
|
259
|
+
>
|
|
260
|
+
{shortcut.key}
|
|
261
|
+
</kbd>
|
|
262
|
+
</span>
|
|
263
|
+
)}
|
|
264
|
+
|
|
265
|
+
{!iconOnly && isExpandable && (
|
|
266
|
+
<span
|
|
267
|
+
aria-hidden="true"
|
|
268
|
+
className={[
|
|
269
|
+
"ml-auto text-muted transition-transform duration-200 ease-in-out",
|
|
270
|
+
expanded ? "rotate-180" : "rotate-0",
|
|
271
|
+
].join(" ")}
|
|
272
|
+
>
|
|
273
|
+
<ChevronDownIcon />
|
|
274
|
+
</span>
|
|
275
|
+
)}
|
|
276
|
+
</Button>
|
|
277
|
+
|
|
278
|
+
{!iconOnly && mounted && (hasSubItems || hasChildren) && (
|
|
279
|
+
<div
|
|
280
|
+
className="overflow-hidden transition-[max-height,opacity,transform,margin] duration-220 ease-in-out"
|
|
281
|
+
style={{
|
|
282
|
+
maxHeight: visible ? `${contentHeight}px` : "0px",
|
|
283
|
+
opacity: visible ? 1 : 0,
|
|
284
|
+
transform: visible ? "translateY(0)" : "translateY(-4px)",
|
|
285
|
+
marginTop: visible ? "var(--spacing-xxs)" : "0px",
|
|
286
|
+
}}
|
|
287
|
+
>
|
|
288
|
+
<div ref={contentRef}>
|
|
289
|
+
{hasSubItems && (
|
|
290
|
+
<ul
|
|
291
|
+
className="ml-lg pl-sm border-l border-hairline-soft space-y-xxs"
|
|
292
|
+
role="list"
|
|
293
|
+
>
|
|
294
|
+
{subItems!.map((item) => (
|
|
295
|
+
<SubItemRow key={item.id} item={item} />
|
|
296
|
+
))}
|
|
297
|
+
</ul>
|
|
298
|
+
)}
|
|
299
|
+
|
|
300
|
+
{hasChildren && (
|
|
301
|
+
<ul
|
|
302
|
+
className="ml-lg pl-sm border-l border-hairline-soft space-y-xxs"
|
|
303
|
+
role="list"
|
|
304
|
+
>
|
|
305
|
+
{children}
|
|
306
|
+
</ul>
|
|
307
|
+
)}
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
)}
|
|
311
|
+
</li>
|
|
312
|
+
);
|
|
313
|
+
},
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
NavItem.displayName = "NavItem";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NavItem } from "./NavItem";
|
|
3
|
+
|
|
4
|
+
const HomeIcon = (
|
|
5
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
6
|
+
<path d="M3 9.75L12 3l9 6.75V20a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9.75z" />
|
|
7
|
+
<polyline points="9 21 9 12 15 12 15 21" />
|
|
8
|
+
</svg>
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
const SearchIcon = (
|
|
12
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
13
|
+
<circle cx="11" cy="11" r="8" />
|
|
14
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const FolderIcon = (
|
|
19
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
20
|
+
<path d="M3 7a2 2 0 0 1 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2A2 2 0 0 0 13.07 8H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z" />
|
|
21
|
+
</svg>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const SettingsIcon = (
|
|
25
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
26
|
+
<circle cx="12" cy="12" r="3" />
|
|
27
|
+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default function NavItemPreview() {
|
|
32
|
+
const [projectsExpanded, setProjectsExpanded] = React.useState(true);
|
|
33
|
+
const [clickableExpanded, setClickableExpanded] = React.useState(true);
|
|
34
|
+
const [deletedIds, setDeletedIds] = React.useState<string[]>([]);
|
|
35
|
+
const [lastClicked, setLastClicked] = React.useState<string | null>(null);
|
|
36
|
+
|
|
37
|
+
const handleDelete = (id: string) => {
|
|
38
|
+
setDeletedIds((prev) => [...prev, id]);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const handleSubItemClick = (id: string) => {
|
|
42
|
+
setLastClicked(id);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const projects = [
|
|
46
|
+
{ id: "p1", label: "Design system", onDelete: handleDelete },
|
|
47
|
+
{ id: "p2", label: "Mobile app", onDelete: handleDelete },
|
|
48
|
+
{ id: "p3", label: "Landing page", onDelete: handleDelete },
|
|
49
|
+
].filter((p) => !deletedIds.includes(p.id));
|
|
50
|
+
|
|
51
|
+
const pages = [
|
|
52
|
+
{ id: "pg1", label: "Overview", onClick: handleSubItemClick },
|
|
53
|
+
{ id: "pg2", label: "Components", onClick: handleSubItemClick },
|
|
54
|
+
{ id: "pg3", label: "Tokens", onClick: handleSubItemClick },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-xl">
|
|
59
|
+
{/* Basic states */}
|
|
60
|
+
<div>
|
|
61
|
+
<p className="text-caption text-muted mb-sm">Basic states</p>
|
|
62
|
+
<ul className="space-y-xxs w-64">
|
|
63
|
+
<NavItem icon={HomeIcon} label="Home" active />
|
|
64
|
+
<NavItem icon={SearchIcon} label="Search" shortcut={{ modifier: "⌘", key: "K" }} />
|
|
65
|
+
<NavItem icon={SettingsIcon} label="Settings" />
|
|
66
|
+
</ul>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{/* Clickable sub-items (new onClick prop) */}
|
|
70
|
+
<div>
|
|
71
|
+
<p className="text-caption text-muted mb-sm">Clickable sub-items — onClick makes the label a button</p>
|
|
72
|
+
{lastClicked && (
|
|
73
|
+
<p className="text-caption text-primary mb-sm">
|
|
74
|
+
Last clicked: <strong>{pages.find((p) => p.id === lastClicked)?.label ?? lastClicked}</strong>
|
|
75
|
+
</p>
|
|
76
|
+
)}
|
|
77
|
+
<ul className="space-y-xxs w-64">
|
|
78
|
+
<NavItem
|
|
79
|
+
icon={FolderIcon}
|
|
80
|
+
label="Docs"
|
|
81
|
+
expanded={clickableExpanded}
|
|
82
|
+
onExpandToggle={() => setClickableExpanded((v) => !v)}
|
|
83
|
+
subItems={pages}
|
|
84
|
+
/>
|
|
85
|
+
</ul>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
{/* Collapsible group with subItems + delete */}
|
|
89
|
+
<div>
|
|
90
|
+
<p className="text-caption text-muted mb-sm">Deletable sub-items (hover to reveal trash)</p>
|
|
91
|
+
<ul className="space-y-xxs w-64">
|
|
92
|
+
<NavItem
|
|
93
|
+
icon={FolderIcon}
|
|
94
|
+
label="Projects"
|
|
95
|
+
expanded={projectsExpanded}
|
|
96
|
+
onExpandToggle={() => setProjectsExpanded((v) => !v)}
|
|
97
|
+
subItems={
|
|
98
|
+
projects.length > 0
|
|
99
|
+
? projects
|
|
100
|
+
: [{ id: "empty", label: "No projects" }]
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
<NavItem icon={HomeIcon} label="Home" />
|
|
104
|
+
<NavItem icon={SearchIcon} label="Search" />
|
|
105
|
+
</ul>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
{/* Collapsed group */}
|
|
109
|
+
<div>
|
|
110
|
+
<p className="text-caption text-muted mb-sm">Collapsed group</p>
|
|
111
|
+
<ul className="space-y-xxs w-64">
|
|
112
|
+
<NavItem
|
|
113
|
+
icon={FolderIcon}
|
|
114
|
+
label="Workspaces"
|
|
115
|
+
expanded={false}
|
|
116
|
+
subItems={[
|
|
117
|
+
{ id: "w1", label: "Marketing" },
|
|
118
|
+
{ id: "w2", label: "Engineering" },
|
|
119
|
+
]}
|
|
120
|
+
/>
|
|
121
|
+
</ul>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
}
|