@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.
Files changed (122) hide show
  1. package/README.md +1 -1
  2. package/dist/fonts/plusjakartasans/PlusJakartaSans-Italic[wght].ttf +0 -0
  3. package/dist/fonts/plusjakartasans/PlusJakartaSans[wght].ttf +0 -0
  4. package/dist/index.cjs +12027 -4942
  5. package/dist/index.js +12089 -5004
  6. package/dist/styles.css +1393 -97
  7. package/package.json +116 -1
  8. package/src/atoms/AgentQuestionCard/AgentQuestionCard.tsx +567 -0
  9. package/src/atoms/AgentQuestionCard/index.ts +6 -0
  10. package/src/atoms/AgentQuestionCard/preview.tsx +199 -0
  11. package/src/atoms/AppLayout/AppLayout.tsx +85 -22
  12. package/src/atoms/AppLayout/preview.tsx +4 -0
  13. package/src/atoms/AppSidebar/AppSidebar.tsx +222 -137
  14. package/src/atoms/AppSidebar/preview.tsx +61 -8
  15. package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +241 -169
  16. package/src/atoms/AppSidebarMobile/preview.tsx +59 -89
  17. package/src/atoms/AuthLogin/AuthLogin.tsx +86 -49
  18. package/src/atoms/AuthLogin/preview.tsx +16 -0
  19. package/src/atoms/AuthSignUp/AuthSignUp.tsx +206 -126
  20. package/src/atoms/AuthSignUp/preview.tsx +10 -0
  21. package/src/atoms/BottomSheet/BottomSheet.tsx +199 -0
  22. package/src/atoms/BottomSheet/index.ts +2 -0
  23. package/src/atoms/BottomSheet/preview.tsx +50 -0
  24. package/src/atoms/Button/Button.tsx +19 -3
  25. package/src/atoms/Button/preview.tsx +2 -1
  26. package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +160 -84
  27. package/src/atoms/ChatHistorySidebar/preview.tsx +81 -42
  28. package/src/atoms/ChatScreen/ChatScreen.tsx +298 -33
  29. package/src/atoms/ChatScreen/preview.tsx +54 -90
  30. package/src/atoms/Chip/Chip.tsx +81 -33
  31. package/src/atoms/Chip/preview.tsx +39 -21
  32. package/src/atoms/CodeEditor/CodeEditor.tsx +10 -4
  33. package/src/atoms/ComponentActionsSheet/ComponentActionsSheet.tsx +165 -0
  34. package/src/atoms/ComponentActionsSheet/index.ts +7 -0
  35. package/src/atoms/ComponentActionsSheet/preview.tsx +67 -0
  36. package/src/atoms/ComponentCard/ComponentCard.tsx +17 -35
  37. package/src/atoms/ComponentCard/preview.tsx +9 -9
  38. package/src/atoms/DesignSystemLoader/DesignSystemLoader.tsx +153 -0
  39. package/src/atoms/DesignSystemLoader/index.ts +2 -0
  40. package/src/atoms/DesignSystemLoader/preview.tsx +19 -0
  41. package/src/atoms/DesignSystemShowcase/DesignSystemShowcase.tsx +410 -0
  42. package/src/atoms/DesignSystemShowcase/index.ts +6 -0
  43. package/src/atoms/DesignSystemShowcase/preview.tsx +22 -0
  44. package/src/atoms/DesignTokensPanel/DesignTokensPanel.data.ts +254 -0
  45. package/src/atoms/DesignTokensPanel/DesignTokensPanel.tsx +946 -0
  46. package/src/atoms/DesignTokensPanel/index.ts +9 -0
  47. package/src/atoms/DesignTokensPanel/preview.tsx +39 -0
  48. package/src/atoms/ExpandableMessage/ExpandableMessage.tsx +239 -0
  49. package/src/atoms/ExpandableMessage/fix-link-note.txt +3 -0
  50. package/src/atoms/ExpandableMessage/index.ts +2 -0
  51. package/src/atoms/ExpandableMessage/markdown.tsx +310 -0
  52. package/src/atoms/ExpandableMessage/preview.tsx +83 -0
  53. package/src/atoms/FilterTabBar/FilterTabBar.tsx +2 -2
  54. package/src/atoms/FontCombobox/FontCombobox.tsx +655 -0
  55. package/src/atoms/FontCombobox/index.ts +6 -0
  56. package/src/atoms/FontCombobox/preview.tsx +111 -0
  57. package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +894 -96
  58. package/src/atoms/HomePageTemplate/preview.tsx +4 -0
  59. package/src/atoms/Icon/Icon.tsx +17 -11
  60. package/src/atoms/Icon/icons.data.ts +34 -0
  61. package/src/atoms/Input/Input.tsx +37 -21
  62. package/src/atoms/LandingHero/LandingHero.tsx +545 -0
  63. package/src/atoms/LandingHero/index.ts +6 -0
  64. package/src/atoms/LandingHero/preview.tsx +88 -0
  65. package/src/atoms/MarketingFooter/MarketingFooter.tsx +215 -0
  66. package/src/atoms/MarketingFooter/index.ts +7 -0
  67. package/src/atoms/MarketingFooter/preview.tsx +28 -0
  68. package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +451 -0
  69. package/src/atoms/MarketingNavbar/index.ts +7 -0
  70. package/src/atoms/MarketingNavbar/preview.tsx +109 -0
  71. package/src/atoms/MobileActionsDrawer/MobileActionsDrawer.tsx +548 -0
  72. package/src/atoms/MobileActionsDrawer/index.ts +9 -0
  73. package/src/atoms/MobileActionsDrawer/preview.tsx +109 -0
  74. package/src/atoms/Modal/Modal.tsx +77 -28
  75. package/src/atoms/PreviewDock/PreviewDock.tsx +119 -0
  76. package/src/atoms/PreviewDock/index.ts +2 -0
  77. package/src/atoms/PreviewDock/preview.tsx +30 -0
  78. package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +47 -30
  79. package/src/atoms/PricingCard/PricingCard.tsx +15 -4
  80. package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +109 -89
  81. package/src/atoms/ProjectSettingsModal/ProjectSettingsModal.tsx +314 -0
  82. package/src/atoms/ProjectSettingsModal/index.ts +2 -0
  83. package/src/atoms/ProjectSettingsModal/preview.tsx +130 -0
  84. package/src/atoms/ProjectSettingsModal/switch.snippet.txt +8 -0
  85. package/src/atoms/PromptInputBar/PromptInputBar.tsx +750 -302
  86. package/src/atoms/PromptInputBar/preview.tsx +64 -64
  87. package/src/atoms/SettingsPageTemplate/SettingsPageTemplate.tsx +272 -0
  88. package/src/atoms/SettingsPageTemplate/index.ts +2 -0
  89. package/src/atoms/SettingsPageTemplate/preview.tsx +29 -0
  90. package/src/atoms/SidebarUpgradeBanner/SidebarUpgradeBanner.tsx +178 -0
  91. package/src/atoms/SidebarUpgradeBanner/index.ts +2 -0
  92. package/src/atoms/SidebarUpgradeBanner/preview.tsx +47 -0
  93. package/src/atoms/SkeletonChip/SkeletonChip.tsx +198 -0
  94. package/src/atoms/SkeletonChip/index.ts +2 -0
  95. package/src/atoms/SkeletonChip/preview.tsx +44 -0
  96. package/src/atoms/TemplateHeader/TemplateHeader.tsx +129 -0
  97. package/src/atoms/TemplateHeader/index.ts +2 -0
  98. package/src/atoms/TemplateHeader/preview.tsx +39 -0
  99. package/src/atoms/TemplateHero/TemplateHero.tsx +286 -0
  100. package/src/atoms/TemplateHero/index.ts +2 -0
  101. package/src/atoms/TemplateHero/preview.tsx +32 -0
  102. package/src/atoms/TemplateSummary/TemplateSummary.tsx +85 -0
  103. package/src/atoms/TemplateSummary/index.ts +2 -0
  104. package/src/atoms/TemplateSummary/preview.tsx +10 -0
  105. package/src/atoms/Toast/Toast.tsx +178 -0
  106. package/src/atoms/Toast/index.ts +2 -0
  107. package/src/atoms/Toast/preview.tsx +100 -0
  108. package/src/atoms/TopNavbar/TopNavbar.tsx +145 -67
  109. package/src/atoms/TopNavbar/preview.tsx +13 -7
  110. package/src/atoms/TopupModal/TopupModal.tsx +94 -0
  111. package/src/atoms/TopupModal/index.ts +2 -0
  112. package/src/atoms/TopupModal/preview.tsx +22 -0
  113. package/src/atoms/UpgradeCard/UpgradeCard.tsx +124 -43
  114. package/src/atoms/UpgradeCard/index.ts +1 -1
  115. package/src/atoms/UpgradeCard/preview.tsx +7 -14
  116. package/src/atoms/UpgradeModal/UpgradeModal.tsx +192 -0
  117. package/src/atoms/UpgradeModal/index.ts +2 -0
  118. package/src/atoms/UpgradeModal/preview.tsx +41 -0
  119. package/src/index.ts +23 -0
  120. package/src/tokens.css +45 -7
  121. package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
  122. package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import { Button } from "../Button";
3
- import { WorkspaceMenu } from "../WorkspaceMenu";
4
3
  import { NavItem } from "../NavItem";
5
4
  import type { NavItemSubItem } from "../NavItem";
6
5
  import { UpgradeCard } from "../UpgradeCard";
6
+ import { SkeletonChip } from "../SkeletonChip";
7
7
  import { Icon } from "../Icon";
8
8
 
9
9
  /* ─── Types ──────────────────────────────────────────────────────────────── */
@@ -43,6 +43,17 @@ export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
43
43
  */
44
44
  entries?: NavEntry[];
45
45
 
46
+ /**
47
+ * When true, the nav entries are still loading (e.g. fetched async) and
48
+ * a stack of SkeletonChip shimmer rows is rendered in their place instead
49
+ * of `entries`. Automatically switches to icon-only skeleton rows when
50
+ * the sidebar is collapsed.
51
+ */
52
+ loading?: boolean;
53
+
54
+ /** Number of skeleton rows to show while `loading` is true. Defaults to 5. */
55
+ loadingCount?: number;
56
+
46
57
  /** ID of the currently-active top-level entry. */
47
58
  activeId?: string;
48
59
 
@@ -65,22 +76,36 @@ export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
65
76
  // ── Footer opt-in props ──────────────────────────────────────────────────
66
77
 
67
78
  /**
68
- * When provided, renders a WorkspaceMenu with this name in the nav area
69
- * (above entries). If omitted the WorkspaceMenu is not shown.
79
+ * @deprecated The workspace dropdown is no longer rendered. Accepted so
80
+ * existing callers keep type-checking; the value is ignored.
70
81
  */
71
82
  workspaceName?: string;
72
83
 
73
84
  /**
74
- * When true, renders the "Share Lovable" referral card in the footer.
75
- * Defaults to false.
85
+ * When provided, renders an UpgradeCard promo above the bottom bar and
86
+ * calls this when the whole card is clicked. If omitted the card is not
87
+ * shown. Hidden entirely when the sidebar is collapsed.
88
+ */
89
+ onUpgradeClick?: () => void;
90
+
91
+ /**
92
+ * Title text displayed in the UpgradeCard. Only used when onUpgradeClick
93
+ * is provided. Defaults to "Upgrade to Pro".
94
+ */
95
+ upgradeTitle?: string;
96
+
97
+ /**
98
+ * Subtitle text displayed in the UpgradeCard. Only used when onUpgradeClick
99
+ * is provided. Defaults to "Unlock more features".
76
100
  */
77
- showShareCard?: boolean;
101
+ upgradeSubtitle?: string;
78
102
 
79
103
  /**
80
- * When true, renders the UpgradeCard in the footer.
81
- * Defaults to false.
104
+ * Optional credits usage forwarded to the UpgradeCard `credits` prop.
105
+ * Only used when onUpgradeClick is provided. When omitted the card renders
106
+ * without a credits block.
82
107
  */
83
- showUpgradeCard?: boolean;
108
+ upgradeCredits?: { remaining: number; total: number; helper?: string };
84
109
 
85
110
  /**
86
111
  * When provided, renders a user avatar chip in the footer with these initials.
@@ -90,17 +115,26 @@ export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
90
115
 
91
116
  /**
92
117
  * Email of the connected user. Shown as the header row of the account menu
93
- * that opens when the avatar is clicked (requires onLogout to be set).
118
+ * that opens when the avatar is clicked (requires onLogout or onSettings to
119
+ * be set).
94
120
  */
95
121
  userEmail?: string;
96
122
 
97
123
  /**
98
- * When provided, the avatar becomes a menu trigger: clicking it opens an
99
- * account menu with the user's email as a header and a "Logout" item that
100
- * calls this handler. If omitted the avatar has no menu.
124
+ * When provided, the avatar becomes a menu trigger and the account menu
125
+ * includes a "Logout" item that calls this handler. The menu opens as soon
126
+ * as either onLogout or onSettings is provided.
101
127
  */
102
128
  onLogout?: () => void;
103
129
 
130
+ /**
131
+ * When provided, the avatar becomes a menu trigger and the account menu
132
+ * includes a "User Settings" item (above Logout) that closes the menu and
133
+ * calls this handler. The menu opens as soon as either onLogout or
134
+ * onSettings is provided.
135
+ */
136
+ onSettings?: () => void;
137
+
104
138
  /**
105
139
  * When provided, renders an inbox button in the footer and calls this on click.
106
140
  * If omitted the inbox button is not shown.
@@ -142,28 +176,14 @@ export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
142
176
  interface AccountMenuProps {
143
177
  userInitials: string;
144
178
  userEmail?: string;
145
- onLogout: () => void;
179
+ onLogout?: () => void;
180
+ onSettings?: () => void;
146
181
  }
147
182
 
148
- function AccountMenu({ userInitials, userEmail, onLogout }: AccountMenuProps) {
183
+ function AccountMenu({ userInitials, userEmail, onLogout, onSettings }: AccountMenuProps) {
149
184
  const [open, setOpen] = React.useState(false);
150
- const [mounted, setMounted] = React.useState(false);
151
- const [visible, setVisible] = React.useState(false);
152
185
  const containerRef = React.useRef<HTMLDivElement>(null);
153
186
 
154
- React.useEffect(() => {
155
- if (open) {
156
- setMounted(true);
157
- const raf = requestAnimationFrame(() => {
158
- requestAnimationFrame(() => setVisible(true));
159
- });
160
- return () => cancelAnimationFrame(raf);
161
- }
162
- setVisible(false);
163
- const timer = window.setTimeout(() => setMounted(false), 200);
164
- return () => window.clearTimeout(timer);
165
- }, [open]);
166
-
167
187
  React.useEffect(() => {
168
188
  if (!open) return;
169
189
  const handler = (e: MouseEvent) => {
@@ -200,29 +220,40 @@ function AccountMenu({ userInitials, userEmail, onLogout }: AccountMenuProps) {
200
220
  {userInitials}
201
221
  </Button>
202
222
 
203
- {mounted && (
204
- <div
205
- role="menu"
206
- aria-label="Account"
207
- aria-hidden={!open}
208
- className={[
209
- "absolute left-0 bottom-full mb-xs origin-bottom rounded-sm bg-surface border border-hairline shadow-card z-10 overflow-hidden",
210
- "flex flex-col gap-0 p-0",
211
- "transition-all duration-200 ease-in-out will-change-transform",
212
- visible
213
- ? "pointer-events-auto opacity-100 translate-y-0 scale-y-100"
214
- : "pointer-events-none opacity-0 translate-y-1 scale-y-95",
215
- ].join(" ")}
216
- style={{ minWidth: "200px" }}
217
- >
218
- {userEmail && (
219
- <div className="px-md py-sm border-b border-hairline">
220
- <span className="block text-body-sm text-ink font-weight-heading-sm truncate">
221
- {userEmail}
222
- </span>
223
- </div>
224
- )}
223
+ <div
224
+ role="menu"
225
+ aria-label="Account"
226
+ aria-hidden={!open}
227
+ data-state={open ? "open" : "closed"}
228
+ className="absolute left-0 bottom-full mb-xs origin-bottom rounded-sm bg-surface border border-hairline shadow-card overflow-hidden flex flex-col gap-0 p-0 transition duration-200 ease-out data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100 data-[state=closed]:pointer-events-none data-[state=closed]:translate-y-1 data-[state=closed]:scale-95 data-[state=closed]:opacity-0"
229
+ style={{ minWidth: "200px", zIndex: open ? "var(--z-dropdown, 1000)" : undefined }}
230
+ >
231
+ {userEmail && (
232
+ <div className="px-md py-sm border-b border-hairline">
233
+ <span className="block text-body-sm text-ink font-weight-heading-sm truncate">
234
+ {userEmail}
235
+ </span>
236
+ </div>
237
+ )}
225
238
 
239
+ {onSettings && (
240
+ <Button
241
+ role="menuitem"
242
+ type="button"
243
+ variant="ghost"
244
+ size="sm"
245
+ onClick={() => {
246
+ setOpen(false);
247
+ onSettings();
248
+ }}
249
+ className="!w-full !justify-start !rounded-none !px-md !py-sm !gap-sm !text-ink"
250
+ >
251
+ <Icon name="settings-gear" className="size-4 shrink-0" />
252
+ <span>User Settings</span>
253
+ </Button>
254
+ )}
255
+
256
+ {onLogout && (
226
257
  <Button
227
258
  role="menuitem"
228
259
  type="button"
@@ -237,31 +268,39 @@ function AccountMenu({ userInitials, userEmail, onLogout }: AccountMenuProps) {
237
268
  <Icon name="logout-sign-out" className="size-4 shrink-0" />
238
269
  <span>Logout</span>
239
270
  </Button>
240
- </div>
241
- )}
271
+ )}
272
+ </div>
242
273
  </div>
243
274
  );
244
275
  }
245
276
 
246
277
  /* ─── Component ──────────────────────────────────────────────────────────── */
247
278
 
279
+ /** Fallback for when `transitionend` never fires (reduced motion, no animation). */
280
+ const WIDTH_TRANSITION_FALLBACK_MS = 180;
281
+
248
282
  export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
249
283
  (
250
284
  {
251
285
  brandName,
252
286
  entries,
287
+ loading = false,
288
+ loadingCount = 5,
253
289
  activeId,
254
290
  onSelect,
255
291
  activeSubId,
256
292
  onSubSelect,
257
293
  defaultExpandedIds,
258
294
  // footer opt-in props
259
- workspaceName,
260
- showShareCard = false,
261
- showUpgradeCard = false,
295
+ workspaceName: _workspaceName,
296
+ onUpgradeClick,
297
+ upgradeTitle,
298
+ upgradeSubtitle,
299
+ upgradeCredits,
262
300
  userInitials,
263
301
  userEmail,
264
302
  onLogout,
303
+ onSettings,
265
304
  onInboxClick,
266
305
  // dark mode toggle
267
306
  darkMode = false,
@@ -276,7 +315,7 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
276
315
  },
277
316
  ref,
278
317
  ) => {
279
- /* ── Collapse state ── */
318
+ /* ── Collapse state (drives the WIDTH class only) ── */
280
319
  const [internalCollapsed, setInternalCollapsed] = React.useState(false);
281
320
  const isControlled = collapsedProp !== undefined;
282
321
  const collapsed = isControlled ? collapsedProp : internalCollapsed;
@@ -287,6 +326,56 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
287
326
  onCollapsedChange?.(next);
288
327
  };
289
328
 
329
+ /* ── Settled chrome state ──
330
+ * `collapsed` flips the width immediately so the browser can paint the
331
+ * transition. `chromeCollapsed` lags behind: it only catches up once the
332
+ * width transition has finished, so labels, sub-items, the brand block and
333
+ * the upgrade card stay mounted (and get clipped by overflow-hidden) while
334
+ * the width animates. That keeps the long lists off the critical path of
335
+ * the frame that starts the animation. */
336
+ const [chromeCollapsed, setChromeCollapsed] = React.useState(collapsed);
337
+
338
+ const navRef = React.useRef<HTMLElement | null>(null);
339
+ const assignRef = React.useCallback(
340
+ (node: HTMLElement | null) => {
341
+ navRef.current = node;
342
+ if (typeof ref === "function") ref(node);
343
+ else if (ref) (ref as React.MutableRefObject<HTMLElement | null>).current = node;
344
+ },
345
+ [ref],
346
+ );
347
+
348
+ React.useEffect(() => {
349
+ if (chromeCollapsed === collapsed) return;
350
+
351
+ const node = navRef.current;
352
+ let settled = false;
353
+ let timer: number | undefined;
354
+
355
+ const settle = () => {
356
+ if (settled) return;
357
+ settled = true;
358
+ if (timer !== undefined) window.clearTimeout(timer);
359
+ node?.removeEventListener("transitionend", onTransitionEnd);
360
+ setChromeCollapsed(collapsed);
361
+ };
362
+
363
+ function onTransitionEnd(event: TransitionEvent) {
364
+ if (event.target !== node) return;
365
+ if (event.propertyName !== "width") return;
366
+ settle();
367
+ }
368
+
369
+ node?.addEventListener("transitionend", onTransitionEnd);
370
+ timer = window.setTimeout(settle, WIDTH_TRANSITION_FALLBACK_MS);
371
+
372
+ return () => {
373
+ settled = true;
374
+ if (timer !== undefined) window.clearTimeout(timer);
375
+ node?.removeEventListener("transitionend", onTransitionEnd);
376
+ };
377
+ }, [collapsed, chromeCollapsed]);
378
+
290
379
  /* ── Expanded subtree state (managed internally per the spec) ── */
291
380
  const [expandedIds, setExpandedIds] = React.useState<Set<string>>(
292
381
  () => new Set(defaultExpandedIds ?? []),
@@ -318,17 +407,23 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
318
407
  const hasEntries = entries && entries.length > 0;
319
408
 
320
409
  /* ── Footer visibility ── */
321
- const hasFooterPromoContent = showShareCard || showUpgradeCard;
410
+ const hasFooterPromoContent = !!onUpgradeClick;
322
411
  const hasFooterBottomContent = !!(userInitials || onInboxClick || onDarkModeToggle);
323
412
  const hasFooterContent = hasFooterPromoContent || hasFooterBottomContent;
413
+ const hasAccountMenu = !!(onLogout || onSettings);
414
+
415
+ /* ── Upgrade card title/subtitle defaults ── */
416
+ const finalUpgradeTitle = upgradeTitle ?? "Upgrade to Pro";
417
+ const finalUpgradeSubtitle = upgradeSubtitle ?? "Unlock more features";
324
418
 
325
419
  return (
326
420
  <nav
327
- ref={ref}
421
+ ref={assignRef}
328
422
  aria-label={brandName ?? "Application"}
329
423
  className={[
330
424
  "flex flex-col bg-canvas border-r border-hairline h-full overflow-hidden",
331
- "transition-all duration-300 ease-in-out",
425
+ // Collapse animates the width only — 150ms ease-out, no transition-all.
426
+ "transition-[width] duration-150 ease-out",
332
427
  collapsed ? "w-14" : "w-64",
333
428
  className,
334
429
  ]
@@ -339,27 +434,28 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
339
434
  {/* ── Header: logo / brand name + collapse toggle ── */}
340
435
  <div
341
436
  className={[
342
- "flex items-center px-md pt-md pb-sm flex-shrink-0 transition-all duration-300",
343
- collapsed ? "justify-center" : "justify-between",
437
+ "flex items-center px-md pt-md pb-sm flex-shrink-0",
438
+ chromeCollapsed ? "justify-center" : "justify-between",
344
439
  ].join(" ")}
345
440
  >
346
- {/* Brand area — fades out when collapsed */}
347
- <div
348
- className="transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0 flex items-center gap-sm min-w-0"
349
- style={{ maxWidth: collapsed ? "0px" : "180px", opacity: collapsed ? 0 : 1 }}
350
- >
351
- <span
352
- className="flex items-center justify-center rounded-md bg-primary text-on-primary flex-shrink-0"
353
- style={{ width: "32px", height: "32px" }}
354
- >
355
- <Icon name="sparkle" className="size-4" />
356
- </span>
357
- {brandName && (
358
- <span className="text-body-sm font-weight-heading-sm text-ink truncate">
359
- {brandName}
441
+ {/* Brand area — stays mounted while the width animates and is clipped
442
+ by the nav's overflow; swapped out once the width has settled.
443
+ It shrinks (min-w-0) so the toggle stays reachable mid-animation. */}
444
+ {!chromeCollapsed && (
445
+ <div className="overflow-hidden flex-1 min-w-0 flex items-center gap-sm">
446
+ <span
447
+ className="flex items-center justify-center rounded-md bg-primary text-on-primary flex-shrink-0"
448
+ style={{ width: "32px", height: "32px" }}
449
+ >
450
+ <Icon name="sparkle" className="size-4" />
360
451
  </span>
361
- )}
362
- </div>
452
+ {brandName && (
453
+ <span className="text-body-sm font-weight-heading-sm text-ink truncate">
454
+ {brandName}
455
+ </span>
456
+ )}
457
+ </div>
458
+ )}
363
459
 
364
460
  {/* Collapse toggle */}
365
461
  <Button
@@ -368,8 +464,8 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
368
464
  aria-label={collapsed ? "Expand sidebar" : "Collapse sidebar"}
369
465
  onClick={handleCollapse}
370
466
  className={[
371
- "!p-xs !rounded-md flex-shrink-0 transition-all duration-200",
372
- collapsed
467
+ "!p-xs !rounded-md flex-shrink-0 transition-[background-color,box-shadow,color] duration-200 ease-out",
468
+ chromeCollapsed
373
469
  ? "!text-primary ring-2 ring-primary !bg-transparent hover:!bg-surface-soft"
374
470
  : "",
375
471
  ]
@@ -382,22 +478,19 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
382
478
 
383
479
  {/* ── Scrollable nav area ── */}
384
480
  <div className="flex-1 overflow-y-auto overflow-x-hidden px-sm space-y-xxs pb-sm">
385
- {/* Workspace selector — only when workspaceName provided and not collapsed */}
386
- {workspaceName && (
387
- <div
388
- className="overflow-hidden transition-all duration-300 ease-in-out"
389
- style={{
390
- maxHeight: collapsed ? "0px" : "60px",
391
- opacity: collapsed ? 0 : 1,
392
- marginBottom: collapsed ? "0px" : "8px",
393
- }}
394
- >
395
- <WorkspaceMenu workspaceName={workspaceName} initials={workspaceName.charAt(0).toUpperCase()} />
396
- </div>
481
+ {/* ── Loading state: shimmer rows stand in for the nav entries,
482
+ sized to match a real NavItem row exactly ── */}
483
+ {loading && (
484
+ <SkeletonChip
485
+ shape="row"
486
+ count={loadingCount}
487
+ iconOnly={chromeCollapsed}
488
+ label="Loading navigation"
489
+ />
397
490
  )}
398
491
 
399
492
  {/* ── Generic entries (new API) ── */}
400
- {hasEntries && (
493
+ {!loading && hasEntries && (
401
494
  <ul className="space-y-xxs" role="list">
402
495
  {entries!.map((entry) => {
403
496
  const isActive = resolvedActiveId === entry.id;
@@ -409,6 +502,9 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
409
502
  // Only pass subItems when there are actual sub-items — this ensures
410
503
  // NavItem's isExpandable check (subItems && subItems.length > 0) is
411
504
  // false for leaf entries, preventing the chevron from appearing.
505
+ // Sub-items stay mounted while the width animates (chromeCollapsed
506
+ // still false), so React does not tear down long lists in the frame
507
+ // that starts the collapse.
412
508
  const mappedSubItems: NavItemSubItem[] | undefined = hasSubItems
413
509
  ? entry.subItems!.map((sub) => ({
414
510
  id: sub.id,
@@ -426,9 +522,9 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
426
522
  icon={entry.icon}
427
523
  label={entry.label}
428
524
  active={isActive}
429
- iconOnly={collapsed}
525
+ iconOnly={chromeCollapsed}
430
526
  alwaysExpanded={isAlwaysExpanded}
431
- subItems={!collapsed ? mappedSubItems : undefined}
527
+ subItems={!chromeCollapsed ? mappedSubItems : undefined}
432
528
  expanded={hasSubItems ? isExpanded : undefined}
433
529
  onExpandToggle={
434
530
  hasSubItems && !isAlwaysExpanded ? () => toggleExpanded(entry.id) : undefined
@@ -445,11 +541,16 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
445
541
  </ul>
446
542
  )}
447
543
 
448
- {/* ── Optional children rendered below nav (only when expanded) ── */}
544
+ {/* ── Optional children rendered below nav ──
545
+ Kept mounted (never unmounted) and clipped while collapsed, with no
546
+ max-height / opacity animation so the chrome swap stays instant. */}
449
547
  {children && (
450
548
  <div
451
- className="overflow-hidden transition-all duration-300 ease-in-out"
452
- style={{ maxHeight: collapsed ? "0px" : "600px", opacity: collapsed ? 0 : 1 }}
549
+ className="overflow-hidden"
550
+ style={{
551
+ maxHeight: chromeCollapsed ? "0px" : "600px",
552
+ opacity: chromeCollapsed ? 0 : 1,
553
+ }}
453
554
  >
454
555
  {children}
455
556
  </div>
@@ -459,49 +560,36 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
459
560
  {/* ── Footer (only renders when there is footer content) ── */}
460
561
  {hasFooterContent && (
461
562
  <div className="flex-shrink-0 px-sm pb-md space-y-sm">
462
- {/* Promo cards — hidden when collapsed */}
463
- {hasFooterPromoContent && (
464
- <div
465
- className="overflow-hidden transition-all duration-300 ease-in-out space-y-sm"
466
- style={{ maxHeight: collapsed ? "0px" : "300px", opacity: collapsed ? 0 : 1 }}
467
- >
468
- {/* Share card */}
469
- {showShareCard && (
470
- <div className="rounded-xl border border-hairline bg-surface px-md py-sm flex items-center justify-between gap-md">
471
- <div className="flex flex-col gap-xxs min-w-0">
472
- <span className="text-body-sm font-weight-heading-sm text-ink">Share Lovable</span>
473
- <span className="text-caption text-body">100 credits per paid referral</span>
474
- </div>
475
- <span
476
- className="flex-shrink-0 flex items-center justify-center rounded-full bg-surface-strong"
477
- style={{ width: "36px", height: "36px" }}
478
- >
479
- <Icon name="gift-present" className="size-5" />
480
- </span>
481
- </div>
482
- )}
483
-
484
- {/* Upgrade to Pro */}
485
- {showUpgradeCard && (
486
- <UpgradeCard eyebrow="" title="Upgrade to Pro" subtitle="Unlock more features" />
487
- )}
488
- </div>
563
+ {/* Upgrade card — stays mounted during the width transition (clipped by
564
+ the nav's overflow) and is removed only once the width has settled. */}
565
+ {hasFooterPromoContent && !chromeCollapsed && (
566
+ <UpgradeCard
567
+ title={finalUpgradeTitle}
568
+ subtitle={finalUpgradeSubtitle}
569
+ onClick={onUpgradeClick}
570
+ credits={upgradeCredits}
571
+ />
489
572
  )}
490
573
 
491
574
  {/* Bottom bar: user avatar (+ account menu) + inbox + dark mode toggle */}
492
575
  {hasFooterBottomContent && (
493
576
  <div
494
577
  className={[
495
- "flex items-center pt-xs transition-all duration-300",
496
- collapsed ? "justify-center flex-col gap-xs" : "justify-between",
578
+ "flex items-center pt-xs",
579
+ chromeCollapsed ? "justify-center flex-col gap-xs" : "justify-between",
497
580
  ].join(" ")}
498
581
  >
499
582
  {/* User avatar — only when userInitials provided. Becomes a menu
500
- trigger with an email header + Logout item (Logout always shown
501
- once onLogout is provided, even without userEmail). */}
583
+ trigger with an email header + User Settings / Logout items as
584
+ soon as either onLogout or onSettings is provided. */}
502
585
  {userInitials && (
503
- onLogout ? (
504
- <AccountMenu userInitials={userInitials} userEmail={userEmail} onLogout={onLogout} />
586
+ hasAccountMenu ? (
587
+ <AccountMenu
588
+ userInitials={userInitials}
589
+ userEmail={userEmail}
590
+ onLogout={onLogout}
591
+ onSettings={onSettings}
592
+ />
505
593
  ) : (
506
594
  <span
507
595
  className="flex items-center justify-center rounded-full bg-primary text-on-primary text-body-sm font-weight-heading-sm cursor-pointer hover:bg-primary-hover transition-colors duration-150 flex-shrink-0"
@@ -513,12 +601,9 @@ export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
513
601
  )
514
602
  )}
515
603
 
516
- {/* Inbox — only when onInboxClick provided, fades out when collapsed */}
604
+ {/* Inbox — only when onInboxClick provided, clipped while collapsed */}
517
605
  {onInboxClick && (
518
- <div
519
- className="overflow-hidden transition-all duration-300 ease-in-out"
520
- style={{ maxWidth: collapsed ? "0px" : "40px", opacity: collapsed ? 0 : 1 }}
521
- >
606
+ <div className="overflow-hidden">
522
607
  <Button
523
608
  variant="ghost"
524
609
  size="sm"