@designa8/vibedesign-v6 1.20.20 → 2.1.2
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 +224 -138
- package/src/atoms/AppSidebar/index.ts +1 -1
- package/src/atoms/AppSidebar/preview.tsx +61 -8
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +242 -173
- 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/ExportDesignMdModal/ExportDesignMdModal.tsx +6 -1
- 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/Menu/Menu.tsx +1 -1
- 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,116 @@ 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
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
workspaceName={workspaceName}
|
|
202
|
-
initials={workspaceName.charAt(0).toUpperCase()}
|
|
203
|
-
/>
|
|
204
|
-
</div>
|
|
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
|
-
>
|
|
230
|
+
<div className="flex flex-1 flex-col px-sm py-sm space-y-sm">
|
|
231
|
+
{/* Workspace switcher */}
|
|
232
|
+
{workspaceName && (
|
|
233
|
+
<WorkspaceMenu workspaceName={workspaceName} />
|
|
234
|
+
)}
|
|
235
|
+
|
|
236
|
+
{/* Nav entries */}
|
|
212
237
|
<ul className="space-y-xxs" role="list">
|
|
213
238
|
{entries.map((entry) => {
|
|
214
|
-
const
|
|
215
|
-
const hasSubItems = !!(entry.subItems?.length);
|
|
239
|
+
const hasSubItems = !!entry.subItems?.length;
|
|
216
240
|
const isAlwaysExpanded = hasSubItems && !!entry.alwaysExpanded;
|
|
217
241
|
const isExpanded = isAlwaysExpanded ? true : expandedIds.has(entry.id);
|
|
242
|
+
const ownsActiveSub =
|
|
243
|
+
activeSubId !== undefined &&
|
|
244
|
+
!!entry.subItems?.some((s) => s.id === activeSubId);
|
|
218
245
|
|
|
219
246
|
const mappedSubItems: NavItemSubItem[] | undefined = hasSubItems
|
|
220
247
|
? entry.subItems!.map((sub) => ({
|
|
221
248
|
id: sub.id,
|
|
222
249
|
label: sub.label,
|
|
223
250
|
onDelete: sub.onDelete,
|
|
224
|
-
onClick:
|
|
225
|
-
|
|
226
|
-
|
|
251
|
+
onClick: (id: string) => {
|
|
252
|
+
onSubSelect?.(id);
|
|
253
|
+
setOpen(false);
|
|
254
|
+
},
|
|
227
255
|
}))
|
|
228
256
|
: undefined;
|
|
229
257
|
|
|
@@ -232,90 +260,105 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
232
260
|
key={entry.id}
|
|
233
261
|
icon={entry.icon}
|
|
234
262
|
label={entry.label}
|
|
235
|
-
active={
|
|
263
|
+
active={activeId === entry.id || (activeId === undefined && ownsActiveSub)}
|
|
236
264
|
subItems={mappedSubItems}
|
|
265
|
+
activeSubId={activeSubId}
|
|
237
266
|
alwaysExpanded={isAlwaysExpanded}
|
|
238
267
|
expanded={hasSubItems ? isExpanded : undefined}
|
|
239
|
-
onExpandToggle={
|
|
240
|
-
|
|
268
|
+
onExpandToggle={
|
|
269
|
+
hasSubItems && !isAlwaysExpanded ? () => toggleExpanded(entry.id) : undefined
|
|
270
|
+
}
|
|
271
|
+
onClick={() => {
|
|
241
272
|
onSelect?.(entry.id);
|
|
242
|
-
if (!hasSubItems) setOpen(false);
|
|
243
|
-
else e.preventDefault();
|
|
273
|
+
if (!hasSubItems || isAlwaysExpanded) setOpen(false);
|
|
244
274
|
}}
|
|
245
275
|
/>
|
|
246
276
|
);
|
|
247
277
|
})}
|
|
248
278
|
</ul>
|
|
249
|
-
</div>
|
|
250
279
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
style={{ backgroundColor: "var(--color-canvas)" }}
|
|
255
|
-
>
|
|
280
|
+
<div className="flex-1" />
|
|
281
|
+
|
|
282
|
+
{/* Share card */}
|
|
256
283
|
{showShareCard && (
|
|
257
|
-
<div className="rounded-
|
|
258
|
-
<div className="flex flex-col gap-xxs
|
|
259
|
-
<span className="text-body-sm font-weight-
|
|
284
|
+
<div className="flex items-center justify-between gap-md rounded-lg border border-hairline bg-surface px-md py-sm">
|
|
285
|
+
<div className="flex min-w-0 flex-col gap-xxs">
|
|
286
|
+
<span className="text-body-sm font-weight-body-md text-ink">Share & earn</span>
|
|
260
287
|
<span className="text-caption text-muted">100 credits per paid referral</span>
|
|
261
288
|
</div>
|
|
262
|
-
<span
|
|
263
|
-
|
|
264
|
-
style={{ width: "36px", height: "36px" }}
|
|
265
|
-
>
|
|
266
|
-
<Icon name="gift-present" />
|
|
289
|
+
<span className="flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-strong">
|
|
290
|
+
<Icon name="gift-present" aria-hidden="true" />
|
|
267
291
|
</span>
|
|
268
292
|
</div>
|
|
269
293
|
)}
|
|
270
294
|
|
|
271
|
-
{
|
|
272
|
-
|
|
295
|
+
{/* Upgrade card */}
|
|
296
|
+
{showUpgrade && (
|
|
297
|
+
<UpgradeCard
|
|
298
|
+
title={upgradeTitle}
|
|
299
|
+
subtitle={upgradeSubtitle}
|
|
300
|
+
onClick={onUpgradeClick ? runAndClose(onUpgradeClick) : undefined}
|
|
301
|
+
credits={upgradeCredits}
|
|
302
|
+
/>
|
|
273
303
|
)}
|
|
274
304
|
|
|
305
|
+
{/* Account */}
|
|
306
|
+
{showAccount && (
|
|
307
|
+
<div className="space-y-xxs border-t border-hairline pt-sm">
|
|
308
|
+
{userEmail && (
|
|
309
|
+
<p className="truncate px-sm py-xxs text-caption text-muted">{userEmail}</p>
|
|
310
|
+
)}
|
|
311
|
+
{onSettings && (
|
|
312
|
+
<button type="button" className={rowButton} onClick={runAndClose(onSettings)}>
|
|
313
|
+
<Icon name="settings-gear" className="text-muted" aria-hidden="true" />
|
|
314
|
+
<span>User Settings</span>
|
|
315
|
+
</button>
|
|
316
|
+
)}
|
|
317
|
+
{onLogout && (
|
|
318
|
+
<button type="button" className={rowButton} onClick={runAndClose(onLogout)}>
|
|
319
|
+
<Icon name="logout-sign-out" className="text-muted" aria-hidden="true" />
|
|
320
|
+
<span>Logout</span>
|
|
321
|
+
</button>
|
|
322
|
+
)}
|
|
323
|
+
</div>
|
|
324
|
+
)}
|
|
325
|
+
|
|
326
|
+
{/* Footer icon row */}
|
|
275
327
|
{showFooterRow && (
|
|
276
|
-
<div className="flex items-center justify-between pt-
|
|
277
|
-
{/* User avatar */}
|
|
328
|
+
<div className="flex items-center justify-between border-t border-hairline pt-sm">
|
|
278
329
|
{userInitials && (
|
|
279
330
|
<span
|
|
280
|
-
|
|
281
|
-
style={{ width: "36px", height: "36px" }}
|
|
331
|
+
role="img"
|
|
282
332
|
aria-label="User profile"
|
|
333
|
+
className="flex size-9 items-center justify-center rounded-full bg-primary text-body-sm font-weight-body-md text-on-primary"
|
|
283
334
|
>
|
|
284
335
|
{userInitials}
|
|
285
336
|
</span>
|
|
286
337
|
)}
|
|
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 */}
|
|
338
|
+
<div className="ml-auto flex items-center gap-xs">
|
|
291
339
|
{onDarkModeToggle && (
|
|
292
|
-
<
|
|
293
|
-
|
|
294
|
-
size="sm"
|
|
340
|
+
<button
|
|
341
|
+
type="button"
|
|
295
342
|
aria-label={darkMode ? "Switch to light mode" : "Switch to dark mode"}
|
|
296
|
-
onClick={onDarkModeToggle}
|
|
297
|
-
className=
|
|
343
|
+
onClick={runAndClose(onDarkModeToggle)}
|
|
344
|
+
className={iconButton}
|
|
298
345
|
>
|
|
299
|
-
<Icon name={darkMode ? "sun-light-mode" : "moon-dark-mode"} />
|
|
300
|
-
</
|
|
346
|
+
<Icon name={darkMode ? "sun-light-mode" : "moon-dark-mode"} aria-hidden="true" />
|
|
347
|
+
</button>
|
|
301
348
|
)}
|
|
302
|
-
|
|
303
|
-
{/* Inbox button */}
|
|
304
349
|
{onInboxClick && (
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
size="sm"
|
|
350
|
+
<button
|
|
351
|
+
type="button"
|
|
308
352
|
aria-label="Inbox"
|
|
309
|
-
onClick={onInboxClick}
|
|
310
|
-
className=
|
|
353
|
+
onClick={runAndClose(onInboxClick)}
|
|
354
|
+
className={iconButton}
|
|
311
355
|
>
|
|
312
|
-
<Icon name="inbox-mail-tray" />
|
|
356
|
+
<Icon name="inbox-mail-tray" aria-hidden="true" />
|
|
313
357
|
<span
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
style={{ width: "8px", height: "8px", top: "4px", right: "4px" }}
|
|
358
|
+
aria-hidden="true"
|
|
359
|
+
className="absolute right-xxs top-xxs size-2 rounded-full bg-semantic-error"
|
|
317
360
|
/>
|
|
318
|
-
</
|
|
361
|
+
</button>
|
|
319
362
|
)}
|
|
320
363
|
</div>
|
|
321
364
|
</div>
|
|
@@ -323,34 +366,60 @@ export const AppSidebarMobile = React.forwardRef<HTMLDivElement, AppSidebarMobil
|
|
|
323
366
|
</div>
|
|
324
367
|
</div>
|
|
325
368
|
</div>
|
|
326
|
-
)
|
|
369
|
+
);
|
|
327
370
|
|
|
328
371
|
return (
|
|
329
|
-
|
|
330
|
-
{
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
372
|
+
<nav
|
|
373
|
+
ref={ref}
|
|
374
|
+
aria-label="Main navigation"
|
|
375
|
+
data-state={open ? "open" : "closed"}
|
|
376
|
+
className={["w-full bg-transparent", className].filter(Boolean).join(" ")}
|
|
377
|
+
>
|
|
378
|
+
{/* ── Bar: three equal columns so the brand is truly centered ── */}
|
|
379
|
+
<div className="grid w-full grid-cols-3 items-center gap-sm px-md py-sm">
|
|
380
|
+
{/* Left: menu toggle */}
|
|
381
|
+
<div className="flex min-w-0 items-center justify-start">
|
|
382
|
+
<button
|
|
383
|
+
ref={toggleRef}
|
|
384
|
+
type="button"
|
|
385
|
+
aria-label={open ? "Close menu" : "Open menu"}
|
|
386
|
+
aria-expanded={open}
|
|
387
|
+
aria-controls={panelId}
|
|
388
|
+
onClick={() => setOpen(!open)}
|
|
389
|
+
className={iconButton}
|
|
390
|
+
>
|
|
391
|
+
<Icon name={open ? "close" : "hamburger-menu"} aria-hidden="true" />
|
|
392
|
+
</button>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
{/* Center: brand mark + name */}
|
|
396
|
+
<div className="flex min-w-0 items-center justify-center gap-sm">
|
|
397
|
+
<span
|
|
398
|
+
aria-hidden="true"
|
|
399
|
+
className="size-7 shrink-0 rounded-full bg-gradient-to-br from-logo-orange to-logo-violet"
|
|
400
|
+
/>
|
|
401
|
+
<span className="truncate text-body-md font-weight-body-md text-ink">{brandName}</span>
|
|
402
|
+
</div>
|
|
403
|
+
|
|
404
|
+
{/* Right: user avatar only */}
|
|
405
|
+
<div className="flex min-w-0 items-center justify-end">
|
|
406
|
+
{userInitials && (
|
|
407
|
+
<span
|
|
408
|
+
role="img"
|
|
409
|
+
aria-label="User profile"
|
|
410
|
+
className="flex size-9 shrink-0 items-center justify-center rounded-full bg-primary text-body-sm font-weight-body-md text-on-primary"
|
|
411
|
+
>
|
|
412
|
+
{userInitials}
|
|
413
|
+
</span>
|
|
414
|
+
)}
|
|
415
|
+
</div>
|
|
342
416
|
</div>
|
|
343
417
|
|
|
344
|
-
{/*
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
*/}
|
|
350
|
-
{typeof window !== "undefined"
|
|
351
|
-
? ReactDOM.createPortal(overlayContent, document.body)
|
|
352
|
-
: overlayContent}
|
|
353
|
-
</>
|
|
418
|
+
{/* ── Left-edge overlay drawer, portalled to body ── */}
|
|
419
|
+
{mounted && typeof window !== "undefined" && typeof document !== "undefined"
|
|
420
|
+
? createPortal(overlay, document.body)
|
|
421
|
+
: null}
|
|
422
|
+
</nav>
|
|
354
423
|
);
|
|
355
424
|
},
|
|
356
425
|
);
|