reifyui 0.13.7 → 0.13.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +674 -518
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +435 -279
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/auth/AuthForm.jsx +17 -2
- package/src/auth/GoogleButton.jsx +26 -6
- package/src/auth/MicrosoftButton.jsx +128 -0
- package/src/auth/client.js +9 -0
- package/src/index.js +2 -1
package/dist/index.cjs
CHANGED
|
@@ -71,8 +71,10 @@ __export(src_exports, {
|
|
|
71
71
|
IcTool: () => IcTool,
|
|
72
72
|
IcX: () => IcX,
|
|
73
73
|
Input: () => Input,
|
|
74
|
+
MICROSOFT_ENABLED: () => MICROSOFT_ENABLED,
|
|
74
75
|
MentionInput: () => MentionInput,
|
|
75
76
|
MentionText: () => MentionText,
|
|
77
|
+
MicrosoftButton: () => MicrosoftButton,
|
|
76
78
|
Modal: () => Modal,
|
|
77
79
|
PaneResizer: () => PaneResizer,
|
|
78
80
|
Panel: () => Panel,
|
|
@@ -115,6 +117,8 @@ __export(src_exports, {
|
|
|
115
117
|
logout: () => logout,
|
|
116
118
|
majorTickStep: () => majorTickStep,
|
|
117
119
|
mention: () => mentionModel_exports,
|
|
120
|
+
microsoftIdToken: () => microsoftIdToken,
|
|
121
|
+
microsoftSignIn: () => microsoftSignIn,
|
|
118
122
|
packLayout: () => packLayout,
|
|
119
123
|
parseArgs: () => parseArgs,
|
|
120
124
|
prettyJson: () => prettyJson,
|
|
@@ -2274,6 +2278,11 @@ async function googleSignIn(credential) {
|
|
|
2274
2278
|
setSession(s);
|
|
2275
2279
|
return s;
|
|
2276
2280
|
}
|
|
2281
|
+
async function microsoftSignIn(credential) {
|
|
2282
|
+
const s = toSession(await authPost("/v1/auth/microsoft", { credential, product: _cfg.product }));
|
|
2283
|
+
setSession(s);
|
|
2284
|
+
return s;
|
|
2285
|
+
}
|
|
2277
2286
|
async function requestPasswordReset(email) {
|
|
2278
2287
|
await fetch(`${_cfg.engine}/v1/auth/request-password-reset`, {
|
|
2279
2288
|
method: "POST",
|
|
@@ -2339,13 +2348,13 @@ async function fetchBalance() {
|
|
|
2339
2348
|
}
|
|
2340
2349
|
|
|
2341
2350
|
// src/auth/AuthForm.jsx
|
|
2342
|
-
var
|
|
2351
|
+
var import_react15 = require("react");
|
|
2343
2352
|
|
|
2344
2353
|
// src/auth/GoogleButton.jsx
|
|
2345
2354
|
var import_react13 = require("react");
|
|
2346
2355
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2347
2356
|
var CLIENT_ID = "247853836408-ojk91u8901hdlbkevid4fohmrfdot17l.apps.googleusercontent.com";
|
|
2348
|
-
function GoogleButton({ onCredential, onError }) {
|
|
2357
|
+
function GoogleButton({ onCredential, onError, divider = true }) {
|
|
2349
2358
|
const ref = (0, import_react13.useRef)(null);
|
|
2350
2359
|
const [failed, setFailed] = (0, import_react13.useState)(false);
|
|
2351
2360
|
const cb = (0, import_react13.useRef)({ onCredential, onError });
|
|
@@ -2354,6 +2363,24 @@ function GoogleButton({ onCredential, onError }) {
|
|
|
2354
2363
|
if (!CLIENT_ID || !ref.current) return void 0;
|
|
2355
2364
|
const SRC = "https://accounts.google.com/gsi/client";
|
|
2356
2365
|
let done = false;
|
|
2366
|
+
let drawn = 0;
|
|
2367
|
+
let observer = null;
|
|
2368
|
+
const draw = () => {
|
|
2369
|
+
const g = window.google;
|
|
2370
|
+
if (!g?.accounts?.id || !ref.current) return;
|
|
2371
|
+
const box = ref.current.getBoundingClientRect().width || 320;
|
|
2372
|
+
const width = Math.round(Math.max(200, Math.min(400, box)));
|
|
2373
|
+
if (Math.abs(width - drawn) < 2) return;
|
|
2374
|
+
drawn = width;
|
|
2375
|
+
ref.current.innerHTML = "";
|
|
2376
|
+
g.accounts.id.renderButton(ref.current, {
|
|
2377
|
+
theme: "outline",
|
|
2378
|
+
size: "large",
|
|
2379
|
+
shape: "pill",
|
|
2380
|
+
text: "continue_with",
|
|
2381
|
+
width
|
|
2382
|
+
});
|
|
2383
|
+
};
|
|
2357
2384
|
const render = () => {
|
|
2358
2385
|
if (done) return;
|
|
2359
2386
|
const g = window.google;
|
|
@@ -2367,14 +2394,16 @@ function GoogleButton({ onCredential, onError }) {
|
|
|
2367
2394
|
else cb.current.onError?.("Google sign in was cancelled.");
|
|
2368
2395
|
}
|
|
2369
2396
|
});
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2397
|
+
draw();
|
|
2398
|
+
if (typeof ResizeObserver === "function") {
|
|
2399
|
+
observer = new ResizeObserver(() => {
|
|
2400
|
+
try {
|
|
2401
|
+
draw();
|
|
2402
|
+
} catch {
|
|
2403
|
+
}
|
|
2404
|
+
});
|
|
2405
|
+
observer.observe(ref.current);
|
|
2406
|
+
}
|
|
2378
2407
|
} catch {
|
|
2379
2408
|
setFailed(true);
|
|
2380
2409
|
}
|
|
@@ -2398,27 +2427,141 @@ function GoogleButton({ onCredential, onError }) {
|
|
|
2398
2427
|
return () => {
|
|
2399
2428
|
s?.removeEventListener("load", render);
|
|
2400
2429
|
window.clearTimeout(check);
|
|
2430
|
+
observer?.disconnect();
|
|
2401
2431
|
};
|
|
2402
2432
|
}, []);
|
|
2403
2433
|
if (!CLIENT_ID || failed) return null;
|
|
2404
2434
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2405
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "auth-or", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "or" }) }),
|
|
2435
|
+
divider && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "auth-or", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "or" }) }),
|
|
2406
2436
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, className: "auth-gwrap" })
|
|
2407
2437
|
] });
|
|
2408
2438
|
}
|
|
2409
2439
|
var GOOGLE_ENABLED = !!CLIENT_ID;
|
|
2410
2440
|
|
|
2411
|
-
// src/auth/
|
|
2441
|
+
// src/auth/MicrosoftButton.jsx
|
|
2442
|
+
var import_react14 = require("react");
|
|
2412
2443
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2444
|
+
var CLIENT_ID2 = "cb5c1b6e-aca8-48dd-9da9-31320de30b73";
|
|
2445
|
+
var AUTHORIZE = "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize";
|
|
2446
|
+
var RETURN_PATH = "/auth/microsoft";
|
|
2447
|
+
var GIVE_UP_MS = 5 * 60 * 1e3;
|
|
2448
|
+
var MICROSOFT_ENABLED = !!CLIENT_ID2;
|
|
2449
|
+
function randomHex(bytes = 16) {
|
|
2450
|
+
const a = new Uint8Array(bytes);
|
|
2451
|
+
crypto.getRandomValues(a);
|
|
2452
|
+
return Array.from(a, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
2453
|
+
}
|
|
2454
|
+
function jwtClaims(token) {
|
|
2455
|
+
try {
|
|
2456
|
+
const part = token.split(".")[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
2457
|
+
const bin = atob(part + "=".repeat((4 - part.length % 4) % 4));
|
|
2458
|
+
return JSON.parse(new TextDecoder().decode(Uint8Array.from(bin, (c) => c.charCodeAt(0))));
|
|
2459
|
+
} catch {
|
|
2460
|
+
return {};
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
function microsoftIdToken() {
|
|
2464
|
+
return new Promise((resolve, reject) => {
|
|
2465
|
+
const state = randomHex();
|
|
2466
|
+
const nonce = randomHex();
|
|
2467
|
+
const back = `${window.location.origin}${RETURN_PATH}`;
|
|
2468
|
+
const url = `${AUTHORIZE}?${new URLSearchParams({
|
|
2469
|
+
client_id: CLIENT_ID2,
|
|
2470
|
+
response_type: "id_token",
|
|
2471
|
+
redirect_uri: back,
|
|
2472
|
+
scope: "openid profile email",
|
|
2473
|
+
response_mode: "fragment",
|
|
2474
|
+
state,
|
|
2475
|
+
nonce,
|
|
2476
|
+
prompt: "select_account"
|
|
2477
|
+
})}`;
|
|
2478
|
+
const w = 480;
|
|
2479
|
+
const h = 640;
|
|
2480
|
+
const left = Math.max(0, window.screenX + (window.outerWidth - w) / 2);
|
|
2481
|
+
const top = Math.max(0, window.screenY + (window.outerHeight - h) / 2);
|
|
2482
|
+
const popup = window.open(url, "microsoft-sign-in", `width=${w},height=${h},left=${left},top=${top}`);
|
|
2483
|
+
if (!popup) {
|
|
2484
|
+
reject(new Error("Allow pop-ups for this site to sign in with Microsoft."));
|
|
2485
|
+
return;
|
|
2486
|
+
}
|
|
2487
|
+
const started = Date.now();
|
|
2488
|
+
const timer = window.setInterval(() => {
|
|
2489
|
+
if (popup.closed) {
|
|
2490
|
+
window.clearInterval(timer);
|
|
2491
|
+
reject(new Error("Microsoft sign in was cancelled."));
|
|
2492
|
+
return;
|
|
2493
|
+
}
|
|
2494
|
+
if (Date.now() - started > GIVE_UP_MS) {
|
|
2495
|
+
window.clearInterval(timer);
|
|
2496
|
+
popup.close();
|
|
2497
|
+
reject(new Error("Microsoft sign in took too long. Try again."));
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
let href = "";
|
|
2501
|
+
try {
|
|
2502
|
+
href = popup.location.href;
|
|
2503
|
+
} catch {
|
|
2504
|
+
return;
|
|
2505
|
+
}
|
|
2506
|
+
if (!href.startsWith(back)) return;
|
|
2507
|
+
window.clearInterval(timer);
|
|
2508
|
+
const params = new URLSearchParams(popup.location.hash.replace(/^#/, ""));
|
|
2509
|
+
popup.close();
|
|
2510
|
+
if (params.get("error")) {
|
|
2511
|
+
const why = (params.get("error_description") || "").split(/\r?\n/)[0].replace(/^AADSTS\d+:\s*/, "");
|
|
2512
|
+
reject(new Error(why || "Microsoft sign in did not complete."));
|
|
2513
|
+
return;
|
|
2514
|
+
}
|
|
2515
|
+
const token = params.get("id_token") || "";
|
|
2516
|
+
if (!token || params.get("state") !== state || jwtClaims(token).nonce !== nonce) {
|
|
2517
|
+
reject(new Error("Microsoft sign in could not be confirmed. Try again."));
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
resolve(token);
|
|
2521
|
+
}, 300);
|
|
2522
|
+
});
|
|
2523
|
+
}
|
|
2524
|
+
function MicrosoftLogo() {
|
|
2525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 21 21", "aria-hidden": "true", children: [
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x: "1", y: "1", width: "9", height: "9", fill: "#F25022" }),
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x: "11", y: "1", width: "9", height: "9", fill: "#7FBA00" }),
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x: "1", y: "11", width: "9", height: "9", fill: "#00A4EF" }),
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { x: "11", y: "11", width: "9", height: "9", fill: "#FFB900" })
|
|
2530
|
+
] });
|
|
2531
|
+
}
|
|
2532
|
+
function MicrosoftButton({ onCredential, onError, disabled }) {
|
|
2533
|
+
const [waiting, setWaiting] = (0, import_react14.useState)(false);
|
|
2534
|
+
const cb = (0, import_react14.useRef)({ onCredential, onError });
|
|
2535
|
+
cb.current = { onCredential, onError };
|
|
2536
|
+
if (!CLIENT_ID2) return null;
|
|
2537
|
+
async function start() {
|
|
2538
|
+
setWaiting(true);
|
|
2539
|
+
try {
|
|
2540
|
+
const token = await microsoftIdToken();
|
|
2541
|
+
await cb.current.onCredential(token);
|
|
2542
|
+
} catch (ex) {
|
|
2543
|
+
cb.current.onError?.(ex instanceof Error ? ex.message : "Microsoft sign in failed.");
|
|
2544
|
+
} finally {
|
|
2545
|
+
setWaiting(false);
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "auth-mswrap", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("button", { type: "button", className: "auth-msbtn", onClick: start, disabled: disabled || waiting, children: [
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MicrosoftLogo, {}),
|
|
2550
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: waiting ? "Waiting for Microsoft..." : "Sign in with Microsoft" })
|
|
2551
|
+
] }) });
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
// src/auth/AuthForm.jsx
|
|
2555
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2413
2556
|
function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = "" }) {
|
|
2414
|
-
const [mode, setMode] = (0,
|
|
2415
|
-
const [email, setEmail] = (0,
|
|
2416
|
-
const [password, setPassword] = (0,
|
|
2417
|
-
const [name, setName] = (0,
|
|
2418
|
-
const [err, setErr] = (0,
|
|
2419
|
-
const [busy, setBusy] = (0,
|
|
2420
|
-
const [choices, setChoices] = (0,
|
|
2421
|
-
const [resetSent, setResetSent] = (0,
|
|
2557
|
+
const [mode, setMode] = (0, import_react15.useState)("signin");
|
|
2558
|
+
const [email, setEmail] = (0, import_react15.useState)("");
|
|
2559
|
+
const [password, setPassword] = (0, import_react15.useState)("");
|
|
2560
|
+
const [name, setName] = (0, import_react15.useState)("");
|
|
2561
|
+
const [err, setErr] = (0, import_react15.useState)("");
|
|
2562
|
+
const [busy, setBusy] = (0, import_react15.useState)(false);
|
|
2563
|
+
const [choices, setChoices] = (0, import_react15.useState)(null);
|
|
2564
|
+
const [resetSent, setResetSent] = (0, import_react15.useState)(false);
|
|
2422
2565
|
async function enter(orgId) {
|
|
2423
2566
|
const session = await switchOrg(orgId);
|
|
2424
2567
|
onDone(session);
|
|
@@ -2447,6 +2590,17 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
2447
2590
|
setBusy(false);
|
|
2448
2591
|
}
|
|
2449
2592
|
}
|
|
2593
|
+
async function onMicrosoft(credential) {
|
|
2594
|
+
setErr("");
|
|
2595
|
+
setBusy(true);
|
|
2596
|
+
try {
|
|
2597
|
+
await afterAuth(await microsoftSignIn(credential));
|
|
2598
|
+
} catch (ex) {
|
|
2599
|
+
setErr(ex instanceof Error ? ex.message : "Microsoft sign in failed.");
|
|
2600
|
+
} finally {
|
|
2601
|
+
setBusy(false);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2450
2604
|
async function onGoogle(credential) {
|
|
2451
2605
|
setErr("");
|
|
2452
2606
|
setBusy(true);
|
|
@@ -2459,10 +2613,10 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
2459
2613
|
}
|
|
2460
2614
|
}
|
|
2461
2615
|
if (choices) {
|
|
2462
|
-
return /* @__PURE__ */ (0,
|
|
2463
|
-
/* @__PURE__ */ (0,
|
|
2464
|
-
/* @__PURE__ */ (0,
|
|
2465
|
-
/* @__PURE__ */ (0,
|
|
2616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "logo", children: brand }),
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h1", { children: "Choose workspace" }),
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2466
2620
|
"button",
|
|
2467
2621
|
{
|
|
2468
2622
|
type: "button",
|
|
@@ -2480,20 +2634,20 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
2480
2634
|
},
|
|
2481
2635
|
o.id
|
|
2482
2636
|
)) }),
|
|
2483
|
-
err && /* @__PURE__ */ (0,
|
|
2637
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "auth-err", children: err })
|
|
2484
2638
|
] });
|
|
2485
2639
|
}
|
|
2486
|
-
return /* @__PURE__ */ (0,
|
|
2487
|
-
/* @__PURE__ */ (0,
|
|
2488
|
-
/* @__PURE__ */ (0,
|
|
2489
|
-
/* @__PURE__ */ (0,
|
|
2490
|
-
mode === "forgot" ? resetSent ? /* @__PURE__ */ (0,
|
|
2491
|
-
/* @__PURE__ */ (0,
|
|
2640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("form", { onSubmit: submit, children: [
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "logo", children: brand }),
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle2 || "Welcome back." }),
|
|
2644
|
+
mode === "forgot" ? resetSent ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "auth-note", children: [
|
|
2492
2646
|
"If an account exists for ",
|
|
2493
|
-
/* @__PURE__ */ (0,
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("b", { children: email.trim() }),
|
|
2494
2648
|
", a password reset link is on its way. It is valid for 1 hour."
|
|
2495
2649
|
] }),
|
|
2496
|
-
/* @__PURE__ */ (0,
|
|
2650
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2497
2651
|
"button",
|
|
2498
2652
|
{
|
|
2499
2653
|
type: "button",
|
|
@@ -2507,36 +2661,36 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
2507
2661
|
children: "Back to sign in"
|
|
2508
2662
|
}
|
|
2509
2663
|
)
|
|
2510
|
-
] }) : /* @__PURE__ */ (0,
|
|
2511
|
-
/* @__PURE__ */ (0,
|
|
2512
|
-
/* @__PURE__ */ (0,
|
|
2513
|
-
/* @__PURE__ */ (0,
|
|
2664
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2665
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "field", children: [
|
|
2666
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { children: "Email" }),
|
|
2667
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
2514
2668
|
] }),
|
|
2515
|
-
err && /* @__PURE__ */ (0,
|
|
2516
|
-
/* @__PURE__ */ (0,
|
|
2517
|
-
/* @__PURE__ */ (0,
|
|
2669
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "auth-err", children: err }),
|
|
2670
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
|
|
2671
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "auth-switch", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: () => {
|
|
2518
2672
|
setErr("");
|
|
2519
2673
|
setMode("signin");
|
|
2520
2674
|
}, children: "Back to sign in" }) })
|
|
2521
|
-
] }) : /* @__PURE__ */ (0,
|
|
2522
|
-
mode === "register" && /* @__PURE__ */ (0,
|
|
2523
|
-
/* @__PURE__ */ (0,
|
|
2524
|
-
/* @__PURE__ */ (0,
|
|
2675
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
2676
|
+
mode === "register" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "field", children: [
|
|
2677
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { children: "Name" }),
|
|
2678
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
|
|
2525
2679
|
] }),
|
|
2526
|
-
/* @__PURE__ */ (0,
|
|
2527
|
-
/* @__PURE__ */ (0,
|
|
2528
|
-
/* @__PURE__ */ (0,
|
|
2680
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "field", children: [
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { children: "Email" }),
|
|
2682
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
|
|
2529
2683
|
] }),
|
|
2530
|
-
/* @__PURE__ */ (0,
|
|
2531
|
-
/* @__PURE__ */ (0,
|
|
2532
|
-
/* @__PURE__ */ (0,
|
|
2533
|
-
mode === "signin" && /* @__PURE__ */ (0,
|
|
2684
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "field", children: [
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "field-row", children: [
|
|
2686
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { children: "Password" }),
|
|
2687
|
+
mode === "signin" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "link-sm", onClick: () => {
|
|
2534
2688
|
setErr("");
|
|
2535
2689
|
setResetSent(false);
|
|
2536
2690
|
setMode("forgot");
|
|
2537
2691
|
}, children: "Forgot password?" })
|
|
2538
2692
|
] }),
|
|
2539
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2540
2694
|
"input",
|
|
2541
2695
|
{
|
|
2542
2696
|
className: "input",
|
|
@@ -2549,13 +2703,15 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
2549
2703
|
}
|
|
2550
2704
|
)
|
|
2551
2705
|
] }),
|
|
2552
|
-
err && /* @__PURE__ */ (0,
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2554
|
-
GOOGLE_ENABLED && /* @__PURE__ */ (0,
|
|
2555
|
-
/* @__PURE__ */ (0,
|
|
2706
|
+
err && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "auth-err", children: err }),
|
|
2707
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
|
|
2708
|
+
(GOOGLE_ENABLED || MICROSOFT_ENABLED) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "auth-or", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "or" }) }),
|
|
2709
|
+
GOOGLE_ENABLED && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GoogleButton, { onCredential: onGoogle, onError: setErr, divider: false }),
|
|
2710
|
+
MICROSOFT_ENABLED && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MicrosoftButton, { onCredential: onMicrosoft, onError: setErr, disabled: busy }),
|
|
2711
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "auth-switch", children: [
|
|
2556
2712
|
mode === "register" ? "Already have an account?" : `New to ${productName || "the product"}?`,
|
|
2557
2713
|
" ",
|
|
2558
|
-
/* @__PURE__ */ (0,
|
|
2714
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: () => {
|
|
2559
2715
|
setErr("");
|
|
2560
2716
|
setMode(mode === "register" ? "signin" : "register");
|
|
2561
2717
|
}, children: mode === "register" ? "Sign in" : "Create one" })
|
|
@@ -2565,15 +2721,15 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
|
|
|
2565
2721
|
}
|
|
2566
2722
|
|
|
2567
2723
|
// src/sheet/SheetGrid.jsx
|
|
2568
|
-
var
|
|
2724
|
+
var import_react18 = require("react");
|
|
2569
2725
|
|
|
2570
2726
|
// src/mention/MentionInput.jsx
|
|
2571
|
-
var
|
|
2727
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
2572
2728
|
|
|
2573
2729
|
// src/components/Popover.jsx
|
|
2574
|
-
var
|
|
2730
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
2575
2731
|
var import_react_dom2 = require("react-dom");
|
|
2576
|
-
var
|
|
2732
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2577
2733
|
var GAP = 6;
|
|
2578
2734
|
var MARGIN = 8;
|
|
2579
2735
|
function Popover(props) {
|
|
@@ -2588,9 +2744,9 @@ function Popover(props) {
|
|
|
2588
2744
|
className,
|
|
2589
2745
|
label
|
|
2590
2746
|
} = props;
|
|
2591
|
-
const popRef = (0,
|
|
2592
|
-
const [pos, setPos] = (0,
|
|
2593
|
-
(0,
|
|
2747
|
+
const popRef = (0, import_react16.useRef)(null);
|
|
2748
|
+
const [pos, setPos] = (0, import_react16.useState)(null);
|
|
2749
|
+
(0, import_react16.useEffect)(() => {
|
|
2594
2750
|
if (!open) {
|
|
2595
2751
|
setPos(null);
|
|
2596
2752
|
return void 0;
|
|
@@ -2617,7 +2773,7 @@ function Popover(props) {
|
|
|
2617
2773
|
window.removeEventListener("scroll", place, true);
|
|
2618
2774
|
};
|
|
2619
2775
|
}, [open, anchorRef, width, minHeight, placement]);
|
|
2620
|
-
(0,
|
|
2776
|
+
(0, import_react16.useEffect)(() => {
|
|
2621
2777
|
if (!open) return void 0;
|
|
2622
2778
|
const onDown = (e) => {
|
|
2623
2779
|
if (popRef.current?.contains(e.target)) return;
|
|
@@ -2627,11 +2783,11 @@ function Popover(props) {
|
|
|
2627
2783
|
document.addEventListener("pointerdown", onDown);
|
|
2628
2784
|
return () => document.removeEventListener("pointerdown", onDown);
|
|
2629
2785
|
}, [open, anchorRef, onClose]);
|
|
2630
|
-
const escape = (0,
|
|
2786
|
+
const escape = (0, import_react16.useCallback)(() => onClose?.(), [onClose]);
|
|
2631
2787
|
useOverlayEscape(open, escape);
|
|
2632
2788
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
2633
2789
|
return (0, import_react_dom2.createPortal)(
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
2790
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2635
2791
|
"div",
|
|
2636
2792
|
{
|
|
2637
2793
|
ref: popRef,
|
|
@@ -2809,7 +2965,7 @@ function activeTrigger(textBeforeCaret, trigger = "@", maxLen = 48) {
|
|
|
2809
2965
|
}
|
|
2810
2966
|
|
|
2811
2967
|
// src/mention/MentionInput.jsx
|
|
2812
|
-
var
|
|
2968
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2813
2969
|
var MENTION_ATTR = "data-mention-id";
|
|
2814
2970
|
function monogram(name) {
|
|
2815
2971
|
const parts = String(name || "").trim().split(/\s+/).filter(Boolean);
|
|
@@ -2916,7 +3072,7 @@ function selectionIn(root) {
|
|
|
2916
3072
|
if (!root.contains(r.startContainer)) return null;
|
|
2917
3073
|
return { sel, range: r };
|
|
2918
3074
|
}
|
|
2919
|
-
var MentionInput = (0,
|
|
3075
|
+
var MentionInput = (0, import_react17.forwardRef)(function MentionInput2(props, ref) {
|
|
2920
3076
|
const {
|
|
2921
3077
|
value = "",
|
|
2922
3078
|
onChange,
|
|
@@ -2940,13 +3096,13 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
2940
3096
|
onKeyDown,
|
|
2941
3097
|
id
|
|
2942
3098
|
} = props;
|
|
2943
|
-
const editorRef = (0,
|
|
2944
|
-
const resolver = (0,
|
|
2945
|
-
const [menu, setMenu] = (0,
|
|
2946
|
-
const [active, setActive] = (0,
|
|
2947
|
-
const [empty, setEmpty] = (0,
|
|
2948
|
-
const listId = (0,
|
|
2949
|
-
const emit = (0,
|
|
3099
|
+
const editorRef = (0, import_react17.useRef)(null);
|
|
3100
|
+
const resolver = (0, import_react17.useMemo)(() => makeResolver(items), [items]);
|
|
3101
|
+
const [menu, setMenu] = (0, import_react17.useState)(null);
|
|
3102
|
+
const [active, setActive] = (0, import_react17.useState)(0);
|
|
3103
|
+
const [empty, setEmpty] = (0, import_react17.useState)(!value);
|
|
3104
|
+
const listId = (0, import_react17.useMemo)(() => `uic-mention-${Math.random().toString(36).slice(2, 8)}`, []);
|
|
3105
|
+
const emit = (0, import_react17.useCallback)(() => {
|
|
2950
3106
|
const root = editorRef.current;
|
|
2951
3107
|
if (!root) return;
|
|
2952
3108
|
const segs = readSegments(root, resolver);
|
|
@@ -2954,7 +3110,7 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
2954
3110
|
setEmpty(!next);
|
|
2955
3111
|
if (onChange) onChange(next, mentionsOf(segs));
|
|
2956
3112
|
}, [resolver, format, onChange]);
|
|
2957
|
-
(0,
|
|
3113
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
2958
3114
|
const root = editorRef.current;
|
|
2959
3115
|
if (!root) return;
|
|
2960
3116
|
const current = serializeSegments(readSegments(root, resolver), format);
|
|
@@ -2962,19 +3118,19 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
2962
3118
|
writeSegments(root, parseValue(value || "", format, resolver));
|
|
2963
3119
|
setEmpty(!value);
|
|
2964
3120
|
}, [value, resolver, format]);
|
|
2965
|
-
(0,
|
|
3121
|
+
(0, import_react17.useEffect)(() => {
|
|
2966
3122
|
if (autoFocus && editorRef.current) editorRef.current.focus();
|
|
2967
3123
|
}, [autoFocus]);
|
|
2968
|
-
const closeMenu = (0,
|
|
2969
|
-
(0,
|
|
3124
|
+
const closeMenu = (0, import_react17.useCallback)(() => setMenu(null), []);
|
|
3125
|
+
(0, import_react17.useEffect)(() => {
|
|
2970
3126
|
if (onOpenChange) onOpenChange(!!menu);
|
|
2971
3127
|
}, [menu, onOpenChange]);
|
|
2972
|
-
const groups = (0,
|
|
2973
|
-
const flat = (0,
|
|
2974
|
-
(0,
|
|
3128
|
+
const groups = (0, import_react17.useMemo)(() => menu ? groupItems(items, menu.query) : [], [items, menu]);
|
|
3129
|
+
const flat = (0, import_react17.useMemo)(() => groups.flatMap((g) => g.items), [groups]);
|
|
3130
|
+
(0, import_react17.useEffect)(() => {
|
|
2975
3131
|
setActive(0);
|
|
2976
3132
|
}, [menu && menu.query, groups.length]);
|
|
2977
|
-
const syncMenu = (0,
|
|
3133
|
+
const syncMenu = (0, import_react17.useCallback)(() => {
|
|
2978
3134
|
const root = editorRef.current;
|
|
2979
3135
|
const s = root && selectionIn(root);
|
|
2980
3136
|
if (!s || !s.range.collapsed) {
|
|
@@ -2997,13 +3153,13 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
2997
3153
|
const rect = r.getBoundingClientRect();
|
|
2998
3154
|
setMenu({ node, start: hit.start, query: hit.query, rect: rect.width || rect.height ? rect : root.getBoundingClientRect() });
|
|
2999
3155
|
}, [trigger]);
|
|
3000
|
-
const anchorRef = (0,
|
|
3156
|
+
const anchorRef = (0, import_react17.useMemo)(() => ({
|
|
3001
3157
|
current: {
|
|
3002
3158
|
getBoundingClientRect: () => menu ? menu.rect : new DOMRect(),
|
|
3003
3159
|
contains: () => false
|
|
3004
3160
|
}
|
|
3005
3161
|
}), [menu]);
|
|
3006
|
-
const insertPill = (0,
|
|
3162
|
+
const insertPill = (0, import_react17.useCallback)((item, replace) => {
|
|
3007
3163
|
const root = editorRef.current;
|
|
3008
3164
|
if (!root || !item || item.disabled) return;
|
|
3009
3165
|
const pill = buildPillNode(item);
|
|
@@ -3029,8 +3185,8 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
3029
3185
|
setMenu(null);
|
|
3030
3186
|
emit();
|
|
3031
3187
|
}, [emit, trigger]);
|
|
3032
|
-
const pick = (0,
|
|
3033
|
-
const insertText = (0,
|
|
3188
|
+
const pick = (0, import_react17.useCallback)((item) => insertPill(item, menu), [insertPill, menu]);
|
|
3189
|
+
const insertText = (0, import_react17.useCallback)((text) => {
|
|
3034
3190
|
const root = editorRef.current;
|
|
3035
3191
|
if (!root) return;
|
|
3036
3192
|
root.focus();
|
|
@@ -3052,7 +3208,7 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
3052
3208
|
emit();
|
|
3053
3209
|
syncMenu();
|
|
3054
3210
|
}, [emit, syncMenu]);
|
|
3055
|
-
const wrapSelection = (0,
|
|
3211
|
+
const wrapSelection = (0, import_react17.useCallback)((before, after = "") => {
|
|
3056
3212
|
const root = editorRef.current;
|
|
3057
3213
|
if (!root) return;
|
|
3058
3214
|
root.focus();
|
|
@@ -3064,7 +3220,7 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
3064
3220
|
for (let i = 0; i < after.length; i++) sel && sel.modify && sel.modify("move", "backward", "character");
|
|
3065
3221
|
}
|
|
3066
3222
|
}, [insertText]);
|
|
3067
|
-
const prefixLine = (0,
|
|
3223
|
+
const prefixLine = (0, import_react17.useCallback)((prefix) => {
|
|
3068
3224
|
const root = editorRef.current;
|
|
3069
3225
|
if (!root) return;
|
|
3070
3226
|
root.focus();
|
|
@@ -3074,7 +3230,7 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
3074
3230
|
const atLineStart = !before || /\n$/.test(before) || node && node.nodeType !== 3;
|
|
3075
3231
|
insertText((atLineStart ? "" : "\n") + prefix);
|
|
3076
3232
|
}, [insertText]);
|
|
3077
|
-
(0,
|
|
3233
|
+
(0, import_react17.useImperativeHandle)(ref, () => ({
|
|
3078
3234
|
focus: () => editorRef.current && editorRef.current.focus(),
|
|
3079
3235
|
clear: () => {
|
|
3080
3236
|
const root = editorRef.current;
|
|
@@ -3176,13 +3332,13 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
3176
3332
|
const handleFocus = (e) => {
|
|
3177
3333
|
if (onFocus) onFocus(e);
|
|
3178
3334
|
};
|
|
3179
|
-
(0,
|
|
3335
|
+
(0, import_react17.useEffect)(() => {
|
|
3180
3336
|
if (!menu) return void 0;
|
|
3181
3337
|
const onSel = () => syncMenu();
|
|
3182
3338
|
document.addEventListener("selectionchange", onSel);
|
|
3183
3339
|
return () => document.removeEventListener("selectionchange", onSel);
|
|
3184
3340
|
}, [menu, syncMenu]);
|
|
3185
|
-
(0,
|
|
3341
|
+
(0, import_react17.useEffect)(() => {
|
|
3186
3342
|
if (!menu) return;
|
|
3187
3343
|
const el = document.getElementById(`${listId}-${active}`);
|
|
3188
3344
|
const list = el && el.closest(".uic-mention-menu");
|
|
@@ -3197,14 +3353,14 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
3197
3353
|
const n = renderIcon(item);
|
|
3198
3354
|
if (n) return n;
|
|
3199
3355
|
}
|
|
3200
|
-
if (item.avatar) return /* @__PURE__ */ (0,
|
|
3356
|
+
if (item.avatar) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: item.avatar, alt: "" });
|
|
3201
3357
|
if (typeof item.icon === "string" && item.icon) return item.icon;
|
|
3202
3358
|
if (item.icon) return item.icon;
|
|
3203
|
-
return /* @__PURE__ */ (0,
|
|
3359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "is-mono", children: monogram(item.name) });
|
|
3204
3360
|
};
|
|
3205
3361
|
let index = -1;
|
|
3206
|
-
return /* @__PURE__ */ (0,
|
|
3207
|
-
/* @__PURE__ */ (0,
|
|
3362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: ["uic-mention-field", disabled ? "is-disabled" : "", className].filter(Boolean).join(" "), children: [
|
|
3363
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3208
3364
|
"div",
|
|
3209
3365
|
{
|
|
3210
3366
|
ref: editorRef,
|
|
@@ -3228,16 +3384,16 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
3228
3384
|
onBlur: handleBlur
|
|
3229
3385
|
}
|
|
3230
3386
|
),
|
|
3231
|
-
/* @__PURE__ */ (0,
|
|
3232
|
-
menuTitle ? /* @__PURE__ */ (0,
|
|
3233
|
-
groups.map((g) => /* @__PURE__ */ (0,
|
|
3234
|
-
g.section ? /* @__PURE__ */ (0,
|
|
3387
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Popover, { open: !!menu, anchorRef, onClose: closeMenu, width: menuWidth, minHeight: 120, className: "uic-mention-pop", label: menuTitle || "Mentions", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "uic-mention-menu", role: "listbox", id: listId, onMouseDown: (e) => e.preventDefault(), children: [
|
|
3388
|
+
menuTitle ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uic-mention-head", children: menuTitle }) : null,
|
|
3389
|
+
groups.map((g) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "uic-mention-group", children: [
|
|
3390
|
+
g.section ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uic-mention-sec", children: g.section }) : null,
|
|
3235
3391
|
g.items.map((item) => {
|
|
3236
3392
|
index += 1;
|
|
3237
3393
|
const i = index;
|
|
3238
3394
|
const dis = !!item.disabled;
|
|
3239
3395
|
const reason = typeof item.disabled === "string" ? item.disabled : null;
|
|
3240
|
-
return /* @__PURE__ */ (0,
|
|
3396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3241
3397
|
"button",
|
|
3242
3398
|
{
|
|
3243
3399
|
type: "button",
|
|
@@ -3252,30 +3408,30 @@ var MentionInput = (0, import_react16.forwardRef)(function MentionInput2(props,
|
|
|
3252
3408
|
if (!dis) pick(item);
|
|
3253
3409
|
},
|
|
3254
3410
|
children: [
|
|
3255
|
-
/* @__PURE__ */ (0,
|
|
3256
|
-
/* @__PURE__ */ (0,
|
|
3257
|
-
/* @__PURE__ */ (0,
|
|
3258
|
-
item.description ? /* @__PURE__ */ (0,
|
|
3411
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-mention-ic", children: iconOf(item) }),
|
|
3412
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "uic-mention-text", children: [
|
|
3413
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-mention-name", children: item.name }),
|
|
3414
|
+
item.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-mention-desc", children: item.description }) : null
|
|
3259
3415
|
] }),
|
|
3260
|
-
reason || item.tag ? /* @__PURE__ */ (0,
|
|
3416
|
+
reason || item.tag ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-mention-tag", children: reason || item.tag }) : null
|
|
3261
3417
|
]
|
|
3262
3418
|
},
|
|
3263
3419
|
item.id
|
|
3264
3420
|
);
|
|
3265
3421
|
})
|
|
3266
3422
|
] }, g.section || "_")),
|
|
3267
|
-
!flat.length ? /* @__PURE__ */ (0,
|
|
3423
|
+
!flat.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uic-mention-empty", children: emptyText }) : null
|
|
3268
3424
|
] }) })
|
|
3269
3425
|
] });
|
|
3270
3426
|
});
|
|
3271
3427
|
function MentionText({ value, items = [], format = CURLY, className = "", renderIcon }) {
|
|
3272
|
-
const resolver = (0,
|
|
3273
|
-
const segs = (0,
|
|
3274
|
-
return /* @__PURE__ */ (0,
|
|
3275
|
-
if (s.type === "text") return /* @__PURE__ */ (0,
|
|
3428
|
+
const resolver = (0, import_react17.useMemo)(() => makeResolver(items), [items]);
|
|
3429
|
+
const segs = (0, import_react17.useMemo)(() => parseValue(value || "", format, resolver), [value, format, resolver]);
|
|
3430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: ["uic-mention-text-view", className].filter(Boolean).join(" "), children: segs.map((s, i) => {
|
|
3431
|
+
if (s.type === "text") return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react17.default.Fragment, { children: s.text }, i);
|
|
3276
3432
|
const item = s.item || s;
|
|
3277
3433
|
const icon = renderIcon ? renderIcon(item) : null;
|
|
3278
|
-
return /* @__PURE__ */ (0,
|
|
3434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3279
3435
|
"span",
|
|
3280
3436
|
{
|
|
3281
3437
|
className: "uic-mention",
|
|
@@ -3283,8 +3439,8 @@ function MentionText({ value, items = [], format = CURLY, className = "", render
|
|
|
3283
3439
|
title: item.description || void 0,
|
|
3284
3440
|
style: item.color ? { "--uic-mention-color": item.color } : void 0,
|
|
3285
3441
|
children: [
|
|
3286
|
-
/* @__PURE__ */ (0,
|
|
3287
|
-
/* @__PURE__ */ (0,
|
|
3442
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-mention-ic" + (icon || typeof item.icon === "string" && item.icon || item.avatar ? "" : " is-mono"), children: icon || (item.avatar ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { src: item.avatar, alt: "" }) : typeof item.icon === "string" && item.icon ? item.icon : monogram(item.name)) }),
|
|
3443
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-mention-name", children: s.name })
|
|
3288
3444
|
]
|
|
3289
3445
|
},
|
|
3290
3446
|
i
|
|
@@ -3303,7 +3459,7 @@ function withAlpha(hex, alpha) {
|
|
|
3303
3459
|
}
|
|
3304
3460
|
|
|
3305
3461
|
// src/sheet/SheetGrid.jsx
|
|
3306
|
-
var
|
|
3462
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3307
3463
|
var cellKey = (rowId, colId) => `${rowId}:${colId}`;
|
|
3308
3464
|
var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
|
|
3309
3465
|
var TYPE_LABEL = {
|
|
@@ -3328,8 +3484,8 @@ var COMPUTE_KINDS = [
|
|
|
3328
3484
|
var RESOURCE_KINDS = ["image", "sheet", "slides", "workflow", "graph"];
|
|
3329
3485
|
var RESOURCE_ICON = { image: "\u{1F5BC}", sheet: "\u25A6", slides: "\u25A4", workflow: "\u2699", graph: "\u25C9" };
|
|
3330
3486
|
function PopPortal({ anchor, width = 250, estHeight = 300, className, children, onClose }) {
|
|
3331
|
-
const boxRef = (0,
|
|
3332
|
-
(0,
|
|
3487
|
+
const boxRef = (0, import_react18.useRef)(null);
|
|
3488
|
+
(0, import_react18.useEffect)(() => {
|
|
3333
3489
|
if (!onClose) return void 0;
|
|
3334
3490
|
const close = (e) => {
|
|
3335
3491
|
if (e?.type === "scroll" && boxRef.current && e.target instanceof Node && boxRef.current.contains(e.target)) return;
|
|
@@ -3347,7 +3503,7 @@ function PopPortal({ anchor, width = 250, estHeight = 300, className, children,
|
|
|
3347
3503
|
let top = anchor.bottom + 6;
|
|
3348
3504
|
if (top + estHeight > window.innerHeight - 8) top = Math.max(8, anchor.top - estHeight - 6);
|
|
3349
3505
|
return (0, import_react_dom3.createPortal)(
|
|
3350
|
-
/* @__PURE__ */ (0,
|
|
3506
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: boxRef, className, style: { position: "fixed", top, left, width, zIndex: 1e3 }, children }),
|
|
3351
3507
|
document.body
|
|
3352
3508
|
);
|
|
3353
3509
|
}
|
|
@@ -3381,8 +3537,8 @@ function pillColor(label, options) {
|
|
|
3381
3537
|
return PILL_FALLBACKS[h % PILL_FALLBACKS.length];
|
|
3382
3538
|
}
|
|
3383
3539
|
function RefImage({ refVal, fetchBlobUrl }) {
|
|
3384
|
-
const [src, setSrc] = (0,
|
|
3385
|
-
(0,
|
|
3540
|
+
const [src, setSrc] = (0, import_react18.useState)(/^https?:\/\//i.test(refVal.url || "") ? refVal.url : null);
|
|
3541
|
+
(0, import_react18.useEffect)(() => {
|
|
3386
3542
|
let dead = false;
|
|
3387
3543
|
let obj = null;
|
|
3388
3544
|
if (!src && refVal.url && fetchBlobUrl) {
|
|
@@ -3398,16 +3554,16 @@ function RefImage({ refVal, fetchBlobUrl }) {
|
|
|
3398
3554
|
if (obj) URL.revokeObjectURL(obj);
|
|
3399
3555
|
};
|
|
3400
3556
|
}, [refVal.url]);
|
|
3401
|
-
if (!src) return /* @__PURE__ */ (0,
|
|
3557
|
+
if (!src) return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "shg-refchip", children: [
|
|
3402
3558
|
RESOURCE_ICON.image,
|
|
3403
3559
|
" ",
|
|
3404
3560
|
refVal.name || "image"
|
|
3405
3561
|
] });
|
|
3406
|
-
return /* @__PURE__ */ (0,
|
|
3562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { className: "shg-refimg", src, alt: refVal.name || "", title: refVal.name || "" });
|
|
3407
3563
|
}
|
|
3408
3564
|
function ResourceChip({ refVal, onOpen }) {
|
|
3409
3565
|
const icon = RESOURCE_ICON[refVal.kind] || "\u25C7";
|
|
3410
|
-
return /* @__PURE__ */ (0,
|
|
3566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3411
3567
|
"button",
|
|
3412
3568
|
{
|
|
3413
3569
|
className: "shg-refchip shg-refchip-btn",
|
|
@@ -3417,42 +3573,42 @@ function ResourceChip({ refVal, onOpen }) {
|
|
|
3417
3573
|
onOpen && onOpen(refVal);
|
|
3418
3574
|
},
|
|
3419
3575
|
children: [
|
|
3420
|
-
/* @__PURE__ */ (0,
|
|
3421
|
-
/* @__PURE__ */ (0,
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-refchip-ic", children: icon }),
|
|
3577
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-refchip-name", children: refVal.name || refVal.id || refVal.kind })
|
|
3422
3578
|
]
|
|
3423
3579
|
}
|
|
3424
3580
|
);
|
|
3425
3581
|
}
|
|
3426
3582
|
function StatusDot({ status }) {
|
|
3427
3583
|
if (!status || status === "empty" || status === "done") return null;
|
|
3428
|
-
return /* @__PURE__ */ (0,
|
|
3584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: `shg-dot shg-dot-${status}`, title: status });
|
|
3429
3585
|
}
|
|
3430
3586
|
function CellValue({ cell, col, fetchBlobUrl, onOpenResource }) {
|
|
3431
3587
|
const v = cell?.value;
|
|
3432
|
-
if (v === void 0 || v === null || v === "") return /* @__PURE__ */ (0,
|
|
3588
|
+
if (v === void 0 || v === null || v === "") return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-val-txt" });
|
|
3433
3589
|
if (v && typeof v === "object" && !Array.isArray(v) && v.kind) {
|
|
3434
|
-
if (v.kind === "image") return /* @__PURE__ */ (0,
|
|
3435
|
-
return /* @__PURE__ */ (0,
|
|
3590
|
+
if (v.kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RefImage, { refVal: v, fetchBlobUrl });
|
|
3591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ResourceChip, { refVal: v, onOpen: onOpenResource });
|
|
3436
3592
|
}
|
|
3437
3593
|
const styled = col.type !== "tags" && optionFor(v, col.options);
|
|
3438
|
-
if (styled) return /* @__PURE__ */ (0,
|
|
3594
|
+
if (styled) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-pill", style: { background: styled.color }, children: styled.label });
|
|
3439
3595
|
switch (col.type) {
|
|
3440
3596
|
case "select":
|
|
3441
|
-
return /* @__PURE__ */ (0,
|
|
3597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-pill", style: { background: pillColor(String(v), col.options) }, children: String(v) });
|
|
3442
3598
|
case "tags": {
|
|
3443
3599
|
const tags = Array.isArray(v) ? v : String(v).split(",").map((s) => s.trim()).filter(Boolean);
|
|
3444
|
-
return /* @__PURE__ */ (0,
|
|
3600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-pills", children: tags.map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-pill", style: { background: pillColor(t, col.options) }, children: t }, t)) });
|
|
3445
3601
|
}
|
|
3446
3602
|
case "checkbox":
|
|
3447
|
-
return /* @__PURE__ */ (0,
|
|
3603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-check" + (v ? " on" : ""), children: v ? "\u2713" : "" });
|
|
3448
3604
|
case "url": {
|
|
3449
3605
|
const href = /^https?:\/\//i.test(String(v)) ? String(v) : `https://${v}`;
|
|
3450
|
-
return /* @__PURE__ */ (0,
|
|
3606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("a", { className: "shg-link", href, target: "_blank", rel: "noreferrer", onClick: (e) => e.stopPropagation(), children: String(v) });
|
|
3451
3607
|
}
|
|
3452
3608
|
case "number":
|
|
3453
|
-
return /* @__PURE__ */ (0,
|
|
3609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-val-txt shg-num", children: String(v) });
|
|
3454
3610
|
default:
|
|
3455
|
-
return /* @__PURE__ */ (0,
|
|
3611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-val-txt", children: typeof v === "object" ? JSON.stringify(v) : String(v) });
|
|
3456
3612
|
}
|
|
3457
3613
|
}
|
|
3458
3614
|
function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetchBlobUrl, onOpenResource, peers, onPresence }) {
|
|
@@ -3461,18 +3617,18 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3461
3617
|
const cells = sheet?.cells || {};
|
|
3462
3618
|
const tabId = sheet?.id;
|
|
3463
3619
|
const canEdit = !readOnly && !!ops && !!tabId;
|
|
3464
|
-
const [editing, setEditing] = (0,
|
|
3465
|
-
const [draft, setDraft] = (0,
|
|
3466
|
-
const [menuCol, setMenuCol] = (0,
|
|
3467
|
-
const [sizeDraft, setSizeDraft] = (0,
|
|
3468
|
-
const [dnd, setDnd] = (0,
|
|
3469
|
-
const [dropAt, setDropAt] = (0,
|
|
3470
|
-
const inputRef = (0,
|
|
3471
|
-
const dragRef = (0,
|
|
3472
|
-
const [sel, setSel] = (0,
|
|
3473
|
-
const dragSel = (0,
|
|
3474
|
-
const rootRef = (0,
|
|
3475
|
-
const presenceRef = (0,
|
|
3620
|
+
const [editing, setEditing] = (0, import_react18.useState)(null);
|
|
3621
|
+
const [draft, setDraft] = (0, import_react18.useState)("");
|
|
3622
|
+
const [menuCol, setMenuCol] = (0, import_react18.useState)(null);
|
|
3623
|
+
const [sizeDraft, setSizeDraft] = (0, import_react18.useState)({});
|
|
3624
|
+
const [dnd, setDnd] = (0, import_react18.useState)(null);
|
|
3625
|
+
const [dropAt, setDropAt] = (0, import_react18.useState)(null);
|
|
3626
|
+
const inputRef = (0, import_react18.useRef)(null);
|
|
3627
|
+
const dragRef = (0, import_react18.useRef)(null);
|
|
3628
|
+
const [sel, setSel] = (0, import_react18.useState)(null);
|
|
3629
|
+
const dragSel = (0, import_react18.useRef)(false);
|
|
3630
|
+
const rootRef = (0, import_react18.useRef)(null);
|
|
3631
|
+
const presenceRef = (0, import_react18.useRef)(onPresence);
|
|
3476
3632
|
presenceRef.current = onPresence;
|
|
3477
3633
|
const range = sel ? {
|
|
3478
3634
|
r0: Math.min(sel.a.r, sel.f.r),
|
|
@@ -3488,14 +3644,14 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3488
3644
|
const f = clampSel({ r: cur.f.r + dr, c: cur.f.c + dc });
|
|
3489
3645
|
return { a: extend ? cur.a : f, f };
|
|
3490
3646
|
});
|
|
3491
|
-
(0,
|
|
3647
|
+
(0, import_react18.useEffect)(() => {
|
|
3492
3648
|
const up = () => {
|
|
3493
3649
|
dragSel.current = false;
|
|
3494
3650
|
};
|
|
3495
3651
|
window.addEventListener("mouseup", up);
|
|
3496
3652
|
return () => window.removeEventListener("mouseup", up);
|
|
3497
3653
|
}, []);
|
|
3498
|
-
(0,
|
|
3654
|
+
(0, import_react18.useEffect)(() => {
|
|
3499
3655
|
const fn = presenceRef.current;
|
|
3500
3656
|
if (!fn) return;
|
|
3501
3657
|
const ids = (p) => [rows[p.r]?.id, columns[p.c]?.id];
|
|
@@ -3504,7 +3660,7 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3504
3660
|
typing: editing && typeof draft === "string" ? { key: cellKey(editing.rowId, editing.colId), text: draft } : null
|
|
3505
3661
|
});
|
|
3506
3662
|
}, [sel, editing, draft, rows, columns]);
|
|
3507
|
-
const peerLayer = (0,
|
|
3663
|
+
const peerLayer = (0, import_react18.useMemo)(() => {
|
|
3508
3664
|
const focus = {}, tint = {}, typing = {};
|
|
3509
3665
|
const rIdx = new Map(rows.map((r, i) => [r.id, i]));
|
|
3510
3666
|
const cIdx = new Map(columns.map((c, i) => [c.id, i]));
|
|
@@ -3615,7 +3771,7 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3615
3771
|
const numW = Math.max(40, 24 + String(rows.length || 1).length * 9);
|
|
3616
3772
|
const numStyle = { width: numW, minWidth: numW, maxWidth: numW };
|
|
3617
3773
|
const rowHeight = (row) => sizeDraft.row && sizeDraft.row[row.id] || row.height || void 0;
|
|
3618
|
-
(0,
|
|
3774
|
+
(0, import_react18.useEffect)(() => {
|
|
3619
3775
|
if (editing && inputRef.current) inputRef.current.focus();
|
|
3620
3776
|
}, [editing]);
|
|
3621
3777
|
const setCell = (rowId, colId, value) => {
|
|
@@ -3768,7 +3924,7 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3768
3924
|
if (col.type === "resource") {
|
|
3769
3925
|
const d = typeof draft === "object" && draft ? draft : { kind: "sheet" };
|
|
3770
3926
|
const set = (k, v) => setDraft({ ...d, [k]: v });
|
|
3771
|
-
return /* @__PURE__ */ (0,
|
|
3927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3772
3928
|
PopPortal,
|
|
3773
3929
|
{
|
|
3774
3930
|
anchor: editing.rect,
|
|
@@ -3776,17 +3932,17 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3776
3932
|
estHeight: 230,
|
|
3777
3933
|
className: "shg-select-pop shg-ref-pop",
|
|
3778
3934
|
onClose: () => setEditing(null),
|
|
3779
|
-
children: /* @__PURE__ */ (0,
|
|
3780
|
-
/* @__PURE__ */ (0,
|
|
3781
|
-
/* @__PURE__ */ (0,
|
|
3782
|
-
/* @__PURE__ */ (0,
|
|
3783
|
-
/* @__PURE__ */ (0,
|
|
3784
|
-
/* @__PURE__ */ (0,
|
|
3785
|
-
/* @__PURE__ */ (0,
|
|
3935
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { onClick: (e) => e.stopPropagation(), children: [
|
|
3936
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { className: "shg-menu-input", value: d.kind || "sheet", onChange: (e) => set("kind", e.target.value), children: RESOURCE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: k, children: k }, k)) }),
|
|
3937
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "shg-menu-input", placeholder: "Name", value: d.name || "", onChange: (e) => set("name", e.target.value) }),
|
|
3938
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "shg-menu-input", placeholder: "Resource id (e.g. sheet.\u2026)", value: d.id || "", onChange: (e) => set("id", e.target.value) }),
|
|
3939
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "shg-menu-input", placeholder: "or URL", value: d.url || "", onChange: (e) => set("url", e.target.value) }),
|
|
3940
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "shg-menu-actions", children: [
|
|
3941
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "shg-pop-clear", onClick: () => {
|
|
3786
3942
|
setCell(editing.rowId, editing.colId, null);
|
|
3787
3943
|
setEditing(null);
|
|
3788
3944
|
}, children: "Clear" }),
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "shg-menu-apply", onClick: () => {
|
|
3790
3946
|
setCell(editing.rowId, editing.colId, d);
|
|
3791
3947
|
setEditing(null);
|
|
3792
3948
|
}, children: "Set" })
|
|
@@ -3797,7 +3953,7 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3797
3953
|
}
|
|
3798
3954
|
if (col.type === "select") {
|
|
3799
3955
|
const opts = normOptions(col.options);
|
|
3800
|
-
return /* @__PURE__ */ (0,
|
|
3956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3801
3957
|
PopPortal,
|
|
3802
3958
|
{
|
|
3803
3959
|
anchor: editing.rect,
|
|
@@ -3806,8 +3962,8 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3806
3962
|
className: "shg-select-pop",
|
|
3807
3963
|
onClose: () => setEditing(null),
|
|
3808
3964
|
children: [
|
|
3809
|
-
opts.length === 0 && /* @__PURE__ */ (0,
|
|
3810
|
-
opts.map((o) => /* @__PURE__ */ (0,
|
|
3965
|
+
opts.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "shg-pop-note", children: "No options yet \u2014 add them in the column menu." }),
|
|
3966
|
+
opts.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3811
3967
|
"button",
|
|
3812
3968
|
{
|
|
3813
3969
|
className: "shg-pill shg-pill-btn",
|
|
@@ -3821,7 +3977,7 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3821
3977
|
},
|
|
3822
3978
|
o.label
|
|
3823
3979
|
)),
|
|
3824
|
-
/* @__PURE__ */ (0,
|
|
3980
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3825
3981
|
"button",
|
|
3826
3982
|
{
|
|
3827
3983
|
className: "shg-pop-clear",
|
|
@@ -3838,7 +3994,7 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3838
3994
|
);
|
|
3839
3995
|
}
|
|
3840
3996
|
const inputType = col.type === "date" ? "date" : col.type === "number" ? "number" : "text";
|
|
3841
|
-
return /* @__PURE__ */ (0,
|
|
3997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3842
3998
|
"input",
|
|
3843
3999
|
{
|
|
3844
4000
|
ref: inputRef,
|
|
@@ -3867,18 +4023,18 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3867
4023
|
}
|
|
3868
4024
|
);
|
|
3869
4025
|
};
|
|
3870
|
-
return /* @__PURE__ */ (0,
|
|
3871
|
-
/* @__PURE__ */ (0,
|
|
3872
|
-
/* @__PURE__ */ (0,
|
|
3873
|
-
columns.map((col) => /* @__PURE__ */ (0,
|
|
4026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "shg", ref: rootRef, tabIndex: 0, onKeyDown, onCopy: copySelection, onPaste: pasteAt, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "shg-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("table", { className: "shg-table", children: [
|
|
4027
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { children: [
|
|
4028
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("th", { className: "shg-corner", style: numStyle }),
|
|
4029
|
+
columns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3874
4030
|
"th",
|
|
3875
4031
|
{
|
|
3876
4032
|
className: "shg-col" + (col.type === "compute" ? " shg-col-compute" : "") + dndClass("col", col.id),
|
|
3877
4033
|
style: colWidth(col) ? { width: colWidth(col), minWidth: colWidth(col), maxWidth: colWidth(col) } : void 0,
|
|
3878
4034
|
...dndProps("col", col.id),
|
|
3879
4035
|
children: [
|
|
3880
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3881
|
-
/* @__PURE__ */ (0,
|
|
4036
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-resize-col", onMouseDown: (e) => startResize(e, "col", col.id, colWidth(col) || e.currentTarget.closest("th").offsetWidth) }),
|
|
4037
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "shg-col-h", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3882
4038
|
ColumnHeader,
|
|
3883
4039
|
{
|
|
3884
4040
|
col,
|
|
@@ -3902,10 +4058,10 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3902
4058
|
},
|
|
3903
4059
|
col.id
|
|
3904
4060
|
)),
|
|
3905
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
4061
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("th", { className: "shg-add-col", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "shg-add", onClick: addColumn, title: "Add column", children: "+" }) })
|
|
3906
4062
|
] }) }),
|
|
3907
|
-
/* @__PURE__ */ (0,
|
|
3908
|
-
rows.map((row, ri) => /* @__PURE__ */ (0,
|
|
4063
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tbody", { children: [
|
|
4064
|
+
rows.map((row, ri) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3909
4065
|
"tr",
|
|
3910
4066
|
{
|
|
3911
4067
|
style: {
|
|
@@ -3913,7 +4069,7 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3913
4069
|
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
3914
4070
|
},
|
|
3915
4071
|
children: [
|
|
3916
|
-
/* @__PURE__ */ (0,
|
|
4072
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3917
4073
|
"td",
|
|
3918
4074
|
{
|
|
3919
4075
|
className: "shg-rownum" + dndClass("row", row.id),
|
|
@@ -3921,9 +4077,9 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3921
4077
|
title: "Drag to reorder",
|
|
3922
4078
|
...dndProps("row", row.id),
|
|
3923
4079
|
children: [
|
|
3924
|
-
/* @__PURE__ */ (0,
|
|
3925
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
3926
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
4080
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: ri + 1 }),
|
|
4081
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "shg-rowdel", onClick: () => deleteRow(row.id), title: "Delete row", children: "\xD7" }),
|
|
4082
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-resize-row", onMouseDown: (e) => startResize(e, "row", row.id, rowHeight(row) || e.currentTarget.closest("tr").offsetHeight) })
|
|
3927
4083
|
]
|
|
3928
4084
|
}
|
|
3929
4085
|
),
|
|
@@ -3938,7 +4094,7 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3938
4094
|
if (focused) shadows.push("inset 0 0 0 2px var(--brand, #0E7490)");
|
|
3939
4095
|
if (peer) shadows.push(`inset 0 0 0 2px ${peer.color}`);
|
|
3940
4096
|
const tint = !selected && peerLayer.tint[key];
|
|
3941
|
-
return /* @__PURE__ */ (0,
|
|
4097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3942
4098
|
"td",
|
|
3943
4099
|
{
|
|
3944
4100
|
"data-cell": key,
|
|
@@ -3967,16 +4123,16 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3967
4123
|
},
|
|
3968
4124
|
title: c.error || "",
|
|
3969
4125
|
children: [
|
|
3970
|
-
peer && /* @__PURE__ */ (0,
|
|
3971
|
-
isEditing ? renderEditor(col) : /* @__PURE__ */ (0,
|
|
4126
|
+
peer && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
|
|
4127
|
+
isEditing ? renderEditor(col) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3972
4128
|
"div",
|
|
3973
4129
|
{
|
|
3974
4130
|
className: "shg-val",
|
|
3975
4131
|
style: { maxWidth: colWidth(col) ? colWidth(col) - 20 : 400 },
|
|
3976
4132
|
children: [
|
|
3977
|
-
col.type === "compute" && /* @__PURE__ */ (0,
|
|
3978
|
-
ghost ? /* @__PURE__ */ (0,
|
|
3979
|
-
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */ (0,
|
|
4133
|
+
col.type === "compute" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StatusDot, { status: c.status }),
|
|
4134
|
+
ghost ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-ghost", style: { color: ghost.color }, title: `${ghost.name} is typing`, children: ghost.text }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
|
|
4135
|
+
col.type === "compute" && !readOnly && onRunCell && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3980
4136
|
"button",
|
|
3981
4137
|
{
|
|
3982
4138
|
className: "shg-runcell",
|
|
@@ -3996,27 +4152,27 @@ function SheetGrid({ sheet, ops, onRunCell, onRunColumn, readOnly = false, fetch
|
|
|
3996
4152
|
col.id
|
|
3997
4153
|
);
|
|
3998
4154
|
}),
|
|
3999
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
4155
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("td", { className: "shg-pad" })
|
|
4000
4156
|
]
|
|
4001
4157
|
},
|
|
4002
4158
|
row.id
|
|
4003
4159
|
)),
|
|
4004
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
4005
|
-
/* @__PURE__ */ (0,
|
|
4006
|
-
/* @__PURE__ */ (0,
|
|
4160
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("tr", { className: "shg-ghost-row", onClick: addRow, children: [
|
|
4161
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("td", { className: "shg-rownum shg-ghost-num", style: numStyle, children: "+" }),
|
|
4162
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("td", { className: "shg-ghost-cell", colSpan: columns.length + 1, children: "New row" })
|
|
4007
4163
|
] })
|
|
4008
4164
|
] })
|
|
4009
4165
|
] }) }) });
|
|
4010
4166
|
}
|
|
4011
4167
|
function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, onCloseMenu, onRename, onConfigure, onDelete, onRun, width }) {
|
|
4012
|
-
const [editing, setEditing] = (0,
|
|
4013
|
-
const [name, setName] = (0,
|
|
4014
|
-
(0,
|
|
4168
|
+
const [editing, setEditing] = (0, import_react18.useState)(false);
|
|
4169
|
+
const [name, setName] = (0, import_react18.useState)(col.name);
|
|
4170
|
+
(0, import_react18.useEffect)(() => setName(col.name), [col.name]);
|
|
4015
4171
|
const w = Number(width) || 0;
|
|
4016
4172
|
const fit = w && w < 160 ? " tight" : w && w < 200 ? " narrow" : "";
|
|
4017
|
-
return /* @__PURE__ */ (0,
|
|
4018
|
-
/* @__PURE__ */ (0,
|
|
4019
|
-
editing && !readOnly ? /* @__PURE__ */ (0,
|
|
4173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "shg-colhdr" + fit, children: [
|
|
4174
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "shg-colhdr-main", children: [
|
|
4175
|
+
editing && !readOnly ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4020
4176
|
"input",
|
|
4021
4177
|
{
|
|
4022
4178
|
className: "shg-colname-input",
|
|
@@ -4031,20 +4187,20 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
4031
4187
|
if (e.key === "Enter") e.target.blur();
|
|
4032
4188
|
}
|
|
4033
4189
|
}
|
|
4034
|
-
) : /* @__PURE__ */ (0,
|
|
4035
|
-
/* @__PURE__ */ (0,
|
|
4190
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-colname", onDoubleClick: () => !readOnly && setEditing(true), title: col.name, children: col.name }),
|
|
4191
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "shg-coltype" + (col.type === "compute" ? " compute" : ""), children: [
|
|
4036
4192
|
TYPE_LABEL[col.type] || col.type,
|
|
4037
4193
|
col.type === "compute" && col.compute?.kind ? ` \xB7 ${col.compute.kind}` : ""
|
|
4038
4194
|
] })
|
|
4039
4195
|
] }),
|
|
4040
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
4041
|
-
onRun && /* @__PURE__ */ (0,
|
|
4196
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "shg-colhdr-tools", children: [
|
|
4197
|
+
onRun && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { className: "shg-colrun", onClick: onRun, title: "Run this column", "aria-label": "Run this column", children: [
|
|
4042
4198
|
"\u25B6",
|
|
4043
|
-
/* @__PURE__ */ (0,
|
|
4199
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-colrun-label", children: " Run" })
|
|
4044
4200
|
] }),
|
|
4045
|
-
/* @__PURE__ */ (0,
|
|
4201
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "shg-colmenu-btn", onClick: (e) => onMenu(e), title: "Column settings", children: "\u22EF" })
|
|
4046
4202
|
] }),
|
|
4047
|
-
menuOpen && !readOnly && /* @__PURE__ */ (0,
|
|
4203
|
+
menuOpen && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4048
4204
|
ColumnMenu,
|
|
4049
4205
|
{
|
|
4050
4206
|
col,
|
|
@@ -4061,8 +4217,8 @@ function ColumnHeader({ col, columns, readOnly, menuOpen, menuAnchor, onMenu, on
|
|
|
4061
4217
|
] });
|
|
4062
4218
|
}
|
|
4063
4219
|
function ValuePills({ values, onChange }) {
|
|
4064
|
-
const [text, setText] = (0,
|
|
4065
|
-
const [picking, setPicking] = (0,
|
|
4220
|
+
const [text, setText] = (0, import_react18.useState)("");
|
|
4221
|
+
const [picking, setPicking] = (0, import_react18.useState)(null);
|
|
4066
4222
|
const add = () => {
|
|
4067
4223
|
const label = text.trim();
|
|
4068
4224
|
if (!label) return;
|
|
@@ -4077,11 +4233,11 @@ function ValuePills({ values, onChange }) {
|
|
|
4077
4233
|
onChange(values.map((v, j) => j === i ? { ...v, color } : v));
|
|
4078
4234
|
setPicking(null);
|
|
4079
4235
|
};
|
|
4080
|
-
return /* @__PURE__ */ (0,
|
|
4236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "shg-values", onClick: (e) => {
|
|
4081
4237
|
if (e.target === e.currentTarget) e.currentTarget.querySelector("input")?.focus();
|
|
4082
4238
|
}, children: [
|
|
4083
|
-
values.map((v, i) => /* @__PURE__ */ (0,
|
|
4084
|
-
/* @__PURE__ */ (0,
|
|
4239
|
+
values.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "shg-value", children: [
|
|
4240
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
4085
4241
|
"button",
|
|
4086
4242
|
{
|
|
4087
4243
|
type: "button",
|
|
@@ -4095,7 +4251,7 @@ function ValuePills({ values, onChange }) {
|
|
|
4095
4251
|
},
|
|
4096
4252
|
children: [
|
|
4097
4253
|
v.label,
|
|
4098
|
-
/* @__PURE__ */ (0,
|
|
4254
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4099
4255
|
"span",
|
|
4100
4256
|
{
|
|
4101
4257
|
className: "shg-value-x",
|
|
@@ -4111,7 +4267,7 @@ function ValuePills({ values, onChange }) {
|
|
|
4111
4267
|
]
|
|
4112
4268
|
}
|
|
4113
4269
|
),
|
|
4114
|
-
picking === i && /* @__PURE__ */ (0,
|
|
4270
|
+
picking === i && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "shg-swatches", role: "listbox", "aria-label": `Color for ${v.label}`, children: PILL_PALETTE.map((p) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4115
4271
|
"button",
|
|
4116
4272
|
{
|
|
4117
4273
|
type: "button",
|
|
@@ -4128,7 +4284,7 @@ function ValuePills({ values, onChange }) {
|
|
|
4128
4284
|
p.name
|
|
4129
4285
|
)) })
|
|
4130
4286
|
] }, v.label)),
|
|
4131
|
-
/* @__PURE__ */ (0,
|
|
4287
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4132
4288
|
"input",
|
|
4133
4289
|
{
|
|
4134
4290
|
className: "shg-values-input",
|
|
@@ -4147,24 +4303,24 @@ function ValuePills({ values, onChange }) {
|
|
|
4147
4303
|
] });
|
|
4148
4304
|
}
|
|
4149
4305
|
function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
4150
|
-
const [type, setType] = (0,
|
|
4151
|
-
const [values, setValues] = (0,
|
|
4306
|
+
const [type, setType] = (0, import_react18.useState)(col.type || "text");
|
|
4307
|
+
const [values, setValues] = (0, import_react18.useState)(() => (col.options || []).map((o) => typeof o === "string" ? { label: o } : { label: o.label ?? String(o.value ?? ""), ...o.color ? { color: o.color } : {} }));
|
|
4152
4308
|
const comp = col.compute || {};
|
|
4153
|
-
const [kind, setKind] = (0,
|
|
4154
|
-
const [prompt, setPrompt] = (0,
|
|
4155
|
-
const [harnessId, setHarnessId] = (0,
|
|
4156
|
-
const [wfSlug, setWfSlug] = (0,
|
|
4157
|
-
const [outKey, setOutKey] = (0,
|
|
4158
|
-
const [deps, setDeps] = (0,
|
|
4159
|
-
const ref = (0,
|
|
4160
|
-
(0,
|
|
4309
|
+
const [kind, setKind] = (0, import_react18.useState)(comp.kind || "prompt");
|
|
4310
|
+
const [prompt, setPrompt] = (0, import_react18.useState)(comp.prompt || "");
|
|
4311
|
+
const [harnessId, setHarnessId] = (0, import_react18.useState)(comp.harness_id || "");
|
|
4312
|
+
const [wfSlug, setWfSlug] = (0, import_react18.useState)(comp.workflow_slug || "");
|
|
4313
|
+
const [outKey, setOutKey] = (0, import_react18.useState)(comp.output_key || "");
|
|
4314
|
+
const [deps, setDeps] = (0, import_react18.useState)(new Set(comp.deps || []));
|
|
4315
|
+
const ref = (0, import_react18.useRef)(null);
|
|
4316
|
+
(0, import_react18.useEffect)(() => {
|
|
4161
4317
|
const onDown = (e) => {
|
|
4162
4318
|
if (ref.current && !ref.current.contains(e.target) && !(e.target.closest && e.target.closest(".uic-pop"))) onClose();
|
|
4163
4319
|
};
|
|
4164
4320
|
window.addEventListener("mousedown", onDown);
|
|
4165
4321
|
return () => window.removeEventListener("mousedown", onDown);
|
|
4166
4322
|
}, [onClose]);
|
|
4167
|
-
const promptItems = (0,
|
|
4323
|
+
const promptItems = (0, import_react18.useMemo)(() => {
|
|
4168
4324
|
const at = columns.findIndex((c) => c.id === col.id);
|
|
4169
4325
|
return columns.filter((c) => c.id !== col.id).map((c) => {
|
|
4170
4326
|
const idx = columns.findIndex((x) => x.id === c.id);
|
|
@@ -4199,26 +4355,26 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
4199
4355
|
}
|
|
4200
4356
|
onApply(patch);
|
|
4201
4357
|
};
|
|
4202
|
-
return /* @__PURE__ */ (0,
|
|
4203
|
-
/* @__PURE__ */ (0,
|
|
4358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PopPortal, { anchor, width: 250, estHeight: 340, className: "shg-menu", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref, onClick: (e) => e.stopPropagation(), children: [
|
|
4359
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
4204
4360
|
"Type",
|
|
4205
|
-
/* @__PURE__ */ (0,
|
|
4206
|
-
MANUAL_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
4207
|
-
/* @__PURE__ */ (0,
|
|
4361
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("select", { className: "shg-menu-input", value: type, onChange: (e) => setType(e.target.value), children: [
|
|
4362
|
+
MANUAL_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: t, children: TYPE_LABEL[t] }, t)),
|
|
4363
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: "compute", children: "Computed" })
|
|
4208
4364
|
] })
|
|
4209
4365
|
] }),
|
|
4210
|
-
/* @__PURE__ */ (0,
|
|
4366
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "shg-menu-lbl", children: [
|
|
4211
4367
|
type === "select" || type === "tags" ? "Options" : "Values",
|
|
4212
|
-
/* @__PURE__ */ (0,
|
|
4368
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ValuePills, { values, onChange: setValues })
|
|
4213
4369
|
] }),
|
|
4214
|
-
type === "compute" && /* @__PURE__ */ (0,
|
|
4215
|
-
/* @__PURE__ */ (0,
|
|
4370
|
+
type === "compute" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
4371
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
4216
4372
|
"Runs",
|
|
4217
|
-
/* @__PURE__ */ (0,
|
|
4373
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("select", { className: "shg-menu-input", value: kind, onChange: (e) => setKind(e.target.value), children: COMPUTE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: k.kind, children: k.label }, k.kind)) })
|
|
4218
4374
|
] }),
|
|
4219
|
-
(kind === "prompt" || kind === "harness") && /* @__PURE__ */ (0,
|
|
4375
|
+
(kind === "prompt" || kind === "harness") && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "shg-menu-lbl", children: [
|
|
4220
4376
|
"Prompt",
|
|
4221
|
-
/* @__PURE__ */ (0,
|
|
4377
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "shg-menu-input shg-menu-prompt", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
4222
4378
|
MentionInput,
|
|
4223
4379
|
{
|
|
4224
4380
|
value: prompt,
|
|
@@ -4233,26 +4389,26 @@ function ColumnMenu({ col, columns, anchor, onApply, onDelete, onClose }) {
|
|
|
4233
4389
|
label: "Prompt"
|
|
4234
4390
|
}
|
|
4235
4391
|
) }),
|
|
4236
|
-
/* @__PURE__ */ (0,
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "shg-menu-hint", children: "Type @ to add a column from this row. Columns to the left fill first." })
|
|
4237
4393
|
] }),
|
|
4238
|
-
kind === "harness" && /* @__PURE__ */ (0,
|
|
4394
|
+
kind === "harness" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
4239
4395
|
"Agent id",
|
|
4240
|
-
/* @__PURE__ */ (0,
|
|
4396
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "shg-menu-input", value: harnessId, onChange: (e) => setHarnessId(e.target.value), placeholder: "chrn_\u2026" })
|
|
4241
4397
|
] }),
|
|
4242
|
-
kind === "workflow" && /* @__PURE__ */ (0,
|
|
4243
|
-
/* @__PURE__ */ (0,
|
|
4398
|
+
kind === "workflow" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
4244
4400
|
"Workflow id",
|
|
4245
|
-
/* @__PURE__ */ (0,
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "shg-menu-input", value: wfSlug, onChange: (e) => setWfSlug(e.target.value), placeholder: "my-workflow" })
|
|
4246
4402
|
] }),
|
|
4247
|
-
/* @__PURE__ */ (0,
|
|
4403
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "shg-menu-lbl", children: [
|
|
4248
4404
|
"Output key (optional)",
|
|
4249
|
-
/* @__PURE__ */ (0,
|
|
4405
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { className: "shg-menu-input", value: outKey, onChange: (e) => setOutKey(e.target.value), placeholder: "summary" })
|
|
4250
4406
|
] })
|
|
4251
4407
|
] })
|
|
4252
4408
|
] }),
|
|
4253
|
-
/* @__PURE__ */ (0,
|
|
4254
|
-
/* @__PURE__ */ (0,
|
|
4255
|
-
/* @__PURE__ */ (0,
|
|
4409
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "shg-menu-actions", children: [
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "shg-menu-del", onClick: onDelete, children: "Delete column" }),
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className: "shg-menu-apply", onClick: apply, children: "Apply" })
|
|
4256
4412
|
] })
|
|
4257
4413
|
] }) });
|
|
4258
4414
|
}
|
|
@@ -4284,8 +4440,8 @@ function sheetToAoA(sheet) {
|
|
|
4284
4440
|
}
|
|
4285
4441
|
|
|
4286
4442
|
// src/components/FileTypeIcon.jsx
|
|
4287
|
-
var
|
|
4288
|
-
var
|
|
4443
|
+
var import_react19 = require("react");
|
|
4444
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
4289
4445
|
function extOf(name) {
|
|
4290
4446
|
const m = String(name || "").toLowerCase().match(/\.([a-z0-9]+)$/);
|
|
4291
4447
|
return m ? m[1] : "";
|
|
@@ -4293,9 +4449,9 @@ function extOf(name) {
|
|
|
4293
4449
|
var mod = null;
|
|
4294
4450
|
var tried = false;
|
|
4295
4451
|
function FileTypeIcon({ name, size = 36 }) {
|
|
4296
|
-
const [, force] = (0,
|
|
4452
|
+
const [, force] = (0, import_react19.useState)(0);
|
|
4297
4453
|
const ext = extOf(name);
|
|
4298
|
-
(0,
|
|
4454
|
+
(0, import_react19.useEffect)(() => {
|
|
4299
4455
|
if (tried || mod) return;
|
|
4300
4456
|
tried = true;
|
|
4301
4457
|
import("react-file-icon").then((m) => {
|
|
@@ -4306,15 +4462,15 @@ function FileTypeIcon({ name, size = 36 }) {
|
|
|
4306
4462
|
}, []);
|
|
4307
4463
|
const box = { width: size, height: Math.round(size * 1.16), display: "inline-block", flex: "0 0 auto" };
|
|
4308
4464
|
if (!mod) {
|
|
4309
|
-
return /* @__PURE__ */ (0,
|
|
4465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "uic-fileglyph", style: box, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "uic-fileglyph-ext", children: (ext || "file").slice(0, 4) }) });
|
|
4310
4466
|
}
|
|
4311
4467
|
const { FileIcon, defaultStyles } = mod;
|
|
4312
4468
|
const style = defaultStyles?.[ext] || {};
|
|
4313
|
-
return /* @__PURE__ */ (0,
|
|
4469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { style: box, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FileIcon, { extension: ext || void 0, ...style }) });
|
|
4314
4470
|
}
|
|
4315
4471
|
|
|
4316
4472
|
// src/components/FileCard.jsx
|
|
4317
|
-
var
|
|
4473
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4318
4474
|
function subtitle(name, origin, bytes) {
|
|
4319
4475
|
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
4320
4476
|
if (origin) parts.push(origin);
|
|
@@ -4332,7 +4488,7 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
|
|
|
4332
4488
|
e.stopPropagation();
|
|
4333
4489
|
onPreview();
|
|
4334
4490
|
} : void 0;
|
|
4335
|
-
return /* @__PURE__ */ (0,
|
|
4491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
4336
4492
|
"div",
|
|
4337
4493
|
{
|
|
4338
4494
|
className: "uic-filecard" + (open ? " is-clickable" : "") + (className ? " " + className : ""),
|
|
@@ -4347,12 +4503,12 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
|
|
|
4347
4503
|
} : void 0,
|
|
4348
4504
|
title: name,
|
|
4349
4505
|
children: [
|
|
4350
|
-
/* @__PURE__ */ (0,
|
|
4351
|
-
/* @__PURE__ */ (0,
|
|
4352
|
-
/* @__PURE__ */ (0,
|
|
4353
|
-
/* @__PURE__ */ (0,
|
|
4506
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FileTypeIcon, { name, size: 32 }) }),
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "uic-filecard-meta", children: [
|
|
4508
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uic-filecard-name", children: name }),
|
|
4509
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
|
|
4354
4510
|
] }),
|
|
4355
|
-
onDownload && /* @__PURE__ */ (0,
|
|
4511
|
+
onDownload && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4356
4512
|
"button",
|
|
4357
4513
|
{
|
|
4358
4514
|
type: "button",
|
|
@@ -4363,18 +4519,18 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
|
|
|
4363
4519
|
e.stopPropagation();
|
|
4364
4520
|
onDownload();
|
|
4365
4521
|
},
|
|
4366
|
-
children: /* @__PURE__ */ (0,
|
|
4522
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IcDownload, { size: 18 })
|
|
4367
4523
|
}
|
|
4368
4524
|
),
|
|
4369
|
-
onPreview && /* @__PURE__ */ (0,
|
|
4525
|
+
onPreview && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "uic-filecard-open", "aria-label": `Preview ${name}`, onClick: open, children: "Preview" })
|
|
4370
4526
|
]
|
|
4371
4527
|
}
|
|
4372
4528
|
);
|
|
4373
4529
|
}
|
|
4374
4530
|
|
|
4375
4531
|
// src/components/FilePreview.jsx
|
|
4376
|
-
var
|
|
4377
|
-
var
|
|
4532
|
+
var import_react20 = require("react");
|
|
4533
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4378
4534
|
var LANG = {
|
|
4379
4535
|
js: "javascript",
|
|
4380
4536
|
mjs: "javascript",
|
|
@@ -4455,11 +4611,11 @@ function delimitedToRows(text, sep) {
|
|
|
4455
4611
|
});
|
|
4456
4612
|
}
|
|
4457
4613
|
function Grid({ rows }) {
|
|
4458
|
-
if (!rows?.length) return /* @__PURE__ */ (0,
|
|
4614
|
+
if (!rows?.length) return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-empty", children: "This file is empty." });
|
|
4459
4615
|
const [head, ...body] = rows;
|
|
4460
|
-
return /* @__PURE__ */ (0,
|
|
4461
|
-
/* @__PURE__ */ (0,
|
|
4462
|
-
/* @__PURE__ */ (0,
|
|
4616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-sheet", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("table", { children: [
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tr", { children: head.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("th", { children: c }, i)) }) }),
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { children: body.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tr", { children: r.map((c, j) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { children: c }, j)) }, i)) })
|
|
4463
4619
|
] }) });
|
|
4464
4620
|
}
|
|
4465
4621
|
var defaultDownload = (url, name) => {
|
|
@@ -4482,10 +4638,10 @@ function FilePreview({
|
|
|
4482
4638
|
title
|
|
4483
4639
|
}) {
|
|
4484
4640
|
const { url, name } = file || {};
|
|
4485
|
-
const [st, setSt] = (0,
|
|
4486
|
-
const [tab, setTab] = (0,
|
|
4487
|
-
const [view, setView] = (0,
|
|
4488
|
-
(0,
|
|
4641
|
+
const [st, setSt] = (0, import_react20.useState)({ kind: "loading" });
|
|
4642
|
+
const [tab, setTab] = (0, import_react20.useState)(0);
|
|
4643
|
+
const [view, setView] = (0, import_react20.useState)("preview");
|
|
4644
|
+
(0, import_react20.useEffect)(() => {
|
|
4489
4645
|
if (!url) return void 0;
|
|
4490
4646
|
let alive = true;
|
|
4491
4647
|
let obj;
|
|
@@ -4548,11 +4704,11 @@ function FilePreview({
|
|
|
4548
4704
|
};
|
|
4549
4705
|
}, [url, name, fetchFile, officePdfUrl, parseWorkbook]);
|
|
4550
4706
|
const download = () => onDownload ? onDownload(url, name) : defaultDownload(url, name);
|
|
4551
|
-
return /* @__PURE__ */ (0,
|
|
4552
|
-
/* @__PURE__ */ (0,
|
|
4553
|
-
/* @__PURE__ */ (0,
|
|
4554
|
-
/* @__PURE__ */ (0,
|
|
4555
|
-
st.kind === "html" && /* @__PURE__ */ (0,
|
|
4707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("aside", { className: "uic-fp", "aria-label": title || `Preview of ${name}`, children: [
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("header", { className: "uic-fp-head", children: [
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-fp-ic", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FileTypeIcon, { name, size: 20 }) }),
|
|
4710
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-fp-name", title: name, children: name }),
|
|
4711
|
+
st.kind === "html" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-seg", role: "tablist", "aria-label": "Show the page or its source", children: [["preview", "Preview"], ["source", "Source"]].map(([id, label]) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4556
4712
|
"button",
|
|
4557
4713
|
{
|
|
4558
4714
|
type: "button",
|
|
@@ -4564,7 +4720,7 @@ function FilePreview({
|
|
|
4564
4720
|
},
|
|
4565
4721
|
id
|
|
4566
4722
|
)) }),
|
|
4567
|
-
/* @__PURE__ */ (0,
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4568
4724
|
"button",
|
|
4569
4725
|
{
|
|
4570
4726
|
type: "button",
|
|
@@ -4572,10 +4728,10 @@ function FilePreview({
|
|
|
4572
4728
|
"aria-label": `Download ${name}`,
|
|
4573
4729
|
title: "Download",
|
|
4574
4730
|
onClick: download,
|
|
4575
|
-
children: /* @__PURE__ */ (0,
|
|
4731
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IcDownload, {})
|
|
4576
4732
|
}
|
|
4577
4733
|
),
|
|
4578
|
-
onClose && /* @__PURE__ */ (0,
|
|
4734
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4579
4735
|
"button",
|
|
4580
4736
|
{
|
|
4581
4737
|
type: "button",
|
|
@@ -4583,26 +4739,26 @@ function FilePreview({
|
|
|
4583
4739
|
"aria-label": "Close preview",
|
|
4584
4740
|
title: "Close",
|
|
4585
4741
|
onClick: onClose,
|
|
4586
|
-
children: /* @__PURE__ */ (0,
|
|
4742
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IcX, { size: 18 })
|
|
4587
4743
|
}
|
|
4588
4744
|
)
|
|
4589
4745
|
] }),
|
|
4590
|
-
/* @__PURE__ */ (0,
|
|
4591
|
-
st.kind === "loading" && /* @__PURE__ */ (0,
|
|
4592
|
-
st.kind === "image" && st.objUrl && /* @__PURE__ */ (0,
|
|
4593
|
-
st.kind === "pdf" && st.objUrl && /* @__PURE__ */ (0,
|
|
4594
|
-
st.kind === "video" && st.objUrl && /* @__PURE__ */ (0,
|
|
4595
|
-
st.kind === "audio" && st.objUrl && /* @__PURE__ */ (0,
|
|
4596
|
-
st.kind === "markdown" && /* @__PURE__ */ (0,
|
|
4597
|
-
st.kind === "code" && /* @__PURE__ */ (0,
|
|
4598
|
-
st.kind === "html" && view === "source" && /* @__PURE__ */ (0,
|
|
4746
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "uic-fp-body", children: [
|
|
4747
|
+
st.kind === "loading" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-pad", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "uic-skel uic-fp-skel" }) }),
|
|
4748
|
+
st.kind === "image" && st.objUrl && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("img", { className: "uic-fp-img", src: st.objUrl, alt: name }) }),
|
|
4749
|
+
st.kind === "pdf" && st.objUrl && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("iframe", { className: "uic-fp-frame", src: st.objUrl, title: name }),
|
|
4750
|
+
st.kind === "video" && st.objUrl && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("video", { className: "uic-fp-media", src: st.objUrl, controls: true }) }),
|
|
4751
|
+
st.kind === "audio" && st.objUrl && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("audio", { src: st.objUrl, controls: true }) }),
|
|
4752
|
+
st.kind === "markdown" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-doc", children: renderMarkdown ? renderMarkdown(st.text || "") : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { className: "uic-fp-pre", children: st.text }) }),
|
|
4753
|
+
st.kind === "code" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CodeBlock, { code: st.text || "", language: LANG[extOf(name)] || "plaintext" }),
|
|
4754
|
+
st.kind === "html" && view === "source" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CodeBlock, { code: st.text || "", language: "xml" }),
|
|
4599
4755
|
st.kind === "html" && view === "preview" && // The page runs in its own origin with scripts only: a mockup's own script and styles
|
|
4600
4756
|
// work, and nothing in it can read the host page, its cookies or its storage.
|
|
4601
|
-
/* @__PURE__ */ (0,
|
|
4602
|
-
st.kind === "csv" && /* @__PURE__ */ (0,
|
|
4603
|
-
st.kind === "sheet" && st.sheets && /* @__PURE__ */ (0,
|
|
4604
|
-
st.sheets[tab]?.filled ? /* @__PURE__ */ (0,
|
|
4605
|
-
/* @__PURE__ */ (0,
|
|
4757
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("iframe", { className: "uic-fp-frame", title: name, sandbox: "allow-scripts", srcDoc: st.text || "" }),
|
|
4758
|
+
st.kind === "csv" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Grid, { rows: st.rows }),
|
|
4759
|
+
st.kind === "sheet" && st.sheets && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "uic-fp-xlsx", children: [
|
|
4760
|
+
st.sheets[tab]?.filled ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Grid, { rows: st.sheets[tab].rows }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-empty", children: "This sheet is empty." }),
|
|
4761
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-tabs", children: st.sheets.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4606
4762
|
"button",
|
|
4607
4763
|
{
|
|
4608
4764
|
type: "button",
|
|
@@ -4614,40 +4770,40 @@ function FilePreview({
|
|
|
4614
4770
|
s.name + i
|
|
4615
4771
|
)) })
|
|
4616
4772
|
] }),
|
|
4617
|
-
st.kind === "binary" && /* @__PURE__ */ (0,
|
|
4618
|
-
/* @__PURE__ */ (0,
|
|
4619
|
-
/* @__PURE__ */ (0,
|
|
4620
|
-
/* @__PURE__ */ (0,
|
|
4773
|
+
st.kind === "binary" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "uic-fp-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "uic-fp-fallback", children: [
|
|
4774
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FileTypeIcon, { name, size: 56 }),
|
|
4775
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: st.error || "No inline preview for this file type." }),
|
|
4776
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "uic-fp-dl", onClick: download, children: "Download" })
|
|
4621
4777
|
] }) })
|
|
4622
4778
|
] })
|
|
4623
4779
|
] });
|
|
4624
4780
|
}
|
|
4625
4781
|
|
|
4626
4782
|
// src/components/form.jsx
|
|
4627
|
-
var
|
|
4628
|
-
var
|
|
4783
|
+
var import_react21 = require("react");
|
|
4784
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4629
4785
|
function Field({ label, hint, error, htmlFor, required, children, className = "" }) {
|
|
4630
|
-
return /* @__PURE__ */ (0,
|
|
4631
|
-
label && /* @__PURE__ */ (0,
|
|
4786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
|
|
4787
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "uic-field-label", htmlFor, children: [
|
|
4632
4788
|
label,
|
|
4633
|
-
required && /* @__PURE__ */ (0,
|
|
4789
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "uic-field-req", "aria-hidden": "true", children: "*" })
|
|
4634
4790
|
] }),
|
|
4635
4791
|
children,
|
|
4636
|
-
error ? /* @__PURE__ */ (0,
|
|
4792
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "uic-field-err", children: error }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "uic-field-hint", children: hint }) : null
|
|
4637
4793
|
] });
|
|
4638
4794
|
}
|
|
4639
4795
|
function withField(Control) {
|
|
4640
4796
|
return function Fielded({ label, hint, error, required, id, className, ...rest }) {
|
|
4641
|
-
const auto = (0,
|
|
4797
|
+
const auto = (0, import_react21.useId)();
|
|
4642
4798
|
const inputId = id || auto;
|
|
4643
|
-
return /* @__PURE__ */ (0,
|
|
4799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Field, { label, hint, error, required, htmlFor: inputId, className, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Control, { id: inputId, invalid: !!error, required, ...rest }) });
|
|
4644
4800
|
};
|
|
4645
4801
|
}
|
|
4646
4802
|
function BareInput({ invalid, ...rest }) {
|
|
4647
|
-
return /* @__PURE__ */ (0,
|
|
4803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { className: "uic-input" + (invalid ? " is-error" : ""), "aria-invalid": invalid || void 0, ...rest });
|
|
4648
4804
|
}
|
|
4649
4805
|
function BareTextarea({ invalid, rows = 4, ...rest }) {
|
|
4650
|
-
return /* @__PURE__ */ (0,
|
|
4806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4651
4807
|
"textarea",
|
|
4652
4808
|
{
|
|
4653
4809
|
className: "uic-input uic-textarea" + (invalid ? " is-error" : ""),
|
|
@@ -4658,44 +4814,44 @@ function BareTextarea({ invalid, rows = 4, ...rest }) {
|
|
|
4658
4814
|
);
|
|
4659
4815
|
}
|
|
4660
4816
|
function BareSelect({ invalid, options = [], placeholder, ...rest }) {
|
|
4661
|
-
return /* @__PURE__ */ (0,
|
|
4662
|
-
/* @__PURE__ */ (0,
|
|
4817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "uic-select-wrap", children: [
|
|
4818
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
4663
4819
|
"select",
|
|
4664
4820
|
{
|
|
4665
4821
|
className: "uic-input uic-select" + (invalid ? " is-error" : ""),
|
|
4666
4822
|
"aria-invalid": invalid || void 0,
|
|
4667
4823
|
...rest,
|
|
4668
4824
|
children: [
|
|
4669
|
-
placeholder && /* @__PURE__ */ (0,
|
|
4825
|
+
placeholder && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: placeholder }),
|
|
4670
4826
|
options.map((o) => {
|
|
4671
4827
|
const opt = typeof o === "string" ? { value: o, label: o } : o;
|
|
4672
|
-
return /* @__PURE__ */ (0,
|
|
4828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value);
|
|
4673
4829
|
})
|
|
4674
4830
|
]
|
|
4675
4831
|
}
|
|
4676
4832
|
),
|
|
4677
|
-
/* @__PURE__ */ (0,
|
|
4833
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "uic-select-chev", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Chevron, { dir: "down", size: 14 }) })
|
|
4678
4834
|
] });
|
|
4679
4835
|
}
|
|
4680
4836
|
var Input = withField(BareInput);
|
|
4681
4837
|
var Textarea = withField(BareTextarea);
|
|
4682
4838
|
var Select = withField(BareSelect);
|
|
4683
4839
|
function FormActions({ children, align = "end", className = "" }) {
|
|
4684
|
-
return /* @__PURE__ */ (0,
|
|
4840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `uic-form-actions is-${align}${className ? " " + className : ""}`, children });
|
|
4685
4841
|
}
|
|
4686
4842
|
function Button({ variant = "default", size = "md", type = "button", className = "", ...rest }) {
|
|
4687
|
-
return /* @__PURE__ */ (0,
|
|
4843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type, className: `uic-btn is-${variant} is-${size}${className ? " " + className : ""}`, ...rest });
|
|
4688
4844
|
}
|
|
4689
4845
|
|
|
4690
4846
|
// src/components/Carousel.jsx
|
|
4691
|
-
var
|
|
4692
|
-
var
|
|
4847
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
4848
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4693
4849
|
var EDGE = 2;
|
|
4694
4850
|
function Carousel(props) {
|
|
4695
4851
|
const { label, step, children, classNames = {} } = props;
|
|
4696
|
-
const ref = (0,
|
|
4697
|
-
const [edges, setEdges] = (0,
|
|
4698
|
-
const measure = (0,
|
|
4852
|
+
const ref = (0, import_react22.useRef)(null);
|
|
4853
|
+
const [edges, setEdges] = (0, import_react22.useState)({ start: true, end: true, overflow: false });
|
|
4854
|
+
const measure = (0, import_react22.useCallback)(() => {
|
|
4699
4855
|
const el = ref.current;
|
|
4700
4856
|
if (!el) return;
|
|
4701
4857
|
const overflow = el.scrollWidth - el.clientWidth > EDGE;
|
|
@@ -4705,7 +4861,7 @@ function Carousel(props) {
|
|
|
4705
4861
|
end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
|
|
4706
4862
|
});
|
|
4707
4863
|
}, []);
|
|
4708
|
-
(0,
|
|
4864
|
+
(0, import_react22.useEffect)(() => {
|
|
4709
4865
|
const el = ref.current;
|
|
4710
4866
|
if (!el) return void 0;
|
|
4711
4867
|
measure();
|
|
@@ -4719,8 +4875,8 @@ function Carousel(props) {
|
|
|
4719
4875
|
if (!el) return;
|
|
4720
4876
|
el.scrollBy({ left: dir * (step || Math.round(el.clientWidth * 0.9)), behavior: "smooth" });
|
|
4721
4877
|
};
|
|
4722
|
-
return /* @__PURE__ */ (0,
|
|
4723
|
-
edges.overflow ? /* @__PURE__ */ (0,
|
|
4878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
|
|
4879
|
+
edges.overflow ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4724
4880
|
"button",
|
|
4725
4881
|
{
|
|
4726
4882
|
type: "button",
|
|
@@ -4728,10 +4884,10 @@ function Carousel(props) {
|
|
|
4728
4884
|
onClick: () => scroll(-1),
|
|
4729
4885
|
disabled: edges.start,
|
|
4730
4886
|
"aria-label": `Scroll ${label} left`,
|
|
4731
|
-
children: /* @__PURE__ */ (0,
|
|
4887
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Chevron, { dir: "left" })
|
|
4732
4888
|
}
|
|
4733
4889
|
) : null,
|
|
4734
|
-
/* @__PURE__ */ (0,
|
|
4890
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4735
4891
|
"div",
|
|
4736
4892
|
{
|
|
4737
4893
|
className: ["uic-carousel", classNames.viewport || ""].filter(Boolean).join(" "),
|
|
@@ -4742,7 +4898,7 @@ function Carousel(props) {
|
|
|
4742
4898
|
children
|
|
4743
4899
|
}
|
|
4744
4900
|
),
|
|
4745
|
-
edges.overflow ? /* @__PURE__ */ (0,
|
|
4901
|
+
edges.overflow ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4746
4902
|
"button",
|
|
4747
4903
|
{
|
|
4748
4904
|
type: "button",
|
|
@@ -4750,42 +4906,42 @@ function Carousel(props) {
|
|
|
4750
4906
|
onClick: () => scroll(1),
|
|
4751
4907
|
disabled: edges.end,
|
|
4752
4908
|
"aria-label": `Scroll ${label} right`,
|
|
4753
|
-
children: /* @__PURE__ */ (0,
|
|
4909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Chevron, { dir: "right" })
|
|
4754
4910
|
}
|
|
4755
4911
|
) : null
|
|
4756
4912
|
] });
|
|
4757
4913
|
}
|
|
4758
4914
|
|
|
4759
4915
|
// src/components/Card.jsx
|
|
4760
|
-
var
|
|
4761
|
-
var
|
|
4916
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
4917
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4762
4918
|
function Card(props) {
|
|
4763
4919
|
const { art, title, subtitle: subtitle2, onClick, selected = false, overlay, actions, classNames = {} } = props;
|
|
4764
|
-
const foot = /* @__PURE__ */ (0,
|
|
4765
|
-
/* @__PURE__ */ (0,
|
|
4766
|
-
subtitle2 ? /* @__PURE__ */ (0,
|
|
4920
|
+
const foot = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "uic-card-foot", children: [
|
|
4921
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-card-name", children: title }),
|
|
4922
|
+
subtitle2 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-card-sub", children: subtitle2 }) : null
|
|
4767
4923
|
] });
|
|
4768
|
-
return /* @__PURE__ */ (0,
|
|
4769
|
-
onClick ? /* @__PURE__ */ (0,
|
|
4770
|
-
/* @__PURE__ */ (0,
|
|
4924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
|
|
4925
|
+
onClick ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
|
|
4926
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-card-art", children: art }),
|
|
4771
4927
|
foot
|
|
4772
|
-
] }) : /* @__PURE__ */ (0,
|
|
4773
|
-
/* @__PURE__ */ (0,
|
|
4928
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "uic-card-main", children: [
|
|
4929
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "uic-card-art", children: art }),
|
|
4774
4930
|
foot
|
|
4775
4931
|
] }),
|
|
4776
|
-
overlay ? /* @__PURE__ */ (0,
|
|
4777
|
-
actions ? /* @__PURE__ */ (0,
|
|
4932
|
+
overlay ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uic-card-overlay", children: overlay }) : null,
|
|
4933
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "uic-card-actions", children: actions }) : null
|
|
4778
4934
|
] });
|
|
4779
4935
|
}
|
|
4780
4936
|
|
|
4781
4937
|
// src/components/SearchField.jsx
|
|
4782
|
-
var
|
|
4783
|
-
var
|
|
4938
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
4939
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4784
4940
|
function SearchField(props) {
|
|
4785
4941
|
const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
|
|
4786
|
-
return /* @__PURE__ */ (0,
|
|
4787
|
-
/* @__PURE__ */ (0,
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
|
|
4943
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IcSearch, {}) }),
|
|
4944
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4789
4945
|
"input",
|
|
4790
4946
|
{
|
|
4791
4947
|
type: "search",
|
|
@@ -4795,14 +4951,14 @@ function SearchField(props) {
|
|
|
4795
4951
|
onChange: (e) => onChange(e.target.value)
|
|
4796
4952
|
}
|
|
4797
4953
|
),
|
|
4798
|
-
value ? /* @__PURE__ */ (0,
|
|
4954
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: "uic-search-x", "aria-label": clearLabel, onClick: () => onChange(""), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IcX, { size: 12 }) }) : null
|
|
4799
4955
|
] });
|
|
4800
4956
|
}
|
|
4801
4957
|
|
|
4802
4958
|
// src/components/CascadeMenu.jsx
|
|
4803
|
-
var
|
|
4804
|
-
var
|
|
4805
|
-
var Tick = () => /* @__PURE__ */ (0,
|
|
4959
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
4960
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4961
|
+
var Tick = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Svg, { s: 14, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M20 6 9 17l-5-5" }) });
|
|
4806
4962
|
var FILTER_PAST = 8;
|
|
4807
4963
|
var itemsOf = (groups) => groups.flatMap((g) => g.items);
|
|
4808
4964
|
function CascadeMenu(props) {
|
|
@@ -4826,21 +4982,21 @@ function CascadeMenu(props) {
|
|
|
4826
4982
|
className,
|
|
4827
4983
|
value
|
|
4828
4984
|
} = props;
|
|
4829
|
-
const rootRef = (0,
|
|
4830
|
-
const [q, setQ] = (0,
|
|
4831
|
-
const [activeId, setActiveId] = (0,
|
|
4832
|
-
const [stage, setStage] = (0,
|
|
4833
|
-
const [stacked, setStacked] = (0,
|
|
4834
|
-
const visible = (0,
|
|
4985
|
+
const rootRef = (0, import_react25.useRef)(null);
|
|
4986
|
+
const [q, setQ] = (0, import_react25.useState)("");
|
|
4987
|
+
const [activeId, setActiveId] = (0, import_react25.useState)(null);
|
|
4988
|
+
const [stage, setStage] = (0, import_react25.useState)("items");
|
|
4989
|
+
const [stacked, setStacked] = (0, import_react25.useState)(false);
|
|
4990
|
+
const visible = (0, import_react25.useMemo)(() => {
|
|
4835
4991
|
const needle = q.trim().toLowerCase();
|
|
4836
4992
|
if (!needle) return groups.filter((g) => g.items.length > 0);
|
|
4837
4993
|
return groups.map((g) => ({ ...g, items: g.items.filter((it) => String(it.label).toLowerCase().includes(needle)) })).filter((g) => g.items.length > 0);
|
|
4838
4994
|
}, [groups, q]);
|
|
4839
|
-
const flat = (0,
|
|
4995
|
+
const flat = (0, import_react25.useMemo)(() => itemsOf(visible), [visible]);
|
|
4840
4996
|
const active = flat.find((it) => it.id === activeId) || flat[0] || null;
|
|
4841
|
-
const options = (0,
|
|
4997
|
+
const options = (0, import_react25.useMemo)(() => active && optionsOf ? optionsOf(active) : [], [active, optionsOf]);
|
|
4842
4998
|
const showFilter = filter === true || filter === "auto" && itemsOf(groups).length > FILTER_PAST;
|
|
4843
|
-
(0,
|
|
4999
|
+
(0, import_react25.useEffect)(() => {
|
|
4844
5000
|
if (!open) return void 0;
|
|
4845
5001
|
setQ("");
|
|
4846
5002
|
setActiveId(value?.item ?? null);
|
|
@@ -4859,14 +5015,14 @@ function CascadeMenu(props) {
|
|
|
4859
5015
|
anchor?.focus?.({ preventScroll: true });
|
|
4860
5016
|
};
|
|
4861
5017
|
}, [open, stackBelow]);
|
|
4862
|
-
const focusIn = (0,
|
|
5018
|
+
const focusIn = (0, import_react25.useCallback)((col, index = 0) => {
|
|
4863
5019
|
const list = rootRef.current?.querySelectorAll(`.uic-cascade-${col} .uic-pop-item:not(:disabled)`);
|
|
4864
5020
|
if (!list || !list.length) return false;
|
|
4865
5021
|
const i = Math.max(0, Math.min(index, list.length - 1));
|
|
4866
5022
|
list[i].focus({ preventScroll: true });
|
|
4867
5023
|
return true;
|
|
4868
5024
|
}, []);
|
|
4869
|
-
const enterOptions = (0,
|
|
5025
|
+
const enterOptions = (0, import_react25.useCallback)(() => {
|
|
4870
5026
|
if (stacked) {
|
|
4871
5027
|
setStage("options");
|
|
4872
5028
|
requestAnimationFrame(() => focusIn("options"));
|
|
@@ -4906,7 +5062,7 @@ function CascadeMenu(props) {
|
|
|
4906
5062
|
};
|
|
4907
5063
|
const showItems = !stacked || stage === "items";
|
|
4908
5064
|
const showOptions = !stacked || stage === "options";
|
|
4909
|
-
return /* @__PURE__ */ (0,
|
|
5065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4910
5066
|
Popover,
|
|
4911
5067
|
{
|
|
4912
5068
|
open,
|
|
@@ -4916,15 +5072,15 @@ function CascadeMenu(props) {
|
|
|
4916
5072
|
width: stacked ? 320 : width,
|
|
4917
5073
|
minHeight: 260,
|
|
4918
5074
|
className: ["uic-cascade-pop", className || ""].filter(Boolean).join(" "),
|
|
4919
|
-
children: /* @__PURE__ */ (0,
|
|
4920
|
-
showItems && /* @__PURE__ */ (0,
|
|
4921
|
-
showFilter ? /* @__PURE__ */ (0,
|
|
4922
|
-
/* @__PURE__ */ (0,
|
|
4923
|
-
visible.map((g, gi) => /* @__PURE__ */ (0,
|
|
4924
|
-
g.label ? /* @__PURE__ */ (0,
|
|
5075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { ref: rootRef, className: "uic-cascade" + (stacked ? " is-stacked" : ""), onKeyDown: onKey2, children: [
|
|
5076
|
+
showItems && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uic-cascade-col uic-cascade-items", children: [
|
|
5077
|
+
showFilter ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SearchField, { className: "uic-cascade-filter", value: q, onChange: setQ, placeholder: filterPlaceholder }) : null,
|
|
5078
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uic-pop-list", children: [
|
|
5079
|
+
visible.map((g, gi) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react25.Fragment, { children: [
|
|
5080
|
+
g.label ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uic-cascade-group", children: g.label }) : null,
|
|
4925
5081
|
g.items.map((it) => {
|
|
4926
5082
|
const on = active?.id === it.id;
|
|
4927
|
-
return /* @__PURE__ */ (0,
|
|
5083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4928
5084
|
"button",
|
|
4929
5085
|
{
|
|
4930
5086
|
type: "button",
|
|
@@ -4937,22 +5093,22 @@ function CascadeMenu(props) {
|
|
|
4937
5093
|
enterOptions();
|
|
4938
5094
|
},
|
|
4939
5095
|
children: [
|
|
4940
|
-
it.icon ? /* @__PURE__ */ (0,
|
|
4941
|
-
/* @__PURE__ */ (0,
|
|
4942
|
-
it.note ? /* @__PURE__ */ (0,
|
|
4943
|
-
/* @__PURE__ */ (0,
|
|
5096
|
+
it.icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: it.icon }) : null,
|
|
5097
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-chip-t", children: it.label }),
|
|
5098
|
+
it.note ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-cascade-note", children: it.note }) : null,
|
|
5099
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-cascade-chev", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Chevron, { dir: "right", size: 14 }) })
|
|
4944
5100
|
]
|
|
4945
5101
|
},
|
|
4946
5102
|
it.id
|
|
4947
5103
|
);
|
|
4948
5104
|
})
|
|
4949
5105
|
] }, g.label || gi)),
|
|
4950
|
-
flat.length === 0 ? /* @__PURE__ */ (0,
|
|
5106
|
+
flat.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uic-pop-note", children: emptyText }) : null
|
|
4951
5107
|
] })
|
|
4952
5108
|
] }),
|
|
4953
|
-
showOptions && /* @__PURE__ */ (0,
|
|
4954
|
-
/* @__PURE__ */ (0,
|
|
4955
|
-
stacked ? /* @__PURE__ */ (0,
|
|
5109
|
+
showOptions && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uic-cascade-col uic-cascade-options", role: "group", "aria-label": optionsLabel, children: [
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uic-cascade-head", children: [
|
|
5111
|
+
stacked ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4956
5112
|
"button",
|
|
4957
5113
|
{
|
|
4958
5114
|
type: "button",
|
|
@@ -4962,16 +5118,16 @@ function CascadeMenu(props) {
|
|
|
4962
5118
|
setStage("items");
|
|
4963
5119
|
requestAnimationFrame(() => focusIn("items", flat.indexOf(active)));
|
|
4964
5120
|
},
|
|
4965
|
-
children: /* @__PURE__ */ (0,
|
|
5121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Chevron, { dir: "left", size: 14 })
|
|
4966
5122
|
}
|
|
4967
5123
|
) : null,
|
|
4968
|
-
active?.icon ? /* @__PURE__ */ (0,
|
|
4969
|
-
/* @__PURE__ */ (0,
|
|
5124
|
+
active?.icon ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: active.icon }) : null,
|
|
5125
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-chip-t", children: active ? active.label : "" })
|
|
4970
5126
|
] }),
|
|
4971
|
-
/* @__PURE__ */ (0,
|
|
5127
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "uic-pop-list", children: [
|
|
4972
5128
|
options.map((o) => {
|
|
4973
5129
|
const on = !!value && active?.id === value.item && o.id === value.option;
|
|
4974
|
-
return /* @__PURE__ */ (0,
|
|
5130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4975
5131
|
"button",
|
|
4976
5132
|
{
|
|
4977
5133
|
type: "button",
|
|
@@ -4980,16 +5136,16 @@ function CascadeMenu(props) {
|
|
|
4980
5136
|
disabled: !!o.disabled,
|
|
4981
5137
|
onClick: () => onPick?.(active, o),
|
|
4982
5138
|
children: [
|
|
4983
|
-
value ? /* @__PURE__ */ (0,
|
|
4984
|
-
/* @__PURE__ */ (0,
|
|
4985
|
-
o.note ? /* @__PURE__ */ (0,
|
|
5139
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-pop-check", "aria-hidden": "true", children: on ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Tick, {}) : null }) : null,
|
|
5140
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-chip-t", children: o.label }),
|
|
5141
|
+
o.note ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "uic-cascade-note", children: o.note }) : null,
|
|
4986
5142
|
o.badge || null
|
|
4987
5143
|
]
|
|
4988
5144
|
},
|
|
4989
5145
|
o.id
|
|
4990
5146
|
);
|
|
4991
5147
|
}),
|
|
4992
|
-
active && options.length === 0 ? /* @__PURE__ */ (0,
|
|
5148
|
+
active && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "uic-pop-note", children: noOptionsText }) : null
|
|
4993
5149
|
] }),
|
|
4994
5150
|
optionsFooter || null
|
|
4995
5151
|
] })
|
|
@@ -4999,9 +5155,9 @@ function CascadeMenu(props) {
|
|
|
4999
5155
|
}
|
|
5000
5156
|
|
|
5001
5157
|
// src/components/Modal.jsx
|
|
5002
|
-
var
|
|
5158
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
5003
5159
|
var import_react_dom4 = require("react-dom");
|
|
5004
|
-
var
|
|
5160
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5005
5161
|
function Modal(props) {
|
|
5006
5162
|
const {
|
|
5007
5163
|
open,
|
|
@@ -5015,10 +5171,10 @@ function Modal(props) {
|
|
|
5015
5171
|
children,
|
|
5016
5172
|
classNames = {}
|
|
5017
5173
|
} = props;
|
|
5018
|
-
const titleId = (0,
|
|
5019
|
-
const escape = (0,
|
|
5174
|
+
const titleId = (0, import_react26.useId)();
|
|
5175
|
+
const escape = (0, import_react26.useCallback)(() => onClose?.(), [onClose]);
|
|
5020
5176
|
useOverlayEscape(open, escape);
|
|
5021
|
-
(0,
|
|
5177
|
+
(0, import_react26.useEffect)(() => {
|
|
5022
5178
|
if (!open || typeof document === "undefined") return void 0;
|
|
5023
5179
|
const prev = document.body.style.overflow;
|
|
5024
5180
|
document.body.style.overflow = "hidden";
|
|
@@ -5031,12 +5187,12 @@ function Modal(props) {
|
|
|
5031
5187
|
if (e.target === e.currentTarget) onClose?.();
|
|
5032
5188
|
};
|
|
5033
5189
|
return (0, import_react_dom4.createPortal)(
|
|
5034
|
-
/* @__PURE__ */ (0,
|
|
5190
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5035
5191
|
"div",
|
|
5036
5192
|
{
|
|
5037
5193
|
className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
|
|
5038
5194
|
onMouseDown: onBackdrop,
|
|
5039
|
-
children: /* @__PURE__ */ (0,
|
|
5195
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5040
5196
|
"div",
|
|
5041
5197
|
{
|
|
5042
5198
|
className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
|
|
@@ -5045,15 +5201,15 @@ function Modal(props) {
|
|
|
5045
5201
|
"aria-modal": "true",
|
|
5046
5202
|
"aria-labelledby": labelledBy || (title ? titleId : void 0),
|
|
5047
5203
|
children: [
|
|
5048
|
-
title || actions ? /* @__PURE__ */ (0,
|
|
5049
|
-
/* @__PURE__ */ (0,
|
|
5050
|
-
title ? /* @__PURE__ */ (0,
|
|
5051
|
-
description ? /* @__PURE__ */ (0,
|
|
5204
|
+
title || actions ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "uic-modal-h", children: [
|
|
5205
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "uic-modal-title", children: [
|
|
5206
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { id: titleId, children: title }) : null,
|
|
5207
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: description }) : null
|
|
5052
5208
|
] }),
|
|
5053
5209
|
actions,
|
|
5054
|
-
/* @__PURE__ */ (0,
|
|
5210
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IcX, { size: 18 }) })
|
|
5055
5211
|
] }) : null,
|
|
5056
|
-
/* @__PURE__ */ (0,
|
|
5212
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
|
|
5057
5213
|
]
|
|
5058
5214
|
}
|
|
5059
5215
|
)
|
|
@@ -5064,15 +5220,15 @@ function Modal(props) {
|
|
|
5064
5220
|
}
|
|
5065
5221
|
|
|
5066
5222
|
// src/hooks/useTypewriter.js
|
|
5067
|
-
var
|
|
5223
|
+
var import_react27 = require("react");
|
|
5068
5224
|
var CHAR_MS = 26;
|
|
5069
5225
|
var HOLD_MS = 2600;
|
|
5070
5226
|
function useTypewriter(phrases, { active = true } = {}) {
|
|
5071
5227
|
const list = phrases && phrases.length ? phrases : [""];
|
|
5072
|
-
const [text, setText] = (0,
|
|
5073
|
-
const listRef = (0,
|
|
5228
|
+
const [text, setText] = (0, import_react27.useState)(list[0]);
|
|
5229
|
+
const listRef = (0, import_react27.useRef)(list);
|
|
5074
5230
|
listRef.current = list;
|
|
5075
|
-
(0,
|
|
5231
|
+
(0, import_react27.useEffect)(() => {
|
|
5076
5232
|
if (!active) return void 0;
|
|
5077
5233
|
if (typeof window === "undefined") return void 0;
|
|
5078
5234
|
if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
|
|
@@ -5103,7 +5259,7 @@ function useTypewriter(phrases, { active = true } = {}) {
|
|
|
5103
5259
|
}
|
|
5104
5260
|
|
|
5105
5261
|
// src/components/Panel.jsx
|
|
5106
|
-
var
|
|
5262
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5107
5263
|
function Panel(props) {
|
|
5108
5264
|
const {
|
|
5109
5265
|
title,
|
|
@@ -5125,43 +5281,43 @@ function Panel(props) {
|
|
|
5125
5281
|
classNames = {},
|
|
5126
5282
|
children
|
|
5127
5283
|
} = props;
|
|
5128
|
-
const body = loading ? /* @__PURE__ */ (0,
|
|
5129
|
-
/* @__PURE__ */ (0,
|
|
5130
|
-
/* @__PURE__ */ (0,
|
|
5131
|
-
/* @__PURE__ */ (0,
|
|
5132
|
-
/* @__PURE__ */ (0,
|
|
5133
|
-
] }) : error ? /* @__PURE__ */ (0,
|
|
5134
|
-
/* @__PURE__ */ (0,
|
|
5135
|
-
/* @__PURE__ */ (0,
|
|
5136
|
-
errorDetail ? /* @__PURE__ */ (0,
|
|
5137
|
-
/* @__PURE__ */ (0,
|
|
5138
|
-
/* @__PURE__ */ (0,
|
|
5284
|
+
const body = loading ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "uic-panel-load", children: [
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uic-panel-load-bar" }),
|
|
5286
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uic-panel-load-bar" }),
|
|
5287
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uic-panel-load-bar" }),
|
|
5288
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "uic-sr", children: loadingLabel })
|
|
5289
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "uic-panel-fail", children: [
|
|
5290
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "uic-panel-fail-t", children: errorTitle }),
|
|
5291
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("pre", { className: "uic-panel-fail-m", children: error }),
|
|
5292
|
+
errorDetail ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("details", { className: "uic-panel-fail-d", children: [
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("summary", { children: detailLabel }),
|
|
5294
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uic-panel-fail-dd", children: errorDetail })
|
|
5139
5295
|
] }) : null,
|
|
5140
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
5296
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uic-panel-fail-act", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { size: "sm", onClick: onRetry, children: retryLabel }) }) : null
|
|
5141
5297
|
] }) : children;
|
|
5142
|
-
return /* @__PURE__ */ (0,
|
|
5298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5143
5299
|
"section",
|
|
5144
5300
|
{
|
|
5145
5301
|
className: ["uic-panel", className, classNames.root || ""].filter(Boolean).join(" "),
|
|
5146
5302
|
"aria-busy": loading || busy || void 0,
|
|
5147
5303
|
children: [
|
|
5148
|
-
/* @__PURE__ */ (0,
|
|
5149
|
-
/* @__PURE__ */ (0,
|
|
5150
|
-
title ? /* @__PURE__ */ (0,
|
|
5151
|
-
meta ? /* @__PURE__ */ (0,
|
|
5304
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("header", { className: ["uic-panel-head", classNames.head || ""].filter(Boolean).join(" "), children: [
|
|
5305
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "uic-panel-titles", children: [
|
|
5306
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, { className: "uic-panel-title", children: title }) : null,
|
|
5307
|
+
meta ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "uic-panel-meta", children: meta }) : null
|
|
5152
5308
|
] }),
|
|
5153
|
-
actions ? /* @__PURE__ */ (0,
|
|
5309
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uic-panel-acts", children: actions }) : null
|
|
5154
5310
|
] }),
|
|
5155
|
-
busy ? /* @__PURE__ */ (0,
|
|
5156
|
-
/* @__PURE__ */ (0,
|
|
5157
|
-
footer ? /* @__PURE__ */ (0,
|
|
5311
|
+
busy ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "uic-panel-busy", role: "status", "aria-label": busyLabel }) : null,
|
|
5312
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: ["uic-panel-body", classNames.body || ""].filter(Boolean).join(" "), children: body }),
|
|
5313
|
+
footer ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("footer", { className: "uic-panel-foot", children: footer }) : null
|
|
5158
5314
|
]
|
|
5159
5315
|
}
|
|
5160
5316
|
);
|
|
5161
5317
|
}
|
|
5162
5318
|
|
|
5163
5319
|
// src/grid/PanelGrid.jsx
|
|
5164
|
-
var
|
|
5320
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
5165
5321
|
|
|
5166
5322
|
// src/grid/layout.js
|
|
5167
5323
|
function sortLayout(layout2) {
|
|
@@ -5234,11 +5390,11 @@ function sameLayout(a, b) {
|
|
|
5234
5390
|
}
|
|
5235
5391
|
|
|
5236
5392
|
// src/grid/PanelGrid.jsx
|
|
5237
|
-
var
|
|
5393
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5238
5394
|
function useMeasuredWidth() {
|
|
5239
|
-
const ref = (0,
|
|
5240
|
-
const [width, setWidth] = (0,
|
|
5241
|
-
(0,
|
|
5395
|
+
const ref = (0, import_react28.useRef)(null);
|
|
5396
|
+
const [width, setWidth] = (0, import_react28.useState)(0);
|
|
5397
|
+
(0, import_react28.useLayoutEffect)(() => {
|
|
5242
5398
|
const el = ref.current;
|
|
5243
5399
|
if (!el) return void 0;
|
|
5244
5400
|
const measure = () => setWidth(el.clientWidth);
|
|
@@ -5265,9 +5421,9 @@ function PanelGrid(props) {
|
|
|
5265
5421
|
className = ""
|
|
5266
5422
|
} = props;
|
|
5267
5423
|
const [wrapRef, width] = useMeasuredWidth();
|
|
5268
|
-
const [drag, setDrag] = (0,
|
|
5269
|
-
const dragRef = (0,
|
|
5270
|
-
const swallowClick = (0,
|
|
5424
|
+
const [drag, setDrag] = (0, import_react28.useState)(null);
|
|
5425
|
+
const dragRef = (0, import_react28.useRef)(null);
|
|
5426
|
+
const swallowClick = (0, import_react28.useRef)(false);
|
|
5271
5427
|
const stacked = width > 0 && width < stackAt;
|
|
5272
5428
|
const arrangeable = editable && !stacked;
|
|
5273
5429
|
const live = drag ? drag.preview : layout2;
|
|
@@ -5275,7 +5431,7 @@ function PanelGrid(props) {
|
|
|
5275
5431
|
const cellW = colW + gap;
|
|
5276
5432
|
const cellH = rowHeight + gap;
|
|
5277
5433
|
const rowsToPx = (h) => h * rowHeight + (h - 1) * gap;
|
|
5278
|
-
const stack2 = (0,
|
|
5434
|
+
const stack2 = (0, import_react28.useMemo)(() => {
|
|
5279
5435
|
if (!stacked) return null;
|
|
5280
5436
|
const tops = /* @__PURE__ */ new Map();
|
|
5281
5437
|
let y = 0;
|
|
@@ -5287,11 +5443,11 @@ function PanelGrid(props) {
|
|
|
5287
5443
|
}, [stacked, live, rowHeight, gap]);
|
|
5288
5444
|
const rows = layoutRows(live);
|
|
5289
5445
|
const height = stacked ? stack2.height : rows ? rowsToPx(rows) : 0;
|
|
5290
|
-
const commit = (0,
|
|
5446
|
+
const commit = (0, import_react28.useCallback)((next) => {
|
|
5291
5447
|
if (onLayoutChange && !sameLayout(next, layout2)) onLayoutChange(next);
|
|
5292
5448
|
}, [onLayoutChange, layout2]);
|
|
5293
|
-
const detach = (0,
|
|
5294
|
-
(0,
|
|
5449
|
+
const detach = (0, import_react28.useRef)(null);
|
|
5450
|
+
(0, import_react28.useEffect)(() => () => detach.current?.(), []);
|
|
5295
5451
|
const start = (id, mode) => (e) => {
|
|
5296
5452
|
if (!arrangeable || e.button !== 0) return;
|
|
5297
5453
|
const item = layout2.find((it) => it.i === id);
|
|
@@ -5356,7 +5512,7 @@ function PanelGrid(props) {
|
|
|
5356
5512
|
const byId = new Map(live.map((it) => [it.i, it]));
|
|
5357
5513
|
const ghost = drag && drag.mode === "move" && byId.has(drag.id) ? boxOf(byId.get(drag.id)) : null;
|
|
5358
5514
|
const cls = ["uic-pg", arrangeable ? "is-editable" : "", stacked ? "is-stacked" : "", className].filter(Boolean).join(" ");
|
|
5359
|
-
return /* @__PURE__ */ (0,
|
|
5515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5360
5516
|
"div",
|
|
5361
5517
|
{
|
|
5362
5518
|
ref: wrapRef,
|
|
@@ -5367,15 +5523,15 @@ function PanelGrid(props) {
|
|
|
5367
5523
|
swallowClick.current = false;
|
|
5368
5524
|
},
|
|
5369
5525
|
children: [
|
|
5370
|
-
ghost ? /* @__PURE__ */ (0,
|
|
5371
|
-
width > 0 &&
|
|
5372
|
-
if (!
|
|
5526
|
+
ghost ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "uic-pg-ghost", "aria-hidden": "true", style: ghost }) : null,
|
|
5527
|
+
width > 0 && import_react28.default.Children.map(children, (child) => {
|
|
5528
|
+
if (!import_react28.default.isValidElement(child) || child.key == null) return null;
|
|
5373
5529
|
const id = String(child.key).replace(/^\.\$/, "");
|
|
5374
5530
|
const it = byId.get(id);
|
|
5375
5531
|
if (!it) return null;
|
|
5376
5532
|
const moving = drag && drag.id === id;
|
|
5377
5533
|
const offset = moving && drag.mode === "move" ? { transform: `translate(${drag.dx}px, ${drag.dy}px)` } : null;
|
|
5378
|
-
return /* @__PURE__ */ (0,
|
|
5534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5379
5535
|
"div",
|
|
5380
5536
|
{
|
|
5381
5537
|
className: "uic-pg-item" + (moving ? " is-moving" : ""),
|
|
@@ -5383,7 +5539,7 @@ function PanelGrid(props) {
|
|
|
5383
5539
|
onPointerDown: arrangeable ? start(id, "move") : void 0,
|
|
5384
5540
|
children: [
|
|
5385
5541
|
child,
|
|
5386
|
-
arrangeable && !it.static ? /* @__PURE__ */ (0,
|
|
5542
|
+
arrangeable && !it.static ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5387
5543
|
"button",
|
|
5388
5544
|
{
|
|
5389
5545
|
type: "button",
|
|
@@ -5391,7 +5547,7 @@ function PanelGrid(props) {
|
|
|
5391
5547
|
"aria-label": resizeLabel ? resizeLabel(id) : "Resize panel. Arrow keys resize it; shift with arrow keys moves it past its neighbours.",
|
|
5392
5548
|
onPointerDown: start(id, "resize"),
|
|
5393
5549
|
onKeyDown: onHandleKey(id),
|
|
5394
|
-
children: /* @__PURE__ */ (0,
|
|
5550
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M9 1v8H1", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) })
|
|
5395
5551
|
}
|
|
5396
5552
|
) : null
|
|
5397
5553
|
]
|
|
@@ -5408,8 +5564,8 @@ function packLayout(layout2, cols = 12) {
|
|
|
5408
5564
|
}
|
|
5409
5565
|
|
|
5410
5566
|
// src/timeline/Timeline.jsx
|
|
5411
|
-
var
|
|
5412
|
-
var
|
|
5567
|
+
var import_react29 = require("react");
|
|
5568
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5413
5569
|
var TL_MIN_PPS = 4;
|
|
5414
5570
|
var TL_MAX_PPS = 400;
|
|
5415
5571
|
var TL_DEFAULT_PPS = 26;
|
|
@@ -5498,21 +5654,21 @@ function Timeline({
|
|
|
5498
5654
|
emptyLabel = "Nothing here yet.",
|
|
5499
5655
|
className = ""
|
|
5500
5656
|
}) {
|
|
5501
|
-
const scroller = (0,
|
|
5502
|
-
const innerRef = (0,
|
|
5503
|
-
const [pps, setPps] = (0,
|
|
5657
|
+
const scroller = (0, import_react29.useRef)(null);
|
|
5658
|
+
const innerRef = (0, import_react29.useRef)(null);
|
|
5659
|
+
const [pps, setPps] = (0, import_react29.useState)(() => {
|
|
5504
5660
|
if (zoomStorageKey && typeof window !== "undefined") {
|
|
5505
5661
|
const n = parseFloat(window.localStorage.getItem(zoomStorageKey) || "");
|
|
5506
5662
|
if (Number.isFinite(n)) return clamp(n, TL_MIN_PPS, TL_MAX_PPS);
|
|
5507
5663
|
}
|
|
5508
5664
|
return TL_DEFAULT_PPS;
|
|
5509
5665
|
});
|
|
5510
|
-
const [snapping, setSnapping] = (0,
|
|
5511
|
-
const gesture = (0,
|
|
5512
|
-
const [drag, setDrag] = (0,
|
|
5513
|
-
const anchor = (0,
|
|
5514
|
-
const [dropAt, setDropAt] = (0,
|
|
5515
|
-
const rows = (0,
|
|
5666
|
+
const [snapping, setSnapping] = (0, import_react29.useState)(() => snapStorageKey && typeof window !== "undefined" ? window.localStorage.getItem(snapStorageKey) !== "0" : true);
|
|
5667
|
+
const gesture = (0, import_react29.useRef)(null);
|
|
5668
|
+
const [drag, setDrag] = (0, import_react29.useState)(null);
|
|
5669
|
+
const anchor = (0, import_react29.useRef)(null);
|
|
5670
|
+
const [dropAt, setDropAt] = (0, import_react29.useState)(null);
|
|
5671
|
+
const rows = (0, import_react29.useMemo)(
|
|
5516
5672
|
() => tracks.map((t) => ({
|
|
5517
5673
|
...t,
|
|
5518
5674
|
sequential: t.sequential !== false,
|
|
@@ -5520,12 +5676,12 @@ function Timeline({
|
|
|
5520
5676
|
})),
|
|
5521
5677
|
[tracks, pps]
|
|
5522
5678
|
);
|
|
5523
|
-
const contentSeconds = (0,
|
|
5679
|
+
const contentSeconds = (0, import_react29.useMemo)(() => {
|
|
5524
5680
|
let end = 0;
|
|
5525
5681
|
for (const t of rows) for (const l of t.laid) end = Math.max(end, l.t0 + l.w / pps);
|
|
5526
5682
|
return end;
|
|
5527
5683
|
}, [rows, pps]);
|
|
5528
|
-
const snapTimes = (0,
|
|
5684
|
+
const snapTimes = (0, import_react29.useMemo)(() => {
|
|
5529
5685
|
const out = [0, currentTime];
|
|
5530
5686
|
for (const t of rows) for (const l of t.laid) {
|
|
5531
5687
|
out.push(l.t0);
|
|
@@ -5533,7 +5689,7 @@ function Timeline({
|
|
|
5533
5689
|
}
|
|
5534
5690
|
return out;
|
|
5535
5691
|
}, [rows, pps, currentTime]);
|
|
5536
|
-
const setZoom = (0,
|
|
5692
|
+
const setZoom = (0, import_react29.useCallback)((next, clientX) => {
|
|
5537
5693
|
const v = clamp(next, TL_MIN_PPS, TL_MAX_PPS);
|
|
5538
5694
|
const el = scroller.current;
|
|
5539
5695
|
if (el) {
|
|
@@ -5549,21 +5705,21 @@ function Timeline({
|
|
|
5549
5705
|
}
|
|
5550
5706
|
}
|
|
5551
5707
|
}, [pps, zoomStorageKey]);
|
|
5552
|
-
const fitPps = (0,
|
|
5708
|
+
const fitPps = (0, import_react29.useCallback)((seconds) => {
|
|
5553
5709
|
const el = scroller.current;
|
|
5554
5710
|
if (!el || !(seconds > 0)) return null;
|
|
5555
5711
|
const room = el.clientWidth - TL_HEAD_W - 56;
|
|
5556
5712
|
return room > 0 ? clamp(room / seconds, TL_MIN_PPS, TL_MAX_PPS) : null;
|
|
5557
5713
|
}, []);
|
|
5558
|
-
const fit = (0,
|
|
5714
|
+
const fit = (0, import_react29.useCallback)(() => {
|
|
5559
5715
|
const v = fitPps(contentSeconds);
|
|
5560
5716
|
if (v !== null) {
|
|
5561
5717
|
setPps(v);
|
|
5562
5718
|
if (scroller.current) scroller.current.scrollLeft = 0;
|
|
5563
5719
|
}
|
|
5564
5720
|
}, [fitPps, contentSeconds]);
|
|
5565
|
-
const fitted = (0,
|
|
5566
|
-
(0,
|
|
5721
|
+
const fitted = (0, import_react29.useRef)(false);
|
|
5722
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
5567
5723
|
if (fitted.current || !(contentSeconds > 0)) return;
|
|
5568
5724
|
if (zoomStorageKey && typeof window !== "undefined" && window.localStorage.getItem(zoomStorageKey)) {
|
|
5569
5725
|
fitted.current = true;
|
|
@@ -5575,13 +5731,13 @@ function Timeline({
|
|
|
5575
5731
|
setPps(v);
|
|
5576
5732
|
}
|
|
5577
5733
|
}, [contentSeconds, fitPps, zoomStorageKey]);
|
|
5578
|
-
(0,
|
|
5734
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
5579
5735
|
const a = anchor.current;
|
|
5580
5736
|
if (!a || !scroller.current) return;
|
|
5581
5737
|
anchor.current = null;
|
|
5582
5738
|
scroller.current.scrollLeft = Math.max(0, TL_HEAD_W + a.t * pps - a.vx);
|
|
5583
5739
|
}, [pps]);
|
|
5584
|
-
(0,
|
|
5740
|
+
(0, import_react29.useEffect)(() => {
|
|
5585
5741
|
const el = scroller.current;
|
|
5586
5742
|
if (!el) return void 0;
|
|
5587
5743
|
const onWheel = (e) => {
|
|
@@ -5592,12 +5748,12 @@ function Timeline({
|
|
|
5592
5748
|
el.addEventListener("wheel", onWheel, { passive: false });
|
|
5593
5749
|
return () => el.removeEventListener("wheel", onWheel);
|
|
5594
5750
|
}, [pps, setZoom]);
|
|
5595
|
-
const timeAt = (0,
|
|
5751
|
+
const timeAt = (0, import_react29.useCallback)((clientX) => {
|
|
5596
5752
|
const el = innerRef.current;
|
|
5597
5753
|
if (!el) return 0;
|
|
5598
5754
|
return Math.max(0, (clientX - el.getBoundingClientRect().left - TL_HEAD_W) / pps);
|
|
5599
5755
|
}, [pps]);
|
|
5600
|
-
const beginGesture = (0,
|
|
5756
|
+
const beginGesture = (0, import_react29.useCallback)((e, spec) => {
|
|
5601
5757
|
e.preventDefault();
|
|
5602
5758
|
e.stopPropagation();
|
|
5603
5759
|
gesture.current = { ...spec, startX: e.clientX, active: false, value: null };
|
|
@@ -5631,12 +5787,12 @@ function Timeline({
|
|
|
5631
5787
|
window.addEventListener("pointermove", move);
|
|
5632
5788
|
window.addEventListener("pointerup", up);
|
|
5633
5789
|
}, [timeAt, snapping, snapTimes, pps, onSeek]);
|
|
5634
|
-
const onScrub = (0,
|
|
5790
|
+
const onScrub = (0, import_react29.useCallback)((e) => {
|
|
5635
5791
|
if (!onSeek) return;
|
|
5636
5792
|
onSeek(timeAt(e.clientX));
|
|
5637
5793
|
beginGesture(e, { kind: "scrub" });
|
|
5638
5794
|
}, [onSeek, timeAt, beginGesture]);
|
|
5639
|
-
const splitTarget = (0,
|
|
5795
|
+
const splitTarget = (0, import_react29.useMemo)(() => {
|
|
5640
5796
|
if (!onSplit) return null;
|
|
5641
5797
|
for (const track of rows) {
|
|
5642
5798
|
for (const l of track.laid) {
|
|
@@ -5648,17 +5804,17 @@ function Timeline({
|
|
|
5648
5804
|
}
|
|
5649
5805
|
return null;
|
|
5650
5806
|
}, [rows, currentTime, onSplit]);
|
|
5651
|
-
const doSplit = (0,
|
|
5807
|
+
const doSplit = (0, import_react29.useCallback)(() => {
|
|
5652
5808
|
if (!splitTarget) return;
|
|
5653
5809
|
onSplit(splitTarget.l.clip, currentTime - splitTarget.l.t0, splitTarget.track);
|
|
5654
5810
|
}, [splitTarget, currentTime, onSplit]);
|
|
5655
|
-
const selected = (0,
|
|
5811
|
+
const selected = (0, import_react29.useMemo)(() => {
|
|
5656
5812
|
for (const track of rows) for (const l of track.laid) {
|
|
5657
5813
|
if (l.clip.id === selectedClipId) return { track, l };
|
|
5658
5814
|
}
|
|
5659
5815
|
return null;
|
|
5660
5816
|
}, [rows, selectedClipId]);
|
|
5661
|
-
const onKeyDown = (0,
|
|
5817
|
+
const onKeyDown = (0, import_react29.useCallback)((e) => {
|
|
5662
5818
|
const tag = e.target?.tagName;
|
|
5663
5819
|
if (tag === "INPUT" || tag === "TEXTAREA" || e.target?.isContentEditable) return;
|
|
5664
5820
|
if (e.key === "+" || e.key === "=") {
|
|
@@ -5675,7 +5831,7 @@ function Timeline({
|
|
|
5675
5831
|
onDeleteClip(selected.l.clip, selected.track);
|
|
5676
5832
|
}
|
|
5677
5833
|
}, [pps, setZoom, doSplit, selected, onDeleteClip]);
|
|
5678
|
-
const toggleSnap = (0,
|
|
5834
|
+
const toggleSnap = (0, import_react29.useCallback)(() => {
|
|
5679
5835
|
setSnapping((v) => {
|
|
5680
5836
|
const next = !v;
|
|
5681
5837
|
if (snapStorageKey && typeof window !== "undefined") {
|
|
@@ -5692,9 +5848,9 @@ function Timeline({
|
|
|
5692
5848
|
const laneW = Math.max(contentSeconds * pps + 140, 320);
|
|
5693
5849
|
const ticks = [];
|
|
5694
5850
|
for (let t = 0; t <= contentSeconds + major; t += major) ticks.push(t);
|
|
5695
|
-
return /* @__PURE__ */ (0,
|
|
5696
|
-
/* @__PURE__ */ (0,
|
|
5697
|
-
onSplit && /* @__PURE__ */ (0,
|
|
5851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `rui-tl ${className}`, onKeyDown, tabIndex: 0, children: [
|
|
5852
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "rui-tl-bar", children: [
|
|
5853
|
+
onSplit && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5698
5854
|
"button",
|
|
5699
5855
|
{
|
|
5700
5856
|
type: "button",
|
|
@@ -5703,7 +5859,7 @@ function Timeline({
|
|
|
5703
5859
|
disabled: !splitTarget,
|
|
5704
5860
|
title: splitTarget ? "Split at the playhead (B)" : "Move the playhead inside a clip to split it",
|
|
5705
5861
|
children: [
|
|
5706
|
-
/* @__PURE__ */ (0,
|
|
5862
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5707
5863
|
"svg",
|
|
5708
5864
|
{
|
|
5709
5865
|
width: "13",
|
|
@@ -5715,19 +5871,19 @@ function Timeline({
|
|
|
5715
5871
|
strokeLinecap: "round",
|
|
5716
5872
|
"aria-hidden": "true",
|
|
5717
5873
|
children: [
|
|
5718
|
-
/* @__PURE__ */ (0,
|
|
5719
|
-
/* @__PURE__ */ (0,
|
|
5720
|
-
/* @__PURE__ */ (0,
|
|
5721
|
-
/* @__PURE__ */ (0,
|
|
5722
|
-
/* @__PURE__ */ (0,
|
|
5874
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("circle", { cx: "6", cy: "6", r: "3" }),
|
|
5875
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("circle", { cx: "6", cy: "18", r: "3" }),
|
|
5876
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("line", { x1: "20", y1: "4", x2: "8.12", y2: "15.88" }),
|
|
5877
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("line", { x1: "14.47", y1: "14.48", x2: "20", y2: "20" }),
|
|
5878
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("line", { x1: "8.12", y1: "8.12", x2: "12", y2: "12" })
|
|
5723
5879
|
]
|
|
5724
5880
|
}
|
|
5725
5881
|
),
|
|
5726
|
-
/* @__PURE__ */ (0,
|
|
5882
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: "Split" })
|
|
5727
5883
|
]
|
|
5728
5884
|
}
|
|
5729
5885
|
),
|
|
5730
|
-
onDeleteClip && /* @__PURE__ */ (0,
|
|
5886
|
+
onDeleteClip && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5731
5887
|
"button",
|
|
5732
5888
|
{
|
|
5733
5889
|
type: "button",
|
|
@@ -5738,7 +5894,7 @@ function Timeline({
|
|
|
5738
5894
|
children: "Remove"
|
|
5739
5895
|
}
|
|
5740
5896
|
),
|
|
5741
|
-
/* @__PURE__ */ (0,
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5742
5898
|
"button",
|
|
5743
5899
|
{
|
|
5744
5900
|
type: "button",
|
|
@@ -5749,9 +5905,9 @@ function Timeline({
|
|
|
5749
5905
|
children: "Snap"
|
|
5750
5906
|
}
|
|
5751
5907
|
),
|
|
5752
|
-
/* @__PURE__ */ (0,
|
|
5753
|
-
/* @__PURE__ */ (0,
|
|
5754
|
-
/* @__PURE__ */ (0,
|
|
5908
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-time", "aria-label": "Playhead position", children: exactLabel(currentTime) }),
|
|
5909
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-spacer" }),
|
|
5910
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5755
5911
|
"button",
|
|
5756
5912
|
{
|
|
5757
5913
|
type: "button",
|
|
@@ -5763,7 +5919,7 @@ function Timeline({
|
|
|
5763
5919
|
children: "\u2212"
|
|
5764
5920
|
}
|
|
5765
5921
|
),
|
|
5766
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5767
5923
|
"button",
|
|
5768
5924
|
{
|
|
5769
5925
|
type: "button",
|
|
@@ -5775,7 +5931,7 @@ function Timeline({
|
|
|
5775
5931
|
children: "+"
|
|
5776
5932
|
}
|
|
5777
5933
|
),
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5934
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5779
5935
|
"button",
|
|
5780
5936
|
{
|
|
5781
5937
|
type: "button",
|
|
@@ -5787,10 +5943,10 @@ function Timeline({
|
|
|
5787
5943
|
}
|
|
5788
5944
|
)
|
|
5789
5945
|
] }),
|
|
5790
|
-
/* @__PURE__ */ (0,
|
|
5791
|
-
/* @__PURE__ */ (0,
|
|
5792
|
-
/* @__PURE__ */ (0,
|
|
5793
|
-
/* @__PURE__ */ (0,
|
|
5946
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "rui-tl-scroll", ref: scroller, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "rui-tl-inner", ref: innerRef, style: { width: TL_HEAD_W + laneW }, children: [
|
|
5947
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "rui-tl-row rui-tl-rulerrow", children: [
|
|
5948
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "rui-tl-head rui-tl-rulerhead", "aria-hidden": "true" }),
|
|
5949
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5794
5950
|
"div",
|
|
5795
5951
|
{
|
|
5796
5952
|
className: "rui-tl-ruler",
|
|
@@ -5819,17 +5975,17 @@ function Timeline({
|
|
|
5819
5975
|
onSeek(currentTime + step);
|
|
5820
5976
|
}
|
|
5821
5977
|
} : void 0,
|
|
5822
|
-
children: ticks.map((t) => /* @__PURE__ */ (0,
|
|
5978
|
+
children: ticks.map((t) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-ticklbl", style: { left: t * pps }, children: tickLabel(t, major) }, t))
|
|
5823
5979
|
}
|
|
5824
5980
|
)
|
|
5825
5981
|
] }),
|
|
5826
|
-
rows.length === 0 && /* @__PURE__ */ (0,
|
|
5827
|
-
rows.map((track) => /* @__PURE__ */ (0,
|
|
5828
|
-
/* @__PURE__ */ (0,
|
|
5982
|
+
rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "rui-tl-empty", children: emptyLabel }),
|
|
5983
|
+
rows.map((track) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "rui-tl-row", children: [
|
|
5984
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "rui-tl-head", title: track.title || track.label, children: [
|
|
5829
5985
|
track.icon,
|
|
5830
|
-
/* @__PURE__ */ (0,
|
|
5986
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-headlbl", children: track.label })
|
|
5831
5987
|
] }),
|
|
5832
|
-
/* @__PURE__ */ (0,
|
|
5988
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
5833
5989
|
"div",
|
|
5834
5990
|
{
|
|
5835
5991
|
className: "rui-tl-lane" + (dropAt?.trackId === track.id ? " is-dropping" : ""),
|
|
@@ -5860,8 +6016,8 @@ function Timeline({
|
|
|
5860
6016
|
onDropClip(payload, { trackId: track.id, seconds: t, index });
|
|
5861
6017
|
} : void 0,
|
|
5862
6018
|
children: [
|
|
5863
|
-
track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ (0,
|
|
5864
|
-
track.laid.map((l) => /* @__PURE__ */ (0,
|
|
6019
|
+
track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "rui-tl-laneempty", children: track.emptyLabel }),
|
|
6020
|
+
track.laid.map((l) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5865
6021
|
Clip,
|
|
5866
6022
|
{
|
|
5867
6023
|
l,
|
|
@@ -5877,7 +6033,7 @@ function Timeline({
|
|
|
5877
6033
|
},
|
|
5878
6034
|
l.clip.id ?? l.i
|
|
5879
6035
|
)),
|
|
5880
|
-
dropAt?.trackId === track.id && /* @__PURE__ */ (0,
|
|
6036
|
+
dropAt?.trackId === track.id && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5881
6037
|
"span",
|
|
5882
6038
|
{
|
|
5883
6039
|
className: "rui-tl-dropmark",
|
|
@@ -5885,7 +6041,7 @@ function Timeline({
|
|
|
5885
6041
|
"aria-hidden": "true"
|
|
5886
6042
|
}
|
|
5887
6043
|
),
|
|
5888
|
-
laneAppend && /* @__PURE__ */ (0,
|
|
6044
|
+
laneAppend && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5889
6045
|
"span",
|
|
5890
6046
|
{
|
|
5891
6047
|
className: "rui-tl-append",
|
|
@@ -5897,9 +6053,9 @@ function Timeline({
|
|
|
5897
6053
|
}
|
|
5898
6054
|
)
|
|
5899
6055
|
] }, track.id)),
|
|
5900
|
-
onDropClip && newLaneLabel && /* @__PURE__ */ (0,
|
|
5901
|
-
/* @__PURE__ */ (0,
|
|
5902
|
-
/* @__PURE__ */ (0,
|
|
6056
|
+
onDropClip && newLaneLabel && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "rui-tl-row", children: [
|
|
6057
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "rui-tl-head rui-tl-newhead", "aria-hidden": "true" }),
|
|
6058
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5903
6059
|
"div",
|
|
5904
6060
|
{
|
|
5905
6061
|
className: "rui-tl-newlane" + (dropAt?.trackId === null ? " is-dropping" : ""),
|
|
@@ -5921,11 +6077,11 @@ function Timeline({
|
|
|
5921
6077
|
e.preventDefault();
|
|
5922
6078
|
onDropClip(payload, { trackId: null, seconds: timeAt(e.clientX), index: 0 });
|
|
5923
6079
|
},
|
|
5924
|
-
children: /* @__PURE__ */ (0,
|
|
6080
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-newlbl", children: newLaneLabel })
|
|
5925
6081
|
}
|
|
5926
6082
|
)
|
|
5927
6083
|
] }),
|
|
5928
|
-
drag?.guide != null && /* @__PURE__ */ (0,
|
|
6084
|
+
drag?.guide != null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5929
6085
|
"div",
|
|
5930
6086
|
{
|
|
5931
6087
|
className: "rui-tl-guide",
|
|
@@ -5933,16 +6089,16 @@ function Timeline({
|
|
|
5933
6089
|
"aria-hidden": "true"
|
|
5934
6090
|
}
|
|
5935
6091
|
),
|
|
5936
|
-
Number.isFinite(currentTime) && /* @__PURE__ */ (0,
|
|
6092
|
+
Number.isFinite(currentTime) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5937
6093
|
"div",
|
|
5938
6094
|
{
|
|
5939
6095
|
className: "rui-tl-playhead",
|
|
5940
6096
|
style: { left: TL_HEAD_W + currentTime * pps },
|
|
5941
6097
|
"aria-hidden": "true",
|
|
5942
|
-
children: /* @__PURE__ */ (0,
|
|
6098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-playhead-grip" })
|
|
5943
6099
|
}
|
|
5944
6100
|
),
|
|
5945
|
-
drag?.annotation && /* @__PURE__ */ (0,
|
|
6101
|
+
drag?.annotation && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "rui-tl-annot", style: { left: TL_HEAD_W + (drag.annotAt || 0) * pps }, children: drag.annotation })
|
|
5946
6102
|
] }) })
|
|
5947
6103
|
] });
|
|
5948
6104
|
}
|
|
@@ -6018,7 +6174,7 @@ function Clip({
|
|
|
6018
6174
|
click: onSelect
|
|
6019
6175
|
});
|
|
6020
6176
|
};
|
|
6021
|
-
return /* @__PURE__ */ (0,
|
|
6177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
6022
6178
|
"article",
|
|
6023
6179
|
{
|
|
6024
6180
|
className: "rui-tl-clip" + (clip.state ? ` is-${clip.state}` : "") + (known ? "" : " is-unmeasured") + (selected ? " is-selected" : "") + (live ? " is-live" : ""),
|
|
@@ -6033,10 +6189,10 @@ function Clip({
|
|
|
6033
6189
|
}
|
|
6034
6190
|
},
|
|
6035
6191
|
children: [
|
|
6036
|
-
clip.poster ? /* @__PURE__ */ (0,
|
|
6192
|
+
clip.poster ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-strip", style: {
|
|
6037
6193
|
backgroundImage: `url("${String(clip.poster).replace(/"/g, '\\"')}")`,
|
|
6038
6194
|
backgroundSize: `${tileW}px 100%`
|
|
6039
|
-
} }) : clip.video ? /* @__PURE__ */ (0,
|
|
6195
|
+
} }) : clip.video ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6040
6196
|
"video",
|
|
6041
6197
|
{
|
|
6042
6198
|
className: "rui-tl-frame",
|
|
@@ -6047,12 +6203,12 @@ function Clip({
|
|
|
6047
6203
|
tabIndex: -1,
|
|
6048
6204
|
"aria-hidden": "true"
|
|
6049
6205
|
}
|
|
6050
|
-
) : /* @__PURE__ */ (0,
|
|
6051
|
-
clip.badge && /* @__PURE__ */ (0,
|
|
6052
|
-
known && width > 46 && /* @__PURE__ */ (0,
|
|
6053
|
-
clip.label && width > 104 && /* @__PURE__ */ (0,
|
|
6054
|
-
onTrim && known && /* @__PURE__ */ (0,
|
|
6055
|
-
/* @__PURE__ */ (0,
|
|
6206
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-blank", "aria-hidden": "true", children: clip.glyph }),
|
|
6207
|
+
clip.badge && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-badge", children: clip.badge }),
|
|
6208
|
+
known && width > 46 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-dur", children: durationLabel(clip.duration) }),
|
|
6209
|
+
clip.label && width > 104 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rui-tl-name", children: clip.label }),
|
|
6210
|
+
onTrim && known && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
6211
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6056
6212
|
"span",
|
|
6057
6213
|
{
|
|
6058
6214
|
className: "rui-tl-trim l",
|
|
@@ -6061,7 +6217,7 @@ function Clip({
|
|
|
6061
6217
|
"aria-label": `Trim the start of ${clip.label || "this clip"}`
|
|
6062
6218
|
}
|
|
6063
6219
|
),
|
|
6064
|
-
/* @__PURE__ */ (0,
|
|
6220
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
6065
6221
|
"span",
|
|
6066
6222
|
{
|
|
6067
6223
|
className: "rui-tl-trim r",
|