@designa8/vibedesign-v6 1.20.20 → 2.1.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/README.md +1 -1
- package/dist/fonts/plusjakartasans/PlusJakartaSans-Italic[wght].ttf +0 -0
- package/dist/fonts/plusjakartasans/PlusJakartaSans[wght].ttf +0 -0
- package/dist/index.cjs +12027 -4942
- package/dist/index.js +12089 -5004
- package/dist/styles.css +1393 -97
- package/package.json +116 -1
- package/src/atoms/AgentQuestionCard/AgentQuestionCard.tsx +567 -0
- package/src/atoms/AgentQuestionCard/index.ts +6 -0
- package/src/atoms/AgentQuestionCard/preview.tsx +199 -0
- package/src/atoms/AppLayout/AppLayout.tsx +85 -22
- package/src/atoms/AppLayout/preview.tsx +4 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +222 -137
- package/src/atoms/AppSidebar/preview.tsx +61 -8
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +241 -169
- package/src/atoms/AppSidebarMobile/preview.tsx +59 -89
- package/src/atoms/AuthLogin/AuthLogin.tsx +86 -49
- package/src/atoms/AuthLogin/preview.tsx +16 -0
- package/src/atoms/AuthSignUp/AuthSignUp.tsx +206 -126
- package/src/atoms/AuthSignUp/preview.tsx +10 -0
- package/src/atoms/BottomSheet/BottomSheet.tsx +199 -0
- package/src/atoms/BottomSheet/index.ts +2 -0
- package/src/atoms/BottomSheet/preview.tsx +50 -0
- package/src/atoms/Button/Button.tsx +19 -3
- package/src/atoms/Button/preview.tsx +2 -1
- package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +160 -84
- package/src/atoms/ChatHistorySidebar/preview.tsx +81 -42
- package/src/atoms/ChatScreen/ChatScreen.tsx +298 -33
- package/src/atoms/ChatScreen/preview.tsx +54 -90
- package/src/atoms/Chip/Chip.tsx +81 -33
- package/src/atoms/Chip/preview.tsx +39 -21
- package/src/atoms/CodeEditor/CodeEditor.tsx +10 -4
- package/src/atoms/ComponentActionsSheet/ComponentActionsSheet.tsx +165 -0
- package/src/atoms/ComponentActionsSheet/index.ts +7 -0
- package/src/atoms/ComponentActionsSheet/preview.tsx +67 -0
- package/src/atoms/ComponentCard/ComponentCard.tsx +17 -35
- package/src/atoms/ComponentCard/preview.tsx +9 -9
- package/src/atoms/DesignSystemLoader/DesignSystemLoader.tsx +153 -0
- package/src/atoms/DesignSystemLoader/index.ts +2 -0
- package/src/atoms/DesignSystemLoader/preview.tsx +19 -0
- package/src/atoms/DesignSystemShowcase/DesignSystemShowcase.tsx +410 -0
- package/src/atoms/DesignSystemShowcase/index.ts +6 -0
- package/src/atoms/DesignSystemShowcase/preview.tsx +22 -0
- package/src/atoms/DesignTokensPanel/DesignTokensPanel.data.ts +254 -0
- package/src/atoms/DesignTokensPanel/DesignTokensPanel.tsx +946 -0
- package/src/atoms/DesignTokensPanel/index.ts +9 -0
- package/src/atoms/DesignTokensPanel/preview.tsx +39 -0
- package/src/atoms/ExpandableMessage/ExpandableMessage.tsx +239 -0
- package/src/atoms/ExpandableMessage/fix-link-note.txt +3 -0
- package/src/atoms/ExpandableMessage/index.ts +2 -0
- package/src/atoms/ExpandableMessage/markdown.tsx +310 -0
- package/src/atoms/ExpandableMessage/preview.tsx +83 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +2 -2
- package/src/atoms/FontCombobox/FontCombobox.tsx +655 -0
- package/src/atoms/FontCombobox/index.ts +6 -0
- package/src/atoms/FontCombobox/preview.tsx +111 -0
- package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +894 -96
- package/src/atoms/HomePageTemplate/preview.tsx +4 -0
- package/src/atoms/Icon/Icon.tsx +17 -11
- package/src/atoms/Icon/icons.data.ts +34 -0
- package/src/atoms/Input/Input.tsx +37 -21
- package/src/atoms/LandingHero/LandingHero.tsx +545 -0
- package/src/atoms/LandingHero/index.ts +6 -0
- package/src/atoms/LandingHero/preview.tsx +88 -0
- package/src/atoms/MarketingFooter/MarketingFooter.tsx +215 -0
- package/src/atoms/MarketingFooter/index.ts +7 -0
- package/src/atoms/MarketingFooter/preview.tsx +28 -0
- package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +451 -0
- package/src/atoms/MarketingNavbar/index.ts +7 -0
- package/src/atoms/MarketingNavbar/preview.tsx +109 -0
- package/src/atoms/MobileActionsDrawer/MobileActionsDrawer.tsx +548 -0
- package/src/atoms/MobileActionsDrawer/index.ts +9 -0
- package/src/atoms/MobileActionsDrawer/preview.tsx +109 -0
- package/src/atoms/Modal/Modal.tsx +77 -28
- package/src/atoms/PreviewDock/PreviewDock.tsx +119 -0
- package/src/atoms/PreviewDock/index.ts +2 -0
- package/src/atoms/PreviewDock/preview.tsx +30 -0
- package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +47 -30
- package/src/atoms/PricingCard/PricingCard.tsx +15 -4
- package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +109 -89
- package/src/atoms/ProjectSettingsModal/ProjectSettingsModal.tsx +314 -0
- package/src/atoms/ProjectSettingsModal/index.ts +2 -0
- package/src/atoms/ProjectSettingsModal/preview.tsx +130 -0
- package/src/atoms/ProjectSettingsModal/switch.snippet.txt +8 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +750 -302
- package/src/atoms/PromptInputBar/preview.tsx +64 -64
- package/src/atoms/SettingsPageTemplate/SettingsPageTemplate.tsx +272 -0
- package/src/atoms/SettingsPageTemplate/index.ts +2 -0
- package/src/atoms/SettingsPageTemplate/preview.tsx +29 -0
- package/src/atoms/SidebarUpgradeBanner/SidebarUpgradeBanner.tsx +178 -0
- package/src/atoms/SidebarUpgradeBanner/index.ts +2 -0
- package/src/atoms/SidebarUpgradeBanner/preview.tsx +47 -0
- package/src/atoms/SkeletonChip/SkeletonChip.tsx +198 -0
- package/src/atoms/SkeletonChip/index.ts +2 -0
- package/src/atoms/SkeletonChip/preview.tsx +44 -0
- package/src/atoms/TemplateHeader/TemplateHeader.tsx +129 -0
- package/src/atoms/TemplateHeader/index.ts +2 -0
- package/src/atoms/TemplateHeader/preview.tsx +39 -0
- package/src/atoms/TemplateHero/TemplateHero.tsx +286 -0
- package/src/atoms/TemplateHero/index.ts +2 -0
- package/src/atoms/TemplateHero/preview.tsx +32 -0
- package/src/atoms/TemplateSummary/TemplateSummary.tsx +85 -0
- package/src/atoms/TemplateSummary/index.ts +2 -0
- package/src/atoms/TemplateSummary/preview.tsx +10 -0
- package/src/atoms/Toast/Toast.tsx +178 -0
- package/src/atoms/Toast/index.ts +2 -0
- package/src/atoms/Toast/preview.tsx +100 -0
- package/src/atoms/TopNavbar/TopNavbar.tsx +145 -67
- package/src/atoms/TopNavbar/preview.tsx +13 -7
- package/src/atoms/TopupModal/TopupModal.tsx +94 -0
- package/src/atoms/TopupModal/index.ts +2 -0
- package/src/atoms/TopupModal/preview.tsx +22 -0
- package/src/atoms/UpgradeCard/UpgradeCard.tsx +124 -43
- package/src/atoms/UpgradeCard/index.ts +1 -1
- package/src/atoms/UpgradeCard/preview.tsx +7 -14
- package/src/atoms/UpgradeModal/UpgradeModal.tsx +192 -0
- package/src/atoms/UpgradeModal/index.ts +2 -0
- package/src/atoms/UpgradeModal/preview.tsx +41 -0
- package/src/index.ts +23 -0
- package/src/tokens.css +45 -7
- package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
- package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import { Button } from "../Button";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
4
3
|
import { Icon } from "../Icon";
|
|
5
4
|
import { NavItem } from "../NavItem";
|
|
6
5
|
import { WorkspaceMenu } from "../WorkspaceMenu";
|
|
@@ -29,6 +28,7 @@ export interface AppSidebarMobileProps {
|
|
|
29
28
|
entries?: MobileNavEntry[];
|
|
30
29
|
activeId?: string;
|
|
31
30
|
onSelect?: (id: string) => void;
|
|
31
|
+
/** Id of the currently selected sub-item (project / template) — highlighted in its group. */
|
|
32
32
|
activeSubId?: string;
|
|
33
33
|
onSubSelect?: (id: string) => void;
|
|
34
34
|
workspaceName?: string;
|
|
@@ -38,8 +38,22 @@ export interface AppSidebarMobileProps {
|
|
|
38
38
|
onInboxClick?: () => void;
|
|
39
39
|
/** Whether dark mode is currently active. Used to pick sun vs moon icon. */
|
|
40
40
|
darkMode?: boolean;
|
|
41
|
-
/** When provided, renders a dark-mode toggle button in the
|
|
41
|
+
/** When provided, renders a dark-mode toggle button in the open menu. */
|
|
42
42
|
onDarkModeToggle?: () => void;
|
|
43
|
+
/** Signed-in user's email, shown above the account rows. */
|
|
44
|
+
userEmail?: string;
|
|
45
|
+
/** When provided, renders a "Logout" row. */
|
|
46
|
+
onLogout?: () => void;
|
|
47
|
+
/** When provided, renders a "User Settings" row. */
|
|
48
|
+
onSettings?: () => void;
|
|
49
|
+
/** When provided, renders a pressable "Upgrade to Pro" card. */
|
|
50
|
+
onUpgradeClick?: () => void;
|
|
51
|
+
/** Custom title for the upgrade card. Defaults to "Upgrade to Pro". */
|
|
52
|
+
upgradeTitle?: string;
|
|
53
|
+
/** Custom subtitle for the upgrade card. Defaults to "Unlock more features". */
|
|
54
|
+
upgradeSubtitle?: string;
|
|
55
|
+
/** Optional credits usage forwarded to the UpgradeCard `credits` prop. Omit for no credits block. */
|
|
56
|
+
upgradeCredits?: { remaining: number; total: number; helper?: string };
|
|
43
57
|
open?: boolean;
|
|
44
58
|
onOpenChange?: (open: boolean) => void;
|
|
45
59
|
/** Entry ids that should be expanded on first render (seeds internal expanded state). */
|
|
@@ -47,16 +61,27 @@ export interface AppSidebarMobileProps {
|
|
|
47
61
|
className?: string;
|
|
48
62
|
}
|
|
49
63
|
|
|
64
|
+
const rowButton =
|
|
65
|
+
"flex w-full items-center gap-sm rounded-md px-sm py-xs text-left text-body-sm text-ink cursor-pointer transition duration-150 ease-out hover:bg-surface-soft active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50";
|
|
66
|
+
|
|
67
|
+
const iconButton =
|
|
68
|
+
"relative inline-flex items-center justify-center rounded-md p-xs text-ink cursor-pointer transition duration-150 ease-out hover:bg-surface-soft active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50";
|
|
69
|
+
|
|
70
|
+
/** Overlay sits above sticky page headers (same 9999 as the previous drawer). */
|
|
71
|
+
const SCRIM_Z = "var(--z-mobile-drawer-scrim, 9999)";
|
|
72
|
+
const PANEL_Z = "var(--z-mobile-drawer, 10000)";
|
|
73
|
+
const DRAWER_MS = 280;
|
|
74
|
+
|
|
50
75
|
/* ─── Component ─────────────────────────────────────────────────────────── */
|
|
51
76
|
|
|
52
|
-
export const AppSidebarMobile = React.forwardRef<
|
|
77
|
+
export const AppSidebarMobile = React.forwardRef<HTMLElement, AppSidebarMobileProps>(
|
|
53
78
|
(
|
|
54
79
|
{
|
|
55
80
|
brandName = "Atoms",
|
|
56
81
|
entries = [],
|
|
57
82
|
activeId,
|
|
58
83
|
onSelect,
|
|
59
|
-
activeSubId
|
|
84
|
+
activeSubId,
|
|
60
85
|
onSubSelect,
|
|
61
86
|
workspaceName,
|
|
62
87
|
showShareCard = false,
|
|
@@ -65,6 +90,13 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
65
90
|
onInboxClick,
|
|
66
91
|
darkMode = false,
|
|
67
92
|
onDarkModeToggle,
|
|
93
|
+
userEmail,
|
|
94
|
+
onLogout,
|
|
95
|
+
onSettings,
|
|
96
|
+
onUpgradeClick,
|
|
97
|
+
upgradeTitle = "Upgrade to Pro",
|
|
98
|
+
upgradeSubtitle = "Unlock more features",
|
|
99
|
+
upgradeCredits,
|
|
68
100
|
open: openProp,
|
|
69
101
|
onOpenChange,
|
|
70
102
|
defaultExpandedIds,
|
|
@@ -76,11 +108,24 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
76
108
|
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
77
109
|
const isControlled = openProp !== undefined;
|
|
78
110
|
const open = isControlled ? openProp : internalOpen;
|
|
111
|
+
const panelId = React.useId();
|
|
112
|
+
const titleId = React.useId();
|
|
113
|
+
const toggleRef = React.useRef<HTMLButtonElement>(null);
|
|
114
|
+
const panelRef = React.useRef<HTMLDivElement>(null);
|
|
79
115
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
116
|
+
/* Portal target only exists on the client (SSR guard). */
|
|
117
|
+
const [mounted, setMounted] = React.useState(false);
|
|
118
|
+
React.useEffect(() => {
|
|
119
|
+
setMounted(true);
|
|
120
|
+
}, []);
|
|
121
|
+
|
|
122
|
+
const setOpen = React.useCallback(
|
|
123
|
+
(next: boolean) => {
|
|
124
|
+
if (!isControlled) setInternalOpen(next);
|
|
125
|
+
onOpenChange?.(next);
|
|
126
|
+
},
|
|
127
|
+
[isControlled, onOpenChange],
|
|
128
|
+
);
|
|
84
129
|
|
|
85
130
|
const [expandedIds, setExpandedIds] = React.useState<Set<string>>(
|
|
86
131
|
() => new Set(defaultExpandedIds ?? []),
|
|
@@ -88,7 +133,8 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
88
133
|
const toggleExpanded = (id: string) => {
|
|
89
134
|
setExpandedIds((prev) => {
|
|
90
135
|
const next = new Set(prev);
|
|
91
|
-
next.has(id)
|
|
136
|
+
if (next.has(id)) next.delete(id);
|
|
137
|
+
else next.add(id);
|
|
92
138
|
return next;
|
|
93
139
|
});
|
|
94
140
|
};
|
|
@@ -96,134 +142,119 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
96
142
|
/* ── Escape key ── */
|
|
97
143
|
React.useEffect(() => {
|
|
98
144
|
if (!open) return;
|
|
99
|
-
const handler = (e: KeyboardEvent) => {
|
|
145
|
+
const handler = (e: KeyboardEvent) => {
|
|
146
|
+
if (e.key === "Escape") {
|
|
147
|
+
setOpen(false);
|
|
148
|
+
toggleRef.current?.focus();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
100
151
|
window.addEventListener("keydown", handler);
|
|
101
152
|
return () => window.removeEventListener("keydown", handler);
|
|
102
|
-
}, [open]);
|
|
103
|
-
|
|
104
|
-
/* ── Slide animation ── */
|
|
105
|
-
const [visible, setVisible] = React.useState(false);
|
|
106
|
-
const [mounted, setMounted] = React.useState(false);
|
|
153
|
+
}, [open, setOpen]);
|
|
107
154
|
|
|
155
|
+
/* ── Move focus into the drawer when it opens ── */
|
|
108
156
|
React.useEffect(() => {
|
|
109
|
-
if (open) {
|
|
110
|
-
setMounted(true);
|
|
111
|
-
requestAnimationFrame(() => requestAnimationFrame(() => setVisible(true)));
|
|
112
|
-
} else {
|
|
113
|
-
setVisible(false);
|
|
114
|
-
const t = setTimeout(() => setMounted(false), 300);
|
|
115
|
-
return () => clearTimeout(t);
|
|
116
|
-
}
|
|
157
|
+
if (open) panelRef.current?.focus({ preventScroll: true });
|
|
117
158
|
}, [open]);
|
|
118
159
|
|
|
119
|
-
|
|
160
|
+
const runAndClose = (fn?: () => void) => () => {
|
|
161
|
+
fn?.();
|
|
162
|
+
setOpen(false);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const showUpgrade = !!onUpgradeClick || showUpgradeCard;
|
|
166
|
+
const showAccount = !!(onLogout || onSettings);
|
|
120
167
|
const showFooterRow = !!(userInitials || onInboxClick || onDarkModeToggle);
|
|
121
168
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
style={{
|
|
129
|
-
position: "fixed",
|
|
130
|
-
inset: 0,
|
|
131
|
-
zIndex: 9999,
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
{/* Scrim */}
|
|
135
|
-
<div
|
|
169
|
+
const overlay = (
|
|
170
|
+
<div data-state={open ? "open" : "closed"}>
|
|
171
|
+
{/* ── Scrim ── */}
|
|
172
|
+
<button
|
|
173
|
+
type="button"
|
|
174
|
+
tabIndex={-1}
|
|
136
175
|
aria-hidden="true"
|
|
137
176
|
onClick={() => setOpen(false)}
|
|
177
|
+
className="cursor-pointer"
|
|
138
178
|
style={{
|
|
139
|
-
position: "
|
|
179
|
+
position: "fixed",
|
|
140
180
|
inset: 0,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
181
|
+
zIndex: SCRIM_Z,
|
|
182
|
+
background: "var(--color-scrim)",
|
|
183
|
+
opacity: open ? 1 : 0,
|
|
184
|
+
pointerEvents: open ? "auto" : "none",
|
|
185
|
+
transition: `opacity ${DRAWER_MS}ms ease-out`,
|
|
186
|
+
border: 0,
|
|
187
|
+
padding: 0,
|
|
144
188
|
}}
|
|
145
189
|
/>
|
|
146
190
|
|
|
147
|
-
{/*
|
|
191
|
+
{/* ── Left drawer panel (stays mounted) ── */}
|
|
148
192
|
<div
|
|
193
|
+
ref={panelRef}
|
|
194
|
+
id={panelId}
|
|
195
|
+
role="dialog"
|
|
196
|
+
aria-modal="true"
|
|
197
|
+
aria-labelledby={titleId}
|
|
198
|
+
aria-hidden={!open}
|
|
199
|
+
inert={!open ? true : undefined}
|
|
200
|
+
tabIndex={-1}
|
|
201
|
+
data-state={open ? "open" : "closed"}
|
|
202
|
+
className="flex flex-col focus-visible:outline-none"
|
|
149
203
|
style={{
|
|
150
|
-
position: "
|
|
204
|
+
position: "fixed",
|
|
151
205
|
top: 0,
|
|
152
206
|
left: 0,
|
|
153
207
|
bottom: 0,
|
|
154
208
|
width: "min(280px, 85vw)",
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
backgroundColor: "var(--color-canvas)",
|
|
209
|
+
zIndex: PANEL_Z,
|
|
210
|
+
background: "var(--color-canvas)",
|
|
158
211
|
borderRight: "1px solid var(--color-hairline)",
|
|
159
|
-
boxShadow: "var(--shadow-lg)",
|
|
160
|
-
transform: visible ? "translateX(0)" : "translateX(-100%)",
|
|
161
|
-
transition: "transform 0.28s cubic-bezier(0.32,0,0.15,1)",
|
|
212
|
+
boxShadow: "var(--shadow-lg, var(--shadow-md))",
|
|
162
213
|
overflowY: "auto",
|
|
163
|
-
|
|
214
|
+
transform: open ? "translateX(0)" : "translateX(-100%)",
|
|
215
|
+
visibility: open ? "visible" : "hidden",
|
|
216
|
+
transition: `transform ${DRAWER_MS}ms ease-out, visibility 0ms linear ${open ? 0 : DRAWER_MS}ms`,
|
|
164
217
|
}}
|
|
165
218
|
>
|
|
166
|
-
{/*
|
|
167
|
-
<div
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
width: "28px",
|
|
176
|
-
height: "28px",
|
|
177
|
-
background: "linear-gradient(135deg, var(--color-logo-orange), var(--color-logo-violet))",
|
|
178
|
-
}}
|
|
179
|
-
aria-hidden="true"
|
|
180
|
-
/>
|
|
181
|
-
<span className="text-body-sm font-weight-heading-sm text-ink truncate">{brandName}</span>
|
|
182
|
-
</div>
|
|
183
|
-
<Button
|
|
184
|
-
variant="ghost"
|
|
185
|
-
size="sm"
|
|
186
|
-
aria-label="Close navigation"
|
|
187
|
-
onClick={() => setOpen(false)}
|
|
188
|
-
className="!p-xs !rounded-md"
|
|
189
|
-
>
|
|
190
|
-
<Icon name="close" />
|
|
191
|
-
</Button>
|
|
219
|
+
{/* Drawer header */}
|
|
220
|
+
<div className="flex items-center gap-sm border-b border-hairline px-md py-sm">
|
|
221
|
+
<span
|
|
222
|
+
aria-hidden="true"
|
|
223
|
+
className="size-7 shrink-0 rounded-full bg-gradient-to-br from-logo-orange to-logo-violet"
|
|
224
|
+
/>
|
|
225
|
+
<span id={titleId} className="truncate text-body-md font-weight-body-md text-ink">
|
|
226
|
+
{brandName}
|
|
227
|
+
</span>
|
|
192
228
|
</div>
|
|
193
229
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
className="px-sm pb-sm"
|
|
198
|
-
style={{ backgroundColor: "var(--color-canvas)" }}
|
|
199
|
-
>
|
|
230
|
+
<div className="flex flex-1 flex-col px-sm py-sm space-y-sm">
|
|
231
|
+
{/* Workspace switcher */}
|
|
232
|
+
{workspaceName && (
|
|
200
233
|
<WorkspaceMenu
|
|
201
234
|
workspaceName={workspaceName}
|
|
202
235
|
initials={workspaceName.charAt(0).toUpperCase()}
|
|
203
236
|
/>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
{/* Nav entries */}
|
|
208
|
-
<div
|
|
209
|
-
className="flex-1 overflow-y-auto px-sm pb-sm"
|
|
210
|
-
style={{ backgroundColor: "var(--color-canvas)" }}
|
|
211
|
-
>
|
|
237
|
+
)}
|
|
238
|
+
|
|
239
|
+
{/* Nav entries */}
|
|
212
240
|
<ul className="space-y-xxs" role="list">
|
|
213
241
|
{entries.map((entry) => {
|
|
214
|
-
const
|
|
215
|
-
const hasSubItems = !!(entry.subItems?.length);
|
|
242
|
+
const hasSubItems = !!entry.subItems?.length;
|
|
216
243
|
const isAlwaysExpanded = hasSubItems && !!entry.alwaysExpanded;
|
|
217
244
|
const isExpanded = isAlwaysExpanded ? true : expandedIds.has(entry.id);
|
|
245
|
+
const ownsActiveSub =
|
|
246
|
+
activeSubId !== undefined &&
|
|
247
|
+
!!entry.subItems?.some((s) => s.id === activeSubId);
|
|
218
248
|
|
|
219
249
|
const mappedSubItems: NavItemSubItem[] | undefined = hasSubItems
|
|
220
250
|
? entry.subItems!.map((sub) => ({
|
|
221
251
|
id: sub.id,
|
|
222
252
|
label: sub.label,
|
|
223
253
|
onDelete: sub.onDelete,
|
|
224
|
-
onClick:
|
|
225
|
-
|
|
226
|
-
|
|
254
|
+
onClick: (id: string) => {
|
|
255
|
+
onSubSelect?.(id);
|
|
256
|
+
setOpen(false);
|
|
257
|
+
},
|
|
227
258
|
}))
|
|
228
259
|
: undefined;
|
|
229
260
|
|
|
@@ -232,90 +263,105 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
232
263
|
key={entry.id}
|
|
233
264
|
icon={entry.icon}
|
|
234
265
|
label={entry.label}
|
|
235
|
-
active={
|
|
266
|
+
active={activeId === entry.id || (activeId === undefined && ownsActiveSub)}
|
|
236
267
|
subItems={mappedSubItems}
|
|
268
|
+
activeSubId={activeSubId}
|
|
237
269
|
alwaysExpanded={isAlwaysExpanded}
|
|
238
270
|
expanded={hasSubItems ? isExpanded : undefined}
|
|
239
|
-
onExpandToggle={
|
|
240
|
-
|
|
271
|
+
onExpandToggle={
|
|
272
|
+
hasSubItems && !isAlwaysExpanded ? () => toggleExpanded(entry.id) : undefined
|
|
273
|
+
}
|
|
274
|
+
onClick={() => {
|
|
241
275
|
onSelect?.(entry.id);
|
|
242
|
-
if (!hasSubItems) setOpen(false);
|
|
243
|
-
else e.preventDefault();
|
|
276
|
+
if (!hasSubItems || isAlwaysExpanded) setOpen(false);
|
|
244
277
|
}}
|
|
245
278
|
/>
|
|
246
279
|
);
|
|
247
280
|
})}
|
|
248
281
|
</ul>
|
|
249
|
-
</div>
|
|
250
282
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
style={{ backgroundColor: "var(--color-canvas)" }}
|
|
255
|
-
>
|
|
283
|
+
<div className="flex-1" />
|
|
284
|
+
|
|
285
|
+
{/* Share card */}
|
|
256
286
|
{showShareCard && (
|
|
257
|
-
<div className="rounded-
|
|
258
|
-
<div className="flex flex-col gap-xxs
|
|
259
|
-
<span className="text-body-sm font-weight-
|
|
287
|
+
<div className="flex items-center justify-between gap-md rounded-lg border border-hairline bg-surface px-md py-sm">
|
|
288
|
+
<div className="flex min-w-0 flex-col gap-xxs">
|
|
289
|
+
<span className="text-body-sm font-weight-body-md text-ink">Share & earn</span>
|
|
260
290
|
<span className="text-caption text-muted">100 credits per paid referral</span>
|
|
261
291
|
</div>
|
|
262
|
-
<span
|
|
263
|
-
|
|
264
|
-
style={{ width: "36px", height: "36px" }}
|
|
265
|
-
>
|
|
266
|
-
<Icon name="gift-present" />
|
|
292
|
+
<span className="flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-strong">
|
|
293
|
+
<Icon name="gift-present" aria-hidden="true" />
|
|
267
294
|
</span>
|
|
268
295
|
</div>
|
|
269
296
|
)}
|
|
270
297
|
|
|
271
|
-
{
|
|
272
|
-
|
|
298
|
+
{/* Upgrade card */}
|
|
299
|
+
{showUpgrade && (
|
|
300
|
+
<UpgradeCard
|
|
301
|
+
title={upgradeTitle}
|
|
302
|
+
subtitle={upgradeSubtitle}
|
|
303
|
+
onClick={onUpgradeClick ? runAndClose(onUpgradeClick) : undefined}
|
|
304
|
+
credits={upgradeCredits}
|
|
305
|
+
/>
|
|
273
306
|
)}
|
|
274
307
|
|
|
308
|
+
{/* Account */}
|
|
309
|
+
{showAccount && (
|
|
310
|
+
<div className="space-y-xxs border-t border-hairline pt-sm">
|
|
311
|
+
{userEmail && (
|
|
312
|
+
<p className="truncate px-sm py-xxs text-caption text-muted">{userEmail}</p>
|
|
313
|
+
)}
|
|
314
|
+
{onSettings && (
|
|
315
|
+
<button type="button" className={rowButton} onClick={runAndClose(onSettings)}>
|
|
316
|
+
<Icon name="settings-gear" className="text-muted" aria-hidden="true" />
|
|
317
|
+
<span>User Settings</span>
|
|
318
|
+
</button>
|
|
319
|
+
)}
|
|
320
|
+
{onLogout && (
|
|
321
|
+
<button type="button" className={rowButton} onClick={runAndClose(onLogout)}>
|
|
322
|
+
<Icon name="logout-sign-out" className="text-muted" aria-hidden="true" />
|
|
323
|
+
<span>Logout</span>
|
|
324
|
+
</button>
|
|
325
|
+
)}
|
|
326
|
+
</div>
|
|
327
|
+
)}
|
|
328
|
+
|
|
329
|
+
{/* Footer icon row */}
|
|
275
330
|
{showFooterRow && (
|
|
276
|
-
<div className="flex items-center justify-between pt-
|
|
277
|
-
{/* User avatar */}
|
|
331
|
+
<div className="flex items-center justify-between border-t border-hairline pt-sm">
|
|
278
332
|
{userInitials && (
|
|
279
333
|
<span
|
|
280
|
-
|
|
281
|
-
style={{ width: "36px", height: "36px" }}
|
|
334
|
+
role="img"
|
|
282
335
|
aria-label="User profile"
|
|
336
|
+
className="flex size-9 items-center justify-center rounded-full bg-primary text-body-sm font-weight-body-md text-on-primary"
|
|
283
337
|
>
|
|
284
338
|
{userInitials}
|
|
285
339
|
</span>
|
|
286
340
|
)}
|
|
287
|
-
|
|
288
|
-
{/* Right-side icon group */}
|
|
289
|
-
<div className="flex items-center gap-xs ml-auto">
|
|
290
|
-
{/* Dark mode toggle — only rendered when callback is provided */}
|
|
341
|
+
<div className="ml-auto flex items-center gap-xs">
|
|
291
342
|
{onDarkModeToggle && (
|
|
292
|
-
<
|
|
293
|
-
|
|
294
|
-
size="sm"
|
|
343
|
+
<button
|
|
344
|
+
type="button"
|
|
295
345
|
aria-label={darkMode ? "Switch to light mode" : "Switch to dark mode"}
|
|
296
|
-
onClick={onDarkModeToggle}
|
|
297
|
-
className=
|
|
346
|
+
onClick={runAndClose(onDarkModeToggle)}
|
|
347
|
+
className={iconButton}
|
|
298
348
|
>
|
|
299
|
-
<Icon name={darkMode ? "sun-light-mode" : "moon-dark-mode"} />
|
|
300
|
-
</
|
|
349
|
+
<Icon name={darkMode ? "sun-light-mode" : "moon-dark-mode"} aria-hidden="true" />
|
|
350
|
+
</button>
|
|
301
351
|
)}
|
|
302
|
-
|
|
303
|
-
{/* Inbox button */}
|
|
304
352
|
{onInboxClick && (
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
size="sm"
|
|
353
|
+
<button
|
|
354
|
+
type="button"
|
|
308
355
|
aria-label="Inbox"
|
|
309
|
-
onClick={onInboxClick}
|
|
310
|
-
className=
|
|
356
|
+
onClick={runAndClose(onInboxClick)}
|
|
357
|
+
className={iconButton}
|
|
311
358
|
>
|
|
312
|
-
<Icon name="inbox-mail-tray" />
|
|
359
|
+
<Icon name="inbox-mail-tray" aria-hidden="true" />
|
|
313
360
|
<span
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
style={{ width: "8px", height: "8px", top: "4px", right: "4px" }}
|
|
361
|
+
aria-hidden="true"
|
|
362
|
+
className="absolute right-xxs top-xxs size-2 rounded-full bg-semantic-error"
|
|
317
363
|
/>
|
|
318
|
-
</
|
|
364
|
+
</button>
|
|
319
365
|
)}
|
|
320
366
|
</div>
|
|
321
367
|
</div>
|
|
@@ -323,34 +369,60 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
323
369
|
</div>
|
|
324
370
|
</div>
|
|
325
371
|
</div>
|
|
326
|
-
)
|
|
372
|
+
);
|
|
327
373
|
|
|
328
374
|
return (
|
|
329
|
-
|
|
330
|
-
{
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
375
|
+
<nav
|
|
376
|
+
ref={ref}
|
|
377
|
+
aria-label="Main navigation"
|
|
378
|
+
data-state={open ? "open" : "closed"}
|
|
379
|
+
className={["w-full bg-transparent", className].filter(Boolean).join(" ")}
|
|
380
|
+
>
|
|
381
|
+
{/* ── Bar: three equal columns so the brand is truly centered ── */}
|
|
382
|
+
<div className="grid w-full grid-cols-3 items-center gap-sm px-md py-sm">
|
|
383
|
+
{/* Left: menu toggle */}
|
|
384
|
+
<div className="flex min-w-0 items-center justify-start">
|
|
385
|
+
<button
|
|
386
|
+
ref={toggleRef}
|
|
387
|
+
type="button"
|
|
388
|
+
aria-label={open ? "Close menu" : "Open menu"}
|
|
389
|
+
aria-expanded={open}
|
|
390
|
+
aria-controls={panelId}
|
|
391
|
+
onClick={() => setOpen(!open)}
|
|
392
|
+
className={iconButton}
|
|
393
|
+
>
|
|
394
|
+
<Icon name={open ? "close" : "hamburger-menu"} aria-hidden="true" />
|
|
395
|
+
</button>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
{/* Center: brand mark + name */}
|
|
399
|
+
<div className="flex min-w-0 items-center justify-center gap-sm">
|
|
400
|
+
<span
|
|
401
|
+
aria-hidden="true"
|
|
402
|
+
className="size-7 shrink-0 rounded-full bg-gradient-to-br from-logo-orange to-logo-violet"
|
|
403
|
+
/>
|
|
404
|
+
<span className="truncate text-body-md font-weight-body-md text-ink">{brandName}</span>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
{/* Right: user avatar only */}
|
|
408
|
+
<div className="flex min-w-0 items-center justify-end">
|
|
409
|
+
{userInitials && (
|
|
410
|
+
<span
|
|
411
|
+
role="img"
|
|
412
|
+
aria-label="User profile"
|
|
413
|
+
className="flex size-9 shrink-0 items-center justify-center rounded-full bg-primary text-body-sm font-weight-body-md text-on-primary"
|
|
414
|
+
>
|
|
415
|
+
{userInitials}
|
|
416
|
+
</span>
|
|
417
|
+
)}
|
|
418
|
+
</div>
|
|
342
419
|
</div>
|
|
343
420
|
|
|
344
|
-
{/*
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
*/}
|
|
350
|
-
{typeof window !== "undefined"
|
|
351
|
-
? ReactDOM.createPortal(overlayContent, document.body)
|
|
352
|
-
: overlayContent}
|
|
353
|
-
</>
|
|
421
|
+
{/* ── Left-edge overlay drawer, portalled to body ── */}
|
|
422
|
+
{mounted && typeof window !== "undefined" && typeof document !== "undefined"
|
|
423
|
+
? createPortal(overlay, document.body)
|
|
424
|
+
: null}
|
|
425
|
+
</nav>
|
|
354
426
|
);
|
|
355
427
|
},
|
|
356
428
|
);
|