@designa8/vibedesign-linear-internal-v1-b737 0.12.4 → 0.12.6
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 +89 -21
- package/dist/index.js +89 -21
- package/dist/styles.css +3 -0
- package/package.json +1 -1
- package/src/molecules/CodePreview/CodePreview.tsx +6 -1
- package/src/molecules/CodePreview/preview.tsx +8 -1
- package/src/molecules/DropdownMenu/DropdownMenu.tsx +2 -1
- package/src/organisms/ChatWindow/ChatWindow.tsx +2 -1
- package/src/organisms/CodeEditor/CodeEditor.tsx +4 -1
- package/src/organisms/Drawer/Drawer.tsx +3 -1
- package/src/organisms/Modal/Modal.tsx +2 -1
- package/src/organisms/PromptInputBar/PromptInputBar.tsx +3 -1
- package/src/organisms/Sidebar/Sidebar.tsx +10 -0
- package/src/organisms/Sidebar/preview.tsx +51 -23
- package/src/organisms/SidebarDesktop/SidebarDesktop.tsx +67 -14
- package/src/organisms/SidebarMobile/SidebarMobile.tsx +48 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-linear-internal-v1-b737
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.12.
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.12.6**.
|
|
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
|
@@ -2965,6 +2965,7 @@ var CodePreview = React33.forwardRef(
|
|
|
2965
2965
|
}).catch(() => {
|
|
2966
2966
|
});
|
|
2967
2967
|
};
|
|
2968
|
+
const overscroll = wrap ? "overscroll-y-contain" : "overscroll-contain";
|
|
2968
2969
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
2969
2970
|
"div",
|
|
2970
2971
|
{
|
|
@@ -2996,7 +2997,8 @@ var CodePreview = React33.forwardRef(
|
|
|
2996
2997
|
"aria-label": capped ? ariaLabel : void 0,
|
|
2997
2998
|
className: cn22(
|
|
2998
2999
|
"px-md py-sm font-mono text-caption focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue",
|
|
2999
|
-
capped && "max-h-64 overflow-y-auto
|
|
3000
|
+
capped && "max-h-64 overflow-y-auto",
|
|
3001
|
+
capped && overscroll,
|
|
3000
3002
|
!wrap && "overflow-x-auto"
|
|
3001
3003
|
),
|
|
3002
3004
|
children: rows.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-md", children: [
|
|
@@ -4467,7 +4469,7 @@ var DropdownMenu = React40.forwardRef(
|
|
|
4467
4469
|
children: header
|
|
4468
4470
|
}
|
|
4469
4471
|
) : null,
|
|
4470
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain p-xs", children: items.map((entry, index) => {
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-y-contain p-xs", children: items.map((entry, index) => {
|
|
4471
4473
|
if (isSeparator(entry)) {
|
|
4472
4474
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Divider, { tone: "soft", className: "my-xs" }, entry.id);
|
|
4473
4475
|
}
|
|
@@ -6791,7 +6793,8 @@ var Modal = React58.forwardRef(
|
|
|
6791
6793
|
"div",
|
|
6792
6794
|
{
|
|
6793
6795
|
className: cn45(
|
|
6794
|
-
|
|
6796
|
+
// Vertical-only containment keeps the horizontal back/forward swipe working.
|
|
6797
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-lg pb-lg",
|
|
6795
6798
|
hasHeader ? "pt-xs" : "pt-lg",
|
|
6796
6799
|
bodyClassName
|
|
6797
6800
|
),
|
|
@@ -7726,7 +7729,7 @@ var ChatWindow = React63.forwardRef(
|
|
|
7726
7729
|
role: "log",
|
|
7727
7730
|
"aria-label": "Messages",
|
|
7728
7731
|
"aria-live": "polite",
|
|
7729
|
-
className: "flex min-h-64 max-h-96 flex-col gap-lg overflow-y-auto overscroll-contain px-base py-base",
|
|
7732
|
+
className: "flex min-h-64 max-h-96 flex-col gap-lg overflow-y-auto overscroll-y-contain px-base py-base",
|
|
7730
7733
|
children: threads.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-xs py-xl text-center", children: [
|
|
7731
7734
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Icon, { name: "message-circle", size: 32, strokeWidth: 1.5, className: "text-muted-soft" }),
|
|
7732
7735
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "mt-sm text-heading-sm text-ink", children: emptyTitle }),
|
|
@@ -8074,7 +8077,7 @@ var CodeEditor = React64.forwardRef(
|
|
|
8074
8077
|
),
|
|
8075
8078
|
...rest,
|
|
8076
8079
|
children: [
|
|
8077
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("aside", { className: "flex w-56 min-h-0 shrink-0 flex-col overflow-y-auto overscroll-contain border-r border-hairline bg-canvas", children: [
|
|
8080
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("aside", { className: "flex w-56 min-h-0 shrink-0 flex-col overflow-y-auto overscroll-y-contain border-r border-hairline bg-canvas", children: [
|
|
8078
8081
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "flex items-center px-base py-md", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "text-overline text-muted-soft", children: "Files" }) }),
|
|
8079
8082
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("nav", { className: "flex flex-col gap-xxs px-sm pb-base", "aria-label": "Files", children: [
|
|
8080
8083
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
@@ -9000,7 +9003,7 @@ var Drawer = React70.forwardRef(
|
|
|
9000
9003
|
"div",
|
|
9001
9004
|
{
|
|
9002
9005
|
className: cn55(
|
|
9003
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-base pb-base pt-xs",
|
|
9006
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-base pb-base pt-xs",
|
|
9004
9007
|
bodyClassName
|
|
9005
9008
|
),
|
|
9006
9009
|
children
|
|
@@ -11203,7 +11206,7 @@ var PromptInputBar = React89.forwardRef(
|
|
|
11203
11206
|
zIndex: "var(--z-popover, 1300)"
|
|
11204
11207
|
},
|
|
11205
11208
|
className: MENU_PANEL,
|
|
11206
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-contain", children: [
|
|
11209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain", children: [
|
|
11207
11210
|
hasModels ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex flex-col gap-xxs", children: [
|
|
11208
11211
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "px-sm pb-xxs pt-xs text-overline text-muted", children: "Model" }),
|
|
11209
11212
|
models?.map((m) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
@@ -11711,6 +11714,8 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11711
11714
|
workspaceName,
|
|
11712
11715
|
workspaceAvatarSrc,
|
|
11713
11716
|
onWorkspaceClick,
|
|
11717
|
+
workspaceMenuItems,
|
|
11718
|
+
workspaceMenuHeader,
|
|
11714
11719
|
workspacePlacement = "top",
|
|
11715
11720
|
headerActions,
|
|
11716
11721
|
sections,
|
|
@@ -11738,6 +11743,7 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11738
11743
|
if (collapsedProp === void 0) setInnerCollapsed(next);
|
|
11739
11744
|
onCollapsedChange?.(next);
|
|
11740
11745
|
};
|
|
11746
|
+
const [workspaceMenuOpen, setWorkspaceMenuOpen] = React91.useState(false);
|
|
11741
11747
|
const [expanded, setExpanded] = React91.useState(
|
|
11742
11748
|
() => new Set(
|
|
11743
11749
|
defaultExpanded ?? sections.filter((s) => s.label).map((s) => s.id)
|
|
@@ -11847,6 +11853,23 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11847
11853
|
const renderItem = (link) => link.children?.length ? renderGroup(link) : renderLink(link);
|
|
11848
11854
|
const showWorkspaceRow = Boolean(workspaceName) || !collapsed && headerActions != null;
|
|
11849
11855
|
const workspaceAtBottom = workspacePlacement === "bottom";
|
|
11856
|
+
const workspaceMenuMode = workspaceMenuItems !== void 0;
|
|
11857
|
+
const workspaceOnClick = workspaceMenuMode ? void 0 : onWorkspaceClick;
|
|
11858
|
+
const workspaceChevronOpen = workspaceMenuMode && workspaceMenuOpen;
|
|
11859
|
+
const withWorkspaceMenu = (button, wrapperClassName) => workspaceMenuMode ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
11860
|
+
DropdownMenu,
|
|
11861
|
+
{
|
|
11862
|
+
trigger: button,
|
|
11863
|
+
items: workspaceMenuItems ?? [],
|
|
11864
|
+
header: workspaceMenuHeader,
|
|
11865
|
+
align: "start",
|
|
11866
|
+
side: workspaceAtBottom ? "top" : "bottom",
|
|
11867
|
+
open: workspaceMenuOpen,
|
|
11868
|
+
onOpenChange: setWorkspaceMenuOpen,
|
|
11869
|
+
"aria-label": "Workspace",
|
|
11870
|
+
className: wrapperClassName
|
|
11871
|
+
}
|
|
11872
|
+
) : button;
|
|
11850
11873
|
const workspaceRow = showWorkspaceRow ? /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
11851
11874
|
"div",
|
|
11852
11875
|
{
|
|
@@ -11856,16 +11879,32 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11856
11879
|
workspaceAtBottom ? "border-t border-hairline py-sm" : "pb-sm"
|
|
11857
11880
|
),
|
|
11858
11881
|
children: [
|
|
11859
|
-
workspaceName ? collapsed ?
|
|
11860
|
-
Button,
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11882
|
+
workspaceName ? collapsed ? withWorkspaceMenu(
|
|
11883
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Button, { variant: "ghost", iconOnly: true, "aria-label": workspaceName, onClick: workspaceOnClick, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }) }),
|
|
11884
|
+
"shrink-0"
|
|
11885
|
+
) : withWorkspaceMenu(
|
|
11886
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
11887
|
+
Button,
|
|
11888
|
+
{
|
|
11889
|
+
variant: "ghost",
|
|
11890
|
+
onClick: workspaceOnClick,
|
|
11891
|
+
className: "min-w-0 flex-1 justify-start px-sm",
|
|
11892
|
+
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }),
|
|
11893
|
+
trailingIcon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
11894
|
+
Icon,
|
|
11895
|
+
{
|
|
11896
|
+
name: "chevron-down",
|
|
11897
|
+
size: 14,
|
|
11898
|
+
className: cn70(
|
|
11899
|
+
"text-muted transition-transform duration-200 ease-out",
|
|
11900
|
+
workspaceChevronOpen && "rotate-180"
|
|
11901
|
+
)
|
|
11902
|
+
}
|
|
11903
|
+
),
|
|
11904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "min-w-0 truncate text-ink", children: workspaceName })
|
|
11905
|
+
}
|
|
11906
|
+
),
|
|
11907
|
+
"min-w-0 flex-1"
|
|
11869
11908
|
) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("span", { className: "min-w-0 flex-1" }),
|
|
11870
11909
|
!collapsed && headerActions != null && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "flex shrink-0 items-center gap-xxs", children: headerActions })
|
|
11871
11910
|
]
|
|
@@ -11885,7 +11924,7 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11885
11924
|
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(IconButton, { icon: "panel-left", variant: "secondary", "aria-label": "Collapse sidebar", onClick: toggle })
|
|
11886
11925
|
] }),
|
|
11887
11926
|
!workspaceAtBottom && workspaceRow,
|
|
11888
|
-
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("nav", { "aria-label": "Main", className: cn70("min-h-0 flex-1 overflow-y-auto overscroll-contain pb-sm", collapsed ? "px-0" : "px-sm"), children: sections.map((section, i) => {
|
|
11927
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("nav", { "aria-label": "Main", className: cn70("min-h-0 flex-1 overflow-y-auto overscroll-y-contain pb-sm", collapsed ? "px-0" : "px-sm"), children: sections.map((section, i) => {
|
|
11889
11928
|
const sectionOpen = !section.label || isOpen(section.id);
|
|
11890
11929
|
const listId = `${baseId}-section-${section.id}`;
|
|
11891
11930
|
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: i > 0 ? "mt-base" : void 0, children: [
|
|
@@ -11980,6 +12019,8 @@ var SidebarMobile = React92.forwardRef(
|
|
|
11980
12019
|
workspaceName,
|
|
11981
12020
|
workspaceAvatarSrc,
|
|
11982
12021
|
onWorkspaceClick,
|
|
12022
|
+
workspaceMenuItems,
|
|
12023
|
+
workspaceMenuHeader,
|
|
11983
12024
|
workspacePlacement = "top",
|
|
11984
12025
|
mobileActions,
|
|
11985
12026
|
sections,
|
|
@@ -12018,6 +12059,7 @@ var SidebarMobile = React92.forwardRef(
|
|
|
12018
12059
|
else next.add(id);
|
|
12019
12060
|
return next;
|
|
12020
12061
|
});
|
|
12062
|
+
const [workspaceMenuOpen, setWorkspaceMenuOpen] = React92.useState(false);
|
|
12021
12063
|
const showHelpAction = onHelpClick !== void 0;
|
|
12022
12064
|
const showSettingsAction = onSettingsClick !== void 0;
|
|
12023
12065
|
const showFooterActions = showHelpAction || showSettingsAction;
|
|
@@ -12086,17 +12128,43 @@ var SidebarMobile = React92.forwardRef(
|
|
|
12086
12128
|
)
|
|
12087
12129
|
] }, link.id);
|
|
12088
12130
|
};
|
|
12089
|
-
const
|
|
12131
|
+
const workspaceMenuMode = workspaceMenuItems !== void 0;
|
|
12132
|
+
const workspaceButtonNode = workspaceName ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
12090
12133
|
Button,
|
|
12091
12134
|
{
|
|
12092
12135
|
variant: "ghost",
|
|
12093
|
-
onClick: onWorkspaceClick,
|
|
12136
|
+
onClick: workspaceMenuMode ? void 0 : onWorkspaceClick,
|
|
12094
12137
|
className: "px-sm",
|
|
12138
|
+
fullWidth: workspaceMenuMode,
|
|
12095
12139
|
leadingIcon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }),
|
|
12096
|
-
trailingIcon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
12140
|
+
trailingIcon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
12141
|
+
Icon,
|
|
12142
|
+
{
|
|
12143
|
+
name: "chevron-down",
|
|
12144
|
+
size: 14,
|
|
12145
|
+
className: cn71(
|
|
12146
|
+
"text-muted transition-transform duration-200 ease-out",
|
|
12147
|
+
workspaceMenuMode && workspaceMenuOpen && "rotate-180"
|
|
12148
|
+
)
|
|
12149
|
+
}
|
|
12150
|
+
),
|
|
12097
12151
|
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "text-ink", children: workspaceName })
|
|
12098
12152
|
}
|
|
12099
12153
|
) : null;
|
|
12154
|
+
const workspaceButton = workspaceButtonNode && workspaceMenuMode ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
12155
|
+
DropdownMenu,
|
|
12156
|
+
{
|
|
12157
|
+
trigger: workspaceButtonNode,
|
|
12158
|
+
items: workspaceMenuItems ?? [],
|
|
12159
|
+
header: workspaceMenuHeader,
|
|
12160
|
+
align: "start",
|
|
12161
|
+
side: workspaceAtBottom ? "top" : "bottom",
|
|
12162
|
+
open: workspaceMenuOpen,
|
|
12163
|
+
onOpenChange: setWorkspaceMenuOpen,
|
|
12164
|
+
"aria-label": "Workspace",
|
|
12165
|
+
className: "w-full"
|
|
12166
|
+
}
|
|
12167
|
+
) : workspaceButtonNode;
|
|
12100
12168
|
const userRow = showFooterRow ? /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex w-full items-center justify-between", children: [
|
|
12101
12169
|
userName ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Avatar, { name: userName, src: userAvatarSrc, size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", {}),
|
|
12102
12170
|
showFooterActions && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-center gap-xxs", children: [
|
package/dist/index.js
CHANGED
|
@@ -2820,6 +2820,7 @@ var CodePreview = React33.forwardRef(
|
|
|
2820
2820
|
}).catch(() => {
|
|
2821
2821
|
});
|
|
2822
2822
|
};
|
|
2823
|
+
const overscroll = wrap ? "overscroll-y-contain" : "overscroll-contain";
|
|
2823
2824
|
return /* @__PURE__ */ jsxs27(
|
|
2824
2825
|
"div",
|
|
2825
2826
|
{
|
|
@@ -2851,7 +2852,8 @@ var CodePreview = React33.forwardRef(
|
|
|
2851
2852
|
"aria-label": capped ? ariaLabel : void 0,
|
|
2852
2853
|
className: cn22(
|
|
2853
2854
|
"px-md py-sm font-mono text-caption focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue",
|
|
2854
|
-
capped && "max-h-64 overflow-y-auto
|
|
2855
|
+
capped && "max-h-64 overflow-y-auto",
|
|
2856
|
+
capped && overscroll,
|
|
2855
2857
|
!wrap && "overflow-x-auto"
|
|
2856
2858
|
),
|
|
2857
2859
|
children: rows.map((line, index) => /* @__PURE__ */ jsxs27("div", { className: "flex gap-md", children: [
|
|
@@ -4322,7 +4324,7 @@ var DropdownMenu = React40.forwardRef(
|
|
|
4322
4324
|
children: header
|
|
4323
4325
|
}
|
|
4324
4326
|
) : null,
|
|
4325
|
-
/* @__PURE__ */ jsx40("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain p-xs", children: items.map((entry, index) => {
|
|
4327
|
+
/* @__PURE__ */ jsx40("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-y-contain p-xs", children: items.map((entry, index) => {
|
|
4326
4328
|
if (isSeparator(entry)) {
|
|
4327
4329
|
return /* @__PURE__ */ jsx40(Divider, { tone: "soft", className: "my-xs" }, entry.id);
|
|
4328
4330
|
}
|
|
@@ -6646,7 +6648,8 @@ var Modal = React58.forwardRef(
|
|
|
6646
6648
|
"div",
|
|
6647
6649
|
{
|
|
6648
6650
|
className: cn45(
|
|
6649
|
-
|
|
6651
|
+
// Vertical-only containment keeps the horizontal back/forward swipe working.
|
|
6652
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-lg pb-lg",
|
|
6650
6653
|
hasHeader ? "pt-xs" : "pt-lg",
|
|
6651
6654
|
bodyClassName
|
|
6652
6655
|
),
|
|
@@ -7581,7 +7584,7 @@ var ChatWindow = React63.forwardRef(
|
|
|
7581
7584
|
role: "log",
|
|
7582
7585
|
"aria-label": "Messages",
|
|
7583
7586
|
"aria-live": "polite",
|
|
7584
|
-
className: "flex min-h-64 max-h-96 flex-col gap-lg overflow-y-auto overscroll-contain px-base py-base",
|
|
7587
|
+
className: "flex min-h-64 max-h-96 flex-col gap-lg overflow-y-auto overscroll-y-contain px-base py-base",
|
|
7585
7588
|
children: threads.length === 0 ? /* @__PURE__ */ jsxs55("div", { className: "flex flex-1 flex-col items-center justify-center gap-xs py-xl text-center", children: [
|
|
7586
7589
|
/* @__PURE__ */ jsx63(Icon, { name: "message-circle", size: 32, strokeWidth: 1.5, className: "text-muted-soft" }),
|
|
7587
7590
|
/* @__PURE__ */ jsx63("p", { className: "mt-sm text-heading-sm text-ink", children: emptyTitle }),
|
|
@@ -7929,7 +7932,7 @@ var CodeEditor = React64.forwardRef(
|
|
|
7929
7932
|
),
|
|
7930
7933
|
...rest,
|
|
7931
7934
|
children: [
|
|
7932
|
-
/* @__PURE__ */ jsxs56("aside", { className: "flex w-56 min-h-0 shrink-0 flex-col overflow-y-auto overscroll-contain border-r border-hairline bg-canvas", children: [
|
|
7935
|
+
/* @__PURE__ */ jsxs56("aside", { className: "flex w-56 min-h-0 shrink-0 flex-col overflow-y-auto overscroll-y-contain border-r border-hairline bg-canvas", children: [
|
|
7933
7936
|
/* @__PURE__ */ jsx64("div", { className: "flex items-center px-base py-md", children: /* @__PURE__ */ jsx64("span", { className: "text-overline text-muted-soft", children: "Files" }) }),
|
|
7934
7937
|
/* @__PURE__ */ jsxs56("nav", { className: "flex flex-col gap-xxs px-sm pb-base", "aria-label": "Files", children: [
|
|
7935
7938
|
/* @__PURE__ */ jsx64(
|
|
@@ -8855,7 +8858,7 @@ var Drawer = React70.forwardRef(
|
|
|
8855
8858
|
"div",
|
|
8856
8859
|
{
|
|
8857
8860
|
className: cn55(
|
|
8858
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-base pb-base pt-xs",
|
|
8861
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-base pb-base pt-xs",
|
|
8859
8862
|
bodyClassName
|
|
8860
8863
|
),
|
|
8861
8864
|
children
|
|
@@ -11058,7 +11061,7 @@ var PromptInputBar = React89.forwardRef(
|
|
|
11058
11061
|
zIndex: "var(--z-popover, 1300)"
|
|
11059
11062
|
},
|
|
11060
11063
|
className: MENU_PANEL,
|
|
11061
|
-
children: /* @__PURE__ */ jsxs81("div", { className: "flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-contain", children: [
|
|
11064
|
+
children: /* @__PURE__ */ jsxs81("div", { className: "flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain", children: [
|
|
11062
11065
|
hasModels ? /* @__PURE__ */ jsxs81("div", { className: "flex flex-col gap-xxs", children: [
|
|
11063
11066
|
/* @__PURE__ */ jsx89("span", { className: "px-sm pb-xxs pt-xs text-overline text-muted", children: "Model" }),
|
|
11064
11067
|
models?.map((m) => /* @__PURE__ */ jsx89(
|
|
@@ -11566,6 +11569,8 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11566
11569
|
workspaceName,
|
|
11567
11570
|
workspaceAvatarSrc,
|
|
11568
11571
|
onWorkspaceClick,
|
|
11572
|
+
workspaceMenuItems,
|
|
11573
|
+
workspaceMenuHeader,
|
|
11569
11574
|
workspacePlacement = "top",
|
|
11570
11575
|
headerActions,
|
|
11571
11576
|
sections,
|
|
@@ -11593,6 +11598,7 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11593
11598
|
if (collapsedProp === void 0) setInnerCollapsed(next);
|
|
11594
11599
|
onCollapsedChange?.(next);
|
|
11595
11600
|
};
|
|
11601
|
+
const [workspaceMenuOpen, setWorkspaceMenuOpen] = React91.useState(false);
|
|
11596
11602
|
const [expanded, setExpanded] = React91.useState(
|
|
11597
11603
|
() => new Set(
|
|
11598
11604
|
defaultExpanded ?? sections.filter((s) => s.label).map((s) => s.id)
|
|
@@ -11702,6 +11708,23 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11702
11708
|
const renderItem = (link) => link.children?.length ? renderGroup(link) : renderLink(link);
|
|
11703
11709
|
const showWorkspaceRow = Boolean(workspaceName) || !collapsed && headerActions != null;
|
|
11704
11710
|
const workspaceAtBottom = workspacePlacement === "bottom";
|
|
11711
|
+
const workspaceMenuMode = workspaceMenuItems !== void 0;
|
|
11712
|
+
const workspaceOnClick = workspaceMenuMode ? void 0 : onWorkspaceClick;
|
|
11713
|
+
const workspaceChevronOpen = workspaceMenuMode && workspaceMenuOpen;
|
|
11714
|
+
const withWorkspaceMenu = (button, wrapperClassName) => workspaceMenuMode ? /* @__PURE__ */ jsx91(
|
|
11715
|
+
DropdownMenu,
|
|
11716
|
+
{
|
|
11717
|
+
trigger: button,
|
|
11718
|
+
items: workspaceMenuItems ?? [],
|
|
11719
|
+
header: workspaceMenuHeader,
|
|
11720
|
+
align: "start",
|
|
11721
|
+
side: workspaceAtBottom ? "top" : "bottom",
|
|
11722
|
+
open: workspaceMenuOpen,
|
|
11723
|
+
onOpenChange: setWorkspaceMenuOpen,
|
|
11724
|
+
"aria-label": "Workspace",
|
|
11725
|
+
className: wrapperClassName
|
|
11726
|
+
}
|
|
11727
|
+
) : button;
|
|
11705
11728
|
const workspaceRow = showWorkspaceRow ? /* @__PURE__ */ jsxs83(
|
|
11706
11729
|
"div",
|
|
11707
11730
|
{
|
|
@@ -11711,16 +11734,32 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11711
11734
|
workspaceAtBottom ? "border-t border-hairline py-sm" : "pb-sm"
|
|
11712
11735
|
),
|
|
11713
11736
|
children: [
|
|
11714
|
-
workspaceName ? collapsed ?
|
|
11715
|
-
Button,
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11737
|
+
workspaceName ? collapsed ? withWorkspaceMenu(
|
|
11738
|
+
/* @__PURE__ */ jsx91(Button, { variant: "ghost", iconOnly: true, "aria-label": workspaceName, onClick: workspaceOnClick, children: /* @__PURE__ */ jsx91(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }) }),
|
|
11739
|
+
"shrink-0"
|
|
11740
|
+
) : withWorkspaceMenu(
|
|
11741
|
+
/* @__PURE__ */ jsx91(
|
|
11742
|
+
Button,
|
|
11743
|
+
{
|
|
11744
|
+
variant: "ghost",
|
|
11745
|
+
onClick: workspaceOnClick,
|
|
11746
|
+
className: "min-w-0 flex-1 justify-start px-sm",
|
|
11747
|
+
leadingIcon: /* @__PURE__ */ jsx91(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }),
|
|
11748
|
+
trailingIcon: /* @__PURE__ */ jsx91(
|
|
11749
|
+
Icon,
|
|
11750
|
+
{
|
|
11751
|
+
name: "chevron-down",
|
|
11752
|
+
size: 14,
|
|
11753
|
+
className: cn70(
|
|
11754
|
+
"text-muted transition-transform duration-200 ease-out",
|
|
11755
|
+
workspaceChevronOpen && "rotate-180"
|
|
11756
|
+
)
|
|
11757
|
+
}
|
|
11758
|
+
),
|
|
11759
|
+
children: /* @__PURE__ */ jsx91("span", { className: "min-w-0 truncate text-ink", children: workspaceName })
|
|
11760
|
+
}
|
|
11761
|
+
),
|
|
11762
|
+
"min-w-0 flex-1"
|
|
11724
11763
|
) : /* @__PURE__ */ jsx91("span", { className: "min-w-0 flex-1" }),
|
|
11725
11764
|
!collapsed && headerActions != null && /* @__PURE__ */ jsx91("div", { className: "flex shrink-0 items-center gap-xxs", children: headerActions })
|
|
11726
11765
|
]
|
|
@@ -11740,7 +11779,7 @@ var SidebarDesktop = React91.forwardRef(
|
|
|
11740
11779
|
/* @__PURE__ */ jsx91(IconButton, { icon: "panel-left", variant: "secondary", "aria-label": "Collapse sidebar", onClick: toggle })
|
|
11741
11780
|
] }),
|
|
11742
11781
|
!workspaceAtBottom && workspaceRow,
|
|
11743
|
-
/* @__PURE__ */ jsx91("nav", { "aria-label": "Main", className: cn70("min-h-0 flex-1 overflow-y-auto overscroll-contain pb-sm", collapsed ? "px-0" : "px-sm"), children: sections.map((section, i) => {
|
|
11782
|
+
/* @__PURE__ */ jsx91("nav", { "aria-label": "Main", className: cn70("min-h-0 flex-1 overflow-y-auto overscroll-y-contain pb-sm", collapsed ? "px-0" : "px-sm"), children: sections.map((section, i) => {
|
|
11744
11783
|
const sectionOpen = !section.label || isOpen(section.id);
|
|
11745
11784
|
const listId = `${baseId}-section-${section.id}`;
|
|
11746
11785
|
return /* @__PURE__ */ jsxs83("div", { className: i > 0 ? "mt-base" : void 0, children: [
|
|
@@ -11835,6 +11874,8 @@ var SidebarMobile = React92.forwardRef(
|
|
|
11835
11874
|
workspaceName,
|
|
11836
11875
|
workspaceAvatarSrc,
|
|
11837
11876
|
onWorkspaceClick,
|
|
11877
|
+
workspaceMenuItems,
|
|
11878
|
+
workspaceMenuHeader,
|
|
11838
11879
|
workspacePlacement = "top",
|
|
11839
11880
|
mobileActions,
|
|
11840
11881
|
sections,
|
|
@@ -11873,6 +11914,7 @@ var SidebarMobile = React92.forwardRef(
|
|
|
11873
11914
|
else next.add(id);
|
|
11874
11915
|
return next;
|
|
11875
11916
|
});
|
|
11917
|
+
const [workspaceMenuOpen, setWorkspaceMenuOpen] = React92.useState(false);
|
|
11876
11918
|
const showHelpAction = onHelpClick !== void 0;
|
|
11877
11919
|
const showSettingsAction = onSettingsClick !== void 0;
|
|
11878
11920
|
const showFooterActions = showHelpAction || showSettingsAction;
|
|
@@ -11941,17 +11983,43 @@ var SidebarMobile = React92.forwardRef(
|
|
|
11941
11983
|
)
|
|
11942
11984
|
] }, link.id);
|
|
11943
11985
|
};
|
|
11944
|
-
const
|
|
11986
|
+
const workspaceMenuMode = workspaceMenuItems !== void 0;
|
|
11987
|
+
const workspaceButtonNode = workspaceName ? /* @__PURE__ */ jsx92(
|
|
11945
11988
|
Button,
|
|
11946
11989
|
{
|
|
11947
11990
|
variant: "ghost",
|
|
11948
|
-
onClick: onWorkspaceClick,
|
|
11991
|
+
onClick: workspaceMenuMode ? void 0 : onWorkspaceClick,
|
|
11949
11992
|
className: "px-sm",
|
|
11993
|
+
fullWidth: workspaceMenuMode,
|
|
11950
11994
|
leadingIcon: /* @__PURE__ */ jsx92(Avatar, { name: workspaceName, src: workspaceAvatarSrc, size: "sm" }),
|
|
11951
|
-
trailingIcon: /* @__PURE__ */ jsx92(
|
|
11995
|
+
trailingIcon: /* @__PURE__ */ jsx92(
|
|
11996
|
+
Icon,
|
|
11997
|
+
{
|
|
11998
|
+
name: "chevron-down",
|
|
11999
|
+
size: 14,
|
|
12000
|
+
className: cn71(
|
|
12001
|
+
"text-muted transition-transform duration-200 ease-out",
|
|
12002
|
+
workspaceMenuMode && workspaceMenuOpen && "rotate-180"
|
|
12003
|
+
)
|
|
12004
|
+
}
|
|
12005
|
+
),
|
|
11952
12006
|
children: /* @__PURE__ */ jsx92("span", { className: "text-ink", children: workspaceName })
|
|
11953
12007
|
}
|
|
11954
12008
|
) : null;
|
|
12009
|
+
const workspaceButton = workspaceButtonNode && workspaceMenuMode ? /* @__PURE__ */ jsx92(
|
|
12010
|
+
DropdownMenu,
|
|
12011
|
+
{
|
|
12012
|
+
trigger: workspaceButtonNode,
|
|
12013
|
+
items: workspaceMenuItems ?? [],
|
|
12014
|
+
header: workspaceMenuHeader,
|
|
12015
|
+
align: "start",
|
|
12016
|
+
side: workspaceAtBottom ? "top" : "bottom",
|
|
12017
|
+
open: workspaceMenuOpen,
|
|
12018
|
+
onOpenChange: setWorkspaceMenuOpen,
|
|
12019
|
+
"aria-label": "Workspace",
|
|
12020
|
+
className: "w-full"
|
|
12021
|
+
}
|
|
12022
|
+
) : workspaceButtonNode;
|
|
11955
12023
|
const userRow = showFooterRow ? /* @__PURE__ */ jsxs84("div", { className: "flex w-full items-center justify-between", children: [
|
|
11956
12024
|
userName ? /* @__PURE__ */ jsx92(Avatar, { name: userName, src: userAvatarSrc, size: "sm" }) : /* @__PURE__ */ jsx92("span", {}),
|
|
11957
12025
|
showFooterActions && /* @__PURE__ */ jsxs84("div", { className: "flex items-center gap-xxs", children: [
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -87,6 +87,10 @@ export const CodePreview = React.forwardRef<HTMLDivElement, CodePreviewProps>(
|
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
+
/* Full-axis containment only when this surface really scrolls sideways;
|
|
91
|
+
otherwise y-only, so the horizontal back/forward swipe still works. */
|
|
92
|
+
const overscroll = wrap ? "overscroll-y-contain" : "overscroll-contain";
|
|
93
|
+
|
|
90
94
|
return (
|
|
91
95
|
<div
|
|
92
96
|
ref={ref}
|
|
@@ -118,7 +122,8 @@ export const CodePreview = React.forwardRef<HTMLDivElement, CodePreviewProps>(
|
|
|
118
122
|
aria-label={capped ? ariaLabel : undefined}
|
|
119
123
|
className={cn(
|
|
120
124
|
"px-md py-sm font-mono text-caption focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue",
|
|
121
|
-
capped && "max-h-64 overflow-y-auto
|
|
125
|
+
capped && "max-h-64 overflow-y-auto",
|
|
126
|
+
capped && overscroll,
|
|
122
127
|
!wrap && "overflow-x-auto",
|
|
123
128
|
)}
|
|
124
129
|
>
|
|
@@ -24,6 +24,13 @@ const pathLines: CodePreviewLine[] = [
|
|
|
24
24
|
{ text: " CodePreview.tsx" },
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
+
const designDocLines: CodePreviewLine[] = [
|
|
28
|
+
{ text: "# DESIGN.md", tone: "heading" },
|
|
29
|
+
{ text: "name: Acme design system" },
|
|
30
|
+
{ text: "brand: colors.primary" },
|
|
31
|
+
{ text: "radius: rounded.md" },
|
|
32
|
+
];
|
|
33
|
+
|
|
27
34
|
export default function CodePreviewPreview() {
|
|
28
35
|
const [loading, setLoading] = React.useState(false);
|
|
29
36
|
const [copyCount, setCopyCount] = React.useState(0);
|
|
@@ -63,7 +70,7 @@ export default function CodePreviewPreview() {
|
|
|
63
70
|
</Button>
|
|
64
71
|
</div>
|
|
65
72
|
<CodePreview
|
|
66
|
-
|
|
73
|
+
lines={designDocLines}
|
|
67
74
|
lineNumbers
|
|
68
75
|
loading={loading}
|
|
69
76
|
loadingLabel="Loading preview…"
|
|
@@ -315,7 +315,8 @@ export const DropdownMenu = React.forwardRef<HTMLSpanElement, DropdownMenuProps>
|
|
|
315
315
|
{header}
|
|
316
316
|
</div>
|
|
317
317
|
) : null}
|
|
318
|
-
|
|
318
|
+
{/* Vertical-only containment keeps the horizontal back/forward swipe working. */}
|
|
319
|
+
<div className="min-h-0 flex-1 overflow-y-auto overscroll-y-contain p-xs">
|
|
319
320
|
{items.map((entry, index) => {
|
|
320
321
|
if (isSeparator(entry)) {
|
|
321
322
|
return <Divider key={entry.id} tone="soft" className="my-xs" />;
|
|
@@ -93,12 +93,13 @@ export const ChatWindow = React.forwardRef<HTMLElement, ChatWindowProps>(
|
|
|
93
93
|
</div>
|
|
94
94
|
</header>
|
|
95
95
|
|
|
96
|
+
{/* Vertical-only containment keeps the horizontal back/forward swipe working. */}
|
|
96
97
|
<div
|
|
97
98
|
ref={listRef}
|
|
98
99
|
role="log"
|
|
99
100
|
aria-label="Messages"
|
|
100
101
|
aria-live="polite"
|
|
101
|
-
className="flex min-h-64 max-h-96 flex-col gap-lg overflow-y-auto overscroll-contain px-base py-base"
|
|
102
|
+
className="flex min-h-64 max-h-96 flex-col gap-lg overflow-y-auto overscroll-y-contain px-base py-base"
|
|
102
103
|
>
|
|
103
104
|
{threads.length === 0 ? (
|
|
104
105
|
<div className="flex flex-1 flex-col items-center justify-center gap-xs py-xl text-center">
|
|
@@ -341,7 +341,9 @@ export const CodeEditor = React.forwardRef<HTMLDivElement, CodeEditorProps>(
|
|
|
341
341
|
)}
|
|
342
342
|
{...rest}
|
|
343
343
|
>
|
|
344
|
-
|
|
344
|
+
{/* The file tree only scrolls vertically, so containment is y-only to keep
|
|
345
|
+
the browser's horizontal swipe-back gesture reachable. */}
|
|
346
|
+
<aside className="flex w-56 min-h-0 shrink-0 flex-col overflow-y-auto overscroll-y-contain border-r border-hairline bg-canvas">
|
|
345
347
|
<div className="flex items-center px-base py-md">
|
|
346
348
|
<span className="text-overline text-muted-soft">Files</span>
|
|
347
349
|
</div>
|
|
@@ -436,6 +438,7 @@ export const CodeEditor = React.forwardRef<HTMLDivElement, CodeEditorProps>(
|
|
|
436
438
|
</Button>
|
|
437
439
|
</div>
|
|
438
440
|
|
|
441
|
+
{/* Code scrolls both axes, so this surface keeps full-axis containment. */}
|
|
439
442
|
<div
|
|
440
443
|
id={`${baseId}-panel`}
|
|
441
444
|
role="tabpanel"
|
|
@@ -244,9 +244,11 @@ export const Drawer = React.forwardRef<HTMLDivElement, DrawerProps>(
|
|
|
244
244
|
/>
|
|
245
245
|
</div>
|
|
246
246
|
)}
|
|
247
|
+
{/* Vertical-only containment: a horizontal two-finger swipe over the
|
|
248
|
+
body still reaches the browser's back/forward gesture. */}
|
|
247
249
|
<div
|
|
248
250
|
className={cn(
|
|
249
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-base pb-base pt-xs",
|
|
251
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-base pb-base pt-xs",
|
|
250
252
|
bodyClassName,
|
|
251
253
|
)}
|
|
252
254
|
>
|
|
@@ -190,7 +190,8 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
190
190
|
{children != null && children !== false && (
|
|
191
191
|
<div
|
|
192
192
|
className={cn(
|
|
193
|
-
|
|
193
|
+
// Vertical-only containment keeps the horizontal back/forward swipe working.
|
|
194
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-lg pb-lg",
|
|
194
195
|
hasHeader ? "pt-xs" : "pt-lg",
|
|
195
196
|
bodyClassName,
|
|
196
197
|
)}
|
|
@@ -570,7 +570,9 @@ export const PromptInputBar = React.forwardRef<
|
|
|
570
570
|
}}
|
|
571
571
|
className={MENU_PANEL}
|
|
572
572
|
>
|
|
573
|
-
|
|
573
|
+
{/* Vertical-only containment: a horizontal two-finger swipe still
|
|
574
|
+
reaches the browser's back/forward gesture. */}
|
|
575
|
+
<div className="flex min-h-0 flex-1 flex-col gap-xxs overflow-y-auto overscroll-y-contain">
|
|
574
576
|
{hasModels ? (
|
|
575
577
|
<div className="flex flex-col gap-xxs">
|
|
576
578
|
<span className="px-sm pb-xxs pt-xs text-overline text-muted">
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { SidebarDesktop } from "../SidebarDesktop";
|
|
3
3
|
import { SidebarMobile } from "../SidebarMobile";
|
|
4
4
|
import type { IconName } from "../../atoms/Icon";
|
|
5
|
+
import type { DropdownMenuEntry } from "../../molecules/DropdownMenu";
|
|
5
6
|
|
|
6
7
|
export interface SidebarLink {
|
|
7
8
|
id: string;
|
|
@@ -25,6 +26,15 @@ export interface SidebarProps {
|
|
|
25
26
|
workspaceName?: string;
|
|
26
27
|
workspaceAvatarSrc?: string;
|
|
27
28
|
onWorkspaceClick?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Entries for the workspace switcher menu. When provided, the workspace button
|
|
31
|
+
* (avatar + name + chevron in both placements, and the avatar-only button in the
|
|
32
|
+
* folded rail) becomes the trigger of a `DropdownMenu` with these entries, instead
|
|
33
|
+
* of calling `onWorkspaceClick`. Omit it to keep the plain click behaviour.
|
|
34
|
+
*/
|
|
35
|
+
workspaceMenuItems?: DropdownMenuEntry[];
|
|
36
|
+
/** Optional block pinned above the workspace menu's actions, like `DropdownMenu`'s `header`. */
|
|
37
|
+
workspaceMenuHeader?: React.ReactNode;
|
|
28
38
|
/**
|
|
29
39
|
* Where the workspace row (avatar, name, chevron plus `headerActions`) renders.
|
|
30
40
|
* Defaults to `"top"` — directly under the logo. `"bottom"` pins it to the end of
|
|
@@ -4,6 +4,7 @@ import { SidebarMobile } from "../SidebarMobile";
|
|
|
4
4
|
import { IconButton } from "../../atoms/IconButton";
|
|
5
5
|
import { Avatar } from "../../atoms/Avatar";
|
|
6
6
|
import type { SidebarSection } from "./Sidebar";
|
|
7
|
+
import type { DropdownMenuEntry } from "../../molecules/DropdownMenu";
|
|
7
8
|
|
|
8
9
|
const SECTIONS: SidebarSection[] = [
|
|
9
10
|
{
|
|
@@ -29,11 +30,6 @@ const SECTIONS: SidebarSection[] = [
|
|
|
29
30
|
},
|
|
30
31
|
],
|
|
31
32
|
},
|
|
32
|
-
{
|
|
33
|
-
id: "try",
|
|
34
|
-
label: "Try",
|
|
35
|
-
items: [{ id: "import", label: "Import issues", icon: "copy" }],
|
|
36
|
-
},
|
|
37
33
|
];
|
|
38
34
|
|
|
39
35
|
const HEADER_ACTIONS = (
|
|
@@ -53,10 +49,28 @@ const MOBILE_ACTIONS = (
|
|
|
53
49
|
|
|
54
50
|
const ANNOUNCEMENT = { eyebrow: "What's new", title: "Cycles 2.0 is live", href: "#" };
|
|
55
51
|
|
|
52
|
+
const WORKSPACE_MENU_HEADER = (
|
|
53
|
+
<span className="flex min-w-0 items-center gap-sm">
|
|
54
|
+
<Avatar name="Northwind Studio" size="sm" />
|
|
55
|
+
<span className="flex min-w-0 flex-col">
|
|
56
|
+
<span className="truncate text-body-sm text-ink">Northwind Studio</span>
|
|
57
|
+
<span className="truncate text-caption text-muted">ada@northwind.studio</span>
|
|
58
|
+
</span>
|
|
59
|
+
</span>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const WORKSPACE_MENU_ITEMS: DropdownMenuEntry[] = [
|
|
63
|
+
{ type: "label", id: "lbl-workspaces", label: "Workspaces" },
|
|
64
|
+
{ id: "northwind", label: "Northwind Studio", icon: "box", selected: true },
|
|
65
|
+
{ id: "lakeside", label: "Lakeside Labs", icon: "box" },
|
|
66
|
+
{ type: "separator", id: "sep-1" },
|
|
67
|
+
{ id: "invite", label: "Invite people", icon: "plus" },
|
|
68
|
+
];
|
|
69
|
+
|
|
56
70
|
export default function SidebarPreview() {
|
|
57
71
|
const [collapsed, setCollapsed] = React.useState(false);
|
|
58
72
|
const [mobileOpen, setMobileOpen] = React.useState(false);
|
|
59
|
-
const [active, setActive] = React.useState("issues");
|
|
73
|
+
const [active, setActive] = React.useState("my-issues");
|
|
60
74
|
|
|
61
75
|
const navigate = (link: { id: string }, e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
62
76
|
e.preventDefault();
|
|
@@ -65,45 +79,59 @@ export default function SidebarPreview() {
|
|
|
65
79
|
|
|
66
80
|
const shared = {
|
|
67
81
|
sections: SECTIONS,
|
|
68
|
-
defaultExpanded: ["teams", "
|
|
82
|
+
defaultExpanded: ["teams", "engineering"],
|
|
69
83
|
activeId: active,
|
|
70
84
|
onNavigate: navigate,
|
|
71
85
|
workspaceName: "Northwind Studio",
|
|
72
86
|
userName: "Ada Fenwick",
|
|
73
87
|
};
|
|
74
88
|
|
|
89
|
+
const menu = {
|
|
90
|
+
workspaceMenuItems: WORKSPACE_MENU_ITEMS,
|
|
91
|
+
workspaceMenuHeader: WORKSPACE_MENU_HEADER,
|
|
92
|
+
};
|
|
93
|
+
|
|
75
94
|
return (
|
|
76
|
-
<div className="mx-auto w-full max-w-
|
|
95
|
+
<div className="mx-auto w-full max-w-4xl space-y-md p-md">
|
|
96
|
+
<p className="text-caption text-muted">
|
|
97
|
+
The workspace switcher opens a menu when `workspaceMenuItems` is supplied — click a switcher to try it.
|
|
98
|
+
</p>
|
|
99
|
+
|
|
77
100
|
<div className="grid w-full gap-md md:grid-cols-2">
|
|
78
101
|
<div className="w-full">
|
|
79
|
-
<p className="mb-xs text-caption text-muted">Top
|
|
80
|
-
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "
|
|
102
|
+
<p className="mb-xs text-caption text-muted">Top placement — menu opens downward</p>
|
|
103
|
+
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "15rem" }}>
|
|
81
104
|
<Sidebar
|
|
82
105
|
{...shared}
|
|
106
|
+
{...menu}
|
|
83
107
|
headerActions={HEADER_ACTIONS}
|
|
84
|
-
onHelpClick={() => {}}
|
|
85
108
|
onSettingsClick={() => {}}
|
|
86
109
|
collapsed={collapsed}
|
|
87
110
|
onCollapsedChange={setCollapsed}
|
|
88
111
|
>
|
|
89
112
|
<div className="p-md">
|
|
90
113
|
<h3 className="text-heading-sm text-ink">Issues</h3>
|
|
91
|
-
<p className="mt-xs text-body-sm text-muted">
|
|
92
|
-
Fold the rail with the panel button to see the workspace avatar-only row.
|
|
93
|
-
</p>
|
|
114
|
+
<p className="mt-xs text-body-sm text-muted">Fold the rail with the panel button to try the avatar trigger.</p>
|
|
94
115
|
</div>
|
|
95
116
|
</Sidebar>
|
|
96
117
|
</div>
|
|
97
118
|
</div>
|
|
98
119
|
|
|
99
120
|
<div className="w-full">
|
|
100
|
-
<p className="mb-xs text-caption text-muted">Bottom —
|
|
101
|
-
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "
|
|
102
|
-
<Sidebar
|
|
121
|
+
<p className="mb-xs text-caption text-muted">Bottom placement — menu opens upward</p>
|
|
122
|
+
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "15rem" }}>
|
|
123
|
+
<Sidebar
|
|
124
|
+
{...shared}
|
|
125
|
+
{...menu}
|
|
126
|
+
headerActions={HEADER_ACTIONS}
|
|
127
|
+
announcement={ANNOUNCEMENT}
|
|
128
|
+
onSettingsClick={() => {}}
|
|
129
|
+
workspacePlacement="bottom"
|
|
130
|
+
>
|
|
103
131
|
<div className="p-md">
|
|
104
132
|
<h3 className="text-heading-sm text-ink">Issues</h3>
|
|
105
133
|
<p className="mt-xs text-body-sm text-muted">
|
|
106
|
-
The
|
|
134
|
+
The workspace row stays above the user footer and opens its menu upward.
|
|
107
135
|
</p>
|
|
108
136
|
</div>
|
|
109
137
|
</Sidebar>
|
|
@@ -113,9 +141,9 @@ export default function SidebarPreview() {
|
|
|
113
141
|
|
|
114
142
|
<div className="grid w-full gap-md md:grid-cols-2">
|
|
115
143
|
<div className="w-full">
|
|
116
|
-
<p className="mb-xs text-caption text-muted">
|
|
117
|
-
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "
|
|
118
|
-
<Sidebar {...shared} onSettingsClick={() => {}} workspacePlacement="bottom" defaultCollapsed>
|
|
144
|
+
<p className="mb-xs text-caption text-muted">Folded rail — avatar trigger opens the same menu</p>
|
|
145
|
+
<div className="w-full overflow-hidden rounded-lg border border-hairline" style={{ height: "12rem" }}>
|
|
146
|
+
<Sidebar {...shared} {...menu} onSettingsClick={() => {}} workspacePlacement="bottom" defaultCollapsed>
|
|
119
147
|
<div className="p-md">
|
|
120
148
|
<h3 className="text-heading-sm text-ink">Issues</h3>
|
|
121
149
|
</div>
|
|
@@ -124,7 +152,7 @@ export default function SidebarPreview() {
|
|
|
124
152
|
</div>
|
|
125
153
|
|
|
126
154
|
<div className="w-full">
|
|
127
|
-
<p className="mb-xs text-caption text-muted">Mobile drawer —
|
|
155
|
+
<p className="mb-xs text-caption text-muted">Mobile drawer — same menu from the drawer switcher</p>
|
|
128
156
|
<div
|
|
129
157
|
className="w-full overflow-hidden rounded-lg border border-hairline"
|
|
130
158
|
style={{ maxWidth: "var(--container-sm, 24rem)" }}
|
|
@@ -137,9 +165,9 @@ export default function SidebarPreview() {
|
|
|
137
165
|
workspaceName="Northwind Studio"
|
|
138
166
|
userName="Ada Fenwick"
|
|
139
167
|
mobileActions={MOBILE_ACTIONS}
|
|
140
|
-
announcement={ANNOUNCEMENT}
|
|
141
168
|
workspacePlacement="bottom"
|
|
142
169
|
onSettingsClick={() => {}}
|
|
170
|
+
{...menu}
|
|
143
171
|
open={mobileOpen}
|
|
144
172
|
onOpenChange={setMobileOpen}
|
|
145
173
|
>
|
|
@@ -6,6 +6,8 @@ import { IconButton } from "../../atoms/IconButton";
|
|
|
6
6
|
import { Button } from "../../atoms/Button";
|
|
7
7
|
import { Avatar } from "../../atoms/Avatar";
|
|
8
8
|
import { Tooltip } from "../../atoms/Tooltip";
|
|
9
|
+
import { DropdownMenu } from "../../molecules/DropdownMenu";
|
|
10
|
+
import type { DropdownMenuEntry } from "../../molecules/DropdownMenu";
|
|
9
11
|
|
|
10
12
|
export interface SidebarDesktopLink {
|
|
11
13
|
id: string;
|
|
@@ -31,6 +33,15 @@ export interface SidebarDesktopProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
31
33
|
workspaceName?: string;
|
|
32
34
|
workspaceAvatarSrc?: string;
|
|
33
35
|
onWorkspaceClick?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Entries for the workspace switcher menu. When provided, the workspace button
|
|
38
|
+
* (avatar + name + chevron, or the avatar-only rail button) becomes the trigger
|
|
39
|
+
* of a `DropdownMenu` with these entries — and `onWorkspaceClick` is no longer
|
|
40
|
+
* called. Omit it to keep the plain click behaviour.
|
|
41
|
+
*/
|
|
42
|
+
workspaceMenuItems?: DropdownMenuEntry[];
|
|
43
|
+
/** Optional block pinned above the workspace menu's actions, like `DropdownMenu`'s `header`. */
|
|
44
|
+
workspaceMenuHeader?: React.ReactNode;
|
|
34
45
|
/**
|
|
35
46
|
* Where the workspace row (avatar, name, chevron plus `headerActions`) renders.
|
|
36
47
|
* `"top"` is the default: directly under the logo. `"bottom"` pins it to the end
|
|
@@ -89,6 +100,8 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
89
100
|
workspaceName,
|
|
90
101
|
workspaceAvatarSrc,
|
|
91
102
|
onWorkspaceClick,
|
|
103
|
+
workspaceMenuItems,
|
|
104
|
+
workspaceMenuHeader,
|
|
92
105
|
workspacePlacement = "top",
|
|
93
106
|
headerActions,
|
|
94
107
|
sections,
|
|
@@ -119,6 +132,9 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
119
132
|
onCollapsedChange?.(next);
|
|
120
133
|
};
|
|
121
134
|
|
|
135
|
+
/** Open state of the workspace switcher menu, so the chevron can follow it. */
|
|
136
|
+
const [workspaceMenuOpen, setWorkspaceMenuOpen] = React.useState(false);
|
|
137
|
+
|
|
122
138
|
const [expanded, setExpanded] = React.useState<Set<string>>(
|
|
123
139
|
() =>
|
|
124
140
|
new Set(
|
|
@@ -258,6 +274,28 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
258
274
|
const showWorkspaceRow = Boolean(workspaceName) || (!collapsed && headerActions != null);
|
|
259
275
|
const workspaceAtBottom = workspacePlacement === "bottom";
|
|
260
276
|
|
|
277
|
+
/** Menu mode: the workspace button becomes the dropdown trigger instead of a click. */
|
|
278
|
+
const workspaceMenuMode = workspaceMenuItems !== undefined;
|
|
279
|
+
const workspaceOnClick = workspaceMenuMode ? undefined : onWorkspaceClick;
|
|
280
|
+
const workspaceChevronOpen = workspaceMenuMode && workspaceMenuOpen;
|
|
281
|
+
|
|
282
|
+
const withWorkspaceMenu = (button: React.ReactElement, wrapperClassName: string) =>
|
|
283
|
+
workspaceMenuMode ? (
|
|
284
|
+
<DropdownMenu
|
|
285
|
+
trigger={button}
|
|
286
|
+
items={workspaceMenuItems ?? []}
|
|
287
|
+
header={workspaceMenuHeader}
|
|
288
|
+
align="start"
|
|
289
|
+
side={workspaceAtBottom ? "top" : "bottom"}
|
|
290
|
+
open={workspaceMenuOpen}
|
|
291
|
+
onOpenChange={setWorkspaceMenuOpen}
|
|
292
|
+
aria-label="Workspace"
|
|
293
|
+
className={wrapperClassName}
|
|
294
|
+
/>
|
|
295
|
+
) : (
|
|
296
|
+
button
|
|
297
|
+
);
|
|
298
|
+
|
|
261
299
|
const workspaceRow = showWorkspaceRow ? (
|
|
262
300
|
<div
|
|
263
301
|
className={cn(
|
|
@@ -268,21 +306,34 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
268
306
|
>
|
|
269
307
|
{workspaceName ? (
|
|
270
308
|
collapsed ? (
|
|
271
|
-
|
|
272
|
-
<Button variant="ghost" iconOnly aria-label={workspaceName} onClick={
|
|
309
|
+
withWorkspaceMenu(
|
|
310
|
+
<Button variant="ghost" iconOnly aria-label={workspaceName} onClick={workspaceOnClick}>
|
|
273
311
|
<Avatar name={workspaceName} src={workspaceAvatarSrc} size="sm" />
|
|
274
|
-
</Button
|
|
275
|
-
|
|
312
|
+
</Button>,
|
|
313
|
+
"shrink-0",
|
|
314
|
+
)
|
|
276
315
|
) : (
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
316
|
+
withWorkspaceMenu(
|
|
317
|
+
<Button
|
|
318
|
+
variant="ghost"
|
|
319
|
+
onClick={workspaceOnClick}
|
|
320
|
+
className="min-w-0 flex-1 justify-start px-sm"
|
|
321
|
+
leadingIcon={<Avatar name={workspaceName} src={workspaceAvatarSrc} size="sm" />}
|
|
322
|
+
trailingIcon={
|
|
323
|
+
<Icon
|
|
324
|
+
name="chevron-down"
|
|
325
|
+
size={14}
|
|
326
|
+
className={cn(
|
|
327
|
+
"text-muted transition-transform duration-200 ease-out",
|
|
328
|
+
workspaceChevronOpen && "rotate-180",
|
|
329
|
+
)}
|
|
330
|
+
/>
|
|
331
|
+
}
|
|
332
|
+
>
|
|
333
|
+
<span className="min-w-0 truncate text-ink">{workspaceName}</span>
|
|
334
|
+
</Button>,
|
|
335
|
+
"min-w-0 flex-1",
|
|
336
|
+
)
|
|
286
337
|
)
|
|
287
338
|
) : (
|
|
288
339
|
<span className="min-w-0 flex-1" />
|
|
@@ -314,7 +365,9 @@ export const SidebarDesktop = React.forwardRef<HTMLDivElement, SidebarDesktopPro
|
|
|
314
365
|
|
|
315
366
|
{!workspaceAtBottom && workspaceRow}
|
|
316
367
|
|
|
317
|
-
|
|
368
|
+
{/* Vertical-only containment: a horizontal two-finger swipe over the nav
|
|
369
|
+
still reaches the browser's back/forward gesture. */}
|
|
370
|
+
<nav aria-label="Main" className={cn("min-h-0 flex-1 overflow-y-auto overscroll-y-contain pb-sm", collapsed ? "px-0" : "px-sm")}>
|
|
318
371
|
{sections.map((section, i) => {
|
|
319
372
|
const sectionOpen = !section.label || isOpen(section.id);
|
|
320
373
|
const listId = `${baseId}-section-${section.id}`;
|
|
@@ -6,6 +6,8 @@ import { IconButton } from "../../atoms/IconButton";
|
|
|
6
6
|
import { Button } from "../../atoms/Button";
|
|
7
7
|
import { Avatar } from "../../atoms/Avatar";
|
|
8
8
|
import { Drawer } from "../Drawer";
|
|
9
|
+
import { DropdownMenu } from "../../molecules/DropdownMenu";
|
|
10
|
+
import type { DropdownMenuEntry } from "../../molecules/DropdownMenu";
|
|
9
11
|
|
|
10
12
|
export interface SidebarMobileLink {
|
|
11
13
|
id: string;
|
|
@@ -31,6 +33,14 @@ export interface SidebarMobileProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
31
33
|
workspaceName?: string;
|
|
32
34
|
workspaceAvatarSrc?: string;
|
|
33
35
|
onWorkspaceClick?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Entries for the workspace switcher menu. When provided, the workspace button
|
|
38
|
+
* in the drawer becomes the trigger of a `DropdownMenu` with these entries —
|
|
39
|
+
* and `onWorkspaceClick` is no longer called. Omit it to keep the plain click.
|
|
40
|
+
*/
|
|
41
|
+
workspaceMenuItems?: DropdownMenuEntry[];
|
|
42
|
+
/** Optional block pinned above the workspace menu's actions, like `DropdownMenu`'s `header`. */
|
|
43
|
+
workspaceMenuHeader?: React.ReactNode;
|
|
34
44
|
/**
|
|
35
45
|
* Where the workspace row renders inside the drawer. `"top"` is the default:
|
|
36
46
|
* above the nav. `"bottom"` pins it to the end of the drawer panel — after the
|
|
@@ -91,6 +101,8 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
91
101
|
workspaceName,
|
|
92
102
|
workspaceAvatarSrc,
|
|
93
103
|
onWorkspaceClick,
|
|
104
|
+
workspaceMenuItems,
|
|
105
|
+
workspaceMenuHeader,
|
|
94
106
|
workspacePlacement = "top",
|
|
95
107
|
mobileActions,
|
|
96
108
|
sections,
|
|
@@ -134,6 +146,9 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
134
146
|
return next;
|
|
135
147
|
});
|
|
136
148
|
|
|
149
|
+
/** Open state of the workspace switcher menu, so the chevron can follow it. */
|
|
150
|
+
const [workspaceMenuOpen, setWorkspaceMenuOpen] = React.useState(false);
|
|
151
|
+
|
|
137
152
|
/** Each drawer-footer action only exists when the consumer supplied its handler. */
|
|
138
153
|
const showHelpAction = onHelpClick !== undefined;
|
|
139
154
|
const showSettingsAction = onSettingsClick !== undefined;
|
|
@@ -209,18 +224,48 @@ export const SidebarMobile = React.forwardRef<HTMLDivElement, SidebarMobileProps
|
|
|
209
224
|
);
|
|
210
225
|
};
|
|
211
226
|
|
|
212
|
-
|
|
227
|
+
/** Menu mode: the workspace button becomes a dropdown trigger instead of a click. */
|
|
228
|
+
const workspaceMenuMode = workspaceMenuItems !== undefined;
|
|
229
|
+
|
|
230
|
+
const workspaceButtonNode = workspaceName ? (
|
|
213
231
|
<Button
|
|
214
232
|
variant="ghost"
|
|
215
|
-
onClick={onWorkspaceClick}
|
|
233
|
+
onClick={workspaceMenuMode ? undefined : onWorkspaceClick}
|
|
216
234
|
className="px-sm"
|
|
235
|
+
fullWidth={workspaceMenuMode}
|
|
217
236
|
leadingIcon={<Avatar name={workspaceName} src={workspaceAvatarSrc} size="sm" />}
|
|
218
|
-
trailingIcon={
|
|
237
|
+
trailingIcon={
|
|
238
|
+
<Icon
|
|
239
|
+
name="chevron-down"
|
|
240
|
+
size={14}
|
|
241
|
+
className={cn(
|
|
242
|
+
"text-muted transition-transform duration-200 ease-out",
|
|
243
|
+
workspaceMenuMode && workspaceMenuOpen && "rotate-180",
|
|
244
|
+
)}
|
|
245
|
+
/>
|
|
246
|
+
}
|
|
219
247
|
>
|
|
220
248
|
<span className="text-ink">{workspaceName}</span>
|
|
221
249
|
</Button>
|
|
222
250
|
) : null;
|
|
223
251
|
|
|
252
|
+
const workspaceButton =
|
|
253
|
+
workspaceButtonNode && workspaceMenuMode ? (
|
|
254
|
+
<DropdownMenu
|
|
255
|
+
trigger={workspaceButtonNode}
|
|
256
|
+
items={workspaceMenuItems ?? []}
|
|
257
|
+
header={workspaceMenuHeader}
|
|
258
|
+
align="start"
|
|
259
|
+
side={workspaceAtBottom ? "top" : "bottom"}
|
|
260
|
+
open={workspaceMenuOpen}
|
|
261
|
+
onOpenChange={setWorkspaceMenuOpen}
|
|
262
|
+
aria-label="Workspace"
|
|
263
|
+
className="w-full"
|
|
264
|
+
/>
|
|
265
|
+
) : (
|
|
266
|
+
workspaceButtonNode
|
|
267
|
+
);
|
|
268
|
+
|
|
224
269
|
const userRow = showFooterRow ? (
|
|
225
270
|
<div className="flex w-full items-center justify-between">
|
|
226
271
|
{userName ? <Avatar name={userName} src={userAvatarSrc} size="sm" /> : <span />}
|