@xenide-io/the-old-ui-theme 0.9.1 → 0.9.2
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-markdown-TSPYON2F.mjs +22 -0
- package/dist/{chunk-BS7BZI5W.mjs → chunk-VA343JBR.mjs} +5 -3
- package/dist/suite.js +385 -452
- package/dist/suite.mjs +612 -385
- package/dist/theme-boot.mjs +1 -2
- package/package.json +3 -3
- package/src/styles/suite-skin.css +62 -11
- package/src/suite/components/{ai-message-blocknote.test.tsx → ai-message-markdown.test.tsx} +10 -9
- package/src/suite/components/ai-message-markdown.tsx +21 -0
- package/src/suite/components/ai-panel.tsx +2 -2
- package/src/suite/components/command-palette-host.tsx +1 -1
- package/src/suite/components/suite-app-layout.tsx +1 -1
- package/dist/ai-message-blocknote-D4Z6DUCJ.mjs +0 -69
- package/dist/chunk-APKRZQRO.mjs +0 -251
- package/dist/chunk-IULORI3A.mjs +0 -8
- package/src/suite/components/ai-message-blocknote.tsx +0 -72
package/dist/suite.mjs
CHANGED
|
@@ -14,18 +14,10 @@ import {
|
|
|
14
14
|
cn
|
|
15
15
|
} from "./chunk-2EO5VCXP.mjs";
|
|
16
16
|
import {
|
|
17
|
+
SUITE_THEME_CHANNEL,
|
|
18
|
+
SUITE_THEME_COOKIE,
|
|
17
19
|
suiteThemeBootScript
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import {
|
|
20
|
-
SuiteThemeProvider,
|
|
21
|
-
clearCookie,
|
|
22
|
-
readCookie,
|
|
23
|
-
useSuiteTheme,
|
|
24
|
-
writeCookie
|
|
25
|
-
} from "./chunk-APKRZQRO.mjs";
|
|
26
|
-
import {
|
|
27
|
-
SUITE_THEME_COOKIE
|
|
28
|
-
} from "./chunk-IULORI3A.mjs";
|
|
20
|
+
} from "./chunk-VA343JBR.mjs";
|
|
29
21
|
import {
|
|
30
22
|
__spreadProps,
|
|
31
23
|
__spreadValues
|
|
@@ -2139,16 +2131,251 @@ function TodayCalibrating({
|
|
|
2139
2131
|
);
|
|
2140
2132
|
}
|
|
2141
2133
|
|
|
2134
|
+
// src/suite/components/theme-provider.tsx
|
|
2135
|
+
import {
|
|
2136
|
+
createContext,
|
|
2137
|
+
useCallback as useCallback2,
|
|
2138
|
+
useContext,
|
|
2139
|
+
useEffect as useEffect6,
|
|
2140
|
+
useMemo,
|
|
2141
|
+
useRef as useRef2,
|
|
2142
|
+
useState as useState7
|
|
2143
|
+
} from "react";
|
|
2144
|
+
|
|
2145
|
+
// src/suite/lib/cookies.ts
|
|
2146
|
+
function suiteCookieDomainAttr() {
|
|
2147
|
+
var _a;
|
|
2148
|
+
const host = window.location.hostname;
|
|
2149
|
+
if (host === "localhost" || /^\d{1,3}(?:\.\d{1,3}){3}$/.test(host)) {
|
|
2150
|
+
return "";
|
|
2151
|
+
}
|
|
2152
|
+
if (host.endsWith(".localhost")) {
|
|
2153
|
+
return "; Domain=.localhost";
|
|
2154
|
+
}
|
|
2155
|
+
const known = /* @__PURE__ */ new Set([
|
|
2156
|
+
"tides",
|
|
2157
|
+
"kraken",
|
|
2158
|
+
"turtletime",
|
|
2159
|
+
"time",
|
|
2160
|
+
"shelly",
|
|
2161
|
+
"app",
|
|
2162
|
+
"shellstack",
|
|
2163
|
+
"portal"
|
|
2164
|
+
]);
|
|
2165
|
+
const parts = host.split(".");
|
|
2166
|
+
if (parts.length >= 3 && known.has((_a = parts[0]) != null ? _a : "")) {
|
|
2167
|
+
return `; Domain=.${parts.slice(1).join(".")}`;
|
|
2168
|
+
}
|
|
2169
|
+
if (parts.length >= 2) return `; Domain=.${parts.slice(1).join(".")}`;
|
|
2170
|
+
return "";
|
|
2171
|
+
}
|
|
2172
|
+
function readCookie(name) {
|
|
2173
|
+
const prefix = `${name}=`;
|
|
2174
|
+
for (const part of document.cookie.split(";")) {
|
|
2175
|
+
const trimmed = part.trim();
|
|
2176
|
+
if (trimmed.startsWith(prefix)) {
|
|
2177
|
+
return decodeURIComponent(trimmed.slice(prefix.length));
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
return null;
|
|
2181
|
+
}
|
|
2182
|
+
function writeCookie(name, value) {
|
|
2183
|
+
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
|
2184
|
+
document.cookie = `${name}=${encodeURIComponent(value)}; Path=/; Max-Age=31536000; SameSite=Lax${suiteCookieDomainAttr()}${secure}`;
|
|
2185
|
+
}
|
|
2186
|
+
function clearCookie(name) {
|
|
2187
|
+
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
|
2188
|
+
document.cookie = `${name}=; Path=/; Max-Age=0; SameSite=Lax${suiteCookieDomainAttr()}${secure}`;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
// src/suite/components/theme-provider.tsx
|
|
2192
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2193
|
+
var SuiteThemeContext = createContext(null);
|
|
2194
|
+
var suiteThemeChannel = null;
|
|
2195
|
+
function broadcastTheme(theme) {
|
|
2196
|
+
if (typeof BroadcastChannel === "undefined") return;
|
|
2197
|
+
try {
|
|
2198
|
+
suiteThemeChannel != null ? suiteThemeChannel : suiteThemeChannel = new BroadcastChannel(SUITE_THEME_CHANNEL);
|
|
2199
|
+
suiteThemeChannel.postMessage(theme);
|
|
2200
|
+
} catch (e) {
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
function readSharedTheme() {
|
|
2204
|
+
if (typeof window === "undefined") return null;
|
|
2205
|
+
try {
|
|
2206
|
+
const value = readCookie(SUITE_THEME_COOKIE);
|
|
2207
|
+
return value === "light" || value === "dark" || value === "system" ? value : null;
|
|
2208
|
+
} catch (e) {
|
|
2209
|
+
return null;
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
function writeSharedTheme(theme) {
|
|
2213
|
+
try {
|
|
2214
|
+
writeCookie(SUITE_THEME_COOKIE, theme);
|
|
2215
|
+
} catch (e) {
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
function systemTheme(fallback) {
|
|
2219
|
+
if (typeof window === "undefined") return fallback;
|
|
2220
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2221
|
+
}
|
|
2222
|
+
function resolveTheme(theme, fallback) {
|
|
2223
|
+
return theme === "system" ? systemTheme(fallback) : theme;
|
|
2224
|
+
}
|
|
2225
|
+
function applyTheme(theme, config) {
|
|
2226
|
+
const resolved = resolveTheme(theme, config.fallbackTheme);
|
|
2227
|
+
if (typeof document === "undefined") return resolved;
|
|
2228
|
+
document.documentElement.setAttribute(
|
|
2229
|
+
"data-theme",
|
|
2230
|
+
resolved === "dark" ? config.darkThemeId : config.lightThemeId
|
|
2231
|
+
);
|
|
2232
|
+
document.documentElement.classList.toggle("dark", resolved === "dark");
|
|
2233
|
+
if (config.themeColorLight && config.themeColorDark) {
|
|
2234
|
+
const meta = document.getElementById(
|
|
2235
|
+
"theme-color-meta"
|
|
2236
|
+
);
|
|
2237
|
+
if (meta) {
|
|
2238
|
+
meta.content = resolved === "light" ? config.themeColorLight : config.themeColorDark;
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
return resolved;
|
|
2242
|
+
}
|
|
2243
|
+
function readStoredTheme(storageKey) {
|
|
2244
|
+
if (typeof window === "undefined") return "system";
|
|
2245
|
+
const shared = readSharedTheme();
|
|
2246
|
+
if (shared) return shared;
|
|
2247
|
+
try {
|
|
2248
|
+
const stored = localStorage.getItem(storageKey);
|
|
2249
|
+
if (stored === "light" || stored === "dark" || stored === "system")
|
|
2250
|
+
return stored;
|
|
2251
|
+
} catch (e) {
|
|
2252
|
+
}
|
|
2253
|
+
return "system";
|
|
2254
|
+
}
|
|
2255
|
+
function SuiteThemeProvider({
|
|
2256
|
+
config,
|
|
2257
|
+
children
|
|
2258
|
+
}) {
|
|
2259
|
+
const [state, setState] = useState7(() => {
|
|
2260
|
+
const theme = readStoredTheme(config.storageKey);
|
|
2261
|
+
if (typeof document === "undefined") {
|
|
2262
|
+
return { theme, resolvedTheme: config.fallbackTheme };
|
|
2263
|
+
}
|
|
2264
|
+
const domTheme = document.documentElement.getAttribute("data-theme");
|
|
2265
|
+
const resolvedTheme = domTheme === config.darkThemeId ? "dark" : domTheme === config.lightThemeId ? "light" : resolveTheme(theme, config.fallbackTheme);
|
|
2266
|
+
return { theme, resolvedTheme };
|
|
2267
|
+
});
|
|
2268
|
+
const themeRef = useRef2(state.theme);
|
|
2269
|
+
themeRef.current = state.theme;
|
|
2270
|
+
useEffect6(() => {
|
|
2271
|
+
applyTheme(state.theme, config);
|
|
2272
|
+
}, [state.theme, config]);
|
|
2273
|
+
useEffect6(() => {
|
|
2274
|
+
if (readSharedTheme() == null) writeSharedTheme(state.theme);
|
|
2275
|
+
}, []);
|
|
2276
|
+
useEffect6(() => {
|
|
2277
|
+
if (state.theme !== "system") return;
|
|
2278
|
+
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
2279
|
+
const update = () => {
|
|
2280
|
+
const resolved = applyTheme("system", config);
|
|
2281
|
+
setState((current) => __spreadProps(__spreadValues({}, current), { resolvedTheme: resolved }));
|
|
2282
|
+
};
|
|
2283
|
+
media.addEventListener("change", update);
|
|
2284
|
+
return () => media.removeEventListener("change", update);
|
|
2285
|
+
}, [state.theme, config]);
|
|
2286
|
+
useEffect6(() => {
|
|
2287
|
+
let channel = null;
|
|
2288
|
+
try {
|
|
2289
|
+
channel = new BroadcastChannel(SUITE_THEME_CHANNEL);
|
|
2290
|
+
} catch (e) {
|
|
2291
|
+
channel = null;
|
|
2292
|
+
}
|
|
2293
|
+
const adopt = (next) => {
|
|
2294
|
+
if (next !== "light" && next !== "dark" && next !== "system") return;
|
|
2295
|
+
if (next === themeRef.current) return;
|
|
2296
|
+
const resolved = applyTheme(next, config);
|
|
2297
|
+
try {
|
|
2298
|
+
localStorage.setItem(config.storageKey, next);
|
|
2299
|
+
} catch (e) {
|
|
2300
|
+
}
|
|
2301
|
+
setState({ theme: next, resolvedTheme: resolved });
|
|
2302
|
+
};
|
|
2303
|
+
const readShared = () => adopt(readSharedTheme());
|
|
2304
|
+
const onChannel = (event) => adopt(event.data);
|
|
2305
|
+
const onStorage = (event) => {
|
|
2306
|
+
if (event.key === config.storageKey) adopt(event.newValue);
|
|
2307
|
+
};
|
|
2308
|
+
let poll = null;
|
|
2309
|
+
const startPolling = () => {
|
|
2310
|
+
if (poll == null) poll = setInterval(readShared, 2e3);
|
|
2311
|
+
};
|
|
2312
|
+
const stopPolling = () => {
|
|
2313
|
+
if (poll != null) {
|
|
2314
|
+
clearInterval(poll);
|
|
2315
|
+
poll = null;
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
const onVisibility = () => {
|
|
2319
|
+
if (document.visibilityState === "visible") {
|
|
2320
|
+
readShared();
|
|
2321
|
+
startPolling();
|
|
2322
|
+
} else {
|
|
2323
|
+
stopPolling();
|
|
2324
|
+
}
|
|
2325
|
+
};
|
|
2326
|
+
channel == null ? void 0 : channel.addEventListener("message", onChannel);
|
|
2327
|
+
window.addEventListener("storage", onStorage);
|
|
2328
|
+
window.addEventListener("focus", readShared);
|
|
2329
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
2330
|
+
if (document.visibilityState === "visible") startPolling();
|
|
2331
|
+
return () => {
|
|
2332
|
+
channel == null ? void 0 : channel.removeEventListener("message", onChannel);
|
|
2333
|
+
channel == null ? void 0 : channel.close();
|
|
2334
|
+
window.removeEventListener("storage", onStorage);
|
|
2335
|
+
window.removeEventListener("focus", readShared);
|
|
2336
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
2337
|
+
stopPolling();
|
|
2338
|
+
};
|
|
2339
|
+
}, [config]);
|
|
2340
|
+
const setTheme = useCallback2(
|
|
2341
|
+
(next) => {
|
|
2342
|
+
const resolved = applyTheme(next, config);
|
|
2343
|
+
setState({ theme: next, resolvedTheme: resolved });
|
|
2344
|
+
try {
|
|
2345
|
+
localStorage.setItem(config.storageKey, next);
|
|
2346
|
+
} catch (e) {
|
|
2347
|
+
}
|
|
2348
|
+
writeSharedTheme(next);
|
|
2349
|
+
broadcastTheme(next);
|
|
2350
|
+
},
|
|
2351
|
+
[config]
|
|
2352
|
+
);
|
|
2353
|
+
const toggleTheme = useCallback2(() => {
|
|
2354
|
+
const next = resolveTheme(themeRef.current, config.fallbackTheme) === "dark" ? "light" : "dark";
|
|
2355
|
+
setTheme(next);
|
|
2356
|
+
}, [config, setTheme]);
|
|
2357
|
+
const value = useMemo(
|
|
2358
|
+
() => ({ theme: state.theme, resolvedTheme: state.resolvedTheme, setTheme, toggleTheme }),
|
|
2359
|
+
[state.theme, state.resolvedTheme, setTheme, toggleTheme]
|
|
2360
|
+
);
|
|
2361
|
+
return /* @__PURE__ */ jsx16(SuiteThemeContext.Provider, { value, children });
|
|
2362
|
+
}
|
|
2363
|
+
function useSuiteTheme() {
|
|
2364
|
+
const ctx = useContext(SuiteThemeContext);
|
|
2365
|
+
if (!ctx) throw new Error("useTheme must be used within ThemeProvider");
|
|
2366
|
+
return ctx;
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2142
2369
|
// src/suite/components/ai-panel.tsx
|
|
2143
2370
|
import {
|
|
2144
2371
|
lazy,
|
|
2145
2372
|
Suspense,
|
|
2146
|
-
useCallback as
|
|
2147
|
-
useEffect as
|
|
2373
|
+
useCallback as useCallback3,
|
|
2374
|
+
useEffect as useEffect7,
|
|
2148
2375
|
useId,
|
|
2149
2376
|
useLayoutEffect,
|
|
2150
|
-
useRef as
|
|
2151
|
-
useState as
|
|
2377
|
+
useRef as useRef3,
|
|
2378
|
+
useState as useState8
|
|
2152
2379
|
} from "react";
|
|
2153
2380
|
import {
|
|
2154
2381
|
ArrowDown,
|
|
@@ -2158,8 +2385,8 @@ import {
|
|
|
2158
2385
|
Square,
|
|
2159
2386
|
WarningTriangle
|
|
2160
2387
|
} from "iconoir-react";
|
|
2161
|
-
import { Fragment as Fragment5, jsx as
|
|
2162
|
-
var
|
|
2388
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2389
|
+
var SuiteAiMarkdownMessage = lazy(() => import("./ai-message-markdown-TSPYON2F.mjs"));
|
|
2163
2390
|
var SUITE_OPEN_ASK_AI_EVENT = "shellstack:open-ask-ai";
|
|
2164
2391
|
var SUITE_ASK_AI_OPEN_KEY = "shellstack:shelly-open";
|
|
2165
2392
|
var SUITE_ASK_AI_OPEN_QUERY = "shelly";
|
|
@@ -2245,10 +2472,10 @@ function SuiteAiPanel({
|
|
|
2245
2472
|
isWaitingForReply = false
|
|
2246
2473
|
}) {
|
|
2247
2474
|
const inputId = useId();
|
|
2248
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
2249
|
-
const [resolvingId, setResolvingId] =
|
|
2475
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState8(false);
|
|
2476
|
+
const [resolvingId, setResolvingId] = useState8("");
|
|
2250
2477
|
const open = openProp != null ? openProp : uncontrolledOpen;
|
|
2251
|
-
const setOpen =
|
|
2478
|
+
const setOpen = useCallback3(
|
|
2252
2479
|
(next) => {
|
|
2253
2480
|
persistSuiteAskAiOpen(next);
|
|
2254
2481
|
if (openProp === void 0) setUncontrolledOpen(next);
|
|
@@ -2256,18 +2483,18 @@ function SuiteAiPanel({
|
|
|
2256
2483
|
},
|
|
2257
2484
|
[onOpenChange, openProp]
|
|
2258
2485
|
);
|
|
2259
|
-
const [prompt, setPrompt] =
|
|
2260
|
-
const [messages, setMessages] =
|
|
2261
|
-
const [loading, setLoading] =
|
|
2262
|
-
const [hydrating, setHydrating] =
|
|
2263
|
-
const [error, setError] =
|
|
2264
|
-
const [atBottom, setAtBottom] =
|
|
2265
|
-
const scrollerRef =
|
|
2266
|
-
const textareaRef =
|
|
2267
|
-
const abortRef =
|
|
2268
|
-
const pendingPromptRef =
|
|
2486
|
+
const [prompt, setPrompt] = useState8("");
|
|
2487
|
+
const [messages, setMessages] = useState8([]);
|
|
2488
|
+
const [loading, setLoading] = useState8(false);
|
|
2489
|
+
const [hydrating, setHydrating] = useState8(false);
|
|
2490
|
+
const [error, setError] = useState8("");
|
|
2491
|
+
const [atBottom, setAtBottom] = useState8(true);
|
|
2492
|
+
const scrollerRef = useRef3(null);
|
|
2493
|
+
const textareaRef = useRef3(null);
|
|
2494
|
+
const abortRef = useRef3(null);
|
|
2495
|
+
const pendingPromptRef = useRef3(null);
|
|
2269
2496
|
const waiting = loading || isWaitingForReply;
|
|
2270
|
-
|
|
2497
|
+
useEffect7(() => {
|
|
2271
2498
|
function onOpen(event) {
|
|
2272
2499
|
var _a;
|
|
2273
2500
|
const detail = event.detail;
|
|
@@ -2281,19 +2508,19 @@ function SuiteAiPanel({
|
|
|
2281
2508
|
window.addEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
|
|
2282
2509
|
return () => window.removeEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
|
|
2283
2510
|
}, [setOpen]);
|
|
2284
|
-
const scrollToBottom =
|
|
2511
|
+
const scrollToBottom = useCallback3((behavior = "auto") => {
|
|
2285
2512
|
const el = scrollerRef.current;
|
|
2286
2513
|
if (!el) return;
|
|
2287
2514
|
el.scrollTo({ top: el.scrollHeight, behavior });
|
|
2288
2515
|
setAtBottom(true);
|
|
2289
2516
|
}, []);
|
|
2290
|
-
const handleScroll =
|
|
2517
|
+
const handleScroll = useCallback3(() => {
|
|
2291
2518
|
const el = scrollerRef.current;
|
|
2292
2519
|
if (!el) return;
|
|
2293
2520
|
const distance = el.scrollHeight - el.scrollTop - el.clientHeight;
|
|
2294
2521
|
setAtBottom(distance < 64);
|
|
2295
2522
|
}, []);
|
|
2296
|
-
const hydrate =
|
|
2523
|
+
const hydrate = useCallback3(async () => {
|
|
2297
2524
|
var _a, _b, _c;
|
|
2298
2525
|
setHydrating(true);
|
|
2299
2526
|
setError("");
|
|
@@ -2316,7 +2543,7 @@ function SuiteAiPanel({
|
|
|
2316
2543
|
setHydrating(false);
|
|
2317
2544
|
}
|
|
2318
2545
|
}, [fetchChat]);
|
|
2319
|
-
|
|
2546
|
+
useEffect7(() => {
|
|
2320
2547
|
var _a;
|
|
2321
2548
|
if (!open) return;
|
|
2322
2549
|
const queued = (_a = pendingPromptRef.current) != null ? _a : consumePendingAskAiPrompt();
|
|
@@ -2327,10 +2554,10 @@ function SuiteAiPanel({
|
|
|
2327
2554
|
if (pending) setPrompt(pending);
|
|
2328
2555
|
});
|
|
2329
2556
|
}, [open, hydrate]);
|
|
2330
|
-
|
|
2557
|
+
useEffect7(() => {
|
|
2331
2558
|
if (open && atBottom) scrollToBottom();
|
|
2332
2559
|
}, [messages, waiting, open, atBottom, scrollToBottom]);
|
|
2333
|
-
|
|
2560
|
+
useEffect7(() => {
|
|
2334
2561
|
var _a;
|
|
2335
2562
|
if (open && !hydrating) (_a = textareaRef.current) == null ? void 0 : _a.focus();
|
|
2336
2563
|
}, [open, hydrating]);
|
|
@@ -2467,7 +2694,7 @@ function SuiteAiPanel({
|
|
|
2467
2694
|
"aria-label": title,
|
|
2468
2695
|
children: [
|
|
2469
2696
|
/* @__PURE__ */ jsxs14("header", { className: "flex items-center gap-2 px-2 pb-2", children: [
|
|
2470
|
-
/* @__PURE__ */
|
|
2697
|
+
/* @__PURE__ */ jsx17("h2", { className: "sr-only", children: title }),
|
|
2471
2698
|
messages.length > 0 ? /* @__PURE__ */ jsxs14(
|
|
2472
2699
|
"button",
|
|
2473
2700
|
{
|
|
@@ -2477,7 +2704,7 @@ function SuiteAiPanel({
|
|
|
2477
2704
|
className: "ml-auto inline-flex h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-ph-subtle transition-colors hover:bg-ph-muted hover:text-ph-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-focus disabled:opacity-40",
|
|
2478
2705
|
"data-test": "ask-ai-clear",
|
|
2479
2706
|
children: [
|
|
2480
|
-
/* @__PURE__ */
|
|
2707
|
+
/* @__PURE__ */ jsx17(Erase, { className: "h-3.5 w-3.5" }),
|
|
2481
2708
|
"Clear"
|
|
2482
2709
|
]
|
|
2483
2710
|
}
|
|
@@ -2496,14 +2723,14 @@ function SuiteAiPanel({
|
|
|
2496
2723
|
className: "suite-scroll-lock h-full space-y-5 overflow-y-auto px-2 py-3",
|
|
2497
2724
|
children: [
|
|
2498
2725
|
hydrating && messages.length === 0 ? /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 text-sm text-ph-subtle", children: [
|
|
2499
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ jsx17(Spinner, { className: "h-4 w-4 animate-spin" }),
|
|
2500
2727
|
"Loading your chat\u2026"
|
|
2501
2728
|
] }) : null,
|
|
2502
2729
|
!hydrating && messages.length === 0 && !error ? /* @__PURE__ */ jsxs14("div", { className: "mx-auto mt-4 flex max-w-sm flex-col items-center px-1 text-center", children: [
|
|
2503
|
-
/* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
/* @__PURE__ */
|
|
2506
|
-
presets.length > 0 ? /* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ jsx17("span", { className: "flex h-10 w-10 items-center justify-center rounded-2xl bg-ph-brand/10 text-ph-brand", children: /* @__PURE__ */ jsx17(Icon, { className: "h-5 w-5" }) }),
|
|
2731
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-3 font-display text-base font-semibold text-ph-ink", children: "How can I help?" }),
|
|
2732
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-1 text-sm leading-relaxed text-ph-subtle", children: emptyState }),
|
|
2733
|
+
presets.length > 0 ? /* @__PURE__ */ jsx17("div", { className: "mt-4 flex w-full flex-col gap-2", children: presets.map((preset) => /* @__PURE__ */ jsxs14(
|
|
2507
2734
|
"button",
|
|
2508
2735
|
{
|
|
2509
2736
|
type: "button",
|
|
@@ -2511,9 +2738,9 @@ function SuiteAiPanel({
|
|
|
2511
2738
|
disabled: waiting || hydrating,
|
|
2512
2739
|
className: "group flex w-full items-center gap-2 rounded-xl border border-ph-border bg-ph-surface px-3 py-2 text-left text-sm text-ph-ink transition-colors hover:border-ph-brand/40 hover:bg-ph-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-focus disabled:opacity-40",
|
|
2513
2740
|
children: [
|
|
2514
|
-
/* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2741
|
+
/* @__PURE__ */ jsx17(Sparks, { className: "h-4 w-4 shrink-0 text-ph-brand" }),
|
|
2742
|
+
/* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate", children: preset.label }),
|
|
2743
|
+
/* @__PURE__ */ jsx17(ArrowUp, { className: "h-3.5 w-3.5 shrink-0 rotate-45 text-ph-mutedtext transition-transform group-hover:translate-x-0.5" })
|
|
2517
2744
|
]
|
|
2518
2745
|
},
|
|
2519
2746
|
preset.label
|
|
@@ -2523,12 +2750,12 @@ function SuiteAiPanel({
|
|
|
2523
2750
|
var _a;
|
|
2524
2751
|
const isUser = message.role === "user";
|
|
2525
2752
|
if (isUser) {
|
|
2526
|
-
return /* @__PURE__ */
|
|
2753
|
+
return /* @__PURE__ */ jsx17(
|
|
2527
2754
|
"div",
|
|
2528
2755
|
{
|
|
2529
2756
|
className: "flex justify-end",
|
|
2530
2757
|
"data-test": "ask-ai-user",
|
|
2531
|
-
children: /* @__PURE__ */
|
|
2758
|
+
children: /* @__PURE__ */ jsx17("div", { className: "w-fit max-w-[85%] whitespace-pre-wrap break-words rounded-2xl rounded-br-md bg-ph-brand px-3 py-2 text-sm leading-relaxed text-[var(--ph-on-accent)] [overflow-wrap:anywhere]", children: message.content })
|
|
2532
2759
|
},
|
|
2533
2760
|
`user-${index}`
|
|
2534
2761
|
);
|
|
@@ -2539,16 +2766,16 @@ function SuiteAiPanel({
|
|
|
2539
2766
|
className: "flex items-end gap-2",
|
|
2540
2767
|
"data-test": "ask-ai-assistant",
|
|
2541
2768
|
children: [
|
|
2542
|
-
/* @__PURE__ */
|
|
2769
|
+
/* @__PURE__ */ jsx17(
|
|
2543
2770
|
"span",
|
|
2544
2771
|
{
|
|
2545
2772
|
className: "mb-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-ph-brand/10 text-ph-brand",
|
|
2546
2773
|
"aria-hidden": true,
|
|
2547
|
-
children: /* @__PURE__ */
|
|
2774
|
+
children: /* @__PURE__ */ jsx17(Icon, { className: "h-3.5 w-3.5" })
|
|
2548
2775
|
}
|
|
2549
2776
|
),
|
|
2550
2777
|
/* @__PURE__ */ jsxs14("div", { className: "min-w-0 max-w-[85%] space-y-2", children: [
|
|
2551
|
-
/* @__PURE__ */
|
|
2778
|
+
/* @__PURE__ */ jsx17("div", { className: "rounded-2xl rounded-bl-md bg-ph-muted px-3 py-2 text-sm leading-relaxed text-ph-ink", children: /* @__PURE__ */ jsx17(
|
|
2552
2779
|
Suspense,
|
|
2553
2780
|
{
|
|
2554
2781
|
fallback: /* @__PURE__ */ jsxs14(
|
|
@@ -2558,14 +2785,14 @@ function SuiteAiPanel({
|
|
|
2558
2785
|
role: "status",
|
|
2559
2786
|
"aria-label": "Rendering response",
|
|
2560
2787
|
children: [
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
/* @__PURE__ */
|
|
2563
|
-
/* @__PURE__ */
|
|
2564
|
-
/* @__PURE__ */
|
|
2788
|
+
/* @__PURE__ */ jsx17("span", { className: "sr-only", children: "Rendering response\u2026" }),
|
|
2789
|
+
/* @__PURE__ */ jsx17("div", { className: "h-3 w-11/12 rounded bg-ph-mutedtext/20 motion-safe:animate-pulse" }),
|
|
2790
|
+
/* @__PURE__ */ jsx17("div", { className: "h-3 w-full rounded bg-ph-mutedtext/20 motion-safe:animate-pulse" }),
|
|
2791
|
+
/* @__PURE__ */ jsx17("div", { className: "h-3 w-3/5 rounded bg-ph-mutedtext/20 motion-safe:animate-pulse" })
|
|
2565
2792
|
]
|
|
2566
2793
|
}
|
|
2567
2794
|
),
|
|
2568
|
-
children: /* @__PURE__ */
|
|
2795
|
+
children: /* @__PURE__ */ jsx17(SuiteAiMarkdownMessage, { markdown: message.content })
|
|
2569
2796
|
}
|
|
2570
2797
|
) }),
|
|
2571
2798
|
((_a = message.actions) != null ? _a : []).map((action) => /* @__PURE__ */ jsxs14(
|
|
@@ -2575,9 +2802,9 @@ function SuiteAiPanel({
|
|
|
2575
2802
|
"data-status": action.status,
|
|
2576
2803
|
className: "rounded-xl border border-ph-border bg-ph-surface px-3 py-2 text-sm text-ph-ink",
|
|
2577
2804
|
children: [
|
|
2578
|
-
/* @__PURE__ */
|
|
2805
|
+
/* @__PURE__ */ jsx17("p", { className: "font-medium", children: action.summary }),
|
|
2579
2806
|
action.status === "proposed" ? /* @__PURE__ */ jsxs14("div", { className: "mt-2 flex flex-wrap gap-2", children: [
|
|
2580
|
-
/* @__PURE__ */
|
|
2807
|
+
/* @__PURE__ */ jsx17(
|
|
2581
2808
|
"button",
|
|
2582
2809
|
{
|
|
2583
2810
|
type: "button",
|
|
@@ -2588,7 +2815,7 @@ function SuiteAiPanel({
|
|
|
2588
2815
|
children: resolvingId === action.id ? "Working\u2026" : "Confirm"
|
|
2589
2816
|
}
|
|
2590
2817
|
),
|
|
2591
|
-
/* @__PURE__ */
|
|
2818
|
+
/* @__PURE__ */ jsx17(
|
|
2592
2819
|
"button",
|
|
2593
2820
|
{
|
|
2594
2821
|
type: "button",
|
|
@@ -2604,7 +2831,7 @@ function SuiteAiPanel({
|
|
|
2604
2831
|
"Done",
|
|
2605
2832
|
action.href ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
2606
2833
|
" \xB7 ",
|
|
2607
|
-
/* @__PURE__ */
|
|
2834
|
+
/* @__PURE__ */ jsx17(
|
|
2608
2835
|
"a",
|
|
2609
2836
|
{
|
|
2610
2837
|
href: action.href,
|
|
@@ -2614,8 +2841,8 @@ function SuiteAiPanel({
|
|
|
2614
2841
|
)
|
|
2615
2842
|
] }) : null
|
|
2616
2843
|
] }) : null,
|
|
2617
|
-
action.status === "cancelled" ? /* @__PURE__ */
|
|
2618
|
-
action.status === "failed" ? /* @__PURE__ */
|
|
2844
|
+
action.status === "cancelled" ? /* @__PURE__ */ jsx17("p", { className: "mt-1 text-xs text-ph-subtle", children: "Cancelled" }) : null,
|
|
2845
|
+
action.status === "failed" ? /* @__PURE__ */ jsx17("p", { className: "mt-1 text-xs text-ph-danger", children: action.error || "Could not apply that." }) : null
|
|
2619
2846
|
]
|
|
2620
2847
|
},
|
|
2621
2848
|
action.id
|
|
@@ -2627,25 +2854,25 @@ function SuiteAiPanel({
|
|
|
2627
2854
|
);
|
|
2628
2855
|
}),
|
|
2629
2856
|
waiting ? /* @__PURE__ */ jsxs14("div", { className: "flex items-end gap-2", "aria-hidden": true, children: [
|
|
2630
|
-
/* @__PURE__ */
|
|
2857
|
+
/* @__PURE__ */ jsx17("span", { className: "mb-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-ph-brand/10 text-ph-brand", children: /* @__PURE__ */ jsx17(Icon, { className: "h-3.5 w-3.5" }) }),
|
|
2631
2858
|
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1.5 rounded-2xl rounded-bl-md bg-ph-muted px-3 py-2.5", children: [
|
|
2632
|
-
/* @__PURE__ */
|
|
2633
|
-
/* @__PURE__ */
|
|
2634
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ jsx17("span", { className: "h-1.5 w-1.5 rounded-full bg-ph-mutedtext motion-safe:animate-bounce" }),
|
|
2860
|
+
/* @__PURE__ */ jsx17("span", { className: "h-1.5 w-1.5 rounded-full bg-ph-mutedtext motion-safe:animate-bounce [animation-delay:0.15s]" }),
|
|
2861
|
+
/* @__PURE__ */ jsx17("span", { className: "h-1.5 w-1.5 rounded-full bg-ph-mutedtext motion-safe:animate-bounce [animation-delay:0.3s]" })
|
|
2635
2862
|
] })
|
|
2636
2863
|
] }) : null,
|
|
2637
|
-
waiting ? /* @__PURE__ */
|
|
2864
|
+
waiting ? /* @__PURE__ */ jsx17("span", { className: "sr-only", "aria-live": "polite", children: "Assistant is responding\u2026" }) : null,
|
|
2638
2865
|
error ? /* @__PURE__ */ jsxs14(
|
|
2639
2866
|
"div",
|
|
2640
2867
|
{
|
|
2641
2868
|
role: "alert",
|
|
2642
2869
|
className: "flex items-start gap-2 rounded-xl border border-ph-danger/30 bg-ph-danger/10 px-3 py-2.5 text-sm text-ph-ink",
|
|
2643
2870
|
children: [
|
|
2644
|
-
/* @__PURE__ */
|
|
2871
|
+
/* @__PURE__ */ jsx17(WarningTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-ph-danger" }),
|
|
2645
2872
|
/* @__PURE__ */ jsxs14("div", { className: "min-w-0 flex-1", children: [
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2873
|
+
/* @__PURE__ */ jsx17("p", { className: "font-medium text-ph-danger", children: "Something went wrong" }),
|
|
2874
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-0.5 text-ph-subtle", children: error }),
|
|
2875
|
+
/* @__PURE__ */ jsx17(
|
|
2649
2876
|
"button",
|
|
2650
2877
|
{
|
|
2651
2878
|
type: "button",
|
|
@@ -2662,20 +2889,20 @@ function SuiteAiPanel({
|
|
|
2662
2889
|
]
|
|
2663
2890
|
}
|
|
2664
2891
|
),
|
|
2665
|
-
!atBottom ? /* @__PURE__ */
|
|
2892
|
+
!atBottom ? /* @__PURE__ */ jsx17("div", { className: "absolute bottom-3 left-1/2 -translate-x-1/2", children: /* @__PURE__ */ jsx17(Tooltip, { content: "Scroll to latest", children: /* @__PURE__ */ jsx17(
|
|
2666
2893
|
"button",
|
|
2667
2894
|
{
|
|
2668
2895
|
type: "button",
|
|
2669
2896
|
onClick: () => scrollToBottom("smooth"),
|
|
2670
2897
|
className: "flex h-9 w-9 items-center justify-center rounded-full border border-ph-border bg-ph-surface text-ph-subtle shadow-ph-md transition-colors hover:text-ph-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-focus",
|
|
2671
2898
|
"aria-label": "Scroll to latest",
|
|
2672
|
-
children: /* @__PURE__ */
|
|
2899
|
+
children: /* @__PURE__ */ jsx17(ArrowDown, { className: "h-4 w-4" })
|
|
2673
2900
|
}
|
|
2674
2901
|
) }) }) : null
|
|
2675
2902
|
] }),
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2903
|
+
/* @__PURE__ */ jsx17("div", { className: "px-2 pt-2 pb-[max(2rem,calc(env(safe-area-inset-bottom)+1rem))]", children: /* @__PURE__ */ jsxs14("div", { className: "flex items-end gap-1.5 rounded-2xl border border-ph-border bg-ph-surface px-1.5 py-1 transition-colors focus-within:border-ph-brand/45 focus-within:ring-2 focus-within:ring-ph-focus/35", children: [
|
|
2904
|
+
/* @__PURE__ */ jsx17("label", { htmlFor: inputId, className: "sr-only", children: "Ask a question" }),
|
|
2905
|
+
/* @__PURE__ */ jsx17(
|
|
2679
2906
|
"textarea",
|
|
2680
2907
|
{
|
|
2681
2908
|
id: inputId,
|
|
@@ -2694,7 +2921,7 @@ function SuiteAiPanel({
|
|
|
2694
2921
|
className: "max-h-36 min-h-10 flex-1 resize-none bg-transparent px-1.5 py-2 text-sm leading-relaxed text-ph-ink outline-none placeholder:text-ph-mutedtext"
|
|
2695
2922
|
}
|
|
2696
2923
|
),
|
|
2697
|
-
loading ? /* @__PURE__ */
|
|
2924
|
+
loading ? /* @__PURE__ */ jsx17(Tooltip, { content: "Stop generating", children: /* @__PURE__ */ jsx17(
|
|
2698
2925
|
"button",
|
|
2699
2926
|
{
|
|
2700
2927
|
type: "button",
|
|
@@ -2702,18 +2929,18 @@ function SuiteAiPanel({
|
|
|
2702
2929
|
"data-test": "ask-ai-stop",
|
|
2703
2930
|
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-ph-muted text-ph-ink transition-colors hover:bg-ph-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-focus",
|
|
2704
2931
|
"aria-label": "Stop generating",
|
|
2705
|
-
children: /* @__PURE__ */
|
|
2932
|
+
children: /* @__PURE__ */ jsx17(Square, { className: "h-3.5 w-3.5 fill-current" })
|
|
2706
2933
|
}
|
|
2707
|
-
) }) : isWaitingForReply ? /* @__PURE__ */
|
|
2934
|
+
) }) : isWaitingForReply ? /* @__PURE__ */ jsx17(
|
|
2708
2935
|
"span",
|
|
2709
2936
|
{
|
|
2710
2937
|
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-ph-muted text-ph-subtle",
|
|
2711
2938
|
"data-test": "ask-ai-waiting",
|
|
2712
2939
|
role: "status",
|
|
2713
2940
|
"aria-label": "Shelly is responding",
|
|
2714
|
-
children: /* @__PURE__ */
|
|
2941
|
+
children: /* @__PURE__ */ jsx17(Spinner, { className: "h-4 w-4 animate-spin" })
|
|
2715
2942
|
}
|
|
2716
|
-
) : /* @__PURE__ */
|
|
2943
|
+
) : /* @__PURE__ */ jsx17(Tooltip, { content: "Send message", children: /* @__PURE__ */ jsx17(
|
|
2717
2944
|
"button",
|
|
2718
2945
|
{
|
|
2719
2946
|
type: "button",
|
|
@@ -2722,7 +2949,7 @@ function SuiteAiPanel({
|
|
|
2722
2949
|
"data-test": "ask-ai-send",
|
|
2723
2950
|
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-ph-brand text-[color:var(--ph-on-accent)] transition-opacity hover:bg-ph-brand-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-focus disabled:opacity-40",
|
|
2724
2951
|
"aria-label": "Send message",
|
|
2725
|
-
children: /* @__PURE__ */
|
|
2952
|
+
children: /* @__PURE__ */ jsx17(ArrowUp, { className: "h-4 w-4" })
|
|
2726
2953
|
}
|
|
2727
2954
|
) })
|
|
2728
2955
|
] }) })
|
|
@@ -2732,9 +2959,9 @@ function SuiteAiPanel({
|
|
|
2732
2959
|
}
|
|
2733
2960
|
|
|
2734
2961
|
// src/suite/components/workspace-switcher.tsx
|
|
2735
|
-
import { useState as
|
|
2962
|
+
import { useState as useState9 } from "react";
|
|
2736
2963
|
import { Building, Check, NavArrowDown } from "iconoir-react";
|
|
2737
|
-
import { Fragment as Fragment6, jsx as
|
|
2964
|
+
import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2738
2965
|
function SuiteWorkspaceSwitcher({
|
|
2739
2966
|
workspaces = [],
|
|
2740
2967
|
groups,
|
|
@@ -2750,9 +2977,9 @@ function SuiteWorkspaceSwitcher({
|
|
|
2750
2977
|
footer
|
|
2751
2978
|
}) {
|
|
2752
2979
|
var _a;
|
|
2753
|
-
const [open, setOpen] =
|
|
2980
|
+
const [open, setOpen] = useState9(false);
|
|
2754
2981
|
const sections = (_a = groups == null ? void 0 : groups.filter((group) => group.workspaces.length > 0)) != null ? _a : workspaces.length > 0 ? [{ id: "workspaces", label: "Switch workspace", workspaces }] : [];
|
|
2755
|
-
return /* @__PURE__ */
|
|
2982
|
+
return /* @__PURE__ */ jsx18(
|
|
2756
2983
|
DropdownMenu2,
|
|
2757
2984
|
{
|
|
2758
2985
|
"aria-label": "Switch workspace",
|
|
@@ -2773,10 +3000,10 @@ function SuiteWorkspaceSwitcher({
|
|
|
2773
3000
|
),
|
|
2774
3001
|
"data-test": "workspace-switcher-trigger",
|
|
2775
3002
|
children: [
|
|
2776
|
-
/* @__PURE__ */
|
|
3003
|
+
/* @__PURE__ */ jsx18(Building, { className: "h-4 w-4 shrink-0 text-ph-ink", "aria-hidden": true }),
|
|
2777
3004
|
!collapsed ? /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
3005
|
+
/* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-ph-ink", children: name }),
|
|
3006
|
+
/* @__PURE__ */ jsx18(
|
|
2780
3007
|
NavArrowDown,
|
|
2781
3008
|
{
|
|
2782
3009
|
className: cn2(
|
|
@@ -2797,9 +3024,9 @@ function SuiteWorkspaceSwitcher({
|
|
|
2797
3024
|
className: "p-1",
|
|
2798
3025
|
"data-test": "workspace-switcher-menu",
|
|
2799
3026
|
children: [
|
|
2800
|
-
sections.length === 0 ? /* @__PURE__ */
|
|
2801
|
-
/* @__PURE__ */
|
|
2802
|
-
section.workspaces.map((workspace) => /* @__PURE__ */
|
|
3027
|
+
sections.length === 0 ? /* @__PURE__ */ jsx18("p", { className: "px-3 py-2 text-sm text-ph-mutedtext", children: emptyLabel }) : sections.map((section) => /* @__PURE__ */ jsxs15("div", { children: [
|
|
3028
|
+
/* @__PURE__ */ jsx18("p", { className: "px-3 py-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-ph-mutedtext", children: section.label }),
|
|
3029
|
+
section.workspaces.map((workspace) => /* @__PURE__ */ jsx18(
|
|
2803
3030
|
DropdownItem2,
|
|
2804
3031
|
{
|
|
2805
3032
|
id: `workspace-option-${workspace.id}`,
|
|
@@ -2814,10 +3041,10 @@ function SuiteWorkspaceSwitcher({
|
|
|
2814
3041
|
className: appSwitcherMenuItemClass(),
|
|
2815
3042
|
children: /* @__PURE__ */ jsxs15("span", { className: "flex min-w-0 w-full items-center gap-3", children: [
|
|
2816
3043
|
/* @__PURE__ */ jsxs15("span", { className: "min-w-0 flex-1", children: [
|
|
2817
|
-
/* @__PURE__ */
|
|
2818
|
-
workspace.description ? /* @__PURE__ */
|
|
3044
|
+
/* @__PURE__ */ jsx18("span", { className: "block truncate text-sm font-medium text-ph-ink", children: workspace.name }),
|
|
3045
|
+
workspace.description ? /* @__PURE__ */ jsx18("span", { className: "block truncate text-xs text-ph-mutedtext", children: workspace.description }) : null
|
|
2819
3046
|
] }),
|
|
2820
|
-
workspace.id === currentId ? /* @__PURE__ */
|
|
3047
|
+
workspace.id === currentId ? /* @__PURE__ */ jsx18(
|
|
2821
3048
|
Check,
|
|
2822
3049
|
{
|
|
2823
3050
|
className: "h-4 w-4 shrink-0 text-ph-brand",
|
|
@@ -2829,7 +3056,7 @@ function SuiteWorkspaceSwitcher({
|
|
|
2829
3056
|
workspace.id
|
|
2830
3057
|
))
|
|
2831
3058
|
] }, section.id)),
|
|
2832
|
-
footer ? /* @__PURE__ */
|
|
3059
|
+
footer ? /* @__PURE__ */ jsx18("div", { className: "mt-1 border-t border-ph-border pt-1", children: footer }) : null
|
|
2833
3060
|
]
|
|
2834
3061
|
}
|
|
2835
3062
|
)
|
|
@@ -2838,7 +3065,7 @@ function SuiteWorkspaceSwitcher({
|
|
|
2838
3065
|
}
|
|
2839
3066
|
|
|
2840
3067
|
// src/suite/icons/suite-icon.tsx
|
|
2841
|
-
import { jsx as
|
|
3068
|
+
import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2842
3069
|
var TODAY_SUN_STYLE = `
|
|
2843
3070
|
@media (prefers-reduced-motion: no-preference) {
|
|
2844
3071
|
.suite-icon-today-sun-rays {
|
|
@@ -2881,8 +3108,8 @@ function SuiteIcon({
|
|
|
2881
3108
|
"aria-label": label,
|
|
2882
3109
|
"aria-hidden": label ? void 0 : true,
|
|
2883
3110
|
children: [
|
|
2884
|
-
glyph.animatedAccent && animated ? /* @__PURE__ */
|
|
2885
|
-
/* @__PURE__ */
|
|
3111
|
+
glyph.animatedAccent && animated ? /* @__PURE__ */ jsx19("style", { children: TODAY_SUN_STYLE }) : null,
|
|
3112
|
+
/* @__PURE__ */ jsx19(
|
|
2886
3113
|
GlyphParts,
|
|
2887
3114
|
{
|
|
2888
3115
|
elements: glyph.elements,
|
|
@@ -2896,9 +3123,9 @@ function SuiteIcon({
|
|
|
2896
3123
|
|
|
2897
3124
|
// src/suite/lib/use-sidebar-width.ts
|
|
2898
3125
|
import {
|
|
2899
|
-
useCallback as
|
|
3126
|
+
useCallback as useCallback4,
|
|
2900
3127
|
useLayoutEffect as useLayoutEffect2,
|
|
2901
|
-
useState as
|
|
3128
|
+
useState as useState10
|
|
2902
3129
|
} from "react";
|
|
2903
3130
|
var SIDEBAR_RAIL_WIDTH = 56;
|
|
2904
3131
|
var SIDEBAR_COLLAPSE_THRESHOLD = 80;
|
|
@@ -2984,8 +3211,8 @@ function resetSuiteSidebarWidth() {
|
|
|
2984
3211
|
}
|
|
2985
3212
|
function useSidebarWidth(storageKey = SUITE_SIDEBAR_WIDTH_KEY, defaultWidth = SIDEBAR_DEFAULT_WIDTH) {
|
|
2986
3213
|
const fallbackWidth = snapWidth(clampWidth(defaultWidth));
|
|
2987
|
-
const [width, setWidth] =
|
|
2988
|
-
const [narrowViewport, setNarrowViewport] =
|
|
3214
|
+
const [width, setWidth] = useState10(fallbackWidth);
|
|
3215
|
+
const [narrowViewport, setNarrowViewport] = useState10(false);
|
|
2989
3216
|
const collapsed = narrowViewport || width <= SIDEBAR_COLLAPSE_THRESHOLD;
|
|
2990
3217
|
useLayoutEffect2(() => {
|
|
2991
3218
|
const sync = () => {
|
|
@@ -3010,13 +3237,13 @@ function useSidebarWidth(storageKey = SUITE_SIDEBAR_WIDTH_KEY, defaultWidth = SI
|
|
|
3010
3237
|
media.addEventListener("change", sync);
|
|
3011
3238
|
return () => media.removeEventListener("change", sync);
|
|
3012
3239
|
}, []);
|
|
3013
|
-
const persist =
|
|
3240
|
+
const persist = useCallback4(
|
|
3014
3241
|
(value) => {
|
|
3015
3242
|
persistSidebarWidth(storageKey, value);
|
|
3016
3243
|
},
|
|
3017
3244
|
[storageKey]
|
|
3018
3245
|
);
|
|
3019
|
-
const setCollapsed =
|
|
3246
|
+
const setCollapsed = useCallback4(
|
|
3020
3247
|
(value) => {
|
|
3021
3248
|
setWidth((current) => {
|
|
3022
3249
|
const next = value ? SIDEBAR_RAIL_WIDTH : current <= SIDEBAR_COLLAPSE_THRESHOLD ? fallbackWidth : snapWidth(current);
|
|
@@ -3026,11 +3253,11 @@ function useSidebarWidth(storageKey = SUITE_SIDEBAR_WIDTH_KEY, defaultWidth = SI
|
|
|
3026
3253
|
},
|
|
3027
3254
|
[fallbackWidth, persist]
|
|
3028
3255
|
);
|
|
3029
|
-
const resetWidth =
|
|
3256
|
+
const resetWidth = useCallback4(() => {
|
|
3030
3257
|
setWidth(fallbackWidth);
|
|
3031
3258
|
persist(fallbackWidth);
|
|
3032
3259
|
}, [fallbackWidth, persist]);
|
|
3033
|
-
const startResize =
|
|
3260
|
+
const startResize = useCallback4(
|
|
3034
3261
|
(event) => {
|
|
3035
3262
|
event.preventDefault();
|
|
3036
3263
|
const startX = event.clientX;
|
|
@@ -3052,7 +3279,7 @@ function useSidebarWidth(storageKey = SUITE_SIDEBAR_WIDTH_KEY, defaultWidth = SI
|
|
|
3052
3279
|
},
|
|
3053
3280
|
[persist, width]
|
|
3054
3281
|
);
|
|
3055
|
-
const resizeBy =
|
|
3282
|
+
const resizeBy = useCallback4(
|
|
3056
3283
|
(delta) => {
|
|
3057
3284
|
setWidth((current) => {
|
|
3058
3285
|
const next = clampWidth(current + delta);
|
|
@@ -3067,9 +3294,9 @@ function useSidebarWidth(storageKey = SUITE_SIDEBAR_WIDTH_KEY, defaultWidth = SI
|
|
|
3067
3294
|
|
|
3068
3295
|
// src/suite/lib/motion.tsx
|
|
3069
3296
|
import { LazyMotion, domAnimation, m } from "motion/react";
|
|
3070
|
-
import { jsx as
|
|
3297
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3071
3298
|
function SuiteMotionProvider({ children }) {
|
|
3072
|
-
return /* @__PURE__ */
|
|
3299
|
+
return /* @__PURE__ */ jsx20(LazyMotion, { features: domAnimation, strict: true, children });
|
|
3073
3300
|
}
|
|
3074
3301
|
var SUITE_SPRINGS = {
|
|
3075
3302
|
/** Snappy panel/sheet entrances — small overshoot. */
|
|
@@ -3081,24 +3308,24 @@ var SUITE_SPRINGS = {
|
|
|
3081
3308
|
};
|
|
3082
3309
|
|
|
3083
3310
|
// src/suite/components/suite-skeleton.tsx
|
|
3084
|
-
import { jsx as
|
|
3311
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3085
3312
|
function SuiteSkeleton({
|
|
3086
3313
|
className,
|
|
3087
3314
|
lines = 1,
|
|
3088
3315
|
circle,
|
|
3089
3316
|
width
|
|
3090
3317
|
}) {
|
|
3091
|
-
return /* @__PURE__ */
|
|
3318
|
+
return /* @__PURE__ */ jsx21(
|
|
3092
3319
|
"div",
|
|
3093
3320
|
{
|
|
3094
3321
|
className: cn2("space-y-2", circle ? "flex flex-col items-center" : ""),
|
|
3095
3322
|
"aria-hidden": true,
|
|
3096
|
-
children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */
|
|
3323
|
+
children: Array.from({ length: lines }).map((_, index) => /* @__PURE__ */ jsx21(
|
|
3097
3324
|
"div",
|
|
3098
3325
|
{
|
|
3099
3326
|
className: "animate-[skeleton-stagger_0.6s_ease-out_both]",
|
|
3100
3327
|
style: { animationDelay: `${index * 80}ms` },
|
|
3101
|
-
children: /* @__PURE__ */
|
|
3328
|
+
children: /* @__PURE__ */ jsx21(
|
|
3102
3329
|
"div",
|
|
3103
3330
|
{
|
|
3104
3331
|
className: cn2(
|
|
@@ -3137,20 +3364,20 @@ function SuiteSkeletonCard({
|
|
|
3137
3364
|
className: "mb-5 flex items-center gap-3 animate-[skeleton-stagger_0.5s_ease-out_both]",
|
|
3138
3365
|
style: { animationDelay: "100ms" },
|
|
3139
3366
|
children: [
|
|
3140
|
-
/* @__PURE__ */
|
|
3367
|
+
/* @__PURE__ */ jsx21("div", { className: "ph-skeleton h-10 w-10 rounded-xl" }),
|
|
3141
3368
|
/* @__PURE__ */ jsxs17("div", { className: "flex-1 space-y-2", children: [
|
|
3142
|
-
/* @__PURE__ */
|
|
3143
|
-
/* @__PURE__ */
|
|
3369
|
+
/* @__PURE__ */ jsx21("div", { className: "ph-skeleton h-4 w-1/3" }),
|
|
3370
|
+
/* @__PURE__ */ jsx21("div", { className: "ph-skeleton h-3 w-1/2" })
|
|
3144
3371
|
] })
|
|
3145
3372
|
]
|
|
3146
3373
|
}
|
|
3147
3374
|
) : null,
|
|
3148
|
-
/* @__PURE__ */
|
|
3375
|
+
/* @__PURE__ */ jsx21("div", { className: "space-y-3", children: Array.from({ length: rows }).map((_, index) => /* @__PURE__ */ jsx21(
|
|
3149
3376
|
"div",
|
|
3150
3377
|
{
|
|
3151
3378
|
className: "animate-[skeleton-stagger_0.5s_ease-out_both]",
|
|
3152
3379
|
style: { animationDelay: `${200 + index * 80}ms` },
|
|
3153
|
-
children: /* @__PURE__ */
|
|
3380
|
+
children: /* @__PURE__ */ jsx21(
|
|
3154
3381
|
"div",
|
|
3155
3382
|
{
|
|
3156
3383
|
className: "ph-skeleton h-3",
|
|
@@ -3168,16 +3395,16 @@ function SuiteSkeletonList({
|
|
|
3168
3395
|
className,
|
|
3169
3396
|
items = 4
|
|
3170
3397
|
}) {
|
|
3171
|
-
return /* @__PURE__ */
|
|
3398
|
+
return /* @__PURE__ */ jsx21("div", { className: cn2("space-y-3", className), "aria-hidden": true, children: Array.from({ length: items }).map((_, index) => /* @__PURE__ */ jsx21(
|
|
3172
3399
|
"div",
|
|
3173
3400
|
{
|
|
3174
3401
|
className: "animate-[skeleton-stagger_0.6s_ease-out_both]",
|
|
3175
3402
|
style: { animationDelay: `${index * 100}ms` },
|
|
3176
3403
|
children: /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-3 rounded-xl border border-ph-border bg-ph-surface p-4", children: [
|
|
3177
|
-
/* @__PURE__ */
|
|
3404
|
+
/* @__PURE__ */ jsx21("div", { className: "ph-skeleton h-10 w-10 rounded-lg" }),
|
|
3178
3405
|
/* @__PURE__ */ jsxs17("div", { className: "min-w-0 flex-1 space-y-2", children: [
|
|
3179
|
-
/* @__PURE__ */
|
|
3180
|
-
/* @__PURE__ */
|
|
3406
|
+
/* @__PURE__ */ jsx21("div", { className: "ph-skeleton h-3.5 w-3/4" }),
|
|
3407
|
+
/* @__PURE__ */ jsx21("div", { className: "ph-skeleton h-3 w-1/2" })
|
|
3181
3408
|
] })
|
|
3182
3409
|
] })
|
|
3183
3410
|
},
|
|
@@ -3202,12 +3429,12 @@ function SuiteEmptyState({
|
|
|
3202
3429
|
),
|
|
3203
3430
|
children: [
|
|
3204
3431
|
/* @__PURE__ */ jsxs17("div", { className: "pointer-events-none absolute inset-0 overflow-hidden opacity-60", "aria-hidden": true, children: [
|
|
3205
|
-
/* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3432
|
+
/* @__PURE__ */ jsx21("div", { className: "absolute -left-10 -top-10 h-40 w-40 rounded-full bg-ph-brand/10 blur-3xl" }),
|
|
3433
|
+
/* @__PURE__ */ jsx21("div", { className: "absolute -bottom-10 -right-10 h-40 w-40 rounded-full bg-ph-accent/10 blur-3xl" })
|
|
3207
3434
|
] }),
|
|
3208
3435
|
/* @__PURE__ */ jsxs17("div", { className: "relative", children: [
|
|
3209
|
-
icon ? /* @__PURE__ */
|
|
3210
|
-
/* @__PURE__ */
|
|
3436
|
+
icon ? /* @__PURE__ */ jsx21("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,
|
|
3437
|
+
/* @__PURE__ */ jsx21(
|
|
3211
3438
|
"h2",
|
|
3212
3439
|
{
|
|
3213
3440
|
className: cn2(
|
|
@@ -3217,8 +3444,8 @@ function SuiteEmptyState({
|
|
|
3217
3444
|
children: title
|
|
3218
3445
|
}
|
|
3219
3446
|
),
|
|
3220
|
-
description ? /* @__PURE__ */
|
|
3221
|
-
action ? /* @__PURE__ */
|
|
3447
|
+
description ? /* @__PURE__ */ jsx21("p", { className: "mx-auto mt-2 max-w-sm text-sm leading-relaxed text-ph-subtle", children: description }) : null,
|
|
3448
|
+
action ? /* @__PURE__ */ jsx21("div", { className: "mt-5 flex flex-wrap items-center justify-center gap-2", children: action }) : null
|
|
3222
3449
|
] })
|
|
3223
3450
|
]
|
|
3224
3451
|
}
|
|
@@ -3227,7 +3454,7 @@ function SuiteEmptyState({
|
|
|
3227
3454
|
|
|
3228
3455
|
// src/suite/components/suite-settings-mobile-nav.tsx
|
|
3229
3456
|
import { isValidElement } from "react";
|
|
3230
|
-
import { jsx as
|
|
3457
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3231
3458
|
function SuiteSettingsMobileNav({
|
|
3232
3459
|
items,
|
|
3233
3460
|
activeHref,
|
|
@@ -3236,16 +3463,16 @@ function SuiteSettingsMobileNav({
|
|
|
3236
3463
|
ariaLabel = "Settings sections",
|
|
3237
3464
|
className
|
|
3238
3465
|
}) {
|
|
3239
|
-
return /* @__PURE__ */
|
|
3466
|
+
return /* @__PURE__ */ jsx22(
|
|
3240
3467
|
"nav",
|
|
3241
3468
|
{
|
|
3242
3469
|
"data-test": dataTest,
|
|
3243
3470
|
"aria-label": ariaLabel,
|
|
3244
3471
|
className: cn2("suite-settings-mobile-nav lg:hidden", className),
|
|
3245
|
-
children: /* @__PURE__ */
|
|
3472
|
+
children: /* @__PURE__ */ jsx22("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) => {
|
|
3246
3473
|
const Icon = item.icon;
|
|
3247
3474
|
const active = activeHref === item.href || activeHref.startsWith(`${item.href}/`);
|
|
3248
|
-
const iconNode = isValidElement(item.icon) ? item.icon : /* @__PURE__ */
|
|
3475
|
+
const iconNode = isValidElement(item.icon) ? item.icon : /* @__PURE__ */ jsx22(
|
|
3249
3476
|
Icon,
|
|
3250
3477
|
{
|
|
3251
3478
|
className: cn2(
|
|
@@ -3270,8 +3497,8 @@ function SuiteSettingsMobileNav({
|
|
|
3270
3497
|
),
|
|
3271
3498
|
children: [
|
|
3272
3499
|
iconNode,
|
|
3273
|
-
/* @__PURE__ */
|
|
3274
|
-
active ? /* @__PURE__ */
|
|
3500
|
+
/* @__PURE__ */ jsx22("span", { className: "whitespace-nowrap", children: item.label }),
|
|
3501
|
+
active ? /* @__PURE__ */ jsx22("span", { className: "absolute inset-x-0 -bottom-3 h-0.5 rounded-full bg-ph-ink lg:hidden" }) : null
|
|
3275
3502
|
]
|
|
3276
3503
|
},
|
|
3277
3504
|
item.href
|
|
@@ -3283,9 +3510,9 @@ function SuiteSettingsMobileNav({
|
|
|
3283
3510
|
|
|
3284
3511
|
// src/suite/components/suite-sidebar.tsx
|
|
3285
3512
|
import Link2 from "next/link";
|
|
3286
|
-
import { useCallback as
|
|
3513
|
+
import { useCallback as useCallback5, useEffect as useEffect8 } from "react";
|
|
3287
3514
|
import { NavArrowLeft, Sparks as Sparks2 } from "iconoir-react";
|
|
3288
|
-
import { Fragment as Fragment7, jsx as
|
|
3515
|
+
import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3289
3516
|
function renderNode(node, collapsed) {
|
|
3290
3517
|
if (typeof node === "function") return node(collapsed);
|
|
3291
3518
|
return node;
|
|
@@ -3308,14 +3535,14 @@ function SuiteSidebar({
|
|
|
3308
3535
|
}) {
|
|
3309
3536
|
const showAskAi = Boolean(onAskAiOpenChange && askAi);
|
|
3310
3537
|
const chatOpen = showAskAi && askAiOpen && !collapsed;
|
|
3311
|
-
const setAskAi =
|
|
3538
|
+
const setAskAi = useCallback5(
|
|
3312
3539
|
(next) => {
|
|
3313
3540
|
persistSuiteAskAiOpen(next);
|
|
3314
3541
|
onAskAiOpenChange == null ? void 0 : onAskAiOpenChange(next);
|
|
3315
3542
|
},
|
|
3316
3543
|
[onAskAiOpenChange]
|
|
3317
3544
|
);
|
|
3318
|
-
|
|
3545
|
+
useEffect8(() => {
|
|
3319
3546
|
if (!onAskAiOpenChange) return;
|
|
3320
3547
|
function onOpen() {
|
|
3321
3548
|
onRequestExpand == null ? void 0 : onRequestExpand();
|
|
@@ -3324,7 +3551,7 @@ function SuiteSidebar({
|
|
|
3324
3551
|
window.addEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
|
|
3325
3552
|
return () => window.removeEventListener(SUITE_OPEN_ASK_AI_EVENT, onOpen);
|
|
3326
3553
|
}, [onAskAiOpenChange, onRequestExpand, setAskAi]);
|
|
3327
|
-
|
|
3554
|
+
useEffect8(() => {
|
|
3328
3555
|
if (!chatOpen) return;
|
|
3329
3556
|
function onKey(event) {
|
|
3330
3557
|
if (event.key === "Escape") setAskAi(false);
|
|
@@ -3340,7 +3567,7 @@ function SuiteSidebar({
|
|
|
3340
3567
|
if (collapsed) onRequestExpand == null ? void 0 : onRequestExpand();
|
|
3341
3568
|
setAskAi(true);
|
|
3342
3569
|
}
|
|
3343
|
-
const askAiButton = /* @__PURE__ */
|
|
3570
|
+
const askAiButton = /* @__PURE__ */ jsx23(
|
|
3344
3571
|
"button",
|
|
3345
3572
|
{
|
|
3346
3573
|
type: "button",
|
|
@@ -3352,7 +3579,7 @@ function SuiteSidebar({
|
|
|
3352
3579
|
"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-lg transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ph-focus-ring",
|
|
3353
3580
|
askAiOpen ? "bg-ph-brand/10 text-ph-brand" : "text-ph-mutedtext hover:bg-ph-muted hover:text-ph-ink"
|
|
3354
3581
|
),
|
|
3355
|
-
children: /* @__PURE__ */
|
|
3582
|
+
children: /* @__PURE__ */ jsx23(Sparks2, { className: "h-4 w-4", "aria-hidden": true })
|
|
3356
3583
|
}
|
|
3357
3584
|
);
|
|
3358
3585
|
if (chatOpen) {
|
|
@@ -3374,7 +3601,7 @@ function SuiteSidebar({
|
|
|
3374
3601
|
surface ? "bg-ph-surface" : "bg-ph-canvas"
|
|
3375
3602
|
),
|
|
3376
3603
|
children: [
|
|
3377
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx23(
|
|
3378
3605
|
"button",
|
|
3379
3606
|
{
|
|
3380
3607
|
type: "button",
|
|
@@ -3382,14 +3609,14 @@ function SuiteSidebar({
|
|
|
3382
3609
|
"aria-label": "Back to navigation",
|
|
3383
3610
|
onClick: () => setAskAi(false),
|
|
3384
3611
|
className: "inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-ph-subtle transition-colors hover:bg-ph-muted hover:text-ph-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-brand",
|
|
3385
|
-
children: /* @__PURE__ */
|
|
3612
|
+
children: /* @__PURE__ */ jsx23(NavArrowLeft, { className: "h-4 w-4", "aria-hidden": true })
|
|
3386
3613
|
}
|
|
3387
3614
|
),
|
|
3388
|
-
/* @__PURE__ */
|
|
3615
|
+
/* @__PURE__ */ jsx23("span", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-ph-ink", children: "Shelly AI" })
|
|
3389
3616
|
]
|
|
3390
3617
|
}
|
|
3391
3618
|
),
|
|
3392
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ jsx23("div", { className: "min-h-0 flex-1", children: askAi })
|
|
3393
3620
|
]
|
|
3394
3621
|
}
|
|
3395
3622
|
);
|
|
@@ -3412,8 +3639,8 @@ function SuiteSidebar({
|
|
|
3412
3639
|
collapsed ? "flex-col items-center gap-1 px-1 py-2" : "h-14 items-center justify-between gap-2 px-3"
|
|
3413
3640
|
),
|
|
3414
3641
|
children: [
|
|
3415
|
-
/* @__PURE__ */
|
|
3416
|
-
collapsed ? null : /* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsx23("div", { className: cn2("min-w-0", collapsed ? "shrink-0" : "flex-1"), children: renderNode(appSwitcher, collapsed) }),
|
|
3643
|
+
collapsed ? null : /* @__PURE__ */ jsx23("div", { className: "shrink-0", children: renderNode(notificationBell, collapsed) })
|
|
3417
3644
|
]
|
|
3418
3645
|
}
|
|
3419
3646
|
) : null,
|
|
@@ -3427,7 +3654,7 @@ function SuiteSidebar({
|
|
|
3427
3654
|
collapsed ? "px-1.5 py-2" : "p-3"
|
|
3428
3655
|
),
|
|
3429
3656
|
children: [
|
|
3430
|
-
contextSwitcher ? /* @__PURE__ */
|
|
3657
|
+
contextSwitcher ? /* @__PURE__ */ jsx23(
|
|
3431
3658
|
"div",
|
|
3432
3659
|
{
|
|
3433
3660
|
className: cn2(
|
|
@@ -3447,16 +3674,16 @@ function SuiteSidebar({
|
|
|
3447
3674
|
onClick: () => setAskAi(false),
|
|
3448
3675
|
className: "inline-flex h-9 items-center gap-1 rounded-lg px-2 text-sm font-medium text-ph-subtle transition-colors hover:bg-ph-muted hover:text-ph-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-brand",
|
|
3449
3676
|
children: [
|
|
3450
|
-
/* @__PURE__ */
|
|
3677
|
+
/* @__PURE__ */ jsx23(NavArrowLeft, { className: "h-4 w-4", "aria-hidden": true }),
|
|
3451
3678
|
"Nav"
|
|
3452
3679
|
]
|
|
3453
3680
|
}
|
|
3454
3681
|
),
|
|
3455
|
-
/* @__PURE__ */
|
|
3682
|
+
/* @__PURE__ */ jsx23("span", { className: "truncate text-sm font-semibold text-ph-ink", children: "Shelly AI" })
|
|
3456
3683
|
] }),
|
|
3457
|
-
/* @__PURE__ */
|
|
3684
|
+
/* @__PURE__ */ jsx23("div", { className: "min-h-0 flex-1", children: askAi })
|
|
3458
3685
|
] }) : /* @__PURE__ */ jsxs19(Fragment7, { children: [
|
|
3459
|
-
/* @__PURE__ */
|
|
3686
|
+
/* @__PURE__ */ jsx23("nav", { "aria-label": "Pages", className: "shrink-0 space-y-1", children: /* @__PURE__ */ jsx23("div", { className: "space-y-1", children: navItems.map((item) => {
|
|
3460
3687
|
var _a;
|
|
3461
3688
|
const Icon = item.icon;
|
|
3462
3689
|
const active = Boolean(item.active);
|
|
@@ -3474,7 +3701,7 @@ function SuiteSidebar({
|
|
|
3474
3701
|
collapsed ? "mx-auto size-11 shrink-0 justify-center gap-0 px-0 py-0" : "w-full px-2.5 py-2"
|
|
3475
3702
|
),
|
|
3476
3703
|
children: [
|
|
3477
|
-
/* @__PURE__ */
|
|
3704
|
+
/* @__PURE__ */ jsx23(
|
|
3478
3705
|
"span",
|
|
3479
3706
|
{
|
|
3480
3707
|
className: cn2(
|
|
@@ -3482,7 +3709,7 @@ function SuiteSidebar({
|
|
|
3482
3709
|
item.iconClassName
|
|
3483
3710
|
),
|
|
3484
3711
|
"aria-hidden": true,
|
|
3485
|
-
children: /* @__PURE__ */
|
|
3712
|
+
children: /* @__PURE__ */ jsx23(
|
|
3486
3713
|
Icon,
|
|
3487
3714
|
{
|
|
3488
3715
|
className: "h-full w-full",
|
|
@@ -3491,7 +3718,7 @@ function SuiteSidebar({
|
|
|
3491
3718
|
)
|
|
3492
3719
|
}
|
|
3493
3720
|
),
|
|
3494
|
-
/* @__PURE__ */
|
|
3721
|
+
/* @__PURE__ */ jsx23(
|
|
3495
3722
|
"span",
|
|
3496
3723
|
{
|
|
3497
3724
|
className: cn2(
|
|
@@ -3502,14 +3729,14 @@ function SuiteSidebar({
|
|
|
3502
3729
|
children: item.label
|
|
3503
3730
|
}
|
|
3504
3731
|
),
|
|
3505
|
-
!collapsed && item.badge ? /* @__PURE__ */
|
|
3732
|
+
!collapsed && item.badge ? /* @__PURE__ */ jsx23("span", { className: "relative ml-auto shrink-0", children: item.badge }) : null
|
|
3506
3733
|
]
|
|
3507
3734
|
},
|
|
3508
3735
|
item.label
|
|
3509
3736
|
);
|
|
3510
|
-
return collapsed ? /* @__PURE__ */
|
|
3737
|
+
return collapsed ? /* @__PURE__ */ jsx23(Tooltip, { content: item.label, side: "right", children: link }, item.label) : link;
|
|
3511
3738
|
}) }) }),
|
|
3512
|
-
secondaryNav ? /* @__PURE__ */
|
|
3739
|
+
secondaryNav ? /* @__PURE__ */ jsx23(
|
|
3513
3740
|
"div",
|
|
3514
3741
|
{
|
|
3515
3742
|
className: "min-h-0 flex-1",
|
|
@@ -3521,7 +3748,7 @@ function SuiteSidebar({
|
|
|
3521
3748
|
]
|
|
3522
3749
|
}
|
|
3523
3750
|
),
|
|
3524
|
-
/* @__PURE__ */
|
|
3751
|
+
/* @__PURE__ */ jsx23(
|
|
3525
3752
|
"div",
|
|
3526
3753
|
{
|
|
3527
3754
|
className: cn2(
|
|
@@ -3538,8 +3765,8 @@ function SuiteSidebar({
|
|
|
3538
3765
|
),
|
|
3539
3766
|
children: [
|
|
3540
3767
|
renderNode(userMenu, collapsed),
|
|
3541
|
-
showAskAi ? /* @__PURE__ */
|
|
3542
|
-
showAskAi && footerExtras ? /* @__PURE__ */
|
|
3768
|
+
showAskAi ? /* @__PURE__ */ jsx23("div", { className: cn2("shrink-0", collapsed ? "mt-2" : "ml-auto"), children: /* @__PURE__ */ jsx23(Tooltip, { content: "Shelly AI", side: collapsed ? "right" : "top", children: askAiButton }) }) : footerExtras ? /* @__PURE__ */ jsx23("div", { className: cn2("shrink-0", collapsed ? "mt-2" : "ml-auto"), children: renderNode(footerExtras, collapsed) }) : null,
|
|
3769
|
+
showAskAi && footerExtras ? /* @__PURE__ */ jsx23("div", { className: cn2("shrink-0", collapsed && "mt-2"), children: renderNode(footerExtras, collapsed) }) : null
|
|
3543
3770
|
]
|
|
3544
3771
|
}
|
|
3545
3772
|
)
|
|
@@ -3551,7 +3778,7 @@ function SuiteSidebar({
|
|
|
3551
3778
|
}
|
|
3552
3779
|
|
|
3553
3780
|
// src/suite/components/suite-app-layout.tsx
|
|
3554
|
-
import { jsx as
|
|
3781
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3555
3782
|
function SuiteAppLayout({
|
|
3556
3783
|
sidebar,
|
|
3557
3784
|
children,
|
|
@@ -3582,8 +3809,8 @@ function SuiteAppLayout({
|
|
|
3582
3809
|
style: { width: `${sidebarWidth}px` },
|
|
3583
3810
|
"data-collapsed": collapsed ? "true" : "false",
|
|
3584
3811
|
children: [
|
|
3585
|
-
/* @__PURE__ */
|
|
3586
|
-
onStartResize ? /* @__PURE__ */
|
|
3812
|
+
/* @__PURE__ */ jsx24("div", { className: "relative z-0 h-full min-h-0 isolate", children: sidebar }),
|
|
3813
|
+
onStartResize ? /* @__PURE__ */ jsx24(
|
|
3587
3814
|
"div",
|
|
3588
3815
|
{
|
|
3589
3816
|
role: "separator",
|
|
@@ -3616,8 +3843,8 @@ function SuiteAppLayout({
|
|
|
3616
3843
|
}
|
|
3617
3844
|
),
|
|
3618
3845
|
/* @__PURE__ */ jsxs20("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
|
|
3619
|
-
mobileHeader ? /* @__PURE__ */
|
|
3620
|
-
/* @__PURE__ */
|
|
3846
|
+
mobileHeader ? /* @__PURE__ */ jsx24("div", { className: "shrink-0 lg:hidden", children: mobileHeader }) : null,
|
|
3847
|
+
/* @__PURE__ */ jsx24(
|
|
3621
3848
|
"main",
|
|
3622
3849
|
{
|
|
3623
3850
|
id: "main-content",
|
|
@@ -3631,7 +3858,7 @@ function SuiteAppLayout({
|
|
|
3631
3858
|
children
|
|
3632
3859
|
}
|
|
3633
3860
|
),
|
|
3634
|
-
bottomNav ? /* @__PURE__ */
|
|
3861
|
+
bottomNav ? /* @__PURE__ */ jsx24("div", { className: "shrink-0 lg:hidden", children: bottomNav }) : null
|
|
3635
3862
|
] })
|
|
3636
3863
|
]
|
|
3637
3864
|
}
|
|
@@ -3640,10 +3867,10 @@ function SuiteAppLayout({
|
|
|
3640
3867
|
|
|
3641
3868
|
// src/suite/components/suite-integration-picker.tsx
|
|
3642
3869
|
import {
|
|
3643
|
-
useEffect as
|
|
3644
|
-
useMemo,
|
|
3645
|
-
useRef as
|
|
3646
|
-
useState as
|
|
3870
|
+
useEffect as useEffect9,
|
|
3871
|
+
useMemo as useMemo2,
|
|
3872
|
+
useRef as useRef4,
|
|
3873
|
+
useState as useState11
|
|
3647
3874
|
} from "react";
|
|
3648
3875
|
import {
|
|
3649
3876
|
EvPlug as Plug,
|
|
@@ -3653,7 +3880,7 @@ import {
|
|
|
3653
3880
|
Search,
|
|
3654
3881
|
Xmark
|
|
3655
3882
|
} from "iconoir-react";
|
|
3656
|
-
import { Fragment as Fragment8, jsx as
|
|
3883
|
+
import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3657
3884
|
var DESCRIPTION_LIMIT = 90;
|
|
3658
3885
|
function IntegrationSkeletonCard() {
|
|
3659
3886
|
return /* @__PURE__ */ jsxs21(
|
|
@@ -3663,14 +3890,14 @@ function IntegrationSkeletonCard() {
|
|
|
3663
3890
|
"aria-hidden": "true",
|
|
3664
3891
|
children: [
|
|
3665
3892
|
/* @__PURE__ */ jsxs21("div", { className: "flex items-start gap-3", children: [
|
|
3666
|
-
/* @__PURE__ */
|
|
3893
|
+
/* @__PURE__ */ jsx25("div", { className: "h-10 w-10 shrink-0 rounded-lg bg-ph-muted" }),
|
|
3667
3894
|
/* @__PURE__ */ jsxs21("div", { className: "min-w-0 flex-1 space-y-2 pt-1", children: [
|
|
3668
|
-
/* @__PURE__ */
|
|
3669
|
-
/* @__PURE__ */
|
|
3670
|
-
/* @__PURE__ */
|
|
3895
|
+
/* @__PURE__ */ jsx25("div", { className: "h-4 w-3/5 rounded bg-ph-muted" }),
|
|
3896
|
+
/* @__PURE__ */ jsx25("div", { className: "h-3 w-full rounded bg-ph-muted" }),
|
|
3897
|
+
/* @__PURE__ */ jsx25("div", { className: "h-3 w-4/5 rounded bg-ph-muted" })
|
|
3671
3898
|
] })
|
|
3672
3899
|
] }),
|
|
3673
|
-
/* @__PURE__ */
|
|
3900
|
+
/* @__PURE__ */ jsx25("div", { className: "mt-3 h-9 w-20 rounded bg-ph-muted" })
|
|
3674
3901
|
]
|
|
3675
3902
|
}
|
|
3676
3903
|
);
|
|
@@ -3745,33 +3972,33 @@ function SuiteIntegrationPicker({
|
|
|
3745
3972
|
description = "Connect an app to this workspace securely.",
|
|
3746
3973
|
dataTest = "suite-integration-picker"
|
|
3747
3974
|
}) {
|
|
3748
|
-
const [query, setQuery] =
|
|
3749
|
-
const [category, setCategory] =
|
|
3750
|
-
const [categoryQuery, setCategoryQuery] =
|
|
3751
|
-
const [categoryMenuOpen, setCategoryMenuOpen] =
|
|
3752
|
-
const [expanded, setExpanded] =
|
|
3753
|
-
const categoryMenuRef =
|
|
3754
|
-
const categoryTriggerRef =
|
|
3755
|
-
const categorySearchRef =
|
|
3756
|
-
const categoryOptionRefs =
|
|
3757
|
-
const pendingCategoryFocus =
|
|
3975
|
+
const [query, setQuery] = useState11("");
|
|
3976
|
+
const [category, setCategory] = useState11("all");
|
|
3977
|
+
const [categoryQuery, setCategoryQuery] = useState11("");
|
|
3978
|
+
const [categoryMenuOpen, setCategoryMenuOpen] = useState11(false);
|
|
3979
|
+
const [expanded, setExpanded] = useState11(null);
|
|
3980
|
+
const categoryMenuRef = useRef4(null);
|
|
3981
|
+
const categoryTriggerRef = useRef4(null);
|
|
3982
|
+
const categorySearchRef = useRef4(null);
|
|
3983
|
+
const categoryOptionRefs = useRef4({});
|
|
3984
|
+
const pendingCategoryFocus = useRef4(
|
|
3758
3985
|
null
|
|
3759
3986
|
);
|
|
3760
|
-
const scrollViewportRef =
|
|
3761
|
-
const loadMoreSentinelRef =
|
|
3762
|
-
const loadMoreInFlightRef =
|
|
3763
|
-
const authRequestRef =
|
|
3764
|
-
const [methodItem, setMethodItem] =
|
|
3765
|
-
const [authItem, setAuthItem] =
|
|
3766
|
-
const [authValues, setAuthValues] =
|
|
3767
|
-
const [authLoading, setAuthLoading] =
|
|
3768
|
-
const [authSubmitting, setAuthSubmitting] =
|
|
3769
|
-
const [authError, setAuthError] =
|
|
3770
|
-
const [connectionError, setConnectionError] =
|
|
3771
|
-
const [itemToDisconnect, setItemToDisconnect] =
|
|
3772
|
-
const [disconnecting, setDisconnecting] =
|
|
3773
|
-
const [disconnectError, setDisconnectError] =
|
|
3774
|
-
const itemCategories =
|
|
3987
|
+
const scrollViewportRef = useRef4(null);
|
|
3988
|
+
const loadMoreSentinelRef = useRef4(null);
|
|
3989
|
+
const loadMoreInFlightRef = useRef4(false);
|
|
3990
|
+
const authRequestRef = useRef4(0);
|
|
3991
|
+
const [methodItem, setMethodItem] = useState11(null);
|
|
3992
|
+
const [authItem, setAuthItem] = useState11(null);
|
|
3993
|
+
const [authValues, setAuthValues] = useState11({});
|
|
3994
|
+
const [authLoading, setAuthLoading] = useState11(false);
|
|
3995
|
+
const [authSubmitting, setAuthSubmitting] = useState11(false);
|
|
3996
|
+
const [authError, setAuthError] = useState11(null);
|
|
3997
|
+
const [connectionError, setConnectionError] = useState11(null);
|
|
3998
|
+
const [itemToDisconnect, setItemToDisconnect] = useState11(null);
|
|
3999
|
+
const [disconnecting, setDisconnecting] = useState11(false);
|
|
4000
|
+
const [disconnectError, setDisconnectError] = useState11(null);
|
|
4001
|
+
const itemCategories = useMemo2(
|
|
3775
4002
|
() => Array.from(
|
|
3776
4003
|
new Set(items.flatMap((item) => {
|
|
3777
4004
|
var _a;
|
|
@@ -3952,7 +4179,7 @@ function SuiteIntegrationPicker({
|
|
|
3952
4179
|
setAuthSubmitting(false);
|
|
3953
4180
|
}
|
|
3954
4181
|
}
|
|
3955
|
-
|
|
4182
|
+
useEffect9(() => {
|
|
3956
4183
|
if (!categoryMenuOpen) return;
|
|
3957
4184
|
const handlePointerDown = (event) => {
|
|
3958
4185
|
var _a;
|
|
@@ -3970,7 +4197,7 @@ function SuiteIntegrationPicker({
|
|
|
3970
4197
|
document.removeEventListener("keydown", handleKeyDown);
|
|
3971
4198
|
};
|
|
3972
4199
|
}, [categoryMenuOpen]);
|
|
3973
|
-
|
|
4200
|
+
useEffect9(() => {
|
|
3974
4201
|
var _a, _b, _c;
|
|
3975
4202
|
const target = pendingCategoryFocus.current;
|
|
3976
4203
|
if (!target) return;
|
|
@@ -3979,10 +4206,10 @@ function SuiteIntegrationPicker({
|
|
|
3979
4206
|
else if (target === "search") (_b = categorySearchRef.current) == null ? void 0 : _b.focus();
|
|
3980
4207
|
else (_c = categoryOptionRefs.current[target]) == null ? void 0 : _c.focus();
|
|
3981
4208
|
}, [activeCategory, categoryMenuOpen, categoryQuery, visibleCategories]);
|
|
3982
|
-
|
|
4209
|
+
useEffect9(() => {
|
|
3983
4210
|
if (!loadingMore) loadMoreInFlightRef.current = false;
|
|
3984
4211
|
}, [loadingMore]);
|
|
3985
|
-
|
|
4212
|
+
useEffect9(() => {
|
|
3986
4213
|
const root = scrollViewportRef.current;
|
|
3987
4214
|
const sentinel = loadMoreSentinelRef.current;
|
|
3988
4215
|
if (!open || !root || !sentinel || !hasMore || !onEndReached || loading || catalogLoading || loadingMore) {
|
|
@@ -4001,7 +4228,7 @@ function SuiteIntegrationPicker({
|
|
|
4001
4228
|
return () => observer.disconnect();
|
|
4002
4229
|
}, [catalogLoading, hasMore, loading, loadingMore, onEndReached, open]);
|
|
4003
4230
|
return /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
4004
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ jsx25(
|
|
4005
4232
|
Modal,
|
|
4006
4233
|
{
|
|
4007
4234
|
open,
|
|
@@ -4012,17 +4239,17 @@ function SuiteIntegrationPicker({
|
|
|
4012
4239
|
dataTest,
|
|
4013
4240
|
bodyClassName: "!overflow-hidden",
|
|
4014
4241
|
children: /* @__PURE__ */ jsxs21("div", { className: "space-y-4", children: [
|
|
4015
|
-
connectionError ? /* @__PURE__ */
|
|
4242
|
+
connectionError ? /* @__PURE__ */ jsx25("p", { className: "text-sm text-ph-danger", role: "alert", children: connectionError }) : null,
|
|
4016
4243
|
/* @__PURE__ */ jsxs21("div", { className: "grid gap-4 md:grid-cols-2", children: [
|
|
4017
4244
|
/* @__PURE__ */ jsxs21("div", { className: "relative", children: [
|
|
4018
|
-
/* @__PURE__ */
|
|
4245
|
+
/* @__PURE__ */ jsx25(
|
|
4019
4246
|
Search,
|
|
4020
4247
|
{
|
|
4021
4248
|
className: "pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-ph-subtle",
|
|
4022
4249
|
"aria-hidden": true
|
|
4023
4250
|
}
|
|
4024
4251
|
),
|
|
4025
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx25(
|
|
4026
4253
|
Input,
|
|
4027
4254
|
{
|
|
4028
4255
|
value: activeSearch,
|
|
@@ -4055,16 +4282,16 @@ function SuiteIntegrationPicker({
|
|
|
4055
4282
|
onKeyDown: handleCategoryTriggerKeyDown,
|
|
4056
4283
|
children: [
|
|
4057
4284
|
/* @__PURE__ */ jsxs21("span", { className: "flex items-center gap-2", children: [
|
|
4058
|
-
/* @__PURE__ */
|
|
4285
|
+
/* @__PURE__ */ jsx25(
|
|
4059
4286
|
Filter,
|
|
4060
4287
|
{
|
|
4061
4288
|
className: "h-4 w-4 shrink-0 text-ph-subtle",
|
|
4062
4289
|
"aria-hidden": true
|
|
4063
4290
|
}
|
|
4064
4291
|
),
|
|
4065
|
-
/* @__PURE__ */
|
|
4292
|
+
/* @__PURE__ */ jsx25("span", { children: activeCategory === "all" ? "All apps" : categoryLabel(activeCategory) })
|
|
4066
4293
|
] }),
|
|
4067
|
-
/* @__PURE__ */
|
|
4294
|
+
/* @__PURE__ */ jsx25(
|
|
4068
4295
|
NavArrowDown2,
|
|
4069
4296
|
{
|
|
4070
4297
|
className: `h-4 w-4 transition-transform ${categoryMenuOpen ? "rotate-180" : ""}`,
|
|
@@ -4079,7 +4306,7 @@ function SuiteIntegrationPicker({
|
|
|
4079
4306
|
{
|
|
4080
4307
|
className: "absolute z-20 mt-2 max-h-[min(22rem,calc(100dvh-12rem))] w-full max-w-full overflow-hidden rounded-lg border border-ph-border bg-ph-surface p-2 shadow-lg",
|
|
4081
4308
|
children: [
|
|
4082
|
-
/* @__PURE__ */
|
|
4309
|
+
/* @__PURE__ */ jsx25(
|
|
4083
4310
|
Input,
|
|
4084
4311
|
{
|
|
4085
4312
|
ref: categorySearchRef,
|
|
@@ -4099,7 +4326,7 @@ function SuiteIntegrationPicker({
|
|
|
4099
4326
|
}
|
|
4100
4327
|
}
|
|
4101
4328
|
),
|
|
4102
|
-
/* @__PURE__ */
|
|
4329
|
+
/* @__PURE__ */ jsx25(
|
|
4103
4330
|
"div",
|
|
4104
4331
|
{
|
|
4105
4332
|
id: `${dataTest}-category-options`,
|
|
@@ -4107,7 +4334,7 @@ function SuiteIntegrationPicker({
|
|
|
4107
4334
|
"aria-label": "Integration categories",
|
|
4108
4335
|
className: "mt-2 max-h-52 overflow-y-auto",
|
|
4109
4336
|
"data-test": "integration-category-options",
|
|
4110
|
-
children: categoryValues.map((value) => /* @__PURE__ */
|
|
4337
|
+
children: categoryValues.map((value) => /* @__PURE__ */ jsx25(
|
|
4111
4338
|
"button",
|
|
4112
4339
|
{
|
|
4113
4340
|
type: "button",
|
|
@@ -4145,12 +4372,12 @@ function SuiteIntegrationPicker({
|
|
|
4145
4372
|
ref: scrollViewportRef,
|
|
4146
4373
|
className: "min-h-0 max-h-[min(60vh,32rem)] w-full overflow-y-auto pr-1",
|
|
4147
4374
|
children: [
|
|
4148
|
-
loading || catalogLoading ? /* @__PURE__ */
|
|
4375
|
+
loading || catalogLoading ? /* @__PURE__ */ jsx25(
|
|
4149
4376
|
"div",
|
|
4150
4377
|
{
|
|
4151
4378
|
className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3",
|
|
4152
4379
|
"aria-label": "Loading apps",
|
|
4153
|
-
children: Array.from({ length: SKELETON_COUNT }, (_, index) => /* @__PURE__ */
|
|
4380
|
+
children: Array.from({ length: SKELETON_COUNT }, (_, index) => /* @__PURE__ */ jsx25(IntegrationSkeletonCard, {}, index))
|
|
4154
4381
|
}
|
|
4155
4382
|
) : /* @__PURE__ */ jsxs21("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: [
|
|
4156
4383
|
filtered.map((item) => {
|
|
@@ -4163,7 +4390,7 @@ function SuiteIntegrationPicker({
|
|
|
4163
4390
|
{
|
|
4164
4391
|
className: "flex min-h-36 min-w-0 flex-col justify-between rounded-xl border border-ph-border bg-ph-surface p-4",
|
|
4165
4392
|
children: [
|
|
4166
|
-
/* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsx25(
|
|
4167
4394
|
"button",
|
|
4168
4395
|
{
|
|
4169
4396
|
type: "button",
|
|
@@ -4171,30 +4398,30 @@ function SuiteIntegrationPicker({
|
|
|
4171
4398
|
onClick: () => longDescription && setExpanded(isExpanded ? null : item.id),
|
|
4172
4399
|
"aria-expanded": isExpanded,
|
|
4173
4400
|
children: /* @__PURE__ */ jsxs21("span", { className: "flex items-start gap-3", children: [
|
|
4174
|
-
/* @__PURE__ */
|
|
4401
|
+
/* @__PURE__ */ jsx25("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-ph-muted text-ph-ink", children: (_a = item.icon) != null ? _a : /* @__PURE__ */ jsx25(Plug, { className: "h-5 w-5", "aria-hidden": true }) }),
|
|
4175
4402
|
/* @__PURE__ */ jsxs21("span", { className: "min-w-0", children: [
|
|
4176
|
-
/* @__PURE__ */
|
|
4177
|
-
/* @__PURE__ */
|
|
4403
|
+
/* @__PURE__ */ jsx25("span", { className: "block truncate font-medium text-ph-ink", children: item.label }),
|
|
4404
|
+
/* @__PURE__ */ jsx25("span", { className: "mt-1 block text-xs text-ph-subtle", children: text }),
|
|
4178
4405
|
longDescription ? /* @__PURE__ */ jsxs21("span", { className: "mt-1 block text-xs font-medium text-ph-brand", children: [
|
|
4179
4406
|
isExpanded ? "See less" : "See more",
|
|
4180
4407
|
" ",
|
|
4181
|
-
isExpanded ? /* @__PURE__ */
|
|
4408
|
+
isExpanded ? /* @__PURE__ */ jsx25(NavArrowUp, { className: "inline h-3 w-3" }) : /* @__PURE__ */ jsx25(NavArrowDown2, { className: "inline h-3 w-3" })
|
|
4182
4409
|
] }) : null
|
|
4183
4410
|
] })
|
|
4184
4411
|
] })
|
|
4185
4412
|
}
|
|
4186
4413
|
),
|
|
4187
|
-
suiteAppsForIntegration(item.categories).length > 0 ? /* @__PURE__ */
|
|
4414
|
+
suiteAppsForIntegration(item.categories).length > 0 ? /* @__PURE__ */ jsx25(
|
|
4188
4415
|
"div",
|
|
4189
4416
|
{
|
|
4190
4417
|
className: "mt-3 flex flex-wrap items-center gap-1.5",
|
|
4191
4418
|
"aria-label": "Works with ShellStack apps",
|
|
4192
4419
|
children: suiteAppsForIntegration(item.categories).map(
|
|
4193
|
-
(app) => /* @__PURE__ */
|
|
4420
|
+
(app) => /* @__PURE__ */ jsx25(
|
|
4194
4421
|
"span",
|
|
4195
4422
|
{
|
|
4196
4423
|
"data-test": `${dataTest}-${item.id}-app-${app}`,
|
|
4197
|
-
children: /* @__PURE__ */
|
|
4424
|
+
children: /* @__PURE__ */ jsx25(
|
|
4198
4425
|
SuiteAppIcon,
|
|
4199
4426
|
{
|
|
4200
4427
|
app,
|
|
@@ -4209,12 +4436,12 @@ function SuiteIntegrationPicker({
|
|
|
4209
4436
|
)
|
|
4210
4437
|
}
|
|
4211
4438
|
) : null,
|
|
4212
|
-
authSchemesFor(item).length > 0 ? /* @__PURE__ */
|
|
4439
|
+
authSchemesFor(item).length > 0 ? /* @__PURE__ */ jsx25(
|
|
4213
4440
|
"div",
|
|
4214
4441
|
{
|
|
4215
4442
|
className: "mt-3 flex flex-wrap gap-1.5",
|
|
4216
4443
|
"aria-label": "Connection methods",
|
|
4217
|
-
children: authSchemesFor(item).map((scheme) => /* @__PURE__ */
|
|
4444
|
+
children: authSchemesFor(item).map((scheme) => /* @__PURE__ */ jsx25(
|
|
4218
4445
|
"span",
|
|
4219
4446
|
{
|
|
4220
4447
|
className: "rounded-full border border-ph-border bg-ph-muted px-2 py-1 text-[0.6875rem] font-medium text-ph-subtle",
|
|
@@ -4225,7 +4452,7 @@ function SuiteIntegrationPicker({
|
|
|
4225
4452
|
))
|
|
4226
4453
|
}
|
|
4227
4454
|
) : null,
|
|
4228
|
-
/* @__PURE__ */
|
|
4455
|
+
/* @__PURE__ */ jsx25(
|
|
4229
4456
|
Button,
|
|
4230
4457
|
{
|
|
4231
4458
|
type: "button",
|
|
@@ -4234,7 +4461,7 @@ function SuiteIntegrationPicker({
|
|
|
4234
4461
|
disabled: Boolean(item.unavailableReason) || item.connecting,
|
|
4235
4462
|
onClick: () => connectItem(item),
|
|
4236
4463
|
children: /* @__PURE__ */ jsxs21("span", { className: "flex items-center gap-1.5", children: [
|
|
4237
|
-
/* @__PURE__ */
|
|
4464
|
+
/* @__PURE__ */ jsx25(Plug, { className: "h-3.5 w-3.5", "aria-hidden": true }),
|
|
4238
4465
|
item.connecting ? "Connecting..." : (_b = item.unavailableReason) != null ? _b : "Connect"
|
|
4239
4466
|
] })
|
|
4240
4467
|
}
|
|
@@ -4244,14 +4471,14 @@ function SuiteIntegrationPicker({
|
|
|
4244
4471
|
item.id
|
|
4245
4472
|
);
|
|
4246
4473
|
}),
|
|
4247
|
-
loadingMore ? Array.from({ length: 3 }, (_, index) => /* @__PURE__ */
|
|
4474
|
+
loadingMore ? Array.from({ length: 3 }, (_, index) => /* @__PURE__ */ jsx25(IntegrationSkeletonCard, {}, `loading-${index}`)) : null
|
|
4248
4475
|
] }),
|
|
4249
|
-
/* @__PURE__ */
|
|
4476
|
+
/* @__PURE__ */ jsx25("div", { ref: loadMoreSentinelRef, className: "h-1", "aria-hidden": "true" })
|
|
4250
4477
|
]
|
|
4251
4478
|
}
|
|
4252
4479
|
),
|
|
4253
4480
|
connectedItems.length > 0 && onDisconnect ? /* @__PURE__ */ jsxs21("div", { className: "space-y-2 border-t border-ph-border pt-4", children: [
|
|
4254
|
-
/* @__PURE__ */
|
|
4481
|
+
/* @__PURE__ */ jsx25("h3", { className: "font-medium text-ph-ink", children: "Connected apps" }),
|
|
4255
4482
|
connectedItems.map((item) => /* @__PURE__ */ jsxs21(
|
|
4256
4483
|
"div",
|
|
4257
4484
|
{
|
|
@@ -4259,16 +4486,16 @@ function SuiteIntegrationPicker({
|
|
|
4259
4486
|
children: [
|
|
4260
4487
|
/* @__PURE__ */ jsxs21("span", { className: "flex min-w-0 items-center gap-2 text-sm text-ph-ink", children: [
|
|
4261
4488
|
item.icon,
|
|
4262
|
-
/* @__PURE__ */
|
|
4489
|
+
/* @__PURE__ */ jsx25("span", { className: "truncate", children: item.label })
|
|
4263
4490
|
] }),
|
|
4264
|
-
/* @__PURE__ */
|
|
4491
|
+
/* @__PURE__ */ jsx25(
|
|
4265
4492
|
Button,
|
|
4266
4493
|
{
|
|
4267
4494
|
type: "button",
|
|
4268
4495
|
variant: "danger",
|
|
4269
4496
|
onClick: () => requestDisconnect(item),
|
|
4270
4497
|
children: /* @__PURE__ */ jsxs21("span", { className: "flex items-center gap-1.5", children: [
|
|
4271
|
-
/* @__PURE__ */
|
|
4498
|
+
/* @__PURE__ */ jsx25(Xmark, { className: "h-4 w-4", "aria-hidden": true }),
|
|
4272
4499
|
"Disconnect"
|
|
4273
4500
|
] })
|
|
4274
4501
|
}
|
|
@@ -4294,7 +4521,7 @@ function SuiteIntegrationPicker({
|
|
|
4294
4521
|
zIndex: 220,
|
|
4295
4522
|
dataTest: `${dataTest}-disconnect-confirmation`,
|
|
4296
4523
|
footer: /* @__PURE__ */ jsxs21("div", { className: "flex justify-end gap-2", children: [
|
|
4297
|
-
/* @__PURE__ */
|
|
4524
|
+
/* @__PURE__ */ jsx25(
|
|
4298
4525
|
Button,
|
|
4299
4526
|
{
|
|
4300
4527
|
type: "button",
|
|
@@ -4304,7 +4531,7 @@ function SuiteIntegrationPicker({
|
|
|
4304
4531
|
children: "Cancel"
|
|
4305
4532
|
}
|
|
4306
4533
|
),
|
|
4307
|
-
/* @__PURE__ */
|
|
4534
|
+
/* @__PURE__ */ jsx25(
|
|
4308
4535
|
Button,
|
|
4309
4536
|
{
|
|
4310
4537
|
type: "button",
|
|
@@ -4317,7 +4544,7 @@ function SuiteIntegrationPicker({
|
|
|
4317
4544
|
)
|
|
4318
4545
|
] }),
|
|
4319
4546
|
children: [
|
|
4320
|
-
disconnectError ? /* @__PURE__ */
|
|
4547
|
+
disconnectError ? /* @__PURE__ */ jsx25("p", { className: "text-sm text-ph-danger", role: "alert", children: disconnectError }) : null,
|
|
4321
4548
|
/* @__PURE__ */ jsxs21("p", { className: "text-sm text-ph-ink", children: [
|
|
4322
4549
|
"Disconnect ",
|
|
4323
4550
|
itemToDisconnect == null ? void 0 : itemToDisconnect.label,
|
|
@@ -4326,7 +4553,7 @@ function SuiteIntegrationPicker({
|
|
|
4326
4553
|
]
|
|
4327
4554
|
}
|
|
4328
4555
|
),
|
|
4329
|
-
/* @__PURE__ */
|
|
4556
|
+
/* @__PURE__ */ jsx25(
|
|
4330
4557
|
Modal,
|
|
4331
4558
|
{
|
|
4332
4559
|
open: Boolean(methodItem),
|
|
@@ -4336,7 +4563,7 @@ function SuiteIntegrationPicker({
|
|
|
4336
4563
|
size: "sm",
|
|
4337
4564
|
zIndex: 200,
|
|
4338
4565
|
dataTest: `${dataTest}-auth-method`,
|
|
4339
|
-
children: methodItem ? /* @__PURE__ */
|
|
4566
|
+
children: methodItem ? /* @__PURE__ */ jsx25("div", { className: "space-y-2", children: authSchemesFor(methodItem).map((scheme) => /* @__PURE__ */ jsxs21(
|
|
4340
4567
|
"button",
|
|
4341
4568
|
{
|
|
4342
4569
|
type: "button",
|
|
@@ -4344,15 +4571,15 @@ function SuiteIntegrationPicker({
|
|
|
4344
4571
|
onClick: () => void prepareConnection(methodItem, scheme),
|
|
4345
4572
|
"data-test": `${dataTest}-choose-${scheme.toLowerCase()}`,
|
|
4346
4573
|
children: [
|
|
4347
|
-
/* @__PURE__ */
|
|
4348
|
-
/* @__PURE__ */
|
|
4574
|
+
/* @__PURE__ */ jsx25("span", { className: "font-medium", children: authSchemeLabel(scheme) }),
|
|
4575
|
+
/* @__PURE__ */ jsx25("span", { className: "text-xs text-ph-subtle", children: "Select" })
|
|
4349
4576
|
]
|
|
4350
4577
|
},
|
|
4351
4578
|
scheme
|
|
4352
4579
|
)) }) : null
|
|
4353
4580
|
}
|
|
4354
4581
|
),
|
|
4355
|
-
/* @__PURE__ */
|
|
4582
|
+
/* @__PURE__ */ jsx25(
|
|
4356
4583
|
Modal,
|
|
4357
4584
|
{
|
|
4358
4585
|
open: Boolean(authItem),
|
|
@@ -4362,14 +4589,14 @@ function SuiteIntegrationPicker({
|
|
|
4362
4589
|
size: "md",
|
|
4363
4590
|
zIndex: 210,
|
|
4364
4591
|
dataTest: `${dataTest}-auth-form`,
|
|
4365
|
-
children: authLoading ? /* @__PURE__ */
|
|
4592
|
+
children: authLoading ? /* @__PURE__ */ jsx25("p", { className: "text-sm text-ph-subtle", children: "Loading authentication fields..." }) : authItem ? /* @__PURE__ */ jsxs21(
|
|
4366
4593
|
"form",
|
|
4367
4594
|
{
|
|
4368
4595
|
className: "space-y-4",
|
|
4369
4596
|
onSubmit: (event) => void submitAuthForm(event),
|
|
4370
4597
|
children: [
|
|
4371
|
-
authError ? /* @__PURE__ */
|
|
4372
|
-
authItem.fields.length === 0 && authError ? /* @__PURE__ */
|
|
4598
|
+
authError ? /* @__PURE__ */ jsx25("p", { className: "text-sm text-ph-danger", role: "alert", children: authError }) : null,
|
|
4599
|
+
authItem.fields.length === 0 && authError ? /* @__PURE__ */ jsx25(
|
|
4373
4600
|
Button,
|
|
4374
4601
|
{
|
|
4375
4602
|
type: "button",
|
|
@@ -4380,7 +4607,7 @@ function SuiteIntegrationPicker({
|
|
|
4380
4607
|
) : null,
|
|
4381
4608
|
authItem.fields.map((field) => {
|
|
4382
4609
|
var _a, _b;
|
|
4383
|
-
return /* @__PURE__ */
|
|
4610
|
+
return /* @__PURE__ */ jsx25(
|
|
4384
4611
|
Input,
|
|
4385
4612
|
{
|
|
4386
4613
|
label: field.label,
|
|
@@ -4397,7 +4624,7 @@ function SuiteIntegrationPicker({
|
|
|
4397
4624
|
);
|
|
4398
4625
|
}),
|
|
4399
4626
|
/* @__PURE__ */ jsxs21("div", { className: "flex justify-end gap-2 border-t border-ph-border pt-4", children: [
|
|
4400
|
-
/* @__PURE__ */
|
|
4627
|
+
/* @__PURE__ */ jsx25(
|
|
4401
4628
|
Button,
|
|
4402
4629
|
{
|
|
4403
4630
|
type: "button",
|
|
@@ -4407,7 +4634,7 @@ function SuiteIntegrationPicker({
|
|
|
4407
4634
|
children: "Cancel"
|
|
4408
4635
|
}
|
|
4409
4636
|
),
|
|
4410
|
-
/* @__PURE__ */
|
|
4637
|
+
/* @__PURE__ */ jsx25(Button, { type: "submit", variant: "primary", disabled: authSubmitting, children: authSubmitting ? "Connecting..." : "Connect" })
|
|
4411
4638
|
] })
|
|
4412
4639
|
]
|
|
4413
4640
|
}
|
|
@@ -4418,9 +4645,9 @@ function SuiteIntegrationPicker({
|
|
|
4418
4645
|
}
|
|
4419
4646
|
|
|
4420
4647
|
// src/suite/components/suite-integration-rules.tsx
|
|
4421
|
-
import { useState as
|
|
4648
|
+
import { useState as useState12 } from "react";
|
|
4422
4649
|
import { Plus, Xmark as Xmark2 } from "iconoir-react";
|
|
4423
|
-
import { jsx as
|
|
4650
|
+
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4424
4651
|
var ACTION_LABELS = {
|
|
4425
4652
|
create_tides_task: "Create a Tides task",
|
|
4426
4653
|
draft_time_entry: "Draft a time entry",
|
|
@@ -4450,18 +4677,18 @@ function SuiteIntegrationRules({
|
|
|
4450
4677
|
onRefresh,
|
|
4451
4678
|
dataTest = "integration-rules"
|
|
4452
4679
|
}) {
|
|
4453
|
-
const [formOpen, setFormOpen] =
|
|
4454
|
-
const [name, setName] =
|
|
4455
|
-
const [trigger, setTrigger] =
|
|
4456
|
-
const [actionType, setActionType] =
|
|
4457
|
-
const [projectId, setProjectId] =
|
|
4458
|
-
const [minutes, setMinutes] =
|
|
4459
|
-
const [priority, setPriority] =
|
|
4460
|
-
const [submitting, setSubmitting] =
|
|
4461
|
-
const [formError, setFormError] =
|
|
4462
|
-
const [busyId, setBusyId] =
|
|
4463
|
-
const [ruleToDelete, setRuleToDelete] =
|
|
4464
|
-
const [deleteError, setDeleteError] =
|
|
4680
|
+
const [formOpen, setFormOpen] = useState12(false);
|
|
4681
|
+
const [name, setName] = useState12("");
|
|
4682
|
+
const [trigger, setTrigger] = useState12("");
|
|
4683
|
+
const [actionType, setActionType] = useState12("create_tides_task");
|
|
4684
|
+
const [projectId, setProjectId] = useState12("");
|
|
4685
|
+
const [minutes, setMinutes] = useState12("");
|
|
4686
|
+
const [priority, setPriority] = useState12("low");
|
|
4687
|
+
const [submitting, setSubmitting] = useState12(false);
|
|
4688
|
+
const [formError, setFormError] = useState12(null);
|
|
4689
|
+
const [busyId, setBusyId] = useState12(null);
|
|
4690
|
+
const [ruleToDelete, setRuleToDelete] = useState12(null);
|
|
4691
|
+
const [deleteError, setDeleteError] = useState12(null);
|
|
4465
4692
|
const needsProject = actionType === "create_tides_task" || actionType === "draft_time_entry";
|
|
4466
4693
|
async function submitForm(event) {
|
|
4467
4694
|
event.preventDefault();
|
|
@@ -4536,10 +4763,10 @@ function SuiteIntegrationRules({
|
|
|
4536
4763
|
children: [
|
|
4537
4764
|
/* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
4538
4765
|
/* @__PURE__ */ jsxs22("div", { children: [
|
|
4539
|
-
/* @__PURE__ */
|
|
4540
|
-
/* @__PURE__ */
|
|
4766
|
+
/* @__PURE__ */ jsx26("h3", { className: "font-medium text-ph-ink", children: "Automation rules" }),
|
|
4767
|
+
/* @__PURE__ */ jsx26("p", { className: "mt-1 text-sm text-ph-subtle", children: "Turn incoming integration events into tasks, time entries, or notifications for this workspace." })
|
|
4541
4768
|
] }),
|
|
4542
|
-
canManage && onCreate ? /* @__PURE__ */
|
|
4769
|
+
canManage && onCreate ? /* @__PURE__ */ jsx26(
|
|
4543
4770
|
Button,
|
|
4544
4771
|
{
|
|
4545
4772
|
type: "button",
|
|
@@ -4548,13 +4775,13 @@ function SuiteIntegrationRules({
|
|
|
4548
4775
|
onClick: () => setFormOpen((open) => !open),
|
|
4549
4776
|
"data-test": `${dataTest}-new`,
|
|
4550
4777
|
children: /* @__PURE__ */ jsxs22("span", { className: "flex items-center gap-1.5", children: [
|
|
4551
|
-
/* @__PURE__ */
|
|
4778
|
+
/* @__PURE__ */ jsx26(Plus, { className: "h-4 w-4", "aria-hidden": true }),
|
|
4552
4779
|
"New rule"
|
|
4553
4780
|
] })
|
|
4554
4781
|
}
|
|
4555
4782
|
) : null
|
|
4556
4783
|
] }),
|
|
4557
|
-
error ? /* @__PURE__ */
|
|
4784
|
+
error ? /* @__PURE__ */ jsx26(
|
|
4558
4785
|
Alert,
|
|
4559
4786
|
{
|
|
4560
4787
|
status: "danger",
|
|
@@ -4562,7 +4789,7 @@ function SuiteIntegrationRules({
|
|
|
4562
4789
|
description: error
|
|
4563
4790
|
}
|
|
4564
4791
|
) : null,
|
|
4565
|
-
loading ? /* @__PURE__ */
|
|
4792
|
+
loading ? /* @__PURE__ */ jsx26("p", { className: "mt-4 text-sm text-ph-subtle", children: "Loading rules..." }) : rules.length === 0 ? /* @__PURE__ */ jsx26(
|
|
4566
4793
|
"div",
|
|
4567
4794
|
{
|
|
4568
4795
|
className: "mt-4 rounded-lg border border-dashed border-ph-border px-4 py-6 text-center",
|
|
@@ -4572,14 +4799,14 @@ function SuiteIntegrationRules({
|
|
|
4572
4799
|
canManage ? " Create one to get started." : ""
|
|
4573
4800
|
] })
|
|
4574
4801
|
}
|
|
4575
|
-
) : /* @__PURE__ */
|
|
4802
|
+
) : /* @__PURE__ */ jsx26("ul", { className: "mt-4 space-y-2", "data-test": `${dataTest}-list`, children: rules.map((rule) => /* @__PURE__ */ jsxs22(
|
|
4576
4803
|
"li",
|
|
4577
4804
|
{
|
|
4578
4805
|
className: "flex items-center justify-between gap-3 rounded-lg border border-ph-border bg-ph-muted px-3 py-3",
|
|
4579
4806
|
"data-test": `${dataTest}-rule-${rule.id}`,
|
|
4580
4807
|
children: [
|
|
4581
4808
|
/* @__PURE__ */ jsxs22("div", { className: "min-w-0", children: [
|
|
4582
|
-
/* @__PURE__ */
|
|
4809
|
+
/* @__PURE__ */ jsx26("p", { className: "truncate text-sm font-medium text-ph-ink", children: rule.name }),
|
|
4583
4810
|
/* @__PURE__ */ jsxs22("p", { className: "mt-0.5 truncate text-xs text-ph-subtle", children: [
|
|
4584
4811
|
rule.trigger_event_type,
|
|
4585
4812
|
" \u2192 ",
|
|
@@ -4591,7 +4818,7 @@ function SuiteIntegrationRules({
|
|
|
4591
4818
|
] })
|
|
4592
4819
|
] }),
|
|
4593
4820
|
canManage ? /* @__PURE__ */ jsxs22("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
4594
|
-
/* @__PURE__ */
|
|
4821
|
+
/* @__PURE__ */ jsx26(
|
|
4595
4822
|
Toggle,
|
|
4596
4823
|
{
|
|
4597
4824
|
checked: rule.enabled,
|
|
@@ -4600,7 +4827,7 @@ function SuiteIntegrationRules({
|
|
|
4600
4827
|
"aria-label": `Enable ${rule.name}`
|
|
4601
4828
|
}
|
|
4602
4829
|
),
|
|
4603
|
-
/* @__PURE__ */
|
|
4830
|
+
/* @__PURE__ */ jsx26(
|
|
4604
4831
|
Button,
|
|
4605
4832
|
{
|
|
4606
4833
|
type: "button",
|
|
@@ -4609,10 +4836,10 @@ function SuiteIntegrationRules({
|
|
|
4609
4836
|
disabled: busyId === rule.id,
|
|
4610
4837
|
onClick: () => requestDelete(rule),
|
|
4611
4838
|
"aria-label": `Delete ${rule.name}`,
|
|
4612
|
-
children: /* @__PURE__ */
|
|
4839
|
+
children: /* @__PURE__ */ jsx26(Xmark2, { className: "h-4 w-4", "aria-hidden": true })
|
|
4613
4840
|
}
|
|
4614
4841
|
)
|
|
4615
|
-
] }) : /* @__PURE__ */
|
|
4842
|
+
] }) : /* @__PURE__ */ jsx26(
|
|
4616
4843
|
Badge,
|
|
4617
4844
|
{
|
|
4618
4845
|
variant: rule.enabled ? "success" : "neutral",
|
|
@@ -4631,8 +4858,8 @@ function SuiteIntegrationRules({
|
|
|
4631
4858
|
onSubmit: (event) => void submitForm(event),
|
|
4632
4859
|
"data-test": `${dataTest}-form`,
|
|
4633
4860
|
children: [
|
|
4634
|
-
formError ? /* @__PURE__ */
|
|
4635
|
-
/* @__PURE__ */
|
|
4861
|
+
formError ? /* @__PURE__ */ jsx26("p", { className: "text-sm text-ph-danger", role: "alert", children: formError }) : null,
|
|
4862
|
+
/* @__PURE__ */ jsx26(
|
|
4636
4863
|
Input,
|
|
4637
4864
|
{
|
|
4638
4865
|
label: "Rule name",
|
|
@@ -4643,7 +4870,7 @@ function SuiteIntegrationRules({
|
|
|
4643
4870
|
"data-test": `${dataTest}-name`
|
|
4644
4871
|
}
|
|
4645
4872
|
),
|
|
4646
|
-
/* @__PURE__ */
|
|
4873
|
+
/* @__PURE__ */ jsx26(
|
|
4647
4874
|
Input,
|
|
4648
4875
|
{
|
|
4649
4876
|
label: "Trigger event type",
|
|
@@ -4655,7 +4882,7 @@ function SuiteIntegrationRules({
|
|
|
4655
4882
|
"data-test": `${dataTest}-trigger`
|
|
4656
4883
|
}
|
|
4657
4884
|
),
|
|
4658
|
-
/* @__PURE__ */
|
|
4885
|
+
/* @__PURE__ */ jsx26(
|
|
4659
4886
|
Select,
|
|
4660
4887
|
{
|
|
4661
4888
|
label: "Action",
|
|
@@ -4664,7 +4891,7 @@ function SuiteIntegrationRules({
|
|
|
4664
4891
|
event.target.value
|
|
4665
4892
|
),
|
|
4666
4893
|
"data-test": `${dataTest}-action`,
|
|
4667
|
-
children: Object.entries(ACTION_LABELS).map(([value, label]) => /* @__PURE__ */
|
|
4894
|
+
children: Object.entries(ACTION_LABELS).map(([value, label]) => /* @__PURE__ */ jsx26("option", { value, children: label }, value))
|
|
4668
4895
|
}
|
|
4669
4896
|
),
|
|
4670
4897
|
needsProject ? /* @__PURE__ */ jsxs22(
|
|
@@ -4675,12 +4902,12 @@ function SuiteIntegrationRules({
|
|
|
4675
4902
|
onChange: (event) => setProjectId(event.target.value),
|
|
4676
4903
|
"data-test": `${dataTest}-project`,
|
|
4677
4904
|
children: [
|
|
4678
|
-
/* @__PURE__ */
|
|
4679
|
-
projects.map((project) => /* @__PURE__ */
|
|
4905
|
+
/* @__PURE__ */ jsx26("option", { value: "", children: "Choose a project..." }),
|
|
4906
|
+
projects.map((project) => /* @__PURE__ */ jsx26("option", { value: project.id, children: project.name }, project.id))
|
|
4680
4907
|
]
|
|
4681
4908
|
}
|
|
4682
4909
|
) : null,
|
|
4683
|
-
actionType === "draft_time_entry" ? /* @__PURE__ */
|
|
4910
|
+
actionType === "draft_time_entry" ? /* @__PURE__ */ jsx26(
|
|
4684
4911
|
Input,
|
|
4685
4912
|
{
|
|
4686
4913
|
label: "Minutes (optional)",
|
|
@@ -4699,15 +4926,15 @@ function SuiteIntegrationRules({
|
|
|
4699
4926
|
onChange: (event) => setPriority(event.target.value),
|
|
4700
4927
|
"data-test": `${dataTest}-priority`,
|
|
4701
4928
|
children: [
|
|
4702
|
-
/* @__PURE__ */
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
/* @__PURE__ */
|
|
4929
|
+
/* @__PURE__ */ jsx26("option", { value: "low", children: "Low" }),
|
|
4930
|
+
/* @__PURE__ */ jsx26("option", { value: "medium", children: "Medium" }),
|
|
4931
|
+
/* @__PURE__ */ jsx26("option", { value: "high", children: "High" }),
|
|
4932
|
+
/* @__PURE__ */ jsx26("option", { value: "urgent", children: "Urgent" })
|
|
4706
4933
|
]
|
|
4707
4934
|
}
|
|
4708
4935
|
) : null,
|
|
4709
4936
|
/* @__PURE__ */ jsxs22("div", { className: "flex justify-end gap-2 border-t border-ph-border pt-3", children: [
|
|
4710
|
-
/* @__PURE__ */
|
|
4937
|
+
/* @__PURE__ */ jsx26(
|
|
4711
4938
|
Button,
|
|
4712
4939
|
{
|
|
4713
4940
|
type: "button",
|
|
@@ -4717,7 +4944,7 @@ function SuiteIntegrationRules({
|
|
|
4717
4944
|
children: "Cancel"
|
|
4718
4945
|
}
|
|
4719
4946
|
),
|
|
4720
|
-
/* @__PURE__ */
|
|
4947
|
+
/* @__PURE__ */ jsx26(Button, { type: "submit", variant: "primary", disabled: submitting, children: submitting ? "Creating..." : "Create rule" })
|
|
4721
4948
|
] })
|
|
4722
4949
|
]
|
|
4723
4950
|
}
|
|
@@ -4736,7 +4963,7 @@ function SuiteIntegrationRules({
|
|
|
4736
4963
|
description: "This action cannot be undone.",
|
|
4737
4964
|
dataTest: `${dataTest}-delete-confirmation`,
|
|
4738
4965
|
footer: /* @__PURE__ */ jsxs22("div", { className: "flex justify-end gap-2", children: [
|
|
4739
|
-
/* @__PURE__ */
|
|
4966
|
+
/* @__PURE__ */ jsx26(
|
|
4740
4967
|
Button,
|
|
4741
4968
|
{
|
|
4742
4969
|
type: "button",
|
|
@@ -4746,7 +4973,7 @@ function SuiteIntegrationRules({
|
|
|
4746
4973
|
children: "Cancel"
|
|
4747
4974
|
}
|
|
4748
4975
|
),
|
|
4749
|
-
/* @__PURE__ */
|
|
4976
|
+
/* @__PURE__ */ jsx26(
|
|
4750
4977
|
Button,
|
|
4751
4978
|
{
|
|
4752
4979
|
type: "button",
|
|
@@ -4759,7 +4986,7 @@ function SuiteIntegrationRules({
|
|
|
4759
4986
|
)
|
|
4760
4987
|
] }),
|
|
4761
4988
|
children: [
|
|
4762
|
-
deleteError ? /* @__PURE__ */
|
|
4989
|
+
deleteError ? /* @__PURE__ */ jsx26("p", { className: "text-sm text-ph-danger", role: "alert", children: deleteError }) : null,
|
|
4763
4990
|
/* @__PURE__ */ jsxs22("p", { className: "text-sm text-ph-ink", children: [
|
|
4764
4991
|
"Delete ",
|
|
4765
4992
|
ruleToDelete == null ? void 0 : ruleToDelete.name,
|
|
@@ -4775,16 +5002,16 @@ function SuiteIntegrationRules({
|
|
|
4775
5002
|
bodyClassName: "p-5",
|
|
4776
5003
|
"data-test": `${dataTest}-events-card`,
|
|
4777
5004
|
children: [
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
/* @__PURE__ */
|
|
4780
|
-
events.length === 0 ? /* @__PURE__ */
|
|
5005
|
+
/* @__PURE__ */ jsx26("h3", { className: "font-medium text-ph-ink", children: "Recent events" }),
|
|
5006
|
+
/* @__PURE__ */ jsx26("p", { className: "mt-1 text-sm text-ph-subtle", children: "The latest events received from your connected apps." }),
|
|
5007
|
+
events.length === 0 ? /* @__PURE__ */ jsx26(
|
|
4781
5008
|
"p",
|
|
4782
5009
|
{
|
|
4783
5010
|
className: "mt-4 rounded-lg border border-dashed border-ph-border px-4 py-6 text-center text-sm text-ph-subtle",
|
|
4784
5011
|
"data-test": `${dataTest}-events-empty`,
|
|
4785
5012
|
children: "No integration events yet."
|
|
4786
5013
|
}
|
|
4787
|
-
) : /* @__PURE__ */
|
|
5014
|
+
) : /* @__PURE__ */ jsx26("ul", { className: "mt-4 space-y-2", "data-test": `${dataTest}-events-list`, children: events.map((event) => /* @__PURE__ */ jsxs22(
|
|
4788
5015
|
"li",
|
|
4789
5016
|
{
|
|
4790
5017
|
className: "flex items-center justify-between gap-3 rounded-lg border border-ph-border bg-ph-muted px-3 py-2",
|
|
@@ -4795,9 +5022,9 @@ function SuiteIntegrationRules({
|
|
|
4795
5022
|
" \xB7 ",
|
|
4796
5023
|
event.event_type
|
|
4797
5024
|
] }),
|
|
4798
|
-
/* @__PURE__ */
|
|
5025
|
+
/* @__PURE__ */ jsx26("p", { className: "mt-0.5 text-xs text-ph-subtle", children: formatDateTime(event.created_at) })
|
|
4799
5026
|
] }),
|
|
4800
|
-
/* @__PURE__ */
|
|
5027
|
+
/* @__PURE__ */ jsx26(
|
|
4801
5028
|
Badge,
|
|
4802
5029
|
{
|
|
4803
5030
|
variant: event.processed_at ? "success" : "warning",
|
|
@@ -4817,10 +5044,10 @@ function SuiteIntegrationRules({
|
|
|
4817
5044
|
|
|
4818
5045
|
// src/suite/components/suite-clients-projects-directory.tsx
|
|
4819
5046
|
import {
|
|
4820
|
-
useEffect as
|
|
4821
|
-
useMemo as
|
|
4822
|
-
useRef as
|
|
4823
|
-
useState as
|
|
5047
|
+
useEffect as useEffect10,
|
|
5048
|
+
useMemo as useMemo3,
|
|
5049
|
+
useRef as useRef5,
|
|
5050
|
+
useState as useState13
|
|
4824
5051
|
} from "react";
|
|
4825
5052
|
import {
|
|
4826
5053
|
ArrowLeft,
|
|
@@ -4830,7 +5057,7 @@ import {
|
|
|
4830
5057
|
Search as Search2,
|
|
4831
5058
|
Trash
|
|
4832
5059
|
} from "iconoir-react";
|
|
4833
|
-
import { Fragment as Fragment9, jsx as
|
|
5060
|
+
import { Fragment as Fragment9, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4834
5061
|
var DEFAULT_ICON = "castle-emblem";
|
|
4835
5062
|
var DEFAULT_COLOR = "#6366f1";
|
|
4836
5063
|
var DIRECTORY_ICON_OPTIONS = [
|
|
@@ -4909,7 +5136,7 @@ function DirectoryIconPicker({
|
|
|
4909
5136
|
onClear,
|
|
4910
5137
|
onChange
|
|
4911
5138
|
}) {
|
|
4912
|
-
const iconRefs =
|
|
5139
|
+
const iconRefs = useRef5({});
|
|
4913
5140
|
function moveSelection(event, index) {
|
|
4914
5141
|
var _a;
|
|
4915
5142
|
let nextIndex = null;
|
|
@@ -4929,8 +5156,8 @@ function DirectoryIconPicker({
|
|
|
4929
5156
|
(_a = iconRefs.current[nextIcon]) == null ? void 0 : _a.focus();
|
|
4930
5157
|
}
|
|
4931
5158
|
return /* @__PURE__ */ jsxs23("div", { className: "space-y-2", children: [
|
|
4932
|
-
/* @__PURE__ */
|
|
4933
|
-
/* @__PURE__ */
|
|
5159
|
+
/* @__PURE__ */ jsx27("span", { className: "mb-1.5 block text-sm font-medium text-ph-ink", children: "Icon" }),
|
|
5160
|
+
/* @__PURE__ */ jsx27(
|
|
4934
5161
|
"div",
|
|
4935
5162
|
{
|
|
4936
5163
|
role: "radiogroup",
|
|
@@ -4938,7 +5165,7 @@ function DirectoryIconPicker({
|
|
|
4938
5165
|
className: "grid grid-cols-6 gap-1.5 rounded-lg border border-ph-border p-1.5 sm:grid-cols-8",
|
|
4939
5166
|
children: DIRECTORY_ICON_OPTIONS.map(([name, label], index) => {
|
|
4940
5167
|
const selected = value === name;
|
|
4941
|
-
return /* @__PURE__ */
|
|
5168
|
+
return /* @__PURE__ */ jsx27(
|
|
4942
5169
|
"button",
|
|
4943
5170
|
{
|
|
4944
5171
|
type: "button",
|
|
@@ -4956,7 +5183,7 @@ function DirectoryIconPicker({
|
|
|
4956
5183
|
"flex h-9 items-center justify-center rounded-md text-ph-mutedtext hover:bg-ph-muted hover:text-ph-ink",
|
|
4957
5184
|
selected && "bg-ph-muted text-ph-ink ring-2 ring-ph-brand ring-inset"
|
|
4958
5185
|
),
|
|
4959
|
-
children: /* @__PURE__ */
|
|
5186
|
+
children: /* @__PURE__ */ jsx27(
|
|
4960
5187
|
"i",
|
|
4961
5188
|
{
|
|
4962
5189
|
className: cn("ra", `ra-${name}`, "text-base leading-none"),
|
|
@@ -4971,11 +5198,11 @@ function DirectoryIconPicker({
|
|
|
4971
5198
|
),
|
|
4972
5199
|
/* @__PURE__ */ jsxs23("div", { className: "rounded-lg border border-ph-border bg-ph-muted p-2", children: [
|
|
4973
5200
|
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 text-sm font-medium text-ph-ink", children: [
|
|
4974
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsx27(ImagePlus, { className: "h-4 w-4", "aria-hidden": true }),
|
|
4975
5202
|
" Custom image"
|
|
4976
5203
|
] }),
|
|
4977
|
-
/* @__PURE__ */
|
|
4978
|
-
/* @__PURE__ */
|
|
5204
|
+
/* @__PURE__ */ jsx27("p", { className: "mt-1 text-xs text-ph-mutedtext", children: "PNG, JPG, GIF, WebP, or SVG \u2014 max 512 KB." }),
|
|
5205
|
+
/* @__PURE__ */ jsx27(
|
|
4979
5206
|
FileUpload,
|
|
4980
5207
|
{
|
|
4981
5208
|
accept: "image/png,image/jpeg,image/gif,image/webp,image/svg+xml,.svg",
|
|
@@ -4986,7 +5213,7 @@ function DirectoryIconPicker({
|
|
|
4986
5213
|
}
|
|
4987
5214
|
),
|
|
4988
5215
|
preview ? /* @__PURE__ */ jsxs23("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
4989
|
-
/* @__PURE__ */
|
|
5216
|
+
/* @__PURE__ */ jsx27(
|
|
4990
5217
|
"img",
|
|
4991
5218
|
{
|
|
4992
5219
|
src: preview,
|
|
@@ -5001,7 +5228,7 @@ function DirectoryIconPicker({
|
|
|
5001
5228
|
className: "text-xs text-ph-mutedtext hover:text-ph-ink",
|
|
5002
5229
|
onClick: onClear,
|
|
5003
5230
|
children: [
|
|
5004
|
-
/* @__PURE__ */
|
|
5231
|
+
/* @__PURE__ */ jsx27(Trash, { className: "mr-1 inline h-3.5 w-3.5", "aria-hidden": true }),
|
|
5005
5232
|
" Remove custom image"
|
|
5006
5233
|
]
|
|
5007
5234
|
}
|
|
@@ -5014,14 +5241,14 @@ function DirectoryIcon({
|
|
|
5014
5241
|
item
|
|
5015
5242
|
}) {
|
|
5016
5243
|
const icon = item.icon && isDirectoryIcon(item.icon) ? item.icon : DEFAULT_ICON;
|
|
5017
|
-
return /* @__PURE__ */
|
|
5244
|
+
return /* @__PURE__ */ jsx27(
|
|
5018
5245
|
"span",
|
|
5019
5246
|
{
|
|
5020
5247
|
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-white",
|
|
5021
5248
|
style: { backgroundColor: item.color || "var(--ph-brand)" },
|
|
5022
5249
|
children: item.icon_image ? (
|
|
5023
5250
|
// eslint-disable-next-line @next/next/no-img-element
|
|
5024
|
-
/* @__PURE__ */
|
|
5251
|
+
/* @__PURE__ */ jsx27(
|
|
5025
5252
|
"img",
|
|
5026
5253
|
{
|
|
5027
5254
|
src: item.icon_image,
|
|
@@ -5029,7 +5256,7 @@ function DirectoryIcon({
|
|
|
5029
5256
|
className: "h-full w-full rounded-lg object-cover"
|
|
5030
5257
|
}
|
|
5031
5258
|
)
|
|
5032
|
-
) : /* @__PURE__ */
|
|
5259
|
+
) : /* @__PURE__ */ jsx27(
|
|
5033
5260
|
"i",
|
|
5034
5261
|
{
|
|
5035
5262
|
className: cn("ra", `ra-${icon}`, "text-base leading-none"),
|
|
@@ -5054,31 +5281,31 @@ function SuiteClientsProjectsDirectory({
|
|
|
5054
5281
|
dataTest = "suite-clients-projects-directory"
|
|
5055
5282
|
}) {
|
|
5056
5283
|
var _a;
|
|
5057
|
-
const [query, setQuery] =
|
|
5058
|
-
const [selectedClientId, setSelectedClientId] =
|
|
5059
|
-
const [mobileDetail, setMobileDetail] =
|
|
5060
|
-
const [editing, setEditing] =
|
|
5061
|
-
const [draft, setDraft] =
|
|
5284
|
+
const [query, setQuery] = useState13("");
|
|
5285
|
+
const [selectedClientId, setSelectedClientId] = useState13(null);
|
|
5286
|
+
const [mobileDetail, setMobileDetail] = useState13(false);
|
|
5287
|
+
const [editing, setEditing] = useState13(null);
|
|
5288
|
+
const [draft, setDraft] = useState13({
|
|
5062
5289
|
name: "",
|
|
5063
5290
|
icon: DEFAULT_ICON,
|
|
5064
5291
|
color: DEFAULT_COLOR
|
|
5065
5292
|
});
|
|
5066
|
-
const [draftClientId, setDraftClientId] =
|
|
5067
|
-
const [preview, setPreview] =
|
|
5068
|
-
const [draftArchived, setDraftArchived] =
|
|
5069
|
-
const [confirming, setConfirming] =
|
|
5070
|
-
const [saving, setSaving] =
|
|
5071
|
-
const [mutationError, setMutationError] =
|
|
5072
|
-
const clientButtonRefs =
|
|
5073
|
-
const backToClientsRef =
|
|
5074
|
-
const mobileFocusTarget =
|
|
5075
|
-
|
|
5293
|
+
const [draftClientId, setDraftClientId] = useState13(null);
|
|
5294
|
+
const [preview, setPreview] = useState13(null);
|
|
5295
|
+
const [draftArchived, setDraftArchived] = useState13(false);
|
|
5296
|
+
const [confirming, setConfirming] = useState13(null);
|
|
5297
|
+
const [saving, setSaving] = useState13(false);
|
|
5298
|
+
const [mutationError, setMutationError] = useState13(null);
|
|
5299
|
+
const clientButtonRefs = useRef5({});
|
|
5300
|
+
const backToClientsRef = useRef5(null);
|
|
5301
|
+
const mobileFocusTarget = useRef5(null);
|
|
5302
|
+
useEffect10(() => {
|
|
5076
5303
|
var _a2, _b;
|
|
5077
5304
|
if (selectedClientId && clients.some((client) => client.id === selectedClientId))
|
|
5078
5305
|
return;
|
|
5079
5306
|
setSelectedClientId((_b = (_a2 = clients[0]) == null ? void 0 : _a2.id) != null ? _b : null);
|
|
5080
5307
|
}, [clients, selectedClientId]);
|
|
5081
|
-
|
|
5308
|
+
useEffect10(() => {
|
|
5082
5309
|
var _a2, _b;
|
|
5083
5310
|
const target = mobileFocusTarget.current;
|
|
5084
5311
|
if (!target) return;
|
|
@@ -5087,7 +5314,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5087
5314
|
else if (selectedClientId)
|
|
5088
5315
|
(_b = clientButtonRefs.current[selectedClientId]) == null ? void 0 : _b.focus();
|
|
5089
5316
|
}, [mobileDetail, selectedClientId]);
|
|
5090
|
-
const filteredClients =
|
|
5317
|
+
const filteredClients = useMemo3(() => {
|
|
5091
5318
|
const value = query.trim().toLowerCase();
|
|
5092
5319
|
return [...clients].sort((a, b) => a.name.localeCompare(b.name)).filter((client) => !value || client.name.toLowerCase().includes(value));
|
|
5093
5320
|
}, [clients, query]);
|
|
@@ -5241,8 +5468,8 @@ function SuiteClientsProjectsDirectory({
|
|
|
5241
5468
|
}
|
|
5242
5469
|
}
|
|
5243
5470
|
return /* @__PURE__ */ jsxs23("div", { "data-test": dataTest, className: "space-y-3", children: [
|
|
5244
|
-
error || mutationError ? /* @__PURE__ */
|
|
5245
|
-
loading ? /* @__PURE__ */
|
|
5471
|
+
error || mutationError ? /* @__PURE__ */ jsx27(Alert, { status: "danger", live: "assertive", children: error || mutationError }) : null,
|
|
5472
|
+
loading ? /* @__PURE__ */ jsx27("p", { className: "text-sm text-ph-mutedtext", children: "Loading directory..." }) : /* @__PURE__ */ jsxs23("div", { className: "overflow-hidden rounded-xl border border-ph-border bg-ph-surface lg:grid lg:min-h-[22rem] lg:grid-cols-[minmax(14rem,18rem)_1fr]", children: [
|
|
5246
5473
|
/* @__PURE__ */ jsxs23(
|
|
5247
5474
|
"section",
|
|
5248
5475
|
{
|
|
@@ -5253,14 +5480,14 @@ function SuiteClientsProjectsDirectory({
|
|
|
5253
5480
|
children: [
|
|
5254
5481
|
/* @__PURE__ */ jsxs23("div", { className: "flex h-14 items-center gap-2 border-b border-ph-border px-3", children: [
|
|
5255
5482
|
/* @__PURE__ */ jsxs23("div", { className: "relative min-w-0 flex-1", children: [
|
|
5256
|
-
/* @__PURE__ */
|
|
5483
|
+
/* @__PURE__ */ jsx27(
|
|
5257
5484
|
Search2,
|
|
5258
5485
|
{
|
|
5259
5486
|
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-ph-mutedtext",
|
|
5260
5487
|
"aria-hidden": true
|
|
5261
5488
|
}
|
|
5262
5489
|
),
|
|
5263
|
-
/* @__PURE__ */
|
|
5490
|
+
/* @__PURE__ */ jsx27(
|
|
5264
5491
|
Input,
|
|
5265
5492
|
{
|
|
5266
5493
|
hideLabel: true,
|
|
@@ -5272,18 +5499,18 @@ function SuiteClientsProjectsDirectory({
|
|
|
5272
5499
|
}
|
|
5273
5500
|
)
|
|
5274
5501
|
] }),
|
|
5275
|
-
canEdit && onCreateClient ? /* @__PURE__ */
|
|
5502
|
+
canEdit && onCreateClient ? /* @__PURE__ */ jsx27(
|
|
5276
5503
|
Button,
|
|
5277
5504
|
{
|
|
5278
5505
|
size: "sm",
|
|
5279
5506
|
variant: "primary",
|
|
5280
|
-
icon: /* @__PURE__ */
|
|
5507
|
+
icon: /* @__PURE__ */ jsx27(Plus2, { className: "h-4 w-4" }),
|
|
5281
5508
|
onClick: () => openNew("client"),
|
|
5282
5509
|
children: "New client"
|
|
5283
5510
|
}
|
|
5284
5511
|
) : null
|
|
5285
5512
|
] }),
|
|
5286
|
-
/* @__PURE__ */
|
|
5513
|
+
/* @__PURE__ */ jsx27(
|
|
5287
5514
|
"ul",
|
|
5288
5515
|
{
|
|
5289
5516
|
role: "listbox",
|
|
@@ -5294,7 +5521,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5294
5521
|
const count = projects.filter(
|
|
5295
5522
|
(project) => project.clientId === client.id
|
|
5296
5523
|
).length;
|
|
5297
|
-
return /* @__PURE__ */
|
|
5524
|
+
return /* @__PURE__ */ jsx27("li", { role: "none", children: /* @__PURE__ */ jsxs23(
|
|
5298
5525
|
"button",
|
|
5299
5526
|
{
|
|
5300
5527
|
type: "button",
|
|
@@ -5311,9 +5538,9 @@ function SuiteClientsProjectsDirectory({
|
|
|
5311
5538
|
selected ? "bg-ph-muted" : "hover:bg-ph-canvas"
|
|
5312
5539
|
),
|
|
5313
5540
|
children: [
|
|
5314
|
-
/* @__PURE__ */
|
|
5541
|
+
/* @__PURE__ */ jsx27(DirectoryIcon, { item: client }),
|
|
5315
5542
|
/* @__PURE__ */ jsxs23("span", { className: "min-w-0 flex-1", children: [
|
|
5316
|
-
/* @__PURE__ */
|
|
5543
|
+
/* @__PURE__ */ jsx27("span", { className: "block truncate text-sm font-medium text-ph-ink", children: client.name }),
|
|
5317
5544
|
/* @__PURE__ */ jsxs23("span", { className: "text-xs text-ph-mutedtext", children: [
|
|
5318
5545
|
count,
|
|
5319
5546
|
" project",
|
|
@@ -5323,7 +5550,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5323
5550
|
]
|
|
5324
5551
|
}
|
|
5325
5552
|
) }, client.id);
|
|
5326
|
-
}) : /* @__PURE__ */
|
|
5553
|
+
}) : /* @__PURE__ */ jsx27("li", { className: "px-3 py-8 text-center text-sm text-ph-mutedtext", children: clients.length ? "No matches." : "Add a client to get started." })
|
|
5327
5554
|
}
|
|
5328
5555
|
)
|
|
5329
5556
|
]
|
|
@@ -5337,8 +5564,8 @@ function SuiteClientsProjectsDirectory({
|
|
|
5337
5564
|
mobileDetail ? "flex" : "hidden lg:flex"
|
|
5338
5565
|
),
|
|
5339
5566
|
children: [
|
|
5340
|
-
/* @__PURE__ */
|
|
5341
|
-
/* @__PURE__ */
|
|
5567
|
+
/* @__PURE__ */ jsx27("div", { className: "flex min-h-14 items-center gap-2 border-b border-ph-border px-3 py-2", children: selectedClient ? /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
5568
|
+
/* @__PURE__ */ jsx27(
|
|
5342
5569
|
"button",
|
|
5343
5570
|
{
|
|
5344
5571
|
type: "button",
|
|
@@ -5349,36 +5576,36 @@ function SuiteClientsProjectsDirectory({
|
|
|
5349
5576
|
setMobileDetail(false);
|
|
5350
5577
|
},
|
|
5351
5578
|
"aria-label": "Back to clients",
|
|
5352
|
-
children: /* @__PURE__ */
|
|
5579
|
+
children: /* @__PURE__ */ jsx27(ArrowLeft, { className: "h-4 w-4" })
|
|
5353
5580
|
}
|
|
5354
5581
|
),
|
|
5355
|
-
/* @__PURE__ */
|
|
5582
|
+
/* @__PURE__ */ jsx27(DirectoryIcon, { item: selectedClient }),
|
|
5356
5583
|
/* @__PURE__ */ jsxs23("div", { className: "min-w-0 flex-1", children: [
|
|
5357
|
-
/* @__PURE__ */
|
|
5584
|
+
/* @__PURE__ */ jsx27("h3", { className: "truncate text-sm font-semibold text-ph-ink", children: selectedClient.name }),
|
|
5358
5585
|
/* @__PURE__ */ jsxs23("p", { className: "text-xs text-ph-mutedtext", children: [
|
|
5359
5586
|
selectedProjects.length,
|
|
5360
5587
|
" project",
|
|
5361
5588
|
selectedProjects.length === 1 ? "" : "s"
|
|
5362
5589
|
] })
|
|
5363
5590
|
] }),
|
|
5364
|
-
canEdit && (onUpdateClient || onDeleteClient) ? /* @__PURE__ */
|
|
5591
|
+
canEdit && (onUpdateClient || onDeleteClient) ? /* @__PURE__ */ jsx27("div", { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx27(
|
|
5365
5592
|
DropdownMenu,
|
|
5366
5593
|
{
|
|
5367
5594
|
"aria-label": `Actions for ${selectedClient.name}`,
|
|
5368
5595
|
align: "end",
|
|
5369
5596
|
trigger: /* @__PURE__ */ jsxs23("span", { className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-ph-mutedtext hover:bg-ph-muted hover:text-ph-ink", children: [
|
|
5370
|
-
/* @__PURE__ */
|
|
5371
|
-
/* @__PURE__ */
|
|
5597
|
+
/* @__PURE__ */ jsx27(MoreHorizontal, { className: "h-4 w-4", "aria-hidden": true }),
|
|
5598
|
+
/* @__PURE__ */ jsx27("span", { className: "sr-only", children: "Client actions" })
|
|
5372
5599
|
] }),
|
|
5373
5600
|
children: /* @__PURE__ */ jsxs23("div", { className: "p-1", children: [
|
|
5374
|
-
onUpdateClient ? /* @__PURE__ */
|
|
5601
|
+
onUpdateClient ? /* @__PURE__ */ jsx27(
|
|
5375
5602
|
DropdownItem,
|
|
5376
5603
|
{
|
|
5377
5604
|
onClick: () => openEdit(selectedClient, "client"),
|
|
5378
5605
|
children: "Edit client"
|
|
5379
5606
|
}
|
|
5380
5607
|
) : null,
|
|
5381
|
-
onDeleteClient ? /* @__PURE__ */
|
|
5608
|
+
onDeleteClient ? /* @__PURE__ */ jsx27(
|
|
5382
5609
|
DropdownItem,
|
|
5383
5610
|
{
|
|
5384
5611
|
className: "text-red-600",
|
|
@@ -5389,17 +5616,17 @@ function SuiteClientsProjectsDirectory({
|
|
|
5389
5616
|
] })
|
|
5390
5617
|
}
|
|
5391
5618
|
) }) : null
|
|
5392
|
-
] }) : /* @__PURE__ */
|
|
5393
|
-
canEdit && onCreateProject ? /* @__PURE__ */
|
|
5619
|
+
] }) : /* @__PURE__ */ jsx27("p", { className: "text-sm text-ph-mutedtext", children: "Select a client" }) }),
|
|
5620
|
+
canEdit && onCreateProject ? /* @__PURE__ */ jsx27("div", { className: "border-b border-ph-border p-3", children: /* @__PURE__ */ jsx27(
|
|
5394
5621
|
Button,
|
|
5395
5622
|
{
|
|
5396
5623
|
variant: "primary",
|
|
5397
|
-
icon: /* @__PURE__ */
|
|
5624
|
+
icon: /* @__PURE__ */ jsx27(Plus2, { className: "h-4 w-4" }),
|
|
5398
5625
|
onClick: () => openNew("project"),
|
|
5399
5626
|
children: "Add project"
|
|
5400
5627
|
}
|
|
5401
5628
|
) }) : null,
|
|
5402
|
-
/* @__PURE__ */
|
|
5629
|
+
/* @__PURE__ */ jsx27("ul", { className: "flex-1 p-2", children: selectedClient && selectedProjects.length ? selectedProjects.map((project) => /* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsxs23(
|
|
5403
5630
|
"div",
|
|
5404
5631
|
{
|
|
5405
5632
|
className: "flex items-center gap-3 rounded-lg px-2 py-1 hover:bg-ph-canvas",
|
|
@@ -5412,9 +5639,9 @@ function SuiteClientsProjectsDirectory({
|
|
|
5412
5639
|
className: "flex min-w-0 flex-1 items-center gap-3 rounded-lg py-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ph-brand",
|
|
5413
5640
|
onClick: () => openEdit(project, "project"),
|
|
5414
5641
|
children: [
|
|
5415
|
-
/* @__PURE__ */
|
|
5642
|
+
/* @__PURE__ */ jsx27(DirectoryIcon, { item: project }),
|
|
5416
5643
|
/* @__PURE__ */ jsxs23("span", { className: "min-w-0 flex-1", children: [
|
|
5417
|
-
/* @__PURE__ */
|
|
5644
|
+
/* @__PURE__ */ jsx27(
|
|
5418
5645
|
"span",
|
|
5419
5646
|
{
|
|
5420
5647
|
className: cn(
|
|
@@ -5424,36 +5651,36 @@ function SuiteClientsProjectsDirectory({
|
|
|
5424
5651
|
children: project.name
|
|
5425
5652
|
}
|
|
5426
5653
|
),
|
|
5427
|
-
/* @__PURE__ */
|
|
5654
|
+
/* @__PURE__ */ jsx27("span", { className: "text-xs text-ph-mutedtext", children: project.isArchived ? "Archived" : "Active" })
|
|
5428
5655
|
] })
|
|
5429
5656
|
]
|
|
5430
5657
|
}
|
|
5431
5658
|
),
|
|
5432
|
-
canEdit && (onUpdateProject || onDeleteProject) ? /* @__PURE__ */
|
|
5659
|
+
canEdit && (onUpdateProject || onDeleteProject) ? /* @__PURE__ */ jsx27("div", { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx27(
|
|
5433
5660
|
DropdownMenu,
|
|
5434
5661
|
{
|
|
5435
5662
|
"aria-label": `Actions for ${project.name}`,
|
|
5436
5663
|
align: "end",
|
|
5437
5664
|
trigger: /* @__PURE__ */ jsxs23("span", { className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-ph-mutedtext hover:bg-ph-muted hover:text-ph-ink", children: [
|
|
5438
|
-
/* @__PURE__ */
|
|
5665
|
+
/* @__PURE__ */ jsx27(
|
|
5439
5666
|
MoreHorizontal,
|
|
5440
5667
|
{
|
|
5441
5668
|
className: "h-4 w-4",
|
|
5442
5669
|
"aria-hidden": true
|
|
5443
5670
|
}
|
|
5444
5671
|
),
|
|
5445
|
-
/* @__PURE__ */
|
|
5672
|
+
/* @__PURE__ */ jsx27("span", { className: "sr-only", children: "Project actions" })
|
|
5446
5673
|
] }),
|
|
5447
5674
|
children: /* @__PURE__ */ jsxs23("div", { className: "p-1", children: [
|
|
5448
5675
|
onUpdateProject ? /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
5449
|
-
/* @__PURE__ */
|
|
5676
|
+
/* @__PURE__ */ jsx27(
|
|
5450
5677
|
DropdownItem,
|
|
5451
5678
|
{
|
|
5452
5679
|
onClick: () => openEdit(project, "project"),
|
|
5453
5680
|
children: "Edit project"
|
|
5454
5681
|
}
|
|
5455
5682
|
),
|
|
5456
|
-
/* @__PURE__ */
|
|
5683
|
+
/* @__PURE__ */ jsx27(
|
|
5457
5684
|
DropdownItem,
|
|
5458
5685
|
{
|
|
5459
5686
|
onClick: () => void toggleArchive(project),
|
|
@@ -5461,7 +5688,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5461
5688
|
}
|
|
5462
5689
|
)
|
|
5463
5690
|
] }) : null,
|
|
5464
|
-
onDeleteProject ? /* @__PURE__ */
|
|
5691
|
+
onDeleteProject ? /* @__PURE__ */ jsx27(
|
|
5465
5692
|
DropdownItem,
|
|
5466
5693
|
{
|
|
5467
5694
|
className: "text-red-600",
|
|
@@ -5474,20 +5701,20 @@ function SuiteClientsProjectsDirectory({
|
|
|
5474
5701
|
) }) : null
|
|
5475
5702
|
]
|
|
5476
5703
|
}
|
|
5477
|
-
) }, project.id)) : /* @__PURE__ */
|
|
5704
|
+
) }, project.id)) : /* @__PURE__ */ jsx27("li", { className: "px-3 py-8 text-center text-sm text-ph-mutedtext", children: selectedClient ? "No projects yet." : "Select a client to see its projects." }) })
|
|
5478
5705
|
]
|
|
5479
5706
|
}
|
|
5480
5707
|
)
|
|
5481
5708
|
] }),
|
|
5482
|
-
/* @__PURE__ */
|
|
5709
|
+
/* @__PURE__ */ jsx27(
|
|
5483
5710
|
Modal,
|
|
5484
5711
|
{
|
|
5485
5712
|
open: editing !== null,
|
|
5486
5713
|
onClose: closeEditor,
|
|
5487
5714
|
title: (editing == null ? void 0 : editing.kind.includes("project")) ? editing.kind === "new-project" ? "New project" : "Edit project" : (editing == null ? void 0 : editing.kind) === "new-client" ? "New client" : "Edit client",
|
|
5488
5715
|
footer: /* @__PURE__ */ jsxs23("div", { className: "flex justify-end gap-2", children: [
|
|
5489
|
-
/* @__PURE__ */
|
|
5490
|
-
/* @__PURE__ */
|
|
5716
|
+
/* @__PURE__ */ jsx27(Button, { variant: "tertiary", onClick: closeEditor, disabled: saving, children: "Cancel" }),
|
|
5717
|
+
/* @__PURE__ */ jsx27(
|
|
5491
5718
|
Button,
|
|
5492
5719
|
{
|
|
5493
5720
|
variant: "primary",
|
|
@@ -5498,7 +5725,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5498
5725
|
)
|
|
5499
5726
|
] }),
|
|
5500
5727
|
children: /* @__PURE__ */ jsxs23("div", { className: "space-y-3", children: [
|
|
5501
|
-
/* @__PURE__ */
|
|
5728
|
+
/* @__PURE__ */ jsx27(
|
|
5502
5729
|
Input,
|
|
5503
5730
|
{
|
|
5504
5731
|
label: "Name",
|
|
@@ -5507,7 +5734,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5507
5734
|
onChange: (event) => setDraft(__spreadProps(__spreadValues({}, draft), { name: event.target.value }))
|
|
5508
5735
|
}
|
|
5509
5736
|
),
|
|
5510
|
-
/* @__PURE__ */
|
|
5737
|
+
/* @__PURE__ */ jsx27(
|
|
5511
5738
|
DirectoryIconPicker,
|
|
5512
5739
|
{
|
|
5513
5740
|
value: isDirectoryIcon(draft.icon) ? draft.icon : DEFAULT_ICON,
|
|
@@ -5521,7 +5748,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5521
5748
|
}
|
|
5522
5749
|
),
|
|
5523
5750
|
/* @__PURE__ */ jsxs23("div", { children: [
|
|
5524
|
-
/* @__PURE__ */
|
|
5751
|
+
/* @__PURE__ */ jsx27("span", { className: "mb-1.5 block text-sm font-medium text-ph-ink", children: "Colour" }),
|
|
5525
5752
|
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap gap-2", children: [
|
|
5526
5753
|
[
|
|
5527
5754
|
"#6366f1",
|
|
@@ -5531,7 +5758,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5531
5758
|
"#ef4444",
|
|
5532
5759
|
"#a855f7",
|
|
5533
5760
|
"#64748b"
|
|
5534
|
-
].map((color) => /* @__PURE__ */
|
|
5761
|
+
].map((color) => /* @__PURE__ */ jsx27(
|
|
5535
5762
|
"button",
|
|
5536
5763
|
{
|
|
5537
5764
|
type: "button",
|
|
@@ -5546,7 +5773,7 @@ function SuiteClientsProjectsDirectory({
|
|
|
5546
5773
|
},
|
|
5547
5774
|
color
|
|
5548
5775
|
)),
|
|
5549
|
-
/* @__PURE__ */
|
|
5776
|
+
/* @__PURE__ */ jsx27(
|
|
5550
5777
|
Input,
|
|
5551
5778
|
{
|
|
5552
5779
|
hideLabel: true,
|
|
@@ -5566,13 +5793,13 @@ function SuiteClientsProjectsDirectory({
|
|
|
5566
5793
|
value: draftClientId != null ? draftClientId : "",
|
|
5567
5794
|
onChange: (event) => setDraftClientId(event.target.value || null),
|
|
5568
5795
|
children: [
|
|
5569
|
-
/* @__PURE__ */
|
|
5570
|
-
clients.map((client) => /* @__PURE__ */
|
|
5796
|
+
/* @__PURE__ */ jsx27("option", { value: "", children: "No client" }),
|
|
5797
|
+
clients.map((client) => /* @__PURE__ */ jsx27("option", { value: client.id, children: client.name }, client.id))
|
|
5571
5798
|
]
|
|
5572
5799
|
}
|
|
5573
5800
|
) : null,
|
|
5574
5801
|
(editing == null ? void 0 : editing.kind.includes("project")) ? /* @__PURE__ */ jsxs23("label", { className: "flex items-center gap-2 text-sm text-ph-ink", children: [
|
|
5575
|
-
/* @__PURE__ */
|
|
5802
|
+
/* @__PURE__ */ jsx27(
|
|
5576
5803
|
"input",
|
|
5577
5804
|
{
|
|
5578
5805
|
type: "checkbox",
|
|
@@ -5585,15 +5812,15 @@ function SuiteClientsProjectsDirectory({
|
|
|
5585
5812
|
] })
|
|
5586
5813
|
}
|
|
5587
5814
|
),
|
|
5588
|
-
/* @__PURE__ */
|
|
5815
|
+
/* @__PURE__ */ jsx27(
|
|
5589
5816
|
Modal,
|
|
5590
5817
|
{
|
|
5591
5818
|
open: confirming !== null,
|
|
5592
5819
|
onClose: () => setConfirming(null),
|
|
5593
5820
|
title: "Confirm deletion",
|
|
5594
5821
|
footer: /* @__PURE__ */ jsxs23("div", { className: "flex justify-end gap-2", children: [
|
|
5595
|
-
/* @__PURE__ */
|
|
5596
|
-
/* @__PURE__ */
|
|
5822
|
+
/* @__PURE__ */ jsx27(Button, { variant: "tertiary", onClick: () => setConfirming(null), children: "Cancel" }),
|
|
5823
|
+
/* @__PURE__ */ jsx27(Button, { variant: "primary", onClick: () => void confirmRemove(), children: "Delete" })
|
|
5597
5824
|
] }),
|
|
5598
5825
|
children: /* @__PURE__ */ jsxs23("p", { className: "text-sm text-ph-ink", children: [
|
|
5599
5826
|
"Delete ",
|