@designa8/vibedesign-linear-internal-v1-2-176b 0.0.1 → 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 +91 -28
- package/dist/index.js +91 -28
- package/dist/styles.css +6 -0
- package/package.json +1 -1
- package/src/atoms/Icon/icons.data.ts +18 -0
- 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
|
@@ -212,7 +212,25 @@ var ICON_REGISTRY = {
|
|
|
212
212
|
"paperclip": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }] },
|
|
213
213
|
"move-diagonal-2": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M19 13v6h-6" }, { tag: "path", d: "M5 11V5h6" }, { tag: "path", d: "m5 5 14 14" }] },
|
|
214
214
|
"fullscreen": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M3 7V5a2 2 0 0 1 2-2h2" }, { tag: "path", d: "M17 3h2a2 2 0 0 1 2 2v2" }, { tag: "path", d: "M21 17v2a2 2 0 0 1-2 2h-2" }, { tag: "path", d: "M7 21H5a2 2 0 0 1-2-2v-2" }, { tag: "rect", width: "10", height: "8", x: "7", y: "8", rx: "1" }] },
|
|
215
|
-
"scaling": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, { tag: "path", d: "M14 15H9v-5" }, { tag: "path", d: "M16 3h5v5" }, { tag: "path", d: "M21 3 9 15" }] }
|
|
215
|
+
"scaling": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, { tag: "path", d: "M14 15H9v-5" }, { tag: "path", d: "M16 3h5v5" }, { tag: "path", d: "M21 3 9 15" }] },
|
|
216
|
+
"sun": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "4" }, { tag: "path", d: "M12 2v2" }, { tag: "path", d: "M12 20v2" }, { tag: "path", d: "m4.93 4.93 1.41 1.41" }, { tag: "path", d: "m17.66 17.66 1.41 1.41" }, { tag: "path", d: "M2 12h2" }, { tag: "path", d: "M20 12h2" }, { tag: "path", d: "m6.34 17.66-1.41 1.41" }, { tag: "path", d: "m19.07 4.93-1.41 1.41" }] },
|
|
217
|
+
"moon": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }] },
|
|
218
|
+
"archive": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "20", height: "5", x: "2", y: "3", rx: "1" }, { tag: "path", d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" }, { tag: "path", d: "M10 12h4" }] },
|
|
219
|
+
"tag": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }, { tag: "circle", cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" }] },
|
|
220
|
+
"link": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }, { tag: "path", d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }] },
|
|
221
|
+
"signal-low": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M2 20h.01" }, { tag: "path", d: "M7 20v-4" }] },
|
|
222
|
+
"repeat": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m17 2 4 4-4 4" }, { tag: "path", d: "M3 11v-1a4 4 0 0 1 4-4h14" }, { tag: "path", d: "m7 22-4-4 4-4" }, { tag: "path", d: "M21 13v1a4 4 0 0 1-4 4H3" }] },
|
|
223
|
+
"target": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "circle", cx: "12", cy: "12", r: "6" }, { tag: "circle", cx: "12", cy: "12", r: "2" }] },
|
|
224
|
+
"arrow-left": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m12 19-7-7 7-7" }, { tag: "path", d: "M19 12H5" }] },
|
|
225
|
+
"square-kanban": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "18", height: "18", x: "3", y: "3", rx: "2" }, { tag: "path", d: "M8 7v7" }, { tag: "path", d: "M12 7v4" }, { tag: "path", d: "M16 7v9" }] },
|
|
226
|
+
"bell": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10.268 21a2 2 0 0 0 3.464 0" }, { tag: "path", d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" }] },
|
|
227
|
+
"play": { viewBox: "0 0 24 24", nodes: [{ tag: "polygon", points: "6 3 20 12 6 21 6 3" }] },
|
|
228
|
+
"flag": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z" }, { tag: "line", x1: "4", x2: "4", y1: "22", y2: "15" }] },
|
|
229
|
+
"eye": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }, { tag: "circle", cx: "12", cy: "12", r: "3" }] },
|
|
230
|
+
"list": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M3 12h.01" }, { tag: "path", d: "M3 18h.01" }, { tag: "path", d: "M3 6h.01" }, { tag: "path", d: "M8 12h13" }, { tag: "path", d: "M8 18h13" }, { tag: "path", d: "M8 6h13" }] },
|
|
231
|
+
"users": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }, { tag: "circle", cx: "9", cy: "7", r: "4" }, { tag: "path", d: "M22 21v-2a4 4 0 0 0-3-3.87" }, { tag: "path", d: "M16 3.13a4 4 0 0 1 0 7.75" }] },
|
|
232
|
+
"user-plus": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }, { tag: "circle", cx: "9", cy: "7", r: "4" }, { tag: "line", x1: "19", x2: "19", y1: "8", y2: "14" }, { tag: "line", x1: "22", x2: "16", y1: "11", y2: "11" }] },
|
|
233
|
+
"circle": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }] }
|
|
216
234
|
};
|
|
217
235
|
|
|
218
236
|
// virtual-pkg:src/atoms/Icon/Icon.tsx
|
|
@@ -7327,6 +7345,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7327
7345
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
7328
7346
|
var cn54 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7329
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;
|
|
7330
7349
|
var SidebarDesktop = React72.forwardRef(
|
|
7331
7350
|
({
|
|
7332
7351
|
brandName = "Linear",
|
|
@@ -7334,6 +7353,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7334
7353
|
workspaceName,
|
|
7335
7354
|
workspaceAvatarSrc,
|
|
7336
7355
|
onWorkspaceClick,
|
|
7356
|
+
headerActions,
|
|
7337
7357
|
sections,
|
|
7338
7358
|
activeId,
|
|
7339
7359
|
onNavigate,
|
|
@@ -7370,6 +7390,16 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7370
7390
|
else next.add(id);
|
|
7371
7391
|
return next;
|
|
7372
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;
|
|
7373
7403
|
const renderLink = (link, nested = false) => {
|
|
7374
7404
|
const current = link.id === activeId;
|
|
7375
7405
|
const anchor = /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
@@ -7385,8 +7415,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7385
7415
|
current ? "bg-surface-strong text-ink font-weight-label" : "text-ink hover:bg-surface-soft active:bg-surface-strong"
|
|
7386
7416
|
),
|
|
7387
7417
|
children: [
|
|
7388
|
-
|
|
7389
|
-
!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 })
|
|
7390
7421
|
]
|
|
7391
7422
|
}
|
|
7392
7423
|
);
|
|
@@ -7424,8 +7455,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7424
7455
|
onClick: () => flip(link.id),
|
|
7425
7456
|
leadingIcon: link.icon ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7426
7457
|
className: "px-sm",
|
|
7427
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7428
|
-
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 }),
|
|
7429
7461
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7430
7462
|
Icon,
|
|
7431
7463
|
{
|
|
@@ -7449,6 +7481,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7449
7481
|
] }, link.id);
|
|
7450
7482
|
};
|
|
7451
7483
|
const renderItem = (link) => link.children?.length ? renderGroup(link) : renderLink(link);
|
|
7484
|
+
const showWorkspaceRow = Boolean(workspaceName) || !collapsed && headerActions != null;
|
|
7452
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: [
|
|
7453
7486
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
7454
7487
|
"aside",
|
|
@@ -7462,17 +7495,29 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7462
7495
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7463
7496
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(IconButton, { icon: "panel-left", variant: "secondary", "aria-label": "Collapse sidebar", "aria-expanded": true, onClick: toggle })
|
|
7464
7497
|
] }),
|
|
7465
|
-
|
|
7466
|
-
|
|
7498
|
+
showWorkspaceRow && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
7499
|
+
"div",
|
|
7467
7500
|
{
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
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
|
+
]
|
|
7474
7519
|
}
|
|
7475
|
-
)
|
|
7520
|
+
),
|
|
7476
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) => {
|
|
7477
7522
|
const sectionOpen = !section.label || isOpen(section.id);
|
|
7478
7523
|
const listId = `${baseId}-section-${section.id}`;
|
|
@@ -7551,6 +7596,7 @@ var React73 = __toESM(require("react"));
|
|
|
7551
7596
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
7552
7597
|
var cn55 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7553
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;
|
|
7554
7600
|
var SidebarMobile = React73.forwardRef(
|
|
7555
7601
|
({
|
|
7556
7602
|
brandName = "Linear",
|
|
@@ -7558,6 +7604,7 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7558
7604
|
workspaceName,
|
|
7559
7605
|
workspaceAvatarSrc,
|
|
7560
7606
|
onWorkspaceClick,
|
|
7607
|
+
mobileActions,
|
|
7561
7608
|
sections,
|
|
7562
7609
|
activeId,
|
|
7563
7610
|
onNavigate,
|
|
@@ -7611,7 +7658,8 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7611
7658
|
),
|
|
7612
7659
|
children: [
|
|
7613
7660
|
link.icon && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Icon, { name: link.icon, size: 16, className: "text-body" }),
|
|
7614
|
-
/* @__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 })
|
|
7615
7663
|
]
|
|
7616
7664
|
}
|
|
7617
7665
|
) }, link.id);
|
|
@@ -7630,8 +7678,9 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7630
7678
|
onClick: () => flip(link.id),
|
|
7631
7679
|
leadingIcon: link.icon ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7632
7680
|
className: "px-sm",
|
|
7633
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7634
|
-
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 }),
|
|
7635
7684
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7636
7685
|
Icon,
|
|
7637
7686
|
{
|
|
@@ -7657,16 +7706,19 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7657
7706
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { ref, className: cn55("flex w-full flex-col bg-canvas text-ink", className), ...rest, children: [
|
|
7658
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: [
|
|
7659
7708
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7660
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
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
|
+
] })
|
|
7670
7722
|
] }),
|
|
7671
7723
|
children !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "min-w-0 flex-1", children }),
|
|
7672
7724
|
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
@@ -7763,6 +7815,8 @@ var Sidebar = React74.forwardRef(
|
|
|
7763
7815
|
onCollapsedChange,
|
|
7764
7816
|
mobileOpen,
|
|
7765
7817
|
onMobileOpenChange,
|
|
7818
|
+
headerActions,
|
|
7819
|
+
mobileActions,
|
|
7766
7820
|
children,
|
|
7767
7821
|
className,
|
|
7768
7822
|
...shared
|
|
@@ -7776,12 +7830,21 @@ var Sidebar = React74.forwardRef(
|
|
|
7776
7830
|
SidebarDesktop,
|
|
7777
7831
|
{
|
|
7778
7832
|
...shared,
|
|
7833
|
+
headerActions,
|
|
7779
7834
|
collapsed,
|
|
7780
7835
|
defaultCollapsed,
|
|
7781
7836
|
onCollapsedChange
|
|
7782
7837
|
}
|
|
7783
7838
|
) }),
|
|
7784
|
-
/* @__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
|
+
) }),
|
|
7785
7848
|
children !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "min-h-0 min-w-0 flex-1 overflow-auto", children })
|
|
7786
7849
|
]
|
|
7787
7850
|
}
|
package/dist/index.js
CHANGED
|
@@ -90,7 +90,25 @@ var ICON_REGISTRY = {
|
|
|
90
90
|
"paperclip": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }] },
|
|
91
91
|
"move-diagonal-2": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M19 13v6h-6" }, { tag: "path", d: "M5 11V5h6" }, { tag: "path", d: "m5 5 14 14" }] },
|
|
92
92
|
"fullscreen": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M3 7V5a2 2 0 0 1 2-2h2" }, { tag: "path", d: "M17 3h2a2 2 0 0 1 2 2v2" }, { tag: "path", d: "M21 17v2a2 2 0 0 1-2 2h-2" }, { tag: "path", d: "M7 21H5a2 2 0 0 1-2-2v-2" }, { tag: "rect", width: "10", height: "8", x: "7", y: "8", rx: "1" }] },
|
|
93
|
-
"scaling": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, { tag: "path", d: "M14 15H9v-5" }, { tag: "path", d: "M16 3h5v5" }, { tag: "path", d: "M21 3 9 15" }] }
|
|
93
|
+
"scaling": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, { tag: "path", d: "M14 15H9v-5" }, { tag: "path", d: "M16 3h5v5" }, { tag: "path", d: "M21 3 9 15" }] },
|
|
94
|
+
"sun": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "4" }, { tag: "path", d: "M12 2v2" }, { tag: "path", d: "M12 20v2" }, { tag: "path", d: "m4.93 4.93 1.41 1.41" }, { tag: "path", d: "m17.66 17.66 1.41 1.41" }, { tag: "path", d: "M2 12h2" }, { tag: "path", d: "M20 12h2" }, { tag: "path", d: "m6.34 17.66-1.41 1.41" }, { tag: "path", d: "m19.07 4.93-1.41 1.41" }] },
|
|
95
|
+
"moon": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }] },
|
|
96
|
+
"archive": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "20", height: "5", x: "2", y: "3", rx: "1" }, { tag: "path", d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" }, { tag: "path", d: "M10 12h4" }] },
|
|
97
|
+
"tag": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }, { tag: "circle", cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" }] },
|
|
98
|
+
"link": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }, { tag: "path", d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }] },
|
|
99
|
+
"signal-low": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M2 20h.01" }, { tag: "path", d: "M7 20v-4" }] },
|
|
100
|
+
"repeat": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m17 2 4 4-4 4" }, { tag: "path", d: "M3 11v-1a4 4 0 0 1 4-4h14" }, { tag: "path", d: "m7 22-4-4 4-4" }, { tag: "path", d: "M21 13v1a4 4 0 0 1-4 4H3" }] },
|
|
101
|
+
"target": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "circle", cx: "12", cy: "12", r: "6" }, { tag: "circle", cx: "12", cy: "12", r: "2" }] },
|
|
102
|
+
"arrow-left": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m12 19-7-7 7-7" }, { tag: "path", d: "M19 12H5" }] },
|
|
103
|
+
"square-kanban": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "18", height: "18", x: "3", y: "3", rx: "2" }, { tag: "path", d: "M8 7v7" }, { tag: "path", d: "M12 7v4" }, { tag: "path", d: "M16 7v9" }] },
|
|
104
|
+
"bell": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10.268 21a2 2 0 0 0 3.464 0" }, { tag: "path", d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" }] },
|
|
105
|
+
"play": { viewBox: "0 0 24 24", nodes: [{ tag: "polygon", points: "6 3 20 12 6 21 6 3" }] },
|
|
106
|
+
"flag": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z" }, { tag: "line", x1: "4", x2: "4", y1: "22", y2: "15" }] },
|
|
107
|
+
"eye": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }, { tag: "circle", cx: "12", cy: "12", r: "3" }] },
|
|
108
|
+
"list": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M3 12h.01" }, { tag: "path", d: "M3 18h.01" }, { tag: "path", d: "M3 6h.01" }, { tag: "path", d: "M8 12h13" }, { tag: "path", d: "M8 18h13" }, { tag: "path", d: "M8 6h13" }] },
|
|
109
|
+
"users": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }, { tag: "circle", cx: "9", cy: "7", r: "4" }, { tag: "path", d: "M22 21v-2a4 4 0 0 0-3-3.87" }, { tag: "path", d: "M16 3.13a4 4 0 0 1 0 7.75" }] },
|
|
110
|
+
"user-plus": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }, { tag: "circle", cx: "9", cy: "7", r: "4" }, { tag: "line", x1: "19", x2: "19", y1: "8", y2: "14" }, { tag: "line", x1: "22", x2: "16", y1: "11", y2: "11" }] },
|
|
111
|
+
"circle": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }] }
|
|
94
112
|
};
|
|
95
113
|
|
|
96
114
|
// virtual-pkg:src/atoms/Icon/Icon.tsx
|
|
@@ -7205,6 +7223,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
7205
7223
|
import { jsx as jsx72, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
7206
7224
|
var cn54 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7207
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;
|
|
7208
7227
|
var SidebarDesktop = React72.forwardRef(
|
|
7209
7228
|
({
|
|
7210
7229
|
brandName = "Linear",
|
|
@@ -7212,6 +7231,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7212
7231
|
workspaceName,
|
|
7213
7232
|
workspaceAvatarSrc,
|
|
7214
7233
|
onWorkspaceClick,
|
|
7234
|
+
headerActions,
|
|
7215
7235
|
sections,
|
|
7216
7236
|
activeId,
|
|
7217
7237
|
onNavigate,
|
|
@@ -7248,6 +7268,16 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7248
7268
|
else next.add(id);
|
|
7249
7269
|
return next;
|
|
7250
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;
|
|
7251
7281
|
const renderLink = (link, nested = false) => {
|
|
7252
7282
|
const current = link.id === activeId;
|
|
7253
7283
|
const anchor = /* @__PURE__ */ jsxs66(
|
|
@@ -7263,8 +7293,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7263
7293
|
current ? "bg-surface-strong text-ink font-weight-label" : "text-ink hover:bg-surface-soft active:bg-surface-strong"
|
|
7264
7294
|
),
|
|
7265
7295
|
children: [
|
|
7266
|
-
|
|
7267
|
-
!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 })
|
|
7268
7299
|
]
|
|
7269
7300
|
}
|
|
7270
7301
|
);
|
|
@@ -7302,8 +7333,9 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7302
7333
|
onClick: () => flip(link.id),
|
|
7303
7334
|
leadingIcon: link.icon ? /* @__PURE__ */ jsx72(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7304
7335
|
className: "px-sm",
|
|
7305
|
-
children: /* @__PURE__ */ jsxs66("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7306
|
-
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 }),
|
|
7307
7339
|
/* @__PURE__ */ jsx72(
|
|
7308
7340
|
Icon,
|
|
7309
7341
|
{
|
|
@@ -7327,6 +7359,7 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7327
7359
|
] }, link.id);
|
|
7328
7360
|
};
|
|
7329
7361
|
const renderItem = (link) => link.children?.length ? renderGroup(link) : renderLink(link);
|
|
7362
|
+
const showWorkspaceRow = Boolean(workspaceName) || !collapsed && headerActions != null;
|
|
7330
7363
|
return /* @__PURE__ */ jsxs66("div", { ref, className: cn54("flex h-full w-full min-h-0 bg-canvas text-ink", className), ...rest, children: [
|
|
7331
7364
|
/* @__PURE__ */ jsxs66(
|
|
7332
7365
|
"aside",
|
|
@@ -7340,17 +7373,29 @@ var SidebarDesktop = React72.forwardRef(
|
|
|
7340
7373
|
/* @__PURE__ */ jsx72(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7341
7374
|
/* @__PURE__ */ jsx72(IconButton, { icon: "panel-left", variant: "secondary", "aria-label": "Collapse sidebar", "aria-expanded": true, onClick: toggle })
|
|
7342
7375
|
] }),
|
|
7343
|
-
|
|
7344
|
-
|
|
7376
|
+
showWorkspaceRow && /* @__PURE__ */ jsxs66(
|
|
7377
|
+
"div",
|
|
7345
7378
|
{
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
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
|
+
]
|
|
7352
7397
|
}
|
|
7353
|
-
)
|
|
7398
|
+
),
|
|
7354
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) => {
|
|
7355
7400
|
const sectionOpen = !section.label || isOpen(section.id);
|
|
7356
7401
|
const listId = `${baseId}-section-${section.id}`;
|
|
@@ -7429,6 +7474,7 @@ import * as React73 from "react";
|
|
|
7429
7474
|
import { jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
7430
7475
|
var cn55 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7431
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;
|
|
7432
7478
|
var SidebarMobile = React73.forwardRef(
|
|
7433
7479
|
({
|
|
7434
7480
|
brandName = "Linear",
|
|
@@ -7436,6 +7482,7 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7436
7482
|
workspaceName,
|
|
7437
7483
|
workspaceAvatarSrc,
|
|
7438
7484
|
onWorkspaceClick,
|
|
7485
|
+
mobileActions,
|
|
7439
7486
|
sections,
|
|
7440
7487
|
activeId,
|
|
7441
7488
|
onNavigate,
|
|
@@ -7489,7 +7536,8 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7489
7536
|
),
|
|
7490
7537
|
children: [
|
|
7491
7538
|
link.icon && /* @__PURE__ */ jsx73(Icon, { name: link.icon, size: 16, className: "text-body" }),
|
|
7492
|
-
/* @__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 })
|
|
7493
7541
|
]
|
|
7494
7542
|
}
|
|
7495
7543
|
) }, link.id);
|
|
@@ -7508,8 +7556,9 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7508
7556
|
onClick: () => flip(link.id),
|
|
7509
7557
|
leadingIcon: link.icon ? /* @__PURE__ */ jsx73(Icon, { name: link.icon, size: 16, className: "text-body" }) : void 0,
|
|
7510
7558
|
className: "px-sm",
|
|
7511
|
-
children: /* @__PURE__ */ jsxs67("span", { className: "inline-flex items-center gap-xs", children: [
|
|
7512
|
-
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 }),
|
|
7513
7562
|
/* @__PURE__ */ jsx73(
|
|
7514
7563
|
Icon,
|
|
7515
7564
|
{
|
|
@@ -7535,16 +7584,19 @@ var SidebarMobile = React73.forwardRef(
|
|
|
7535
7584
|
return /* @__PURE__ */ jsxs67("div", { ref, className: cn55("flex w-full flex-col bg-canvas text-ink", className), ...rest, children: [
|
|
7536
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: [
|
|
7537
7586
|
/* @__PURE__ */ jsx73(Logo, { name: brandName, href: brandHref, size: "md" }),
|
|
7538
|
-
/* @__PURE__ */
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
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
|
+
] })
|
|
7548
7600
|
] }),
|
|
7549
7601
|
children !== void 0 && /* @__PURE__ */ jsx73("div", { className: "min-w-0 flex-1", children }),
|
|
7550
7602
|
/* @__PURE__ */ jsxs67(
|
|
@@ -7641,6 +7693,8 @@ var Sidebar = React74.forwardRef(
|
|
|
7641
7693
|
onCollapsedChange,
|
|
7642
7694
|
mobileOpen,
|
|
7643
7695
|
onMobileOpenChange,
|
|
7696
|
+
headerActions,
|
|
7697
|
+
mobileActions,
|
|
7644
7698
|
children,
|
|
7645
7699
|
className,
|
|
7646
7700
|
...shared
|
|
@@ -7654,12 +7708,21 @@ var Sidebar = React74.forwardRef(
|
|
|
7654
7708
|
SidebarDesktop,
|
|
7655
7709
|
{
|
|
7656
7710
|
...shared,
|
|
7711
|
+
headerActions,
|
|
7657
7712
|
collapsed,
|
|
7658
7713
|
defaultCollapsed,
|
|
7659
7714
|
onCollapsedChange
|
|
7660
7715
|
}
|
|
7661
7716
|
) }),
|
|
7662
|
-
/* @__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
|
+
) }),
|
|
7663
7726
|
children !== void 0 && /* @__PURE__ */ jsx74("div", { className: "min-h-0 min-w-0 flex-1 overflow-auto", children })
|
|
7664
7727
|
]
|
|
7665
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
|
@@ -75,6 +75,24 @@ export const ICON_REGISTRY = {
|
|
|
75
75
|
"move-diagonal-2": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M19 13v6h-6" }, { tag: "path", d: "M5 11V5h6" }, { tag: "path", d: "m5 5 14 14" }] },
|
|
76
76
|
"fullscreen": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M3 7V5a2 2 0 0 1 2-2h2" }, { tag: "path", d: "M17 3h2a2 2 0 0 1 2 2v2" }, { tag: "path", d: "M21 17v2a2 2 0 0 1-2 2h-2" }, { tag: "path", d: "M7 21H5a2 2 0 0 1-2-2v-2" }, { tag: "rect", width: "10", height: "8", x: "7", y: "8", rx: "1" }] },
|
|
77
77
|
"scaling": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, { tag: "path", d: "M14 15H9v-5" }, { tag: "path", d: "M16 3h5v5" }, { tag: "path", d: "M21 3 9 15" }] },
|
|
78
|
+
"sun": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "4" }, { tag: "path", d: "M12 2v2" }, { tag: "path", d: "M12 20v2" }, { tag: "path", d: "m4.93 4.93 1.41 1.41" }, { tag: "path", d: "m17.66 17.66 1.41 1.41" }, { tag: "path", d: "M2 12h2" }, { tag: "path", d: "M20 12h2" }, { tag: "path", d: "m6.34 17.66-1.41 1.41" }, { tag: "path", d: "m19.07 4.93-1.41 1.41" }] },
|
|
79
|
+
"moon": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }] },
|
|
80
|
+
"archive": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "20", height: "5", x: "2", y: "3", rx: "1" }, { tag: "path", d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" }, { tag: "path", d: "M10 12h4" }] },
|
|
81
|
+
"tag": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }, { tag: "circle", cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" }] },
|
|
82
|
+
"link": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }, { tag: "path", d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }] },
|
|
83
|
+
"signal-low": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M2 20h.01" }, { tag: "path", d: "M7 20v-4" }] },
|
|
84
|
+
"repeat": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m17 2 4 4-4 4" }, { tag: "path", d: "M3 11v-1a4 4 0 0 1 4-4h14" }, { tag: "path", d: "m7 22-4-4 4-4" }, { tag: "path", d: "M21 13v1a4 4 0 0 1-4 4H3" }] },
|
|
85
|
+
"target": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }, { tag: "circle", cx: "12", cy: "12", r: "6" }, { tag: "circle", cx: "12", cy: "12", r: "2" }] },
|
|
86
|
+
"arrow-left": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "m12 19-7-7 7-7" }, { tag: "path", d: "M19 12H5" }] },
|
|
87
|
+
"square-kanban": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "18", height: "18", x: "3", y: "3", rx: "2" }, { tag: "path", d: "M8 7v7" }, { tag: "path", d: "M12 7v4" }, { tag: "path", d: "M16 7v9" }] },
|
|
88
|
+
"bell": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M10.268 21a2 2 0 0 0 3.464 0" }, { tag: "path", d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" }] },
|
|
89
|
+
"play": { viewBox: "0 0 24 24", nodes: [{ tag: "polygon", points: "6 3 20 12 6 21 6 3" }] },
|
|
90
|
+
"flag": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z" }, { tag: "line", x1: "4", x2: "4", y1: "22", y2: "15" }] },
|
|
91
|
+
"eye": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }, { tag: "circle", cx: "12", cy: "12", r: "3" }] },
|
|
92
|
+
"list": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M3 12h.01" }, { tag: "path", d: "M3 18h.01" }, { tag: "path", d: "M3 6h.01" }, { tag: "path", d: "M8 12h13" }, { tag: "path", d: "M8 18h13" }, { tag: "path", d: "M8 6h13" }] },
|
|
93
|
+
"users": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }, { tag: "circle", cx: "9", cy: "7", r: "4" }, { tag: "path", d: "M22 21v-2a4 4 0 0 0-3-3.87" }, { tag: "path", d: "M16 3.13a4 4 0 0 1 0 7.75" }] },
|
|
94
|
+
"user-plus": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }, { tag: "circle", cx: "9", cy: "7", r: "4" }, { tag: "line", x1: "19", x2: "19", y1: "8", y2: "14" }, { tag: "line", x1: "22", x2: "16", y1: "11", y2: "11" }] },
|
|
95
|
+
"circle": { viewBox: "0 0 24 24", nodes: [{ tag: "circle", cx: "12", cy: "12", r: "10" }] },
|
|
78
96
|
} as const;
|
|
79
97
|
|
|
80
98
|
export type IconName = keyof typeof ICON_REGISTRY;
|
|
@@ -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>
|