@designa8/vibedesign-perplexity-internal-v1-2-176b 0.1.0 → 0.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/index.cjs +132 -49
- package/dist/index.js +132 -49
- package/dist/styles.css +13 -0
- package/package.json +1 -1
- package/src/atoms/NavbarDesktop/NavbarDesktop.tsx +24 -17
- package/src/atoms/NavigationMenu/NavigationMenu.tsx +62 -28
- package/src/atoms/NavigationMenu/preview.tsx +41 -10
- package/src/atoms/NavigationMenuMobile/NavigationMenuMobile.tsx +4 -0
- package/src/atoms/NavigationMenuMobile/preview.tsx +11 -0
- package/src/atoms/Sidebar/Sidebar.tsx +12 -1
- package/src/atoms/SidebarDesktop/.keep-badge-snippet.txt +0 -0
- package/src/atoms/SidebarDesktop/SidebarDesktop.tsx +27 -1
- package/src/atoms/SidebarDesktop/preview.tsx +48 -8
- package/src/atoms/SidebarMobile/SidebarMobile.tsx +10 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-perplexity-internal-v1-2-176b
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.1.
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.1.2**.
|
|
4
4
|
Tokens, atoms, molecules, organisms, and templates — import from the package root;
|
|
5
5
|
never hardcode visual values in consumer code.
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -5389,6 +5389,7 @@ var NavbarDesktop = React55.forwardRef(
|
|
|
5389
5389
|
actions,
|
|
5390
5390
|
onSearch,
|
|
5391
5391
|
onPreferences,
|
|
5392
|
+
showAccount = true,
|
|
5392
5393
|
accountItems = DEFAULT_ACCOUNT,
|
|
5393
5394
|
onAccountSelect,
|
|
5394
5395
|
accountLabel = "Account menu",
|
|
@@ -5399,7 +5400,7 @@ var NavbarDesktop = React55.forwardRef(
|
|
|
5399
5400
|
}, ref) => {
|
|
5400
5401
|
const menuId = React55.useId();
|
|
5401
5402
|
const [innerOpen, setInnerOpen] = React55.useState(false);
|
|
5402
|
-
const open = menuOpen ?? innerOpen;
|
|
5403
|
+
const open = showAccount && (menuOpen ?? innerOpen);
|
|
5403
5404
|
const setOpen = React55.useCallback(
|
|
5404
5405
|
(v) => {
|
|
5405
5406
|
if (menuOpen === void 0) setInnerOpen(v);
|
|
@@ -5485,27 +5486,29 @@ var NavbarDesktop = React55.forwardRef(
|
|
|
5485
5486
|
}
|
|
5486
5487
|
)
|
|
5487
5488
|
] }),
|
|
5488
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5489
|
+
showAccount ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
5490
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { "aria-hidden": "true", className: "mx-xs h-6 w-px bg-hairline" }),
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5492
|
+
IconButton,
|
|
5493
|
+
{
|
|
5494
|
+
ref: triggerRef,
|
|
5495
|
+
icon: "user",
|
|
5496
|
+
label: accountLabel,
|
|
5497
|
+
variant: "soft",
|
|
5498
|
+
pill: true,
|
|
5499
|
+
"aria-haspopup": "menu",
|
|
5500
|
+
"aria-expanded": open,
|
|
5501
|
+
"aria-controls": menuId,
|
|
5502
|
+
onClick: () => {
|
|
5503
|
+
place();
|
|
5504
|
+
setOpen(!open);
|
|
5505
|
+
}
|
|
5503
5506
|
}
|
|
5504
|
-
|
|
5505
|
-
)
|
|
5507
|
+
)
|
|
5508
|
+
] }) : null
|
|
5506
5509
|
] })
|
|
5507
5510
|
] }),
|
|
5508
|
-
mounted ? (0, import_react_dom6.createPortal)(
|
|
5511
|
+
mounted && showAccount ? (0, import_react_dom6.createPortal)(
|
|
5509
5512
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5510
5513
|
"div",
|
|
5511
5514
|
{
|
|
@@ -5899,6 +5902,7 @@ var NavigationMenuMobile = React59.forwardRef(
|
|
|
5899
5902
|
onNavigate,
|
|
5900
5903
|
open: openProp,
|
|
5901
5904
|
onOpenChange,
|
|
5905
|
+
footer,
|
|
5902
5906
|
expandedId: expandedProp,
|
|
5903
5907
|
onExpandedIdChange,
|
|
5904
5908
|
side = "left",
|
|
@@ -5958,6 +5962,7 @@ var NavigationMenuMobile = React59.forwardRef(
|
|
|
5958
5962
|
onOpenChange: setOpen,
|
|
5959
5963
|
side,
|
|
5960
5964
|
headerStart: brand,
|
|
5965
|
+
footer,
|
|
5961
5966
|
"aria-label": "Main menu",
|
|
5962
5967
|
closeLabel: "Close menu",
|
|
5963
5968
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("nav", { "aria-label": "Main", className: "border-t border-hairline pt-sm", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { className: "flex flex-col gap-xxs", children: menu.map((m, i) => {
|
|
@@ -6046,39 +6051,73 @@ var NavigationMenu = React60.forwardRef(
|
|
|
6046
6051
|
onPreferences,
|
|
6047
6052
|
desktopActions,
|
|
6048
6053
|
mobileActions,
|
|
6054
|
+
showAccount = true,
|
|
6049
6055
|
accountItems,
|
|
6050
6056
|
onAccountSelect,
|
|
6057
|
+
mobileOpen,
|
|
6058
|
+
onMobileOpenChange,
|
|
6059
|
+
mobileMenuFooter,
|
|
6051
6060
|
className,
|
|
6061
|
+
onKeyDown,
|
|
6052
6062
|
...rest
|
|
6053
|
-
}, ref) =>
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
logo,
|
|
6059
|
-
brandName,
|
|
6060
|
-
brandHref,
|
|
6061
|
-
onNavigate,
|
|
6062
|
-
onSearch,
|
|
6063
|
-
onPreferences,
|
|
6064
|
-
actions: desktopActions,
|
|
6065
|
-
accountItems,
|
|
6066
|
-
onAccountSelect
|
|
6067
|
-
}
|
|
6068
|
-
) }),
|
|
6069
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6070
|
-
NavigationMenuMobile,
|
|
6063
|
+
}, ref) => {
|
|
6064
|
+
const mobilePanelId = React60.useId();
|
|
6065
|
+
const drawerOpen = mobileOpen ?? false;
|
|
6066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
6067
|
+
"div",
|
|
6071
6068
|
{
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6069
|
+
ref,
|
|
6070
|
+
className: ["w-full rounded-none", className].filter(Boolean).join(" "),
|
|
6071
|
+
onKeyDown: (e) => {
|
|
6072
|
+
onKeyDown?.(e);
|
|
6073
|
+
if (e.key === "Escape" && drawerOpen) onMobileOpenChange?.(false);
|
|
6074
|
+
},
|
|
6075
|
+
...rest,
|
|
6076
|
+
children: [
|
|
6077
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6078
|
+
NavigationMenuDesktop,
|
|
6079
|
+
{
|
|
6080
|
+
menu,
|
|
6081
|
+
logo,
|
|
6082
|
+
brandName,
|
|
6083
|
+
brandHref,
|
|
6084
|
+
onNavigate,
|
|
6085
|
+
onSearch,
|
|
6086
|
+
onPreferences,
|
|
6087
|
+
actions: desktopActions,
|
|
6088
|
+
showAccount,
|
|
6089
|
+
accountItems,
|
|
6090
|
+
onAccountSelect
|
|
6091
|
+
}
|
|
6092
|
+
) }),
|
|
6093
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6094
|
+
"div",
|
|
6095
|
+
{
|
|
6096
|
+
id: mobilePanelId,
|
|
6097
|
+
className: "md:hidden",
|
|
6098
|
+
"aria-expanded": drawerOpen,
|
|
6099
|
+
"aria-controls": mobilePanelId,
|
|
6100
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6101
|
+
NavigationMenuMobile,
|
|
6102
|
+
{
|
|
6103
|
+
menu,
|
|
6104
|
+
logo,
|
|
6105
|
+
brandName,
|
|
6106
|
+
brandHref,
|
|
6107
|
+
onNavigate,
|
|
6108
|
+
onSearch,
|
|
6109
|
+
actions: mobileActions,
|
|
6110
|
+
open: mobileOpen,
|
|
6111
|
+
onOpenChange: onMobileOpenChange,
|
|
6112
|
+
footer: mobileMenuFooter
|
|
6113
|
+
}
|
|
6114
|
+
)
|
|
6115
|
+
}
|
|
6116
|
+
)
|
|
6117
|
+
]
|
|
6079
6118
|
}
|
|
6080
|
-
)
|
|
6081
|
-
|
|
6119
|
+
);
|
|
6120
|
+
}
|
|
6082
6121
|
);
|
|
6083
6122
|
NavigationMenu.displayName = "NavigationMenu";
|
|
6084
6123
|
|
|
@@ -7036,6 +7075,8 @@ var SidebarDesktop = React70.forwardRef(
|
|
|
7036
7075
|
onUserClick,
|
|
7037
7076
|
onNotifications,
|
|
7038
7077
|
onSettings,
|
|
7078
|
+
notificationCount,
|
|
7079
|
+
footerActions,
|
|
7039
7080
|
folded: foldedProp,
|
|
7040
7081
|
defaultFolded = false,
|
|
7041
7082
|
onFoldedChange,
|
|
@@ -7055,6 +7096,9 @@ var SidebarDesktop = React70.forwardRef(
|
|
|
7055
7096
|
() => Object.fromEntries(items.filter((i) => i.children?.length).map((i) => [i.id, i.defaultOpen ?? true]))
|
|
7056
7097
|
);
|
|
7057
7098
|
const navId = React70.useId();
|
|
7099
|
+
const unread = typeof notificationCount === "number" && Number.isFinite(notificationCount) && notificationCount > 0 ? Math.floor(notificationCount) : 0;
|
|
7100
|
+
const unreadLabel = unread > 9 ? "9+" : String(unread);
|
|
7101
|
+
const notificationsLabel = unread > 0 ? `Notifications (${unread} unread)` : "Notifications";
|
|
7058
7102
|
const foldIcon = side === "left" ? folded ? "panel-right" : "panel-left" : folded ? "panel-left" : "panel-right";
|
|
7059
7103
|
const renderRow = (item, depth = 0) => {
|
|
7060
7104
|
const isGroup = Boolean(item.children?.length);
|
|
@@ -7250,7 +7294,19 @@ var SidebarDesktop = React70.forwardRef(
|
|
|
7250
7294
|
]
|
|
7251
7295
|
}
|
|
7252
7296
|
),
|
|
7253
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
7297
|
+
footerActions ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: cn60("flex shrink-0 items-center gap-xs", folded && "flex-col"), children: footerActions }) : null,
|
|
7298
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: cn60("relative inline-flex shrink-0", unread > 0 && "mr-xxs"), children: [
|
|
7299
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(IconButton, { icon: "bell", label: notificationsLabel, variant: "ghost", size: "sm", onClick: onNotifications }),
|
|
7300
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
7301
|
+
"span",
|
|
7302
|
+
{
|
|
7303
|
+
"aria-hidden": "true",
|
|
7304
|
+
"data-state": unread > 0 ? "open" : "closed",
|
|
7305
|
+
className: "pointer-events-none absolute -right-xxs -top-xxs inline-flex origin-top-right transition duration-150 ease-out data-[state=open]:scale-100 data-[state=open]:opacity-100 data-[state=closed]:scale-75 data-[state=closed]:opacity-0",
|
|
7306
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Badge, { variant: "accent", size: "sm", pill: true, className: "justify-center px-xs tabular-nums", children: unreadLabel })
|
|
7307
|
+
}
|
|
7308
|
+
)
|
|
7309
|
+
] }),
|
|
7254
7310
|
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(IconButton, { icon: "settings", label: "Settings", variant: "ghost", size: "sm", onClick: onSettings })
|
|
7255
7311
|
]
|
|
7256
7312
|
}
|
|
@@ -7289,6 +7345,8 @@ var SidebarMobile = React71.forwardRef(
|
|
|
7289
7345
|
brandHref = "#",
|
|
7290
7346
|
side = "left",
|
|
7291
7347
|
items,
|
|
7348
|
+
notificationCount,
|
|
7349
|
+
footerActions,
|
|
7292
7350
|
className,
|
|
7293
7351
|
children,
|
|
7294
7352
|
...sidebarProps
|
|
@@ -7353,7 +7411,17 @@ var SidebarMobile = React71.forwardRef(
|
|
|
7353
7411
|
closeLabel: "Close navigation",
|
|
7354
7412
|
bodyClassName: "flex flex-col pb-0",
|
|
7355
7413
|
className: "bg-surface-soft",
|
|
7356
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7415
|
+
SidebarDesktop,
|
|
7416
|
+
{
|
|
7417
|
+
...sidebarProps,
|
|
7418
|
+
items: wrapped,
|
|
7419
|
+
side,
|
|
7420
|
+
notificationCount,
|
|
7421
|
+
footerActions,
|
|
7422
|
+
embedded: true
|
|
7423
|
+
}
|
|
7424
|
+
)
|
|
7357
7425
|
}
|
|
7358
7426
|
)
|
|
7359
7427
|
]
|
|
@@ -7370,6 +7438,8 @@ var Sidebar = React72.forwardRef(
|
|
|
7370
7438
|
folded,
|
|
7371
7439
|
defaultFolded,
|
|
7372
7440
|
onFoldedChange,
|
|
7441
|
+
notificationCount,
|
|
7442
|
+
footerActions,
|
|
7373
7443
|
mobileOpen,
|
|
7374
7444
|
onMobileOpenChange,
|
|
7375
7445
|
mobileActions,
|
|
@@ -7378,11 +7448,24 @@ var Sidebar = React72.forwardRef(
|
|
|
7378
7448
|
children,
|
|
7379
7449
|
...shared
|
|
7380
7450
|
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { ref, className: ["h-full w-full", className].filter(Boolean).join(" "), children: [
|
|
7381
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "hidden h-full md:block", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7451
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "hidden h-full md:block", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7452
|
+
SidebarDesktop,
|
|
7453
|
+
{
|
|
7454
|
+
...shared,
|
|
7455
|
+
notificationCount,
|
|
7456
|
+
footerActions,
|
|
7457
|
+
folded,
|
|
7458
|
+
defaultFolded,
|
|
7459
|
+
onFoldedChange,
|
|
7460
|
+
children
|
|
7461
|
+
}
|
|
7462
|
+
) }),
|
|
7382
7463
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "h-full md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7383
7464
|
SidebarMobile,
|
|
7384
7465
|
{
|
|
7385
7466
|
...shared,
|
|
7467
|
+
notificationCount,
|
|
7468
|
+
footerActions,
|
|
7386
7469
|
open: mobileOpen,
|
|
7387
7470
|
onOpenChange: onMobileOpenChange,
|
|
7388
7471
|
actions: mobileActions,
|
package/dist/index.js
CHANGED
|
@@ -5267,6 +5267,7 @@ var NavbarDesktop = React55.forwardRef(
|
|
|
5267
5267
|
actions,
|
|
5268
5268
|
onSearch,
|
|
5269
5269
|
onPreferences,
|
|
5270
|
+
showAccount = true,
|
|
5270
5271
|
accountItems = DEFAULT_ACCOUNT,
|
|
5271
5272
|
onAccountSelect,
|
|
5272
5273
|
accountLabel = "Account menu",
|
|
@@ -5277,7 +5278,7 @@ var NavbarDesktop = React55.forwardRef(
|
|
|
5277
5278
|
}, ref) => {
|
|
5278
5279
|
const menuId = React55.useId();
|
|
5279
5280
|
const [innerOpen, setInnerOpen] = React55.useState(false);
|
|
5280
|
-
const open = menuOpen ?? innerOpen;
|
|
5281
|
+
const open = showAccount && (menuOpen ?? innerOpen);
|
|
5281
5282
|
const setOpen = React55.useCallback(
|
|
5282
5283
|
(v) => {
|
|
5283
5284
|
if (menuOpen === void 0) setInnerOpen(v);
|
|
@@ -5363,27 +5364,29 @@ var NavbarDesktop = React55.forwardRef(
|
|
|
5363
5364
|
}
|
|
5364
5365
|
)
|
|
5365
5366
|
] }),
|
|
5366
|
-
/* @__PURE__ */
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5367
|
+
showAccount ? /* @__PURE__ */ jsxs49(Fragment10, { children: [
|
|
5368
|
+
/* @__PURE__ */ jsx55("span", { "aria-hidden": "true", className: "mx-xs h-6 w-px bg-hairline" }),
|
|
5369
|
+
/* @__PURE__ */ jsx55(
|
|
5370
|
+
IconButton,
|
|
5371
|
+
{
|
|
5372
|
+
ref: triggerRef,
|
|
5373
|
+
icon: "user",
|
|
5374
|
+
label: accountLabel,
|
|
5375
|
+
variant: "soft",
|
|
5376
|
+
pill: true,
|
|
5377
|
+
"aria-haspopup": "menu",
|
|
5378
|
+
"aria-expanded": open,
|
|
5379
|
+
"aria-controls": menuId,
|
|
5380
|
+
onClick: () => {
|
|
5381
|
+
place();
|
|
5382
|
+
setOpen(!open);
|
|
5383
|
+
}
|
|
5381
5384
|
}
|
|
5382
|
-
|
|
5383
|
-
)
|
|
5385
|
+
)
|
|
5386
|
+
] }) : null
|
|
5384
5387
|
] })
|
|
5385
5388
|
] }),
|
|
5386
|
-
mounted ? createPortal6(
|
|
5389
|
+
mounted && showAccount ? createPortal6(
|
|
5387
5390
|
/* @__PURE__ */ jsx55(
|
|
5388
5391
|
"div",
|
|
5389
5392
|
{
|
|
@@ -5777,6 +5780,7 @@ var NavigationMenuMobile = React59.forwardRef(
|
|
|
5777
5780
|
onNavigate,
|
|
5778
5781
|
open: openProp,
|
|
5779
5782
|
onOpenChange,
|
|
5783
|
+
footer,
|
|
5780
5784
|
expandedId: expandedProp,
|
|
5781
5785
|
onExpandedIdChange,
|
|
5782
5786
|
side = "left",
|
|
@@ -5836,6 +5840,7 @@ var NavigationMenuMobile = React59.forwardRef(
|
|
|
5836
5840
|
onOpenChange: setOpen,
|
|
5837
5841
|
side,
|
|
5838
5842
|
headerStart: brand,
|
|
5843
|
+
footer,
|
|
5839
5844
|
"aria-label": "Main menu",
|
|
5840
5845
|
closeLabel: "Close menu",
|
|
5841
5846
|
children: /* @__PURE__ */ jsx59("nav", { "aria-label": "Main", className: "border-t border-hairline pt-sm", children: /* @__PURE__ */ jsx59("ul", { className: "flex flex-col gap-xxs", children: menu.map((m, i) => {
|
|
@@ -5924,39 +5929,73 @@ var NavigationMenu = React60.forwardRef(
|
|
|
5924
5929
|
onPreferences,
|
|
5925
5930
|
desktopActions,
|
|
5926
5931
|
mobileActions,
|
|
5932
|
+
showAccount = true,
|
|
5927
5933
|
accountItems,
|
|
5928
5934
|
onAccountSelect,
|
|
5935
|
+
mobileOpen,
|
|
5936
|
+
onMobileOpenChange,
|
|
5937
|
+
mobileMenuFooter,
|
|
5929
5938
|
className,
|
|
5939
|
+
onKeyDown,
|
|
5930
5940
|
...rest
|
|
5931
|
-
}, ref) =>
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
logo,
|
|
5937
|
-
brandName,
|
|
5938
|
-
brandHref,
|
|
5939
|
-
onNavigate,
|
|
5940
|
-
onSearch,
|
|
5941
|
-
onPreferences,
|
|
5942
|
-
actions: desktopActions,
|
|
5943
|
-
accountItems,
|
|
5944
|
-
onAccountSelect
|
|
5945
|
-
}
|
|
5946
|
-
) }),
|
|
5947
|
-
/* @__PURE__ */ jsx60("div", { className: "md:hidden", children: /* @__PURE__ */ jsx60(
|
|
5948
|
-
NavigationMenuMobile,
|
|
5941
|
+
}, ref) => {
|
|
5942
|
+
const mobilePanelId = React60.useId();
|
|
5943
|
+
const drawerOpen = mobileOpen ?? false;
|
|
5944
|
+
return /* @__PURE__ */ jsxs54(
|
|
5945
|
+
"div",
|
|
5949
5946
|
{
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5947
|
+
ref,
|
|
5948
|
+
className: ["w-full rounded-none", className].filter(Boolean).join(" "),
|
|
5949
|
+
onKeyDown: (e) => {
|
|
5950
|
+
onKeyDown?.(e);
|
|
5951
|
+
if (e.key === "Escape" && drawerOpen) onMobileOpenChange?.(false);
|
|
5952
|
+
},
|
|
5953
|
+
...rest,
|
|
5954
|
+
children: [
|
|
5955
|
+
/* @__PURE__ */ jsx60("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx60(
|
|
5956
|
+
NavigationMenuDesktop,
|
|
5957
|
+
{
|
|
5958
|
+
menu,
|
|
5959
|
+
logo,
|
|
5960
|
+
brandName,
|
|
5961
|
+
brandHref,
|
|
5962
|
+
onNavigate,
|
|
5963
|
+
onSearch,
|
|
5964
|
+
onPreferences,
|
|
5965
|
+
actions: desktopActions,
|
|
5966
|
+
showAccount,
|
|
5967
|
+
accountItems,
|
|
5968
|
+
onAccountSelect
|
|
5969
|
+
}
|
|
5970
|
+
) }),
|
|
5971
|
+
/* @__PURE__ */ jsx60(
|
|
5972
|
+
"div",
|
|
5973
|
+
{
|
|
5974
|
+
id: mobilePanelId,
|
|
5975
|
+
className: "md:hidden",
|
|
5976
|
+
"aria-expanded": drawerOpen,
|
|
5977
|
+
"aria-controls": mobilePanelId,
|
|
5978
|
+
children: /* @__PURE__ */ jsx60(
|
|
5979
|
+
NavigationMenuMobile,
|
|
5980
|
+
{
|
|
5981
|
+
menu,
|
|
5982
|
+
logo,
|
|
5983
|
+
brandName,
|
|
5984
|
+
brandHref,
|
|
5985
|
+
onNavigate,
|
|
5986
|
+
onSearch,
|
|
5987
|
+
actions: mobileActions,
|
|
5988
|
+
open: mobileOpen,
|
|
5989
|
+
onOpenChange: onMobileOpenChange,
|
|
5990
|
+
footer: mobileMenuFooter
|
|
5991
|
+
}
|
|
5992
|
+
)
|
|
5993
|
+
}
|
|
5994
|
+
)
|
|
5995
|
+
]
|
|
5957
5996
|
}
|
|
5958
|
-
)
|
|
5959
|
-
|
|
5997
|
+
);
|
|
5998
|
+
}
|
|
5960
5999
|
);
|
|
5961
6000
|
NavigationMenu.displayName = "NavigationMenu";
|
|
5962
6001
|
|
|
@@ -6914,6 +6953,8 @@ var SidebarDesktop = React70.forwardRef(
|
|
|
6914
6953
|
onUserClick,
|
|
6915
6954
|
onNotifications,
|
|
6916
6955
|
onSettings,
|
|
6956
|
+
notificationCount,
|
|
6957
|
+
footerActions,
|
|
6917
6958
|
folded: foldedProp,
|
|
6918
6959
|
defaultFolded = false,
|
|
6919
6960
|
onFoldedChange,
|
|
@@ -6933,6 +6974,9 @@ var SidebarDesktop = React70.forwardRef(
|
|
|
6933
6974
|
() => Object.fromEntries(items.filter((i) => i.children?.length).map((i) => [i.id, i.defaultOpen ?? true]))
|
|
6934
6975
|
);
|
|
6935
6976
|
const navId = React70.useId();
|
|
6977
|
+
const unread = typeof notificationCount === "number" && Number.isFinite(notificationCount) && notificationCount > 0 ? Math.floor(notificationCount) : 0;
|
|
6978
|
+
const unreadLabel = unread > 9 ? "9+" : String(unread);
|
|
6979
|
+
const notificationsLabel = unread > 0 ? `Notifications (${unread} unread)` : "Notifications";
|
|
6936
6980
|
const foldIcon = side === "left" ? folded ? "panel-right" : "panel-left" : folded ? "panel-left" : "panel-right";
|
|
6937
6981
|
const renderRow = (item, depth = 0) => {
|
|
6938
6982
|
const isGroup = Boolean(item.children?.length);
|
|
@@ -7128,7 +7172,19 @@ var SidebarDesktop = React70.forwardRef(
|
|
|
7128
7172
|
]
|
|
7129
7173
|
}
|
|
7130
7174
|
),
|
|
7131
|
-
/* @__PURE__ */ jsx70(
|
|
7175
|
+
footerActions ? /* @__PURE__ */ jsx70("div", { className: cn60("flex shrink-0 items-center gap-xs", folded && "flex-col"), children: footerActions }) : null,
|
|
7176
|
+
/* @__PURE__ */ jsxs64("span", { className: cn60("relative inline-flex shrink-0", unread > 0 && "mr-xxs"), children: [
|
|
7177
|
+
/* @__PURE__ */ jsx70(IconButton, { icon: "bell", label: notificationsLabel, variant: "ghost", size: "sm", onClick: onNotifications }),
|
|
7178
|
+
/* @__PURE__ */ jsx70(
|
|
7179
|
+
"span",
|
|
7180
|
+
{
|
|
7181
|
+
"aria-hidden": "true",
|
|
7182
|
+
"data-state": unread > 0 ? "open" : "closed",
|
|
7183
|
+
className: "pointer-events-none absolute -right-xxs -top-xxs inline-flex origin-top-right transition duration-150 ease-out data-[state=open]:scale-100 data-[state=open]:opacity-100 data-[state=closed]:scale-75 data-[state=closed]:opacity-0",
|
|
7184
|
+
children: /* @__PURE__ */ jsx70(Badge, { variant: "accent", size: "sm", pill: true, className: "justify-center px-xs tabular-nums", children: unreadLabel })
|
|
7185
|
+
}
|
|
7186
|
+
)
|
|
7187
|
+
] }),
|
|
7132
7188
|
/* @__PURE__ */ jsx70(IconButton, { icon: "settings", label: "Settings", variant: "ghost", size: "sm", onClick: onSettings })
|
|
7133
7189
|
]
|
|
7134
7190
|
}
|
|
@@ -7167,6 +7223,8 @@ var SidebarMobile = React71.forwardRef(
|
|
|
7167
7223
|
brandHref = "#",
|
|
7168
7224
|
side = "left",
|
|
7169
7225
|
items,
|
|
7226
|
+
notificationCount,
|
|
7227
|
+
footerActions,
|
|
7170
7228
|
className,
|
|
7171
7229
|
children,
|
|
7172
7230
|
...sidebarProps
|
|
@@ -7231,7 +7289,17 @@ var SidebarMobile = React71.forwardRef(
|
|
|
7231
7289
|
closeLabel: "Close navigation",
|
|
7232
7290
|
bodyClassName: "flex flex-col pb-0",
|
|
7233
7291
|
className: "bg-surface-soft",
|
|
7234
|
-
children: /* @__PURE__ */ jsx71(
|
|
7292
|
+
children: /* @__PURE__ */ jsx71(
|
|
7293
|
+
SidebarDesktop,
|
|
7294
|
+
{
|
|
7295
|
+
...sidebarProps,
|
|
7296
|
+
items: wrapped,
|
|
7297
|
+
side,
|
|
7298
|
+
notificationCount,
|
|
7299
|
+
footerActions,
|
|
7300
|
+
embedded: true
|
|
7301
|
+
}
|
|
7302
|
+
)
|
|
7235
7303
|
}
|
|
7236
7304
|
)
|
|
7237
7305
|
]
|
|
@@ -7248,6 +7316,8 @@ var Sidebar = React72.forwardRef(
|
|
|
7248
7316
|
folded,
|
|
7249
7317
|
defaultFolded,
|
|
7250
7318
|
onFoldedChange,
|
|
7319
|
+
notificationCount,
|
|
7320
|
+
footerActions,
|
|
7251
7321
|
mobileOpen,
|
|
7252
7322
|
onMobileOpenChange,
|
|
7253
7323
|
mobileActions,
|
|
@@ -7256,11 +7326,24 @@ var Sidebar = React72.forwardRef(
|
|
|
7256
7326
|
children,
|
|
7257
7327
|
...shared
|
|
7258
7328
|
}, ref) => /* @__PURE__ */ jsxs66("div", { ref, className: ["h-full w-full", className].filter(Boolean).join(" "), children: [
|
|
7259
|
-
/* @__PURE__ */ jsx72("div", { className: "hidden h-full md:block", children: /* @__PURE__ */ jsx72(
|
|
7329
|
+
/* @__PURE__ */ jsx72("div", { className: "hidden h-full md:block", children: /* @__PURE__ */ jsx72(
|
|
7330
|
+
SidebarDesktop,
|
|
7331
|
+
{
|
|
7332
|
+
...shared,
|
|
7333
|
+
notificationCount,
|
|
7334
|
+
footerActions,
|
|
7335
|
+
folded,
|
|
7336
|
+
defaultFolded,
|
|
7337
|
+
onFoldedChange,
|
|
7338
|
+
children
|
|
7339
|
+
}
|
|
7340
|
+
) }),
|
|
7260
7341
|
/* @__PURE__ */ jsx72("div", { className: "h-full md:hidden", children: /* @__PURE__ */ jsx72(
|
|
7261
7342
|
SidebarMobile,
|
|
7262
7343
|
{
|
|
7263
7344
|
...shared,
|
|
7345
|
+
notificationCount,
|
|
7346
|
+
footerActions,
|
|
7264
7347
|
open: mobileOpen,
|
|
7265
7348
|
onOpenChange: onMobileOpenChange,
|
|
7266
7349
|
actions: mobileActions,
|
package/dist/styles.css
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
--container-lg: 32rem;
|
|
17
17
|
--container-xl: 36rem;
|
|
18
18
|
--container-3xl: 48rem;
|
|
19
|
+
--container-4xl: 56rem;
|
|
19
20
|
--radius-xs: 4px;
|
|
20
21
|
--radius-sm: 6px;
|
|
21
22
|
--radius-md: 8px;
|
|
@@ -335,6 +336,9 @@
|
|
|
335
336
|
.-top-xs {
|
|
336
337
|
top: calc(var(--spacing-xs) * -1);
|
|
337
338
|
}
|
|
339
|
+
.-top-xxs {
|
|
340
|
+
top: calc(var(--spacing-xxs) * -1);
|
|
341
|
+
}
|
|
338
342
|
.top-0 {
|
|
339
343
|
top: 0;
|
|
340
344
|
}
|
|
@@ -347,6 +351,9 @@
|
|
|
347
351
|
.-right-xs {
|
|
348
352
|
right: calc(var(--spacing-xs) * -1);
|
|
349
353
|
}
|
|
354
|
+
.-right-xxs {
|
|
355
|
+
right: calc(var(--spacing-xxs) * -1);
|
|
356
|
+
}
|
|
350
357
|
.right-0 {
|
|
351
358
|
right: 0;
|
|
352
359
|
}
|
|
@@ -446,6 +453,9 @@
|
|
|
446
453
|
.-mr-xs {
|
|
447
454
|
margin-right: calc(var(--spacing-xs) * -1);
|
|
448
455
|
}
|
|
456
|
+
.mr-xxs {
|
|
457
|
+
margin-right: var(--spacing-xxs);
|
|
458
|
+
}
|
|
449
459
|
.mb-xs {
|
|
450
460
|
margin-bottom: var(--spacing-xs);
|
|
451
461
|
}
|
|
@@ -741,6 +751,9 @@
|
|
|
741
751
|
.max-w-3xl {
|
|
742
752
|
max-width: var(--container-3xl);
|
|
743
753
|
}
|
|
754
|
+
.max-w-4xl {
|
|
755
|
+
max-width: var(--container-4xl);
|
|
756
|
+
}
|
|
744
757
|
.max-w-full {
|
|
745
758
|
max-width: 100%;
|
|
746
759
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designa8/vibedesign-perplexity-internal-v1-2-176b",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Complete design system \"My Project perplexity-internal-v1\" generated by Atoms Design.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -34,6 +34,8 @@ export interface NavbarDesktopProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
34
34
|
actions?: React.ReactNode;
|
|
35
35
|
onSearch?: () => void;
|
|
36
36
|
onPreferences?: () => void;
|
|
37
|
+
/** Render the account button, its divider and its menu. Set false for public / marketing headers. */
|
|
38
|
+
showAccount?: boolean;
|
|
37
39
|
/** Items in the account menu. */
|
|
38
40
|
accountItems?: NavbarMenuItem[];
|
|
39
41
|
onAccountSelect?: (value: string) => void;
|
|
@@ -64,6 +66,7 @@ export const NavbarDesktop = React.forwardRef<HTMLElement, NavbarDesktopProps>(
|
|
|
64
66
|
actions,
|
|
65
67
|
onSearch,
|
|
66
68
|
onPreferences,
|
|
69
|
+
showAccount = true,
|
|
67
70
|
accountItems = DEFAULT_ACCOUNT,
|
|
68
71
|
onAccountSelect,
|
|
69
72
|
accountLabel = "Account menu",
|
|
@@ -76,7 +79,7 @@ export const NavbarDesktop = React.forwardRef<HTMLElement, NavbarDesktopProps>(
|
|
|
76
79
|
) => {
|
|
77
80
|
const menuId = React.useId();
|
|
78
81
|
const [innerOpen, setInnerOpen] = React.useState(false);
|
|
79
|
-
const open = menuOpen ?? innerOpen;
|
|
82
|
+
const open = showAccount && (menuOpen ?? innerOpen);
|
|
80
83
|
const setOpen = React.useCallback(
|
|
81
84
|
(v: boolean) => {
|
|
82
85
|
if (menuOpen === undefined) setInnerOpen(v);
|
|
@@ -178,25 +181,29 @@ export const NavbarDesktop = React.forwardRef<HTMLElement, NavbarDesktopProps>(
|
|
|
178
181
|
/>
|
|
179
182
|
</>
|
|
180
183
|
)}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
184
|
+
{showAccount ? (
|
|
185
|
+
<>
|
|
186
|
+
<span aria-hidden="true" className="mx-xs h-6 w-px bg-hairline" />
|
|
187
|
+
<IconButton
|
|
188
|
+
ref={triggerRef}
|
|
189
|
+
icon="user"
|
|
190
|
+
label={accountLabel}
|
|
191
|
+
variant="soft"
|
|
192
|
+
pill
|
|
193
|
+
aria-haspopup="menu"
|
|
194
|
+
aria-expanded={open}
|
|
195
|
+
aria-controls={menuId}
|
|
196
|
+
onClick={() => {
|
|
197
|
+
place();
|
|
198
|
+
setOpen(!open);
|
|
199
|
+
}}
|
|
200
|
+
/>
|
|
201
|
+
</>
|
|
202
|
+
) : null}
|
|
196
203
|
</div>
|
|
197
204
|
</div>
|
|
198
205
|
|
|
199
|
-
{mounted
|
|
206
|
+
{mounted && showAccount
|
|
200
207
|
? createPortal(
|
|
201
208
|
<div
|
|
202
209
|
ref={panelRef}
|
|
@@ -16,8 +16,15 @@ export interface NavigationMenuProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
16
16
|
desktopActions?: React.ReactNode;
|
|
17
17
|
/** Mobile bar right-side actions (defaults to Search). */
|
|
18
18
|
mobileActions?: React.ReactNode;
|
|
19
|
+
/** Render the desktop account button and its menu. Set false for public / marketing headers. */
|
|
20
|
+
showAccount?: boolean;
|
|
19
21
|
accountItems?: NavbarMenuItem[];
|
|
20
22
|
onAccountSelect?: (value: string) => void;
|
|
23
|
+
/** Controlled mobile drawer state. */
|
|
24
|
+
mobileOpen?: boolean;
|
|
25
|
+
onMobileOpenChange?: (open: boolean) => void;
|
|
26
|
+
/** Pinned footer inside the mobile drawer, e.g. Sign in / Get started actions. */
|
|
27
|
+
mobileMenuFooter?: React.ReactNode;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
export const NavigationMenu = React.forwardRef<HTMLDivElement, NavigationMenuProps>(
|
|
@@ -32,40 +39,67 @@ export const NavigationMenu = React.forwardRef<HTMLDivElement, NavigationMenuPro
|
|
|
32
39
|
onPreferences,
|
|
33
40
|
desktopActions,
|
|
34
41
|
mobileActions,
|
|
42
|
+
showAccount = true,
|
|
35
43
|
accountItems,
|
|
36
44
|
onAccountSelect,
|
|
45
|
+
mobileOpen,
|
|
46
|
+
onMobileOpenChange,
|
|
47
|
+
mobileMenuFooter,
|
|
37
48
|
className,
|
|
49
|
+
onKeyDown,
|
|
38
50
|
...rest
|
|
39
51
|
},
|
|
40
52
|
ref,
|
|
41
|
-
) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
) => {
|
|
54
|
+
const mobilePanelId = React.useId();
|
|
55
|
+
const drawerOpen = mobileOpen ?? false;
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
ref={ref}
|
|
60
|
+
className={["w-full rounded-none", className].filter(Boolean).join(" ")}
|
|
61
|
+
onKeyDown={(e) => {
|
|
62
|
+
onKeyDown?.(e);
|
|
63
|
+
if (e.key === "Escape" && drawerOpen) onMobileOpenChange?.(false);
|
|
64
|
+
}}
|
|
65
|
+
{...rest}
|
|
66
|
+
>
|
|
67
|
+
<div className="hidden md:block">
|
|
68
|
+
<NavigationMenuDesktop
|
|
69
|
+
menu={menu}
|
|
70
|
+
logo={logo}
|
|
71
|
+
brandName={brandName}
|
|
72
|
+
brandHref={brandHref}
|
|
73
|
+
onNavigate={onNavigate}
|
|
74
|
+
onSearch={onSearch}
|
|
75
|
+
onPreferences={onPreferences}
|
|
76
|
+
actions={desktopActions}
|
|
77
|
+
showAccount={showAccount}
|
|
78
|
+
accountItems={accountItems}
|
|
79
|
+
onAccountSelect={onAccountSelect}
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
<div
|
|
83
|
+
id={mobilePanelId}
|
|
84
|
+
className="md:hidden"
|
|
85
|
+
aria-expanded={drawerOpen}
|
|
86
|
+
aria-controls={mobilePanelId}
|
|
87
|
+
>
|
|
88
|
+
<NavigationMenuMobile
|
|
89
|
+
menu={menu}
|
|
90
|
+
logo={logo}
|
|
91
|
+
brandName={brandName}
|
|
92
|
+
brandHref={brandHref}
|
|
93
|
+
onNavigate={onNavigate}
|
|
94
|
+
onSearch={onSearch}
|
|
95
|
+
actions={mobileActions}
|
|
96
|
+
open={mobileOpen}
|
|
97
|
+
onOpenChange={onMobileOpenChange}
|
|
98
|
+
footer={mobileMenuFooter}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
67
101
|
</div>
|
|
68
|
-
|
|
69
|
-
|
|
102
|
+
);
|
|
103
|
+
},
|
|
70
104
|
);
|
|
71
105
|
NavigationMenu.displayName = "NavigationMenu";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { NavigationMenu } from "./NavigationMenu";
|
|
3
|
+
import { Button } from "../Button";
|
|
3
4
|
import type { NavigationMenuMobileEntry } from "../NavigationMenuMobile";
|
|
4
5
|
import type { NavMenuColumn } from "../NavigationMenuDesktop";
|
|
5
6
|
|
|
@@ -31,21 +32,51 @@ const MENU: NavigationMenuMobileEntry[] = [
|
|
|
31
32
|
col("Fields", "flask-conical", ["Science", "Technology", "Engineering", "Mathematics"]),
|
|
32
33
|
],
|
|
33
34
|
},
|
|
34
|
-
{ id: "patents", label: "Patents", href: "#patents", icon: "layers" },
|
|
35
35
|
];
|
|
36
36
|
|
|
37
37
|
export default function NavigationMenuPreview() {
|
|
38
38
|
const [page, setPage] = React.useState("#discover");
|
|
39
|
+
const [mobileOpen, setMobileOpen] = React.useState(false);
|
|
40
|
+
|
|
41
|
+
const items = MENU.map((m) => ({ ...m, active: m.href === page }));
|
|
42
|
+
const navigate = (href: string, e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
setPage(href);
|
|
45
|
+
};
|
|
46
|
+
|
|
39
47
|
return (
|
|
40
|
-
<div className="w-full">
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
<div className="w-full max-w-4xl mx-auto flex flex-col gap-lg p-lg">
|
|
49
|
+
<section className="flex flex-col gap-sm">
|
|
50
|
+
<p className="text-caption uppercase text-muted">Marketing header — no account control</p>
|
|
51
|
+
<div className="w-full overflow-hidden rounded-xl border border-hairline">
|
|
52
|
+
<NavigationMenu
|
|
53
|
+
menu={items.slice(0, 3)}
|
|
54
|
+
onNavigate={navigate}
|
|
55
|
+
showAccount={false}
|
|
56
|
+
desktopActions={<Button variant="primary" pill>Get started</Button>}
|
|
57
|
+
mobileActions={<Button variant="ghost" size="sm">Sign in</Button>}
|
|
58
|
+
mobileOpen={mobileOpen}
|
|
59
|
+
onMobileOpenChange={setMobileOpen}
|
|
60
|
+
mobileMenuFooter={
|
|
61
|
+
<div className="flex w-full flex-col gap-sm">
|
|
62
|
+
<Button variant="outline" fullWidth>Sign in</Button>
|
|
63
|
+
<Button variant="primary" fullWidth>Get started</Button>
|
|
64
|
+
</div>
|
|
65
|
+
}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</section>
|
|
69
|
+
|
|
70
|
+
<section className="flex flex-col gap-sm">
|
|
71
|
+
<p className="text-caption uppercase text-muted">Product header — account menu shown</p>
|
|
72
|
+
<div className="w-full overflow-hidden rounded-xl border border-hairline">
|
|
73
|
+
<NavigationMenu menu={items} onNavigate={navigate} />
|
|
74
|
+
</div>
|
|
75
|
+
</section>
|
|
76
|
+
|
|
77
|
+
<p className="text-body-sm text-muted">
|
|
78
|
+
Viewing {page.slice(1)}. Mobile drawer is {mobileOpen ? "open" : "closed"} — resize the pane to try it.
|
|
79
|
+
</p>
|
|
49
80
|
</div>
|
|
50
81
|
);
|
|
51
82
|
}
|
|
@@ -22,6 +22,8 @@ export interface NavigationMenuMobileProps extends React.HTMLAttributes<HTMLElem
|
|
|
22
22
|
/** Controlled drawer state. */
|
|
23
23
|
open?: boolean;
|
|
24
24
|
onOpenChange?: (open: boolean) => void;
|
|
25
|
+
/** Pinned footer inside the drawer (e.g. Sign in / Get started actions). */
|
|
26
|
+
footer?: React.ReactNode;
|
|
25
27
|
/** Controlled expanded section (one at a time). */
|
|
26
28
|
expandedId?: string | null;
|
|
27
29
|
onExpandedIdChange?: (id: string | null) => void;
|
|
@@ -45,6 +47,7 @@ export const NavigationMenuMobile = React.forwardRef<HTMLElement, NavigationMenu
|
|
|
45
47
|
onNavigate,
|
|
46
48
|
open: openProp,
|
|
47
49
|
onOpenChange,
|
|
50
|
+
footer,
|
|
48
51
|
expandedId: expandedProp,
|
|
49
52
|
onExpandedIdChange,
|
|
50
53
|
side = "left",
|
|
@@ -107,6 +110,7 @@ export const NavigationMenuMobile = React.forwardRef<HTMLElement, NavigationMenu
|
|
|
107
110
|
onOpenChange={setOpen}
|
|
108
111
|
side={side}
|
|
109
112
|
headerStart={brand}
|
|
113
|
+
footer={footer}
|
|
110
114
|
aria-label="Main menu"
|
|
111
115
|
closeLabel="Close menu"
|
|
112
116
|
>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { NavigationMenuMobile, type NavigationMenuMobileEntry } from "./NavigationMenuMobile";
|
|
3
|
+
import { Button } from "../Button";
|
|
3
4
|
|
|
4
5
|
const links = (labels: string[]) => labels.map((l) => ({ label: l, href: `#${l.toLowerCase().replace(/\s+/g, "-")}` }));
|
|
5
6
|
|
|
@@ -35,6 +36,16 @@ export default function NavigationMenuMobilePreview() {
|
|
|
35
36
|
onOpenChange={setOpen}
|
|
36
37
|
expandedId={expanded}
|
|
37
38
|
onExpandedIdChange={setExpanded}
|
|
39
|
+
footer={
|
|
40
|
+
<div className="flex w-full flex-col gap-sm">
|
|
41
|
+
<Button variant="outline" fullWidth>
|
|
42
|
+
Sign in
|
|
43
|
+
</Button>
|
|
44
|
+
<Button variant="primary" fullWidth>
|
|
45
|
+
Get started
|
|
46
|
+
</Button>
|
|
47
|
+
</div>
|
|
48
|
+
}
|
|
38
49
|
onNavigate={(href, e) => {
|
|
39
50
|
e.preventDefault();
|
|
40
51
|
setPage(href);
|
|
@@ -17,6 +17,8 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
17
17
|
folded,
|
|
18
18
|
defaultFolded,
|
|
19
19
|
onFoldedChange,
|
|
20
|
+
notificationCount,
|
|
21
|
+
footerActions,
|
|
20
22
|
mobileOpen,
|
|
21
23
|
onMobileOpenChange,
|
|
22
24
|
mobileActions,
|
|
@@ -29,13 +31,22 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
29
31
|
) => (
|
|
30
32
|
<div ref={ref} className={["h-full w-full", className].filter(Boolean).join(" ")}>
|
|
31
33
|
<div className="hidden h-full md:block">
|
|
32
|
-
<SidebarDesktop
|
|
34
|
+
<SidebarDesktop
|
|
35
|
+
{...shared}
|
|
36
|
+
notificationCount={notificationCount}
|
|
37
|
+
footerActions={footerActions}
|
|
38
|
+
folded={folded}
|
|
39
|
+
defaultFolded={defaultFolded}
|
|
40
|
+
onFoldedChange={onFoldedChange}
|
|
41
|
+
>
|
|
33
42
|
{children}
|
|
34
43
|
</SidebarDesktop>
|
|
35
44
|
</div>
|
|
36
45
|
<div className="h-full md:hidden">
|
|
37
46
|
<SidebarMobile
|
|
38
47
|
{...shared}
|
|
48
|
+
notificationCount={notificationCount}
|
|
49
|
+
footerActions={footerActions}
|
|
39
50
|
open={mobileOpen}
|
|
40
51
|
onOpenChange={onMobileOpenChange}
|
|
41
52
|
actions={mobileActions}
|
|
File without changes
|
|
@@ -50,6 +50,10 @@ export interface SidebarDesktopProps extends Omit<React.HTMLAttributes<HTMLDivEl
|
|
|
50
50
|
onUserClick?: () => void;
|
|
51
51
|
onNotifications?: () => void;
|
|
52
52
|
onSettings?: () => void;
|
|
53
|
+
/** Unread count on the bell; hidden when 0 or undefined, capped at 9+. */
|
|
54
|
+
notificationCount?: number;
|
|
55
|
+
/** Extra icon-sized controls in the user row, between the account link and the bell. */
|
|
56
|
+
footerActions?: React.ReactNode;
|
|
53
57
|
/** Controlled fold state. */
|
|
54
58
|
folded?: boolean;
|
|
55
59
|
defaultFolded?: boolean;
|
|
@@ -85,6 +89,8 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
85
89
|
onUserClick,
|
|
86
90
|
onNotifications,
|
|
87
91
|
onSettings,
|
|
92
|
+
notificationCount,
|
|
93
|
+
footerActions,
|
|
88
94
|
folded: foldedProp,
|
|
89
95
|
defaultFolded = false,
|
|
90
96
|
onFoldedChange,
|
|
@@ -107,6 +113,12 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
107
113
|
);
|
|
108
114
|
const navId = React.useId();
|
|
109
115
|
|
|
116
|
+
const unread = typeof notificationCount === "number" && Number.isFinite(notificationCount) && notificationCount > 0
|
|
117
|
+
? Math.floor(notificationCount)
|
|
118
|
+
: 0;
|
|
119
|
+
const unreadLabel = unread > 9 ? "9+" : String(unread);
|
|
120
|
+
const notificationsLabel = unread > 0 ? `Notifications (${unread} unread)` : "Notifications";
|
|
121
|
+
|
|
110
122
|
const foldIcon: IconName =
|
|
111
123
|
side === "left" ? (folded ? "panel-right" : "panel-left") : folded ? "panel-left" : "panel-right";
|
|
112
124
|
|
|
@@ -337,7 +349,21 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
337
349
|
</>
|
|
338
350
|
) : null}
|
|
339
351
|
</a>
|
|
340
|
-
|
|
352
|
+
{footerActions ? (
|
|
353
|
+
<div className={cn("flex shrink-0 items-center gap-xs", folded && "flex-col")}>{footerActions}</div>
|
|
354
|
+
) : null}
|
|
355
|
+
<span className={cn("relative inline-flex shrink-0", unread > 0 && "mr-xxs")}>
|
|
356
|
+
<IconButton icon="bell" label={notificationsLabel} variant="ghost" size="sm" onClick={onNotifications} />
|
|
357
|
+
<span
|
|
358
|
+
aria-hidden="true"
|
|
359
|
+
data-state={unread > 0 ? "open" : "closed"}
|
|
360
|
+
className="pointer-events-none absolute -right-xxs -top-xxs inline-flex origin-top-right transition duration-150 ease-out data-[state=open]:scale-100 data-[state=open]:opacity-100 data-[state=closed]:scale-75 data-[state=closed]:opacity-0"
|
|
361
|
+
>
|
|
362
|
+
<Badge variant="accent" size="sm" pill className="justify-center px-xs tabular-nums">
|
|
363
|
+
{unreadLabel}
|
|
364
|
+
</Badge>
|
|
365
|
+
</span>
|
|
366
|
+
</span>
|
|
341
367
|
<IconButton icon="settings" label="Settings" variant="ghost" size="sm" onClick={onSettings} />
|
|
342
368
|
</div>
|
|
343
369
|
) : null}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { IconButton } from "../IconButton";
|
|
2
3
|
import { SidebarDesktop, type SidebarNavItem } from "./SidebarDesktop";
|
|
3
4
|
|
|
4
5
|
const build = (active: string, go: (id: string) => void): SidebarNavItem[] => {
|
|
@@ -25,29 +26,68 @@ const build = (active: string, go: (id: string) => void): SidebarNavItem[] => {
|
|
|
25
26
|
];
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
const workspaces = [
|
|
30
|
+
{ value: "personal", label: "Personal", icon: "user" as const },
|
|
31
|
+
{ value: "team", label: "Team workspace", icon: "layers" as const },
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const promo = {
|
|
35
|
+
title: "Upgrade to Enterprise",
|
|
36
|
+
description: "Get more usage, security, and team features.",
|
|
37
|
+
href: "#upgrade",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Frame height from the spacing scale so no raw px lands in the preview. */
|
|
41
|
+
const frameHeight = { height: "calc(var(--spacing-section) * 10)" } as React.CSSProperties;
|
|
42
|
+
|
|
28
43
|
export default function SidebarDesktopPreview() {
|
|
29
44
|
const [folded, setFolded] = React.useState(false);
|
|
30
45
|
const [active, setActive] = React.useState("discover");
|
|
31
46
|
const [workspace, setWorkspace] = React.useState("personal");
|
|
47
|
+
const [dark, setDark] = React.useState(false);
|
|
48
|
+
const [unread, setUnread] = React.useState(12);
|
|
49
|
+
|
|
50
|
+
const themeToggle = (
|
|
51
|
+
<IconButton
|
|
52
|
+
icon={dark ? "sun" : "moon"}
|
|
53
|
+
label={dark ? "Switch to light theme" : "Switch to dark theme"}
|
|
54
|
+
variant="ghost"
|
|
55
|
+
size="sm"
|
|
56
|
+
onClick={() => setDark((d) => !d)}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
32
59
|
|
|
33
60
|
return (
|
|
34
|
-
<div className="w-full">
|
|
35
|
-
<div className="
|
|
61
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-lg">
|
|
62
|
+
<div className="flex flex-wrap items-center gap-sm">
|
|
63
|
+
<IconButton
|
|
64
|
+
icon="bell"
|
|
65
|
+
label={unread > 0 ? `Simulate ${unread} unread` : "Simulate unread notifications"}
|
|
66
|
+
variant="secondary"
|
|
67
|
+
size="sm"
|
|
68
|
+
onClick={() => setUnread((n) => (n === 0 ? 4 : n === 4 ? 12 : 0))}
|
|
69
|
+
/>
|
|
70
|
+
<span className="text-body-sm text-muted">
|
|
71
|
+
Unread: {unread === 0 ? "none — badge hidden" : unread > 9 ? "capped at 9+" : unread}
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div className="w-full border-y border-hairline bg-canvas" style={frameHeight}>
|
|
36
76
|
<SidebarDesktop
|
|
37
77
|
items={build(active, setActive)}
|
|
38
78
|
folded={folded}
|
|
39
79
|
onFoldedChange={setFolded}
|
|
40
|
-
workspaces={
|
|
41
|
-
{ value: "personal", label: "Personal", icon: "user" },
|
|
42
|
-
{ value: "team", label: "Team workspace", icon: "layers" },
|
|
43
|
-
]}
|
|
80
|
+
workspaces={workspaces}
|
|
44
81
|
workspace={workspace}
|
|
45
82
|
onWorkspaceChange={setWorkspace}
|
|
46
|
-
promo={
|
|
83
|
+
promo={promo}
|
|
47
84
|
user={{ name: "alexsmith2026", badge: "Pro" }}
|
|
85
|
+
notificationCount={unread}
|
|
86
|
+
footerActions={themeToggle}
|
|
48
87
|
>
|
|
49
88
|
<div className="p-lg text-body-sm text-muted">
|
|
50
|
-
Viewing {active}.
|
|
89
|
+
Viewing {active}. Fold the rail with the panel button — the theme toggle joins the icon column and the
|
|
90
|
+
count badge stays pinned to the bell.
|
|
51
91
|
</div>
|
|
52
92
|
</SidebarDesktop>
|
|
53
93
|
</div>
|
|
@@ -30,6 +30,8 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
30
30
|
brandHref = "#",
|
|
31
31
|
side = "left",
|
|
32
32
|
items,
|
|
33
|
+
notificationCount,
|
|
34
|
+
footerActions,
|
|
33
35
|
className,
|
|
34
36
|
children,
|
|
35
37
|
...sidebarProps
|
|
@@ -95,7 +97,14 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
95
97
|
bodyClassName="flex flex-col pb-0"
|
|
96
98
|
className="bg-surface-soft"
|
|
97
99
|
>
|
|
98
|
-
<SidebarDesktop
|
|
100
|
+
<SidebarDesktop
|
|
101
|
+
{...sidebarProps}
|
|
102
|
+
items={wrapped}
|
|
103
|
+
side={side}
|
|
104
|
+
notificationCount={notificationCount}
|
|
105
|
+
footerActions={footerActions}
|
|
106
|
+
embedded
|
|
107
|
+
/>
|
|
99
108
|
</Drawer>
|
|
100
109
|
</div>
|
|
101
110
|
);
|