@xenide-io/the-old-ui-theme 0.4.6 → 0.4.9
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/dist/ai-message-blocknote-4Q4U2T2W.mjs +63 -0
- package/dist/chunk-IAH7Z46I.mjs +104 -0
- package/dist/suite.js +501 -240
- package/dist/suite.mjs +291 -199
- package/package.json +3 -1
- package/src/styles/suite-skin.css +22 -0
- package/src/suite/components/ai-message-blocknote.test.tsx +40 -0
- package/src/suite/components/ai-message-blocknote.tsx +61 -0
- package/src/suite/components/ai-panel.test.ts +20 -0
- package/src/suite/components/ai-panel.tsx +255 -12
package/dist/suite.js
CHANGED
|
@@ -34,6 +34,9 @@ var __objRest = (source, exclude) => {
|
|
|
34
34
|
}
|
|
35
35
|
return target;
|
|
36
36
|
};
|
|
37
|
+
var __esm = (fn, res) => function __init() {
|
|
38
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
39
|
+
};
|
|
37
40
|
var __export = (target, all) => {
|
|
38
41
|
for (var name in all)
|
|
39
42
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -56,6 +59,168 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
56
59
|
));
|
|
57
60
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
61
|
|
|
62
|
+
// src/suite/components/theme-provider.tsx
|
|
63
|
+
function systemTheme(fallback) {
|
|
64
|
+
if (typeof window === "undefined") return fallback;
|
|
65
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
66
|
+
}
|
|
67
|
+
function resolveTheme(theme, fallback) {
|
|
68
|
+
return theme === "system" ? systemTheme(fallback) : theme;
|
|
69
|
+
}
|
|
70
|
+
function applyTheme(theme, config) {
|
|
71
|
+
const resolved = resolveTheme(theme, config.fallbackTheme);
|
|
72
|
+
if (typeof document === "undefined") return resolved;
|
|
73
|
+
document.documentElement.setAttribute(
|
|
74
|
+
"data-theme",
|
|
75
|
+
resolved === "dark" ? config.darkThemeId : config.lightThemeId
|
|
76
|
+
);
|
|
77
|
+
document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
78
|
+
if (config.themeColorLight && config.themeColorDark) {
|
|
79
|
+
const meta = document.getElementById(
|
|
80
|
+
"theme-color-meta"
|
|
81
|
+
);
|
|
82
|
+
if (meta) {
|
|
83
|
+
meta.content = resolved === "light" ? config.themeColorLight : config.themeColorDark;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return resolved;
|
|
87
|
+
}
|
|
88
|
+
function readStoredTheme(storageKey) {
|
|
89
|
+
if (typeof window === "undefined") return "system";
|
|
90
|
+
const stored = localStorage.getItem(storageKey);
|
|
91
|
+
if (stored === "light" || stored === "dark" || stored === "system")
|
|
92
|
+
return stored;
|
|
93
|
+
return "system";
|
|
94
|
+
}
|
|
95
|
+
function SuiteThemeProvider({
|
|
96
|
+
config,
|
|
97
|
+
children
|
|
98
|
+
}) {
|
|
99
|
+
const [state, setState] = (0, import_react7.useState)(() => {
|
|
100
|
+
const theme2 = readStoredTheme(config.storageKey);
|
|
101
|
+
if (typeof document === "undefined") {
|
|
102
|
+
return { theme: theme2, resolvedTheme: config.fallbackTheme };
|
|
103
|
+
}
|
|
104
|
+
const domTheme = document.documentElement.getAttribute("data-theme");
|
|
105
|
+
const resolvedTheme2 = domTheme === config.darkThemeId ? "dark" : domTheme === config.lightThemeId ? "light" : resolveTheme(theme2, config.fallbackTheme);
|
|
106
|
+
return { theme: theme2, resolvedTheme: resolvedTheme2 };
|
|
107
|
+
});
|
|
108
|
+
const { theme, resolvedTheme } = state;
|
|
109
|
+
(0, import_react7.useEffect)(() => {
|
|
110
|
+
if (theme !== "system") return;
|
|
111
|
+
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
112
|
+
const update = () => {
|
|
113
|
+
const resolved = applyTheme("system", config);
|
|
114
|
+
setState((current) => __spreadProps(__spreadValues({}, current), { resolvedTheme: resolved }));
|
|
115
|
+
};
|
|
116
|
+
media.addEventListener("change", update);
|
|
117
|
+
return () => media.removeEventListener("change", update);
|
|
118
|
+
}, [theme, config]);
|
|
119
|
+
const setTheme = (0, import_react7.useCallback)(
|
|
120
|
+
(next) => {
|
|
121
|
+
const resolved = applyTheme(next, config);
|
|
122
|
+
setState({ theme: next, resolvedTheme: resolved });
|
|
123
|
+
localStorage.setItem(config.storageKey, next);
|
|
124
|
+
},
|
|
125
|
+
[config]
|
|
126
|
+
);
|
|
127
|
+
const toggleTheme = (0, import_react7.useCallback)(() => {
|
|
128
|
+
setState((prev) => {
|
|
129
|
+
const next = resolveTheme(prev.theme, config.fallbackTheme) === "dark" ? "light" : "dark";
|
|
130
|
+
const resolved = applyTheme(next, config);
|
|
131
|
+
localStorage.setItem(config.storageKey, next);
|
|
132
|
+
return { theme: next, resolvedTheme: resolved };
|
|
133
|
+
});
|
|
134
|
+
}, [config]);
|
|
135
|
+
const value = (0, import_react7.useMemo)(
|
|
136
|
+
() => ({ theme, resolvedTheme, setTheme, toggleTheme }),
|
|
137
|
+
[theme, resolvedTheme, setTheme, toggleTheme]
|
|
138
|
+
);
|
|
139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SuiteThemeContext.Provider, { value, children });
|
|
140
|
+
}
|
|
141
|
+
function useSuiteTheme() {
|
|
142
|
+
const ctx = (0, import_react7.useContext)(SuiteThemeContext);
|
|
143
|
+
if (!ctx) throw new Error("useTheme must be used within ThemeProvider");
|
|
144
|
+
return ctx;
|
|
145
|
+
}
|
|
146
|
+
var import_react7, import_jsx_runtime18, SuiteThemeContext;
|
|
147
|
+
var init_theme_provider = __esm({
|
|
148
|
+
"src/suite/components/theme-provider.tsx"() {
|
|
149
|
+
"use strict";
|
|
150
|
+
"use client";
|
|
151
|
+
import_react7 = require("react");
|
|
152
|
+
import_jsx_runtime18 = require("react/jsx-runtime");
|
|
153
|
+
SuiteThemeContext = (0, import_react7.createContext)(null);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// src/suite/components/ai-message-blocknote.tsx
|
|
158
|
+
var ai_message_blocknote_exports = {};
|
|
159
|
+
__export(ai_message_blocknote_exports, {
|
|
160
|
+
default: () => SuiteAiBlockNoteMessage
|
|
161
|
+
});
|
|
162
|
+
function SuiteAiBlockNoteMessage({
|
|
163
|
+
markdown
|
|
164
|
+
}) {
|
|
165
|
+
const { resolvedTheme } = useSuiteTheme();
|
|
166
|
+
const editor = (0, import_react9.useCreateBlockNote)({ schema: assistantSchema });
|
|
167
|
+
(0, import_react8.useEffect)(() => {
|
|
168
|
+
try {
|
|
169
|
+
const blocks = editor.tryParseMarkdownToBlocks(markdown);
|
|
170
|
+
editor.replaceBlocks(
|
|
171
|
+
editor.document,
|
|
172
|
+
blocks.length > 0 ? blocks : [{ type: "paragraph", content: markdown }]
|
|
173
|
+
);
|
|
174
|
+
} catch (e) {
|
|
175
|
+
editor.replaceBlocks(editor.document, [
|
|
176
|
+
{ type: "paragraph", content: markdown }
|
|
177
|
+
]);
|
|
178
|
+
}
|
|
179
|
+
}, [editor, markdown]);
|
|
180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
181
|
+
import_react9.BlockNoteViewRaw,
|
|
182
|
+
{
|
|
183
|
+
editor,
|
|
184
|
+
editable: false,
|
|
185
|
+
theme: resolvedTheme,
|
|
186
|
+
className: "suite-ai-blocknote",
|
|
187
|
+
formattingToolbar: false,
|
|
188
|
+
sideMenu: false,
|
|
189
|
+
slashMenu: false,
|
|
190
|
+
linkToolbar: false,
|
|
191
|
+
filePanel: false,
|
|
192
|
+
tableHandles: false,
|
|
193
|
+
comments: false
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
var import_react8, import_core, import_react9, import_style, import_jsx_runtime19, assistantSchema;
|
|
198
|
+
var init_ai_message_blocknote = __esm({
|
|
199
|
+
"src/suite/components/ai-message-blocknote.tsx"() {
|
|
200
|
+
"use strict";
|
|
201
|
+
"use client";
|
|
202
|
+
import_react8 = require("react");
|
|
203
|
+
import_core = require("@blocknote/core");
|
|
204
|
+
import_react9 = require("@blocknote/react");
|
|
205
|
+
import_style = require("@blocknote/react/style.css");
|
|
206
|
+
init_theme_provider();
|
|
207
|
+
import_jsx_runtime19 = require("react/jsx-runtime");
|
|
208
|
+
assistantSchema = import_core.BlockNoteSchema.create({
|
|
209
|
+
blockSpecs: {
|
|
210
|
+
paragraph: import_core.defaultBlockSpecs.paragraph,
|
|
211
|
+
heading: import_core.defaultBlockSpecs.heading,
|
|
212
|
+
bulletListItem: import_core.defaultBlockSpecs.bulletListItem,
|
|
213
|
+
numberedListItem: import_core.defaultBlockSpecs.numberedListItem,
|
|
214
|
+
checkListItem: import_core.defaultBlockSpecs.checkListItem,
|
|
215
|
+
codeBlock: import_core.defaultBlockSpecs.codeBlock,
|
|
216
|
+
quote: import_core.defaultBlockSpecs.quote,
|
|
217
|
+
table: import_core.defaultBlockSpecs.table,
|
|
218
|
+
divider: import_core.defaultBlockSpecs.divider
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
59
224
|
// src/suite/index.ts
|
|
60
225
|
var suite_exports = {};
|
|
61
226
|
__export(suite_exports, {
|
|
@@ -122,7 +287,7 @@ __export(suite_exports, {
|
|
|
122
287
|
appSwitcherTriggerClass: () => appSwitcherTriggerClass,
|
|
123
288
|
cn: () => cn,
|
|
124
289
|
getTodayGreeting: () => getTodayGreeting,
|
|
125
|
-
m: () =>
|
|
290
|
+
m: () => import_react12.m,
|
|
126
291
|
openSuiteAskAi: () => openSuiteAskAi,
|
|
127
292
|
resolveSuiteNotificationHref: () => resolveSuiteNotificationHref,
|
|
128
293
|
sourceToSuiteApp: () => sourceToSuiteApp,
|
|
@@ -2217,98 +2382,16 @@ function TodayCalibrating({
|
|
|
2217
2382
|
);
|
|
2218
2383
|
}
|
|
2219
2384
|
|
|
2220
|
-
// src/suite/
|
|
2221
|
-
|
|
2222
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2223
|
-
var SuiteThemeContext = (0, import_react7.createContext)(null);
|
|
2224
|
-
function systemTheme(fallback) {
|
|
2225
|
-
if (typeof window === "undefined") return fallback;
|
|
2226
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2227
|
-
}
|
|
2228
|
-
function resolveTheme(theme, fallback) {
|
|
2229
|
-
return theme === "system" ? systemTheme(fallback) : theme;
|
|
2230
|
-
}
|
|
2231
|
-
function applyTheme(theme, config) {
|
|
2232
|
-
const resolved = resolveTheme(theme, config.fallbackTheme);
|
|
2233
|
-
if (typeof document === "undefined") return resolved;
|
|
2234
|
-
document.documentElement.setAttribute(
|
|
2235
|
-
"data-theme",
|
|
2236
|
-
resolved === "dark" ? config.darkThemeId : config.lightThemeId
|
|
2237
|
-
);
|
|
2238
|
-
document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
2239
|
-
if (config.themeColorLight && config.themeColorDark) {
|
|
2240
|
-
const meta = document.getElementById(
|
|
2241
|
-
"theme-color-meta"
|
|
2242
|
-
);
|
|
2243
|
-
if (meta) {
|
|
2244
|
-
meta.content = resolved === "light" ? config.themeColorLight : config.themeColorDark;
|
|
2245
|
-
}
|
|
2246
|
-
}
|
|
2247
|
-
return resolved;
|
|
2248
|
-
}
|
|
2249
|
-
function readStoredTheme(storageKey) {
|
|
2250
|
-
if (typeof window === "undefined") return "system";
|
|
2251
|
-
const stored = localStorage.getItem(storageKey);
|
|
2252
|
-
if (stored === "light" || stored === "dark" || stored === "system")
|
|
2253
|
-
return stored;
|
|
2254
|
-
return "system";
|
|
2255
|
-
}
|
|
2256
|
-
function SuiteThemeProvider({
|
|
2257
|
-
config,
|
|
2258
|
-
children
|
|
2259
|
-
}) {
|
|
2260
|
-
const [state, setState] = (0, import_react7.useState)(() => {
|
|
2261
|
-
const theme2 = readStoredTheme(config.storageKey);
|
|
2262
|
-
if (typeof document === "undefined") {
|
|
2263
|
-
return { theme: theme2, resolvedTheme: config.fallbackTheme };
|
|
2264
|
-
}
|
|
2265
|
-
const domTheme = document.documentElement.getAttribute("data-theme");
|
|
2266
|
-
const resolvedTheme2 = domTheme === config.darkThemeId ? "dark" : domTheme === config.lightThemeId ? "light" : resolveTheme(theme2, config.fallbackTheme);
|
|
2267
|
-
return { theme: theme2, resolvedTheme: resolvedTheme2 };
|
|
2268
|
-
});
|
|
2269
|
-
const { theme, resolvedTheme } = state;
|
|
2270
|
-
(0, import_react7.useEffect)(() => {
|
|
2271
|
-
if (theme !== "system") return;
|
|
2272
|
-
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2273
|
-
const update = () => {
|
|
2274
|
-
const resolved = applyTheme("system", config);
|
|
2275
|
-
setState((current) => __spreadProps(__spreadValues({}, current), { resolvedTheme: resolved }));
|
|
2276
|
-
};
|
|
2277
|
-
media.addEventListener("change", update);
|
|
2278
|
-
return () => media.removeEventListener("change", update);
|
|
2279
|
-
}, [theme, config]);
|
|
2280
|
-
const setTheme = (0, import_react7.useCallback)(
|
|
2281
|
-
(next) => {
|
|
2282
|
-
const resolved = applyTheme(next, config);
|
|
2283
|
-
setState({ theme: next, resolvedTheme: resolved });
|
|
2284
|
-
localStorage.setItem(config.storageKey, next);
|
|
2285
|
-
},
|
|
2286
|
-
[config]
|
|
2287
|
-
);
|
|
2288
|
-
const toggleTheme = (0, import_react7.useCallback)(() => {
|
|
2289
|
-
setState((prev) => {
|
|
2290
|
-
const next = resolveTheme(prev.theme, config.fallbackTheme) === "dark" ? "light" : "dark";
|
|
2291
|
-
const resolved = applyTheme(next, config);
|
|
2292
|
-
localStorage.setItem(config.storageKey, next);
|
|
2293
|
-
return { theme: next, resolvedTheme: resolved };
|
|
2294
|
-
});
|
|
2295
|
-
}, [config]);
|
|
2296
|
-
const value = (0, import_react7.useMemo)(
|
|
2297
|
-
() => ({ theme, resolvedTheme, setTheme, toggleTheme }),
|
|
2298
|
-
[theme, resolvedTheme, setTheme, toggleTheme]
|
|
2299
|
-
);
|
|
2300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SuiteThemeContext.Provider, { value, children });
|
|
2301
|
-
}
|
|
2302
|
-
function useSuiteTheme() {
|
|
2303
|
-
const ctx = (0, import_react7.useContext)(SuiteThemeContext);
|
|
2304
|
-
if (!ctx) throw new Error("useTheme must be used within ThemeProvider");
|
|
2305
|
-
return ctx;
|
|
2306
|
-
}
|
|
2385
|
+
// src/suite/index.ts
|
|
2386
|
+
init_theme_provider();
|
|
2307
2387
|
|
|
2308
2388
|
// src/suite/components/ai-panel.tsx
|
|
2309
|
-
var
|
|
2389
|
+
var import_react10 = require("react");
|
|
2310
2390
|
var import_iconoir_react8 = require("iconoir-react");
|
|
2311
|
-
var
|
|
2391
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2392
|
+
var SuiteAiBlockNoteMessage2 = (0, import_react10.lazy)(
|
|
2393
|
+
() => Promise.resolve().then(() => (init_ai_message_blocknote(), ai_message_blocknote_exports))
|
|
2394
|
+
);
|
|
2312
2395
|
var SUITE_OPEN_ASK_AI_EVENT = "shellstack:open-ask-ai";
|
|
2313
2396
|
function openSuiteAskAi(detail) {
|
|
2314
2397
|
if (typeof window === "undefined") return;
|
|
@@ -2318,6 +2401,22 @@ function openSuiteAskAi(detail) {
|
|
|
2318
2401
|
})
|
|
2319
2402
|
);
|
|
2320
2403
|
}
|
|
2404
|
+
var LAUNCHER_EDGE_GAP = 12;
|
|
2405
|
+
var LAUNCHER_STORAGE_KEY = "suite-ask-ai-launcher-position";
|
|
2406
|
+
function resolveSuiteAiLauncherPosition(side, desiredY, viewportWidth, viewportHeight, launcherWidth, launcherHeight) {
|
|
2407
|
+
const maxX = Math.max(
|
|
2408
|
+
LAUNCHER_EDGE_GAP,
|
|
2409
|
+
viewportWidth - launcherWidth - LAUNCHER_EDGE_GAP
|
|
2410
|
+
);
|
|
2411
|
+
const maxY = Math.max(
|
|
2412
|
+
LAUNCHER_EDGE_GAP,
|
|
2413
|
+
viewportHeight - launcherHeight - LAUNCHER_EDGE_GAP
|
|
2414
|
+
);
|
|
2415
|
+
return {
|
|
2416
|
+
x: side === "left" ? LAUNCHER_EDGE_GAP : maxX,
|
|
2417
|
+
y: Math.min(Math.max(desiredY, LAUNCHER_EDGE_GAP), maxY)
|
|
2418
|
+
};
|
|
2419
|
+
}
|
|
2321
2420
|
function SuiteAiPanel({
|
|
2322
2421
|
presets = [],
|
|
2323
2422
|
emptyState = "Ask anything about your workspace, or look something up online.",
|
|
@@ -2329,21 +2428,64 @@ function SuiteAiPanel({
|
|
|
2329
2428
|
spinner: Spinner,
|
|
2330
2429
|
hideLauncher = false
|
|
2331
2430
|
}) {
|
|
2332
|
-
const [open, setOpen] = (0,
|
|
2333
|
-
const [prompt, setPrompt] = (0,
|
|
2334
|
-
const [messages, setMessages] = (0,
|
|
2335
|
-
const [loading, setLoading] = (0,
|
|
2336
|
-
const [hydrating, setHydrating] = (0,
|
|
2337
|
-
const [error, setError] = (0,
|
|
2338
|
-
const [copiedId, setCopiedId] = (0,
|
|
2339
|
-
const
|
|
2340
|
-
const
|
|
2341
|
-
const
|
|
2431
|
+
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
2432
|
+
const [prompt, setPrompt] = (0, import_react10.useState)("");
|
|
2433
|
+
const [messages, setMessages] = (0, import_react10.useState)([]);
|
|
2434
|
+
const [loading, setLoading] = (0, import_react10.useState)(false);
|
|
2435
|
+
const [hydrating, setHydrating] = (0, import_react10.useState)(false);
|
|
2436
|
+
const [error, setError] = (0, import_react10.useState)("");
|
|
2437
|
+
const [copiedId, setCopiedId] = (0, import_react10.useState)(null);
|
|
2438
|
+
const [launcherSide, setLauncherSide] = (0, import_react10.useState)("right");
|
|
2439
|
+
const [launcherPosition, setLauncherPosition] = (0, import_react10.useState)(null);
|
|
2440
|
+
const [draggingLauncher, setDraggingLauncher] = (0, import_react10.useState)(false);
|
|
2441
|
+
const scrollerRef = (0, import_react10.useRef)(null);
|
|
2442
|
+
const launcherRef = (0, import_react10.useRef)(null);
|
|
2443
|
+
const launcherSideRef = (0, import_react10.useRef)("right");
|
|
2444
|
+
const launcherPositionRef = (0, import_react10.useRef)(null);
|
|
2445
|
+
const launcherDragRef = (0, import_react10.useRef)(null);
|
|
2446
|
+
const suppressLauncherClickRef = (0, import_react10.useRef)(false);
|
|
2447
|
+
const pendingPromptRef = (0, import_react10.useRef)(null);
|
|
2448
|
+
(0, import_react10.useEffect)(() => {
|
|
2449
|
+
const launcher = launcherRef.current;
|
|
2450
|
+
if (!launcher) return;
|
|
2451
|
+
let side = "right";
|
|
2452
|
+
let desiredY = window.innerHeight - launcher.offsetHeight - 20;
|
|
2453
|
+
try {
|
|
2454
|
+
const stored = JSON.parse(
|
|
2455
|
+
localStorage.getItem(LAUNCHER_STORAGE_KEY) || "null"
|
|
2456
|
+
);
|
|
2457
|
+
if ((stored == null ? void 0 : stored.side) === "left" || (stored == null ? void 0 : stored.side) === "right")
|
|
2458
|
+
side = stored.side;
|
|
2459
|
+
if (typeof (stored == null ? void 0 : stored.y) === "number") desiredY = stored.y;
|
|
2460
|
+
} catch (e) {
|
|
2461
|
+
}
|
|
2462
|
+
launcherSideRef.current = side;
|
|
2463
|
+
setLauncherSide(side);
|
|
2464
|
+
const placeLauncher = () => {
|
|
2465
|
+
var _a, _b;
|
|
2466
|
+
const element = launcherRef.current;
|
|
2467
|
+
if (!element) return;
|
|
2468
|
+
const next = resolveSuiteAiLauncherPosition(
|
|
2469
|
+
launcherSideRef.current,
|
|
2470
|
+
(_b = (_a = launcherPositionRef.current) == null ? void 0 : _a.y) != null ? _b : desiredY,
|
|
2471
|
+
window.innerWidth,
|
|
2472
|
+
window.innerHeight,
|
|
2473
|
+
element.offsetWidth,
|
|
2474
|
+
element.offsetHeight
|
|
2475
|
+
);
|
|
2476
|
+
launcherPositionRef.current = next;
|
|
2477
|
+
setLauncherPosition(next);
|
|
2478
|
+
};
|
|
2479
|
+
placeLauncher();
|
|
2480
|
+
window.addEventListener("resize", placeLauncher);
|
|
2481
|
+
return () => window.removeEventListener("resize", placeLauncher);
|
|
2482
|
+
}, []);
|
|
2483
|
+
const scrollToBottom = (0, import_react10.useCallback)(() => {
|
|
2342
2484
|
const el = scrollerRef.current;
|
|
2343
2485
|
if (!el) return;
|
|
2344
2486
|
el.scrollTop = el.scrollHeight;
|
|
2345
2487
|
}, []);
|
|
2346
|
-
const hydrate = (0,
|
|
2488
|
+
const hydrate = (0, import_react10.useCallback)(async () => {
|
|
2347
2489
|
var _a;
|
|
2348
2490
|
setHydrating(true);
|
|
2349
2491
|
setError("");
|
|
@@ -2361,7 +2503,7 @@ function SuiteAiPanel({
|
|
|
2361
2503
|
setHydrating(false);
|
|
2362
2504
|
}
|
|
2363
2505
|
}, [fetchChat]);
|
|
2364
|
-
(0,
|
|
2506
|
+
(0, import_react10.useEffect)(() => {
|
|
2365
2507
|
function onOpen(event) {
|
|
2366
2508
|
var _a;
|
|
2367
2509
|
const detail = event.detail;
|
|
@@ -2374,7 +2516,7 @@ function SuiteAiPanel({
|
|
|
2374
2516
|
window.addEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
|
|
2375
2517
|
return () => window.removeEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
|
|
2376
2518
|
}, []);
|
|
2377
|
-
(0,
|
|
2519
|
+
(0, import_react10.useEffect)(() => {
|
|
2378
2520
|
if (!open) return;
|
|
2379
2521
|
void hydrate().then(() => {
|
|
2380
2522
|
const pending = pendingPromptRef.current;
|
|
@@ -2384,7 +2526,7 @@ function SuiteAiPanel({
|
|
|
2384
2526
|
}
|
|
2385
2527
|
});
|
|
2386
2528
|
}, [open, hydrate]);
|
|
2387
|
-
(0,
|
|
2529
|
+
(0, import_react10.useEffect)(() => {
|
|
2388
2530
|
if (open) scrollToBottom();
|
|
2389
2531
|
}, [messages, loading, open, scrollToBottom]);
|
|
2390
2532
|
async function ask(text) {
|
|
@@ -2433,24 +2575,137 @@ function SuiteAiPanel({
|
|
|
2433
2575
|
} catch (e) {
|
|
2434
2576
|
}
|
|
2435
2577
|
}
|
|
2578
|
+
function saveLauncherPosition(side, position) {
|
|
2579
|
+
try {
|
|
2580
|
+
localStorage.setItem(
|
|
2581
|
+
LAUNCHER_STORAGE_KEY,
|
|
2582
|
+
JSON.stringify({ side, y: position.y })
|
|
2583
|
+
);
|
|
2584
|
+
} catch (e) {
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
function dockLauncher(side, desiredY) {
|
|
2588
|
+
const launcher = launcherRef.current;
|
|
2589
|
+
if (!launcher) return;
|
|
2590
|
+
const next = resolveSuiteAiLauncherPosition(
|
|
2591
|
+
side,
|
|
2592
|
+
desiredY,
|
|
2593
|
+
window.innerWidth,
|
|
2594
|
+
window.innerHeight,
|
|
2595
|
+
launcher.offsetWidth,
|
|
2596
|
+
launcher.offsetHeight
|
|
2597
|
+
);
|
|
2598
|
+
launcherSideRef.current = side;
|
|
2599
|
+
launcherPositionRef.current = next;
|
|
2600
|
+
setLauncherSide(side);
|
|
2601
|
+
setLauncherPosition(next);
|
|
2602
|
+
saveLauncherPosition(side, next);
|
|
2603
|
+
}
|
|
2604
|
+
function startLauncherDrag(event) {
|
|
2605
|
+
if (event.pointerType === "mouse" && event.button !== 0) return;
|
|
2606
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
2607
|
+
launcherDragRef.current = {
|
|
2608
|
+
pointerId: event.pointerId,
|
|
2609
|
+
offsetX: event.clientX - rect.left,
|
|
2610
|
+
offsetY: event.clientY - rect.top,
|
|
2611
|
+
startX: event.clientX,
|
|
2612
|
+
startY: event.clientY
|
|
2613
|
+
};
|
|
2614
|
+
suppressLauncherClickRef.current = false;
|
|
2615
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
2616
|
+
setDraggingLauncher(true);
|
|
2617
|
+
}
|
|
2618
|
+
function moveLauncher(event) {
|
|
2619
|
+
const drag = launcherDragRef.current;
|
|
2620
|
+
if (!drag || drag.pointerId !== event.pointerId) return;
|
|
2621
|
+
const launcher = event.currentTarget;
|
|
2622
|
+
const maxX = Math.max(
|
|
2623
|
+
LAUNCHER_EDGE_GAP,
|
|
2624
|
+
window.innerWidth - launcher.offsetWidth - LAUNCHER_EDGE_GAP
|
|
2625
|
+
);
|
|
2626
|
+
const maxY = Math.max(
|
|
2627
|
+
LAUNCHER_EDGE_GAP,
|
|
2628
|
+
window.innerHeight - launcher.offsetHeight - LAUNCHER_EDGE_GAP
|
|
2629
|
+
);
|
|
2630
|
+
const next = {
|
|
2631
|
+
x: Math.min(
|
|
2632
|
+
Math.max(event.clientX - drag.offsetX, LAUNCHER_EDGE_GAP),
|
|
2633
|
+
maxX
|
|
2634
|
+
),
|
|
2635
|
+
y: Math.min(
|
|
2636
|
+
Math.max(event.clientY - drag.offsetY, LAUNCHER_EDGE_GAP),
|
|
2637
|
+
maxY
|
|
2638
|
+
)
|
|
2639
|
+
};
|
|
2640
|
+
if (Math.hypot(event.clientX - drag.startX, event.clientY - drag.startY) > 4) {
|
|
2641
|
+
suppressLauncherClickRef.current = true;
|
|
2642
|
+
}
|
|
2643
|
+
launcherPositionRef.current = next;
|
|
2644
|
+
setLauncherPosition(next);
|
|
2645
|
+
}
|
|
2646
|
+
function finishLauncherDrag(event) {
|
|
2647
|
+
var _a, _b, _c, _d;
|
|
2648
|
+
const drag = launcherDragRef.current;
|
|
2649
|
+
if (!drag || drag.pointerId !== event.pointerId) return;
|
|
2650
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
2651
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
2652
|
+
}
|
|
2653
|
+
launcherDragRef.current = null;
|
|
2654
|
+
setDraggingLauncher(false);
|
|
2655
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
2656
|
+
const currentX = (_b = (_a = launcherPositionRef.current) == null ? void 0 : _a.x) != null ? _b : rect.left;
|
|
2657
|
+
const side = currentX + rect.width / 2 < window.innerWidth / 2 ? "left" : "right";
|
|
2658
|
+
dockLauncher(side, (_d = (_c = launcherPositionRef.current) == null ? void 0 : _c.y) != null ? _d : rect.top);
|
|
2659
|
+
}
|
|
2660
|
+
function moveLauncherWithKeyboard(event) {
|
|
2661
|
+
var _a, _b;
|
|
2662
|
+
if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(event.key))
|
|
2663
|
+
return;
|
|
2664
|
+
event.preventDefault();
|
|
2665
|
+
const currentY = (_b = (_a = launcherPositionRef.current) == null ? void 0 : _a.y) != null ? _b : event.currentTarget.getBoundingClientRect().top;
|
|
2666
|
+
if (event.key === "ArrowLeft") dockLauncher("left", currentY);
|
|
2667
|
+
else if (event.key === "ArrowRight") dockLauncher("right", currentY);
|
|
2668
|
+
else
|
|
2669
|
+
dockLauncher(
|
|
2670
|
+
launcherSideRef.current,
|
|
2671
|
+
currentY + (event.key === "ArrowUp" ? -24 : 24)
|
|
2672
|
+
);
|
|
2673
|
+
}
|
|
2436
2674
|
const Icon = BrandIcon != null ? BrandIcon : import_iconoir_react8.Sparks;
|
|
2437
|
-
return /* @__PURE__ */ (0,
|
|
2438
|
-
!hideLauncher ? /* @__PURE__ */ (0,
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2676
|
+
!hideLauncher ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2677
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2678
|
+
"button",
|
|
2679
|
+
{
|
|
2680
|
+
ref: launcherRef,
|
|
2681
|
+
type: "button",
|
|
2682
|
+
"data-test": "ai-panel-launcher",
|
|
2683
|
+
onClick: () => {
|
|
2684
|
+
if (suppressLauncherClickRef.current) {
|
|
2685
|
+
suppressLauncherClickRef.current = false;
|
|
2686
|
+
return;
|
|
2687
|
+
}
|
|
2688
|
+
setOpen(true);
|
|
2689
|
+
},
|
|
2690
|
+
onPointerDown: startLauncherDrag,
|
|
2691
|
+
onPointerMove: moveLauncher,
|
|
2692
|
+
onPointerUp: finishLauncherDrag,
|
|
2693
|
+
onPointerCancel: finishLauncherDrag,
|
|
2694
|
+
onKeyDown: moveLauncherWithKeyboard,
|
|
2695
|
+
className: `fixed z-30 flex touch-none select-none items-center gap-2 rounded-full border border-ph-border bg-ph-surface px-4 py-2.5 text-sm font-medium text-ph-ink shadow-ph hover:bg-ph-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-brand ${draggingLauncher ? "cursor-grabbing" : "cursor-grab"}`,
|
|
2696
|
+
style: launcherPosition ? { left: launcherPosition.x, top: launcherPosition.y } : { bottom: 20, right: 20 },
|
|
2697
|
+
"aria-label": "Open Ask AI",
|
|
2698
|
+
"aria-describedby": "suite-ask-ai-launcher-help",
|
|
2699
|
+
children: [
|
|
2700
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { className: "h-4 w-4 text-ph-brand" }),
|
|
2701
|
+
"Ask AI"
|
|
2702
|
+
]
|
|
2703
|
+
}
|
|
2704
|
+
),
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { id: "suite-ask-ai-launcher-help", className: "sr-only", children: "Drag to reposition, or use arrow keys. The launcher docks to the nearest screen edge." })
|
|
2706
|
+
] }) : null,
|
|
2707
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "fixed inset-0 z-40", role: "dialog", "aria-modal": "true", children: [
|
|
2708
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2454
2709
|
"button",
|
|
2455
2710
|
{
|
|
2456
2711
|
type: "button",
|
|
@@ -2459,22 +2714,22 @@ function SuiteAiPanel({
|
|
|
2459
2714
|
"aria-label": "Close Ask AI"
|
|
2460
2715
|
}
|
|
2461
2716
|
),
|
|
2462
|
-
/* @__PURE__ */ (0,
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2463
2718
|
"aside",
|
|
2464
2719
|
{
|
|
2465
|
-
className:
|
|
2720
|
+
className: `absolute inset-y-0 flex w-full max-w-md flex-col bg-ph-surface shadow-2xl ${launcherSide === "left" ? "left-0 border-r border-ph-border" : "right-0 border-l border-ph-border"}`,
|
|
2466
2721
|
"data-test": "suite-ask-ai-panel",
|
|
2467
2722
|
children: [
|
|
2468
|
-
/* @__PURE__ */ (0,
|
|
2469
|
-
/* @__PURE__ */ (0,
|
|
2470
|
-
/* @__PURE__ */ (0,
|
|
2471
|
-
/* @__PURE__ */ (0,
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between border-b border-ph-border px-4 py-3", children: [
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "min-w-0", children: [
|
|
2725
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { className: "h-4 w-4 shrink-0 text-ph-brand" }),
|
|
2727
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-sm font-semibold text-ph-ink", children: title })
|
|
2473
2728
|
] }),
|
|
2474
|
-
/* @__PURE__ */ (0,
|
|
2729
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "mt-0.5 text-[11px] text-ph-mutedtext", children: "Shared across your suite \xB7 same chat in every app" })
|
|
2475
2730
|
] }),
|
|
2476
|
-
/* @__PURE__ */ (0,
|
|
2477
|
-
messages.length > 0 ? /* @__PURE__ */ (0,
|
|
2731
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2732
|
+
messages.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2478
2733
|
"button",
|
|
2479
2734
|
{
|
|
2480
2735
|
type: "button",
|
|
@@ -2485,19 +2740,19 @@ function SuiteAiPanel({
|
|
|
2485
2740
|
children: "Clear"
|
|
2486
2741
|
}
|
|
2487
2742
|
) : null,
|
|
2488
|
-
/* @__PURE__ */ (0,
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2489
2744
|
"button",
|
|
2490
2745
|
{
|
|
2491
2746
|
type: "button",
|
|
2492
2747
|
onClick: () => setOpen(false),
|
|
2493
2748
|
className: "rounded p-1 hover:bg-ph-muted",
|
|
2494
2749
|
"aria-label": "Close",
|
|
2495
|
-
children: /* @__PURE__ */ (0,
|
|
2750
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_iconoir_react8.Xmark, { className: "h-4 w-4" })
|
|
2496
2751
|
}
|
|
2497
2752
|
)
|
|
2498
2753
|
] })
|
|
2499
2754
|
] }),
|
|
2500
|
-
presets.length > 0 && messages.length === 0 ? /* @__PURE__ */ (0,
|
|
2755
|
+
presets.length > 0 && messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-wrap gap-1.5 border-b border-ph-border px-4 py-2", children: presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2501
2756
|
"button",
|
|
2502
2757
|
{
|
|
2503
2758
|
type: "button",
|
|
@@ -2508,38 +2763,44 @@ function SuiteAiPanel({
|
|
|
2508
2763
|
},
|
|
2509
2764
|
preset.label
|
|
2510
2765
|
)) }) : null,
|
|
2511
|
-
/* @__PURE__ */ (0,
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2512
2767
|
"div",
|
|
2513
2768
|
{
|
|
2514
2769
|
ref: scrollerRef,
|
|
2515
2770
|
className: "flex-1 space-y-3 overflow-y-auto p-4",
|
|
2516
2771
|
children: [
|
|
2517
|
-
error ? /* @__PURE__ */ (0,
|
|
2518
|
-
hydrating && messages.length === 0 ? /* @__PURE__ */ (0,
|
|
2519
|
-
/* @__PURE__ */ (0,
|
|
2772
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "bg-ph-danger/10 rounded-lg px-3 py-2 text-sm text-ph-danger", children: error }) : null,
|
|
2773
|
+
hydrating && messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2 text-sm text-ph-mutedtext", children: [
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Spinner, { className: "h-4 w-4 animate-spin" }),
|
|
2520
2775
|
"Loading chat\u2026"
|
|
2521
2776
|
] }) : null,
|
|
2522
|
-
!hydrating && messages.length === 0 && !error ? /* @__PURE__ */ (0,
|
|
2523
|
-
/* @__PURE__ */ (0,
|
|
2524
|
-
/* @__PURE__ */ (0,
|
|
2777
|
+
!hydrating && messages.length === 0 && !error ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mt-10 px-2 text-center", children: [
|
|
2778
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "font-display text-base font-semibold text-ph-ink", children: "How can I help?" }),
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "mt-2 text-sm leading-relaxed text-ph-subtle", children: emptyState })
|
|
2525
2780
|
] }) : null,
|
|
2526
2781
|
messages.map((message, index) => {
|
|
2527
2782
|
const isUser = message.role === "user";
|
|
2528
|
-
return /* @__PURE__ */ (0,
|
|
2783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2529
2784
|
"div",
|
|
2530
2785
|
{
|
|
2531
2786
|
className: isUser ? "ml-8 rounded-2xl bg-ph-brand/10 px-3.5 py-2.5 text-sm text-ph-ink" : "mr-4 rounded-2xl bg-ph-muted px-3.5 py-2.5 text-sm text-ph-ink",
|
|
2532
2787
|
"data-test": isUser ? "ask-ai-user" : "ask-ai-assistant",
|
|
2533
2788
|
children: [
|
|
2534
|
-
/* @__PURE__ */ (0,
|
|
2535
|
-
|
|
2789
|
+
isUser ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "whitespace-pre-wrap", children: message.content }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2790
|
+
import_react10.Suspense,
|
|
2791
|
+
{
|
|
2792
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "whitespace-pre-wrap", children: message.content }),
|
|
2793
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SuiteAiBlockNoteMessage2, { markdown: message.content })
|
|
2794
|
+
}
|
|
2795
|
+
),
|
|
2796
|
+
!isUser ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2536
2797
|
"button",
|
|
2537
2798
|
{
|
|
2538
2799
|
type: "button",
|
|
2539
2800
|
onClick: () => void copyMessage(index, message.content),
|
|
2540
2801
|
className: "mt-2 inline-flex items-center gap-1 text-xs text-ph-mutedtext hover:text-ph-ink",
|
|
2541
2802
|
children: [
|
|
2542
|
-
copiedId === index ? /* @__PURE__ */ (0,
|
|
2803
|
+
copiedId === index ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_iconoir_react8.Check, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_iconoir_react8.Copy, { className: "h-3 w-3" }),
|
|
2543
2804
|
copiedId === index ? "Copied" : "Copy"
|
|
2544
2805
|
]
|
|
2545
2806
|
}
|
|
@@ -2549,15 +2810,15 @@ function SuiteAiPanel({
|
|
|
2549
2810
|
`${message.role}-${index}-${message.content.slice(0, 24)}`
|
|
2550
2811
|
);
|
|
2551
2812
|
}),
|
|
2552
|
-
loading ? /* @__PURE__ */ (0,
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2813
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2 text-sm text-ph-mutedtext", children: [
|
|
2814
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Spinner, { className: "h-4 w-4 animate-spin" }),
|
|
2554
2815
|
"Thinking\u2026"
|
|
2555
2816
|
] }) : null
|
|
2556
2817
|
]
|
|
2557
2818
|
}
|
|
2558
2819
|
),
|
|
2559
|
-
/* @__PURE__ */ (0,
|
|
2560
|
-
/* @__PURE__ */ (0,
|
|
2820
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "border-t border-ph-border p-3", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex gap-2", children: [
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2561
2822
|
"textarea",
|
|
2562
2823
|
{
|
|
2563
2824
|
value: prompt,
|
|
@@ -2575,7 +2836,7 @@ function SuiteAiPanel({
|
|
|
2575
2836
|
className: "flex-1 resize-none rounded-xl border border-ph-border bg-ph-canvas p-2.5 text-sm text-ph-ink outline-none focus:ring-1 focus:ring-ph-brand"
|
|
2576
2837
|
}
|
|
2577
2838
|
),
|
|
2578
|
-
/* @__PURE__ */ (0,
|
|
2839
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2579
2840
|
"button",
|
|
2580
2841
|
{
|
|
2581
2842
|
type: "button",
|
|
@@ -2595,7 +2856,7 @@ function SuiteAiPanel({
|
|
|
2595
2856
|
}
|
|
2596
2857
|
|
|
2597
2858
|
// src/suite/lib/use-sidebar-width.ts
|
|
2598
|
-
var
|
|
2859
|
+
var import_react11 = require("react");
|
|
2599
2860
|
var SIDEBAR_RAIL_WIDTH = 56;
|
|
2600
2861
|
var SIDEBAR_COLLAPSE_THRESHOLD = 80;
|
|
2601
2862
|
var SIDEBAR_MIN_EXPANDED_WIDTH = 180;
|
|
@@ -2610,10 +2871,10 @@ function snapWidth(width) {
|
|
|
2610
2871
|
return Math.min(SIDEBAR_MAX_WIDTH, width);
|
|
2611
2872
|
}
|
|
2612
2873
|
function useSidebarWidth(storageKey) {
|
|
2613
|
-
const [width, setWidth] = (0,
|
|
2614
|
-
const [narrowViewport, setNarrowViewport] = (0,
|
|
2874
|
+
const [width, setWidth] = (0, import_react11.useState)(SIDEBAR_DEFAULT_WIDTH);
|
|
2875
|
+
const [narrowViewport, setNarrowViewport] = (0, import_react11.useState)(false);
|
|
2615
2876
|
const collapsed = narrowViewport || width <= SIDEBAR_COLLAPSE_THRESHOLD;
|
|
2616
|
-
(0,
|
|
2877
|
+
(0, import_react11.useEffect)(() => {
|
|
2617
2878
|
let stored = null;
|
|
2618
2879
|
try {
|
|
2619
2880
|
stored = localStorage.getItem(storageKey);
|
|
@@ -2625,14 +2886,14 @@ function useSidebarWidth(storageKey) {
|
|
|
2625
2886
|
queueMicrotask(() => setWidth(snapWidth(clampWidth(parsed))));
|
|
2626
2887
|
}
|
|
2627
2888
|
}, [storageKey]);
|
|
2628
|
-
(0,
|
|
2889
|
+
(0, import_react11.useEffect)(() => {
|
|
2629
2890
|
const media = window.matchMedia("(max-width: 639px)");
|
|
2630
2891
|
const sync = () => setNarrowViewport(media.matches);
|
|
2631
2892
|
sync();
|
|
2632
2893
|
media.addEventListener("change", sync);
|
|
2633
2894
|
return () => media.removeEventListener("change", sync);
|
|
2634
2895
|
}, []);
|
|
2635
|
-
const persist = (0,
|
|
2896
|
+
const persist = (0, import_react11.useCallback)(
|
|
2636
2897
|
(value) => {
|
|
2637
2898
|
try {
|
|
2638
2899
|
localStorage.setItem(storageKey, String(value));
|
|
@@ -2641,7 +2902,7 @@ function useSidebarWidth(storageKey) {
|
|
|
2641
2902
|
},
|
|
2642
2903
|
[storageKey]
|
|
2643
2904
|
);
|
|
2644
|
-
const setCollapsed = (0,
|
|
2905
|
+
const setCollapsed = (0, import_react11.useCallback)(
|
|
2645
2906
|
(value) => {
|
|
2646
2907
|
setWidth((current) => {
|
|
2647
2908
|
const next = value ? SIDEBAR_RAIL_WIDTH : current <= SIDEBAR_COLLAPSE_THRESHOLD ? SIDEBAR_DEFAULT_WIDTH : snapWidth(current);
|
|
@@ -2651,11 +2912,11 @@ function useSidebarWidth(storageKey) {
|
|
|
2651
2912
|
},
|
|
2652
2913
|
[persist]
|
|
2653
2914
|
);
|
|
2654
|
-
const resetWidth = (0,
|
|
2915
|
+
const resetWidth = (0, import_react11.useCallback)(() => {
|
|
2655
2916
|
setWidth(SIDEBAR_DEFAULT_WIDTH);
|
|
2656
2917
|
persist(SIDEBAR_DEFAULT_WIDTH);
|
|
2657
2918
|
}, [persist]);
|
|
2658
|
-
const startResize = (0,
|
|
2919
|
+
const startResize = (0, import_react11.useCallback)(
|
|
2659
2920
|
(event) => {
|
|
2660
2921
|
event.preventDefault();
|
|
2661
2922
|
const startX = event.clientX;
|
|
@@ -2681,10 +2942,10 @@ function useSidebarWidth(storageKey) {
|
|
|
2681
2942
|
}
|
|
2682
2943
|
|
|
2683
2944
|
// src/suite/lib/motion.tsx
|
|
2684
|
-
var
|
|
2685
|
-
var
|
|
2945
|
+
var import_react12 = require("motion/react");
|
|
2946
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2686
2947
|
function SuiteMotionProvider({ children }) {
|
|
2687
|
-
return /* @__PURE__ */ (0,
|
|
2948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react12.LazyMotion, { features: import_react12.domAnimation, strict: true, children });
|
|
2688
2949
|
}
|
|
2689
2950
|
var SUITE_SPRINGS = {
|
|
2690
2951
|
/** Snappy panel/sheet entrances — small overshoot. */
|
|
@@ -2696,24 +2957,24 @@ var SUITE_SPRINGS = {
|
|
|
2696
2957
|
};
|
|
2697
2958
|
|
|
2698
2959
|
// src/suite/components/suite-skeleton.tsx
|
|
2699
|
-
var
|
|
2960
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2700
2961
|
function SuiteSkeleton({
|
|
2701
2962
|
className,
|
|
2702
2963
|
lines = 1,
|
|
2703
2964
|
circle,
|
|
2704
2965
|
width
|
|
2705
2966
|
}) {
|
|
2706
|
-
return /* @__PURE__ */ (0,
|
|
2967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2707
2968
|
"div",
|
|
2708
2969
|
{
|
|
2709
2970
|
className: cn("space-y-2", circle ? "flex flex-col items-center" : ""),
|
|
2710
2971
|
"aria-hidden": true,
|
|
2711
|
-
children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */ (0,
|
|
2972
|
+
children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2712
2973
|
"div",
|
|
2713
2974
|
{
|
|
2714
2975
|
className: "animate-[skeleton-stagger_0.6s_ease-out_both]",
|
|
2715
2976
|
style: { animationDelay: `${index * 80}ms` },
|
|
2716
|
-
children: /* @__PURE__ */ (0,
|
|
2977
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2717
2978
|
"div",
|
|
2718
2979
|
{
|
|
2719
2980
|
className: cn(
|
|
@@ -2737,7 +2998,7 @@ function SuiteSkeletonCard({
|
|
|
2737
2998
|
rows = 3,
|
|
2738
2999
|
header = true
|
|
2739
3000
|
}) {
|
|
2740
|
-
return /* @__PURE__ */ (0,
|
|
3001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2741
3002
|
"div",
|
|
2742
3003
|
{
|
|
2743
3004
|
className: cn(
|
|
@@ -2746,26 +3007,26 @@ function SuiteSkeletonCard({
|
|
|
2746
3007
|
),
|
|
2747
3008
|
"aria-hidden": true,
|
|
2748
3009
|
children: [
|
|
2749
|
-
header ? /* @__PURE__ */ (0,
|
|
3010
|
+
header ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2750
3011
|
"div",
|
|
2751
3012
|
{
|
|
2752
3013
|
className: "mb-5 flex items-center gap-3 animate-[skeleton-stagger_0.5s_ease-out_both]",
|
|
2753
3014
|
style: { animationDelay: "100ms" },
|
|
2754
3015
|
children: [
|
|
2755
|
-
/* @__PURE__ */ (0,
|
|
2756
|
-
/* @__PURE__ */ (0,
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
2758
|
-
/* @__PURE__ */ (0,
|
|
3016
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ph-skeleton h-10 w-10 rounded-xl" }),
|
|
3017
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex-1 space-y-2", children: [
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ph-skeleton h-4 w-1/3" }),
|
|
3019
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ph-skeleton h-3 w-1/2" })
|
|
2759
3020
|
] })
|
|
2760
3021
|
]
|
|
2761
3022
|
}
|
|
2762
3023
|
) : null,
|
|
2763
|
-
/* @__PURE__ */ (0,
|
|
3024
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "space-y-3", children: Array.from({ length: rows }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2764
3025
|
"div",
|
|
2765
3026
|
{
|
|
2766
3027
|
className: "animate-[skeleton-stagger_0.5s_ease-out_both]",
|
|
2767
3028
|
style: { animationDelay: `${200 + index * 80}ms` },
|
|
2768
|
-
children: /* @__PURE__ */ (0,
|
|
3029
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2769
3030
|
"div",
|
|
2770
3031
|
{
|
|
2771
3032
|
className: "ph-skeleton h-3",
|
|
@@ -2783,16 +3044,16 @@ function SuiteSkeletonList({
|
|
|
2783
3044
|
className,
|
|
2784
3045
|
items = 4
|
|
2785
3046
|
}) {
|
|
2786
|
-
return /* @__PURE__ */ (0,
|
|
3047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("space-y-3", className), "aria-hidden": true, children: Array.from({ length: items }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2787
3048
|
"div",
|
|
2788
3049
|
{
|
|
2789
3050
|
className: "animate-[skeleton-stagger_0.6s_ease-out_both]",
|
|
2790
3051
|
style: { animationDelay: `${index * 100}ms` },
|
|
2791
|
-
children: /* @__PURE__ */ (0,
|
|
2792
|
-
/* @__PURE__ */ (0,
|
|
2793
|
-
/* @__PURE__ */ (0,
|
|
2794
|
-
/* @__PURE__ */ (0,
|
|
2795
|
-
/* @__PURE__ */ (0,
|
|
3052
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-3 rounded-xl border border-ph-border bg-ph-surface p-4", children: [
|
|
3053
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ph-skeleton h-10 w-10 rounded-lg" }),
|
|
3054
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "min-w-0 flex-1 space-y-2", children: [
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ph-skeleton h-3.5 w-3/4" }),
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "ph-skeleton h-3 w-1/2" })
|
|
2796
3057
|
] })
|
|
2797
3058
|
] })
|
|
2798
3059
|
},
|
|
@@ -2807,7 +3068,7 @@ function SuiteEmptyState({
|
|
|
2807
3068
|
className,
|
|
2808
3069
|
size = "md"
|
|
2809
3070
|
}) {
|
|
2810
|
-
return /* @__PURE__ */ (0,
|
|
3071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2811
3072
|
"div",
|
|
2812
3073
|
{
|
|
2813
3074
|
className: cn(
|
|
@@ -2816,13 +3077,13 @@ function SuiteEmptyState({
|
|
|
2816
3077
|
className
|
|
2817
3078
|
),
|
|
2818
3079
|
children: [
|
|
2819
|
-
/* @__PURE__ */ (0,
|
|
2820
|
-
/* @__PURE__ */ (0,
|
|
2821
|
-
/* @__PURE__ */ (0,
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "pointer-events-none absolute inset-0 overflow-hidden opacity-60", "aria-hidden": true, children: [
|
|
3081
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute -left-10 -top-10 h-40 w-40 rounded-full bg-ph-brand/10 blur-3xl" }),
|
|
3082
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute -bottom-10 -right-10 h-40 w-40 rounded-full bg-ph-accent/10 blur-3xl" })
|
|
2822
3083
|
] }),
|
|
2823
|
-
/* @__PURE__ */ (0,
|
|
2824
|
-
icon ? /* @__PURE__ */ (0,
|
|
2825
|
-
/* @__PURE__ */ (0,
|
|
3084
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
|
|
3085
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mx-auto mb-4 inline-flex items-center justify-center rounded-2xl bg-ph-muted p-3 shadow-sm ring-1 ring-black/[0.06]", children: icon }) : null,
|
|
3086
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2826
3087
|
"h3",
|
|
2827
3088
|
{
|
|
2828
3089
|
className: cn(
|
|
@@ -2832,8 +3093,8 @@ function SuiteEmptyState({
|
|
|
2832
3093
|
children: title
|
|
2833
3094
|
}
|
|
2834
3095
|
),
|
|
2835
|
-
description ? /* @__PURE__ */ (0,
|
|
2836
|
-
action ? /* @__PURE__ */ (0,
|
|
3096
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mx-auto mt-2 max-w-sm text-sm leading-relaxed text-ph-subtle", children: description }) : null,
|
|
3097
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mt-5 flex flex-wrap items-center justify-center gap-2", children: action }) : null
|
|
2837
3098
|
] })
|
|
2838
3099
|
]
|
|
2839
3100
|
}
|
|
@@ -2841,8 +3102,8 @@ function SuiteEmptyState({
|
|
|
2841
3102
|
}
|
|
2842
3103
|
|
|
2843
3104
|
// src/suite/components/suite-settings-mobile-nav.tsx
|
|
2844
|
-
var
|
|
2845
|
-
var
|
|
3105
|
+
var import_react13 = require("react");
|
|
3106
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2846
3107
|
function SuiteSettingsMobileNav({
|
|
2847
3108
|
items,
|
|
2848
3109
|
activeHref,
|
|
@@ -2851,16 +3112,16 @@ function SuiteSettingsMobileNav({
|
|
|
2851
3112
|
ariaLabel = "Settings sections",
|
|
2852
3113
|
className
|
|
2853
3114
|
}) {
|
|
2854
|
-
return /* @__PURE__ */ (0,
|
|
3115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2855
3116
|
"nav",
|
|
2856
3117
|
{
|
|
2857
3118
|
"data-test": dataTest,
|
|
2858
3119
|
"aria-label": ariaLabel,
|
|
2859
3120
|
className: cn("suite-settings-mobile-nav lg:hidden", className),
|
|
2860
|
-
children: /* @__PURE__ */ (0,
|
|
3121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex snap-x gap-2 overflow-x-auto pb-3 pt-1 scrollbar-hide [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: items.map((item) => {
|
|
2861
3122
|
const Icon = item.icon;
|
|
2862
3123
|
const active = activeHref === item.href || activeHref.startsWith(`${item.href}/`);
|
|
2863
|
-
const iconNode = (0,
|
|
3124
|
+
const iconNode = (0, import_react13.isValidElement)(item.icon) ? item.icon : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2864
3125
|
Icon,
|
|
2865
3126
|
{
|
|
2866
3127
|
className: cn(
|
|
@@ -2870,7 +3131,7 @@ function SuiteSettingsMobileNav({
|
|
|
2870
3131
|
"aria-hidden": true
|
|
2871
3132
|
}
|
|
2872
3133
|
);
|
|
2873
|
-
return /* @__PURE__ */ (0,
|
|
3134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2874
3135
|
"button",
|
|
2875
3136
|
{
|
|
2876
3137
|
type: "button",
|
|
@@ -2884,8 +3145,8 @@ function SuiteSettingsMobileNav({
|
|
|
2884
3145
|
),
|
|
2885
3146
|
children: [
|
|
2886
3147
|
iconNode,
|
|
2887
|
-
/* @__PURE__ */ (0,
|
|
2888
|
-
active ? /* @__PURE__ */ (0,
|
|
3148
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "whitespace-nowrap", children: item.label }),
|
|
3149
|
+
active ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "absolute inset-x-0 -bottom-3 h-0.5 rounded-full bg-ph-ink lg:hidden" }) : null
|
|
2889
3150
|
]
|
|
2890
3151
|
},
|
|
2891
3152
|
item.href
|
|
@@ -2899,10 +3160,10 @@ function SuiteSettingsMobileNav({
|
|
|
2899
3160
|
var import_link2 = __toESM(require("next/link"));
|
|
2900
3161
|
|
|
2901
3162
|
// src/components/ui/Tooltip.tsx
|
|
2902
|
-
var
|
|
3163
|
+
var import_react14 = require("react");
|
|
2903
3164
|
var import_react_dom = require("react-dom");
|
|
2904
|
-
var
|
|
2905
|
-
var TooltipDelayContext = (0,
|
|
3165
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3166
|
+
var TooltipDelayContext = (0, import_react14.createContext)(0);
|
|
2906
3167
|
function tooltipPosition(trigger, side, align, offset) {
|
|
2907
3168
|
const horizontal = align === "start" ? trigger.left : align === "end" ? trigger.right : trigger.left + trigger.width / 2;
|
|
2908
3169
|
const vertical = align === "start" ? trigger.top : align === "end" ? trigger.bottom : trigger.top + trigger.height / 2;
|
|
@@ -2942,12 +3203,12 @@ function Tooltip({
|
|
|
2942
3203
|
onOpenChange,
|
|
2943
3204
|
delayDuration
|
|
2944
3205
|
}) {
|
|
2945
|
-
const providerDelay = (0,
|
|
2946
|
-
const generatedId = (0,
|
|
2947
|
-
const triggerRef = (0,
|
|
2948
|
-
const timerRef = (0,
|
|
2949
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
2950
|
-
const [position, setPosition] = (0,
|
|
3206
|
+
const providerDelay = (0, import_react14.useContext)(TooltipDelayContext);
|
|
3207
|
+
const generatedId = (0, import_react14.useId)().replace(/:/g, "");
|
|
3208
|
+
const triggerRef = (0, import_react14.useRef)(null);
|
|
3209
|
+
const timerRef = (0, import_react14.useRef)(null);
|
|
3210
|
+
const [internalOpen, setInternalOpen] = (0, import_react14.useState)(defaultOpen);
|
|
3211
|
+
const [position, setPosition] = (0, import_react14.useState)(null);
|
|
2951
3212
|
const isOpen = open != null ? open : internalOpen;
|
|
2952
3213
|
const triggerId = children.props.id;
|
|
2953
3214
|
const tooltipId = triggerId ? `${triggerId}-tooltip` : `ph-tooltip-${generatedId}`;
|
|
@@ -2981,7 +3242,7 @@ function Tooltip({
|
|
|
2981
3242
|
clearTimer();
|
|
2982
3243
|
setOpen(false);
|
|
2983
3244
|
}
|
|
2984
|
-
(0,
|
|
3245
|
+
(0, import_react14.useEffect)(() => {
|
|
2985
3246
|
if (!isOpen) return;
|
|
2986
3247
|
const reposition = () => updatePosition();
|
|
2987
3248
|
window.addEventListener("resize", reposition);
|
|
@@ -2991,11 +3252,11 @@ function Tooltip({
|
|
|
2991
3252
|
window.removeEventListener("scroll", reposition, true);
|
|
2992
3253
|
};
|
|
2993
3254
|
});
|
|
2994
|
-
(0,
|
|
3255
|
+
(0, import_react14.useEffect)(() => () => clearTimer(), []);
|
|
2995
3256
|
const describedBy = [children.props["aria-describedby"], tooltipId].filter(Boolean).join(" ");
|
|
2996
|
-
const trigger = (0,
|
|
2997
|
-
return /* @__PURE__ */ (0,
|
|
2998
|
-
/* @__PURE__ */ (0,
|
|
3257
|
+
const trigger = (0, import_react14.cloneElement)(children, { "aria-describedby": describedBy });
|
|
3258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
3259
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2999
3260
|
"span",
|
|
3000
3261
|
{
|
|
3001
3262
|
ref: triggerRef,
|
|
@@ -3011,12 +3272,12 @@ function Tooltip({
|
|
|
3011
3272
|
}
|
|
3012
3273
|
),
|
|
3013
3274
|
isOpen && position && typeof document !== "undefined" ? (0, import_react_dom.createPortal)(
|
|
3014
|
-
/* @__PURE__ */ (0,
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3015
3276
|
"span",
|
|
3016
3277
|
{
|
|
3017
3278
|
style: __spreadValues({ position: "fixed" }, position),
|
|
3018
3279
|
className: "pointer-events-none z-[200]",
|
|
3019
|
-
children: /* @__PURE__ */ (0,
|
|
3280
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3020
3281
|
"span",
|
|
3021
3282
|
{
|
|
3022
3283
|
id: tooltipId,
|
|
@@ -3034,7 +3295,7 @@ function Tooltip({
|
|
|
3034
3295
|
}
|
|
3035
3296
|
|
|
3036
3297
|
// src/suite/components/suite-sidebar.tsx
|
|
3037
|
-
var
|
|
3298
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3038
3299
|
function renderNode(node, collapsed) {
|
|
3039
3300
|
if (typeof node === "function") return node(collapsed);
|
|
3040
3301
|
return node;
|
|
@@ -3051,7 +3312,7 @@ function SuiteSidebar({
|
|
|
3051
3312
|
className,
|
|
3052
3313
|
surface = false
|
|
3053
3314
|
}) {
|
|
3054
|
-
return /* @__PURE__ */ (0,
|
|
3315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3055
3316
|
"div",
|
|
3056
3317
|
{
|
|
3057
3318
|
className: cn(
|
|
@@ -3060,7 +3321,7 @@ function SuiteSidebar({
|
|
|
3060
3321
|
className
|
|
3061
3322
|
),
|
|
3062
3323
|
children: [
|
|
3063
|
-
/* @__PURE__ */ (0,
|
|
3324
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3064
3325
|
"div",
|
|
3065
3326
|
{
|
|
3066
3327
|
className: cn(
|
|
@@ -3069,12 +3330,12 @@ function SuiteSidebar({
|
|
|
3069
3330
|
collapsed ? "flex-col items-center gap-1 px-1 py-2" : "h-14 items-center justify-between gap-2 px-3"
|
|
3070
3331
|
),
|
|
3071
3332
|
children: [
|
|
3072
|
-
/* @__PURE__ */ (0,
|
|
3073
|
-
collapsed ? null : /* @__PURE__ */ (0,
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cn("min-w-0", collapsed ? "shrink-0" : "flex-1"), children: renderNode(appSwitcher, collapsed) }),
|
|
3334
|
+
collapsed ? null : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "shrink-0", children: renderNode(notificationBell, collapsed) })
|
|
3074
3335
|
]
|
|
3075
3336
|
}
|
|
3076
3337
|
),
|
|
3077
|
-
/* @__PURE__ */ (0,
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3078
3339
|
"div",
|
|
3079
3340
|
{
|
|
3080
3341
|
className: cn(
|
|
@@ -3083,17 +3344,17 @@ function SuiteSidebar({
|
|
|
3083
3344
|
collapsed ? "px-1.5 py-2" : "p-2"
|
|
3084
3345
|
),
|
|
3085
3346
|
children: [
|
|
3086
|
-
/* @__PURE__ */ (0,
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3087
3348
|
"nav",
|
|
3088
3349
|
{
|
|
3089
3350
|
"aria-label": "Pages",
|
|
3090
3351
|
className: "shrink-0 space-y-0.5",
|
|
3091
3352
|
children: [
|
|
3092
|
-
/* @__PURE__ */ (0,
|
|
3093
|
-
/* @__PURE__ */ (0,
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cn("mb-3", collapsed && "flex justify-center"), children: renderNode(contextSwitcher, collapsed) }),
|
|
3354
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "space-y-0.5", children: navItems.map((item) => {
|
|
3094
3355
|
const Icon = item.icon;
|
|
3095
3356
|
const active = Boolean(item.active);
|
|
3096
|
-
const link = /* @__PURE__ */ (0,
|
|
3357
|
+
const link = /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3097
3358
|
import_link2.default,
|
|
3098
3359
|
{
|
|
3099
3360
|
href: item.href,
|
|
@@ -3106,7 +3367,7 @@ function SuiteSidebar({
|
|
|
3106
3367
|
collapsed ? "mx-auto size-10 shrink-0 justify-center gap-0 px-0 py-0" : "w-full px-2.5 py-2"
|
|
3107
3368
|
),
|
|
3108
3369
|
children: [
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
3370
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3110
3371
|
"span",
|
|
3111
3372
|
{
|
|
3112
3373
|
className: cn(
|
|
@@ -3114,7 +3375,7 @@ function SuiteSidebar({
|
|
|
3114
3375
|
item.iconClassName
|
|
3115
3376
|
),
|
|
3116
3377
|
"aria-hidden": true,
|
|
3117
|
-
children: /* @__PURE__ */ (0,
|
|
3378
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3118
3379
|
Icon,
|
|
3119
3380
|
{
|
|
3120
3381
|
className: "h-full w-full",
|
|
@@ -3123,7 +3384,7 @@ function SuiteSidebar({
|
|
|
3123
3384
|
)
|
|
3124
3385
|
}
|
|
3125
3386
|
),
|
|
3126
|
-
/* @__PURE__ */ (0,
|
|
3387
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3127
3388
|
"span",
|
|
3128
3389
|
{
|
|
3129
3390
|
className: cn(
|
|
@@ -3134,17 +3395,17 @@ function SuiteSidebar({
|
|
|
3134
3395
|
children: item.label
|
|
3135
3396
|
}
|
|
3136
3397
|
),
|
|
3137
|
-
!collapsed && item.badge ? /* @__PURE__ */ (0,
|
|
3398
|
+
!collapsed && item.badge ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "relative ml-auto shrink-0", children: item.badge }) : null
|
|
3138
3399
|
]
|
|
3139
3400
|
},
|
|
3140
3401
|
item.label
|
|
3141
3402
|
);
|
|
3142
|
-
return collapsed ? /* @__PURE__ */ (0,
|
|
3403
|
+
return collapsed ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Tooltip, { content: item.label, side: "right", children: link }, item.label) : link;
|
|
3143
3404
|
}) })
|
|
3144
3405
|
]
|
|
3145
3406
|
}
|
|
3146
3407
|
),
|
|
3147
|
-
secondaryNav ? /* @__PURE__ */ (0,
|
|
3408
|
+
secondaryNav ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3148
3409
|
"div",
|
|
3149
3410
|
{
|
|
3150
3411
|
className: "min-h-0 flex-1",
|
|
@@ -3155,7 +3416,7 @@ function SuiteSidebar({
|
|
|
3155
3416
|
]
|
|
3156
3417
|
}
|
|
3157
3418
|
),
|
|
3158
|
-
/* @__PURE__ */ (0,
|
|
3419
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3159
3420
|
"div",
|
|
3160
3421
|
{
|
|
3161
3422
|
className: cn(
|
|
@@ -3163,7 +3424,7 @@ function SuiteSidebar({
|
|
|
3163
3424
|
surface ? "bg-ph-surface" : "bg-ph-canvas",
|
|
3164
3425
|
collapsed ? "p-1.5" : "p-3"
|
|
3165
3426
|
),
|
|
3166
|
-
children: /* @__PURE__ */ (0,
|
|
3427
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3167
3428
|
"div",
|
|
3168
3429
|
{
|
|
3169
3430
|
className: cn(
|
|
@@ -3172,7 +3433,7 @@ function SuiteSidebar({
|
|
|
3172
3433
|
),
|
|
3173
3434
|
children: [
|
|
3174
3435
|
renderNode(userMenu, collapsed),
|
|
3175
|
-
!collapsed && footerExtras ? /* @__PURE__ */ (0,
|
|
3436
|
+
!collapsed && footerExtras ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "ml-auto shrink-0", children: renderNode(footerExtras, collapsed) }) : null
|
|
3176
3437
|
]
|
|
3177
3438
|
}
|
|
3178
3439
|
)
|
|
@@ -3184,7 +3445,7 @@ function SuiteSidebar({
|
|
|
3184
3445
|
}
|
|
3185
3446
|
|
|
3186
3447
|
// src/suite/components/suite-app-layout.tsx
|
|
3187
|
-
var
|
|
3448
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3188
3449
|
function SuiteAppLayout({
|
|
3189
3450
|
sidebar,
|
|
3190
3451
|
children,
|
|
@@ -3197,13 +3458,13 @@ function SuiteAppLayout({
|
|
|
3197
3458
|
onResetWidth,
|
|
3198
3459
|
className
|
|
3199
3460
|
}) {
|
|
3200
|
-
return /* @__PURE__ */ (0,
|
|
3461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3201
3462
|
"div",
|
|
3202
3463
|
{
|
|
3203
3464
|
"data-test": "app-shell",
|
|
3204
3465
|
className: cn("flex min-h-dvh lg:h-screen lg:overflow-hidden", className),
|
|
3205
3466
|
children: [
|
|
3206
|
-
/* @__PURE__ */ (0,
|
|
3467
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
3207
3468
|
"aside",
|
|
3208
3469
|
{
|
|
3209
3470
|
className: "relative hidden shrink-0 flex-col overflow-hidden border-r border-ph-border transition-[width] duration-200 ease-out lg:flex",
|
|
@@ -3211,7 +3472,7 @@ function SuiteAppLayout({
|
|
|
3211
3472
|
"data-collapsed": collapsed ? "true" : "false",
|
|
3212
3473
|
children: [
|
|
3213
3474
|
sidebar,
|
|
3214
|
-
onStartResize ? /* @__PURE__ */ (0,
|
|
3475
|
+
onStartResize ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3215
3476
|
"div",
|
|
3216
3477
|
{
|
|
3217
3478
|
role: "separator",
|
|
@@ -3225,9 +3486,9 @@ function SuiteAppLayout({
|
|
|
3225
3486
|
]
|
|
3226
3487
|
}
|
|
3227
3488
|
),
|
|
3228
|
-
/* @__PURE__ */ (0,
|
|
3229
|
-
mobileHeader ? /* @__PURE__ */ (0,
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3489
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
|
|
3490
|
+
mobileHeader ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "shrink-0 lg:hidden", children: mobileHeader }) : null,
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3231
3492
|
"main",
|
|
3232
3493
|
{
|
|
3233
3494
|
id: "main-content",
|
|
@@ -3240,7 +3501,7 @@ function SuiteAppLayout({
|
|
|
3240
3501
|
children
|
|
3241
3502
|
}
|
|
3242
3503
|
),
|
|
3243
|
-
bottomNav ? /* @__PURE__ */ (0,
|
|
3504
|
+
bottomNav ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "shrink-0 lg:hidden", children: bottomNav }) : null
|
|
3244
3505
|
] })
|
|
3245
3506
|
]
|
|
3246
3507
|
}
|