@designa8/vibedesign-v6 1.6.7
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 +66 -0
- package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
- package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
- package/dist/index.cjs +3231 -0
- package/dist/index.js +3201 -0
- package/dist/styles.css +1810 -0
- package/package.json +109 -0
- package/src/atoms/AppLayout/AppLayout.tsx +537 -0
- package/src/atoms/AppLayout/index.ts +2 -0
- package/src/atoms/AppLayout/preview.tsx +75 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +399 -0
- package/src/atoms/AppSidebar/index.ts +2 -0
- package/src/atoms/AppSidebar/preview.tsx +214 -0
- package/src/atoms/AuthScreen/AuthScreen.tsx +226 -0
- package/src/atoms/AuthScreen/index.ts +2 -0
- package/src/atoms/AuthScreen/preview.tsx +10 -0
- package/src/atoms/Button/Button.tsx +71 -0
- package/src/atoms/Button/index.ts +2 -0
- package/src/atoms/Button/preview.tsx +71 -0
- package/src/atoms/ChatScreen/ChatScreen.tsx +629 -0
- package/src/atoms/ChatScreen/index.ts +2 -0
- package/src/atoms/ChatScreen/preview.tsx +239 -0
- package/src/atoms/Chip/Chip.tsx +121 -0
- package/src/atoms/Chip/index.ts +2 -0
- package/src/atoms/Chip/preview.tsx +99 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +95 -0
- package/src/atoms/FilterTabBar/index.ts +2 -0
- package/src/atoms/FilterTabBar/preview.tsx +92 -0
- package/src/atoms/Input/Input.tsx +139 -0
- package/src/atoms/Input/index.ts +2 -0
- package/src/atoms/Input/preview.tsx +97 -0
- package/src/atoms/Modal/Modal.tsx +144 -0
- package/src/atoms/Modal/index.ts +2 -0
- package/src/atoms/Modal/preview.tsx +111 -0
- package/src/atoms/NavItem/NavItem.tsx +316 -0
- package/src/atoms/NavItem/index.ts +2 -0
- package/src/atoms/NavItem/preview.tsx +125 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +626 -0
- package/src/atoms/PromptInputBar/index.ts +2 -0
- package/src/atoms/PromptInputBar/preview.tsx +85 -0
- package/src/atoms/TopNavbar/TopNavbar.tsx +400 -0
- package/src/atoms/TopNavbar/index.ts +2 -0
- package/src/atoms/TopNavbar/preview.tsx +117 -0
- package/src/atoms/UpgradeCard/UpgradeCard.tsx +65 -0
- package/src/atoms/UpgradeCard/index.ts +2 -0
- package/src/atoms/UpgradeCard/preview.tsx +25 -0
- package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +216 -0
- package/src/atoms/WorkspaceMenu/index.ts +2 -0
- package/src/atoms/WorkspaceMenu/preview.tsx +44 -0
- package/src/index.ts +16 -0
- package/src/tokens.css +165 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,3231 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// virtual-pkg:src/index.ts
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
AppLayout: () => AppLayout,
|
|
33
|
+
AppSidebar: () => AppSidebar,
|
|
34
|
+
AuthScreen: () => AuthScreen,
|
|
35
|
+
Button: () => Button,
|
|
36
|
+
ChatScreen: () => ChatScreen,
|
|
37
|
+
Chip: () => Chip,
|
|
38
|
+
FilterTabBar: () => FilterTabBar,
|
|
39
|
+
Input: () => Input,
|
|
40
|
+
Modal: () => Modal,
|
|
41
|
+
NavItem: () => NavItem,
|
|
42
|
+
PromptInputBar: () => PromptInputBar,
|
|
43
|
+
TopNavbar: () => TopNavbar,
|
|
44
|
+
UpgradeCard: () => UpgradeCard,
|
|
45
|
+
WorkspaceMenu: () => WorkspaceMenu
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(src_exports);
|
|
48
|
+
var import_styles = require("../dist/styles.css");
|
|
49
|
+
|
|
50
|
+
// virtual-pkg:src/atoms/AppLayout/AppLayout.tsx
|
|
51
|
+
var import_react7 = __toESM(require("react"));
|
|
52
|
+
|
|
53
|
+
// virtual-pkg:src/atoms/TopNavbar/TopNavbar.tsx
|
|
54
|
+
var import_react2 = __toESM(require("react"));
|
|
55
|
+
|
|
56
|
+
// virtual-pkg:src/atoms/Button/Button.tsx
|
|
57
|
+
var import_react = __toESM(require("react"));
|
|
58
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
59
|
+
var variantClasses = {
|
|
60
|
+
primary: "bg-primary text-on-primary hover:bg-primary-hover active:bg-primary-active disabled:bg-primary-disabled disabled:text-on-primary disabled:cursor-not-allowed border border-transparent",
|
|
61
|
+
secondary: "bg-canvas text-ink hover:bg-surface-soft active:bg-surface-strong disabled:opacity-50 disabled:cursor-not-allowed border border-hairline",
|
|
62
|
+
ghost: "bg-transparent text-ink hover:bg-surface-soft active:bg-surface-strong disabled:opacity-50 disabled:cursor-not-allowed border border-transparent",
|
|
63
|
+
destructive: "bg-semantic-error text-on-primary hover:brightness-90 active:brightness-75 disabled:opacity-50 disabled:cursor-not-allowed border border-transparent"
|
|
64
|
+
};
|
|
65
|
+
var sizeClasses = {
|
|
66
|
+
sm: "px-md py-xs text-body-sm rounded-md",
|
|
67
|
+
md: "px-lg py-sm text-body-md rounded-xl",
|
|
68
|
+
lg: "px-xl py-md text-body-lg rounded-xl"
|
|
69
|
+
};
|
|
70
|
+
var Button = import_react.default.forwardRef(
|
|
71
|
+
({
|
|
72
|
+
variant = "primary",
|
|
73
|
+
size = "md",
|
|
74
|
+
loading = false,
|
|
75
|
+
disabled,
|
|
76
|
+
children,
|
|
77
|
+
className,
|
|
78
|
+
...rest
|
|
79
|
+
}, ref) => {
|
|
80
|
+
const isDisabled = disabled || loading;
|
|
81
|
+
const base = "inline-flex items-center justify-center gap-sm font-weight-heading-sm transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-focus focus-visible:ring-offset-2 select-none whitespace-nowrap";
|
|
82
|
+
const classes = [base, variantClasses[variant], sizeClasses[size], className].filter(Boolean).join(" ");
|
|
83
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", { ref, disabled: isDisabled, className: classes, ...rest, children: [
|
|
84
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
85
|
+
"svg",
|
|
86
|
+
{
|
|
87
|
+
"aria-hidden": "true",
|
|
88
|
+
className: "size-4 animate-spin",
|
|
89
|
+
viewBox: "0 0 24 24",
|
|
90
|
+
fill: "none",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" })
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
children
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
Button.displayName = "Button";
|
|
102
|
+
|
|
103
|
+
// virtual-pkg:src/atoms/TopNavbar/TopNavbar.tsx
|
|
104
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
105
|
+
function relativeTime(isoDate) {
|
|
106
|
+
const then = new Date(isoDate).getTime();
|
|
107
|
+
if (isNaN(then)) return isoDate;
|
|
108
|
+
const diffMs = Date.now() - then;
|
|
109
|
+
const diffSec = Math.round(diffMs / 1e3);
|
|
110
|
+
if (diffSec < 45) return "just now";
|
|
111
|
+
const diffMin = Math.round(diffSec / 60);
|
|
112
|
+
if (diffMin < 60) return diffMin === 1 ? "1 minute ago" : `${diffMin} minutes ago`;
|
|
113
|
+
const diffHr = Math.round(diffMin / 60);
|
|
114
|
+
if (diffHr < 24) return diffHr === 1 ? "1 hour ago" : `${diffHr} hours ago`;
|
|
115
|
+
const diffDay = Math.round(diffHr / 24);
|
|
116
|
+
if (diffDay < 30) return diffDay === 1 ? "1 day ago" : `${diffDay} days ago`;
|
|
117
|
+
const diffMonth = Math.round(diffDay / 30);
|
|
118
|
+
if (diffMonth < 12) return diffMonth === 1 ? "1 month ago" : `${diffMonth} months ago`;
|
|
119
|
+
const diffYear = Math.round(diffMonth / 12);
|
|
120
|
+
return diffYear === 1 ? "1 year ago" : `${diffYear} years ago`;
|
|
121
|
+
}
|
|
122
|
+
function getVersionLabel(item) {
|
|
123
|
+
return typeof item === "string" ? item : item.version;
|
|
124
|
+
}
|
|
125
|
+
var ChevronIcon = ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
126
|
+
"svg",
|
|
127
|
+
{
|
|
128
|
+
"aria-hidden": "true",
|
|
129
|
+
viewBox: "0 0 24 24",
|
|
130
|
+
fill: "none",
|
|
131
|
+
stroke: "currentColor",
|
|
132
|
+
strokeWidth: "2.5",
|
|
133
|
+
strokeLinecap: "round",
|
|
134
|
+
strokeLinejoin: "round",
|
|
135
|
+
style: {
|
|
136
|
+
width: "13px",
|
|
137
|
+
height: "13px",
|
|
138
|
+
flexShrink: 0,
|
|
139
|
+
transition: "transform 150ms ease",
|
|
140
|
+
transform: open ? "rotate(180deg)" : "rotate(0deg)"
|
|
141
|
+
},
|
|
142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
var SunIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
146
|
+
"svg",
|
|
147
|
+
{
|
|
148
|
+
"aria-hidden": "true",
|
|
149
|
+
viewBox: "0 0 24 24",
|
|
150
|
+
fill: "none",
|
|
151
|
+
stroke: "currentColor",
|
|
152
|
+
strokeWidth: "2",
|
|
153
|
+
strokeLinecap: "round",
|
|
154
|
+
strokeLinejoin: "round",
|
|
155
|
+
width: "16",
|
|
156
|
+
height: "16",
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "5" }),
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
162
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
163
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
165
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
var MoonIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
171
|
+
"svg",
|
|
172
|
+
{
|
|
173
|
+
"aria-hidden": "true",
|
|
174
|
+
viewBox: "0 0 24 24",
|
|
175
|
+
fill: "none",
|
|
176
|
+
stroke: "currentColor",
|
|
177
|
+
strokeWidth: "2",
|
|
178
|
+
strokeLinecap: "round",
|
|
179
|
+
strokeLinejoin: "round",
|
|
180
|
+
width: "16",
|
|
181
|
+
height: "16",
|
|
182
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" })
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
var VersionDropdown = ({
|
|
186
|
+
versions,
|
|
187
|
+
selected,
|
|
188
|
+
onSelect
|
|
189
|
+
}) => {
|
|
190
|
+
const [open, setOpen] = import_react2.default.useState(false);
|
|
191
|
+
const containerRef = import_react2.default.useRef(null);
|
|
192
|
+
import_react2.default.useEffect(() => {
|
|
193
|
+
if (!open) return;
|
|
194
|
+
const handler = (e) => {
|
|
195
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
196
|
+
setOpen(false);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
document.addEventListener("mousedown", handler);
|
|
200
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
201
|
+
}, [open]);
|
|
202
|
+
import_react2.default.useEffect(() => {
|
|
203
|
+
if (!open) return;
|
|
204
|
+
const handler = (e) => {
|
|
205
|
+
if (e.key === "Escape") setOpen(false);
|
|
206
|
+
};
|
|
207
|
+
document.addEventListener("keydown", handler);
|
|
208
|
+
return () => document.removeEventListener("keydown", handler);
|
|
209
|
+
}, [open]);
|
|
210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: containerRef, className: "relative inline-block", style: { zIndex: 50 }, children: [
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
212
|
+
Button,
|
|
213
|
+
{
|
|
214
|
+
type: "button",
|
|
215
|
+
variant: "secondary",
|
|
216
|
+
size: "sm",
|
|
217
|
+
"aria-haspopup": "listbox",
|
|
218
|
+
"aria-expanded": open,
|
|
219
|
+
"aria-label": `Select version: ${selected}`,
|
|
220
|
+
onClick: () => setOpen((v) => !v),
|
|
221
|
+
className: "!gap-sm !pr-sm",
|
|
222
|
+
style: { minWidth: "120px" },
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "flex-1 text-left truncate text-body-sm font-weight-heading-sm", children: selected }),
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChevronIcon, { open })
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
),
|
|
229
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
230
|
+
"ul",
|
|
231
|
+
{
|
|
232
|
+
role: "listbox",
|
|
233
|
+
"aria-label": "Select version",
|
|
234
|
+
className: [
|
|
235
|
+
"absolute right-0 mt-xs rounded-xl",
|
|
236
|
+
"bg-surface border border-hairline-soft shadow-card",
|
|
237
|
+
"py-xs overflow-y-auto overflow-x-hidden",
|
|
238
|
+
"z-50"
|
|
239
|
+
].join(" "),
|
|
240
|
+
style: { minWidth: "220px", maxHeight: "350px" },
|
|
241
|
+
children: versions.map((item) => {
|
|
242
|
+
const label = getVersionLabel(item);
|
|
243
|
+
const entry = typeof item === "object" ? item : null;
|
|
244
|
+
const hasMetadata = entry && (entry.publishedAt || entry.publishedBy);
|
|
245
|
+
let metaLine = null;
|
|
246
|
+
if (hasMetadata) {
|
|
247
|
+
const parts = [];
|
|
248
|
+
if (entry.publishedAt) parts.push(relativeTime(entry.publishedAt));
|
|
249
|
+
if (entry.publishedBy) parts.push(entry.publishedBy);
|
|
250
|
+
metaLine = parts.join(" \xB7 ");
|
|
251
|
+
}
|
|
252
|
+
const isSelected = label === selected;
|
|
253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
254
|
+
"li",
|
|
255
|
+
{
|
|
256
|
+
role: "option",
|
|
257
|
+
"aria-selected": isSelected,
|
|
258
|
+
tabIndex: 0,
|
|
259
|
+
onClick: () => {
|
|
260
|
+
onSelect(label);
|
|
261
|
+
setOpen(false);
|
|
262
|
+
},
|
|
263
|
+
onKeyDown: (e) => {
|
|
264
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
265
|
+
onSelect(label);
|
|
266
|
+
setOpen(false);
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
className: [
|
|
270
|
+
"flex flex-col px-md cursor-pointer select-none",
|
|
271
|
+
"transition-colors duration-100",
|
|
272
|
+
metaLine ? "py-sm" : "py-xs",
|
|
273
|
+
isSelected ? "bg-surface-soft text-primary" : "text-ink hover:bg-surface-soft"
|
|
274
|
+
].join(" "),
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: ["text-body-sm", isSelected ? "font-weight-heading-sm" : ""].join(" ").trim(), children: label }),
|
|
277
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-caption text-muted mt-xxs", children: metaLine })
|
|
278
|
+
]
|
|
279
|
+
},
|
|
280
|
+
label
|
|
281
|
+
);
|
|
282
|
+
})
|
|
283
|
+
}
|
|
284
|
+
)
|
|
285
|
+
] });
|
|
286
|
+
};
|
|
287
|
+
var TopNavbar = import_react2.default.forwardRef(
|
|
288
|
+
({
|
|
289
|
+
avatarInitials = "DU",
|
|
290
|
+
version = "Latest",
|
|
291
|
+
versions = ["Latest", "v1.2", "v1.1", "v1.0"],
|
|
292
|
+
onExport,
|
|
293
|
+
onPublish,
|
|
294
|
+
onShare,
|
|
295
|
+
onVersionChange,
|
|
296
|
+
darkMode = false,
|
|
297
|
+
onToggleDarkMode,
|
|
298
|
+
className,
|
|
299
|
+
...rest
|
|
300
|
+
}, ref) => {
|
|
301
|
+
const [selected, setSelected] = import_react2.default.useState(version);
|
|
302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
303
|
+
"header",
|
|
304
|
+
{
|
|
305
|
+
ref,
|
|
306
|
+
className: [
|
|
307
|
+
"w-full bg-canvas border-b border-hairline",
|
|
308
|
+
"flex items-center justify-end gap-sm px-lg py-sm",
|
|
309
|
+
className
|
|
310
|
+
].filter(Boolean).join(" "),
|
|
311
|
+
...rest,
|
|
312
|
+
children: [
|
|
313
|
+
onExport && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Button, { variant: "secondary", size: "sm", onClick: onExport, "aria-label": "Export DESIGN.md", children: [
|
|
314
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
315
|
+
"svg",
|
|
316
|
+
{
|
|
317
|
+
"aria-hidden": "true",
|
|
318
|
+
width: "15",
|
|
319
|
+
height: "15",
|
|
320
|
+
viewBox: "0 0 24 24",
|
|
321
|
+
fill: "none",
|
|
322
|
+
stroke: "currentColor",
|
|
323
|
+
strokeWidth: "2",
|
|
324
|
+
strokeLinecap: "round",
|
|
325
|
+
strokeLinejoin: "round",
|
|
326
|
+
className: "shrink-0",
|
|
327
|
+
children: [
|
|
328
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
329
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "14 2 14 8 20 8" }),
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "16", y1: "17", x2: "8", y2: "17" })
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
"Export DESIGN.md"
|
|
336
|
+
] }),
|
|
337
|
+
onPublish && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Button, { variant: "secondary", size: "sm", onClick: onPublish, "aria-label": "Publish", children: [
|
|
338
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
339
|
+
"svg",
|
|
340
|
+
{
|
|
341
|
+
"aria-hidden": "true",
|
|
342
|
+
width: "15",
|
|
343
|
+
height: "15",
|
|
344
|
+
viewBox: "0 0 24 24",
|
|
345
|
+
fill: "none",
|
|
346
|
+
stroke: "currentColor",
|
|
347
|
+
strokeWidth: "2",
|
|
348
|
+
strokeLinecap: "round",
|
|
349
|
+
strokeLinejoin: "round",
|
|
350
|
+
className: "shrink-0",
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polyline", { points: "16 16 12 12 8 16" }),
|
|
353
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: "12", y1: "12", x2: "12", y2: "21" }),
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" })
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
"Publish"
|
|
359
|
+
] }),
|
|
360
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
361
|
+
VersionDropdown,
|
|
362
|
+
{
|
|
363
|
+
versions,
|
|
364
|
+
selected,
|
|
365
|
+
onSelect: (v) => {
|
|
366
|
+
setSelected(v);
|
|
367
|
+
onVersionChange?.(v);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
),
|
|
371
|
+
onToggleDarkMode && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
372
|
+
Button,
|
|
373
|
+
{
|
|
374
|
+
type: "button",
|
|
375
|
+
variant: "ghost",
|
|
376
|
+
size: "sm",
|
|
377
|
+
onClick: onToggleDarkMode,
|
|
378
|
+
"aria-label": darkMode ? "Switch to light mode" : "Switch to dark mode",
|
|
379
|
+
"aria-pressed": darkMode,
|
|
380
|
+
className: "!px-xs !py-xs",
|
|
381
|
+
children: darkMode ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SunIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MoonIcon, {})
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
onShare && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { variant: "primary", size: "sm", onClick: onShare, children: "Share" }),
|
|
385
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
386
|
+
"span",
|
|
387
|
+
{
|
|
388
|
+
role: "button",
|
|
389
|
+
tabIndex: 0,
|
|
390
|
+
"aria-label": `User menu \u2014 ${avatarInitials}`,
|
|
391
|
+
onKeyDown: (e) => {
|
|
392
|
+
if (e.key === "Enter" || e.key === " ") e.currentTarget.click();
|
|
393
|
+
},
|
|
394
|
+
className: [
|
|
395
|
+
"inline-flex items-center justify-center shrink-0 cursor-pointer select-none",
|
|
396
|
+
"size-8 rounded-full bg-primary text-on-primary",
|
|
397
|
+
"text-caption font-weight-heading-sm uppercase",
|
|
398
|
+
"hover:bg-primary-hover active:bg-primary-active",
|
|
399
|
+
"transition-colors duration-150",
|
|
400
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-focus focus-visible:ring-offset-2"
|
|
401
|
+
].join(" "),
|
|
402
|
+
children: avatarInitials.slice(0, 2)
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
);
|
|
410
|
+
TopNavbar.displayName = "TopNavbar";
|
|
411
|
+
|
|
412
|
+
// virtual-pkg:src/atoms/ChatScreen/ChatScreen.tsx
|
|
413
|
+
var import_react5 = __toESM(require("react"));
|
|
414
|
+
|
|
415
|
+
// virtual-pkg:src/atoms/PromptInputBar/PromptInputBar.tsx
|
|
416
|
+
var import_react4 = __toESM(require("react"));
|
|
417
|
+
|
|
418
|
+
// virtual-pkg:src/atoms/Input/Input.tsx
|
|
419
|
+
var import_react3 = __toESM(require("react"));
|
|
420
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
421
|
+
var sizeClasses2 = {
|
|
422
|
+
sm: {
|
|
423
|
+
input: "h-8 px-sm text-body-sm",
|
|
424
|
+
icon: "w-4 h-4",
|
|
425
|
+
label: "text-body-sm"
|
|
426
|
+
},
|
|
427
|
+
md: {
|
|
428
|
+
input: "h-10 px-md text-body-md",
|
|
429
|
+
icon: "w-4 h-4",
|
|
430
|
+
label: "text-body-sm"
|
|
431
|
+
},
|
|
432
|
+
lg: {
|
|
433
|
+
input: "h-12 px-base text-body-lg",
|
|
434
|
+
icon: "w-5 h-5",
|
|
435
|
+
label: "text-body-md"
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
var Input = import_react3.default.forwardRef(
|
|
439
|
+
({
|
|
440
|
+
label,
|
|
441
|
+
helperText,
|
|
442
|
+
error,
|
|
443
|
+
size = "md",
|
|
444
|
+
leadingIcon,
|
|
445
|
+
trailingIcon,
|
|
446
|
+
fullWidth = false,
|
|
447
|
+
disabled,
|
|
448
|
+
id,
|
|
449
|
+
className = "",
|
|
450
|
+
...rest
|
|
451
|
+
}, ref) => {
|
|
452
|
+
const generatedId = import_react3.default.useId();
|
|
453
|
+
const inputId = id ?? generatedId;
|
|
454
|
+
const helperId = `${inputId}-helper`;
|
|
455
|
+
const hasError = Boolean(error);
|
|
456
|
+
const { input: inputSize, icon: iconSize, label: labelSize } = sizeClasses2[size];
|
|
457
|
+
const borderColor = hasError ? "border-semantic-error focus:ring-semantic-error/30 focus:border-semantic-error" : "border-hairline focus:ring-primary-focus/20 focus:border-primary-focus";
|
|
458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `flex flex-col gap-xs ${fullWidth ? "w-full" : "w-fit"}`, children: [
|
|
459
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
460
|
+
"label",
|
|
461
|
+
{
|
|
462
|
+
htmlFor: inputId,
|
|
463
|
+
className: `${labelSize} font-medium text-ink`,
|
|
464
|
+
children: label
|
|
465
|
+
}
|
|
466
|
+
),
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative flex items-center", children: [
|
|
468
|
+
leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
469
|
+
"span",
|
|
470
|
+
{
|
|
471
|
+
"aria-hidden": "true",
|
|
472
|
+
className: `absolute left-md flex items-center text-muted ${iconSize}`,
|
|
473
|
+
children: leadingIcon
|
|
474
|
+
}
|
|
475
|
+
),
|
|
476
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
477
|
+
"input",
|
|
478
|
+
{
|
|
479
|
+
ref,
|
|
480
|
+
id: inputId,
|
|
481
|
+
disabled,
|
|
482
|
+
"aria-invalid": hasError ? "true" : void 0,
|
|
483
|
+
"aria-describedby": error ? helperId : helperText ? helperId : void 0,
|
|
484
|
+
className: [
|
|
485
|
+
"w-full rounded-md border bg-surface text-ink placeholder:text-muted-soft",
|
|
486
|
+
"outline-none ring-0",
|
|
487
|
+
"transition-colors duration-150",
|
|
488
|
+
"focus:ring-2",
|
|
489
|
+
inputSize,
|
|
490
|
+
borderColor,
|
|
491
|
+
leadingIcon ? "pl-9" : "",
|
|
492
|
+
trailingIcon ? "pr-9" : "",
|
|
493
|
+
disabled ? "cursor-not-allowed bg-surface-soft text-muted opacity-60" : "",
|
|
494
|
+
className
|
|
495
|
+
].filter(Boolean).join(" "),
|
|
496
|
+
...rest
|
|
497
|
+
}
|
|
498
|
+
),
|
|
499
|
+
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
500
|
+
"span",
|
|
501
|
+
{
|
|
502
|
+
"aria-hidden": "true",
|
|
503
|
+
className: `absolute right-md flex items-center text-muted ${iconSize}`,
|
|
504
|
+
children: trailingIcon
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
] }),
|
|
508
|
+
(error || helperText) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
509
|
+
"p",
|
|
510
|
+
{
|
|
511
|
+
id: helperId,
|
|
512
|
+
className: `text-body-sm ${hasError ? "text-semantic-error" : "text-muted"}`,
|
|
513
|
+
children: error ?? helperText
|
|
514
|
+
}
|
|
515
|
+
)
|
|
516
|
+
] });
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
Input.displayName = "Input";
|
|
520
|
+
|
|
521
|
+
// virtual-pkg:src/atoms/PromptInputBar/PromptInputBar.tsx
|
|
522
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
523
|
+
var MODES = ["Build", "Chat", "Design"];
|
|
524
|
+
var XIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
525
|
+
"svg",
|
|
526
|
+
{
|
|
527
|
+
viewBox: "0 0 16 16",
|
|
528
|
+
fill: "none",
|
|
529
|
+
stroke: "currentColor",
|
|
530
|
+
strokeWidth: 2.5,
|
|
531
|
+
strokeLinecap: "round",
|
|
532
|
+
className: "w-2.5 h-2.5",
|
|
533
|
+
"aria-hidden": "true",
|
|
534
|
+
children: [
|
|
535
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "4", y1: "4", x2: "12", y2: "12" }),
|
|
536
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "12", y1: "4", x2: "4", y2: "12" })
|
|
537
|
+
]
|
|
538
|
+
}
|
|
539
|
+
);
|
|
540
|
+
function useClickOutside(ref, onClose, enabled) {
|
|
541
|
+
import_react4.default.useEffect(() => {
|
|
542
|
+
if (!enabled) return;
|
|
543
|
+
const handler = (e) => {
|
|
544
|
+
if (ref.current && !ref.current.contains(e.target)) {
|
|
545
|
+
onClose();
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
document.addEventListener("mousedown", handler);
|
|
549
|
+
document.addEventListener("touchstart", handler);
|
|
550
|
+
return () => {
|
|
551
|
+
document.removeEventListener("mousedown", handler);
|
|
552
|
+
document.removeEventListener("touchstart", handler);
|
|
553
|
+
};
|
|
554
|
+
}, [ref, onClose, enabled]);
|
|
555
|
+
}
|
|
556
|
+
var PromptInputBar = import_react4.default.forwardRef(
|
|
557
|
+
({
|
|
558
|
+
placeholder = "Ask Lovable...",
|
|
559
|
+
value,
|
|
560
|
+
onChange,
|
|
561
|
+
mode = "Build",
|
|
562
|
+
onModeChange,
|
|
563
|
+
onSend,
|
|
564
|
+
onAttach,
|
|
565
|
+
onFilesSelected,
|
|
566
|
+
onVisualEdits,
|
|
567
|
+
onMic,
|
|
568
|
+
disabled = false,
|
|
569
|
+
isStreaming = false,
|
|
570
|
+
onStop,
|
|
571
|
+
models,
|
|
572
|
+
selectedModelId,
|
|
573
|
+
onModelChange,
|
|
574
|
+
pastedImages,
|
|
575
|
+
onImagesChange,
|
|
576
|
+
className
|
|
577
|
+
}, ref) => {
|
|
578
|
+
const [internalValue, setInternalValue] = import_react4.default.useState("");
|
|
579
|
+
const [internalImages, setInternalImages] = import_react4.default.useState([]);
|
|
580
|
+
const [modeOpen, setModeOpen] = import_react4.default.useState(false);
|
|
581
|
+
const [modelOpen, setModelOpen] = import_react4.default.useState(false);
|
|
582
|
+
const fileInputRef = import_react4.default.useRef(null);
|
|
583
|
+
const modeRef = import_react4.default.useRef(null);
|
|
584
|
+
const modelRef = import_react4.default.useRef(null);
|
|
585
|
+
useClickOutside(modeRef, import_react4.default.useCallback(() => setModeOpen(false), []), modeOpen);
|
|
586
|
+
useClickOutside(modelRef, import_react4.default.useCallback(() => setModelOpen(false), []), modelOpen);
|
|
587
|
+
const textValue = value !== void 0 ? value : internalValue;
|
|
588
|
+
const images = pastedImages !== void 0 ? pastedImages : internalImages;
|
|
589
|
+
const selectedModel = models?.find((m) => m.id === selectedModelId) ?? models?.[0];
|
|
590
|
+
const addImageFiles = import_react4.default.useCallback(
|
|
591
|
+
(files) => {
|
|
592
|
+
const next = files.filter((f) => f.type.startsWith("image/")).map((f) => ({
|
|
593
|
+
id: `${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
594
|
+
url: URL.createObjectURL(f),
|
|
595
|
+
name: f.name || "image"
|
|
596
|
+
}));
|
|
597
|
+
if (next.length === 0) return;
|
|
598
|
+
const updated = [...images, ...next];
|
|
599
|
+
if (pastedImages !== void 0) {
|
|
600
|
+
onImagesChange?.(updated);
|
|
601
|
+
} else {
|
|
602
|
+
setInternalImages(updated);
|
|
603
|
+
onImagesChange?.(updated);
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
[images, pastedImages, onImagesChange]
|
|
607
|
+
);
|
|
608
|
+
const removeImage = import_react4.default.useCallback(
|
|
609
|
+
(id) => {
|
|
610
|
+
const target = images.find((img) => img.id === id);
|
|
611
|
+
if (target) URL.revokeObjectURL(target.url);
|
|
612
|
+
const updated = images.filter((img) => img.id !== id);
|
|
613
|
+
if (pastedImages !== void 0) {
|
|
614
|
+
onImagesChange?.(updated);
|
|
615
|
+
} else {
|
|
616
|
+
setInternalImages(updated);
|
|
617
|
+
onImagesChange?.(updated);
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
[images, pastedImages, onImagesChange]
|
|
621
|
+
);
|
|
622
|
+
const handleChange = (e) => {
|
|
623
|
+
if (value === void 0) setInternalValue(e.target.value);
|
|
624
|
+
onChange?.(e.target.value);
|
|
625
|
+
};
|
|
626
|
+
const handleSend = () => {
|
|
627
|
+
if (!textValue.trim() && images.length === 0) return;
|
|
628
|
+
onSend?.(textValue, images);
|
|
629
|
+
if (value === void 0) setInternalValue("");
|
|
630
|
+
if (pastedImages !== void 0) {
|
|
631
|
+
onImagesChange?.([]);
|
|
632
|
+
} else {
|
|
633
|
+
internalImages.forEach((img) => URL.revokeObjectURL(img.url));
|
|
634
|
+
setInternalImages([]);
|
|
635
|
+
onImagesChange?.([]);
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
const handleKeyDown = (e) => {
|
|
639
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
640
|
+
e.preventDefault();
|
|
641
|
+
handleSend();
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
const handlePaste = (e) => {
|
|
645
|
+
const files = Array.from(e.clipboardData.items).filter((item) => item.kind === "file" && item.type.startsWith("image/")).map((item) => item.getAsFile()).filter((f) => f !== null);
|
|
646
|
+
if (files.length > 0) {
|
|
647
|
+
e.preventDefault();
|
|
648
|
+
addImageFiles(files);
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
const handleAttachClick = () => {
|
|
652
|
+
if (onFilesSelected) {
|
|
653
|
+
fileInputRef.current?.click();
|
|
654
|
+
} else {
|
|
655
|
+
onAttach?.();
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
const handleFileInputChange = (e) => {
|
|
659
|
+
if (e.target.files && e.target.files.length > 0) {
|
|
660
|
+
onFilesSelected?.(e.target.files);
|
|
661
|
+
e.target.value = "";
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
const canSend = (textValue.trim().length > 0 || images.length > 0) && !disabled && !isStreaming;
|
|
665
|
+
const textareaDisabled = disabled || isStreaming;
|
|
666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref, className: ["w-full", className].filter(Boolean).join(" "), children: [
|
|
667
|
+
onFilesSelected && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
668
|
+
Input,
|
|
669
|
+
{
|
|
670
|
+
ref: fileInputRef,
|
|
671
|
+
type: "file",
|
|
672
|
+
multiple: true,
|
|
673
|
+
"aria-hidden": "true",
|
|
674
|
+
tabIndex: -1,
|
|
675
|
+
className: "sr-only",
|
|
676
|
+
onChange: handleFileInputChange
|
|
677
|
+
}
|
|
678
|
+
),
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "w-full rounded-xl bg-canvas shadow-card border border-hairline px-lg pt-lg pb-md flex flex-col gap-md", children: [
|
|
680
|
+
images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
681
|
+
"div",
|
|
682
|
+
{
|
|
683
|
+
role: "list",
|
|
684
|
+
"aria-label": "Attached images",
|
|
685
|
+
className: "flex flex-wrap gap-sm",
|
|
686
|
+
children: images.map((img) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
687
|
+
"div",
|
|
688
|
+
{
|
|
689
|
+
role: "listitem",
|
|
690
|
+
className: "relative group flex-shrink-0",
|
|
691
|
+
children: [
|
|
692
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-16 h-16 rounded-md overflow-hidden border border-hairline bg-surface-soft", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
693
|
+
"img",
|
|
694
|
+
{
|
|
695
|
+
src: img.url,
|
|
696
|
+
alt: img.name,
|
|
697
|
+
className: "w-full h-full object-cover"
|
|
698
|
+
}
|
|
699
|
+
) }),
|
|
700
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
701
|
+
Button,
|
|
702
|
+
{
|
|
703
|
+
variant: "ghost",
|
|
704
|
+
size: "sm",
|
|
705
|
+
onClick: () => removeImage(img.id),
|
|
706
|
+
"aria-label": `Remove image ${img.name}`,
|
|
707
|
+
className: "absolute -top-1.5 -right-1.5 !p-0 !w-5 !h-5 !min-w-0 !rounded-full bg-ink text-on-primary hover:bg-body opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity duration-150 shadow-sm flex items-center justify-center",
|
|
708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(XIcon, {})
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
]
|
|
712
|
+
},
|
|
713
|
+
img.id
|
|
714
|
+
))
|
|
715
|
+
}
|
|
716
|
+
),
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
718
|
+
"textarea",
|
|
719
|
+
{
|
|
720
|
+
"aria-label": "Prompt input",
|
|
721
|
+
placeholder,
|
|
722
|
+
value: textValue,
|
|
723
|
+
onChange: handleChange,
|
|
724
|
+
onKeyDown: handleKeyDown,
|
|
725
|
+
onPaste: handlePaste,
|
|
726
|
+
disabled: textareaDisabled,
|
|
727
|
+
rows: 2,
|
|
728
|
+
className: "w-full resize-none bg-transparent text-body-md text-ink placeholder:text-muted-soft outline-none border-none leading-relaxed disabled:opacity-50"
|
|
729
|
+
}
|
|
730
|
+
),
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center justify-between gap-sm", children: [
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-sm", children: [
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
734
|
+
"span",
|
|
735
|
+
{
|
|
736
|
+
role: "button",
|
|
737
|
+
tabIndex: 0,
|
|
738
|
+
onClick: handleAttachClick,
|
|
739
|
+
onKeyDown: (e) => e.key === "Enter" && handleAttachClick(),
|
|
740
|
+
"aria-label": "Attach",
|
|
741
|
+
className: "flex items-center justify-center size-8 rounded-full bg-surface-soft border border-hairline text-ink hover:bg-surface-strong active:bg-surface-strong transition-colors duration-150 flex-shrink-0 cursor-pointer",
|
|
742
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
743
|
+
"svg",
|
|
744
|
+
{
|
|
745
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
746
|
+
viewBox: "0 0 24 24",
|
|
747
|
+
fill: "none",
|
|
748
|
+
stroke: "currentColor",
|
|
749
|
+
strokeWidth: "2",
|
|
750
|
+
strokeLinecap: "round",
|
|
751
|
+
strokeLinejoin: "round",
|
|
752
|
+
className: "size-4",
|
|
753
|
+
"aria-hidden": "true",
|
|
754
|
+
children: [
|
|
755
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
756
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
757
|
+
]
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
}
|
|
761
|
+
),
|
|
762
|
+
onVisualEdits !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
763
|
+
Button,
|
|
764
|
+
{
|
|
765
|
+
variant: "primary",
|
|
766
|
+
size: "sm",
|
|
767
|
+
onClick: onVisualEdits,
|
|
768
|
+
"aria-label": "Visual edits",
|
|
769
|
+
className: "rounded-full px-md gap-xs",
|
|
770
|
+
children: [
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
772
|
+
"svg",
|
|
773
|
+
{
|
|
774
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
775
|
+
viewBox: "0 0 24 24",
|
|
776
|
+
fill: "none",
|
|
777
|
+
stroke: "currentColor",
|
|
778
|
+
strokeWidth: "2",
|
|
779
|
+
strokeLinecap: "round",
|
|
780
|
+
strokeLinejoin: "round",
|
|
781
|
+
className: "size-4 flex-shrink-0",
|
|
782
|
+
"aria-hidden": "true",
|
|
783
|
+
children: [
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M17 1l4 4-4 4" }),
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 11V9a4 4 0 0 1 4-4h14" }),
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7 23l-4-4 4-4" }),
|
|
787
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 13v2a4 4 0 0 1-4 4H3" })
|
|
788
|
+
]
|
|
789
|
+
}
|
|
790
|
+
),
|
|
791
|
+
"Visual edits"
|
|
792
|
+
]
|
|
793
|
+
}
|
|
794
|
+
),
|
|
795
|
+
models && models.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: modelRef, className: "relative", children: [
|
|
796
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
797
|
+
"span",
|
|
798
|
+
{
|
|
799
|
+
role: "button",
|
|
800
|
+
tabIndex: 0,
|
|
801
|
+
onClick: () => setModelOpen((o) => !o),
|
|
802
|
+
onKeyDown: (e) => {
|
|
803
|
+
if (e.key === "Enter") setModelOpen((o) => !o);
|
|
804
|
+
if (e.key === "Escape") setModelOpen(false);
|
|
805
|
+
},
|
|
806
|
+
"aria-haspopup": "listbox",
|
|
807
|
+
"aria-expanded": modelOpen,
|
|
808
|
+
"aria-label": "Select model",
|
|
809
|
+
className: "flex items-center gap-xs text-body-sm font-weight-heading-sm text-muted hover:text-ink transition-colors duration-150 cursor-pointer select-none rounded-sm px-xs py-xxs",
|
|
810
|
+
children: [
|
|
811
|
+
(models.find((m) => m.id === selectedModelId) ?? models[0])?.name ?? "Model",
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
813
|
+
"svg",
|
|
814
|
+
{
|
|
815
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
816
|
+
viewBox: "0 0 24 24",
|
|
817
|
+
fill: "none",
|
|
818
|
+
stroke: "currentColor",
|
|
819
|
+
strokeWidth: "2.5",
|
|
820
|
+
strokeLinecap: "round",
|
|
821
|
+
strokeLinejoin: "round",
|
|
822
|
+
className: "size-3",
|
|
823
|
+
"aria-hidden": "true",
|
|
824
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
825
|
+
}
|
|
826
|
+
)
|
|
827
|
+
]
|
|
828
|
+
}
|
|
829
|
+
),
|
|
830
|
+
modelOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
831
|
+
"ul",
|
|
832
|
+
{
|
|
833
|
+
role: "listbox",
|
|
834
|
+
"aria-label": "Model options",
|
|
835
|
+
className: "absolute bottom-full mb-xs left-0 bg-canvas border border-hairline rounded-md shadow-md min-w-[12rem] max-h-[250px] overflow-y-auto",
|
|
836
|
+
style: { zIndex: "var(--z-dropdown, 50)" },
|
|
837
|
+
children: models.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { role: "option", "aria-selected": m.id === selectedModelId, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
838
|
+
"span",
|
|
839
|
+
{
|
|
840
|
+
role: "button",
|
|
841
|
+
tabIndex: 0,
|
|
842
|
+
onClick: () => {
|
|
843
|
+
onModelChange?.(m.id);
|
|
844
|
+
setModelOpen(false);
|
|
845
|
+
},
|
|
846
|
+
onKeyDown: (e) => {
|
|
847
|
+
if (e.key === "Enter") {
|
|
848
|
+
onModelChange?.(m.id);
|
|
849
|
+
setModelOpen(false);
|
|
850
|
+
}
|
|
851
|
+
if (e.key === "Escape") setModelOpen(false);
|
|
852
|
+
},
|
|
853
|
+
className: [
|
|
854
|
+
"flex flex-col w-full text-left px-md py-sm transition-colors duration-100 cursor-pointer",
|
|
855
|
+
m.id === selectedModelId ? "bg-surface-soft" : "hover:bg-surface-soft"
|
|
856
|
+
].join(" "),
|
|
857
|
+
children: [
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "flex items-center gap-xs", children: [
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
860
|
+
"span",
|
|
861
|
+
{
|
|
862
|
+
className: [
|
|
863
|
+
"text-body-sm",
|
|
864
|
+
m.id === selectedModelId ? "font-weight-heading-sm text-ink" : "text-body"
|
|
865
|
+
].join(" "),
|
|
866
|
+
children: m.name
|
|
867
|
+
}
|
|
868
|
+
),
|
|
869
|
+
m.tier && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-caption text-muted bg-surface-strong rounded-xs px-xs py-xxs leading-none", children: m.tier })
|
|
870
|
+
] }),
|
|
871
|
+
m.description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-caption text-muted mt-xxs", children: m.description })
|
|
872
|
+
]
|
|
873
|
+
}
|
|
874
|
+
) }, m.id))
|
|
875
|
+
}
|
|
876
|
+
)
|
|
877
|
+
] })
|
|
878
|
+
] }),
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-sm", children: [
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref: modeRef, className: "relative", children: [
|
|
881
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
882
|
+
"span",
|
|
883
|
+
{
|
|
884
|
+
role: "button",
|
|
885
|
+
tabIndex: 0,
|
|
886
|
+
onClick: () => setModeOpen((o) => !o),
|
|
887
|
+
onKeyDown: (e) => {
|
|
888
|
+
if (e.key === "Enter") setModeOpen((o) => !o);
|
|
889
|
+
if (e.key === "Escape") setModeOpen(false);
|
|
890
|
+
},
|
|
891
|
+
"aria-haspopup": "listbox",
|
|
892
|
+
"aria-expanded": modeOpen,
|
|
893
|
+
className: "flex items-center gap-xs text-body-md font-weight-heading-sm text-ink hover:text-muted transition-colors duration-150 cursor-pointer select-none",
|
|
894
|
+
children: [
|
|
895
|
+
mode,
|
|
896
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
897
|
+
"svg",
|
|
898
|
+
{
|
|
899
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
900
|
+
viewBox: "0 0 24 24",
|
|
901
|
+
fill: "none",
|
|
902
|
+
stroke: "currentColor",
|
|
903
|
+
strokeWidth: "2.5",
|
|
904
|
+
strokeLinecap: "round",
|
|
905
|
+
strokeLinejoin: "round",
|
|
906
|
+
className: "size-4",
|
|
907
|
+
"aria-hidden": "true",
|
|
908
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
909
|
+
}
|
|
910
|
+
)
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
modeOpen && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
915
|
+
"ul",
|
|
916
|
+
{
|
|
917
|
+
role: "listbox",
|
|
918
|
+
className: "absolute bottom-full mb-xs right-0 bg-canvas border border-hairline rounded-md shadow-md py-xs min-w-[8rem]",
|
|
919
|
+
style: { zIndex: "var(--z-dropdown, 50)" },
|
|
920
|
+
children: MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { role: "option", "aria-selected": m === mode, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
921
|
+
"span",
|
|
922
|
+
{
|
|
923
|
+
role: "button",
|
|
924
|
+
tabIndex: 0,
|
|
925
|
+
onClick: () => {
|
|
926
|
+
onModeChange?.(m);
|
|
927
|
+
setModeOpen(false);
|
|
928
|
+
},
|
|
929
|
+
onKeyDown: (e) => {
|
|
930
|
+
if (e.key === "Enter") {
|
|
931
|
+
onModeChange?.(m);
|
|
932
|
+
setModeOpen(false);
|
|
933
|
+
}
|
|
934
|
+
if (e.key === "Escape") setModeOpen(false);
|
|
935
|
+
},
|
|
936
|
+
className: [
|
|
937
|
+
"block w-full text-left px-md py-xs text-body-sm transition-colors duration-100 cursor-pointer",
|
|
938
|
+
m === mode ? "text-ink font-weight-heading-sm bg-surface-soft" : "text-muted hover:bg-surface-soft"
|
|
939
|
+
].join(" "),
|
|
940
|
+
children: m
|
|
941
|
+
}
|
|
942
|
+
) }, m))
|
|
943
|
+
}
|
|
944
|
+
)
|
|
945
|
+
] }),
|
|
946
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
947
|
+
"span",
|
|
948
|
+
{
|
|
949
|
+
role: "button",
|
|
950
|
+
tabIndex: 0,
|
|
951
|
+
onClick: onMic,
|
|
952
|
+
onKeyDown: (e) => e.key === "Enter" && onMic?.(),
|
|
953
|
+
"aria-label": "Voice input",
|
|
954
|
+
className: "flex items-center justify-center size-9 rounded-full bg-surface-soft border border-hairline text-ink hover:bg-surface-strong active:bg-surface-strong transition-colors duration-150 flex-shrink-0 cursor-pointer",
|
|
955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
956
|
+
"svg",
|
|
957
|
+
{
|
|
958
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
959
|
+
viewBox: "0 0 24 24",
|
|
960
|
+
fill: "none",
|
|
961
|
+
stroke: "currentColor",
|
|
962
|
+
strokeWidth: "1.75",
|
|
963
|
+
strokeLinecap: "round",
|
|
964
|
+
strokeLinejoin: "round",
|
|
965
|
+
className: "size-4",
|
|
966
|
+
"aria-hidden": "true",
|
|
967
|
+
children: [
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "9", y: "2", width: "6", height: "11", rx: "3" }),
|
|
969
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M19 10a7 7 0 0 1-14 0" }),
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "12", y1: "19", x2: "12", y2: "22" }),
|
|
971
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "8", y1: "22", x2: "16", y2: "22" })
|
|
972
|
+
]
|
|
973
|
+
}
|
|
974
|
+
)
|
|
975
|
+
}
|
|
976
|
+
),
|
|
977
|
+
isStreaming ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
978
|
+
"span",
|
|
979
|
+
{
|
|
980
|
+
role: "button",
|
|
981
|
+
tabIndex: 0,
|
|
982
|
+
onClick: onStop,
|
|
983
|
+
onKeyDown: (e) => e.key === "Enter" && onStop?.(),
|
|
984
|
+
"aria-label": "Stop generation",
|
|
985
|
+
className: "flex items-center justify-center size-9 rounded-full bg-ink text-on-primary hover:bg-body transition-colors duration-150 flex-shrink-0 cursor-pointer",
|
|
986
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
987
|
+
"svg",
|
|
988
|
+
{
|
|
989
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
990
|
+
viewBox: "0 0 24 24",
|
|
991
|
+
fill: "currentColor",
|
|
992
|
+
className: "size-4",
|
|
993
|
+
"aria-hidden": "true",
|
|
994
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "5", y: "5", width: "14", height: "14", rx: "2" })
|
|
995
|
+
}
|
|
996
|
+
)
|
|
997
|
+
}
|
|
998
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
999
|
+
"span",
|
|
1000
|
+
{
|
|
1001
|
+
role: "button",
|
|
1002
|
+
tabIndex: 0,
|
|
1003
|
+
onClick: canSend ? handleSend : void 0,
|
|
1004
|
+
onKeyDown: (e) => e.key === "Enter" && canSend && handleSend(),
|
|
1005
|
+
"aria-label": "Send",
|
|
1006
|
+
"aria-disabled": !canSend,
|
|
1007
|
+
className: [
|
|
1008
|
+
"flex items-center justify-center size-9 rounded-full transition-colors duration-150 flex-shrink-0",
|
|
1009
|
+
canSend ? "bg-primary text-on-primary hover:bg-primary-hover active:bg-primary-active cursor-pointer" : "bg-surface-strong text-muted-soft cursor-not-allowed"
|
|
1010
|
+
].join(" "),
|
|
1011
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1012
|
+
"svg",
|
|
1013
|
+
{
|
|
1014
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1015
|
+
viewBox: "0 0 24 24",
|
|
1016
|
+
fill: "none",
|
|
1017
|
+
stroke: "currentColor",
|
|
1018
|
+
strokeWidth: "2.25",
|
|
1019
|
+
strokeLinecap: "round",
|
|
1020
|
+
strokeLinejoin: "round",
|
|
1021
|
+
className: "size-4",
|
|
1022
|
+
"aria-hidden": "true",
|
|
1023
|
+
children: [
|
|
1024
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "12", y1: "19", x2: "12", y2: "5" }),
|
|
1025
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("polyline", { points: "5 12 12 5 19 12" })
|
|
1026
|
+
]
|
|
1027
|
+
}
|
|
1028
|
+
)
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
] })
|
|
1032
|
+
] })
|
|
1033
|
+
] })
|
|
1034
|
+
] });
|
|
1035
|
+
}
|
|
1036
|
+
);
|
|
1037
|
+
PromptInputBar.displayName = "PromptInputBar";
|
|
1038
|
+
|
|
1039
|
+
// virtual-pkg:src/atoms/ChatScreen/ChatScreen.tsx
|
|
1040
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1041
|
+
var ChatEmptyIllustration = () => (
|
|
1042
|
+
// 112px container — stable width regardless of Tailwind spacing scale.
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1044
|
+
"div",
|
|
1045
|
+
{
|
|
1046
|
+
className: "relative flex-shrink-0",
|
|
1047
|
+
"aria-hidden": "true",
|
|
1048
|
+
style: { width: 112 },
|
|
1049
|
+
children: [
|
|
1050
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1051
|
+
"svg",
|
|
1052
|
+
{
|
|
1053
|
+
viewBox: "0 0 160 140",
|
|
1054
|
+
width: "112",
|
|
1055
|
+
height: "98",
|
|
1056
|
+
className: "text-primary",
|
|
1057
|
+
fill: "currentColor",
|
|
1058
|
+
style: { opacity: 0.15, display: "block" },
|
|
1059
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M78 8c28-6 52 10 58 34 6 24-6 44-4 62 2 16-14 30-36 32-26 2-48-8-62-28-12-18-22-42-10-58C36 30 52 14 78 8z" })
|
|
1060
|
+
}
|
|
1061
|
+
),
|
|
1062
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1063
|
+
"div",
|
|
1064
|
+
{
|
|
1065
|
+
className: "relative flex items-center justify-center rounded-full bg-primary shadow-sm",
|
|
1066
|
+
style: { width: 64, height: 64 },
|
|
1067
|
+
children: [
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col", style: { width: 32, gap: 6 }, children: [
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1070
|
+
"span",
|
|
1071
|
+
{
|
|
1072
|
+
className: "rounded-full bg-on-primary",
|
|
1073
|
+
style: { height: 6, width: "100%" }
|
|
1074
|
+
}
|
|
1075
|
+
),
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1077
|
+
"span",
|
|
1078
|
+
{
|
|
1079
|
+
className: "rounded-full bg-on-primary",
|
|
1080
|
+
style: { height: 6, width: "66%" }
|
|
1081
|
+
}
|
|
1082
|
+
)
|
|
1083
|
+
] }),
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1085
|
+
"span",
|
|
1086
|
+
{
|
|
1087
|
+
className: "absolute bg-primary",
|
|
1088
|
+
style: {
|
|
1089
|
+
width: 12,
|
|
1090
|
+
height: 12,
|
|
1091
|
+
bottom: -2,
|
|
1092
|
+
right: 8,
|
|
1093
|
+
transform: "rotate(45deg)",
|
|
1094
|
+
borderRadius: 2
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
)
|
|
1098
|
+
]
|
|
1099
|
+
}
|
|
1100
|
+
) }),
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1102
|
+
"svg",
|
|
1103
|
+
{
|
|
1104
|
+
viewBox: "0 0 24 24",
|
|
1105
|
+
width: "12",
|
|
1106
|
+
height: "12",
|
|
1107
|
+
className: "absolute text-primary",
|
|
1108
|
+
fill: "currentColor",
|
|
1109
|
+
"aria-hidden": "true",
|
|
1110
|
+
style: { left: 8, top: 16 },
|
|
1111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" })
|
|
1112
|
+
}
|
|
1113
|
+
),
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1115
|
+
"svg",
|
|
1116
|
+
{
|
|
1117
|
+
viewBox: "0 0 24 24",
|
|
1118
|
+
width: "10",
|
|
1119
|
+
height: "10",
|
|
1120
|
+
className: "absolute text-primary",
|
|
1121
|
+
fill: "currentColor",
|
|
1122
|
+
"aria-hidden": "true",
|
|
1123
|
+
style: { right: 12, top: 32 },
|
|
1124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" })
|
|
1125
|
+
}
|
|
1126
|
+
),
|
|
1127
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1128
|
+
"svg",
|
|
1129
|
+
{
|
|
1130
|
+
viewBox: "0 0 24 24",
|
|
1131
|
+
width: "8",
|
|
1132
|
+
height: "8",
|
|
1133
|
+
className: "absolute text-primary",
|
|
1134
|
+
fill: "currentColor",
|
|
1135
|
+
"aria-hidden": "true",
|
|
1136
|
+
style: { left: 24, bottom: 24 },
|
|
1137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" })
|
|
1138
|
+
}
|
|
1139
|
+
),
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1141
|
+
"svg",
|
|
1142
|
+
{
|
|
1143
|
+
viewBox: "0 0 24 24",
|
|
1144
|
+
width: "14",
|
|
1145
|
+
height: "14",
|
|
1146
|
+
className: "absolute text-primary",
|
|
1147
|
+
fill: "currentColor",
|
|
1148
|
+
"aria-hidden": "true",
|
|
1149
|
+
style: { right: 8, bottom: 32 },
|
|
1150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" })
|
|
1151
|
+
}
|
|
1152
|
+
)
|
|
1153
|
+
]
|
|
1154
|
+
}
|
|
1155
|
+
)
|
|
1156
|
+
);
|
|
1157
|
+
var ChatEmptyStateContent = ({
|
|
1158
|
+
title,
|
|
1159
|
+
description
|
|
1160
|
+
}) => (
|
|
1161
|
+
// Use inline gap so the layout is robust when gap-lg is absent in the consumer theme.
|
|
1162
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center px-lg", style: { gap: 24 }, children: [
|
|
1163
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChatEmptyIllustration, {}),
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex min-w-0 flex-col gap-xs", children: [
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "text-heading-sm font-weight-heading-sm text-ink", children: title }),
|
|
1166
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-sm text-muted", style: { maxWidth: "24rem" }, children: description })
|
|
1167
|
+
] })
|
|
1168
|
+
] })
|
|
1169
|
+
);
|
|
1170
|
+
var ChevronIcon2 = ({ expanded }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1171
|
+
"svg",
|
|
1172
|
+
{
|
|
1173
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1174
|
+
viewBox: "0 0 24 24",
|
|
1175
|
+
fill: "none",
|
|
1176
|
+
stroke: "currentColor",
|
|
1177
|
+
strokeWidth: "2",
|
|
1178
|
+
strokeLinecap: "round",
|
|
1179
|
+
strokeLinejoin: "round",
|
|
1180
|
+
className: "size-4 text-muted flex-shrink-0 transition-transform duration-200",
|
|
1181
|
+
style: { transform: expanded ? "rotate(180deg)" : "rotate(0deg)" },
|
|
1182
|
+
"aria-hidden": "true",
|
|
1183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
1184
|
+
}
|
|
1185
|
+
);
|
|
1186
|
+
var PlanCardBlock = ({ plan }) => {
|
|
1187
|
+
const [titleExpanded, setTitleExpanded] = import_react5.default.useState(false);
|
|
1188
|
+
const titleRef = import_react5.default.useRef(null);
|
|
1189
|
+
const [isOverflowing, setIsOverflowing] = import_react5.default.useState(false);
|
|
1190
|
+
import_react5.default.useEffect(() => {
|
|
1191
|
+
const el = titleRef.current;
|
|
1192
|
+
if (!el) return;
|
|
1193
|
+
const check = () => {
|
|
1194
|
+
if (el) {
|
|
1195
|
+
setIsOverflowing(el.scrollHeight > el.clientHeight + 2);
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
check();
|
|
1199
|
+
const ro = new ResizeObserver(check);
|
|
1200
|
+
ro.observe(el);
|
|
1201
|
+
return () => ro.disconnect();
|
|
1202
|
+
}, [plan.title]);
|
|
1203
|
+
const hasActivity = plan.tasks.some(
|
|
1204
|
+
(t) => t.status === "in_progress" || t.status === "done" || t.status === "failed"
|
|
1205
|
+
);
|
|
1206
|
+
const visibleTasks = plan.tasks.filter(
|
|
1207
|
+
(t) => t.status === "in_progress" || t.status === "done" || t.status === "failed"
|
|
1208
|
+
);
|
|
1209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mt-md rounded-xl border border-hairline bg-canvas shadow-sm overflow-hidden", children: [
|
|
1210
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-start gap-sm px-lg py-md border-b border-hairline-soft", children: [
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1212
|
+
"svg",
|
|
1213
|
+
{
|
|
1214
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1215
|
+
viewBox: "0 0 24 24",
|
|
1216
|
+
fill: "none",
|
|
1217
|
+
stroke: "currentColor",
|
|
1218
|
+
strokeWidth: "2",
|
|
1219
|
+
strokeLinecap: "round",
|
|
1220
|
+
strokeLinejoin: "round",
|
|
1221
|
+
className: "size-4 text-primary flex-shrink-0 mt-xs",
|
|
1222
|
+
"aria-hidden": "true",
|
|
1223
|
+
children: [
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "8", y1: "6", x2: "21", y2: "6" }),
|
|
1225
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "8", y1: "12", x2: "21", y2: "12" }),
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "8", y1: "18", x2: "21", y2: "18" }),
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "3", y1: "6", x2: "3.01", y2: "6" }),
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "3", y1: "12", x2: "3.01", y2: "12" }),
|
|
1229
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "3", y1: "18", x2: "3.01", y2: "18" })
|
|
1230
|
+
]
|
|
1231
|
+
}
|
|
1232
|
+
),
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 min-w-0 flex items-start gap-xs", children: [
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1235
|
+
"span",
|
|
1236
|
+
{
|
|
1237
|
+
ref: titleRef,
|
|
1238
|
+
className: "text-body-sm font-weight-heading-sm text-primary flex-1 min-w-0",
|
|
1239
|
+
style: titleExpanded ? void 0 : {
|
|
1240
|
+
display: "-webkit-box",
|
|
1241
|
+
WebkitLineClamp: 2,
|
|
1242
|
+
WebkitBoxOrient: "vertical",
|
|
1243
|
+
overflow: "hidden"
|
|
1244
|
+
},
|
|
1245
|
+
children: plan.title
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
isOverflowing && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1249
|
+
Button,
|
|
1250
|
+
{
|
|
1251
|
+
variant: "ghost",
|
|
1252
|
+
size: "sm",
|
|
1253
|
+
type: "button",
|
|
1254
|
+
onClick: () => setTitleExpanded((prev) => !prev),
|
|
1255
|
+
"aria-label": titleExpanded ? "Collapse plan title" : "Expand plan title",
|
|
1256
|
+
className: "flex-shrink-0 !p-xxs !rounded-xs",
|
|
1257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronIcon2, { expanded: titleExpanded })
|
|
1258
|
+
}
|
|
1259
|
+
)
|
|
1260
|
+
] })
|
|
1261
|
+
] }),
|
|
1262
|
+
hasActivity && visibleTasks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ol", { className: "flex flex-col divide-y divide-hairline-soft", children: visibleTasks.map((task) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1263
|
+
"li",
|
|
1264
|
+
{
|
|
1265
|
+
className: "flex items-center gap-md px-lg py-md",
|
|
1266
|
+
children: [
|
|
1267
|
+
task.status === "in_progress" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1268
|
+
"span",
|
|
1269
|
+
{
|
|
1270
|
+
className: "flex-shrink-0 size-3 rounded-full bg-primary animate-pulse",
|
|
1271
|
+
"aria-label": "In progress"
|
|
1272
|
+
}
|
|
1273
|
+
),
|
|
1274
|
+
task.status === "done" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "flex-shrink-0", "aria-label": "Done", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1275
|
+
"svg",
|
|
1276
|
+
{
|
|
1277
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1278
|
+
viewBox: "0 0 24 24",
|
|
1279
|
+
fill: "none",
|
|
1280
|
+
stroke: "currentColor",
|
|
1281
|
+
strokeWidth: "2.5",
|
|
1282
|
+
strokeLinecap: "round",
|
|
1283
|
+
strokeLinejoin: "round",
|
|
1284
|
+
className: "size-4 text-semantic-success",
|
|
1285
|
+
"aria-hidden": "true",
|
|
1286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { points: "20 6 9 17 4 12" })
|
|
1287
|
+
}
|
|
1288
|
+
) }),
|
|
1289
|
+
task.status === "failed" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "flex-shrink-0", "aria-label": "Failed", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1290
|
+
"svg",
|
|
1291
|
+
{
|
|
1292
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1293
|
+
viewBox: "0 0 24 24",
|
|
1294
|
+
fill: "none",
|
|
1295
|
+
stroke: "currentColor",
|
|
1296
|
+
strokeWidth: "2.5",
|
|
1297
|
+
strokeLinecap: "round",
|
|
1298
|
+
strokeLinejoin: "round",
|
|
1299
|
+
className: "size-4 text-semantic-error",
|
|
1300
|
+
"aria-hidden": "true",
|
|
1301
|
+
children: [
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1303
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1304
|
+
]
|
|
1305
|
+
}
|
|
1306
|
+
) }),
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1308
|
+
"span",
|
|
1309
|
+
{
|
|
1310
|
+
className: [
|
|
1311
|
+
"text-body-sm",
|
|
1312
|
+
task.status === "in_progress" ? "font-weight-heading-sm text-ink" : task.status === "done" ? "line-through text-muted" : task.status === "failed" ? "text-semantic-error" : "text-ink"
|
|
1313
|
+
].filter(Boolean).join(" "),
|
|
1314
|
+
children: task.label
|
|
1315
|
+
}
|
|
1316
|
+
),
|
|
1317
|
+
task.status === "in_progress" && task.currentTool && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ml-auto text-caption text-muted flex-shrink-0", children: task.currentTool })
|
|
1318
|
+
]
|
|
1319
|
+
},
|
|
1320
|
+
task.id
|
|
1321
|
+
)) })
|
|
1322
|
+
] });
|
|
1323
|
+
};
|
|
1324
|
+
var AIAvatar = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1325
|
+
"span",
|
|
1326
|
+
{
|
|
1327
|
+
"aria-hidden": "true",
|
|
1328
|
+
className: "flex-shrink-0 flex items-center justify-center size-8 rounded-full bg-primary text-on-primary text-caption font-weight-heading-sm select-none mt-1",
|
|
1329
|
+
children: "AI"
|
|
1330
|
+
}
|
|
1331
|
+
);
|
|
1332
|
+
var UserAvatar = ({ initials = "U" }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1333
|
+
"span",
|
|
1334
|
+
{
|
|
1335
|
+
"aria-hidden": "true",
|
|
1336
|
+
className: "flex-shrink-0 flex items-center justify-center size-8 rounded-full bg-surface-strong text-muted text-caption font-weight-heading-sm select-none",
|
|
1337
|
+
children: initials
|
|
1338
|
+
}
|
|
1339
|
+
);
|
|
1340
|
+
var SpinnerIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1341
|
+
"svg",
|
|
1342
|
+
{
|
|
1343
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1344
|
+
viewBox: "0 0 24 24",
|
|
1345
|
+
fill: "none",
|
|
1346
|
+
stroke: "currentColor",
|
|
1347
|
+
strokeWidth: "2.5",
|
|
1348
|
+
strokeLinecap: "round",
|
|
1349
|
+
strokeLinejoin: "round",
|
|
1350
|
+
className: "size-4 text-primary animate-spin flex-shrink-0",
|
|
1351
|
+
"aria-hidden": "true",
|
|
1352
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
1353
|
+
}
|
|
1354
|
+
);
|
|
1355
|
+
var AiMessage = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-start gap-md w-full", children: [
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AIAvatar, {}),
|
|
1357
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
1358
|
+
message.inFlight && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-xs mb-sm min-h-8", role: "status", "aria-live": "polite", children: [
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SpinnerIcon, {}),
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-body-sm text-primary", children: message.currentToolLabel ?? "Working\u2026" })
|
|
1361
|
+
] }),
|
|
1362
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-sm text-body leading-relaxed", children: message.content }),
|
|
1363
|
+
message.plan && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PlanCardBlock, { plan: message.plan }),
|
|
1364
|
+
message.postContent && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-sm text-body leading-relaxed mt-md", children: message.postContent })
|
|
1365
|
+
] })
|
|
1366
|
+
] });
|
|
1367
|
+
var UserMessage = ({ message }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-start gap-md w-full justify-end", children: [
|
|
1368
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "max-w-[80%] bg-primary-disabled rounded-xl px-lg py-md", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-body-sm text-ink", children: message.content }) }),
|
|
1369
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UserAvatar, { initials: message.userInitials ?? "U" })
|
|
1370
|
+
] });
|
|
1371
|
+
var DEFAULT_EMPTY_TITLE = "Start the conversation";
|
|
1372
|
+
var DEFAULT_EMPTY_DESCRIPTION = "Ask about atoms, tokens, components, or anything in your design system.";
|
|
1373
|
+
var ChatScreen = import_react5.default.forwardRef(
|
|
1374
|
+
({
|
|
1375
|
+
messages: initialMessages,
|
|
1376
|
+
placeholder = "Ask Lovable...",
|
|
1377
|
+
onSend,
|
|
1378
|
+
children,
|
|
1379
|
+
renderFooter,
|
|
1380
|
+
models,
|
|
1381
|
+
selectedModelId,
|
|
1382
|
+
onModelChange,
|
|
1383
|
+
className,
|
|
1384
|
+
emptyTitle = DEFAULT_EMPTY_TITLE,
|
|
1385
|
+
emptyDescription = DEFAULT_EMPTY_DESCRIPTION,
|
|
1386
|
+
emptyState
|
|
1387
|
+
}, ref) => {
|
|
1388
|
+
const defaultMessages = [
|
|
1389
|
+
{
|
|
1390
|
+
id: "1",
|
|
1391
|
+
role: "user",
|
|
1392
|
+
content: "Build a `PromptInputBar` Molecule that reproduces the Lovable-style prompt bar with placeholder and the bottom toolbar.",
|
|
1393
|
+
userInitials: "DU"
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
id: "2",
|
|
1397
|
+
role: "ai",
|
|
1398
|
+
content: "I'll build the `PromptInputBar` Molecule to match the Lovable-style prompt bar. It will include a soft surface background, large rounded container, textarea with placeholder, and the bottom toolbar with `+`, `Visual edits`, `Build` mode dropdown, mic, and send buttons.\n\nHere's my plan for building this component:",
|
|
1399
|
+
plan: {
|
|
1400
|
+
title: "Plan: Build the PromptInputBar Molecule with all toolbar controls, placeholder text, and mode-switching behaviour for the Lovable editor canvas",
|
|
1401
|
+
tasks: [
|
|
1402
|
+
{ id: "p1", label: "Create the PromptInputBar structure and styling", status: "done" },
|
|
1403
|
+
{ id: "p2", label: "Add textarea with placeholder", status: "done" },
|
|
1404
|
+
{ id: "p3", label: "Build bottom toolbar with all button elements", status: "done" },
|
|
1405
|
+
{ id: "p4", label: "Add interactions and states" },
|
|
1406
|
+
{ id: "p5", label: "Create stories and tests" }
|
|
1407
|
+
]
|
|
1408
|
+
},
|
|
1409
|
+
postContent: "The plan above outlines all the steps. Let me start building the component now."
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
id: "3",
|
|
1413
|
+
role: "ai",
|
|
1414
|
+
content: "Let me start building the `PromptInputBar` Molecule."
|
|
1415
|
+
}
|
|
1416
|
+
];
|
|
1417
|
+
const [messages, setMessages] = import_react5.default.useState(
|
|
1418
|
+
initialMessages !== void 0 ? initialMessages : defaultMessages
|
|
1419
|
+
);
|
|
1420
|
+
const [mode, setMode] = import_react5.default.useState("Build");
|
|
1421
|
+
const threadRef = import_react5.default.useRef(null);
|
|
1422
|
+
const lastMessageCountRef = import_react5.default.useRef(messages.length);
|
|
1423
|
+
import_react5.default.useEffect(() => {
|
|
1424
|
+
if (initialMessages !== void 0) {
|
|
1425
|
+
setMessages(initialMessages);
|
|
1426
|
+
}
|
|
1427
|
+
}, [initialMessages]);
|
|
1428
|
+
import_react5.default.useLayoutEffect(() => {
|
|
1429
|
+
const thread = threadRef.current;
|
|
1430
|
+
if (!thread) return;
|
|
1431
|
+
const previousCount = lastMessageCountRef.current;
|
|
1432
|
+
const currentCount = messages.length;
|
|
1433
|
+
const didGrow = currentCount > previousCount;
|
|
1434
|
+
if (previousCount === currentCount) {
|
|
1435
|
+
thread.scrollTop = thread.scrollHeight;
|
|
1436
|
+
} else if (didGrow) {
|
|
1437
|
+
thread.scrollTop = thread.scrollHeight;
|
|
1438
|
+
}
|
|
1439
|
+
lastMessageCountRef.current = currentCount;
|
|
1440
|
+
}, [messages]);
|
|
1441
|
+
const handleSend = (value) => {
|
|
1442
|
+
if (!children) {
|
|
1443
|
+
const newMsg = {
|
|
1444
|
+
id: String(Date.now()),
|
|
1445
|
+
role: "user",
|
|
1446
|
+
content: value
|
|
1447
|
+
};
|
|
1448
|
+
setMessages((prev) => [...prev, newMsg]);
|
|
1449
|
+
}
|
|
1450
|
+
onSend?.(value);
|
|
1451
|
+
};
|
|
1452
|
+
const showEmptyState = children === void 0 && initialMessages !== void 0 && initialMessages.length === 0;
|
|
1453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1454
|
+
"div",
|
|
1455
|
+
{
|
|
1456
|
+
ref,
|
|
1457
|
+
className: [
|
|
1458
|
+
"w-full flex flex-col bg-surface-soft",
|
|
1459
|
+
className
|
|
1460
|
+
].filter(Boolean).join(" "),
|
|
1461
|
+
style: { height: "100%" },
|
|
1462
|
+
children: [
|
|
1463
|
+
children !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex-1 flex flex-col min-h-0", children }) : showEmptyState ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex-1 flex items-center justify-center overflow-y-auto px-lg py-xl", children: emptyState !== void 0 ? emptyState : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChatEmptyStateContent, { title: emptyTitle, description: emptyDescription }) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { ref: threadRef, className: "flex-1 overflow-y-auto px-lg py-xl", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-full max-w-2xl mx-auto flex flex-col gap-xl", children: messages.map(
|
|
1464
|
+
(msg) => msg.role === "user" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UserMessage, { message: msg }, msg.id) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AiMessage, { message: msg }, msg.id)
|
|
1465
|
+
) }) }),
|
|
1466
|
+
renderFooter !== void 0 ? renderFooter : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-full px-lg pb-lg pt-sm border-t border-hairline-soft bg-canvas", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-full max-w-2xl mx-auto", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1467
|
+
PromptInputBar,
|
|
1468
|
+
{
|
|
1469
|
+
placeholder,
|
|
1470
|
+
mode,
|
|
1471
|
+
onModeChange: setMode,
|
|
1472
|
+
onSend: handleSend,
|
|
1473
|
+
models,
|
|
1474
|
+
selectedModelId,
|
|
1475
|
+
onModelChange
|
|
1476
|
+
}
|
|
1477
|
+
) }) })
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
);
|
|
1481
|
+
}
|
|
1482
|
+
);
|
|
1483
|
+
ChatScreen.displayName = "ChatScreen";
|
|
1484
|
+
|
|
1485
|
+
// virtual-pkg:src/atoms/WorkspaceMenu/WorkspaceMenu.tsx
|
|
1486
|
+
var import_react6 = __toESM(require("react"));
|
|
1487
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1488
|
+
var RenameIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1489
|
+
"svg",
|
|
1490
|
+
{
|
|
1491
|
+
"aria-hidden": "true",
|
|
1492
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1493
|
+
viewBox: "0 0 24 24",
|
|
1494
|
+
fill: "none",
|
|
1495
|
+
stroke: "currentColor",
|
|
1496
|
+
strokeWidth: "2",
|
|
1497
|
+
strokeLinecap: "round",
|
|
1498
|
+
strokeLinejoin: "round",
|
|
1499
|
+
style: { width: "16px", height: "16px", flexShrink: 0 },
|
|
1500
|
+
children: [
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M12 20h9" }),
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z" })
|
|
1503
|
+
]
|
|
1504
|
+
}
|
|
1505
|
+
);
|
|
1506
|
+
var DeleteIcon = () => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1507
|
+
"svg",
|
|
1508
|
+
{
|
|
1509
|
+
"aria-hidden": "true",
|
|
1510
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1511
|
+
viewBox: "0 0 24 24",
|
|
1512
|
+
fill: "none",
|
|
1513
|
+
stroke: "currentColor",
|
|
1514
|
+
strokeWidth: "2",
|
|
1515
|
+
strokeLinecap: "round",
|
|
1516
|
+
strokeLinejoin: "round",
|
|
1517
|
+
style: { width: "16px", height: "16px", flexShrink: 0 },
|
|
1518
|
+
children: [
|
|
1519
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M19 6l-1 14H6L5 6" }),
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M10 11v6" }),
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M14 11v6" }),
|
|
1523
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M9 6V4h6v2" })
|
|
1524
|
+
]
|
|
1525
|
+
}
|
|
1526
|
+
);
|
|
1527
|
+
var ChevronIcon3 = ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1528
|
+
"svg",
|
|
1529
|
+
{
|
|
1530
|
+
"aria-hidden": "true",
|
|
1531
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1532
|
+
viewBox: "0 0 24 24",
|
|
1533
|
+
fill: "none",
|
|
1534
|
+
stroke: "currentColor",
|
|
1535
|
+
strokeWidth: "2",
|
|
1536
|
+
strokeLinecap: "round",
|
|
1537
|
+
strokeLinejoin: "round",
|
|
1538
|
+
style: {
|
|
1539
|
+
width: "16px",
|
|
1540
|
+
height: "16px",
|
|
1541
|
+
flexShrink: 0,
|
|
1542
|
+
transition: "transform 180ms ease-in-out",
|
|
1543
|
+
transform: open ? "rotate(180deg)" : "rotate(0deg)"
|
|
1544
|
+
},
|
|
1545
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
1546
|
+
}
|
|
1547
|
+
);
|
|
1548
|
+
var WorkspaceMenu = import_react6.default.forwardRef(
|
|
1549
|
+
({
|
|
1550
|
+
workspaceName = "Plasma Design System",
|
|
1551
|
+
onRename,
|
|
1552
|
+
onDelete,
|
|
1553
|
+
defaultOpen = false,
|
|
1554
|
+
className,
|
|
1555
|
+
...rest
|
|
1556
|
+
}, ref) => {
|
|
1557
|
+
const [open, setOpen] = import_react6.default.useState(defaultOpen);
|
|
1558
|
+
const [mounted, setMounted] = import_react6.default.useState(defaultOpen);
|
|
1559
|
+
const [visible, setVisible] = import_react6.default.useState(false);
|
|
1560
|
+
const containerRef = import_react6.default.useRef(null);
|
|
1561
|
+
const setRefs = import_react6.default.useCallback(
|
|
1562
|
+
(node) => {
|
|
1563
|
+
containerRef.current = node;
|
|
1564
|
+
if (typeof ref === "function") ref(node);
|
|
1565
|
+
else if (ref)
|
|
1566
|
+
ref.current = node;
|
|
1567
|
+
},
|
|
1568
|
+
[ref]
|
|
1569
|
+
);
|
|
1570
|
+
import_react6.default.useEffect(() => {
|
|
1571
|
+
if (open) {
|
|
1572
|
+
setMounted(true);
|
|
1573
|
+
const raf = requestAnimationFrame(() => {
|
|
1574
|
+
requestAnimationFrame(() => setVisible(true));
|
|
1575
|
+
});
|
|
1576
|
+
return () => cancelAnimationFrame(raf);
|
|
1577
|
+
}
|
|
1578
|
+
setVisible(false);
|
|
1579
|
+
const timer = window.setTimeout(() => setMounted(false), 220);
|
|
1580
|
+
return () => window.clearTimeout(timer);
|
|
1581
|
+
}, [open]);
|
|
1582
|
+
import_react6.default.useEffect(() => {
|
|
1583
|
+
if (!open) return;
|
|
1584
|
+
const handler = (e) => {
|
|
1585
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
1586
|
+
setOpen(false);
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
document.addEventListener("mousedown", handler);
|
|
1590
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
1591
|
+
}, [open]);
|
|
1592
|
+
import_react6.default.useEffect(() => {
|
|
1593
|
+
if (!open) return;
|
|
1594
|
+
const handler = (e) => {
|
|
1595
|
+
if (e.key === "Escape") setOpen(false);
|
|
1596
|
+
};
|
|
1597
|
+
document.addEventListener("keydown", handler);
|
|
1598
|
+
return () => document.removeEventListener("keydown", handler);
|
|
1599
|
+
}, [open]);
|
|
1600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1601
|
+
"div",
|
|
1602
|
+
{
|
|
1603
|
+
ref: setRefs,
|
|
1604
|
+
className: ["relative inline-block", className].filter(Boolean).join(" "),
|
|
1605
|
+
...rest,
|
|
1606
|
+
children: [
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1608
|
+
Button,
|
|
1609
|
+
{
|
|
1610
|
+
type: "button",
|
|
1611
|
+
variant: "secondary",
|
|
1612
|
+
size: "sm",
|
|
1613
|
+
"aria-haspopup": "menu",
|
|
1614
|
+
"aria-expanded": open,
|
|
1615
|
+
"aria-label": `Workspace options: ${workspaceName}`,
|
|
1616
|
+
onClick: () => setOpen((v) => !v),
|
|
1617
|
+
className: "!gap-sm !pr-sm",
|
|
1618
|
+
style: { minWidth: "200px" },
|
|
1619
|
+
children: [
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "flex-1 text-left truncate text-body-sm font-weight-heading-sm", children: workspaceName }),
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronIcon3, { open })
|
|
1622
|
+
]
|
|
1623
|
+
}
|
|
1624
|
+
),
|
|
1625
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1626
|
+
"div",
|
|
1627
|
+
{
|
|
1628
|
+
role: "menu",
|
|
1629
|
+
"aria-label": "Workspace actions",
|
|
1630
|
+
"aria-hidden": !open,
|
|
1631
|
+
className: [
|
|
1632
|
+
"absolute left-0 mt-xs origin-top rounded-xl bg-surface border border-hairline-soft shadow-card z-10 py-xs overflow-hidden",
|
|
1633
|
+
"transition-all duration-200 ease-in-out will-change-transform",
|
|
1634
|
+
visible ? "pointer-events-auto opacity-100 translate-y-0 scale-y-100" : "pointer-events-none opacity-0 -translate-y-1 scale-y-95"
|
|
1635
|
+
].join(" "),
|
|
1636
|
+
style: { minWidth: "200px" },
|
|
1637
|
+
children: [
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1639
|
+
Button,
|
|
1640
|
+
{
|
|
1641
|
+
role: "menuitem",
|
|
1642
|
+
type: "button",
|
|
1643
|
+
variant: "ghost",
|
|
1644
|
+
size: "sm",
|
|
1645
|
+
onClick: () => {
|
|
1646
|
+
setOpen(false);
|
|
1647
|
+
onRename?.();
|
|
1648
|
+
},
|
|
1649
|
+
className: "!w-full !justify-start !rounded-none !px-md !gap-sm text-muted",
|
|
1650
|
+
children: [
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RenameIcon, {}),
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-ink", children: "Rename" })
|
|
1653
|
+
]
|
|
1654
|
+
}
|
|
1655
|
+
),
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1657
|
+
Button,
|
|
1658
|
+
{
|
|
1659
|
+
role: "menuitem",
|
|
1660
|
+
type: "button",
|
|
1661
|
+
variant: "ghost",
|
|
1662
|
+
size: "sm",
|
|
1663
|
+
onClick: () => {
|
|
1664
|
+
setOpen(false);
|
|
1665
|
+
onDelete?.();
|
|
1666
|
+
},
|
|
1667
|
+
className: "!w-full !justify-start !rounded-none !px-md !gap-sm",
|
|
1668
|
+
style: { color: "var(--color-semantic-error)" },
|
|
1669
|
+
children: [
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DeleteIcon, {}),
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Delete" })
|
|
1672
|
+
]
|
|
1673
|
+
}
|
|
1674
|
+
)
|
|
1675
|
+
]
|
|
1676
|
+
}
|
|
1677
|
+
)
|
|
1678
|
+
]
|
|
1679
|
+
}
|
|
1680
|
+
);
|
|
1681
|
+
}
|
|
1682
|
+
);
|
|
1683
|
+
WorkspaceMenu.displayName = "WorkspaceMenu";
|
|
1684
|
+
|
|
1685
|
+
// virtual-pkg:src/atoms/AppLayout/AppLayout.tsx
|
|
1686
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1687
|
+
var TOPBAR_HEIGHT = 48;
|
|
1688
|
+
var CURVE_R = 16;
|
|
1689
|
+
var MIN_CHAT_WIDTH = 260;
|
|
1690
|
+
var MAX_CHAT_WIDTH = 600;
|
|
1691
|
+
var COLLAPSE_DURATION = 250;
|
|
1692
|
+
var COLLAPSED_RAIL_WIDTH = 12;
|
|
1693
|
+
var PANEL_GAP_RIGHT = CURVE_R;
|
|
1694
|
+
var LayoutPanelIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1695
|
+
"svg",
|
|
1696
|
+
{
|
|
1697
|
+
width: "16",
|
|
1698
|
+
height: "16",
|
|
1699
|
+
viewBox: "0 0 24 24",
|
|
1700
|
+
fill: "none",
|
|
1701
|
+
stroke: "currentColor",
|
|
1702
|
+
strokeWidth: "2",
|
|
1703
|
+
strokeLinecap: "round",
|
|
1704
|
+
strokeLinejoin: "round",
|
|
1705
|
+
"aria-hidden": "true",
|
|
1706
|
+
children: [
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9 3v18" })
|
|
1709
|
+
]
|
|
1710
|
+
}
|
|
1711
|
+
);
|
|
1712
|
+
var ArrowLeftIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1713
|
+
"svg",
|
|
1714
|
+
{
|
|
1715
|
+
width: "16",
|
|
1716
|
+
height: "16",
|
|
1717
|
+
viewBox: "0 0 24 24",
|
|
1718
|
+
fill: "none",
|
|
1719
|
+
stroke: "currentColor",
|
|
1720
|
+
strokeWidth: "2",
|
|
1721
|
+
strokeLinecap: "round",
|
|
1722
|
+
strokeLinejoin: "round",
|
|
1723
|
+
"aria-hidden": "true",
|
|
1724
|
+
children: [
|
|
1725
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M19 12H5" }),
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m12 19-7-7 7-7" })
|
|
1727
|
+
]
|
|
1728
|
+
}
|
|
1729
|
+
);
|
|
1730
|
+
var HomeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1731
|
+
"svg",
|
|
1732
|
+
{
|
|
1733
|
+
width: "16",
|
|
1734
|
+
height: "16",
|
|
1735
|
+
viewBox: "0 0 24 24",
|
|
1736
|
+
fill: "none",
|
|
1737
|
+
stroke: "currentColor",
|
|
1738
|
+
strokeWidth: "2",
|
|
1739
|
+
strokeLinecap: "round",
|
|
1740
|
+
strokeLinejoin: "round",
|
|
1741
|
+
"aria-hidden": "true",
|
|
1742
|
+
children: [
|
|
1743
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }),
|
|
1744
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "9 22 9 12 15 12 15 22" })
|
|
1745
|
+
]
|
|
1746
|
+
}
|
|
1747
|
+
);
|
|
1748
|
+
var ChevronDownIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1749
|
+
"svg",
|
|
1750
|
+
{
|
|
1751
|
+
width: "12",
|
|
1752
|
+
height: "12",
|
|
1753
|
+
viewBox: "0 0 24 24",
|
|
1754
|
+
fill: "none",
|
|
1755
|
+
stroke: "currentColor",
|
|
1756
|
+
strokeWidth: "2.5",
|
|
1757
|
+
strokeLinecap: "round",
|
|
1758
|
+
strokeLinejoin: "round",
|
|
1759
|
+
"aria-hidden": "true",
|
|
1760
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
1761
|
+
}
|
|
1762
|
+
);
|
|
1763
|
+
function applyWidth(els, px) {
|
|
1764
|
+
for (const el of els) {
|
|
1765
|
+
if (el) el.style.width = `${px}px`;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
function restoreTransition(els, transition) {
|
|
1769
|
+
requestAnimationFrame(() => {
|
|
1770
|
+
for (const el of els) {
|
|
1771
|
+
if (el) el.style.transition = transition;
|
|
1772
|
+
}
|
|
1773
|
+
});
|
|
1774
|
+
}
|
|
1775
|
+
var AvatarNav = ({ initials, onBackToProjects, onHome }) => {
|
|
1776
|
+
const [open, setOpen] = import_react7.default.useState(false);
|
|
1777
|
+
const containerRef = import_react7.default.useRef(null);
|
|
1778
|
+
import_react7.default.useEffect(() => {
|
|
1779
|
+
if (!open) return;
|
|
1780
|
+
const handler = (e) => {
|
|
1781
|
+
if (containerRef.current && !containerRef.current.contains(e.target))
|
|
1782
|
+
setOpen(false);
|
|
1783
|
+
};
|
|
1784
|
+
document.addEventListener("mousedown", handler);
|
|
1785
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
1786
|
+
}, [open]);
|
|
1787
|
+
import_react7.default.useEffect(() => {
|
|
1788
|
+
if (!open) return;
|
|
1789
|
+
const handler = (e) => {
|
|
1790
|
+
if (e.key === "Escape") setOpen(false);
|
|
1791
|
+
};
|
|
1792
|
+
document.addEventListener("keydown", handler);
|
|
1793
|
+
return () => document.removeEventListener("keydown", handler);
|
|
1794
|
+
}, [open]);
|
|
1795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { ref: containerRef, className: "relative flex-shrink-0", style: { zIndex: 1e3 }, children: [
|
|
1796
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1797
|
+
Button,
|
|
1798
|
+
{
|
|
1799
|
+
type: "button",
|
|
1800
|
+
variant: "ghost",
|
|
1801
|
+
size: "sm",
|
|
1802
|
+
"aria-label": "Open navigation menu",
|
|
1803
|
+
"aria-haspopup": "menu",
|
|
1804
|
+
"aria-expanded": open,
|
|
1805
|
+
onClick: () => setOpen((v) => !v),
|
|
1806
|
+
className: "!p-0 !gap-xxs !rounded-xl !bg-transparent !border-0 flex items-center",
|
|
1807
|
+
children: [
|
|
1808
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1809
|
+
"span",
|
|
1810
|
+
{
|
|
1811
|
+
className: "flex items-center justify-center rounded-full bg-primary text-on-primary select-none font-weight-heading-sm",
|
|
1812
|
+
style: { width: 32, height: 32, fontSize: 13, flexShrink: 0 },
|
|
1813
|
+
children: initials
|
|
1814
|
+
}
|
|
1815
|
+
),
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted", style: { lineHeight: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronDownIcon, {}) })
|
|
1817
|
+
]
|
|
1818
|
+
}
|
|
1819
|
+
),
|
|
1820
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1821
|
+
"div",
|
|
1822
|
+
{
|
|
1823
|
+
role: "menu",
|
|
1824
|
+
"aria-label": "Navigation",
|
|
1825
|
+
className: "absolute left-0 mt-xs rounded-xl bg-canvas border border-hairline-soft shadow-card py-xs",
|
|
1826
|
+
style: { minWidth: 200, zIndex: 1e3, top: "100%" },
|
|
1827
|
+
children: [
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1829
|
+
Button,
|
|
1830
|
+
{
|
|
1831
|
+
role: "menuitem",
|
|
1832
|
+
type: "button",
|
|
1833
|
+
variant: "ghost",
|
|
1834
|
+
size: "sm",
|
|
1835
|
+
onClick: () => {
|
|
1836
|
+
setOpen(false);
|
|
1837
|
+
onBackToProjects?.();
|
|
1838
|
+
},
|
|
1839
|
+
className: "!w-full !justify-start !rounded-none !px-md !gap-md !text-ink",
|
|
1840
|
+
children: [
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ArrowLeftIcon, {}) }),
|
|
1842
|
+
"Back to projects"
|
|
1843
|
+
]
|
|
1844
|
+
}
|
|
1845
|
+
),
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1847
|
+
Button,
|
|
1848
|
+
{
|
|
1849
|
+
role: "menuitem",
|
|
1850
|
+
type: "button",
|
|
1851
|
+
variant: "ghost",
|
|
1852
|
+
size: "sm",
|
|
1853
|
+
onClick: () => {
|
|
1854
|
+
setOpen(false);
|
|
1855
|
+
onHome?.();
|
|
1856
|
+
},
|
|
1857
|
+
className: "!w-full !justify-start !rounded-none !px-md !gap-md !text-ink",
|
|
1858
|
+
children: [
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-muted", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HomeIcon, {}) }),
|
|
1860
|
+
"Home"
|
|
1861
|
+
]
|
|
1862
|
+
}
|
|
1863
|
+
)
|
|
1864
|
+
]
|
|
1865
|
+
}
|
|
1866
|
+
)
|
|
1867
|
+
] });
|
|
1868
|
+
};
|
|
1869
|
+
var ConcaveCorner = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1870
|
+
"div",
|
|
1871
|
+
{
|
|
1872
|
+
"aria-hidden": "true",
|
|
1873
|
+
style: {
|
|
1874
|
+
position: "absolute",
|
|
1875
|
+
top: -1,
|
|
1876
|
+
// cover the 1px border exactly
|
|
1877
|
+
left: -1,
|
|
1878
|
+
width: CURVE_R + 1,
|
|
1879
|
+
height: CURVE_R + 1,
|
|
1880
|
+
pointerEvents: "none",
|
|
1881
|
+
zIndex: 2,
|
|
1882
|
+
// above the border
|
|
1883
|
+
overflow: "hidden"
|
|
1884
|
+
},
|
|
1885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1886
|
+
"svg",
|
|
1887
|
+
{
|
|
1888
|
+
width: CURVE_R + 1,
|
|
1889
|
+
height: CURVE_R + 1,
|
|
1890
|
+
viewBox: `0 0 ${CURVE_R + 1} ${CURVE_R + 1}`,
|
|
1891
|
+
fill: "none",
|
|
1892
|
+
children: [
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { width: CURVE_R + 1, height: CURVE_R + 1, fill: "var(--color-surface-soft)" }),
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1895
|
+
"path",
|
|
1896
|
+
{
|
|
1897
|
+
d: `M${CURVE_R + 1} 0 L${CURVE_R + 1} ${CURVE_R + 1} Q0 ${CURVE_R + 1} 0 0 Z`,
|
|
1898
|
+
fill: "var(--color-canvas)"
|
|
1899
|
+
}
|
|
1900
|
+
)
|
|
1901
|
+
]
|
|
1902
|
+
}
|
|
1903
|
+
)
|
|
1904
|
+
}
|
|
1905
|
+
);
|
|
1906
|
+
var RightPanelPlaceholder = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1 flex flex-col items-center justify-center", style: { minHeight: "100%" }, children: [
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: "64", height: "64", viewBox: "0 0 72 72", fill: "none", className: "text-hairline-strong mb-lg", "aria-hidden": "true", children: [
|
|
1908
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "4", y: "4", width: "64", height: "64", rx: "10", stroke: "currentColor", strokeWidth: "2.5", strokeDasharray: "6 4" }),
|
|
1909
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "14", y: "14", width: "20", height: "20", rx: "4", fill: "currentColor", opacity: "0.15" }),
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "38", y: "14", width: "20", height: "20", rx: "4", fill: "currentColor", opacity: "0.1" }),
|
|
1911
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "14", y: "38", width: "44", height: "12", rx: "4", fill: "currentColor", opacity: "0.08" })
|
|
1912
|
+
] }),
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-body-sm text-muted-soft", children: "Preview will appear here" })
|
|
1914
|
+
] });
|
|
1915
|
+
var PromptFooter = ({ chatProps }) => {
|
|
1916
|
+
const [mode, setMode] = import_react7.default.useState("Build");
|
|
1917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full px-md pb-md pt-sm", style: { background: "var(--color-surface-soft)" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1918
|
+
PromptInputBar,
|
|
1919
|
+
{
|
|
1920
|
+
placeholder: chatProps?.placeholder ?? "Ask Lovable\u2026",
|
|
1921
|
+
mode,
|
|
1922
|
+
onModeChange: setMode,
|
|
1923
|
+
onSend: chatProps?.onSend,
|
|
1924
|
+
models: chatProps?.models,
|
|
1925
|
+
selectedModelId: chatProps?.selectedModelId,
|
|
1926
|
+
onModelChange: chatProps?.onModelChange
|
|
1927
|
+
}
|
|
1928
|
+
) });
|
|
1929
|
+
};
|
|
1930
|
+
var AppLayout = import_react7.default.forwardRef(
|
|
1931
|
+
({
|
|
1932
|
+
navbarProps,
|
|
1933
|
+
chatProps,
|
|
1934
|
+
rightPanel,
|
|
1935
|
+
rightPanelTabs = [],
|
|
1936
|
+
rightPanelActiveTab = 0,
|
|
1937
|
+
onRightPanelTabChange,
|
|
1938
|
+
defaultChatWidth = 340,
|
|
1939
|
+
projectName = "My Project",
|
|
1940
|
+
onRenameProject,
|
|
1941
|
+
onBackToProjects,
|
|
1942
|
+
onHome,
|
|
1943
|
+
avatarInitials = "A",
|
|
1944
|
+
className
|
|
1945
|
+
}, ref) => {
|
|
1946
|
+
const [activeTab, setActiveTab] = import_react7.default.useState(rightPanelActiveTab);
|
|
1947
|
+
const [chatWidth, setChatWidth] = import_react7.default.useState(defaultChatWidth);
|
|
1948
|
+
const [chatCollapsed, setChatCollapsed] = import_react7.default.useState(false);
|
|
1949
|
+
const topChatColRef = import_react7.default.useRef(null);
|
|
1950
|
+
const bodyChatColRef = import_react7.default.useRef(null);
|
|
1951
|
+
const topDividerRef = import_react7.default.useRef(null);
|
|
1952
|
+
const bodyDividerRef = import_react7.default.useRef(null);
|
|
1953
|
+
const isDragging = import_react7.default.useRef(false);
|
|
1954
|
+
const startX = import_react7.default.useRef(0);
|
|
1955
|
+
const startWidth = import_react7.default.useRef(defaultChatWidth);
|
|
1956
|
+
const currentWidth = import_react7.default.useRef(defaultChatWidth);
|
|
1957
|
+
const collapseTransition = `width ${COLLAPSE_DURATION}ms cubic-bezier(0.4,0,0.2,1)`;
|
|
1958
|
+
const opacityTransition = `opacity ${COLLAPSE_DURATION}ms ease`;
|
|
1959
|
+
import_react7.default.useEffect(() => {
|
|
1960
|
+
setActiveTab(rightPanelActiveTab);
|
|
1961
|
+
}, [rightPanelActiveTab]);
|
|
1962
|
+
const handleTabChange = (i) => {
|
|
1963
|
+
setActiveTab(i);
|
|
1964
|
+
onRightPanelTabChange?.(i);
|
|
1965
|
+
};
|
|
1966
|
+
const onDividerMouseDown = (e) => {
|
|
1967
|
+
if (chatCollapsed) return;
|
|
1968
|
+
e.preventDefault();
|
|
1969
|
+
isDragging.current = true;
|
|
1970
|
+
startX.current = e.clientX;
|
|
1971
|
+
startWidth.current = currentWidth.current;
|
|
1972
|
+
const colNodes = [topChatColRef.current, bodyChatColRef.current];
|
|
1973
|
+
const divNodes = [topDividerRef.current, bodyDividerRef.current];
|
|
1974
|
+
for (const el of [...colNodes, ...divNodes]) {
|
|
1975
|
+
if (el) el.style.transition = "none";
|
|
1976
|
+
}
|
|
1977
|
+
document.body.style.cursor = "col-resize";
|
|
1978
|
+
document.body.style.userSelect = "none";
|
|
1979
|
+
const onMove = (ev) => {
|
|
1980
|
+
if (!isDragging.current) return;
|
|
1981
|
+
const next = Math.min(
|
|
1982
|
+
MAX_CHAT_WIDTH,
|
|
1983
|
+
Math.max(MIN_CHAT_WIDTH, startWidth.current + ev.clientX - startX.current)
|
|
1984
|
+
);
|
|
1985
|
+
currentWidth.current = next;
|
|
1986
|
+
applyWidth(colNodes, next);
|
|
1987
|
+
applyWidth(divNodes, 6);
|
|
1988
|
+
};
|
|
1989
|
+
const onUp = () => {
|
|
1990
|
+
if (!isDragging.current) return;
|
|
1991
|
+
isDragging.current = false;
|
|
1992
|
+
document.body.style.cursor = "";
|
|
1993
|
+
document.body.style.userSelect = "";
|
|
1994
|
+
window.removeEventListener("mousemove", onMove);
|
|
1995
|
+
window.removeEventListener("mouseup", onUp);
|
|
1996
|
+
setChatWidth(currentWidth.current);
|
|
1997
|
+
restoreTransition([...colNodes, ...divNodes], collapseTransition);
|
|
1998
|
+
};
|
|
1999
|
+
window.addEventListener("mousemove", onMove);
|
|
2000
|
+
window.addEventListener("mouseup", onUp);
|
|
2001
|
+
};
|
|
2002
|
+
const renderedWidth = chatCollapsed ? COLLAPSED_RAIL_WIDTH : chatWidth;
|
|
2003
|
+
const hasTabs = Array.isArray(rightPanelTabs) && rightPanelTabs.length > 0;
|
|
2004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2005
|
+
"div",
|
|
2006
|
+
{
|
|
2007
|
+
ref,
|
|
2008
|
+
className: ["w-full flex flex-col overflow-hidden", className].filter(Boolean).join(" "),
|
|
2009
|
+
style: { height: "100vh", background: "var(--color-surface-soft)" },
|
|
2010
|
+
children: [
|
|
2011
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2012
|
+
"div",
|
|
2013
|
+
{
|
|
2014
|
+
className: "w-full flex flex-shrink-0 items-center",
|
|
2015
|
+
style: { height: TOPBAR_HEIGHT, background: "var(--color-surface-soft)" },
|
|
2016
|
+
children: [
|
|
2017
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2018
|
+
"div",
|
|
2019
|
+
{
|
|
2020
|
+
ref: topChatColRef,
|
|
2021
|
+
className: "flex-shrink-0 h-full",
|
|
2022
|
+
style: {
|
|
2023
|
+
width: renderedWidth,
|
|
2024
|
+
minWidth: 0,
|
|
2025
|
+
transition: collapseTransition,
|
|
2026
|
+
position: "relative",
|
|
2027
|
+
zIndex: 500
|
|
2028
|
+
},
|
|
2029
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2030
|
+
"div",
|
|
2031
|
+
{
|
|
2032
|
+
className: "flex items-center px-sm gap-sm h-full",
|
|
2033
|
+
style: {
|
|
2034
|
+
opacity: chatCollapsed ? 0 : 1,
|
|
2035
|
+
transition: opacityTransition,
|
|
2036
|
+
pointerEvents: chatCollapsed ? "none" : "auto"
|
|
2037
|
+
},
|
|
2038
|
+
children: [
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2040
|
+
AvatarNav,
|
|
2041
|
+
{
|
|
2042
|
+
initials: avatarInitials,
|
|
2043
|
+
onBackToProjects,
|
|
2044
|
+
onHome
|
|
2045
|
+
}
|
|
2046
|
+
),
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-1 min-w-0", style: { position: "relative", zIndex: 1e3 }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2048
|
+
WorkspaceMenu,
|
|
2049
|
+
{
|
|
2050
|
+
workspaceName: projectName,
|
|
2051
|
+
onRename: onRenameProject,
|
|
2052
|
+
className: "w-full"
|
|
2053
|
+
}
|
|
2054
|
+
) })
|
|
2055
|
+
]
|
|
2056
|
+
}
|
|
2057
|
+
)
|
|
2058
|
+
}
|
|
2059
|
+
),
|
|
2060
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2061
|
+
"div",
|
|
2062
|
+
{
|
|
2063
|
+
ref: topDividerRef,
|
|
2064
|
+
className: "flex-shrink-0",
|
|
2065
|
+
style: {
|
|
2066
|
+
width: chatCollapsed ? 0 : 6,
|
|
2067
|
+
overflow: "hidden",
|
|
2068
|
+
transition: collapseTransition
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
),
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2073
|
+
"div",
|
|
2074
|
+
{
|
|
2075
|
+
className: "flex-1 flex items-center px-sm h-full gap-xs overflow-visible",
|
|
2076
|
+
style: { background: "var(--color-surface-soft)" },
|
|
2077
|
+
children: [
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2079
|
+
Button,
|
|
2080
|
+
{
|
|
2081
|
+
variant: "ghost",
|
|
2082
|
+
size: "sm",
|
|
2083
|
+
"aria-label": chatCollapsed ? "Expand chat panel" : "Collapse chat panel",
|
|
2084
|
+
onClick: () => setChatCollapsed((v) => !v),
|
|
2085
|
+
className: "!p-xs !rounded-md flex-shrink-0",
|
|
2086
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LayoutPanelIcon, {})
|
|
2087
|
+
}
|
|
2088
|
+
),
|
|
2089
|
+
hasTabs && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("nav", { "aria-label": "Panel tabs", className: "flex items-center gap-xs ml-xs overflow-x-auto", children: rightPanelTabs.map((tab, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2090
|
+
Button,
|
|
2091
|
+
{
|
|
2092
|
+
type: "button",
|
|
2093
|
+
variant: i === activeTab ? "secondary" : "ghost",
|
|
2094
|
+
size: "sm",
|
|
2095
|
+
onClick: () => handleTabChange(i),
|
|
2096
|
+
"aria-selected": i === activeTab,
|
|
2097
|
+
className: i === activeTab ? "!bg-surface-strong !text-ink !border-hairline flex-shrink-0" : "!text-muted hover:!text-ink flex-shrink-0",
|
|
2098
|
+
children: tab
|
|
2099
|
+
},
|
|
2100
|
+
tab
|
|
2101
|
+
)) }),
|
|
2102
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-1" }),
|
|
2103
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex-shrink-0", style: { minWidth: "fit-content" }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2104
|
+
TopNavbar,
|
|
2105
|
+
{
|
|
2106
|
+
...navbarProps,
|
|
2107
|
+
className: "!border-0 !py-0 !px-0 !bg-transparent w-auto"
|
|
2108
|
+
}
|
|
2109
|
+
) })
|
|
2110
|
+
]
|
|
2111
|
+
}
|
|
2112
|
+
)
|
|
2113
|
+
]
|
|
2114
|
+
}
|
|
2115
|
+
),
|
|
2116
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-1 min-h-0 overflow-hidden", children: [
|
|
2117
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2118
|
+
"div",
|
|
2119
|
+
{
|
|
2120
|
+
ref: bodyChatColRef,
|
|
2121
|
+
className: "flex flex-col flex-shrink-0 overflow-hidden",
|
|
2122
|
+
style: {
|
|
2123
|
+
width: renderedWidth,
|
|
2124
|
+
minWidth: 0,
|
|
2125
|
+
background: "var(--color-surface-soft)",
|
|
2126
|
+
transition: collapseTransition
|
|
2127
|
+
},
|
|
2128
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2129
|
+
"div",
|
|
2130
|
+
{
|
|
2131
|
+
className: "flex flex-col flex-1 min-h-0 overflow-hidden",
|
|
2132
|
+
style: {
|
|
2133
|
+
opacity: chatCollapsed ? 0 : 1,
|
|
2134
|
+
transition: opacityTransition,
|
|
2135
|
+
pointerEvents: chatCollapsed ? "none" : "auto"
|
|
2136
|
+
},
|
|
2137
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2138
|
+
ChatScreen,
|
|
2139
|
+
{
|
|
2140
|
+
...chatProps,
|
|
2141
|
+
className: ["flex-1 min-h-0", chatProps?.className].filter(Boolean).join(" "),
|
|
2142
|
+
renderFooter: chatProps?.renderFooter ?? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PromptFooter, { chatProps })
|
|
2143
|
+
}
|
|
2144
|
+
)
|
|
2145
|
+
}
|
|
2146
|
+
)
|
|
2147
|
+
}
|
|
2148
|
+
),
|
|
2149
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2150
|
+
"div",
|
|
2151
|
+
{
|
|
2152
|
+
ref: bodyDividerRef,
|
|
2153
|
+
role: "separator",
|
|
2154
|
+
"aria-label": "Resize chat panel",
|
|
2155
|
+
"aria-orientation": "vertical",
|
|
2156
|
+
onMouseDown: onDividerMouseDown,
|
|
2157
|
+
className: "flex-shrink-0 flex items-center justify-center group",
|
|
2158
|
+
style: {
|
|
2159
|
+
width: chatCollapsed ? 0 : 6,
|
|
2160
|
+
cursor: chatCollapsed ? "default" : "col-resize",
|
|
2161
|
+
transition: collapseTransition,
|
|
2162
|
+
overflow: "hidden",
|
|
2163
|
+
position: "relative",
|
|
2164
|
+
zIndex: 10,
|
|
2165
|
+
background: "transparent"
|
|
2166
|
+
},
|
|
2167
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2168
|
+
"div",
|
|
2169
|
+
{
|
|
2170
|
+
className: "rounded-full bg-hairline-strong group-hover:bg-primary transition-colors duration-150",
|
|
2171
|
+
style: { width: 3, height: 40, opacity: 0.4, flexShrink: 0 }
|
|
2172
|
+
}
|
|
2173
|
+
)
|
|
2174
|
+
}
|
|
2175
|
+
),
|
|
2176
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
2177
|
+
"div",
|
|
2178
|
+
{
|
|
2179
|
+
className: "flex-1 min-w-0 flex flex-col overflow-hidden",
|
|
2180
|
+
style: {
|
|
2181
|
+
background: "var(--color-canvas)",
|
|
2182
|
+
borderRadius: `${CURVE_R}px ${CURVE_R}px 0 0`,
|
|
2183
|
+
marginRight: PANEL_GAP_RIGHT,
|
|
2184
|
+
border: "1px solid var(--color-hairline)",
|
|
2185
|
+
borderBottom: "none",
|
|
2186
|
+
position: "relative"
|
|
2187
|
+
},
|
|
2188
|
+
children: [
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ConcaveCorner, {}),
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2191
|
+
"div",
|
|
2192
|
+
{
|
|
2193
|
+
className: "flex-1 min-h-0 overflow-auto flex flex-col",
|
|
2194
|
+
style: { position: "relative", zIndex: 0 },
|
|
2195
|
+
children: rightPanel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full flex-1", children: rightPanel }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RightPanelPlaceholder, {})
|
|
2196
|
+
}
|
|
2197
|
+
)
|
|
2198
|
+
]
|
|
2199
|
+
}
|
|
2200
|
+
)
|
|
2201
|
+
] })
|
|
2202
|
+
]
|
|
2203
|
+
}
|
|
2204
|
+
);
|
|
2205
|
+
}
|
|
2206
|
+
);
|
|
2207
|
+
AppLayout.displayName = "AppLayout";
|
|
2208
|
+
|
|
2209
|
+
// virtual-pkg:src/atoms/AppSidebar/AppSidebar.tsx
|
|
2210
|
+
var import_react10 = __toESM(require("react"));
|
|
2211
|
+
|
|
2212
|
+
// virtual-pkg:src/atoms/NavItem/NavItem.tsx
|
|
2213
|
+
var import_react8 = __toESM(require("react"));
|
|
2214
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2215
|
+
var ChevronDownIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2216
|
+
"svg",
|
|
2217
|
+
{
|
|
2218
|
+
viewBox: "0 0 24 24",
|
|
2219
|
+
fill: "none",
|
|
2220
|
+
stroke: "currentColor",
|
|
2221
|
+
strokeWidth: "2",
|
|
2222
|
+
strokeLinecap: "round",
|
|
2223
|
+
strokeLinejoin: "round",
|
|
2224
|
+
"aria-hidden": "true",
|
|
2225
|
+
style: { width: "14px", height: "14px", flexShrink: 0 },
|
|
2226
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
2227
|
+
}
|
|
2228
|
+
);
|
|
2229
|
+
var TrashIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2230
|
+
"svg",
|
|
2231
|
+
{
|
|
2232
|
+
viewBox: "0 0 24 24",
|
|
2233
|
+
fill: "none",
|
|
2234
|
+
stroke: "currentColor",
|
|
2235
|
+
strokeWidth: "1.75",
|
|
2236
|
+
strokeLinecap: "round",
|
|
2237
|
+
strokeLinejoin: "round",
|
|
2238
|
+
"aria-hidden": "true",
|
|
2239
|
+
style: { width: "14px", height: "14px", flexShrink: 0 },
|
|
2240
|
+
children: [
|
|
2241
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }),
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M10 11v6M14 11v6" }),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2" })
|
|
2245
|
+
]
|
|
2246
|
+
}
|
|
2247
|
+
);
|
|
2248
|
+
var SubItemRow = ({ item }) => {
|
|
2249
|
+
const [hovered, setHovered] = import_react8.default.useState(false);
|
|
2250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2251
|
+
"li",
|
|
2252
|
+
{
|
|
2253
|
+
className: "list-none flex items-center gap-xs",
|
|
2254
|
+
onMouseEnter: () => setHovered(true),
|
|
2255
|
+
onMouseLeave: () => setHovered(false),
|
|
2256
|
+
children: [
|
|
2257
|
+
item.onClick ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2258
|
+
Button,
|
|
2259
|
+
{
|
|
2260
|
+
variant: "ghost",
|
|
2261
|
+
size: "sm",
|
|
2262
|
+
className: "!flex-1 !justify-start !px-sm !py-xxs !text-body-sm !text-body !rounded-sm !cursor-pointer hover:!text-ink",
|
|
2263
|
+
onClick: () => item.onClick(item.id),
|
|
2264
|
+
children: item.label
|
|
2265
|
+
}
|
|
2266
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "flex-1 truncate px-sm py-xxs text-body-sm text-body rounded-sm cursor-default select-none", children: item.label }),
|
|
2267
|
+
item.onDelete && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2268
|
+
Button,
|
|
2269
|
+
{
|
|
2270
|
+
variant: "ghost",
|
|
2271
|
+
size: "sm",
|
|
2272
|
+
"aria-label": `Delete ${item.label}`,
|
|
2273
|
+
onClick: (e) => {
|
|
2274
|
+
e.stopPropagation();
|
|
2275
|
+
item.onDelete(item.id);
|
|
2276
|
+
},
|
|
2277
|
+
className: [
|
|
2278
|
+
"!p-xxs !rounded-xs !text-muted !min-w-0 transition-opacity duration-200 ease-in-out",
|
|
2279
|
+
"hover:!text-semantic-error",
|
|
2280
|
+
hovered ? "opacity-100" : "opacity-0"
|
|
2281
|
+
].join(" "),
|
|
2282
|
+
tabIndex: hovered ? 0 : -1,
|
|
2283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TrashIcon, {})
|
|
2284
|
+
}
|
|
2285
|
+
)
|
|
2286
|
+
]
|
|
2287
|
+
}
|
|
2288
|
+
);
|
|
2289
|
+
};
|
|
2290
|
+
var NavItem = import_react8.default.forwardRef(
|
|
2291
|
+
({
|
|
2292
|
+
icon,
|
|
2293
|
+
label,
|
|
2294
|
+
active = false,
|
|
2295
|
+
shortcut,
|
|
2296
|
+
subItems,
|
|
2297
|
+
children,
|
|
2298
|
+
expanded,
|
|
2299
|
+
onExpandToggle,
|
|
2300
|
+
iconOnly = false,
|
|
2301
|
+
onClick,
|
|
2302
|
+
className,
|
|
2303
|
+
...rest
|
|
2304
|
+
}, ref) => {
|
|
2305
|
+
const hasSubItems = subItems && subItems.length > 0;
|
|
2306
|
+
const hasChildren = import_react8.default.Children.count(children) > 0;
|
|
2307
|
+
const isExpandable = hasSubItems || hasChildren;
|
|
2308
|
+
const contentRef = import_react8.default.useRef(null);
|
|
2309
|
+
const [mounted, setMounted] = import_react8.default.useState(Boolean(expanded));
|
|
2310
|
+
const [visible, setVisible] = import_react8.default.useState(Boolean(expanded));
|
|
2311
|
+
const [contentHeight, setContentHeight] = import_react8.default.useState(0);
|
|
2312
|
+
import_react8.default.useEffect(() => {
|
|
2313
|
+
if (expanded) {
|
|
2314
|
+
setMounted(true);
|
|
2315
|
+
const raf = requestAnimationFrame(() => {
|
|
2316
|
+
if (contentRef.current) {
|
|
2317
|
+
setContentHeight(contentRef.current.scrollHeight);
|
|
2318
|
+
}
|
|
2319
|
+
requestAnimationFrame(() => setVisible(true));
|
|
2320
|
+
});
|
|
2321
|
+
return () => cancelAnimationFrame(raf);
|
|
2322
|
+
}
|
|
2323
|
+
if (contentRef.current) {
|
|
2324
|
+
setContentHeight(contentRef.current.scrollHeight);
|
|
2325
|
+
}
|
|
2326
|
+
setVisible(false);
|
|
2327
|
+
const timer = window.setTimeout(() => setMounted(false), 220);
|
|
2328
|
+
return () => window.clearTimeout(timer);
|
|
2329
|
+
}, [expanded, subItems, children]);
|
|
2330
|
+
import_react8.default.useEffect(() => {
|
|
2331
|
+
if (!mounted || !contentRef.current) return;
|
|
2332
|
+
const measure = () => setContentHeight(contentRef.current?.scrollHeight ?? 0);
|
|
2333
|
+
measure();
|
|
2334
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
2335
|
+
const observer = new ResizeObserver(measure);
|
|
2336
|
+
observer.observe(contentRef.current);
|
|
2337
|
+
return () => observer.disconnect();
|
|
2338
|
+
}, [mounted, subItems, children]);
|
|
2339
|
+
const handleClick = (e) => {
|
|
2340
|
+
if (isExpandable && onExpandToggle) {
|
|
2341
|
+
onExpandToggle();
|
|
2342
|
+
}
|
|
2343
|
+
onClick?.(e);
|
|
2344
|
+
};
|
|
2345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2346
|
+
"li",
|
|
2347
|
+
{
|
|
2348
|
+
ref,
|
|
2349
|
+
className: ["list-none", className].filter(Boolean).join(" "),
|
|
2350
|
+
...rest,
|
|
2351
|
+
children: [
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2353
|
+
Button,
|
|
2354
|
+
{
|
|
2355
|
+
variant: "ghost",
|
|
2356
|
+
size: "sm",
|
|
2357
|
+
"aria-current": active ? "page" : void 0,
|
|
2358
|
+
"aria-expanded": isExpandable ? expanded : void 0,
|
|
2359
|
+
"aria-label": iconOnly ? label : void 0,
|
|
2360
|
+
title: iconOnly ? label : void 0,
|
|
2361
|
+
onClick: handleClick,
|
|
2362
|
+
className: [
|
|
2363
|
+
iconOnly ? "!w-full !justify-center !px-xs !py-xs !rounded-md" : "!w-full !justify-start !px-sm !py-xs !rounded-md !gap-sm !font-weight-body-md",
|
|
2364
|
+
active ? "!bg-primary-disabled !text-primary" : ""
|
|
2365
|
+
].filter(Boolean).join(" "),
|
|
2366
|
+
children: [
|
|
2367
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2368
|
+
"span",
|
|
2369
|
+
{
|
|
2370
|
+
"aria-hidden": "true",
|
|
2371
|
+
className: [
|
|
2372
|
+
"flex-shrink-0",
|
|
2373
|
+
active ? "text-primary" : "text-muted"
|
|
2374
|
+
].join(" "),
|
|
2375
|
+
style: {
|
|
2376
|
+
width: "18px",
|
|
2377
|
+
height: "18px",
|
|
2378
|
+
display: "flex",
|
|
2379
|
+
alignItems: "center",
|
|
2380
|
+
justifyContent: "center"
|
|
2381
|
+
},
|
|
2382
|
+
children: icon
|
|
2383
|
+
}
|
|
2384
|
+
),
|
|
2385
|
+
!iconOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2386
|
+
"span",
|
|
2387
|
+
{
|
|
2388
|
+
className: [
|
|
2389
|
+
"flex-1 text-left text-body-sm",
|
|
2390
|
+
active ? "text-primary" : "text-ink"
|
|
2391
|
+
].join(" "),
|
|
2392
|
+
children: label
|
|
2393
|
+
}
|
|
2394
|
+
),
|
|
2395
|
+
!iconOnly && shortcut && !isExpandable && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "flex items-center gap-xs ml-auto", "aria-hidden": "true", children: [
|
|
2396
|
+
shortcut.modifier && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2397
|
+
"kbd",
|
|
2398
|
+
{
|
|
2399
|
+
className: "inline-flex items-center justify-center px-xs py-xxs text-caption text-muted border border-hairline rounded-xs bg-surface-soft",
|
|
2400
|
+
style: { minWidth: "22px", height: "22px" },
|
|
2401
|
+
children: shortcut.modifier
|
|
2402
|
+
}
|
|
2403
|
+
),
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2405
|
+
"kbd",
|
|
2406
|
+
{
|
|
2407
|
+
className: "inline-flex items-center justify-center px-xs py-xxs text-caption text-muted border border-hairline rounded-xs bg-surface-soft",
|
|
2408
|
+
style: { minWidth: "22px", height: "22px" },
|
|
2409
|
+
children: shortcut.key
|
|
2410
|
+
}
|
|
2411
|
+
)
|
|
2412
|
+
] }),
|
|
2413
|
+
!iconOnly && isExpandable && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2414
|
+
"span",
|
|
2415
|
+
{
|
|
2416
|
+
"aria-hidden": "true",
|
|
2417
|
+
className: [
|
|
2418
|
+
"ml-auto text-muted transition-transform duration-200 ease-in-out",
|
|
2419
|
+
expanded ? "rotate-180" : "rotate-0"
|
|
2420
|
+
].join(" "),
|
|
2421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChevronDownIcon2, {})
|
|
2422
|
+
}
|
|
2423
|
+
)
|
|
2424
|
+
]
|
|
2425
|
+
}
|
|
2426
|
+
),
|
|
2427
|
+
!iconOnly && mounted && (hasSubItems || hasChildren) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2428
|
+
"div",
|
|
2429
|
+
{
|
|
2430
|
+
className: "overflow-hidden transition-[max-height,opacity,transform,margin] duration-220 ease-in-out",
|
|
2431
|
+
style: {
|
|
2432
|
+
maxHeight: visible ? `${contentHeight}px` : "0px",
|
|
2433
|
+
opacity: visible ? 1 : 0,
|
|
2434
|
+
transform: visible ? "translateY(0)" : "translateY(-4px)",
|
|
2435
|
+
marginTop: visible ? "var(--spacing-xxs)" : "0px"
|
|
2436
|
+
},
|
|
2437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref: contentRef, children: [
|
|
2438
|
+
hasSubItems && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2439
|
+
"ul",
|
|
2440
|
+
{
|
|
2441
|
+
className: "ml-lg pl-sm border-l border-hairline-soft space-y-xxs",
|
|
2442
|
+
role: "list",
|
|
2443
|
+
children: subItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SubItemRow, { item }, item.id))
|
|
2444
|
+
}
|
|
2445
|
+
),
|
|
2446
|
+
hasChildren && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2447
|
+
"ul",
|
|
2448
|
+
{
|
|
2449
|
+
className: "ml-lg pl-sm border-l border-hairline-soft space-y-xxs",
|
|
2450
|
+
role: "list",
|
|
2451
|
+
children
|
|
2452
|
+
}
|
|
2453
|
+
)
|
|
2454
|
+
] })
|
|
2455
|
+
}
|
|
2456
|
+
)
|
|
2457
|
+
]
|
|
2458
|
+
}
|
|
2459
|
+
);
|
|
2460
|
+
}
|
|
2461
|
+
);
|
|
2462
|
+
NavItem.displayName = "NavItem";
|
|
2463
|
+
|
|
2464
|
+
// virtual-pkg:src/atoms/UpgradeCard/UpgradeCard.tsx
|
|
2465
|
+
var import_react9 = __toESM(require("react"));
|
|
2466
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2467
|
+
var UpgradeCard = import_react9.default.forwardRef(
|
|
2468
|
+
({
|
|
2469
|
+
eyebrow = "Card \u2013 Upgrade",
|
|
2470
|
+
title = "Upgrade to Pro",
|
|
2471
|
+
subtitle = "Unlock more features",
|
|
2472
|
+
className,
|
|
2473
|
+
...rest
|
|
2474
|
+
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2475
|
+
"div",
|
|
2476
|
+
{
|
|
2477
|
+
ref,
|
|
2478
|
+
className: ["w-full", className].filter(Boolean).join(" "),
|
|
2479
|
+
...rest,
|
|
2480
|
+
children: [
|
|
2481
|
+
eyebrow && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-caption text-muted mb-md", children: eyebrow }),
|
|
2482
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "rounded-xl bg-surface shadow-card px-md py-sm flex items-center justify-between gap-sm", children: [
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col gap-xxs min-w-0", children: [
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-body-sm font-weight-heading-sm text-ink truncate", children: title }),
|
|
2485
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-caption text-muted truncate", children: subtitle })
|
|
2486
|
+
] }),
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2488
|
+
"span",
|
|
2489
|
+
{
|
|
2490
|
+
"aria-hidden": "true",
|
|
2491
|
+
className: "flex-shrink-0 flex items-center justify-center rounded-full",
|
|
2492
|
+
style: {
|
|
2493
|
+
width: "40px",
|
|
2494
|
+
height: "40px",
|
|
2495
|
+
backgroundColor: "color-mix(in srgb, var(--color-primary) 15%, transparent)"
|
|
2496
|
+
},
|
|
2497
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2498
|
+
"svg",
|
|
2499
|
+
{
|
|
2500
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2501
|
+
viewBox: "0 0 24 24",
|
|
2502
|
+
fill: "currentColor",
|
|
2503
|
+
"aria-hidden": "true",
|
|
2504
|
+
style: { width: "18px", height: "18px", color: "var(--color-ink)" },
|
|
2505
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M13 2 3 14h9l-1 8 10-12h-9l1-8z" })
|
|
2506
|
+
}
|
|
2507
|
+
)
|
|
2508
|
+
}
|
|
2509
|
+
)
|
|
2510
|
+
] })
|
|
2511
|
+
]
|
|
2512
|
+
}
|
|
2513
|
+
)
|
|
2514
|
+
);
|
|
2515
|
+
UpgradeCard.displayName = "UpgradeCard";
|
|
2516
|
+
|
|
2517
|
+
// virtual-pkg:src/atoms/AppSidebar/AppSidebar.tsx
|
|
2518
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2519
|
+
var LogoIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { width: "32", height: "32", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 36C12 36 8 28 16 22C20 19 26 20 26 20C26 20 22 26 18 30C16 32 12 36 12 36Z", style: { fill: "var(--color-logo-orange)" } }),
|
|
2521
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M24 8C24 8 36 12 36 24C36 30 32 36 26 38C26 38 28 30 26 24C25 20 24 8 24 8Z", style: { fill: "var(--color-logo-violet)" } }),
|
|
2522
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 36C12 36 16 24 24 20C28 18 36 20 36 20C36 20 30 28 26 32C22 36 12 36 12 36Z", style: { fill: "var(--color-logo-pink)", opacity: 0.7 } })
|
|
2523
|
+
] });
|
|
2524
|
+
var GiftIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "20px", height: "20px" }, children: [
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polyline", { points: "20 12 20 22 4 22 4 12" }),
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "2", y: "7", width: "20", height: "5" }),
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "12", y1: "22", x2: "12", y2: "7" }),
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z" }),
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z" })
|
|
2530
|
+
] });
|
|
2531
|
+
var InboxIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "20px", height: "20px" }, children: [
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12" }),
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" })
|
|
2534
|
+
] });
|
|
2535
|
+
var SidebarIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "18px", height: "18px" }, children: [
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
|
|
2538
|
+
] });
|
|
2539
|
+
var AppSidebar = import_react10.default.forwardRef(
|
|
2540
|
+
({
|
|
2541
|
+
brandName,
|
|
2542
|
+
entries,
|
|
2543
|
+
activeId,
|
|
2544
|
+
onSelect,
|
|
2545
|
+
activeSubId,
|
|
2546
|
+
onSubSelect,
|
|
2547
|
+
// footer opt-in props
|
|
2548
|
+
workspaceName,
|
|
2549
|
+
showShareCard = false,
|
|
2550
|
+
showUpgradeCard = false,
|
|
2551
|
+
userInitials,
|
|
2552
|
+
onInboxClick,
|
|
2553
|
+
// legacy compat
|
|
2554
|
+
activeItem,
|
|
2555
|
+
collapsed: collapsedProp,
|
|
2556
|
+
onCollapsedChange,
|
|
2557
|
+
children,
|
|
2558
|
+
className,
|
|
2559
|
+
...rest
|
|
2560
|
+
}, ref) => {
|
|
2561
|
+
const [internalCollapsed, setInternalCollapsed] = import_react10.default.useState(false);
|
|
2562
|
+
const isControlled = collapsedProp !== void 0;
|
|
2563
|
+
const collapsed = isControlled ? collapsedProp : internalCollapsed;
|
|
2564
|
+
const handleCollapse = () => {
|
|
2565
|
+
const next = !collapsed;
|
|
2566
|
+
if (!isControlled) setInternalCollapsed(next);
|
|
2567
|
+
onCollapsedChange?.(next);
|
|
2568
|
+
};
|
|
2569
|
+
const [expandedIds, setExpandedIds] = import_react10.default.useState(/* @__PURE__ */ new Set());
|
|
2570
|
+
const toggleExpanded = (id) => {
|
|
2571
|
+
setExpandedIds((prev) => {
|
|
2572
|
+
const next = new Set(prev);
|
|
2573
|
+
if (next.has(id)) next.delete(id);
|
|
2574
|
+
else next.add(id);
|
|
2575
|
+
return next;
|
|
2576
|
+
});
|
|
2577
|
+
};
|
|
2578
|
+
const resolvedActiveId = activeId ?? activeItem ?? "";
|
|
2579
|
+
const hasEntries = entries && entries.length > 0;
|
|
2580
|
+
const hasFooterPromoContent = showShareCard || showUpgradeCard;
|
|
2581
|
+
const hasFooterBottomContent = !!(userInitials || onInboxClick);
|
|
2582
|
+
const hasFooterContent = hasFooterPromoContent || hasFooterBottomContent;
|
|
2583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2584
|
+
"nav",
|
|
2585
|
+
{
|
|
2586
|
+
ref,
|
|
2587
|
+
"aria-label": brandName ?? "Application",
|
|
2588
|
+
className: [
|
|
2589
|
+
"flex flex-col bg-canvas border-r border-hairline h-full overflow-hidden",
|
|
2590
|
+
"transition-all duration-300 ease-in-out",
|
|
2591
|
+
collapsed ? "w-14" : "w-64",
|
|
2592
|
+
className
|
|
2593
|
+
].filter(Boolean).join(" "),
|
|
2594
|
+
...rest,
|
|
2595
|
+
children: [
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2597
|
+
"div",
|
|
2598
|
+
{
|
|
2599
|
+
className: [
|
|
2600
|
+
"flex items-center px-md pt-md pb-sm flex-shrink-0 transition-all duration-300",
|
|
2601
|
+
collapsed ? "justify-center" : "justify-between"
|
|
2602
|
+
].join(" "),
|
|
2603
|
+
children: [
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2605
|
+
"div",
|
|
2606
|
+
{
|
|
2607
|
+
className: "transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0 flex items-center gap-sm min-w-0",
|
|
2608
|
+
style: { maxWidth: collapsed ? "0px" : "180px", opacity: collapsed ? 0 : 1 },
|
|
2609
|
+
children: [
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LogoIcon, {}),
|
|
2611
|
+
brandName && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-body-sm font-weight-heading-sm text-ink truncate", children: brandName })
|
|
2612
|
+
]
|
|
2613
|
+
}
|
|
2614
|
+
),
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2616
|
+
Button,
|
|
2617
|
+
{
|
|
2618
|
+
variant: "ghost",
|
|
2619
|
+
size: "sm",
|
|
2620
|
+
"aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
2621
|
+
onClick: handleCollapse,
|
|
2622
|
+
className: [
|
|
2623
|
+
"!p-xs !rounded-md flex-shrink-0 transition-all duration-200",
|
|
2624
|
+
collapsed ? "!text-primary ring-2 ring-primary !bg-transparent hover:!bg-surface-soft" : ""
|
|
2625
|
+
].filter(Boolean).join(" "),
|
|
2626
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SidebarIcon, {})
|
|
2627
|
+
}
|
|
2628
|
+
)
|
|
2629
|
+
]
|
|
2630
|
+
}
|
|
2631
|
+
),
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-1 overflow-y-auto overflow-x-hidden px-sm space-y-xxs pb-sm", children: [
|
|
2633
|
+
workspaceName && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2634
|
+
"div",
|
|
2635
|
+
{
|
|
2636
|
+
className: "overflow-hidden transition-all duration-300 ease-in-out",
|
|
2637
|
+
style: {
|
|
2638
|
+
maxHeight: collapsed ? "0px" : "60px",
|
|
2639
|
+
opacity: collapsed ? 0 : 1,
|
|
2640
|
+
marginBottom: collapsed ? "0px" : "8px"
|
|
2641
|
+
},
|
|
2642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WorkspaceMenu, { workspaceName, initials: workspaceName.charAt(0).toUpperCase() })
|
|
2643
|
+
}
|
|
2644
|
+
),
|
|
2645
|
+
hasEntries && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "space-y-xxs", role: "list", children: entries.map((entry) => {
|
|
2646
|
+
const isActive = resolvedActiveId === entry.id;
|
|
2647
|
+
const hasSubItems = !!(entry.subItems && entry.subItems.length > 0);
|
|
2648
|
+
const isExpanded = expandedIds.has(entry.id);
|
|
2649
|
+
const mappedSubItems = hasSubItems ? entry.subItems.map((sub) => ({
|
|
2650
|
+
id: sub.id,
|
|
2651
|
+
label: sub.label,
|
|
2652
|
+
onDelete: sub.onDelete,
|
|
2653
|
+
onClick: onSubSelect ? (_id) => onSubSelect(_id) : void 0
|
|
2654
|
+
})) : void 0;
|
|
2655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2656
|
+
NavItem,
|
|
2657
|
+
{
|
|
2658
|
+
icon: entry.icon,
|
|
2659
|
+
label: entry.label,
|
|
2660
|
+
active: isActive,
|
|
2661
|
+
iconOnly: collapsed,
|
|
2662
|
+
subItems: !collapsed ? mappedSubItems : void 0,
|
|
2663
|
+
expanded: hasSubItems ? isExpanded : void 0,
|
|
2664
|
+
onExpandToggle: hasSubItems ? () => toggleExpanded(entry.id) : void 0,
|
|
2665
|
+
onClick: (e) => {
|
|
2666
|
+
onSelect?.(entry.id);
|
|
2667
|
+
if (hasSubItems) {
|
|
2668
|
+
e.preventDefault();
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
},
|
|
2672
|
+
entry.id
|
|
2673
|
+
);
|
|
2674
|
+
}) }),
|
|
2675
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2676
|
+
"div",
|
|
2677
|
+
{
|
|
2678
|
+
className: "overflow-hidden transition-all duration-300 ease-in-out",
|
|
2679
|
+
style: { maxHeight: collapsed ? "0px" : "600px", opacity: collapsed ? 0 : 1 },
|
|
2680
|
+
children
|
|
2681
|
+
}
|
|
2682
|
+
)
|
|
2683
|
+
] }),
|
|
2684
|
+
hasFooterContent && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex-shrink-0 px-sm pb-md space-y-sm", children: [
|
|
2685
|
+
hasFooterPromoContent && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2686
|
+
"div",
|
|
2687
|
+
{
|
|
2688
|
+
className: "overflow-hidden transition-all duration-300 ease-in-out space-y-sm",
|
|
2689
|
+
style: { maxHeight: collapsed ? "0px" : "300px", opacity: collapsed ? 0 : 1 },
|
|
2690
|
+
children: [
|
|
2691
|
+
showShareCard && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "rounded-xl border border-hairline bg-surface px-md py-sm flex items-center justify-between gap-md", children: [
|
|
2692
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex flex-col gap-xxs min-w-0", children: [
|
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-body-sm font-weight-heading-sm text-ink", children: "Share Lovable" }),
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-caption text-muted", children: "100 credits per paid referral" })
|
|
2695
|
+
] }),
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2697
|
+
"span",
|
|
2698
|
+
{
|
|
2699
|
+
className: "flex-shrink-0 flex items-center justify-center rounded-full bg-surface-strong",
|
|
2700
|
+
style: { width: "36px", height: "36px" },
|
|
2701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GiftIcon, {})
|
|
2702
|
+
}
|
|
2703
|
+
)
|
|
2704
|
+
] }),
|
|
2705
|
+
showUpgradeCard && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UpgradeCard, { eyebrow: "", title: "Upgrade to Pro", subtitle: "Unlock more features" })
|
|
2706
|
+
]
|
|
2707
|
+
}
|
|
2708
|
+
),
|
|
2709
|
+
hasFooterBottomContent && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2710
|
+
"div",
|
|
2711
|
+
{
|
|
2712
|
+
className: [
|
|
2713
|
+
"flex items-center pt-xs transition-all duration-300",
|
|
2714
|
+
collapsed ? "justify-center" : "justify-between"
|
|
2715
|
+
].join(" "),
|
|
2716
|
+
children: [
|
|
2717
|
+
userInitials && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2718
|
+
"span",
|
|
2719
|
+
{
|
|
2720
|
+
className: "flex items-center justify-center rounded-full bg-primary text-on-primary text-body-sm font-weight-heading-sm cursor-pointer hover:bg-primary-hover transition-colors duration-150 flex-shrink-0",
|
|
2721
|
+
style: { width: "36px", height: "36px" },
|
|
2722
|
+
"aria-label": "User profile",
|
|
2723
|
+
children: userInitials
|
|
2724
|
+
}
|
|
2725
|
+
),
|
|
2726
|
+
onInboxClick && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2727
|
+
"div",
|
|
2728
|
+
{
|
|
2729
|
+
className: "overflow-hidden transition-all duration-300 ease-in-out",
|
|
2730
|
+
style: { maxWidth: collapsed ? "0px" : "40px", opacity: collapsed ? 0 : 1 },
|
|
2731
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2732
|
+
Button,
|
|
2733
|
+
{
|
|
2734
|
+
variant: "ghost",
|
|
2735
|
+
size: "sm",
|
|
2736
|
+
"aria-label": "Inbox",
|
|
2737
|
+
onClick: onInboxClick,
|
|
2738
|
+
className: "!p-xs !rounded-sm relative",
|
|
2739
|
+
children: [
|
|
2740
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InboxIcon, {}),
|
|
2741
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2742
|
+
"span",
|
|
2743
|
+
{
|
|
2744
|
+
className: "absolute top-1 right-1 rounded-full bg-semantic-error",
|
|
2745
|
+
"aria-label": "New notifications",
|
|
2746
|
+
style: { width: "8px", height: "8px" }
|
|
2747
|
+
}
|
|
2748
|
+
)
|
|
2749
|
+
]
|
|
2750
|
+
}
|
|
2751
|
+
)
|
|
2752
|
+
}
|
|
2753
|
+
)
|
|
2754
|
+
]
|
|
2755
|
+
}
|
|
2756
|
+
)
|
|
2757
|
+
] })
|
|
2758
|
+
]
|
|
2759
|
+
}
|
|
2760
|
+
);
|
|
2761
|
+
}
|
|
2762
|
+
);
|
|
2763
|
+
AppSidebar.displayName = "AppSidebar";
|
|
2764
|
+
|
|
2765
|
+
// virtual-pkg:src/atoms/AuthScreen/AuthScreen.tsx
|
|
2766
|
+
var import_react11 = __toESM(require("react"));
|
|
2767
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2768
|
+
var AuthScreen = import_react11.default.forwardRef(
|
|
2769
|
+
({ defaultTab = "login", onLogin, onSignup, loading = false }, ref) => {
|
|
2770
|
+
const [tab, setTab] = (0, import_react11.useState)(defaultTab);
|
|
2771
|
+
const [name, setName] = (0, import_react11.useState)("");
|
|
2772
|
+
const [email, setEmail] = (0, import_react11.useState)("");
|
|
2773
|
+
const [password, setPassword] = (0, import_react11.useState)("");
|
|
2774
|
+
const [confirm, setConfirm] = (0, import_react11.useState)("");
|
|
2775
|
+
const [error, setError] = (0, import_react11.useState)(null);
|
|
2776
|
+
const nameId = (0, import_react11.useId)();
|
|
2777
|
+
const emailId = (0, import_react11.useId)();
|
|
2778
|
+
const passwordId = (0, import_react11.useId)();
|
|
2779
|
+
const confirmId = (0, import_react11.useId)();
|
|
2780
|
+
const switchTab = (t) => {
|
|
2781
|
+
setTab(t);
|
|
2782
|
+
setError(null);
|
|
2783
|
+
};
|
|
2784
|
+
const handleSubmit = (e) => {
|
|
2785
|
+
e.preventDefault();
|
|
2786
|
+
setError(null);
|
|
2787
|
+
if (tab === "signup") {
|
|
2788
|
+
if (password !== confirm) {
|
|
2789
|
+
setError("Passwords do not match.");
|
|
2790
|
+
return;
|
|
2791
|
+
}
|
|
2792
|
+
onSignup?.({ name, email, password });
|
|
2793
|
+
} else {
|
|
2794
|
+
onLogin?.({ email, password });
|
|
2795
|
+
}
|
|
2796
|
+
};
|
|
2797
|
+
const labelCls = "block text-body-sm text-body mb-xs font-weight-heading-sm";
|
|
2798
|
+
return (
|
|
2799
|
+
/* Full-width page background — no height constraint */
|
|
2800
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, className: "w-full bg-surface p-xl", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "w-full max-w-3xl mx-auto flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2801
|
+
"div",
|
|
2802
|
+
{
|
|
2803
|
+
style: { width: "min(100%, 22rem)" },
|
|
2804
|
+
className: "rounded-xl border border-hairline-soft bg-canvas px-xl py-xxl shadow-card",
|
|
2805
|
+
children: [
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-lg flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex h-14 w-10 items-center justify-center rounded-full bg-primary", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2807
|
+
"path",
|
|
2808
|
+
{
|
|
2809
|
+
d: "M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5",
|
|
2810
|
+
stroke: "white",
|
|
2811
|
+
strokeWidth: "2",
|
|
2812
|
+
strokeLinecap: "round",
|
|
2813
|
+
strokeLinejoin: "round"
|
|
2814
|
+
}
|
|
2815
|
+
) }) }) }),
|
|
2816
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { className: "mb-xs text-heading-sm text-ink", children: tab === "login" ? "Welcome back" : "Create an account" }),
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mb-xl text-body-sm text-muted", children: tab === "login" ? "Sign in to continue to your workspace." : "Start your journey \u2014 it only takes a minute." }),
|
|
2818
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2819
|
+
"div",
|
|
2820
|
+
{
|
|
2821
|
+
role: "tablist",
|
|
2822
|
+
"aria-label": "Auth mode",
|
|
2823
|
+
className: "mb-xl flex rounded-lg bg-surface-soft p-xs gap-xs",
|
|
2824
|
+
children: ["login", "signup"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2825
|
+
Button,
|
|
2826
|
+
{
|
|
2827
|
+
role: "tab",
|
|
2828
|
+
type: "button",
|
|
2829
|
+
"aria-selected": tab === t,
|
|
2830
|
+
onClick: () => switchTab(t),
|
|
2831
|
+
variant: "ghost",
|
|
2832
|
+
size: "sm",
|
|
2833
|
+
style: { flex: 1, whiteSpace: "normal" },
|
|
2834
|
+
className: [
|
|
2835
|
+
"min-w-0 rounded-md py-sm transition-colors",
|
|
2836
|
+
tab === t ? "bg-canvas text-ink shadow-sm font-weight-heading-sm" : "text-muted hover:text-ink bg-transparent border-transparent"
|
|
2837
|
+
].join(" "),
|
|
2838
|
+
children: t === "login" ? "Log in" : "Sign up"
|
|
2839
|
+
},
|
|
2840
|
+
t
|
|
2841
|
+
))
|
|
2842
|
+
}
|
|
2843
|
+
),
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { onSubmit: handleSubmit, noValidate: true, className: "space-y-base", children: [
|
|
2845
|
+
tab === "signup" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: nameId, className: labelCls, children: "Full name" }),
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2848
|
+
Input,
|
|
2849
|
+
{
|
|
2850
|
+
id: nameId,
|
|
2851
|
+
type: "text",
|
|
2852
|
+
autoComplete: "name",
|
|
2853
|
+
required: true,
|
|
2854
|
+
placeholder: "Jane Doe",
|
|
2855
|
+
value: name,
|
|
2856
|
+
onChange: (e) => setName(e.target.value),
|
|
2857
|
+
fullWidth: true
|
|
2858
|
+
}
|
|
2859
|
+
)
|
|
2860
|
+
] }),
|
|
2861
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
2862
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: emailId, className: labelCls, children: "Email address" }),
|
|
2863
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2864
|
+
Input,
|
|
2865
|
+
{
|
|
2866
|
+
id: emailId,
|
|
2867
|
+
type: "email",
|
|
2868
|
+
autoComplete: "email",
|
|
2869
|
+
required: true,
|
|
2870
|
+
placeholder: "you@example.com",
|
|
2871
|
+
value: email,
|
|
2872
|
+
onChange: (e) => setEmail(e.target.value),
|
|
2873
|
+
fullWidth: true
|
|
2874
|
+
}
|
|
2875
|
+
)
|
|
2876
|
+
] }),
|
|
2877
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-xs flex items-center justify-between", children: [
|
|
2879
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: passwordId, className: labelCls + " mb-0", children: "Password" }),
|
|
2880
|
+
tab === "login" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { href: "#", className: "text-body-sm text-primary hover:underline", children: "Forgot password?" })
|
|
2881
|
+
] }),
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2883
|
+
Input,
|
|
2884
|
+
{
|
|
2885
|
+
id: passwordId,
|
|
2886
|
+
type: "password",
|
|
2887
|
+
required: true,
|
|
2888
|
+
autoComplete: tab === "login" ? "current-password" : "new-password",
|
|
2889
|
+
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
2890
|
+
value: password,
|
|
2891
|
+
onChange: (e) => setPassword(e.target.value),
|
|
2892
|
+
fullWidth: true
|
|
2893
|
+
}
|
|
2894
|
+
)
|
|
2895
|
+
] }),
|
|
2896
|
+
tab === "signup" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
2897
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: confirmId, className: labelCls, children: "Confirm password" }),
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2899
|
+
Input,
|
|
2900
|
+
{
|
|
2901
|
+
id: confirmId,
|
|
2902
|
+
type: "password",
|
|
2903
|
+
autoComplete: "new-password",
|
|
2904
|
+
required: true,
|
|
2905
|
+
placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
2906
|
+
value: confirm,
|
|
2907
|
+
onChange: (e) => setConfirm(e.target.value),
|
|
2908
|
+
fullWidth: true
|
|
2909
|
+
}
|
|
2910
|
+
)
|
|
2911
|
+
] }),
|
|
2912
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2913
|
+
"p",
|
|
2914
|
+
{
|
|
2915
|
+
role: "alert",
|
|
2916
|
+
className: "rounded-md border border-semantic-error px-base py-sm text-body-sm text-semantic-error",
|
|
2917
|
+
children: error
|
|
2918
|
+
}
|
|
2919
|
+
),
|
|
2920
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { type: "submit", variant: "primary", size: "lg", disabled: loading, className: "w-full", children: loading ? "Please wait\u2026" : tab === "login" ? "Sign in" : "Create account" })
|
|
2921
|
+
] }),
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "my-xl flex items-center gap-base", children: [
|
|
2923
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "h-px flex-1 bg-hairline" }),
|
|
2924
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-caption text-muted-soft", children: "OR" }),
|
|
2925
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "h-px flex-1 bg-hairline" })
|
|
2926
|
+
] }),
|
|
2927
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Button, { type: "button", variant: "secondary", size: "md", className: "w-full", children: [
|
|
2928
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", className: "shrink-0", children: [
|
|
2929
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z", fill: "var(--color-google-blue)" }),
|
|
2930
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z", fill: "var(--color-google-green)" }),
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z", fill: "var(--color-google-yellow)" }),
|
|
2932
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z", fill: "var(--color-google-red)" })
|
|
2933
|
+
] }),
|
|
2934
|
+
"Continue with Google"
|
|
2935
|
+
] }),
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mt-xl text-center text-body-sm text-muted", children: tab === "login" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2937
|
+
"Don\u2019t have an account?",
|
|
2938
|
+
" ",
|
|
2939
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2940
|
+
Button,
|
|
2941
|
+
{
|
|
2942
|
+
type: "button",
|
|
2943
|
+
variant: "ghost",
|
|
2944
|
+
size: "sm",
|
|
2945
|
+
onClick: () => switchTab("signup"),
|
|
2946
|
+
style: { whiteSpace: "normal" },
|
|
2947
|
+
className: "text-primary hover:underline bg-transparent border-transparent p-0 h-auto",
|
|
2948
|
+
children: "Sign up"
|
|
2949
|
+
}
|
|
2950
|
+
)
|
|
2951
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2952
|
+
"Already have an account?",
|
|
2953
|
+
" ",
|
|
2954
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2955
|
+
Button,
|
|
2956
|
+
{
|
|
2957
|
+
type: "button",
|
|
2958
|
+
variant: "ghost",
|
|
2959
|
+
size: "sm",
|
|
2960
|
+
onClick: () => switchTab("login"),
|
|
2961
|
+
style: { whiteSpace: "normal" },
|
|
2962
|
+
className: "text-primary hover:underline bg-transparent border-transparent p-0 h-auto",
|
|
2963
|
+
children: "Log in"
|
|
2964
|
+
}
|
|
2965
|
+
)
|
|
2966
|
+
] }) })
|
|
2967
|
+
]
|
|
2968
|
+
}
|
|
2969
|
+
) }) })
|
|
2970
|
+
);
|
|
2971
|
+
}
|
|
2972
|
+
);
|
|
2973
|
+
AuthScreen.displayName = "AuthScreen";
|
|
2974
|
+
|
|
2975
|
+
// virtual-pkg:src/atoms/Chip/Chip.tsx
|
|
2976
|
+
var import_react12 = __toESM(require("react"));
|
|
2977
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2978
|
+
var variantClasses2 = {
|
|
2979
|
+
default: "bg-surface-strong text-body border border-hairline",
|
|
2980
|
+
primary: "bg-primary text-on-primary border border-primary",
|
|
2981
|
+
success: "bg-[var(--color-semantic-success-soft)] text-[var(--color-semantic-success)] border border-[var(--color-semantic-success)]",
|
|
2982
|
+
warning: "bg-[var(--color-semantic-warning-soft)] text-[var(--color-semantic-warning)] border border-[var(--color-semantic-warning)]",
|
|
2983
|
+
error: "bg-[var(--color-semantic-error-soft)] text-[var(--color-semantic-error)] border border-[var(--color-semantic-error)]"
|
|
2984
|
+
};
|
|
2985
|
+
var sizeClasses3 = {
|
|
2986
|
+
sm: { chip: "h-6 px-xs gap-xs rounded-xs", text: "text-caption", icon: "w-3 h-3", dismissSize: "sm" },
|
|
2987
|
+
md: { chip: "h-8 px-sm gap-xs rounded-sm", text: "text-body-sm", icon: "w-4 h-4", dismissSize: "sm" },
|
|
2988
|
+
lg: { chip: "h-10 px-md gap-sm rounded-md", text: "text-body-md", icon: "w-5 h-5", dismissSize: "sm" }
|
|
2989
|
+
};
|
|
2990
|
+
var CloseIcon = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2991
|
+
"svg",
|
|
2992
|
+
{
|
|
2993
|
+
viewBox: "0 0 16 16",
|
|
2994
|
+
fill: "none",
|
|
2995
|
+
stroke: "currentColor",
|
|
2996
|
+
strokeWidth: 2.5,
|
|
2997
|
+
strokeLinecap: "round",
|
|
2998
|
+
className,
|
|
2999
|
+
"aria-hidden": "true",
|
|
3000
|
+
children: [
|
|
3001
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("line", { x1: "4", y1: "4", x2: "12", y2: "12" }),
|
|
3002
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("line", { x1: "12", y1: "4", x2: "4", y2: "12" })
|
|
3003
|
+
]
|
|
3004
|
+
}
|
|
3005
|
+
);
|
|
3006
|
+
var Chip = import_react12.default.forwardRef(
|
|
3007
|
+
({
|
|
3008
|
+
label,
|
|
3009
|
+
variant = "default",
|
|
3010
|
+
size = "md",
|
|
3011
|
+
icon,
|
|
3012
|
+
onDismiss,
|
|
3013
|
+
disabled = false,
|
|
3014
|
+
className = "",
|
|
3015
|
+
...props
|
|
3016
|
+
}, ref) => {
|
|
3017
|
+
const sz = sizeClasses3[size];
|
|
3018
|
+
const vr = variantClasses2[variant];
|
|
3019
|
+
const disabledStyles = disabled ? "opacity-50 pointer-events-none select-none" : "";
|
|
3020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3021
|
+
"span",
|
|
3022
|
+
{
|
|
3023
|
+
ref,
|
|
3024
|
+
role: "status",
|
|
3025
|
+
"aria-label": label,
|
|
3026
|
+
className: [
|
|
3027
|
+
"inline-flex items-center font-medium whitespace-nowrap transition-colors",
|
|
3028
|
+
sz.chip,
|
|
3029
|
+
vr,
|
|
3030
|
+
disabledStyles,
|
|
3031
|
+
className
|
|
3032
|
+
].filter(Boolean).join(" "),
|
|
3033
|
+
...props,
|
|
3034
|
+
children: [
|
|
3035
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3036
|
+
"span",
|
|
3037
|
+
{
|
|
3038
|
+
className: `${sz.icon} flex-shrink-0 flex items-center justify-center`,
|
|
3039
|
+
"aria-hidden": "true",
|
|
3040
|
+
children: icon
|
|
3041
|
+
}
|
|
3042
|
+
),
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: sz.text, children: label }),
|
|
3044
|
+
onDismiss && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3045
|
+
Button,
|
|
3046
|
+
{
|
|
3047
|
+
variant: "ghost",
|
|
3048
|
+
size: sz.dismissSize,
|
|
3049
|
+
onClick: onDismiss,
|
|
3050
|
+
disabled,
|
|
3051
|
+
"aria-label": `Remove ${label}`,
|
|
3052
|
+
className: "!p-0 !h-4 !w-4 !min-w-0 opacity-60 hover:opacity-100 rounded-full flex-shrink-0",
|
|
3053
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon, { className: "w-3 h-3" })
|
|
3054
|
+
}
|
|
3055
|
+
)
|
|
3056
|
+
]
|
|
3057
|
+
}
|
|
3058
|
+
);
|
|
3059
|
+
}
|
|
3060
|
+
);
|
|
3061
|
+
Chip.displayName = "Chip";
|
|
3062
|
+
|
|
3063
|
+
// virtual-pkg:src/atoms/FilterTabBar/FilterTabBar.tsx
|
|
3064
|
+
var import_react13 = __toESM(require("react"));
|
|
3065
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3066
|
+
var FilterTabBar = import_react13.default.forwardRef(
|
|
3067
|
+
({ tabs, value, onChange, className = "", ...rest }, ref) => {
|
|
3068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3069
|
+
"div",
|
|
3070
|
+
{
|
|
3071
|
+
ref,
|
|
3072
|
+
role: "tablist",
|
|
3073
|
+
"aria-label": "Filter tabs",
|
|
3074
|
+
className: [
|
|
3075
|
+
"inline-flex items-center gap-xs p-xs",
|
|
3076
|
+
"bg-surface border border-hairline rounded-xl shadow-sm",
|
|
3077
|
+
className
|
|
3078
|
+
].filter(Boolean).join(" "),
|
|
3079
|
+
...rest,
|
|
3080
|
+
children: tabs.map((tab) => {
|
|
3081
|
+
const isActive = tab.value === value;
|
|
3082
|
+
const iconOnly = !!tab.icon && !tab.label;
|
|
3083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
3084
|
+
Button,
|
|
3085
|
+
{
|
|
3086
|
+
role: "tab",
|
|
3087
|
+
"aria-selected": isActive,
|
|
3088
|
+
"aria-label": tab["aria-label"],
|
|
3089
|
+
variant: isActive ? "primary" : "ghost",
|
|
3090
|
+
size: "sm",
|
|
3091
|
+
onClick: () => onChange(tab.value),
|
|
3092
|
+
className: [
|
|
3093
|
+
"transition-[background-color,color,box-shadow] duration-200 ease-in-out",
|
|
3094
|
+
iconOnly ? "!px-xs aspect-square" : ""
|
|
3095
|
+
].filter(Boolean).join(" "),
|
|
3096
|
+
children: [
|
|
3097
|
+
tab.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "inline-flex items-center justify-center size-4 shrink-0", children: tab.icon }),
|
|
3098
|
+
tab.label && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: tab.label }),
|
|
3099
|
+
tab.count !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3100
|
+
"span",
|
|
3101
|
+
{
|
|
3102
|
+
className: [
|
|
3103
|
+
"inline-flex items-center justify-center",
|
|
3104
|
+
"min-w-[1.25rem] h-5 px-xs rounded-sm",
|
|
3105
|
+
"text-caption leading-none",
|
|
3106
|
+
"transition-[background-color,color] duration-200 ease-in-out",
|
|
3107
|
+
isActive ? "bg-primary-active text-on-primary" : "bg-surface-strong text-muted"
|
|
3108
|
+
].filter(Boolean).join(" "),
|
|
3109
|
+
"aria-label": `${tab.count} items`,
|
|
3110
|
+
children: tab.count
|
|
3111
|
+
}
|
|
3112
|
+
)
|
|
3113
|
+
]
|
|
3114
|
+
},
|
|
3115
|
+
tab.value
|
|
3116
|
+
);
|
|
3117
|
+
})
|
|
3118
|
+
}
|
|
3119
|
+
);
|
|
3120
|
+
}
|
|
3121
|
+
);
|
|
3122
|
+
FilterTabBar.displayName = "FilterTabBar";
|
|
3123
|
+
|
|
3124
|
+
// virtual-pkg:src/atoms/Modal/Modal.tsx
|
|
3125
|
+
var import_react14 = __toESM(require("react"));
|
|
3126
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3127
|
+
var sizeMap = {
|
|
3128
|
+
sm: "max-w-sm",
|
|
3129
|
+
md: "max-w-lg",
|
|
3130
|
+
lg: "max-w-2xl"
|
|
3131
|
+
};
|
|
3132
|
+
var Modal = import_react14.default.forwardRef(
|
|
3133
|
+
({ isOpen, onClose, title, children, footer, size = "md" }, ref) => {
|
|
3134
|
+
const [mounted, setMounted] = (0, import_react14.useState)(false);
|
|
3135
|
+
const [visible, setVisible] = (0, import_react14.useState)(false);
|
|
3136
|
+
const overlayRef = (0, import_react14.useRef)(null);
|
|
3137
|
+
(0, import_react14.useEffect)(() => {
|
|
3138
|
+
if (isOpen) {
|
|
3139
|
+
setMounted(true);
|
|
3140
|
+
const raf = requestAnimationFrame(() => {
|
|
3141
|
+
requestAnimationFrame(() => setVisible(true));
|
|
3142
|
+
});
|
|
3143
|
+
return () => cancelAnimationFrame(raf);
|
|
3144
|
+
} else {
|
|
3145
|
+
setVisible(false);
|
|
3146
|
+
const timer = setTimeout(() => setMounted(false), 250);
|
|
3147
|
+
return () => clearTimeout(timer);
|
|
3148
|
+
}
|
|
3149
|
+
}, [isOpen]);
|
|
3150
|
+
(0, import_react14.useEffect)(() => {
|
|
3151
|
+
if (!mounted) return;
|
|
3152
|
+
const handleKey = (e) => {
|
|
3153
|
+
if (e.key === "Escape") onClose();
|
|
3154
|
+
};
|
|
3155
|
+
document.addEventListener("keydown", handleKey);
|
|
3156
|
+
return () => document.removeEventListener("keydown", handleKey);
|
|
3157
|
+
}, [mounted, onClose]);
|
|
3158
|
+
if (!mounted) return null;
|
|
3159
|
+
const handleBackdropClick = (e) => {
|
|
3160
|
+
if (e.target === overlayRef.current) onClose();
|
|
3161
|
+
};
|
|
3162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3163
|
+
"div",
|
|
3164
|
+
{
|
|
3165
|
+
ref: overlayRef,
|
|
3166
|
+
role: "dialog",
|
|
3167
|
+
"aria-modal": "true",
|
|
3168
|
+
"aria-labelledby": title ? "modal-title" : void 0,
|
|
3169
|
+
onClick: handleBackdropClick,
|
|
3170
|
+
className: [
|
|
3171
|
+
"fixed inset-0 flex items-center justify-center p-base",
|
|
3172
|
+
"bg-[var(--color-scrim)]/50",
|
|
3173
|
+
"transition-opacity duration-250 ease-in-out",
|
|
3174
|
+
visible ? "opacity-100" : "opacity-0"
|
|
3175
|
+
].join(" "),
|
|
3176
|
+
style: { zIndex: "var(--z-modal, 1000)" },
|
|
3177
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3178
|
+
"div",
|
|
3179
|
+
{
|
|
3180
|
+
ref,
|
|
3181
|
+
className: [
|
|
3182
|
+
"relative w-full bg-canvas rounded-lg",
|
|
3183
|
+
"shadow-[0_8px_40px_0_rgba(0,0,0,0.18)]",
|
|
3184
|
+
"flex flex-col overflow-hidden",
|
|
3185
|
+
sizeMap[size],
|
|
3186
|
+
"transition-all duration-250 ease-in-out",
|
|
3187
|
+
visible ? "opacity-100 translate-y-0 scale-100" : "opacity-0 translate-y-2 scale-95"
|
|
3188
|
+
].join(" "),
|
|
3189
|
+
children: [
|
|
3190
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between px-lg py-base border-b border-hairline", children: [
|
|
3191
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h2", { id: "modal-title", className: "text-heading-sm text-ink", children: title }),
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3193
|
+
Button,
|
|
3194
|
+
{
|
|
3195
|
+
variant: "ghost",
|
|
3196
|
+
size: "sm",
|
|
3197
|
+
"aria-label": "Close modal",
|
|
3198
|
+
onClick: onClose,
|
|
3199
|
+
className: "!px-xs !py-xs",
|
|
3200
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3201
|
+
"svg",
|
|
3202
|
+
{
|
|
3203
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3204
|
+
width: "16",
|
|
3205
|
+
height: "16",
|
|
3206
|
+
viewBox: "0 0 24 24",
|
|
3207
|
+
fill: "none",
|
|
3208
|
+
stroke: "currentColor",
|
|
3209
|
+
strokeWidth: "2",
|
|
3210
|
+
strokeLinecap: "round",
|
|
3211
|
+
strokeLinejoin: "round",
|
|
3212
|
+
"aria-hidden": "true",
|
|
3213
|
+
children: [
|
|
3214
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
3215
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
3216
|
+
]
|
|
3217
|
+
}
|
|
3218
|
+
)
|
|
3219
|
+
}
|
|
3220
|
+
)
|
|
3221
|
+
] }),
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex-1 px-lg py-base text-body-md text-body overflow-y-auto", children }),
|
|
3223
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-end gap-sm px-lg py-base border-t border-hairline", children: footer })
|
|
3224
|
+
]
|
|
3225
|
+
}
|
|
3226
|
+
)
|
|
3227
|
+
}
|
|
3228
|
+
);
|
|
3229
|
+
}
|
|
3230
|
+
);
|
|
3231
|
+
Modal.displayName = "Modal";
|