@designa8/vibedesign-superhuman-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 +47 -10
- package/dist/index.js +54 -17
- package/dist/styles.css +15 -0
- package/package.json +1 -1
- package/src/atoms/SidebarDesktop/SidebarDesktop.tsx +66 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-superhuman-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
|
@@ -7054,7 +7054,7 @@ var defaultSidebarGroups = [
|
|
|
7054
7054
|
]
|
|
7055
7055
|
}
|
|
7056
7056
|
];
|
|
7057
|
-
var rowBase2 = "flex h-9 w-full items-center rounded-md text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue";
|
|
7057
|
+
var rowBase2 = "relative flex h-9 w-full items-center rounded-md text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue";
|
|
7058
7058
|
function NavGroup({
|
|
7059
7059
|
group,
|
|
7060
7060
|
folded,
|
|
@@ -7068,6 +7068,7 @@ function NavGroup({
|
|
|
7068
7068
|
const list = /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex flex-col gap-xxs", children: [
|
|
7069
7069
|
group.items.map((item) => {
|
|
7070
7070
|
const isActive = item.href === activeHref;
|
|
7071
|
+
const hasBadge = item.badge !== void 0 && item.badge !== null && item.badge !== "";
|
|
7071
7072
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
7072
7073
|
"a",
|
|
7073
7074
|
{
|
|
@@ -7090,7 +7091,24 @@ function NavGroup({
|
|
|
7090
7091
|
className: cn60("shrink-0", isActive ? "text-on-primary-soft" : "text-body")
|
|
7091
7092
|
}
|
|
7092
7093
|
),
|
|
7093
|
-
folded ? null : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "truncate", children: item.label })
|
|
7094
|
+
folded ? null : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "truncate", children: item.label }),
|
|
7095
|
+
hasBadge ? folded ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
7096
|
+
"span",
|
|
7097
|
+
{
|
|
7098
|
+
"aria-hidden": "true",
|
|
7099
|
+
className: "absolute right-xs top-xs h-xxs w-xxs rounded-full bg-primary"
|
|
7100
|
+
}
|
|
7101
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
7102
|
+
"span",
|
|
7103
|
+
{
|
|
7104
|
+
className: cn60(
|
|
7105
|
+
"ml-auto shrink-0 pl-xs text-body-sm tabular-nums",
|
|
7106
|
+
isActive ? "text-on-primary-soft" : "text-muted"
|
|
7107
|
+
),
|
|
7108
|
+
children: item.badge
|
|
7109
|
+
}
|
|
7110
|
+
) : null,
|
|
7111
|
+
folded && hasBadge ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "sr-only", children: item.badge }) : null
|
|
7094
7112
|
]
|
|
7095
7113
|
},
|
|
7096
7114
|
item.href
|
|
@@ -7168,6 +7186,8 @@ var SidebarDesktop = React68.forwardRef(
|
|
|
7168
7186
|
user = { name: "Avery Park" },
|
|
7169
7187
|
onHelp,
|
|
7170
7188
|
onSettings,
|
|
7189
|
+
onUserClick,
|
|
7190
|
+
footerActions,
|
|
7171
7191
|
folded: foldedProp,
|
|
7172
7192
|
defaultFolded = false,
|
|
7173
7193
|
onFoldedChange,
|
|
@@ -7182,6 +7202,11 @@ var SidebarDesktop = React68.forwardRef(
|
|
|
7182
7202
|
};
|
|
7183
7203
|
const [innerTeam, setInnerTeam] = React68.useState(teams[0]?.value);
|
|
7184
7204
|
const currentTeam = team ?? innerTeam;
|
|
7205
|
+
const hasFooterActions = Boolean(onHelp || onSettings || footerActions);
|
|
7206
|
+
const userContent = /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
7207
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Avatar, { size: "sm", name: user.name, initials: user.initials, src: user.src }),
|
|
7208
|
+
folded ? null : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "truncate text-body-md text-ink", children: user.name })
|
|
7209
|
+
] });
|
|
7185
7210
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
7186
7211
|
"aside",
|
|
7187
7212
|
{
|
|
@@ -7260,14 +7285,26 @@ var SidebarDesktop = React68.forwardRef(
|
|
|
7260
7285
|
folded ? "flex-col items-center gap-sm px-0" : "items-center justify-between gap-sm px-base"
|
|
7261
7286
|
),
|
|
7262
7287
|
children: [
|
|
7263
|
-
/* @__PURE__ */ (0, import_jsx_runtime68.
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7288
|
+
onUserClick ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
7289
|
+
Button,
|
|
7290
|
+
{
|
|
7291
|
+
variant: "item",
|
|
7292
|
+
size: "md",
|
|
7293
|
+
"aria-label": folded ? `${user.name} account menu` : void 0,
|
|
7294
|
+
"aria-haspopup": "menu",
|
|
7295
|
+
onClick: onUserClick,
|
|
7296
|
+
className: cn60(
|
|
7297
|
+
"h-9 min-w-0 text-body-md text-ink",
|
|
7298
|
+
folded ? "w-9 shrink-0 justify-center px-0" : "gap-md px-xs"
|
|
7299
|
+
),
|
|
7300
|
+
children: userContent
|
|
7301
|
+
}
|
|
7302
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "flex min-w-0 items-center gap-md", children: userContent }),
|
|
7303
|
+
hasFooterActions ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: cn60("flex items-center gap-xxs", folded && "flex-col"), children: [
|
|
7304
|
+
footerActions,
|
|
7305
|
+
onHelp ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(IconButton, { icon: "circle-help", variant: "ghost", size: "md", "aria-label": "Help", onClick: onHelp }) : null,
|
|
7306
|
+
onSettings ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(IconButton, { icon: "settings", variant: "ghost", size: "md", "aria-label": "Settings", onClick: onSettings }) : null
|
|
7307
|
+
] }) : null
|
|
7271
7308
|
]
|
|
7272
7309
|
}
|
|
7273
7310
|
)
|
package/dist/index.js
CHANGED
|
@@ -6900,7 +6900,7 @@ import * as React70 from "react";
|
|
|
6900
6900
|
|
|
6901
6901
|
// virtual-pkg:src/atoms/SidebarDesktop/SidebarDesktop.tsx
|
|
6902
6902
|
import * as React68 from "react";
|
|
6903
|
-
import { jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
6903
|
+
import { Fragment as Fragment13, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
6904
6904
|
var cn60 = (...parts) => parts.filter(Boolean).join(" ");
|
|
6905
6905
|
var defaultSidebarGroups = [
|
|
6906
6906
|
{
|
|
@@ -6930,7 +6930,7 @@ var defaultSidebarGroups = [
|
|
|
6930
6930
|
]
|
|
6931
6931
|
}
|
|
6932
6932
|
];
|
|
6933
|
-
var rowBase2 = "flex h-9 w-full items-center rounded-md text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue";
|
|
6933
|
+
var rowBase2 = "relative flex h-9 w-full items-center rounded-md text-body-md cursor-pointer transition-colors duration-150 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue";
|
|
6934
6934
|
function NavGroup({
|
|
6935
6935
|
group,
|
|
6936
6936
|
folded,
|
|
@@ -6944,6 +6944,7 @@ function NavGroup({
|
|
|
6944
6944
|
const list = /* @__PURE__ */ jsxs62("div", { className: "flex flex-col gap-xxs", children: [
|
|
6945
6945
|
group.items.map((item) => {
|
|
6946
6946
|
const isActive = item.href === activeHref;
|
|
6947
|
+
const hasBadge = item.badge !== void 0 && item.badge !== null && item.badge !== "";
|
|
6947
6948
|
return /* @__PURE__ */ jsxs62(
|
|
6948
6949
|
"a",
|
|
6949
6950
|
{
|
|
@@ -6966,7 +6967,24 @@ function NavGroup({
|
|
|
6966
6967
|
className: cn60("shrink-0", isActive ? "text-on-primary-soft" : "text-body")
|
|
6967
6968
|
}
|
|
6968
6969
|
),
|
|
6969
|
-
folded ? null : /* @__PURE__ */ jsx68("span", { className: "truncate", children: item.label })
|
|
6970
|
+
folded ? null : /* @__PURE__ */ jsx68("span", { className: "truncate", children: item.label }),
|
|
6971
|
+
hasBadge ? folded ? /* @__PURE__ */ jsx68(
|
|
6972
|
+
"span",
|
|
6973
|
+
{
|
|
6974
|
+
"aria-hidden": "true",
|
|
6975
|
+
className: "absolute right-xs top-xs h-xxs w-xxs rounded-full bg-primary"
|
|
6976
|
+
}
|
|
6977
|
+
) : /* @__PURE__ */ jsx68(
|
|
6978
|
+
"span",
|
|
6979
|
+
{
|
|
6980
|
+
className: cn60(
|
|
6981
|
+
"ml-auto shrink-0 pl-xs text-body-sm tabular-nums",
|
|
6982
|
+
isActive ? "text-on-primary-soft" : "text-muted"
|
|
6983
|
+
),
|
|
6984
|
+
children: item.badge
|
|
6985
|
+
}
|
|
6986
|
+
) : null,
|
|
6987
|
+
folded && hasBadge ? /* @__PURE__ */ jsx68("span", { className: "sr-only", children: item.badge }) : null
|
|
6970
6988
|
]
|
|
6971
6989
|
},
|
|
6972
6990
|
item.href
|
|
@@ -7044,6 +7062,8 @@ var SidebarDesktop = React68.forwardRef(
|
|
|
7044
7062
|
user = { name: "Avery Park" },
|
|
7045
7063
|
onHelp,
|
|
7046
7064
|
onSettings,
|
|
7065
|
+
onUserClick,
|
|
7066
|
+
footerActions,
|
|
7047
7067
|
folded: foldedProp,
|
|
7048
7068
|
defaultFolded = false,
|
|
7049
7069
|
onFoldedChange,
|
|
@@ -7058,6 +7078,11 @@ var SidebarDesktop = React68.forwardRef(
|
|
|
7058
7078
|
};
|
|
7059
7079
|
const [innerTeam, setInnerTeam] = React68.useState(teams[0]?.value);
|
|
7060
7080
|
const currentTeam = team ?? innerTeam;
|
|
7081
|
+
const hasFooterActions = Boolean(onHelp || onSettings || footerActions);
|
|
7082
|
+
const userContent = /* @__PURE__ */ jsxs62(Fragment13, { children: [
|
|
7083
|
+
/* @__PURE__ */ jsx68(Avatar, { size: "sm", name: user.name, initials: user.initials, src: user.src }),
|
|
7084
|
+
folded ? null : /* @__PURE__ */ jsx68("span", { className: "truncate text-body-md text-ink", children: user.name })
|
|
7085
|
+
] });
|
|
7061
7086
|
return /* @__PURE__ */ jsxs62(
|
|
7062
7087
|
"aside",
|
|
7063
7088
|
{
|
|
@@ -7136,14 +7161,26 @@ var SidebarDesktop = React68.forwardRef(
|
|
|
7136
7161
|
folded ? "flex-col items-center gap-sm px-0" : "items-center justify-between gap-sm px-base"
|
|
7137
7162
|
),
|
|
7138
7163
|
children: [
|
|
7139
|
-
/* @__PURE__ */
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7164
|
+
onUserClick ? /* @__PURE__ */ jsx68(
|
|
7165
|
+
Button,
|
|
7166
|
+
{
|
|
7167
|
+
variant: "item",
|
|
7168
|
+
size: "md",
|
|
7169
|
+
"aria-label": folded ? `${user.name} account menu` : void 0,
|
|
7170
|
+
"aria-haspopup": "menu",
|
|
7171
|
+
onClick: onUserClick,
|
|
7172
|
+
className: cn60(
|
|
7173
|
+
"h-9 min-w-0 text-body-md text-ink",
|
|
7174
|
+
folded ? "w-9 shrink-0 justify-center px-0" : "gap-md px-xs"
|
|
7175
|
+
),
|
|
7176
|
+
children: userContent
|
|
7177
|
+
}
|
|
7178
|
+
) : /* @__PURE__ */ jsx68("div", { className: "flex min-w-0 items-center gap-md", children: userContent }),
|
|
7179
|
+
hasFooterActions ? /* @__PURE__ */ jsxs62("div", { className: cn60("flex items-center gap-xxs", folded && "flex-col"), children: [
|
|
7180
|
+
footerActions,
|
|
7181
|
+
onHelp ? /* @__PURE__ */ jsx68(IconButton, { icon: "circle-help", variant: "ghost", size: "md", "aria-label": "Help", onClick: onHelp }) : null,
|
|
7182
|
+
onSettings ? /* @__PURE__ */ jsx68(IconButton, { icon: "settings", variant: "ghost", size: "md", "aria-label": "Settings", onClick: onSettings }) : null
|
|
7183
|
+
] }) : null
|
|
7147
7184
|
]
|
|
7148
7185
|
}
|
|
7149
7186
|
)
|
|
@@ -7789,7 +7826,7 @@ Spinner.displayName = "Spinner";
|
|
|
7789
7826
|
|
|
7790
7827
|
// virtual-pkg:src/atoms/StepperItem/StepperItem.tsx
|
|
7791
7828
|
import * as React73 from "react";
|
|
7792
|
-
import { Fragment as
|
|
7829
|
+
import { Fragment as Fragment14, jsx as jsx73, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
7793
7830
|
var cn64 = (...parts) => parts.filter(Boolean).join(" ");
|
|
7794
7831
|
var statusLabel2 = {
|
|
7795
7832
|
upcoming: "Upcoming",
|
|
@@ -7875,7 +7912,7 @@ var StepperItem = React73.forwardRef(
|
|
|
7875
7912
|
/* @__PURE__ */ jsxs67("div", { className: cn64("flex min-w-0 flex-col gap-xxs", !last && "pb-base"), children: [
|
|
7876
7913
|
/* @__PURE__ */ jsxs67("p", { className: "flex flex-wrap items-baseline gap-x-xs text-body-md", children: [
|
|
7877
7914
|
/* @__PURE__ */ jsx73("span", { className: cn64("text-ink", status === "active" && "font-(weight:--font-weight-heading-sm)"), children: title }),
|
|
7878
|
-
meta && /* @__PURE__ */ jsxs67(
|
|
7915
|
+
meta && /* @__PURE__ */ jsxs67(Fragment14, { children: [
|
|
7879
7916
|
/* @__PURE__ */ jsx73("span", { "aria-hidden": "true", className: "text-muted-soft", children: "\xB7" }),
|
|
7880
7917
|
/* @__PURE__ */ jsx73("span", { className: "text-muted", children: meta })
|
|
7881
7918
|
] }),
|
|
@@ -8452,7 +8489,7 @@ Toast.displayName = "Toast";
|
|
|
8452
8489
|
// virtual-pkg:src/atoms/Tooltip/Tooltip.tsx
|
|
8453
8490
|
import * as React81 from "react";
|
|
8454
8491
|
import { createPortal as createPortal9 } from "react-dom";
|
|
8455
|
-
import { Fragment as
|
|
8492
|
+
import { Fragment as Fragment15, jsx as jsx81, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
8456
8493
|
var cn72 = (...parts) => parts.filter(Boolean).join(" ");
|
|
8457
8494
|
var GAP = 10;
|
|
8458
8495
|
var closedOffset = {
|
|
@@ -8615,7 +8652,7 @@ function Tooltip({
|
|
|
8615
8652
|
]
|
|
8616
8653
|
}
|
|
8617
8654
|
);
|
|
8618
|
-
return /* @__PURE__ */ jsxs75(
|
|
8655
|
+
return /* @__PURE__ */ jsxs75(Fragment15, { children: [
|
|
8619
8656
|
trigger,
|
|
8620
8657
|
mounted ? createPortal9(bubble, document.body) : null
|
|
8621
8658
|
] });
|
|
@@ -8624,7 +8661,7 @@ Tooltip.displayName = "Tooltip";
|
|
|
8624
8661
|
|
|
8625
8662
|
// virtual-pkg:src/atoms/Wizard/Wizard.tsx
|
|
8626
8663
|
import * as React82 from "react";
|
|
8627
|
-
import { Fragment as
|
|
8664
|
+
import { Fragment as Fragment16, jsx as jsx82, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
8628
8665
|
var cn73 = (...parts) => parts.filter(Boolean).join(" ");
|
|
8629
8666
|
var Wizard = React82.forwardRef(
|
|
8630
8667
|
({
|
|
@@ -8659,7 +8696,7 @@ var Wizard = React82.forwardRef(
|
|
|
8659
8696
|
"aria-labelledby": headingId,
|
|
8660
8697
|
className: cn73("w-full", className),
|
|
8661
8698
|
actionsAlign: "end",
|
|
8662
|
-
actions: /* @__PURE__ */ jsxs76(
|
|
8699
|
+
actions: /* @__PURE__ */ jsxs76(Fragment16, { children: [
|
|
8663
8700
|
index > 0 ? /* @__PURE__ */ jsx82(Button, { variant: "outline", size: "lg", onClick: () => go(index - 1), disabled: completing, children: backLabel }) : null,
|
|
8664
8701
|
/* @__PURE__ */ jsx82(
|
|
8665
8702
|
Button,
|
package/dist/styles.css
CHANGED
|
@@ -328,6 +328,9 @@
|
|
|
328
328
|
.top-full {
|
|
329
329
|
top: 100%;
|
|
330
330
|
}
|
|
331
|
+
.top-xs {
|
|
332
|
+
top: var(--spacing-xs);
|
|
333
|
+
}
|
|
331
334
|
.-right-xxs {
|
|
332
335
|
right: calc(var(--spacing-xxs) * -1);
|
|
333
336
|
}
|
|
@@ -343,6 +346,9 @@
|
|
|
343
346
|
.right-sm {
|
|
344
347
|
right: var(--spacing-sm);
|
|
345
348
|
}
|
|
349
|
+
.right-xs {
|
|
350
|
+
right: var(--spacing-xs);
|
|
351
|
+
}
|
|
346
352
|
.-bottom-px {
|
|
347
353
|
bottom: -1px;
|
|
348
354
|
}
|
|
@@ -634,6 +640,9 @@
|
|
|
634
640
|
.h-px {
|
|
635
641
|
height: 1px;
|
|
636
642
|
}
|
|
643
|
+
.h-xxs {
|
|
644
|
+
height: var(--spacing-xxs);
|
|
645
|
+
}
|
|
637
646
|
.max-h-72 {
|
|
638
647
|
max-height: calc(var(--spacing) * 72);
|
|
639
648
|
}
|
|
@@ -763,6 +772,9 @@
|
|
|
763
772
|
.w-px {
|
|
764
773
|
width: 1px;
|
|
765
774
|
}
|
|
775
|
+
.w-xxs {
|
|
776
|
+
width: var(--spacing-xxs);
|
|
777
|
+
}
|
|
766
778
|
.max-w-0 {
|
|
767
779
|
max-width: 0;
|
|
768
780
|
}
|
|
@@ -1509,6 +1521,9 @@
|
|
|
1509
1521
|
.pl-sm {
|
|
1510
1522
|
padding-left: var(--spacing-sm);
|
|
1511
1523
|
}
|
|
1524
|
+
.pl-xs {
|
|
1525
|
+
padding-left: var(--spacing-xs);
|
|
1526
|
+
}
|
|
1512
1527
|
.text-center {
|
|
1513
1528
|
text-align: center;
|
|
1514
1529
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designa8/vibedesign-superhuman-internal-v1-2-176b",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Complete design system \"My Project superhuman-internal-v1\" generated by Atoms Design.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -11,6 +11,8 @@ export interface SidebarNavItem {
|
|
|
11
11
|
label: string;
|
|
12
12
|
href: string;
|
|
13
13
|
icon: IconName;
|
|
14
|
+
/** Right-aligned count in the row, e.g. unread messages. Folds to a dot on the rail. */
|
|
15
|
+
badge?: number | string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export interface SidebarNavGroup {
|
|
@@ -39,8 +41,14 @@ export interface SidebarDesktopProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
39
41
|
promo?: { title: string; description?: string; href?: string } | null;
|
|
40
42
|
/** Signed-in person in the footer. */
|
|
41
43
|
user?: { name: string; initials?: string; src?: string };
|
|
44
|
+
/** Renders the Help button in the footer. Omit to hide it. */
|
|
42
45
|
onHelp?: () => void;
|
|
46
|
+
/** Renders the Settings button in the footer. Omit to hide it. */
|
|
43
47
|
onSettings?: () => void;
|
|
48
|
+
/** Turns the footer person into a button, e.g. to open an account menu. */
|
|
49
|
+
onUserClick?: () => void;
|
|
50
|
+
/** Extra controls in the footer, after help/settings (e.g. a theme toggle). */
|
|
51
|
+
footerActions?: React.ReactNode;
|
|
44
52
|
/** Folded (icon rail) state, controlled. */
|
|
45
53
|
folded?: boolean;
|
|
46
54
|
defaultFolded?: boolean;
|
|
@@ -79,7 +87,7 @@ export const defaultSidebarGroups: SidebarNavGroup[] = [
|
|
|
79
87
|
];
|
|
80
88
|
|
|
81
89
|
const rowBase =
|
|
82
|
-
"flex h-9 w-full items-center rounded-md text-body-md cursor-pointer transition-colors duration-150 ease-out " +
|
|
90
|
+
"relative flex h-9 w-full items-center rounded-md text-body-md cursor-pointer transition-colors duration-150 ease-out " +
|
|
83
91
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue";
|
|
84
92
|
|
|
85
93
|
function NavGroup({
|
|
@@ -103,6 +111,7 @@ function NavGroup({
|
|
|
103
111
|
<div className="flex flex-col gap-xxs">
|
|
104
112
|
{group.items.map((item) => {
|
|
105
113
|
const isActive = item.href === activeHref;
|
|
114
|
+
const hasBadge = item.badge !== undefined && item.badge !== null && item.badge !== "";
|
|
106
115
|
return (
|
|
107
116
|
<a
|
|
108
117
|
key={item.href}
|
|
@@ -125,6 +134,24 @@ function NavGroup({
|
|
|
125
134
|
className={cn("shrink-0", isActive ? "text-on-primary-soft" : "text-body")}
|
|
126
135
|
/>
|
|
127
136
|
{folded ? null : <span className="truncate">{item.label}</span>}
|
|
137
|
+
{hasBadge ? (
|
|
138
|
+
folded ? (
|
|
139
|
+
<span
|
|
140
|
+
aria-hidden="true"
|
|
141
|
+
className="absolute right-xs top-xs h-xxs w-xxs rounded-full bg-primary"
|
|
142
|
+
/>
|
|
143
|
+
) : (
|
|
144
|
+
<span
|
|
145
|
+
className={cn(
|
|
146
|
+
"ml-auto shrink-0 pl-xs text-body-sm tabular-nums",
|
|
147
|
+
isActive ? "text-on-primary-soft" : "text-muted",
|
|
148
|
+
)}
|
|
149
|
+
>
|
|
150
|
+
{item.badge}
|
|
151
|
+
</span>
|
|
152
|
+
)
|
|
153
|
+
) : null}
|
|
154
|
+
{folded && hasBadge ? <span className="sr-only">{item.badge}</span> : null}
|
|
128
155
|
</a>
|
|
129
156
|
);
|
|
130
157
|
})}
|
|
@@ -210,6 +237,8 @@ export const SidebarDesktop = React.forwardRef<HTMLElement, SidebarDesktopProps>
|
|
|
210
237
|
user = { name: "Avery Park" },
|
|
211
238
|
onHelp,
|
|
212
239
|
onSettings,
|
|
240
|
+
onUserClick,
|
|
241
|
+
footerActions,
|
|
213
242
|
folded: foldedProp,
|
|
214
243
|
defaultFolded = false,
|
|
215
244
|
onFoldedChange,
|
|
@@ -226,6 +255,14 @@ export const SidebarDesktop = React.forwardRef<HTMLElement, SidebarDesktopProps>
|
|
|
226
255
|
};
|
|
227
256
|
const [innerTeam, setInnerTeam] = React.useState(teams[0]?.value);
|
|
228
257
|
const currentTeam = team ?? innerTeam;
|
|
258
|
+
const hasFooterActions = Boolean(onHelp || onSettings || footerActions);
|
|
259
|
+
|
|
260
|
+
const userContent = (
|
|
261
|
+
<>
|
|
262
|
+
<Avatar size="sm" name={user.name} initials={user.initials} src={user.src} />
|
|
263
|
+
{folded ? null : <span className="truncate text-body-md text-ink">{user.name}</span>}
|
|
264
|
+
</>
|
|
265
|
+
);
|
|
229
266
|
|
|
230
267
|
return (
|
|
231
268
|
<aside
|
|
@@ -310,14 +347,34 @@ export const SidebarDesktop = React.forwardRef<HTMLElement, SidebarDesktopProps>
|
|
|
310
347
|
folded ? "flex-col items-center gap-sm px-0" : "items-center justify-between gap-sm px-base",
|
|
311
348
|
)}
|
|
312
349
|
>
|
|
313
|
-
|
|
314
|
-
<
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
350
|
+
{onUserClick ? (
|
|
351
|
+
<Button
|
|
352
|
+
variant="item"
|
|
353
|
+
size="md"
|
|
354
|
+
aria-label={folded ? `${user.name} account menu` : undefined}
|
|
355
|
+
aria-haspopup="menu"
|
|
356
|
+
onClick={onUserClick}
|
|
357
|
+
className={cn(
|
|
358
|
+
"h-9 min-w-0 text-body-md text-ink",
|
|
359
|
+
folded ? "w-9 shrink-0 justify-center px-0" : "gap-md px-xs",
|
|
360
|
+
)}
|
|
361
|
+
>
|
|
362
|
+
{userContent}
|
|
363
|
+
</Button>
|
|
364
|
+
) : (
|
|
365
|
+
<div className="flex min-w-0 items-center gap-md">{userContent}</div>
|
|
366
|
+
)}
|
|
367
|
+
{hasFooterActions ? (
|
|
368
|
+
<div className={cn("flex items-center gap-xxs", folded && "flex-col")}>
|
|
369
|
+
{footerActions}
|
|
370
|
+
{onHelp ? (
|
|
371
|
+
<IconButton icon="circle-help" variant="ghost" size="md" aria-label="Help" onClick={onHelp} />
|
|
372
|
+
) : null}
|
|
373
|
+
{onSettings ? (
|
|
374
|
+
<IconButton icon="settings" variant="ghost" size="md" aria-label="Settings" onClick={onSettings} />
|
|
375
|
+
) : null}
|
|
376
|
+
</div>
|
|
377
|
+
) : null}
|
|
321
378
|
</div>
|
|
322
379
|
</aside>
|
|
323
380
|
);
|