@designa8/vibedesign-linear-internal-v1-2-176b 0.0.2 → 0.0.3
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 +72 -27
- package/dist/index.js +72 -27
- package/dist/styles.css +6 -0
- package/package.json +1 -1
- package/src/atoms/Sidebar/Sidebar.tsx +15 -1
- package/src/atoms/Sidebar/preview.tsx +50 -7
- package/src/atoms/SidebarDesktop/SidebarDesktop.tsx +60 -19
- package/src/atoms/SidebarDesktop/preview.tsx +41 -7
- package/src/atoms/SidebarMobile/SidebarMobile.tsx +28 -9
- package/src/atoms/SidebarMobile/preview.tsx +37 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-linear-internal-v1-2-176b
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.0.
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.0.3**.
|
|
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
|
@@ -7345,6 +7345,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7345
7345
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
7346
7346
|
var cn54 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7347
7347
|
var linkBase = "flex h-8 items-center rounded-md border border-transparent text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue";
|
|
7348
|
+
var hasBadge = (badge) => badge !== void 0 && badge !== null && badge !== false;
|
|
7348
7349
|
var SidebarDesktop = React72.forwardRef(
|
|
7349
7350
|
({
|
|
7350
7351
|
brandName = "Linear",
|
|
@@ -7352,6 +7353,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7352
7353
|
workspaceName,
|
|
7353
7354
|
workspaceAvatarSrc,
|
|
7354
7355
|
onWorkspaceClick,
|
|
7356
|
+
headerActions,
|
|
7355
7357
|
sections,
|
|
7356
7358
|
activeId,
|
|
7357
7359
|
onNavigate,
|
|
@@ -7388,6 +7390,16 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7388
7390
|
else next.add(id);
|
|
7389
7391
|
return next;
|
|
7390
7392
|
});
|
|
7393
|
+
const renderIcon = (link) => link.icon ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "relative inline-flex shrink-0 items-center justify-center", children: [
|
|
7394
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { name: link.icon, size: 16, className: "text-body" }),
|
|
7395
|
+
collapsed && hasBadge(link.badge) && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7396
|
+
"span",
|
|
7397
|
+
{
|
|
7398
|
+
"aria-hidden": "true",
|
|
7399
|
+
className: "absolute right-0 top-0 h-xs w-xs rounded-full bg-primary ring-2 ring-surface"
|
|
7400
|
+
}
|
|
7401
|
+
)
|
|
7402
|
+
] }) : null;
|
|
7391
7403
|
const renderLink = (link, nested = false) => {
|
|
7392
7404
|
const current = link.id === activeId;
|
|
7393
7405
|
const anchor = /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
@@ -7403,8 +7415,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7403
7415
|
current ? "bg-surface-strong text-ink font-weight-label" : "text-ink hover:bg-surface-soft active:bg-surface-strong"
|
|
7404
7416
|
),
|
|
7405
7417
|
children: [
|
|
7406
|
-
|
|
7407
|
-
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "min-w-0 flex-1 truncate", children: link.label })
|
|
7418
|
+
renderIcon(link),
|
|
7419
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "min-w-0 flex-1 truncate", children: link.label }),
|
|
7420
|
+
!collapsed && hasBadge(link.badge) && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge })
|
|
7408
7421
|
]
|
|
7409
7422
|
}
|
|
7410
7423
|
);
|
|
@@ -7442,8 +7455,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7442
7455
|
onClick: () => flip(link.id),
|
|
7443
7456
|
leadingIcon: link.icon ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7444
7457
|
className: "px-sm",
|
|
7445
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7446
|
-
link.label,
|
|
7458
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
|
|
7459
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "truncate", children: link.label }),
|
|
7460
|
+
hasBadge(link.badge) && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge }),
|
|
7447
7461
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7448
7462
|
Icon,
|
|
7449
7463
|
{
|
|
@@ -7467,6 +7481,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7467
7481
|
] }, link.id);
|
|
7468
7482
|
};
|
|
7469
7483
|
const renderItem = (link) => link.children?.length ? renderGroup(link) : renderLink(link);
|
|
7484
|
+
const showWorkspaceRow = Boolean(workspaceName) || !collapsed && headerActions != null;
|
|
7470
7485
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { ref, className: cn54("flex h-full w-full min-h-0 bg-canvas text-ink", className), ...rest, children: [
|
|
7471
7486
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
7472
7487
|
"aside",
|
|
@@ -7480,17 +7495,29 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7480
7495
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7481
7496
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(IconButton, { icon: "panel-left", variant: "secondary", "aria-label": "Collapse sidebar", "aria-expanded": true, onClick: toggle })
|
|
7482
7497
|
] }),
|
|
7483
|
-
|
|
7484
|
-
|
|
7498
|
+
showWorkspaceRow && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
7499
|
+
"div",
|
|
7485
7500
|
{
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7501
|
+
className: cn54(
|
|
7502
|
+
"shrink-0 pb-sm",
|
|
7503
|
+
collapsed ? "flex justify-center" : "flex items-center gap-xxs px-sm"
|
|
7504
|
+
),
|
|
7505
|
+
children: [
|
|
7506
|
+
workspaceName ? collapsed ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Tooltip, { content: workspaceName, placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Button, { variant: "ghost", iconOnly: true, "aria-label": workspaceName, onClick: onWorkspaceClick, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7507
|
+
Button,
|
|
7508
|
+
{
|
|
7509
|
+
variant: "ghost",
|
|
7510
|
+
onClick: onWorkspaceClick,
|
|
7511
|
+
className: "min-w-0 flex-1 justify-start px-sm",
|
|
7512
|
+
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }),
|
|
7513
|
+
trailingIcon: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { name: "chevron-down", size: 14, className: "text-muted" }),
|
|
7514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "min-w-0 truncate text-ink", children: workspaceName })
|
|
7515
|
+
}
|
|
7516
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "min-w-0 flex-1" }),
|
|
7517
|
+
!collapsed && headerActions != null && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "flex shrink-0 items-center gap-xxs", children: headerActions })
|
|
7518
|
+
]
|
|
7492
7519
|
}
|
|
7493
|
-
)
|
|
7520
|
+
),
|
|
7494
7521
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("nav", { "aria-label": "Main", className: cn54("min-h-0 flex-1 overflow-y-auto overscroll-contain pb-sm", collapsed ? "px-0" : "px-sm"), children: sections.map((section, i) => {
|
|
7495
7522
|
const sectionOpen = !section.label || isOpen(section.id);
|
|
7496
7523
|
const listId = `${baseId}-section-${section.id}`;
|
|
@@ -7569,6 +7596,7 @@ var React73 = __toESM(require("react"));
|
|
|
7569
7596
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
7570
7597
|
var cn55 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7571
7598
|
var linkBase2 = "flex h-9 w-full items-center gap-sm rounded-md border border-transparent px-sm text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue";
|
|
7599
|
+
var hasBadge2 = (badge) => badge !== void 0 && badge !== null && badge !== false;
|
|
7572
7600
|
var SidebarMobile = React73.forwardRef(
|
|
7573
7601
|
({
|
|
7574
7602
|
brandName = "Linear",
|
|
@@ -7576,6 +7604,7 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7576
7604
|
workspaceName,
|
|
7577
7605
|
workspaceAvatarSrc,
|
|
7578
7606
|
onWorkspaceClick,
|
|
7607
|
+
mobileActions,
|
|
7579
7608
|
sections,
|
|
7580
7609
|
activeId,
|
|
7581
7610
|
onNavigate,
|
|
@@ -7629,7 +7658,8 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7629
7658
|
),
|
|
7630
7659
|
children: [
|
|
7631
7660
|
link.icon && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Icon, { name: link.icon, size: 16, className: "text-body" }),
|
|
7632
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "min-w-0 flex-1 truncate", children: link.label })
|
|
7661
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "min-w-0 flex-1 truncate", children: link.label }),
|
|
7662
|
+
hasBadge2(link.badge) && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge })
|
|
7633
7663
|
]
|
|
7634
7664
|
}
|
|
7635
7665
|
) }, link.id);
|
|
@@ -7648,8 +7678,9 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7648
7678
|
onClick: () => flip(link.id),
|
|
7649
7679
|
leadingIcon: link.icon ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7650
7680
|
className: "px-sm",
|
|
7651
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7652
|
-
link.label,
|
|
7681
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
|
|
7682
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "truncate", children: link.label }),
|
|
7683
|
+
hasBadge2(link.badge) && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge }),
|
|
7653
7684
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7654
7685
|
Icon,
|
|
7655
7686
|
{
|
|
@@ -7675,16 +7706,19 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7675
7706
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { ref, className: cn55("flex w-full flex-col bg-canvas text-ink", className), ...rest, children: [
|
|
7676
7707
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("header", { className: "flex h-14 w-full shrink-0 items-center justify-between gap-sm border-b border-hairline bg-canvas px-base", children: [
|
|
7677
7708
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7678
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7709
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex min-w-0 items-center gap-xxs", children: [
|
|
7710
|
+
mobileActions != null && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "flex items-center gap-xxs", children: mobileActions }),
|
|
7711
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7712
|
+
IconButton,
|
|
7713
|
+
{
|
|
7714
|
+
icon: "menu",
|
|
7715
|
+
variant: "ghost",
|
|
7716
|
+
"aria-label": "Open navigation",
|
|
7717
|
+
"aria-expanded": open,
|
|
7718
|
+
onClick: () => setOpen(true)
|
|
7719
|
+
}
|
|
7720
|
+
)
|
|
7721
|
+
] })
|
|
7688
7722
|
] }),
|
|
7689
7723
|
children !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "min-w-0 flex-1", children }),
|
|
7690
7724
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
@@ -7781,6 +7815,8 @@ var Sidebar = React74.forwardRef(
|
|
|
7781
7815
|
onCollapsedChange,
|
|
7782
7816
|
mobileOpen,
|
|
7783
7817
|
onMobileOpenChange,
|
|
7818
|
+
headerActions,
|
|
7819
|
+
mobileActions,
|
|
7784
7820
|
children,
|
|
7785
7821
|
className,
|
|
7786
7822
|
...shared
|
|
@@ -7794,12 +7830,21 @@ var Sidebar = React74.forwardRef(
|
|
|
7794
7830
|
SidebarDesktop,
|
|
7795
7831
|
{
|
|
7796
7832
|
...shared,
|
|
7833
|
+
headerActions,
|
|
7797
7834
|
collapsed,
|
|
7798
7835
|
defaultCollapsed,
|
|
7799
7836
|
onCollapsedChange
|
|
7800
7837
|
}
|
|
7801
7838
|
) }),
|
|
7802
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "shrink-0 md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7839
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "shrink-0 md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7840
|
+
SidebarMobile,
|
|
7841
|
+
{
|
|
7842
|
+
...shared,
|
|
7843
|
+
mobileActions,
|
|
7844
|
+
open: mobileOpen,
|
|
7845
|
+
onOpenChange: onMobileOpenChange
|
|
7846
|
+
}
|
|
7847
|
+
) }),
|
|
7803
7848
|
children !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "min-h-0 min-w-0 flex-1 overflow-auto", children })
|
|
7804
7849
|
]
|
|
7805
7850
|
}
|
package/dist/index.js
CHANGED
|
@@ -7223,6 +7223,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7223
7223
|
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
7224
7224
|
var cn54 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7225
7225
|
var linkBase = "flex h-8 items-center rounded-md border border-transparent text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue";
|
|
7226
|
+
var hasBadge = (badge) => badge !== void 0 && badge !== null && badge !== false;
|
|
7226
7227
|
var SidebarDesktop = React72.forwardRef(
|
|
7227
7228
|
({
|
|
7228
7229
|
brandName = "Linear",
|
|
@@ -7230,6 +7231,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7230
7231
|
workspaceName,
|
|
7231
7232
|
workspaceAvatarSrc,
|
|
7232
7233
|
onWorkspaceClick,
|
|
7234
|
+
headerActions,
|
|
7233
7235
|
sections,
|
|
7234
7236
|
activeId,
|
|
7235
7237
|
onNavigate,
|
|
@@ -7266,6 +7268,16 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7266
7268
|
else next.add(id);
|
|
7267
7269
|
return next;
|
|
7268
7270
|
});
|
|
7271
|
+
const renderIcon = (link) => link.icon ? /* @__PURE__ */ jsxs66("span", { className: "relative inline-flex shrink-0 items-center justify-center", children: [
|
|
7272
|
+
/* @__PURE__ */ jsx72(Icon, { name: link.icon, size: 16, className: "text-body" }),
|
|
7273
|
+
collapsed && hasBadge(link.badge) && /* @__PURE__ */ jsx72(
|
|
7274
|
+
"span",
|
|
7275
|
+
{
|
|
7276
|
+
"aria-hidden": "true",
|
|
7277
|
+
className: "absolute right-0 top-0 h-xs w-xs rounded-full bg-primary ring-2 ring-surface"
|
|
7278
|
+
}
|
|
7279
|
+
)
|
|
7280
|
+
] }) : null;
|
|
7269
7281
|
const renderLink = (link, nested = false) => {
|
|
7270
7282
|
const current = link.id === activeId;
|
|
7271
7283
|
const anchor = /* @__PURE__ */ jsxs66(
|
|
@@ -7281,8 +7293,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7281
7293
|
current ? "bg-surface-strong text-ink font-weight-label" : "text-ink hover:bg-surface-soft active:bg-surface-strong"
|
|
7282
7294
|
),
|
|
7283
7295
|
children: [
|
|
7284
|
-
|
|
7285
|
-
!collapsed && /* @__PURE__ */ jsx72("span", { className: "min-w-0 flex-1 truncate", children: link.label })
|
|
7296
|
+
renderIcon(link),
|
|
7297
|
+
!collapsed && /* @__PURE__ */ jsx72("span", { className: "min-w-0 flex-1 truncate", children: link.label }),
|
|
7298
|
+
!collapsed && hasBadge(link.badge) && /* @__PURE__ */ jsx72("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge })
|
|
7286
7299
|
]
|
|
7287
7300
|
}
|
|
7288
7301
|
);
|
|
@@ -7320,8 +7333,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7320
7333
|
onClick: () => flip(link.id),
|
|
7321
7334
|
leadingIcon: link.icon ? /* @__PURE__ */ jsx72(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7322
7335
|
className: "px-sm",
|
|
7323
|
-
children: /* @__PURE__ */ jsxs66("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7324
|
-
link.label,
|
|
7336
|
+
children: /* @__PURE__ */ jsxs66("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
|
|
7337
|
+
/* @__PURE__ */ jsx72("span", { className: "truncate", children: link.label }),
|
|
7338
|
+
hasBadge(link.badge) && /* @__PURE__ */ jsx72("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge }),
|
|
7325
7339
|
/* @__PURE__ */ jsx72(
|
|
7326
7340
|
Icon,
|
|
7327
7341
|
{
|
|
@@ -7345,6 +7359,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7345
7359
|
] }, link.id);
|
|
7346
7360
|
};
|
|
7347
7361
|
const renderItem = (link) => link.children?.length ? renderGroup(link) : renderLink(link);
|
|
7362
|
+
const showWorkspaceRow = Boolean(workspaceName) || !collapsed && headerActions != null;
|
|
7348
7363
|
return /* @__PURE__ */ jsxs66("div", { ref, className: cn54("flex h-full w-full min-h-0 bg-canvas text-ink", className), ...rest, children: [
|
|
7349
7364
|
/* @__PURE__ */ jsxs66(
|
|
7350
7365
|
"aside",
|
|
@@ -7358,17 +7373,29 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7358
7373
|
/* @__PURE__ */ jsx72(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7359
7374
|
/* @__PURE__ */ jsx72(IconButton, { icon: "panel-left", variant: "secondary", "aria-label": "Collapse sidebar", "aria-expanded": true, onClick: toggle })
|
|
7360
7375
|
] }),
|
|
7361
|
-
|
|
7362
|
-
|
|
7376
|
+
showWorkspaceRow && /* @__PURE__ */ jsxs66(
|
|
7377
|
+
"div",
|
|
7363
7378
|
{
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7379
|
+
className: cn54(
|
|
7380
|
+
"shrink-0 pb-sm",
|
|
7381
|
+
collapsed ? "flex justify-center" : "flex items-center gap-xxs px-sm"
|
|
7382
|
+
),
|
|
7383
|
+
children: [
|
|
7384
|
+
workspaceName ? collapsed ? /* @__PURE__ */ jsx72(Tooltip, { content: workspaceName, placement: "right", children: /* @__PURE__ */ jsx72(Button, { variant: "ghost", iconOnly: true, "aria-label": workspaceName, onClick: onWorkspaceClick, children: /* @__PURE__ */ jsx72(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }) }) }) : /* @__PURE__ */ jsx72(
|
|
7385
|
+
Button,
|
|
7386
|
+
{
|
|
7387
|
+
variant: "ghost",
|
|
7388
|
+
onClick: onWorkspaceClick,
|
|
7389
|
+
className: "min-w-0 flex-1 justify-start px-sm",
|
|
7390
|
+
leadingIcon: /* @__PURE__ */ jsx72(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }),
|
|
7391
|
+
trailingIcon: /* @__PURE__ */ jsx72(Icon, { name: "chevron-down", size: 14, className: "text-muted" }),
|
|
7392
|
+
children: /* @__PURE__ */ jsx72("span", { className: "min-w-0 truncate text-ink", children: workspaceName })
|
|
7393
|
+
}
|
|
7394
|
+
) : /* @__PURE__ */ jsx72("span", { className: "min-w-0 flex-1" }),
|
|
7395
|
+
!collapsed && headerActions != null && /* @__PURE__ */ jsx72("div", { className: "flex shrink-0 items-center gap-xxs", children: headerActions })
|
|
7396
|
+
]
|
|
7370
7397
|
}
|
|
7371
|
-
)
|
|
7398
|
+
),
|
|
7372
7399
|
/* @__PURE__ */ jsx72("nav", { "aria-label": "Main", className: cn54("min-h-0 flex-1 overflow-y-auto overscroll-contain pb-sm", collapsed ? "px-0" : "px-sm"), children: sections.map((section, i) => {
|
|
7373
7400
|
const sectionOpen = !section.label || isOpen(section.id);
|
|
7374
7401
|
const listId = `${baseId}-section-${section.id}`;
|
|
@@ -7447,6 +7474,7 @@ import * as React73 from "react";
|
|
|
7447
7474
|
import { jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
7448
7475
|
var cn55 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7449
7476
|
var linkBase2 = "flex h-9 w-full items-center gap-sm rounded-md border border-transparent px-sm text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue";
|
|
7477
|
+
var hasBadge2 = (badge) => badge !== void 0 && badge !== null && badge !== false;
|
|
7450
7478
|
var SidebarMobile = React73.forwardRef(
|
|
7451
7479
|
({
|
|
7452
7480
|
brandName = "Linear",
|
|
@@ -7454,6 +7482,7 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7454
7482
|
workspaceName,
|
|
7455
7483
|
workspaceAvatarSrc,
|
|
7456
7484
|
onWorkspaceClick,
|
|
7485
|
+
mobileActions,
|
|
7457
7486
|
sections,
|
|
7458
7487
|
activeId,
|
|
7459
7488
|
onNavigate,
|
|
@@ -7507,7 +7536,8 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7507
7536
|
),
|
|
7508
7537
|
children: [
|
|
7509
7538
|
link.icon && /* @__PURE__ */ jsx73(Icon, { name: link.icon, size: 16, className: "text-body" }),
|
|
7510
|
-
/* @__PURE__ */ jsx73("span", { className: "min-w-0 flex-1 truncate", children: link.label })
|
|
7539
|
+
/* @__PURE__ */ jsx73("span", { className: "min-w-0 flex-1 truncate", children: link.label }),
|
|
7540
|
+
hasBadge2(link.badge) && /* @__PURE__ */ jsx73("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge })
|
|
7511
7541
|
]
|
|
7512
7542
|
}
|
|
7513
7543
|
) }, link.id);
|
|
@@ -7526,8 +7556,9 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7526
7556
|
onClick: () => flip(link.id),
|
|
7527
7557
|
leadingIcon: link.icon ? /* @__PURE__ */ jsx73(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7528
7558
|
className: "px-sm",
|
|
7529
|
-
children: /* @__PURE__ */ jsxs67("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7530
|
-
link.label,
|
|
7559
|
+
children: /* @__PURE__ */ jsxs67("span", { className: "inline-flex min-w-0 items-center gap-xs", children: [
|
|
7560
|
+
/* @__PURE__ */ jsx73("span", { className: "truncate", children: link.label }),
|
|
7561
|
+
hasBadge2(link.badge) && /* @__PURE__ */ jsx73("span", { className: "shrink-0 text-caption text-muted tabular-nums", children: link.badge }),
|
|
7531
7562
|
/* @__PURE__ */ jsx73(
|
|
7532
7563
|
Icon,
|
|
7533
7564
|
{
|
|
@@ -7553,16 +7584,19 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7553
7584
|
return /* @__PURE__ */ jsxs67("div", { ref, className: cn55("flex w-full flex-col bg-canvas text-ink", className), ...rest, children: [
|
|
7554
7585
|
/* @__PURE__ */ jsxs67("header", { className: "flex h-14 w-full shrink-0 items-center justify-between gap-sm border-b border-hairline bg-canvas px-base", children: [
|
|
7555
7586
|
/* @__PURE__ */ jsx73(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7556
|
-
/* @__PURE__ */
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7587
|
+
/* @__PURE__ */ jsxs67("div", { className: "flex min-w-0 items-center gap-xxs", children: [
|
|
7588
|
+
mobileActions != null && /* @__PURE__ */ jsx73("div", { className: "flex items-center gap-xxs", children: mobileActions }),
|
|
7589
|
+
/* @__PURE__ */ jsx73(
|
|
7590
|
+
IconButton,
|
|
7591
|
+
{
|
|
7592
|
+
icon: "menu",
|
|
7593
|
+
variant: "ghost",
|
|
7594
|
+
"aria-label": "Open navigation",
|
|
7595
|
+
"aria-expanded": open,
|
|
7596
|
+
onClick: () => setOpen(true)
|
|
7597
|
+
}
|
|
7598
|
+
)
|
|
7599
|
+
] })
|
|
7566
7600
|
] }),
|
|
7567
7601
|
children !== void 0 && /* @__PURE__ */ jsx73("div", { className: "min-w-0 flex-1", children }),
|
|
7568
7602
|
/* @__PURE__ */ jsxs67(
|
|
@@ -7659,6 +7693,8 @@ var Sidebar = React74.forwardRef(
|
|
|
7659
7693
|
onCollapsedChange,
|
|
7660
7694
|
mobileOpen,
|
|
7661
7695
|
onMobileOpenChange,
|
|
7696
|
+
headerActions,
|
|
7697
|
+
mobileActions,
|
|
7662
7698
|
children,
|
|
7663
7699
|
className,
|
|
7664
7700
|
...shared
|
|
@@ -7672,12 +7708,21 @@ var Sidebar = React74.forwardRef(
|
|
|
7672
7708
|
SidebarDesktop,
|
|
7673
7709
|
{
|
|
7674
7710
|
...shared,
|
|
7711
|
+
headerActions,
|
|
7675
7712
|
collapsed,
|
|
7676
7713
|
defaultCollapsed,
|
|
7677
7714
|
onCollapsedChange
|
|
7678
7715
|
}
|
|
7679
7716
|
) }),
|
|
7680
|
-
/* @__PURE__ */ jsx74("div", { className: "shrink-0 md:hidden", children: /* @__PURE__ */ jsx74(
|
|
7717
|
+
/* @__PURE__ */ jsx74("div", { className: "shrink-0 md:hidden", children: /* @__PURE__ */ jsx74(
|
|
7718
|
+
SidebarMobile,
|
|
7719
|
+
{
|
|
7720
|
+
...shared,
|
|
7721
|
+
mobileActions,
|
|
7722
|
+
open: mobileOpen,
|
|
7723
|
+
onOpenChange: onMobileOpenChange
|
|
7724
|
+
}
|
|
7725
|
+
) }),
|
|
7681
7726
|
children !== void 0 && /* @__PURE__ */ jsx74("div", { className: "min-h-0 min-w-0 flex-1 overflow-auto", children })
|
|
7682
7727
|
]
|
|
7683
7728
|
}
|
package/dist/styles.css
CHANGED
|
@@ -675,6 +675,9 @@
|
|
|
675
675
|
.h-px {
|
|
676
676
|
height: 1px;
|
|
677
677
|
}
|
|
678
|
+
.h-xs {
|
|
679
|
+
height: var(--spacing-xs);
|
|
680
|
+
}
|
|
678
681
|
.max-h-72 {
|
|
679
682
|
max-height: calc(var(--spacing) * 72);
|
|
680
683
|
}
|
|
@@ -1776,6 +1779,9 @@
|
|
|
1776
1779
|
.ring-primary {
|
|
1777
1780
|
--tw-ring-color: var(--color-primary);
|
|
1778
1781
|
}
|
|
1782
|
+
.ring-surface {
|
|
1783
|
+
--tw-ring-color: var(--color-surface);
|
|
1784
|
+
}
|
|
1779
1785
|
.ring-offset-2 {
|
|
1780
1786
|
--tw-ring-offset-width: 2px;
|
|
1781
1787
|
--tw-ring-offset-shadow: var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
package/package.json
CHANGED
|
@@ -8,6 +8,8 @@ export interface SidebarLink {
|
|
|
8
8
|
label: string;
|
|
9
9
|
icon?: IconName;
|
|
10
10
|
href?: string;
|
|
11
|
+
/** Small count or muted marker shown right-aligned at the end of the row. */
|
|
12
|
+
badge?: React.ReactNode;
|
|
11
13
|
children?: SidebarLink[];
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -32,6 +34,10 @@ export interface SidebarProps {
|
|
|
32
34
|
userAvatarSrc?: string;
|
|
33
35
|
onHelpClick?: () => void;
|
|
34
36
|
onSettingsClick?: () => void;
|
|
37
|
+
/** App actions rendered right-aligned on the workspace row (desktop). Hidden when folded. */
|
|
38
|
+
headerActions?: React.ReactNode;
|
|
39
|
+
/** App actions rendered in the mobile top bar, between the logo and the menu button. */
|
|
40
|
+
mobileActions?: React.ReactNode;
|
|
35
41
|
/** Desktop fold state. */
|
|
36
42
|
collapsed?: boolean;
|
|
37
43
|
defaultCollapsed?: boolean;
|
|
@@ -53,6 +59,8 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
53
59
|
onCollapsedChange,
|
|
54
60
|
mobileOpen,
|
|
55
61
|
onMobileOpenChange,
|
|
62
|
+
headerActions,
|
|
63
|
+
mobileActions,
|
|
56
64
|
children,
|
|
57
65
|
className,
|
|
58
66
|
...shared
|
|
@@ -66,13 +74,19 @@ export const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
|
|
|
66
74
|
<div className="hidden h-full shrink-0 md:block">
|
|
67
75
|
<SidebarDesktop
|
|
68
76
|
{...shared}
|
|
77
|
+
headerActions={headerActions}
|
|
69
78
|
collapsed={collapsed}
|
|
70
79
|
defaultCollapsed={defaultCollapsed}
|
|
71
80
|
onCollapsedChange={onCollapsedChange}
|
|
72
81
|
/>
|
|
73
82
|
</div>
|
|
74
83
|
<div className="shrink-0 md:hidden">
|
|
75
|
-
<SidebarMobile
|
|
84
|
+
<SidebarMobile
|
|
85
|
+
{...shared}
|
|
86
|
+
mobileActions={mobileActions}
|
|
87
|
+
open={mobileOpen}
|
|
88
|
+
onOpenChange={onMobileOpenChange}
|
|
89
|
+
/>
|
|
76
90
|
</div>
|
|
77
91
|
{children !== undefined && <div className="min-h-0 min-w-0 flex-1 overflow-auto">{children}</div>}
|
|
78
92
|
</div>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Sidebar } from "./Sidebar";
|
|
3
|
+
import { SidebarMobile } from "../SidebarMobile";
|
|
4
|
+
import { IconButton } from "../IconButton";
|
|
5
|
+
import { Avatar } from "../Avatar";
|
|
3
6
|
import type { SidebarSection } from "./Sidebar";
|
|
4
7
|
|
|
5
8
|
const SECTIONS: SidebarSection[] = [
|
|
6
9
|
{
|
|
7
10
|
id: "main",
|
|
8
11
|
items: [
|
|
9
|
-
{ id: "drafts", label: "Drafts", icon: "square-pen" },
|
|
10
|
-
{ id: "inbox", label: "Inbox", icon: "inbox" },
|
|
12
|
+
{ id: "drafts", label: "Drafts", icon: "square-pen", badge: "2" },
|
|
13
|
+
{ id: "inbox", label: "Inbox", icon: "inbox", badge: "4" },
|
|
11
14
|
{ id: "my-issues", label: "My issues", icon: "scan-eye" },
|
|
12
15
|
{ id: "more", label: "More", icon: "ellipsis" },
|
|
13
16
|
],
|
|
@@ -21,7 +24,7 @@ const SECTIONS: SidebarSection[] = [
|
|
|
21
24
|
label: "Engineering Team",
|
|
22
25
|
icon: "monitor",
|
|
23
26
|
children: [
|
|
24
|
-
{ id: "eng-issues", label: "Issues", icon: "copy" },
|
|
27
|
+
{ id: "eng-issues", label: "Issues", icon: "copy", badge: "12" },
|
|
25
28
|
{ id: "eng-projects", label: "Projects", icon: "box" },
|
|
26
29
|
],
|
|
27
30
|
},
|
|
@@ -50,14 +53,29 @@ const SECTIONS: SidebarSection[] = [
|
|
|
50
53
|
},
|
|
51
54
|
];
|
|
52
55
|
|
|
56
|
+
const HEADER_ACTIONS = (
|
|
57
|
+
<>
|
|
58
|
+
<IconButton icon="search" variant="ghost" aria-label="Search issues" />
|
|
59
|
+
<IconButton icon="square-pen" variant="ghost" aria-label="New issue" />
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const MOBILE_ACTIONS = (
|
|
64
|
+
<>
|
|
65
|
+
<IconButton icon="search" variant="ghost" aria-label="Search issues" />
|
|
66
|
+
<IconButton icon="inbox" variant="ghost" aria-label="Inbox, 4 unread" />
|
|
67
|
+
<Avatar name="AS Mobbin" size="sm" />
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
|
|
53
71
|
export default function SidebarPreview() {
|
|
54
72
|
const [collapsed, setCollapsed] = React.useState(false);
|
|
55
73
|
const [mobileOpen, setMobileOpen] = React.useState(false);
|
|
56
74
|
const [active, setActive] = React.useState("issues");
|
|
57
75
|
|
|
58
76
|
return (
|
|
59
|
-
<div className="w-full">
|
|
60
|
-
<div className="
|
|
77
|
+
<div className="mx-auto w-full max-w-5xl space-y-lg p-md">
|
|
78
|
+
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "24rem" }}>
|
|
61
79
|
<Sidebar
|
|
62
80
|
sections={SECTIONS}
|
|
63
81
|
defaultExpanded={["teams", "try", "workspace-team"]}
|
|
@@ -68,7 +86,8 @@ export default function SidebarPreview() {
|
|
|
68
86
|
}}
|
|
69
87
|
workspaceName="AS Mobbin"
|
|
70
88
|
userName="AS Mobbin"
|
|
71
|
-
|
|
89
|
+
headerActions={HEADER_ACTIONS}
|
|
90
|
+
mobileActions={MOBILE_ACTIONS}
|
|
72
91
|
collapsed={collapsed}
|
|
73
92
|
onCollapsedChange={setCollapsed}
|
|
74
93
|
mobileOpen={mobileOpen}
|
|
@@ -76,10 +95,34 @@ export default function SidebarPreview() {
|
|
|
76
95
|
>
|
|
77
96
|
<div className="p-lg">
|
|
78
97
|
<h1 className="text-heading-sm text-ink">Issues</h1>
|
|
79
|
-
<p className="mt-xs text-body-sm text-muted">
|
|
98
|
+
<p className="mt-xs text-body-sm text-muted">
|
|
99
|
+
Counts sit at the end of Inbox and Drafts; search and compose sit beside the workspace switcher and
|
|
100
|
+
fold away with the rail.
|
|
101
|
+
</p>
|
|
80
102
|
</div>
|
|
81
103
|
</Sidebar>
|
|
82
104
|
</div>
|
|
105
|
+
|
|
106
|
+
<div
|
|
107
|
+
className="w-full overflow-hidden rounded-lg border border-hairline"
|
|
108
|
+
style={{ maxWidth: "var(--container-sm, 24rem)" }}
|
|
109
|
+
>
|
|
110
|
+
<SidebarMobile
|
|
111
|
+
sections={SECTIONS}
|
|
112
|
+
defaultExpanded={["teams", "workspace-team"]}
|
|
113
|
+
activeId={active}
|
|
114
|
+
workspaceName="AS Mobbin"
|
|
115
|
+
userName="AS Mobbin"
|
|
116
|
+
mobileActions={MOBILE_ACTIONS}
|
|
117
|
+
>
|
|
118
|
+
<div className="p-md">
|
|
119
|
+
<h2 className="text-heading-sm text-ink">Mobile top bar</h2>
|
|
120
|
+
<p className="mt-xs text-body-sm text-muted">
|
|
121
|
+
Search, inbox count and avatar sit between the logo and the menu button, on one row.
|
|
122
|
+
</p>
|
|
123
|
+
</div>
|
|
124
|
+
</SidebarMobile>
|
|
125
|
+
</div>
|
|
83
126
|
</div>
|
|
84
127
|
);
|
|
85
128
|
}
|
|
@@ -12,6 +12,8 @@ export interface SidebarDesktopLink {
|
|
|
12
12
|
label: string;
|
|
13
13
|
icon?: IconName;
|
|
14
14
|
href?: string;
|
|
15
|
+
/** Small count or muted marker shown right-aligned at the end of the row (e.g. Inbox 4). */
|
|
16
|
+
badge?: React.ReactNode;
|
|
15
17
|
/** Child links; makes this row a collapsible group (e.g. a team). */
|
|
16
18
|
children?: SidebarDesktopLink[];
|
|
17
19
|
}
|
|
@@ -29,6 +31,8 @@ export interface SidebarDesktopProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
29
31
|
workspaceName?: string;
|
|
30
32
|
workspaceAvatarSrc?: string;
|
|
31
33
|
onWorkspaceClick?: () => void;
|
|
34
|
+
/** App actions shown right-aligned on the workspace row, e.g. search and compose. Hidden when folded. */
|
|
35
|
+
headerActions?: React.ReactNode;
|
|
32
36
|
sections: SidebarDesktopSection[];
|
|
33
37
|
/** id of the current link. */
|
|
34
38
|
activeId?: string;
|
|
@@ -55,6 +59,8 @@ const cn = (...parts: Array<string | false | null | undefined>) =>
|
|
|
55
59
|
const linkBase =
|
|
56
60
|
"flex h-8 items-center rounded-md border border-transparent text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue";
|
|
57
61
|
|
|
62
|
+
const hasBadge = (badge: React.ReactNode) => badge !== undefined && badge !== null && badge !== false;
|
|
63
|
+
|
|
58
64
|
export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopProps>(
|
|
59
65
|
(
|
|
60
66
|
{
|
|
@@ -63,6 +69,7 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
63
69
|
workspaceName,
|
|
64
70
|
workspaceAvatarSrc,
|
|
65
71
|
onWorkspaceClick,
|
|
72
|
+
headerActions,
|
|
66
73
|
sections,
|
|
67
74
|
activeId,
|
|
68
75
|
onNavigate,
|
|
@@ -105,6 +112,20 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
105
112
|
return next;
|
|
106
113
|
});
|
|
107
114
|
|
|
115
|
+
/** Leading icon; while folded a badge degrades to a small primary dot on the glyph. */
|
|
116
|
+
const renderIcon = (link: SidebarDesktopLink) =>
|
|
117
|
+
link.icon ? (
|
|
118
|
+
<span className="relative inline-flex shrink-0 items-center justify-center">
|
|
119
|
+
<Icon name={link.icon} size={16} className="text-body" />
|
|
120
|
+
{collapsed && hasBadge(link.badge) && (
|
|
121
|
+
<span
|
|
122
|
+
aria-hidden="true"
|
|
123
|
+
className="absolute right-0 top-0 h-xs w-xs rounded-full bg-primary ring-2 ring-surface"
|
|
124
|
+
/>
|
|
125
|
+
)}
|
|
126
|
+
</span>
|
|
127
|
+
) : null;
|
|
128
|
+
|
|
108
129
|
const renderLink = (link: SidebarDesktopLink, nested = false) => {
|
|
109
130
|
const current = link.id === activeId;
|
|
110
131
|
const anchor = (
|
|
@@ -121,8 +142,11 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
121
142
|
: "text-ink hover:bg-surface-soft active:bg-surface-strong",
|
|
122
143
|
)}
|
|
123
144
|
>
|
|
124
|
-
{link
|
|
145
|
+
{renderIcon(link)}
|
|
125
146
|
{!collapsed && <span className="min-w-0 flex-1 truncate">{link.label}</span>}
|
|
147
|
+
{!collapsed && hasBadge(link.badge) && (
|
|
148
|
+
<span className="shrink-0 text-caption text-muted tabular-nums">{link.badge}</span>
|
|
149
|
+
)}
|
|
126
150
|
</a>
|
|
127
151
|
);
|
|
128
152
|
return (
|
|
@@ -173,8 +197,11 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
173
197
|
leadingIcon={link.icon ? <Icon name={link.icon} size={16} className="text-body" /> : undefined}
|
|
174
198
|
className="px-sm"
|
|
175
199
|
>
|
|
176
|
-
<span className="inline-flex items-center gap-xs">
|
|
177
|
-
{link.label}
|
|
200
|
+
<span className="inline-flex min-w-0 items-center gap-xs">
|
|
201
|
+
<span className="truncate">{link.label}</span>
|
|
202
|
+
{hasBadge(link.badge) && (
|
|
203
|
+
<span className="shrink-0 text-caption text-muted tabular-nums">{link.badge}</span>
|
|
204
|
+
)}
|
|
178
205
|
<Icon
|
|
179
206
|
name="chevron-down"
|
|
180
207
|
size={12}
|
|
@@ -198,6 +225,8 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
198
225
|
const renderItem = (link: SidebarDesktopLink) =>
|
|
199
226
|
link.children?.length ? renderGroup(link) : renderLink(link);
|
|
200
227
|
|
|
228
|
+
const showWorkspaceRow = Boolean(workspaceName) || (!collapsed && headerActions != null);
|
|
229
|
+
|
|
201
230
|
return (
|
|
202
231
|
<div ref={ref} className={cn("flex h-full w-full min-h-0 bg-canvas text-ink", className)} {...rest}>
|
|
203
232
|
<aside
|
|
@@ -217,24 +246,36 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
217
246
|
</div>
|
|
218
247
|
)}
|
|
219
248
|
|
|
220
|
-
{
|
|
221
|
-
<div
|
|
222
|
-
{
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
249
|
+
{showWorkspaceRow && (
|
|
250
|
+
<div
|
|
251
|
+
className={cn(
|
|
252
|
+
"shrink-0 pb-sm",
|
|
253
|
+
collapsed ? "flex justify-center" : "flex items-center gap-xxs px-sm",
|
|
254
|
+
)}
|
|
255
|
+
>
|
|
256
|
+
{workspaceName ? (
|
|
257
|
+
collapsed ? (
|
|
258
|
+
<Tooltip content={workspaceName} placement="right">
|
|
259
|
+
<Button variant="ghost" iconOnly aria-label={workspaceName} onClick={onWorkspaceClick}>
|
|
260
|
+
<Avatar name={workspaceName} src={workspaceAvatarSrc} size="sm" />
|
|
261
|
+
</Button>
|
|
262
|
+
</Tooltip>
|
|
263
|
+
) : (
|
|
264
|
+
<Button
|
|
265
|
+
variant="ghost"
|
|
266
|
+
onClick={onWorkspaceClick}
|
|
267
|
+
className="min-w-0 flex-1 justify-start px-sm"
|
|
268
|
+
leadingIcon={<Avatar name={workspaceName} src={workspaceAvatarSrc} size="sm" />}
|
|
269
|
+
trailingIcon={<Icon name="chevron-down" size={14} className="text-muted" />}
|
|
270
|
+
>
|
|
271
|
+
<span className="min-w-0 truncate text-ink">{workspaceName}</span>
|
|
226
272
|
</Button>
|
|
227
|
-
|
|
273
|
+
)
|
|
228
274
|
) : (
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
leadingIcon={<Avatar name={workspaceName} src={workspaceAvatarSrc} size="sm" />}
|
|
234
|
-
trailingIcon={<Icon name="chevron-down" size={14} className="text-muted" />}
|
|
235
|
-
>
|
|
236
|
-
<span className="text-ink">{workspaceName}</span>
|
|
237
|
-
</Button>
|
|
275
|
+
<span className="min-w-0 flex-1" />
|
|
276
|
+
)}
|
|
277
|
+
{!collapsed && headerActions != null && (
|
|
278
|
+
<div className="flex shrink-0 items-center gap-xxs">{headerActions}</div>
|
|
238
279
|
)}
|
|
239
280
|
</div>
|
|
240
281
|
)}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { SidebarDesktop } from "./SidebarDesktop";
|
|
3
|
+
import { IconButton } from "../IconButton";
|
|
3
4
|
import type { SidebarDesktopSection } from "./SidebarDesktop";
|
|
4
5
|
|
|
5
6
|
const SECTIONS: SidebarDesktopSection[] = [
|
|
6
7
|
{
|
|
7
8
|
id: "main",
|
|
8
9
|
items: [
|
|
9
|
-
{ id: "drafts", label: "Drafts", icon: "square-pen" },
|
|
10
|
-
{ id: "inbox", label: "Inbox", icon: "inbox" },
|
|
10
|
+
{ id: "drafts", label: "Drafts", icon: "square-pen", badge: "2" },
|
|
11
|
+
{ id: "inbox", label: "Inbox", icon: "inbox", badge: "4" },
|
|
11
12
|
{ id: "my-issues", label: "My issues", icon: "scan-eye" },
|
|
12
13
|
{ id: "more", label: "More", icon: "ellipsis" },
|
|
13
14
|
],
|
|
@@ -21,7 +22,7 @@ const SECTIONS: SidebarDesktopSection[] = [
|
|
|
21
22
|
label: "Engineering Team",
|
|
22
23
|
icon: "monitor",
|
|
23
24
|
children: [
|
|
24
|
-
{ id: "eng-issues", label: "Issues", icon: "copy" },
|
|
25
|
+
{ id: "eng-issues", label: "Issues", icon: "copy", badge: "12" },
|
|
25
26
|
{ id: "eng-projects", label: "Projects", icon: "box" },
|
|
26
27
|
],
|
|
27
28
|
},
|
|
@@ -50,13 +51,32 @@ const SECTIONS: SidebarDesktopSection[] = [
|
|
|
50
51
|
},
|
|
51
52
|
];
|
|
52
53
|
|
|
54
|
+
const FOLDED_SECTIONS: SidebarDesktopSection[] = [
|
|
55
|
+
{
|
|
56
|
+
id: "main",
|
|
57
|
+
items: [
|
|
58
|
+
{ id: "drafts", label: "Drafts", icon: "square-pen" },
|
|
59
|
+
{ id: "inbox", label: "Inbox", icon: "inbox", badge: "4" },
|
|
60
|
+
{ id: "my-issues", label: "My issues", icon: "scan-eye" },
|
|
61
|
+
{ id: "more", label: "More", icon: "ellipsis" },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const HEADER_ACTIONS = (
|
|
67
|
+
<>
|
|
68
|
+
<IconButton icon="search" variant="ghost" aria-label="Search issues" />
|
|
69
|
+
<IconButton icon="square-pen" variant="ghost" aria-label="New issue" />
|
|
70
|
+
</>
|
|
71
|
+
);
|
|
72
|
+
|
|
53
73
|
export default function SidebarDesktopPreview() {
|
|
54
74
|
const [collapsed, setCollapsed] = React.useState(false);
|
|
55
75
|
const [active, setActive] = React.useState("issues");
|
|
56
76
|
|
|
57
77
|
return (
|
|
58
|
-
<div className="w-full">
|
|
59
|
-
<div className="
|
|
78
|
+
<div className="mx-auto w-full max-w-5xl space-y-lg p-lg">
|
|
79
|
+
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "26rem" }}>
|
|
60
80
|
<SidebarDesktop
|
|
61
81
|
sections={SECTIONS}
|
|
62
82
|
defaultExpanded={["teams", "try", "workspace-team"]}
|
|
@@ -67,16 +87,30 @@ export default function SidebarDesktopPreview() {
|
|
|
67
87
|
}}
|
|
68
88
|
workspaceName="AS Mobbin"
|
|
69
89
|
userName="AS Mobbin"
|
|
70
|
-
|
|
90
|
+
headerActions={HEADER_ACTIONS}
|
|
71
91
|
collapsed={collapsed}
|
|
72
92
|
onCollapsedChange={setCollapsed}
|
|
73
93
|
>
|
|
74
94
|
<div className="p-lg">
|
|
75
95
|
<h1 className="text-heading-sm text-ink">Issues</h1>
|
|
76
|
-
<p className="mt-xs text-body-sm text-muted">
|
|
96
|
+
<p className="mt-xs text-body-sm text-muted">
|
|
97
|
+
Counts sit at the end of each row; search and compose sit beside the workspace switcher and fold
|
|
98
|
+
away with the rail.
|
|
99
|
+
</p>
|
|
77
100
|
</div>
|
|
78
101
|
</SidebarDesktop>
|
|
79
102
|
</div>
|
|
103
|
+
|
|
104
|
+
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "22rem" }}>
|
|
105
|
+
<SidebarDesktop
|
|
106
|
+
sections={FOLDED_SECTIONS}
|
|
107
|
+
defaultExpanded={["main"]}
|
|
108
|
+
activeId="inbox"
|
|
109
|
+
workspaceName="AS Mobbin"
|
|
110
|
+
headerActions={HEADER_ACTIONS}
|
|
111
|
+
defaultCollapsed
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
80
114
|
</div>
|
|
81
115
|
);
|
|
82
116
|
}
|
|
@@ -12,6 +12,8 @@ export interface SidebarMobileLink {
|
|
|
12
12
|
label: string;
|
|
13
13
|
icon?: IconName;
|
|
14
14
|
href?: string;
|
|
15
|
+
/** Small count or muted marker shown right-aligned at the end of the row (e.g. Inbox 4). */
|
|
16
|
+
badge?: React.ReactNode;
|
|
15
17
|
/** Child links; makes this row a collapsible group (e.g. a team). */
|
|
16
18
|
children?: SidebarMobileLink[];
|
|
17
19
|
}
|
|
@@ -29,6 +31,11 @@ export interface SidebarMobileProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
29
31
|
workspaceName?: string;
|
|
30
32
|
workspaceAvatarSrc?: string;
|
|
31
33
|
onWorkspaceClick?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* App actions rendered in the top bar between the logo and the menu button —
|
|
36
|
+
* up to three icon-sized controls (search, inbox with count, avatar).
|
|
37
|
+
*/
|
|
38
|
+
mobileActions?: React.ReactNode;
|
|
32
39
|
sections: SidebarMobileSection[];
|
|
33
40
|
/** id of the current link. */
|
|
34
41
|
activeId?: string;
|
|
@@ -54,6 +61,8 @@ const cn = (...parts: Array<string | false | null | undefined>) =>
|
|
|
54
61
|
const linkBase =
|
|
55
62
|
"flex h-9 w-full items-center gap-sm rounded-md border border-transparent px-sm text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue";
|
|
56
63
|
|
|
64
|
+
const hasBadge = (badge: React.ReactNode) => badge !== undefined && badge !== null && badge !== false;
|
|
65
|
+
|
|
57
66
|
export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps>(
|
|
58
67
|
(
|
|
59
68
|
{
|
|
@@ -62,6 +71,7 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
62
71
|
workspaceName,
|
|
63
72
|
workspaceAvatarSrc,
|
|
64
73
|
onWorkspaceClick,
|
|
74
|
+
mobileActions,
|
|
65
75
|
sections,
|
|
66
76
|
activeId,
|
|
67
77
|
onNavigate,
|
|
@@ -123,6 +133,9 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
123
133
|
>
|
|
124
134
|
{link.icon && <Icon name={link.icon} size={16} className="text-body" />}
|
|
125
135
|
<span className="min-w-0 flex-1 truncate">{link.label}</span>
|
|
136
|
+
{hasBadge(link.badge) && (
|
|
137
|
+
<span className="shrink-0 text-caption text-muted tabular-nums">{link.badge}</span>
|
|
138
|
+
)}
|
|
126
139
|
</a>
|
|
127
140
|
</li>
|
|
128
141
|
);
|
|
@@ -142,8 +155,11 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
142
155
|
leadingIcon={link.icon ? <Icon name={link.icon} size={16} className="text-body" /> : undefined}
|
|
143
156
|
className="px-sm"
|
|
144
157
|
>
|
|
145
|
-
<span className="inline-flex items-center gap-xs">
|
|
146
|
-
{link.label}
|
|
158
|
+
<span className="inline-flex min-w-0 items-center gap-xs">
|
|
159
|
+
<span className="truncate">{link.label}</span>
|
|
160
|
+
{hasBadge(link.badge) && (
|
|
161
|
+
<span className="shrink-0 text-caption text-muted tabular-nums">{link.badge}</span>
|
|
162
|
+
)}
|
|
147
163
|
<Icon
|
|
148
164
|
name="chevron-down"
|
|
149
165
|
size={12}
|
|
@@ -168,13 +184,16 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
168
184
|
<div ref={ref} className={cn("flex w-full flex-col bg-canvas text-ink", className)} {...rest}>
|
|
169
185
|
<header className="flex h-14 w-full shrink-0 items-center justify-between gap-sm border-b border-hairline bg-canvas px-base">
|
|
170
186
|
<Logo name={brandName} href={brandHref} size="md" />
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
187
|
+
<div className="flex min-w-0 items-center gap-xxs">
|
|
188
|
+
{mobileActions != null && <div className="flex items-center gap-xxs">{mobileActions}</div>}
|
|
189
|
+
<IconButton
|
|
190
|
+
icon="menu"
|
|
191
|
+
variant="ghost"
|
|
192
|
+
aria-label="Open navigation"
|
|
193
|
+
aria-expanded={open}
|
|
194
|
+
onClick={() => setOpen(true)}
|
|
195
|
+
/>
|
|
196
|
+
</div>
|
|
178
197
|
</header>
|
|
179
198
|
{children !== undefined && <div className="min-w-0 flex-1">{children}</div>}
|
|
180
199
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { SidebarMobile } from "./SidebarMobile";
|
|
3
|
+
import { IconButton } from "../IconButton";
|
|
4
|
+
import { Avatar } from "../Avatar";
|
|
3
5
|
import type { SidebarMobileSection } from "./SidebarMobile";
|
|
4
6
|
|
|
5
7
|
const SECTIONS: SidebarMobileSection[] = [
|
|
6
8
|
{
|
|
7
9
|
id: "main",
|
|
8
10
|
items: [
|
|
9
|
-
{ id: "drafts", label: "Drafts", icon: "square-pen" },
|
|
10
|
-
{ id: "inbox", label: "Inbox", icon: "inbox" },
|
|
11
|
+
{ id: "drafts", label: "Drafts", icon: "square-pen", badge: "2" },
|
|
12
|
+
{ id: "inbox", label: "Inbox", icon: "inbox", badge: "4" },
|
|
11
13
|
{ id: "my-issues", label: "My issues", icon: "scan-eye" },
|
|
12
14
|
{ id: "more", label: "More", icon: "ellipsis" },
|
|
13
15
|
],
|
|
@@ -21,7 +23,7 @@ const SECTIONS: SidebarMobileSection[] = [
|
|
|
21
23
|
label: "Engineering Team",
|
|
22
24
|
icon: "monitor",
|
|
23
25
|
children: [
|
|
24
|
-
{ id: "eng-issues", label: "Issues", icon: "copy" },
|
|
26
|
+
{ id: "eng-issues", label: "Issues", icon: "copy", badge: "12" },
|
|
25
27
|
{ id: "eng-projects", label: "Projects", icon: "box" },
|
|
26
28
|
],
|
|
27
29
|
},
|
|
@@ -50,13 +52,24 @@ const SECTIONS: SidebarMobileSection[] = [
|
|
|
50
52
|
},
|
|
51
53
|
];
|
|
52
54
|
|
|
55
|
+
const MOBILE_ACTIONS = (
|
|
56
|
+
<>
|
|
57
|
+
<IconButton icon="search" variant="ghost" aria-label="Search issues" />
|
|
58
|
+
<IconButton icon="inbox" variant="ghost" aria-label="Inbox, 4 unread" />
|
|
59
|
+
<Avatar name="AS Mobbin" size="sm" />
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
|
|
53
63
|
export default function SidebarMobilePreview() {
|
|
54
64
|
const [open, setOpen] = React.useState(false);
|
|
55
65
|
const [active, setActive] = React.useState("issues");
|
|
56
66
|
|
|
57
67
|
return (
|
|
58
|
-
<div className="w-full max-w-3xl
|
|
59
|
-
<div
|
|
68
|
+
<div className="mx-auto w-full max-w-3xl space-y-lg p-lg">
|
|
69
|
+
<div
|
|
70
|
+
className="mx-auto w-full overflow-hidden rounded-xl border border-hairline"
|
|
71
|
+
style={{ maxWidth: "var(--container-sm, 24rem)" }}
|
|
72
|
+
>
|
|
60
73
|
<SidebarMobile
|
|
61
74
|
sections={SECTIONS}
|
|
62
75
|
defaultExpanded={["teams", "try", "workspace-team"]}
|
|
@@ -68,12 +81,29 @@ export default function SidebarMobilePreview() {
|
|
|
68
81
|
workspaceName="AS Mobbin"
|
|
69
82
|
userName="AS Mobbin"
|
|
70
83
|
announcement={{ eyebrow: "What's new", title: "Web forms for intake requests" }}
|
|
84
|
+
mobileActions={MOBILE_ACTIONS}
|
|
71
85
|
open={open}
|
|
72
86
|
onOpenChange={setOpen}
|
|
73
87
|
>
|
|
74
|
-
<div className="
|
|
88
|
+
<div className="bg-surface p-base">
|
|
75
89
|
<h1 className="text-heading-sm text-ink">Issues</h1>
|
|
76
|
-
<p className="mt-xs text-body-sm text-muted">
|
|
90
|
+
<p className="mt-xs text-body-sm text-muted">
|
|
91
|
+
Counts sit at the end of Inbox and Drafts; app actions sit in the top bar beside the menu button.
|
|
92
|
+
</p>
|
|
93
|
+
</div>
|
|
94
|
+
</SidebarMobile>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div
|
|
98
|
+
className="mx-auto w-full overflow-hidden rounded-xl border border-hairline"
|
|
99
|
+
style={{ maxWidth: "var(--container-sm, 24rem)" }}
|
|
100
|
+
>
|
|
101
|
+
<SidebarMobile sections={SECTIONS} defaultExpanded={["teams"]} activeId="drafts">
|
|
102
|
+
<div className="bg-surface p-base">
|
|
103
|
+
<h1 className="text-heading-sm text-ink">No slot content</h1>
|
|
104
|
+
<p className="mt-xs text-body-sm text-muted">
|
|
105
|
+
Without mobileActions the bar keeps the logo and menu button only, unchanged.
|
|
106
|
+
</p>
|
|
77
107
|
</div>
|
|
78
108
|
</SidebarMobile>
|
|
79
109
|
</div>
|