@discuss-ds/ui 0.40.1 → 0.41.0
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/CHANGELOG.md +18 -0
- package/dist/index.cjs +691 -580
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -6
- package/dist/index.d.ts +71 -6
- package/dist/index.js +663 -556
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2354,63 +2354,117 @@ Stepper.displayName = "Stepper";
|
|
|
2354
2354
|
// src/components/Navigation/NavRail.tsx
|
|
2355
2355
|
import * as React34 from "react";
|
|
2356
2356
|
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2357
|
-
var
|
|
2357
|
+
var NavRailContext = React34.createContext("secondary");
|
|
2358
|
+
var NavRail = React34.forwardRef(({ className, children, footer, header, hierarchy = "secondary", ...props }, ref) => /* @__PURE__ */ jsx35(NavRailContext.Provider, { value: hierarchy, children: /* @__PURE__ */ jsxs25("nav", { ref, className: cn("flex h-full shrink-0 flex-col border-r border-border", hierarchy === "primary" ? "w-18" : "w-16", className), ...props, children: [
|
|
2359
|
+
header && /* @__PURE__ */ jsx35("div", { className: "flex h-16 shrink-0 items-center justify-center border-b border-border", children: header }),
|
|
2358
2360
|
/* @__PURE__ */ jsx35("ul", { className: "flex flex-col items-center gap-2 px-2 pt-3", children }),
|
|
2359
|
-
footer && /* @__PURE__ */ jsx35("div", { className: "mt-auto flex flex-col items-center px-2 pb-3", children: footer })
|
|
2360
|
-
] }));
|
|
2361
|
+
footer && /* @__PURE__ */ jsx35("div", { className: cn("mt-auto flex flex-col items-center px-2", hierarchy === "primary" ? "gap-3 py-4" : "pb-3"), children: footer })
|
|
2362
|
+
] }) }));
|
|
2361
2363
|
NavRail.displayName = "NavRail";
|
|
2362
|
-
var NavRailItem = React34.forwardRef(({ className, icon, label, selected = false, type = "button", ...props }, ref) =>
|
|
2363
|
-
"
|
|
2364
|
-
{
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
"
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
/* @__PURE__ */ jsx35(
|
|
2378
|
-
"span",
|
|
2379
|
-
{
|
|
2380
|
-
"aria-hidden": "true",
|
|
2381
|
-
className: cn(
|
|
2382
|
-
"flex size-9 items-center justify-center rounded-md transition-colors [&>svg]:size-4",
|
|
2383
|
-
// Hover fills the square with accent-soft, over the selected fill too.
|
|
2384
|
-
selected ? "bg-secondary" : "",
|
|
2385
|
-
"group-hover:bg-accent-soft"
|
|
2386
|
-
),
|
|
2387
|
-
children: icon
|
|
2388
|
-
}
|
|
2364
|
+
var NavRailItem = React34.forwardRef(({ className, icon, label, selected = false, type = "button", ...props }, ref) => {
|
|
2365
|
+
const primary = React34.useContext(NavRailContext) === "primary";
|
|
2366
|
+
return /* @__PURE__ */ jsx35("li", { className: "w-full", children: /* @__PURE__ */ jsxs25(
|
|
2367
|
+
"button",
|
|
2368
|
+
{
|
|
2369
|
+
ref,
|
|
2370
|
+
type,
|
|
2371
|
+
"aria-current": selected ? "page" : void 0,
|
|
2372
|
+
className: cn(
|
|
2373
|
+
"group flex w-full cursor-pointer flex-col items-center rounded-md text-body-xxs outline-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
2374
|
+
primary ? "gap-2 font-medium" : "gap-1",
|
|
2375
|
+
// Hover (selected or not, Figma "Primary menu items" Hover=Yes): the caption and icon in accent-soft-foreground.
|
|
2376
|
+
selected ? primary ? "text-primary" : "text-surface-foreground" : "text-secondary-muted-foreground",
|
|
2377
|
+
"hover:text-accent-soft-foreground",
|
|
2378
|
+
className
|
|
2389
2379
|
),
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2380
|
+
...props,
|
|
2381
|
+
children: [
|
|
2382
|
+
/* @__PURE__ */ jsx35(
|
|
2383
|
+
"span",
|
|
2384
|
+
{
|
|
2385
|
+
"aria-hidden": "true",
|
|
2386
|
+
className: cn(
|
|
2387
|
+
"flex items-center justify-center rounded-md transition-colors",
|
|
2388
|
+
primary ? "size-10 [&>svg]:size-6" : "size-9 [&>svg]:size-4",
|
|
2389
|
+
// Selected: secondary fill, or primary with the label colour on a primary rail. Hover fills the square with accent-soft, over the selected fill too.
|
|
2390
|
+
selected ? primary ? "bg-primary text-primary-foreground" : "bg-secondary" : "",
|
|
2391
|
+
"group-hover:bg-accent-soft group-hover:text-accent-soft-foreground"
|
|
2392
|
+
),
|
|
2393
|
+
children: icon
|
|
2394
|
+
}
|
|
2395
|
+
),
|
|
2396
|
+
/* @__PURE__ */ jsx35("span", { children: label })
|
|
2397
|
+
]
|
|
2398
|
+
}
|
|
2399
|
+
) });
|
|
2400
|
+
});
|
|
2394
2401
|
NavRailItem.displayName = "NavRailItem";
|
|
2395
2402
|
|
|
2396
|
-
// src/components/
|
|
2403
|
+
// src/components/Navigation/ProjectSidebar.tsx
|
|
2397
2404
|
import * as React35 from "react";
|
|
2405
|
+
import { jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2406
|
+
var ProjectSidebar = React35.forwardRef(({ className, children, project, action, label, ...props }, ref) => {
|
|
2407
|
+
const labelId = React35.useId();
|
|
2408
|
+
return /* @__PURE__ */ jsxs26("nav", { ref, className: cn("flex h-full w-60 shrink-0 flex-col border-r border-border bg-surface", className), ...props, children: [
|
|
2409
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex h-16 shrink-0 items-center gap-2 border-b border-border px-3", children: [
|
|
2410
|
+
/* @__PURE__ */ jsx36("span", { className: "min-w-0 flex-1 truncate text-ui-label text-surface-foreground", children: project }),
|
|
2411
|
+
action
|
|
2412
|
+
] }),
|
|
2413
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex min-h-0 flex-col gap-2 overflow-y-auto p-3", children: [
|
|
2414
|
+
label && /* @__PURE__ */ jsx36("p", { id: labelId, className: "px-2 pt-1 text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
2415
|
+
/* @__PURE__ */ jsx36("ul", { className: "flex flex-col gap-2", "aria-labelledby": label ? labelId : void 0, children })
|
|
2416
|
+
] })
|
|
2417
|
+
] });
|
|
2418
|
+
});
|
|
2419
|
+
ProjectSidebar.displayName = "ProjectSidebar";
|
|
2420
|
+
|
|
2421
|
+
// src/components/Navigation/SidebarNavItem.tsx
|
|
2422
|
+
import * as React36 from "react";
|
|
2423
|
+
import { CaretDown as CaretDown4 } from "@phosphor-icons/react";
|
|
2424
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2425
|
+
var SidebarNavItem = React36.forwardRef(
|
|
2426
|
+
({ className, icon, label, selected = false, expandable = false, expanded = false, type = "button", ...props }, ref) => /* @__PURE__ */ jsx37("li", { className: "w-full", children: /* @__PURE__ */ jsxs27(
|
|
2427
|
+
"button",
|
|
2428
|
+
{
|
|
2429
|
+
ref,
|
|
2430
|
+
type,
|
|
2431
|
+
"aria-current": selected ? "page" : void 0,
|
|
2432
|
+
"aria-expanded": expandable ? expanded : void 0,
|
|
2433
|
+
className: cn(
|
|
2434
|
+
"flex h-8 w-full cursor-pointer items-center gap-2 rounded-md px-2 text-left text-body-small text-surface-foreground outline-offset-2 transition-colors disabled:pointer-events-none disabled:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
2435
|
+
// Selected (Figma): the secondary fill with overlay-dark-5 over it.
|
|
2436
|
+
selected ? "bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5" : "hover:bg-accent-soft hover:text-accent-soft-foreground",
|
|
2437
|
+
className
|
|
2438
|
+
),
|
|
2439
|
+
...props,
|
|
2440
|
+
children: [
|
|
2441
|
+
/* @__PURE__ */ jsx37("span", { "aria-hidden": "true", className: "flex size-4 shrink-0 items-center justify-center [&>svg]:size-4", children: icon }),
|
|
2442
|
+
/* @__PURE__ */ jsx37("span", { className: "min-w-0 flex-1 truncate", children: label }),
|
|
2443
|
+
expandable && /* @__PURE__ */ jsx37(CaretDown4, { "aria-hidden": "true", className: cn("transition-transform", expanded && "rotate-180") })
|
|
2444
|
+
]
|
|
2445
|
+
}
|
|
2446
|
+
) })
|
|
2447
|
+
);
|
|
2448
|
+
SidebarNavItem.displayName = "SidebarNavItem";
|
|
2449
|
+
|
|
2450
|
+
// src/components/Overlays & Feedback/Dialog.tsx
|
|
2451
|
+
import * as React37 from "react";
|
|
2398
2452
|
import { X as X3 } from "@phosphor-icons/react";
|
|
2399
2453
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
2400
|
-
import { jsx as
|
|
2454
|
+
import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2401
2455
|
var Dialog = DialogPrimitive.Root;
|
|
2402
2456
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
2403
2457
|
var DialogClose = DialogPrimitive.Close;
|
|
2404
|
-
var DialogContent =
|
|
2405
|
-
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2458
|
+
var DialogContent = React37.forwardRef(
|
|
2459
|
+
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */ jsxs28(DialogPrimitive.Portal, { children: [
|
|
2460
|
+
/* @__PURE__ */ jsx38(
|
|
2407
2461
|
DialogPrimitive.Overlay,
|
|
2408
2462
|
{
|
|
2409
2463
|
style: { zIndex: "var(--sys-z-30)" },
|
|
2410
2464
|
className: "fixed inset-0 bg-primary/30"
|
|
2411
2465
|
}
|
|
2412
2466
|
),
|
|
2413
|
-
/* @__PURE__ */
|
|
2467
|
+
/* @__PURE__ */ jsxs28(
|
|
2414
2468
|
DialogPrimitive.Content,
|
|
2415
2469
|
{
|
|
2416
2470
|
ref,
|
|
@@ -2422,15 +2476,15 @@ var DialogContent = React35.forwardRef(
|
|
|
2422
2476
|
...props,
|
|
2423
2477
|
children: [
|
|
2424
2478
|
children,
|
|
2425
|
-
!hideClose && /* @__PURE__ */
|
|
2479
|
+
!hideClose && /* @__PURE__ */ jsx38(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx38(Button, { variant: "ghost", size: "icon-sm", "aria-label": closeLabel, className: "absolute top-4 right-6", children: /* @__PURE__ */ jsx38(X3, { size: 16, "aria-hidden": true }) }) })
|
|
2426
2480
|
]
|
|
2427
2481
|
}
|
|
2428
2482
|
)
|
|
2429
2483
|
] })
|
|
2430
2484
|
);
|
|
2431
2485
|
DialogContent.displayName = "DialogContent";
|
|
2432
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
2433
|
-
var DialogTitle =
|
|
2486
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx38("div", { className: cn("flex flex-col gap-1.5 border-b border-border px-6 py-4 pr-16", className), ...props });
|
|
2487
|
+
var DialogTitle = React37.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
2434
2488
|
DialogPrimitive.Title,
|
|
2435
2489
|
{
|
|
2436
2490
|
ref,
|
|
@@ -2439,7 +2493,7 @@ var DialogTitle = React35.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2439
2493
|
}
|
|
2440
2494
|
));
|
|
2441
2495
|
DialogTitle.displayName = "DialogTitle";
|
|
2442
|
-
var DialogDescription =
|
|
2496
|
+
var DialogDescription = React37.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
2443
2497
|
DialogPrimitive.Description,
|
|
2444
2498
|
{
|
|
2445
2499
|
ref,
|
|
@@ -2448,15 +2502,15 @@ var DialogDescription = React35.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2448
2502
|
}
|
|
2449
2503
|
));
|
|
2450
2504
|
DialogDescription.displayName = "DialogDescription";
|
|
2451
|
-
var DialogBody = ({ className, ...props }) => /* @__PURE__ */
|
|
2452
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
2505
|
+
var DialogBody = ({ className, ...props }) => /* @__PURE__ */ jsx38("div", { className: cn("flex flex-col gap-4 p-6", className), ...props });
|
|
2506
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx38("div", { className: cn("flex items-center justify-end gap-3 border-t border-border px-6 py-4", className), ...props });
|
|
2453
2507
|
|
|
2454
2508
|
// src/components/Overlays & Feedback/Toast.tsx
|
|
2455
|
-
import * as
|
|
2509
|
+
import * as React38 from "react";
|
|
2456
2510
|
import { CheckCircle as CheckCircle3, Info, Warning, WarningCircle as WarningCircle4, X as X4 } from "@phosphor-icons/react";
|
|
2457
2511
|
import { cva as cva4 } from "class-variance-authority";
|
|
2458
2512
|
import { Toast as ToastPrimitive } from "radix-ui";
|
|
2459
|
-
import { Fragment as Fragment7, jsx as
|
|
2513
|
+
import { Fragment as Fragment7, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2460
2514
|
var toastVariants = cva4("border", {
|
|
2461
2515
|
variants: {
|
|
2462
2516
|
variant: {
|
|
@@ -2494,13 +2548,13 @@ var titleColour = {
|
|
|
2494
2548
|
};
|
|
2495
2549
|
function VariantIcon({ variant, size }) {
|
|
2496
2550
|
const props = { size, "aria-hidden": true, className: cn("shrink-0", iconColour[variant]) };
|
|
2497
|
-
if (variant === "success") return /* @__PURE__ */
|
|
2498
|
-
if (variant === "warning") return /* @__PURE__ */
|
|
2499
|
-
if (variant === "destructive") return /* @__PURE__ */
|
|
2500
|
-
return /* @__PURE__ */
|
|
2551
|
+
if (variant === "success") return /* @__PURE__ */ jsx39(CheckCircle3, { ...props });
|
|
2552
|
+
if (variant === "warning") return /* @__PURE__ */ jsx39(Warning, { ...props });
|
|
2553
|
+
if (variant === "destructive") return /* @__PURE__ */ jsx39(WarningCircle4, { ...props });
|
|
2554
|
+
return /* @__PURE__ */ jsx39(Info, { ...props });
|
|
2501
2555
|
}
|
|
2502
2556
|
var ToastProvider = ToastPrimitive.Provider;
|
|
2503
|
-
var ToastViewport =
|
|
2557
|
+
var ToastViewport = React38.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
2504
2558
|
ToastPrimitive.Viewport,
|
|
2505
2559
|
{
|
|
2506
2560
|
ref,
|
|
@@ -2510,10 +2564,10 @@ var ToastViewport = React36.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2510
2564
|
}
|
|
2511
2565
|
));
|
|
2512
2566
|
ToastViewport.displayName = "ToastViewport";
|
|
2513
|
-
var Toast =
|
|
2567
|
+
var Toast = React38.forwardRef(
|
|
2514
2568
|
({ className, variant = "info", title, description, action, closeLabel = "Close", children, ...props }, ref) => {
|
|
2515
2569
|
const v = variant ?? "info";
|
|
2516
|
-
return /* @__PURE__ */
|
|
2570
|
+
return /* @__PURE__ */ jsxs29(
|
|
2517
2571
|
ToastPrimitive.Root,
|
|
2518
2572
|
{
|
|
2519
2573
|
ref,
|
|
@@ -2521,19 +2575,19 @@ var Toast = React36.forwardRef(
|
|
|
2521
2575
|
className: cn("flex items-start gap-3 rounded-lg p-4 shadow-lg", toastVariants({ variant: v }), className),
|
|
2522
2576
|
...props,
|
|
2523
2577
|
children: [
|
|
2524
|
-
/* @__PURE__ */
|
|
2525
|
-
/* @__PURE__ */
|
|
2526
|
-
title != null && /* @__PURE__ */
|
|
2527
|
-
description != null && /* @__PURE__ */
|
|
2578
|
+
/* @__PURE__ */ jsx39(VariantIcon, { variant: v, size: 20 }),
|
|
2579
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 flex-1 flex-col gap-1 text-body-small", children: [
|
|
2580
|
+
title != null && /* @__PURE__ */ jsx39(ToastPrimitive.Title, { className: cn("font-semibold", titleColour[v]), children: title }),
|
|
2581
|
+
description != null && /* @__PURE__ */ jsx39(ToastPrimitive.Description, { className: "text-secondary-muted-foreground", children: description }),
|
|
2528
2582
|
children,
|
|
2529
2583
|
action
|
|
2530
2584
|
] }),
|
|
2531
|
-
/* @__PURE__ */
|
|
2585
|
+
/* @__PURE__ */ jsx39(
|
|
2532
2586
|
ToastPrimitive.Close,
|
|
2533
2587
|
{
|
|
2534
2588
|
"aria-label": closeLabel,
|
|
2535
2589
|
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-xs text-surface-foreground",
|
|
2536
|
-
children: /* @__PURE__ */
|
|
2590
|
+
children: /* @__PURE__ */ jsx39(X4, { size: 16, "aria-hidden": true })
|
|
2537
2591
|
}
|
|
2538
2592
|
)
|
|
2539
2593
|
]
|
|
@@ -2543,11 +2597,11 @@ var Toast = React36.forwardRef(
|
|
|
2543
2597
|
);
|
|
2544
2598
|
Toast.displayName = "Toast";
|
|
2545
2599
|
var ToastAction = ToastPrimitive.Action;
|
|
2546
|
-
var ToastInline =
|
|
2600
|
+
var ToastInline = React38.forwardRef(
|
|
2547
2601
|
({ className, variant = "info", actions, actionsPlacement = "end", onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2548
2602
|
const v = variant ?? "info";
|
|
2549
2603
|
const below = actionsPlacement === "bottom" && !!actions;
|
|
2550
|
-
return /* @__PURE__ */
|
|
2604
|
+
return /* @__PURE__ */ jsxs29(
|
|
2551
2605
|
"div",
|
|
2552
2606
|
{
|
|
2553
2607
|
ref,
|
|
@@ -2555,15 +2609,15 @@ var ToastInline = React36.forwardRef(
|
|
|
2555
2609
|
className: cn("flex gap-2 rounded-sm px-2 py-1.5", below ? "items-start" : "items-center", inlineVariants({ variant: v }), className),
|
|
2556
2610
|
...props,
|
|
2557
2611
|
children: [
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
-
below ? /* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
] }) : /* @__PURE__ */
|
|
2563
|
-
/* @__PURE__ */
|
|
2564
|
-
actions && /* @__PURE__ */
|
|
2612
|
+
/* @__PURE__ */ jsx39("span", { className: cn("inline-flex shrink-0", below && "mt-0.5"), children: /* @__PURE__ */ jsx39(VariantIcon, { variant: v === "neutral" ? "info" : v, size: 16 }) }),
|
|
2613
|
+
below ? /* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2614
|
+
/* @__PURE__ */ jsx39("p", { className: "text-body-small text-secondary-muted-foreground", children }),
|
|
2615
|
+
/* @__PURE__ */ jsx39("div", { className: "flex items-center gap-2", children: actions })
|
|
2616
|
+
] }) : /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
2617
|
+
/* @__PURE__ */ jsx39("p", { className: "min-w-0 flex-1 text-body-small text-secondary-muted-foreground", children }),
|
|
2618
|
+
actions && /* @__PURE__ */ jsx39("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
2565
2619
|
] }),
|
|
2566
|
-
onClose && /* @__PURE__ */
|
|
2620
|
+
onClose && /* @__PURE__ */ jsx39(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx39(X4, { size: 16, "aria-hidden": true }) })
|
|
2567
2621
|
]
|
|
2568
2622
|
}
|
|
2569
2623
|
);
|
|
@@ -2572,16 +2626,16 @@ var ToastInline = React36.forwardRef(
|
|
|
2572
2626
|
ToastInline.displayName = "ToastInline";
|
|
2573
2627
|
|
|
2574
2628
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
2575
|
-
import * as
|
|
2629
|
+
import * as React39 from "react";
|
|
2576
2630
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2577
|
-
import { Fragment as Fragment8, jsx as
|
|
2631
|
+
import { Fragment as Fragment8, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2578
2632
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
2579
2633
|
var Tooltip = TooltipPrimitive.Root;
|
|
2580
2634
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
2581
|
-
var TooltipContent =
|
|
2635
|
+
var TooltipContent = React39.forwardRef(
|
|
2582
2636
|
({ className, sideOffset = 4, title, description, action, arrow = true, children, ...props }, ref) => {
|
|
2583
2637
|
const detailed = title != null || description != null;
|
|
2584
|
-
return /* @__PURE__ */
|
|
2638
|
+
return /* @__PURE__ */ jsx40(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs30(
|
|
2585
2639
|
TooltipPrimitive.Content,
|
|
2586
2640
|
{
|
|
2587
2641
|
ref,
|
|
@@ -2595,12 +2649,12 @@ var TooltipContent = React37.forwardRef(
|
|
|
2595
2649
|
),
|
|
2596
2650
|
...props,
|
|
2597
2651
|
children: [
|
|
2598
|
-
detailed ? /* @__PURE__ */
|
|
2599
|
-
title != null && /* @__PURE__ */
|
|
2600
|
-
description != null && /* @__PURE__ */
|
|
2601
|
-
action != null && /* @__PURE__ */
|
|
2652
|
+
detailed ? /* @__PURE__ */ jsxs30(Fragment8, { children: [
|
|
2653
|
+
title != null && /* @__PURE__ */ jsx40("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2654
|
+
description != null && /* @__PURE__ */ jsx40("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2655
|
+
action != null && /* @__PURE__ */ jsx40("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
2602
2656
|
] }) : children,
|
|
2603
|
-
arrow && /* @__PURE__ */
|
|
2657
|
+
arrow && /* @__PURE__ */ jsx40(TooltipPrimitive.Arrow, { width: 12, height: 8, className: "fill-primary-soft-foreground" })
|
|
2604
2658
|
]
|
|
2605
2659
|
}
|
|
2606
2660
|
) });
|
|
@@ -2609,14 +2663,14 @@ var TooltipContent = React37.forwardRef(
|
|
|
2609
2663
|
TooltipContent.displayName = "TooltipContent";
|
|
2610
2664
|
|
|
2611
2665
|
// src/components/Question Types/FileUpload.tsx
|
|
2612
|
-
import * as
|
|
2666
|
+
import * as React41 from "react";
|
|
2613
2667
|
import { FileText, X as X5 } from "@phosphor-icons/react";
|
|
2614
2668
|
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
2615
2669
|
|
|
2616
2670
|
// src/components/Tags & Badges/Tag.tsx
|
|
2617
|
-
import * as
|
|
2671
|
+
import * as React40 from "react";
|
|
2618
2672
|
import { cva as cva5 } from "class-variance-authority";
|
|
2619
|
-
import { jsx as
|
|
2673
|
+
import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2620
2674
|
var tagVariants = cva5(
|
|
2621
2675
|
"inline-flex items-center gap-1.5 whitespace-nowrap rounded-sm border px-2.5 py-1 text-ui-caption",
|
|
2622
2676
|
{
|
|
@@ -2632,7 +2686,7 @@ var tagVariants = cva5(
|
|
|
2632
2686
|
defaultVariants: { variant: "neutral" }
|
|
2633
2687
|
}
|
|
2634
2688
|
);
|
|
2635
|
-
var Tag =
|
|
2689
|
+
var Tag = React40.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx41("span", { ref, className: cn(tagVariants({ variant }), className), ...props }));
|
|
2636
2690
|
Tag.displayName = "Tag";
|
|
2637
2691
|
var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
2638
2692
|
variants: {
|
|
@@ -2645,20 +2699,20 @@ var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
|
2645
2699
|
},
|
|
2646
2700
|
defaultVariants: { status: "active" }
|
|
2647
2701
|
});
|
|
2648
|
-
var StatusTag =
|
|
2649
|
-
({ className, status, children, ...props }, ref) => /* @__PURE__ */
|
|
2650
|
-
/* @__PURE__ */
|
|
2702
|
+
var StatusTag = React40.forwardRef(
|
|
2703
|
+
({ className, status, children, ...props }, ref) => /* @__PURE__ */ jsxs31("span", { ref, className: cn(tagVariants({ variant: "default" }), className), ...props, children: [
|
|
2704
|
+
/* @__PURE__ */ jsx41("span", { className: statusDotVariants({ status }), "aria-hidden": "true" }),
|
|
2651
2705
|
children
|
|
2652
2706
|
] })
|
|
2653
2707
|
);
|
|
2654
2708
|
StatusTag.displayName = "StatusTag";
|
|
2655
2709
|
|
|
2656
2710
|
// src/components/Question Types/FileUpload.tsx
|
|
2657
|
-
import { Fragment as Fragment9, jsx as
|
|
2658
|
-
var FileUploadZone =
|
|
2711
|
+
import { Fragment as Fragment9, jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2712
|
+
var FileUploadZone = React41.forwardRef(
|
|
2659
2713
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2660
|
-
const [over, setOver] =
|
|
2661
|
-
return /* @__PURE__ */
|
|
2714
|
+
const [over, setOver] = React41.useState(false);
|
|
2715
|
+
return /* @__PURE__ */ jsxs32(
|
|
2662
2716
|
"label",
|
|
2663
2717
|
{
|
|
2664
2718
|
className: cn(
|
|
@@ -2678,12 +2732,12 @@ var FileUploadZone = React39.forwardRef(
|
|
|
2678
2732
|
onFiles?.(Array.from(event.dataTransfer.files));
|
|
2679
2733
|
},
|
|
2680
2734
|
children: [
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
/* @__PURE__ */
|
|
2684
|
-
hint && /* @__PURE__ */
|
|
2735
|
+
/* @__PURE__ */ jsx42("span", { className: "flex size-10 items-center justify-center rounded-full bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground", children: icon ?? /* @__PURE__ */ jsx42(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2736
|
+
/* @__PURE__ */ jsxs32("span", { className: "flex flex-col gap-1", children: [
|
|
2737
|
+
/* @__PURE__ */ jsx42("span", { className: "text-body-small text-surface-foreground", children: title }),
|
|
2738
|
+
hint && /* @__PURE__ */ jsx42("span", { className: "text-ui-caption text-secondary-muted-foreground", children: hint })
|
|
2685
2739
|
] }),
|
|
2686
|
-
/* @__PURE__ */
|
|
2740
|
+
/* @__PURE__ */ jsx42(
|
|
2687
2741
|
"input",
|
|
2688
2742
|
{
|
|
2689
2743
|
ref,
|
|
@@ -2699,47 +2753,47 @@ var FileUploadZone = React39.forwardRef(
|
|
|
2699
2753
|
}
|
|
2700
2754
|
);
|
|
2701
2755
|
FileUploadZone.displayName = "FileUploadZone";
|
|
2702
|
-
var FileUploadItem =
|
|
2756
|
+
var FileUploadItem = React41.forwardRef(
|
|
2703
2757
|
({ className, name, size, status = "uploading", progress = 0, timeLeft, icon, onRemove, removeLabel, ...props }, ref) => {
|
|
2704
2758
|
const uploading = status === "uploading";
|
|
2705
|
-
return /* @__PURE__ */
|
|
2759
|
+
return /* @__PURE__ */ jsxs32(
|
|
2706
2760
|
"div",
|
|
2707
2761
|
{
|
|
2708
2762
|
ref,
|
|
2709
2763
|
className: cn("flex w-full flex-col justify-center gap-2 overflow-hidden rounded-sm border border-border p-2", className),
|
|
2710
2764
|
...props,
|
|
2711
2765
|
children: [
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
onRemove && /* @__PURE__ */
|
|
2766
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-2", children: [
|
|
2767
|
+
/* @__PURE__ */ jsx42("span", { className: "flex size-10 shrink-0 items-center justify-center rounded-full bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground", children: icon ?? /* @__PURE__ */ jsx42(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2768
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2769
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2770
|
+
/* @__PURE__ */ jsx42("p", { className: "min-w-0 truncate text-ui-label text-surface-foreground", children: name }),
|
|
2771
|
+
onRemove && /* @__PURE__ */ jsx42(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx42(X5, { size: 16, "aria-hidden": true }) })
|
|
2718
2772
|
] }),
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
2773
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2774
|
+
/* @__PURE__ */ jsxs32("span", { className: "flex items-center gap-2", children: [
|
|
2721
2775
|
size,
|
|
2722
|
-
status === "complete" && /* @__PURE__ */
|
|
2723
|
-
status === "error" && /* @__PURE__ */
|
|
2724
|
-
uploading && timeLeft && /* @__PURE__ */
|
|
2725
|
-
/* @__PURE__ */
|
|
2776
|
+
status === "complete" && /* @__PURE__ */ jsx42(Tag, { variant: "success", children: "Complete" }),
|
|
2777
|
+
status === "error" && /* @__PURE__ */ jsx42(Tag, { variant: "destructive", children: "Error" }),
|
|
2778
|
+
uploading && timeLeft && /* @__PURE__ */ jsxs32(Fragment9, { children: [
|
|
2779
|
+
/* @__PURE__ */ jsx42("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2726
2780
|
timeLeft
|
|
2727
2781
|
] })
|
|
2728
2782
|
] }),
|
|
2729
|
-
uploading && /* @__PURE__ */
|
|
2783
|
+
uploading && /* @__PURE__ */ jsxs32("span", { className: "text-body-xxs font-normal", children: [
|
|
2730
2784
|
Math.round(progress),
|
|
2731
2785
|
"%"
|
|
2732
2786
|
] })
|
|
2733
2787
|
] })
|
|
2734
2788
|
] })
|
|
2735
2789
|
] }),
|
|
2736
|
-
uploading && /* @__PURE__ */
|
|
2790
|
+
uploading && /* @__PURE__ */ jsx42(
|
|
2737
2791
|
ProgressPrimitive.Root,
|
|
2738
2792
|
{
|
|
2739
2793
|
value: progress,
|
|
2740
2794
|
"aria-label": `Uploading ${name}`,
|
|
2741
2795
|
className: "h-0.75 w-full overflow-hidden rounded-sm bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5",
|
|
2742
|
-
children: /* @__PURE__ */
|
|
2796
|
+
children: /* @__PURE__ */ jsx42(ProgressPrimitive.Indicator, { className: "h-full bg-accent transition-[width]", style: { width: `${progress}%` } })
|
|
2743
2797
|
}
|
|
2744
2798
|
)
|
|
2745
2799
|
]
|
|
@@ -2750,25 +2804,28 @@ var FileUploadItem = React39.forwardRef(
|
|
|
2750
2804
|
FileUploadItem.displayName = "FileUploadItem";
|
|
2751
2805
|
|
|
2752
2806
|
// src/components/Question Types/Media.tsx
|
|
2753
|
-
import * as
|
|
2754
|
-
import { CornersOut, DotsThree, Image as ImageIcon, Pause, Play, SpeakerSimpleHigh, SpeakerSimpleX, Trash as Trash3 } from "@phosphor-icons/react";
|
|
2807
|
+
import * as React42 from "react";
|
|
2808
|
+
import { CornersOut, DotsThree, DotsThreeVertical, Image as ImageIcon, Pause, Play, SpeakerSimpleHigh, SpeakerSimpleX, Trash as Trash3 } from "@phosphor-icons/react";
|
|
2755
2809
|
import { Slider as SliderPrimitive2, ToggleGroup as ToggleGroupPrimitive2 } from "radix-ui";
|
|
2756
|
-
import { jsx as
|
|
2757
|
-
function MediaInfo({ name, details, onRemove, removeLabel, large, className, ...props }) {
|
|
2758
|
-
return /* @__PURE__ */
|
|
2759
|
-
/* @__PURE__ */
|
|
2760
|
-
/* @__PURE__ */
|
|
2761
|
-
|
|
2762
|
-
|
|
2810
|
+
import { jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2811
|
+
function MediaInfo({ name, details, onRemove, removeLabel, large, actions, className, ...props }) {
|
|
2812
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("flex items-center justify-between border-t border-border bg-surface px-6 py-4", className), ...props, children: [
|
|
2813
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2814
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2815
|
+
/* @__PURE__ */ jsx43("p", { className: cn("min-w-0 flex-1 truncate text-surface-foreground", large ? "text-body-section" : "text-ui-label"), children: name }),
|
|
2816
|
+
actions
|
|
2817
|
+
] }),
|
|
2818
|
+
details && /* @__PURE__ */ jsx43("p", { className: cn("flex items-center gap-2 text-secondary-muted-foreground", large ? "text-body-small" : "text-ui-caption"), children: details.map((part, index) => /* @__PURE__ */ jsxs33(React42.Fragment, { children: [
|
|
2819
|
+
index > 0 && /* @__PURE__ */ jsx43("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2763
2820
|
part
|
|
2764
2821
|
] }, part)) })
|
|
2765
2822
|
] }),
|
|
2766
|
-
onRemove && /* @__PURE__ */
|
|
2823
|
+
onRemove && /* @__PURE__ */ jsx43(Button, { type: "button", variant: "destructive", size: "icon", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx43(Trash3, { size: 16, "aria-hidden": true }) })
|
|
2767
2824
|
] });
|
|
2768
2825
|
}
|
|
2769
|
-
var ImagePreview =
|
|
2770
|
-
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */
|
|
2771
|
-
/* @__PURE__ */
|
|
2826
|
+
var ImagePreview = React42.forwardRef(
|
|
2827
|
+
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */ jsxs33("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border", className), ...props, children: [
|
|
2828
|
+
/* @__PURE__ */ jsx43(
|
|
2772
2829
|
"div",
|
|
2773
2830
|
{
|
|
2774
2831
|
className: cn(
|
|
@@ -2779,12 +2836,12 @@ var ImagePreview = React40.forwardRef(
|
|
|
2779
2836
|
children
|
|
2780
2837
|
}
|
|
2781
2838
|
),
|
|
2782
|
-
/* @__PURE__ */
|
|
2839
|
+
/* @__PURE__ */ jsx43(MediaInfo, { name, details, onRemove, large: true })
|
|
2783
2840
|
] })
|
|
2784
2841
|
);
|
|
2785
2842
|
ImagePreview.displayName = "ImagePreview";
|
|
2786
|
-
var ImageThumbnails =
|
|
2787
|
-
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */
|
|
2843
|
+
var ImageThumbnails = React42.forwardRef(
|
|
2844
|
+
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ jsx43(
|
|
2788
2845
|
ToggleGroupPrimitive2.Root,
|
|
2789
2846
|
{
|
|
2790
2847
|
ref,
|
|
@@ -2796,17 +2853,17 @@ var ImageThumbnails = React40.forwardRef(
|
|
|
2796
2853
|
children: Array.from({ length: max }, (_, index) => {
|
|
2797
2854
|
const image = images[index];
|
|
2798
2855
|
if (!image) {
|
|
2799
|
-
return /* @__PURE__ */
|
|
2856
|
+
return /* @__PURE__ */ jsx43(
|
|
2800
2857
|
"span",
|
|
2801
2858
|
{
|
|
2802
2859
|
"aria-hidden": "true",
|
|
2803
2860
|
className: "flex h-20 min-w-0 flex-1 items-center justify-center rounded-sm border border-dashed border-border text-accent-foreground",
|
|
2804
|
-
children: /* @__PURE__ */
|
|
2861
|
+
children: /* @__PURE__ */ jsx43(ImageIcon, { size: 24 })
|
|
2805
2862
|
},
|
|
2806
2863
|
`empty-${index}`
|
|
2807
2864
|
);
|
|
2808
2865
|
}
|
|
2809
|
-
return /* @__PURE__ */
|
|
2866
|
+
return /* @__PURE__ */ jsx43(
|
|
2810
2867
|
ToggleGroupPrimitive2.Item,
|
|
2811
2868
|
{
|
|
2812
2869
|
value: image.id,
|
|
@@ -2816,7 +2873,7 @@ var ImageThumbnails = React40.forwardRef(
|
|
|
2816
2873
|
"hover:bg-accent-soft hover:bg-none",
|
|
2817
2874
|
"data-[state=on]:border-accent-foreground data-[state=on]:bg-accent-soft data-[state=on]:bg-none data-[state=on]:text-accent-foreground"
|
|
2818
2875
|
),
|
|
2819
|
-
children: image.src ? /* @__PURE__ */
|
|
2876
|
+
children: image.src ? /* @__PURE__ */ jsx43("img", { src: image.src, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx43(ImageIcon, { size: 24, "aria-hidden": true })
|
|
2820
2877
|
},
|
|
2821
2878
|
image.id
|
|
2822
2879
|
);
|
|
@@ -2829,13 +2886,13 @@ var formatTime = (seconds) => {
|
|
|
2829
2886
|
const total = Math.max(0, Math.floor(Number.isFinite(seconds) ? seconds : 0));
|
|
2830
2887
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
2831
2888
|
};
|
|
2832
|
-
var VideoPlayer =
|
|
2833
|
-
({ className, src, name, details, onRemove, onMore, initialTime = 0, initialDuration = 0, ...props }, ref) => {
|
|
2834
|
-
const video =
|
|
2835
|
-
const [playing, setPlaying] =
|
|
2836
|
-
const [time, setTime] =
|
|
2837
|
-
const [duration, setDuration] =
|
|
2838
|
-
const [volume, setVolume] =
|
|
2889
|
+
var VideoPlayer = React42.forwardRef(
|
|
2890
|
+
({ className, src, name, details, onRemove, onMore, initialTime = 0, initialDuration = 0, controls = "always", moreIn = "controls", badge, ...props }, ref) => {
|
|
2891
|
+
const video = React42.useRef(null);
|
|
2892
|
+
const [playing, setPlaying] = React42.useState(false);
|
|
2893
|
+
const [time, setTime] = React42.useState(initialTime);
|
|
2894
|
+
const [duration, setDuration] = React42.useState(initialDuration);
|
|
2895
|
+
const [volume, setVolume] = React42.useState(1);
|
|
2839
2896
|
const muted = volume === 0;
|
|
2840
2897
|
const toggle2 = () => {
|
|
2841
2898
|
const el = video.current;
|
|
@@ -2843,9 +2900,9 @@ var VideoPlayer = React40.forwardRef(
|
|
|
2843
2900
|
if (el.paused) void el.play();
|
|
2844
2901
|
else el.pause();
|
|
2845
2902
|
};
|
|
2846
|
-
return /* @__PURE__ */
|
|
2847
|
-
/* @__PURE__ */
|
|
2848
|
-
src && /* @__PURE__ */
|
|
2903
|
+
return /* @__PURE__ */ jsxs33("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface", className), ...props, children: [
|
|
2904
|
+
/* @__PURE__ */ jsxs33("div", { className: "group/player relative flex h-60.5 w-full items-end bg-accent-soft", children: [
|
|
2905
|
+
src && /* @__PURE__ */ jsx43(
|
|
2849
2906
|
"video",
|
|
2850
2907
|
{
|
|
2851
2908
|
ref: video,
|
|
@@ -2858,93 +2915,111 @@ var VideoPlayer = React40.forwardRef(
|
|
|
2858
2915
|
onVolumeChange: (event) => setVolume(event.currentTarget.muted ? 0 : event.currentTarget.volume)
|
|
2859
2916
|
}
|
|
2860
2917
|
),
|
|
2861
|
-
/* @__PURE__ */
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
if (video.current) video.current.currentTime = next;
|
|
2873
|
-
},
|
|
2874
|
-
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
2875
|
-
children: [
|
|
2876
|
-
/* @__PURE__ */ jsx41(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx41(SliderPrimitive2.Range, { className: "absolute h-full bg-accent-foreground" }) }),
|
|
2877
|
-
/* @__PURE__ */ jsx41(SliderPrimitive2.Thumb, { "aria-label": "Seek", className: "block size-3 rounded-full border-2 border-surface bg-surface shadow-sm" })
|
|
2878
|
-
]
|
|
2879
|
-
}
|
|
2880
|
-
),
|
|
2881
|
-
/* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
|
|
2882
|
-
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-4", children: [
|
|
2883
|
-
/* @__PURE__ */ jsx41(
|
|
2884
|
-
"button",
|
|
2918
|
+
badge && /* @__PURE__ */ jsx43("div", { className: "absolute top-3 left-3", children: badge }),
|
|
2919
|
+
/* @__PURE__ */ jsxs33(
|
|
2920
|
+
"div",
|
|
2921
|
+
{
|
|
2922
|
+
className: cn(
|
|
2923
|
+
"relative flex w-full flex-col gap-2 bg-surface-foreground bg-linear-to-r from-primary/30 to-primary/30 px-4 pt-3 pb-4 text-surface",
|
|
2924
|
+
controls === "hover" && "opacity-0 transition-opacity group-focus-within/player:opacity-100 group-hover/player:opacity-100"
|
|
2925
|
+
),
|
|
2926
|
+
children: [
|
|
2927
|
+
/* @__PURE__ */ jsxs33(
|
|
2928
|
+
SliderPrimitive2.Root,
|
|
2885
2929
|
{
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2930
|
+
min: 0,
|
|
2931
|
+
max: duration || 1,
|
|
2932
|
+
step: 0.1,
|
|
2933
|
+
value: [Math.min(time, duration || 1)],
|
|
2934
|
+
onValueChange: ([next]) => {
|
|
2935
|
+
if (next === void 0) return;
|
|
2936
|
+
setTime(next);
|
|
2937
|
+
if (video.current) video.current.currentTime = next;
|
|
2938
|
+
},
|
|
2939
|
+
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
2940
|
+
children: [
|
|
2941
|
+
/* @__PURE__ */ jsx43(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx43(SliderPrimitive2.Range, { className: "absolute h-full bg-accent-foreground" }) }),
|
|
2942
|
+
/* @__PURE__ */ jsx43(SliderPrimitive2.Thumb, { "aria-label": "Seek", className: "block size-3 rounded-full border-2 border-surface bg-surface shadow-sm" })
|
|
2943
|
+
]
|
|
2891
2944
|
}
|
|
2892
2945
|
),
|
|
2893
|
-
/* @__PURE__ */
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
volume,
|
|
2904
|
-
onVolumeChange: (next) => {
|
|
2905
|
-
setVolume(next);
|
|
2906
|
-
if (video.current) {
|
|
2907
|
-
video.current.volume = next;
|
|
2908
|
-
video.current.muted = next === 0;
|
|
2946
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center justify-between", children: [
|
|
2947
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-4", children: [
|
|
2948
|
+
/* @__PURE__ */ jsx43(
|
|
2949
|
+
"button",
|
|
2950
|
+
{
|
|
2951
|
+
type: "button",
|
|
2952
|
+
"aria-label": playing ? "Pause" : "Play",
|
|
2953
|
+
onClick: toggle2,
|
|
2954
|
+
className: "inline-flex size-10 items-center justify-center rounded-full bg-surface/12 text-surface transition-colors hover:bg-surface/20",
|
|
2955
|
+
children: playing ? /* @__PURE__ */ jsx43(Pause, { size: 16, weight: "fill", "aria-hidden": true }) : /* @__PURE__ */ jsx43(Play, { size: 16, weight: "fill", "aria-hidden": true })
|
|
2909
2956
|
}
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2957
|
+
),
|
|
2958
|
+
/* @__PURE__ */ jsxs33("span", { className: "text-ui-label whitespace-nowrap text-surface/80", children: [
|
|
2959
|
+
formatTime(time),
|
|
2960
|
+
" / ",
|
|
2961
|
+
formatTime(duration)
|
|
2962
|
+
] })
|
|
2963
|
+
] }),
|
|
2964
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
|
|
2965
|
+
/* @__PURE__ */ jsx43(
|
|
2966
|
+
VolumeControl,
|
|
2967
|
+
{
|
|
2968
|
+
volume,
|
|
2969
|
+
onVolumeChange: (next) => {
|
|
2970
|
+
setVolume(next);
|
|
2971
|
+
if (video.current) {
|
|
2972
|
+
video.current.volume = next;
|
|
2973
|
+
video.current.muted = next === 0;
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
),
|
|
2978
|
+
/* @__PURE__ */ jsx43(
|
|
2979
|
+
"button",
|
|
2980
|
+
{
|
|
2981
|
+
type: "button",
|
|
2982
|
+
"aria-label": "Full screen",
|
|
2983
|
+
onClick: () => void video.current?.requestFullscreen?.(),
|
|
2984
|
+
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2985
|
+
children: /* @__PURE__ */ jsx43(CornersOut, { size: 16, "aria-hidden": true })
|
|
2986
|
+
}
|
|
2987
|
+
),
|
|
2988
|
+
moreIn === "controls" && /* @__PURE__ */ jsx43(
|
|
2989
|
+
"button",
|
|
2990
|
+
{
|
|
2991
|
+
type: "button",
|
|
2992
|
+
"aria-label": "More",
|
|
2993
|
+
onClick: onMore,
|
|
2994
|
+
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2995
|
+
children: /* @__PURE__ */ jsx43(DotsThree, { size: 16, "aria-hidden": true })
|
|
2996
|
+
}
|
|
2997
|
+
)
|
|
2998
|
+
] })
|
|
2999
|
+
] })
|
|
3000
|
+
]
|
|
3001
|
+
}
|
|
3002
|
+
)
|
|
2936
3003
|
] }),
|
|
2937
|
-
name && /* @__PURE__ */
|
|
2938
|
-
|
|
3004
|
+
name && /* @__PURE__ */ jsx43(
|
|
3005
|
+
MediaInfo,
|
|
3006
|
+
{
|
|
3007
|
+
name,
|
|
3008
|
+
details,
|
|
3009
|
+
onRemove,
|
|
3010
|
+
actions: moreIn === "info" && /* @__PURE__ */ jsx43(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "More", onClick: onMore, children: /* @__PURE__ */ jsx43(DotsThreeVertical, { size: 16, "aria-hidden": true }) })
|
|
3011
|
+
}
|
|
3012
|
+
),
|
|
3013
|
+
/* @__PURE__ */ jsx43("span", { className: "sr-only", "aria-live": "polite", children: muted ? "Muted" : "" })
|
|
2939
3014
|
] });
|
|
2940
3015
|
}
|
|
2941
3016
|
);
|
|
2942
3017
|
VideoPlayer.displayName = "VideoPlayer";
|
|
2943
3018
|
function VolumeControl({ volume, onVolumeChange, className }) {
|
|
2944
|
-
const last =
|
|
3019
|
+
const last = React42.useRef(volume || 1);
|
|
2945
3020
|
if (volume > 0) last.current = volume;
|
|
2946
|
-
return /* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
3021
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("group/volume flex items-center", className), children: [
|
|
3022
|
+
/* @__PURE__ */ jsx43("div", { className: "w-0 overflow-hidden opacity-0 transition-all group-focus-within/volume:w-16 group-focus-within/volume:opacity-100 group-hover/volume:w-16 group-hover/volume:opacity-100", children: /* @__PURE__ */ jsxs33(
|
|
2948
3023
|
SliderPrimitive2.Root,
|
|
2949
3024
|
{
|
|
2950
3025
|
min: 0,
|
|
@@ -2954,32 +3029,32 @@ function VolumeControl({ volume, onVolumeChange, className }) {
|
|
|
2954
3029
|
onValueChange: ([next]) => next !== void 0 && onVolumeChange(next),
|
|
2955
3030
|
className: "relative flex h-4 w-14 touch-none items-center select-none",
|
|
2956
3031
|
children: [
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsx43(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx43(SliderPrimitive2.Range, { className: "absolute h-full bg-surface" }) }),
|
|
3033
|
+
/* @__PURE__ */ jsx43(SliderPrimitive2.Thumb, { "aria-label": "Volume", className: "block size-3 rounded-full bg-surface shadow-sm" })
|
|
2959
3034
|
]
|
|
2960
3035
|
}
|
|
2961
3036
|
) }),
|
|
2962
|
-
/* @__PURE__ */
|
|
3037
|
+
/* @__PURE__ */ jsx43(
|
|
2963
3038
|
"button",
|
|
2964
3039
|
{
|
|
2965
3040
|
type: "button",
|
|
2966
3041
|
"aria-label": volume === 0 ? "Unmute" : "Mute",
|
|
2967
3042
|
onClick: () => onVolumeChange(volume === 0 ? last.current : 0),
|
|
2968
3043
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2969
|
-
children: volume === 0 ? /* @__PURE__ */
|
|
3044
|
+
children: volume === 0 ? /* @__PURE__ */ jsx43(SpeakerSimpleX, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx43(SpeakerSimpleHigh, { size: 16, "aria-hidden": true })
|
|
2970
3045
|
}
|
|
2971
3046
|
)
|
|
2972
3047
|
] });
|
|
2973
3048
|
}
|
|
2974
3049
|
|
|
2975
3050
|
// src/components/Question Types/OpenEndAnswer.tsx
|
|
2976
|
-
import * as
|
|
2977
|
-
import { jsx as
|
|
2978
|
-
var OpenEndAnswer =
|
|
3051
|
+
import * as React43 from "react";
|
|
3052
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
3053
|
+
var OpenEndAnswer = React43.forwardRef(
|
|
2979
3054
|
({ value, defaultValue, onChange, maxLength = 1e3, placeholder = "Write your answer", ...props }, ref) => {
|
|
2980
|
-
const [internal, setInternal] =
|
|
3055
|
+
const [internal, setInternal] = React43.useState(String(defaultValue ?? ""));
|
|
2981
3056
|
const text = value !== void 0 ? String(value) : internal;
|
|
2982
|
-
return /* @__PURE__ */
|
|
3057
|
+
return /* @__PURE__ */ jsx44(
|
|
2983
3058
|
Textarea,
|
|
2984
3059
|
{
|
|
2985
3060
|
ref,
|
|
@@ -2999,10 +3074,10 @@ var OpenEndAnswer = React41.forwardRef(
|
|
|
2999
3074
|
OpenEndAnswer.displayName = "OpenEndAnswer";
|
|
3000
3075
|
|
|
3001
3076
|
// src/components/Question Types/QuestionCard.tsx
|
|
3002
|
-
import * as
|
|
3003
|
-
import { jsx as
|
|
3004
|
-
var QuestionCard =
|
|
3005
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3077
|
+
import * as React44 from "react";
|
|
3078
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
3079
|
+
var QuestionCard = React44.forwardRef(
|
|
3080
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx45(
|
|
3006
3081
|
"div",
|
|
3007
3082
|
{
|
|
3008
3083
|
ref,
|
|
@@ -3014,7 +3089,7 @@ var QuestionCard = React42.forwardRef(
|
|
|
3014
3089
|
QuestionCard.displayName = "QuestionCard";
|
|
3015
3090
|
|
|
3016
3091
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3017
|
-
import * as
|
|
3092
|
+
import * as React48 from "react";
|
|
3018
3093
|
import {
|
|
3019
3094
|
Clipboard,
|
|
3020
3095
|
Copy,
|
|
@@ -3034,16 +3109,16 @@ function keepEditingFocus(event) {
|
|
|
3034
3109
|
}
|
|
3035
3110
|
|
|
3036
3111
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3037
|
-
import * as
|
|
3112
|
+
import * as React47 from "react";
|
|
3038
3113
|
|
|
3039
3114
|
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3040
|
-
import * as
|
|
3115
|
+
import * as React46 from "react";
|
|
3041
3116
|
import { DotsSixVertical } from "@phosphor-icons/react";
|
|
3042
3117
|
|
|
3043
3118
|
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
3044
3119
|
import "react";
|
|
3045
3120
|
import { ChatsCircle, CheckSquare, FileArrowUp, FileText as FileText2, Image, ListNumbers, RadioButton as RadioButton2, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
3046
|
-
import { jsx as
|
|
3121
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
3047
3122
|
var icons = {
|
|
3048
3123
|
"select-one": RadioButton2,
|
|
3049
3124
|
"select-multiple": CheckSquare,
|
|
@@ -3058,13 +3133,13 @@ var icons = {
|
|
|
3058
3133
|
};
|
|
3059
3134
|
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
3060
3135
|
const Icon = icons[type];
|
|
3061
|
-
return /* @__PURE__ */
|
|
3136
|
+
return /* @__PURE__ */ jsx46(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
3062
3137
|
}
|
|
3063
3138
|
|
|
3064
3139
|
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3065
|
-
import { jsx as
|
|
3066
|
-
var QuestionNumberTag =
|
|
3067
|
-
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */
|
|
3140
|
+
import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3141
|
+
var QuestionNumberTag = React46.forwardRef(
|
|
3142
|
+
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */ jsxs34(
|
|
3068
3143
|
"span",
|
|
3069
3144
|
{
|
|
3070
3145
|
ref,
|
|
@@ -3083,7 +3158,7 @@ var QuestionNumberTag = React44.forwardRef(
|
|
|
3083
3158
|
dragHandleProps?.className
|
|
3084
3159
|
),
|
|
3085
3160
|
children: [
|
|
3086
|
-
questionType && /* @__PURE__ */
|
|
3161
|
+
questionType && /* @__PURE__ */ jsx47(
|
|
3087
3162
|
QuestionTypeIcon,
|
|
3088
3163
|
{
|
|
3089
3164
|
type: questionType,
|
|
@@ -3091,7 +3166,7 @@ var QuestionNumberTag = React44.forwardRef(
|
|
|
3091
3166
|
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3092
3167
|
}
|
|
3093
3168
|
),
|
|
3094
|
-
showDragHandle && /* @__PURE__ */
|
|
3169
|
+
showDragHandle && /* @__PURE__ */ jsx47(
|
|
3095
3170
|
DotsSixVertical,
|
|
3096
3171
|
{
|
|
3097
3172
|
size: 16,
|
|
@@ -3108,30 +3183,30 @@ var QuestionNumberTag = React44.forwardRef(
|
|
|
3108
3183
|
QuestionNumberTag.displayName = "QuestionNumberTag";
|
|
3109
3184
|
|
|
3110
3185
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3111
|
-
import { jsx as
|
|
3186
|
+
import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3112
3187
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
3113
|
-
var QuestionHeader =
|
|
3188
|
+
var QuestionHeader = React47.forwardRef(
|
|
3114
3189
|
({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, titleRecommendedMax, titleRecommendedNote, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, questionType, titleMarks, onTitleMarkApply, onTitleMarkDismiss, titleEditing, ...props }, ref) => {
|
|
3115
|
-
const [draft, setDraft] =
|
|
3190
|
+
const [draft, setDraft] = React47.useState(null);
|
|
3116
3191
|
const label = String(number).padStart(2, "0");
|
|
3117
3192
|
const showError = error !== void 0 && error !== false;
|
|
3118
3193
|
if (editor) {
|
|
3119
3194
|
const text = typeof title === "string" ? title : "";
|
|
3120
3195
|
const count = (draft ?? text).length;
|
|
3121
3196
|
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
3122
|
-
return /* @__PURE__ */
|
|
3123
|
-
/* @__PURE__ */
|
|
3124
|
-
/* @__PURE__ */
|
|
3125
|
-
/* @__PURE__ */
|
|
3197
|
+
return /* @__PURE__ */ jsxs35("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
3198
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between", children: [
|
|
3199
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2", children: [
|
|
3200
|
+
/* @__PURE__ */ jsx48(QuestionNumberTag, { number, active, questionType, showDragHandle, dragHandleProps }),
|
|
3126
3201
|
meta
|
|
3127
3202
|
] }),
|
|
3128
|
-
actions && /* @__PURE__ */
|
|
3203
|
+
actions && /* @__PURE__ */ jsx48("div", { className: cn(
|
|
3129
3204
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
3130
3205
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
3131
3206
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
3132
3207
|
), children: actions })
|
|
3133
3208
|
] }),
|
|
3134
|
-
/* @__PURE__ */
|
|
3209
|
+
/* @__PURE__ */ jsx48(
|
|
3135
3210
|
InlineEdit,
|
|
3136
3211
|
{
|
|
3137
3212
|
variant: "question",
|
|
@@ -3157,8 +3232,8 @@ var QuestionHeader = React45.forwardRef(
|
|
|
3157
3232
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
3158
3233
|
}
|
|
3159
3234
|
),
|
|
3160
|
-
long && titleRecommendedNote != null && /* @__PURE__ */
|
|
3161
|
-
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */
|
|
3235
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ jsx48("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
3236
|
+
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs35("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3162
3237
|
count,
|
|
3163
3238
|
"/",
|
|
3164
3239
|
maxLength,
|
|
@@ -3166,16 +3241,16 @@ var QuestionHeader = React45.forwardRef(
|
|
|
3166
3241
|
] })
|
|
3167
3242
|
] });
|
|
3168
3243
|
}
|
|
3169
|
-
return /* @__PURE__ */
|
|
3170
|
-
showError && /* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3244
|
+
return /* @__PURE__ */ jsxs35("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3245
|
+
showError && /* @__PURE__ */ jsx48(ToastInline, { variant: "destructive", onClose: onDismissError, className: "min-h-10", children: /* @__PURE__ */ jsx48("span", { className: "text-ui-label text-destructive", children: error === true ? "This question is mandatory." : error }) }),
|
|
3246
|
+
/* @__PURE__ */ jsxs35("p", { className: eyebrow, children: [
|
|
3172
3247
|
"Question ",
|
|
3173
3248
|
label
|
|
3174
3249
|
] }),
|
|
3175
|
-
/* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ jsxs35("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
3176
3251
|
title,
|
|
3177
|
-
required && /* @__PURE__ */
|
|
3178
|
-
required && /* @__PURE__ */
|
|
3252
|
+
required && /* @__PURE__ */ jsx48("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
3253
|
+
required && /* @__PURE__ */ jsx48("span", { className: "sr-only", children: " (required)" })
|
|
3179
3254
|
] })
|
|
3180
3255
|
] });
|
|
3181
3256
|
}
|
|
@@ -3183,8 +3258,8 @@ var QuestionHeader = React45.forwardRef(
|
|
|
3183
3258
|
QuestionHeader.displayName = "QuestionHeader";
|
|
3184
3259
|
|
|
3185
3260
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3186
|
-
import { Fragment as Fragment11, jsx as
|
|
3187
|
-
var QuestionEditorCard =
|
|
3261
|
+
import { Fragment as Fragment11, jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3262
|
+
var QuestionEditorCard = React48.forwardRef(
|
|
3188
3263
|
({
|
|
3189
3264
|
className,
|
|
3190
3265
|
number,
|
|
@@ -3220,7 +3295,7 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3220
3295
|
...props
|
|
3221
3296
|
}, ref) => {
|
|
3222
3297
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
3223
|
-
return /* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ jsxs36(
|
|
3224
3299
|
"div",
|
|
3225
3300
|
{
|
|
3226
3301
|
ref,
|
|
@@ -3232,7 +3307,7 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3232
3307
|
props.onMouseDown?.(event);
|
|
3233
3308
|
},
|
|
3234
3309
|
children: [
|
|
3235
|
-
/* @__PURE__ */
|
|
3310
|
+
/* @__PURE__ */ jsxs36(
|
|
3236
3311
|
"div",
|
|
3237
3312
|
{
|
|
3238
3313
|
className: cn(
|
|
@@ -3240,9 +3315,9 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3240
3315
|
active ? "border-accent" : "border-border"
|
|
3241
3316
|
),
|
|
3242
3317
|
children: [
|
|
3243
|
-
/* @__PURE__ */
|
|
3244
|
-
/* @__PURE__ */
|
|
3245
|
-
/* @__PURE__ */
|
|
3318
|
+
/* @__PURE__ */ jsxs36("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
3319
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-4", children: [
|
|
3320
|
+
/* @__PURE__ */ jsx49(
|
|
3246
3321
|
QuestionHeader,
|
|
3247
3322
|
{
|
|
3248
3323
|
editor: true,
|
|
@@ -3265,8 +3340,8 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3265
3340
|
titleEditing,
|
|
3266
3341
|
meta,
|
|
3267
3342
|
maxLength,
|
|
3268
|
-
actions: actions ?? /* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3343
|
+
actions: actions ?? /* @__PURE__ */ jsxs36(Fragment11, { children: [
|
|
3344
|
+
/* @__PURE__ */ jsx49(
|
|
3270
3345
|
Button,
|
|
3271
3346
|
{
|
|
3272
3347
|
type: "button",
|
|
@@ -3274,10 +3349,10 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3274
3349
|
size: "icon-sm",
|
|
3275
3350
|
"aria-label": "Duplicate question",
|
|
3276
3351
|
onClick: onDuplicate,
|
|
3277
|
-
children: /* @__PURE__ */
|
|
3352
|
+
children: /* @__PURE__ */ jsx49(Copy, { size: 16, "aria-hidden": true })
|
|
3278
3353
|
}
|
|
3279
3354
|
),
|
|
3280
|
-
/* @__PURE__ */
|
|
3355
|
+
/* @__PURE__ */ jsx49(
|
|
3281
3356
|
Button,
|
|
3282
3357
|
{
|
|
3283
3358
|
type: "button",
|
|
@@ -3285,10 +3360,10 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3285
3360
|
size: "icon-sm",
|
|
3286
3361
|
"aria-label": "Delete question",
|
|
3287
3362
|
onClick: onDelete,
|
|
3288
|
-
children: /* @__PURE__ */
|
|
3363
|
+
children: /* @__PURE__ */ jsx49(Trash4, { size: 16, "aria-hidden": true })
|
|
3289
3364
|
}
|
|
3290
3365
|
),
|
|
3291
|
-
/* @__PURE__ */
|
|
3366
|
+
/* @__PURE__ */ jsx49(
|
|
3292
3367
|
Button,
|
|
3293
3368
|
{
|
|
3294
3369
|
type: "button",
|
|
@@ -3296,7 +3371,7 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3296
3371
|
size: "icon-sm",
|
|
3297
3372
|
"aria-label": "Preview question",
|
|
3298
3373
|
onClick: onPreview,
|
|
3299
|
-
children: /* @__PURE__ */
|
|
3374
|
+
children: /* @__PURE__ */ jsx49(Eye, { size: 16, "aria-hidden": true })
|
|
3300
3375
|
}
|
|
3301
3376
|
)
|
|
3302
3377
|
] })
|
|
@@ -3304,18 +3379,18 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3304
3379
|
),
|
|
3305
3380
|
children
|
|
3306
3381
|
] }),
|
|
3307
|
-
error && /* @__PURE__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
3382
|
+
error && /* @__PURE__ */ jsxs36("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3383
|
+
/* @__PURE__ */ jsx49(Warning2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3309
3384
|
error
|
|
3310
3385
|
] }),
|
|
3311
|
-
footer && /* @__PURE__ */
|
|
3312
|
-
/* @__PURE__ */
|
|
3313
|
-
/* @__PURE__ */
|
|
3314
|
-
onAdd && /* @__PURE__ */
|
|
3315
|
-
/* @__PURE__ */
|
|
3386
|
+
footer && /* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between", children: [
|
|
3387
|
+
/* @__PURE__ */ jsx49("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3388
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
3389
|
+
onAdd && /* @__PURE__ */ jsxs36(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3390
|
+
/* @__PURE__ */ jsx49(Plus3, { size: 16, "aria-hidden": true }),
|
|
3316
3391
|
"Add choice"
|
|
3317
3392
|
] }),
|
|
3318
|
-
onPaste && /* @__PURE__ */
|
|
3393
|
+
onPaste && /* @__PURE__ */ jsx49(
|
|
3319
3394
|
Button,
|
|
3320
3395
|
{
|
|
3321
3396
|
type: "button",
|
|
@@ -3323,17 +3398,17 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3323
3398
|
size: "icon",
|
|
3324
3399
|
"aria-label": "Paste choices",
|
|
3325
3400
|
onClick: onPaste,
|
|
3326
|
-
children: /* @__PURE__ */
|
|
3401
|
+
children: /* @__PURE__ */ jsx49(Clipboard, { size: 16, "aria-hidden": true })
|
|
3327
3402
|
}
|
|
3328
3403
|
)
|
|
3329
3404
|
] })
|
|
3330
3405
|
] })
|
|
3331
3406
|
] }),
|
|
3332
|
-
note && /* @__PURE__ */
|
|
3407
|
+
note && /* @__PURE__ */ jsx49("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
3333
3408
|
]
|
|
3334
3409
|
}
|
|
3335
3410
|
),
|
|
3336
|
-
onAskAi && /* @__PURE__ */
|
|
3411
|
+
onAskAi && /* @__PURE__ */ jsx49(
|
|
3337
3412
|
Button,
|
|
3338
3413
|
{
|
|
3339
3414
|
type: "button",
|
|
@@ -3342,7 +3417,7 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3342
3417
|
"aria-label": "Ask AI",
|
|
3343
3418
|
onClick: onAskAi,
|
|
3344
3419
|
className: "shrink-0 opacity-0 transition-opacity group-hover/editor:opacity-100 group-focus-within/editor:opacity-100 group-data-[hovered]/editor:opacity-100 focus-visible:opacity-100",
|
|
3345
|
-
children: /* @__PURE__ */
|
|
3420
|
+
children: /* @__PURE__ */ jsx49(Sparkle2, { size: 16, "aria-hidden": true })
|
|
3346
3421
|
}
|
|
3347
3422
|
)
|
|
3348
3423
|
]
|
|
@@ -3353,15 +3428,15 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3353
3428
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
3354
3429
|
|
|
3355
3430
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
3356
|
-
import * as
|
|
3431
|
+
import * as React49 from "react";
|
|
3357
3432
|
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3, WarningCircle as WarningCircle5 } from "@phosphor-icons/react";
|
|
3358
3433
|
import { Slot as Slot3 } from "radix-ui";
|
|
3359
|
-
import { jsx as
|
|
3360
|
-
var QuestionNavItem =
|
|
3434
|
+
import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3435
|
+
var QuestionNavItem = React49.forwardRef(
|
|
3361
3436
|
({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3362
3437
|
const Comp = asChild ? Slot3.Root : "button";
|
|
3363
3438
|
const warn = !error && !!warning;
|
|
3364
|
-
return /* @__PURE__ */
|
|
3439
|
+
return /* @__PURE__ */ jsxs37(
|
|
3365
3440
|
Comp,
|
|
3366
3441
|
{
|
|
3367
3442
|
ref,
|
|
@@ -3380,9 +3455,9 @@ var QuestionNavItem = React47.forwardRef(
|
|
|
3380
3455
|
),
|
|
3381
3456
|
...props,
|
|
3382
3457
|
children: [
|
|
3383
|
-
/* @__PURE__ */
|
|
3384
|
-
showDragHandle && /* @__PURE__ */
|
|
3385
|
-
/* @__PURE__ */
|
|
3458
|
+
/* @__PURE__ */ jsxs37("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3459
|
+
showDragHandle && /* @__PURE__ */ jsx50(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3460
|
+
/* @__PURE__ */ jsx50("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx50(WarningCircle5, { size: 16, className: "text-destructive-foreground" }) : warn ? /* @__PURE__ */ jsx50(Warning3, { size: 16, className: "text-warning-foreground" }) : /* @__PURE__ */ jsx50(
|
|
3386
3461
|
QuestionTypeIcon,
|
|
3387
3462
|
{
|
|
3388
3463
|
type: questionType,
|
|
@@ -3391,9 +3466,9 @@ var QuestionNavItem = React47.forwardRef(
|
|
|
3391
3466
|
}
|
|
3392
3467
|
) })
|
|
3393
3468
|
] }),
|
|
3394
|
-
/* @__PURE__ */
|
|
3395
|
-
error && /* @__PURE__ */
|
|
3396
|
-
warn && /* @__PURE__ */
|
|
3469
|
+
/* @__PURE__ */ jsx50("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3470
|
+
error && /* @__PURE__ */ jsx50("span", { className: "sr-only", children: ", has errors" }),
|
|
3471
|
+
warn && /* @__PURE__ */ jsx50("span", { className: "sr-only", children: ", has warnings" })
|
|
3397
3472
|
]
|
|
3398
3473
|
}
|
|
3399
3474
|
);
|
|
@@ -3402,14 +3477,14 @@ var QuestionNavItem = React47.forwardRef(
|
|
|
3402
3477
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
3403
3478
|
|
|
3404
3479
|
// src/components/Question Types/QuestionOption.tsx
|
|
3405
|
-
import * as
|
|
3480
|
+
import * as React50 from "react";
|
|
3406
3481
|
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle6 } from "@phosphor-icons/react";
|
|
3407
|
-
import { Fragment as Fragment12, jsx as
|
|
3482
|
+
import { Fragment as Fragment12, jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3408
3483
|
var optionClasses = "flex w-full max-w-150 cursor-pointer items-center gap-2 rounded-md border border-border bg-surface px-4 py-2 text-body-base text-surface-foreground transition-colors hover:bg-accent-soft hover:shadow-md has-[[data-state=checked]]:border-accent-foreground has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50";
|
|
3409
3484
|
function QuestionOption(props) {
|
|
3410
|
-
const id =
|
|
3411
|
-
return /* @__PURE__ */
|
|
3412
|
-
props.kind === "checkbox" ? /* @__PURE__ */
|
|
3485
|
+
const id = React50.useId();
|
|
3486
|
+
return /* @__PURE__ */ jsxs38("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3487
|
+
props.kind === "checkbox" ? /* @__PURE__ */ jsx51(
|
|
3413
3488
|
Checkbox,
|
|
3414
3489
|
{
|
|
3415
3490
|
id,
|
|
@@ -3418,16 +3493,16 @@ function QuestionOption(props) {
|
|
|
3418
3493
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
3419
3494
|
disabled: props.disabled
|
|
3420
3495
|
}
|
|
3421
|
-
) : /* @__PURE__ */
|
|
3422
|
-
/* @__PURE__ */
|
|
3496
|
+
) : /* @__PURE__ */ jsx51(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3497
|
+
/* @__PURE__ */ jsx51("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3423
3498
|
] });
|
|
3424
3499
|
}
|
|
3425
|
-
var QuestionOtherOption =
|
|
3500
|
+
var QuestionOtherOption = React50.forwardRef(
|
|
3426
3501
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3427
|
-
const inner =
|
|
3428
|
-
|
|
3502
|
+
const inner = React50.useRef(null);
|
|
3503
|
+
React50.useImperativeHandle(ref, () => inner.current);
|
|
3429
3504
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3430
|
-
return /* @__PURE__ */
|
|
3505
|
+
return /* @__PURE__ */ jsxs38(
|
|
3431
3506
|
"div",
|
|
3432
3507
|
{
|
|
3433
3508
|
className: cn(
|
|
@@ -3435,7 +3510,7 @@ var QuestionOtherOption = React48.forwardRef(
|
|
|
3435
3510
|
className
|
|
3436
3511
|
),
|
|
3437
3512
|
children: [
|
|
3438
|
-
/* @__PURE__ */
|
|
3513
|
+
/* @__PURE__ */ jsx51(
|
|
3439
3514
|
"input",
|
|
3440
3515
|
{
|
|
3441
3516
|
ref: inner,
|
|
@@ -3451,7 +3526,7 @@ var QuestionOtherOption = React48.forwardRef(
|
|
|
3451
3526
|
...props
|
|
3452
3527
|
}
|
|
3453
3528
|
),
|
|
3454
|
-
/* @__PURE__ */
|
|
3529
|
+
/* @__PURE__ */ jsx51(Button, { type: "button", variant: "subtle", size: "icon-sm", "aria-label": confirmLabel, onClick: submit, children: /* @__PURE__ */ jsx51(Check4, { size: 16, "aria-hidden": true }) })
|
|
3455
3530
|
]
|
|
3456
3531
|
}
|
|
3457
3532
|
);
|
|
@@ -3466,16 +3541,16 @@ function limitsText2(min, max) {
|
|
|
3466
3541
|
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3467
3542
|
const reveal = kind !== void 0;
|
|
3468
3543
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3469
|
-
const [draft, setDraft] =
|
|
3470
|
-
const [error, setError] =
|
|
3471
|
-
const helperId =
|
|
3472
|
-
const [focused, setFocused] =
|
|
3544
|
+
const [draft, setDraft] = React50.useState(null);
|
|
3545
|
+
const [error, setError] = React50.useState(null);
|
|
3546
|
+
const helperId = React50.useId();
|
|
3547
|
+
const [focused, setFocused] = React50.useState(false);
|
|
3473
3548
|
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3474
|
-
const fieldRef =
|
|
3475
|
-
const [editMarks, setEditMarks] =
|
|
3476
|
-
const [scroll, setScroll] =
|
|
3549
|
+
const fieldRef = React50.useRef(null);
|
|
3550
|
+
const [editMarks, setEditMarks] = React50.useState([]);
|
|
3551
|
+
const [scroll, setScroll] = React50.useState(0);
|
|
3477
3552
|
const typed = guarded ? draft ?? label : label;
|
|
3478
|
-
const skipBlur =
|
|
3553
|
+
const skipBlur = React50.useRef(false);
|
|
3479
3554
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3480
3555
|
const save = () => {
|
|
3481
3556
|
if (draft === null) return true;
|
|
@@ -3496,9 +3571,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3496
3571
|
...dragHandleProps,
|
|
3497
3572
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3498
3573
|
} : { "aria-hidden": true };
|
|
3499
|
-
const grip = dragHandleProps ? /* @__PURE__ */
|
|
3500
|
-
return /* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
3574
|
+
const grip = dragHandleProps ? /* @__PURE__ */ jsx51("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ jsx51(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ jsx51(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
|
|
3575
|
+
return /* @__PURE__ */ jsxs38("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3576
|
+
/* @__PURE__ */ jsx51(
|
|
3502
3577
|
"div",
|
|
3503
3578
|
{
|
|
3504
3579
|
className: cn(
|
|
@@ -3508,10 +3583,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3508
3583
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3509
3584
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3510
3585
|
),
|
|
3511
|
-
children: /* @__PURE__ */
|
|
3512
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */
|
|
3586
|
+
children: /* @__PURE__ */ jsxs38("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3587
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ jsx51("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ jsxs38(Fragment12, { children: [
|
|
3513
3588
|
!locked && grip,
|
|
3514
|
-
/* @__PURE__ */
|
|
3589
|
+
/* @__PURE__ */ jsx51(
|
|
3515
3590
|
"span",
|
|
3516
3591
|
{
|
|
3517
3592
|
"aria-hidden": "true",
|
|
@@ -3519,8 +3594,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3519
3594
|
children: rank
|
|
3520
3595
|
}
|
|
3521
3596
|
)
|
|
3522
|
-
] }) : reveal && locked ? /* @__PURE__ */
|
|
3523
|
-
/* @__PURE__ */
|
|
3597
|
+
] }) : reveal && locked ? /* @__PURE__ */ jsx51("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx51("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ jsxs38("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
|
|
3598
|
+
/* @__PURE__ */ jsx51(
|
|
3524
3599
|
"span",
|
|
3525
3600
|
{
|
|
3526
3601
|
"aria-hidden": "true",
|
|
@@ -3531,7 +3606,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3531
3606
|
)
|
|
3532
3607
|
}
|
|
3533
3608
|
),
|
|
3534
|
-
/* @__PURE__ */
|
|
3609
|
+
/* @__PURE__ */ jsx51(
|
|
3535
3610
|
DotsSixVertical3,
|
|
3536
3611
|
{
|
|
3537
3612
|
size: 20,
|
|
@@ -3543,10 +3618,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3543
3618
|
}
|
|
3544
3619
|
)
|
|
3545
3620
|
] }) : locked ? null : grip }),
|
|
3546
|
-
/* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3548
|
-
focused && editMarks.length > 0 && /* @__PURE__ */
|
|
3549
|
-
/* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3622
|
+
/* @__PURE__ */ jsxs38("div", { className: "relative min-w-0", children: [
|
|
3623
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ jsx51(DraftMarks, { layer: "behind", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3624
|
+
/* @__PURE__ */ jsx51(
|
|
3550
3625
|
"input",
|
|
3551
3626
|
{
|
|
3552
3627
|
ref: fieldRef,
|
|
@@ -3601,24 +3676,24 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3601
3676
|
)
|
|
3602
3677
|
}
|
|
3603
3678
|
),
|
|
3604
|
-
focused && editMarks.length > 0 && /* @__PURE__ */
|
|
3605
|
-
showMarks && /* @__PURE__ */
|
|
3606
|
-
(piece, i) => piece.mark ? /* @__PURE__ */
|
|
3679
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ jsx51(DraftMarks, { layer: "over", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3680
|
+
showMarks && /* @__PURE__ */ jsx51("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 flex items-center overflow-hidden whitespace-pre text-body-base text-surface-foreground [&_[data-mark]]:pointer-events-auto", children: splitMarks(label, marks).map(
|
|
3681
|
+
(piece, i) => piece.mark ? /* @__PURE__ */ jsx51(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : /* @__PURE__ */ jsx51("span", { children: piece.text }, i)
|
|
3607
3682
|
) })
|
|
3608
3683
|
] }),
|
|
3609
|
-
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */
|
|
3684
|
+
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ jsxs38(
|
|
3610
3685
|
"p",
|
|
3611
3686
|
{
|
|
3612
3687
|
id: helperId,
|
|
3613
3688
|
role: error ? "alert" : void 0,
|
|
3614
3689
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3615
3690
|
children: [
|
|
3616
|
-
/* @__PURE__ */
|
|
3617
|
-
error && /* @__PURE__ */
|
|
3691
|
+
/* @__PURE__ */ jsxs38("span", { className: "flex items-start gap-2", children: [
|
|
3692
|
+
error && /* @__PURE__ */ jsx51(WarningCircle6, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3618
3693
|
limitsText2(minLength, maxLength),
|
|
3619
|
-
error && /* @__PURE__ */
|
|
3694
|
+
error && /* @__PURE__ */ jsx51("span", { className: "sr-only", children: error })
|
|
3620
3695
|
] }),
|
|
3621
|
-
/* @__PURE__ */
|
|
3696
|
+
/* @__PURE__ */ jsxs38("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3622
3697
|
draft.length,
|
|
3623
3698
|
maxLength !== void 0 && `/${maxLength}`
|
|
3624
3699
|
] })
|
|
@@ -3629,7 +3704,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3629
3704
|
] })
|
|
3630
3705
|
}
|
|
3631
3706
|
),
|
|
3632
|
-
!locked && /* @__PURE__ */
|
|
3707
|
+
!locked && /* @__PURE__ */ jsxs38(
|
|
3633
3708
|
"div",
|
|
3634
3709
|
{
|
|
3635
3710
|
className: cn(
|
|
@@ -3637,8 +3712,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3637
3712
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3638
3713
|
),
|
|
3639
3714
|
children: [
|
|
3640
|
-
/* @__PURE__ */
|
|
3641
|
-
/* @__PURE__ */
|
|
3715
|
+
/* @__PURE__ */ jsx51(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", disabled: removeDisabled, onClick: onRemove, children: /* @__PURE__ */ jsx51(Trash5, { size: 16, "aria-hidden": true }) }),
|
|
3716
|
+
/* @__PURE__ */ jsx51(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", disabled: addDisabled, onClick: onAdd, children: /* @__PURE__ */ jsx51(Plus4, { size: 16, "aria-hidden": true }) })
|
|
3642
3717
|
]
|
|
3643
3718
|
}
|
|
3644
3719
|
)
|
|
@@ -3646,9 +3721,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3646
3721
|
}
|
|
3647
3722
|
|
|
3648
3723
|
// src/components/Question Types/RankList.tsx
|
|
3649
|
-
import * as
|
|
3724
|
+
import * as React51 from "react";
|
|
3650
3725
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
3651
|
-
import { Fragment as Fragment13, jsx as
|
|
3726
|
+
import { Fragment as Fragment13, jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3652
3727
|
function move(list, from, to) {
|
|
3653
3728
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3654
3729
|
const next = list.slice();
|
|
@@ -3656,13 +3731,13 @@ function move(list, from, to) {
|
|
|
3656
3731
|
next.splice(to, 0, item);
|
|
3657
3732
|
return next;
|
|
3658
3733
|
}
|
|
3659
|
-
var RankList =
|
|
3734
|
+
var RankList = React51.forwardRef(
|
|
3660
3735
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3661
|
-
const [dragIndex, setDragIndex] =
|
|
3662
|
-
const [announcement, setAnnouncement] =
|
|
3663
|
-
const handles =
|
|
3664
|
-
const refocus =
|
|
3665
|
-
|
|
3736
|
+
const [dragIndex, setDragIndex] = React51.useState(null);
|
|
3737
|
+
const [announcement, setAnnouncement] = React51.useState("");
|
|
3738
|
+
const handles = React51.useRef(/* @__PURE__ */ new Map());
|
|
3739
|
+
const refocus = React51.useRef(null);
|
|
3740
|
+
React51.useEffect(() => {
|
|
3666
3741
|
if (refocus.current) {
|
|
3667
3742
|
handles.current.get(refocus.current)?.focus();
|
|
3668
3743
|
refocus.current = null;
|
|
@@ -3675,8 +3750,8 @@ var RankList = React49.forwardRef(
|
|
|
3675
3750
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3676
3751
|
onItemsChange(next);
|
|
3677
3752
|
};
|
|
3678
|
-
return /* @__PURE__ */
|
|
3679
|
-
/* @__PURE__ */
|
|
3753
|
+
return /* @__PURE__ */ jsxs39(Fragment13, { children: [
|
|
3754
|
+
/* @__PURE__ */ jsx52("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs39(
|
|
3680
3755
|
"li",
|
|
3681
3756
|
{
|
|
3682
3757
|
draggable: true,
|
|
@@ -3693,7 +3768,7 @@ var RankList = React49.forwardRef(
|
|
|
3693
3768
|
dragIndex === index && "opacity-50"
|
|
3694
3769
|
),
|
|
3695
3770
|
children: [
|
|
3696
|
-
/* @__PURE__ */
|
|
3771
|
+
/* @__PURE__ */ jsx52(
|
|
3697
3772
|
"button",
|
|
3698
3773
|
{
|
|
3699
3774
|
type: "button",
|
|
@@ -3712,10 +3787,10 @@ var RankList = React49.forwardRef(
|
|
|
3712
3787
|
}
|
|
3713
3788
|
},
|
|
3714
3789
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3715
|
-
children: /* @__PURE__ */
|
|
3790
|
+
children: /* @__PURE__ */ jsx52(DotsSixVertical4, { size: 16, "aria-hidden": true })
|
|
3716
3791
|
}
|
|
3717
3792
|
),
|
|
3718
|
-
/* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ jsx52(
|
|
3719
3794
|
"span",
|
|
3720
3795
|
{
|
|
3721
3796
|
"aria-hidden": "true",
|
|
@@ -3723,27 +3798,27 @@ var RankList = React49.forwardRef(
|
|
|
3723
3798
|
children: index + 1
|
|
3724
3799
|
}
|
|
3725
3800
|
),
|
|
3726
|
-
/* @__PURE__ */
|
|
3801
|
+
/* @__PURE__ */ jsx52("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3727
3802
|
]
|
|
3728
3803
|
},
|
|
3729
3804
|
item.id
|
|
3730
3805
|
)) }),
|
|
3731
|
-
/* @__PURE__ */
|
|
3806
|
+
/* @__PURE__ */ jsx52("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3732
3807
|
] });
|
|
3733
3808
|
}
|
|
3734
3809
|
);
|
|
3735
3810
|
RankList.displayName = "RankList";
|
|
3736
3811
|
|
|
3737
3812
|
// src/components/Question Types/RatingScale.tsx
|
|
3738
|
-
import * as
|
|
3813
|
+
import * as React52 from "react";
|
|
3739
3814
|
import { ToggleGroup as ToggleGroupPrimitive3 } from "radix-ui";
|
|
3740
|
-
import { jsx as
|
|
3741
|
-
var RatingScale =
|
|
3815
|
+
import { jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3816
|
+
var RatingScale = React52.forwardRef(
|
|
3742
3817
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3743
|
-
const [internal, setInternal] =
|
|
3818
|
+
const [internal, setInternal] = React52.useState(defaultValue);
|
|
3744
3819
|
const current = value !== void 0 ? value : internal;
|
|
3745
|
-
return /* @__PURE__ */
|
|
3746
|
-
/* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ jsxs40("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3821
|
+
/* @__PURE__ */ jsx53(
|
|
3747
3822
|
ToggleGroupPrimitive3.Root,
|
|
3748
3823
|
{
|
|
3749
3824
|
ref,
|
|
@@ -3756,7 +3831,7 @@ var RatingScale = React50.forwardRef(
|
|
|
3756
3831
|
},
|
|
3757
3832
|
className: "flex gap-2",
|
|
3758
3833
|
...props,
|
|
3759
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */
|
|
3834
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsx53(
|
|
3760
3835
|
ToggleGroupPrimitive3.Item,
|
|
3761
3836
|
{
|
|
3762
3837
|
value: String(n),
|
|
@@ -3772,9 +3847,9 @@ var RatingScale = React50.forwardRef(
|
|
|
3772
3847
|
))
|
|
3773
3848
|
}
|
|
3774
3849
|
),
|
|
3775
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */
|
|
3776
|
-
/* @__PURE__ */
|
|
3777
|
-
/* @__PURE__ */
|
|
3850
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ jsxs40("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3851
|
+
/* @__PURE__ */ jsx53("span", { children: lowLabel }),
|
|
3852
|
+
/* @__PURE__ */ jsx53("span", { children: highLabel })
|
|
3778
3853
|
] })
|
|
3779
3854
|
] });
|
|
3780
3855
|
}
|
|
@@ -3782,12 +3857,12 @@ var RatingScale = React50.forwardRef(
|
|
|
3782
3857
|
RatingScale.displayName = "RatingScale";
|
|
3783
3858
|
|
|
3784
3859
|
// src/components/Question Types/StimulusCard.tsx
|
|
3785
|
-
import * as
|
|
3860
|
+
import * as React53 from "react";
|
|
3786
3861
|
import { Image as ImageIcon2, ImageBroken, Trash as Trash6 } from "@phosphor-icons/react";
|
|
3787
|
-
import { jsx as
|
|
3862
|
+
import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3788
3863
|
var MIN_THUMBNAIL = 92;
|
|
3789
3864
|
var MAX_THUMBNAIL = 240;
|
|
3790
|
-
var StimulusCard =
|
|
3865
|
+
var StimulusCard = React53.forwardRef(
|
|
3791
3866
|
({
|
|
3792
3867
|
className,
|
|
3793
3868
|
thumbnail,
|
|
@@ -3804,14 +3879,14 @@ var StimulusCard = React51.forwardRef(
|
|
|
3804
3879
|
removeLabel = "Remove stimulus",
|
|
3805
3880
|
...props
|
|
3806
3881
|
}, ref) => {
|
|
3807
|
-
const [failedSrc, setFailedSrc] =
|
|
3882
|
+
const [failedSrc, setFailedSrc] = React53.useState();
|
|
3808
3883
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3809
3884
|
const showImage = thumbnail !== void 0 && !error;
|
|
3810
|
-
const [draft, setDraft] =
|
|
3885
|
+
const [draft, setDraft] = React53.useState(null);
|
|
3811
3886
|
const count = (draft ?? caption ?? "").length;
|
|
3812
|
-
const textRef =
|
|
3813
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3814
|
-
|
|
3887
|
+
const textRef = React53.useRef(null);
|
|
3888
|
+
const [thumbnailSize, setThumbnailSize] = React53.useState(MIN_THUMBNAIL);
|
|
3889
|
+
React53.useEffect(() => {
|
|
3815
3890
|
const el = textRef.current;
|
|
3816
3891
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3817
3892
|
const observer = new ResizeObserver(() => {
|
|
@@ -3820,7 +3895,7 @@ var StimulusCard = React51.forwardRef(
|
|
|
3820
3895
|
observer.observe(el);
|
|
3821
3896
|
return () => observer.disconnect();
|
|
3822
3897
|
}, []);
|
|
3823
|
-
return /* @__PURE__ */
|
|
3898
|
+
return /* @__PURE__ */ jsxs41(
|
|
3824
3899
|
"div",
|
|
3825
3900
|
{
|
|
3826
3901
|
ref,
|
|
@@ -3828,8 +3903,8 @@ var StimulusCard = React51.forwardRef(
|
|
|
3828
3903
|
className: cn("flex min-h-24.5 w-full items-center gap-4 rounded-md border border-border p-0.5 pr-4", className),
|
|
3829
3904
|
...props,
|
|
3830
3905
|
children: [
|
|
3831
|
-
/* @__PURE__ */
|
|
3832
|
-
/* @__PURE__ */
|
|
3906
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3907
|
+
/* @__PURE__ */ jsx54(
|
|
3833
3908
|
"span",
|
|
3834
3909
|
{
|
|
3835
3910
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3840,13 +3915,13 @@ var StimulusCard = React51.forwardRef(
|
|
|
3840
3915
|
),
|
|
3841
3916
|
children: showImage ? (
|
|
3842
3917
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3843
|
-
/* @__PURE__ */
|
|
3844
|
-
) : error ? /* @__PURE__ */
|
|
3918
|
+
/* @__PURE__ */ jsx54("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) })
|
|
3919
|
+
) : error ? /* @__PURE__ */ jsx54(ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ jsx54(ImageIcon2, { size: 24, "aria-hidden": true })
|
|
3845
3920
|
}
|
|
3846
3921
|
),
|
|
3847
|
-
/* @__PURE__ */
|
|
3848
|
-
/* @__PURE__ */
|
|
3849
|
-
onCaptionChange ? /* @__PURE__ */
|
|
3922
|
+
/* @__PURE__ */ jsxs41("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
3923
|
+
/* @__PURE__ */ jsx54("p", { className: "w-full text-ui-label", children: label }),
|
|
3924
|
+
onCaptionChange ? /* @__PURE__ */ jsx54(
|
|
3850
3925
|
InlineEdit,
|
|
3851
3926
|
{
|
|
3852
3927
|
variant: "question",
|
|
@@ -3863,8 +3938,8 @@ var StimulusCard = React51.forwardRef(
|
|
|
3863
3938
|
},
|
|
3864
3939
|
textClassName: "text-body-base"
|
|
3865
3940
|
}
|
|
3866
|
-
) : /* @__PURE__ */
|
|
3867
|
-
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */
|
|
3941
|
+
) : /* @__PURE__ */ jsx54("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
3942
|
+
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs41("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3868
3943
|
count,
|
|
3869
3944
|
"/",
|
|
3870
3945
|
maxLength,
|
|
@@ -3872,7 +3947,7 @@ var StimulusCard = React51.forwardRef(
|
|
|
3872
3947
|
] })
|
|
3873
3948
|
] })
|
|
3874
3949
|
] }),
|
|
3875
|
-
onRemove && /* @__PURE__ */
|
|
3950
|
+
onRemove && /* @__PURE__ */ jsx54(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx54(Trash6, { size: 16, "aria-hidden": true }) })
|
|
3876
3951
|
]
|
|
3877
3952
|
}
|
|
3878
3953
|
);
|
|
@@ -3881,27 +3956,27 @@ var StimulusCard = React51.forwardRef(
|
|
|
3881
3956
|
StimulusCard.displayName = "StimulusCard";
|
|
3882
3957
|
|
|
3883
3958
|
// src/components/Data Display/Progress.tsx
|
|
3884
|
-
import * as
|
|
3959
|
+
import * as React54 from "react";
|
|
3885
3960
|
import { Progress as ProgressPrimitive2 } from "radix-ui";
|
|
3886
|
-
import { jsx as
|
|
3887
|
-
var Progress =
|
|
3961
|
+
import { jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3962
|
+
var Progress = React54.forwardRef(
|
|
3888
3963
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3889
3964
|
const hasHeader = label != null || valueLabel != null;
|
|
3890
3965
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3891
3966
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3892
|
-
return /* @__PURE__ */
|
|
3893
|
-
hasHeader && /* @__PURE__ */
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3967
|
+
return /* @__PURE__ */ jsxs42("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
3968
|
+
hasHeader && /* @__PURE__ */ jsxs42("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
3969
|
+
/* @__PURE__ */ jsx55("span", { children: label }),
|
|
3970
|
+
/* @__PURE__ */ jsx55("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3896
3971
|
] }),
|
|
3897
|
-
/* @__PURE__ */
|
|
3972
|
+
/* @__PURE__ */ jsx55(
|
|
3898
3973
|
ProgressPrimitive2.Root,
|
|
3899
3974
|
{
|
|
3900
3975
|
ref,
|
|
3901
3976
|
value: clamped,
|
|
3902
3977
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3903
3978
|
...props,
|
|
3904
|
-
children: /* @__PURE__ */
|
|
3979
|
+
children: /* @__PURE__ */ jsx55(
|
|
3905
3980
|
ProgressPrimitive2.Indicator,
|
|
3906
3981
|
{
|
|
3907
3982
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3910,9 +3985,9 @@ var Progress = React52.forwardRef(
|
|
|
3910
3985
|
)
|
|
3911
3986
|
}
|
|
3912
3987
|
),
|
|
3913
|
-
hasDetails && /* @__PURE__ */
|
|
3914
|
-
/* @__PURE__ */
|
|
3915
|
-
/* @__PURE__ */
|
|
3988
|
+
hasDetails && /* @__PURE__ */ jsxs42("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3989
|
+
/* @__PURE__ */ jsx55("span", { children: detailsStart }),
|
|
3990
|
+
/* @__PURE__ */ jsx55("span", { children: detailsEnd })
|
|
3916
3991
|
] })
|
|
3917
3992
|
] });
|
|
3918
3993
|
}
|
|
@@ -3920,11 +3995,11 @@ var Progress = React52.forwardRef(
|
|
|
3920
3995
|
Progress.displayName = "Progress";
|
|
3921
3996
|
|
|
3922
3997
|
// src/components/Data Display/Table.tsx
|
|
3923
|
-
import * as
|
|
3924
|
-
import { CaretDown as
|
|
3925
|
-
import { jsx as
|
|
3926
|
-
var Table =
|
|
3927
|
-
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */
|
|
3998
|
+
import * as React55 from "react";
|
|
3999
|
+
import { CaretDown as CaretDown5, CaretUp } from "@phosphor-icons/react";
|
|
4000
|
+
import { jsx as jsx56, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4001
|
+
var Table = React55.forwardRef(
|
|
4002
|
+
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ jsx56("div", { ref: containerRef, className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ jsx56(
|
|
3928
4003
|
"table",
|
|
3929
4004
|
{
|
|
3930
4005
|
ref,
|
|
@@ -3935,20 +4010,20 @@ var Table = React53.forwardRef(
|
|
|
3935
4010
|
) })
|
|
3936
4011
|
);
|
|
3937
4012
|
Table.displayName = "Table";
|
|
3938
|
-
var TableHeader =
|
|
3939
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4013
|
+
var TableHeader = React55.forwardRef(
|
|
4014
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx56("thead", { ref, className, ...props })
|
|
3940
4015
|
);
|
|
3941
4016
|
TableHeader.displayName = "TableHeader";
|
|
3942
|
-
var TableFooter =
|
|
3943
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4017
|
+
var TableFooter = React55.forwardRef(
|
|
4018
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx56("tfoot", { ref, className: cn("border-t border-border bg-background text-ui-label", className), ...props })
|
|
3944
4019
|
);
|
|
3945
4020
|
TableFooter.displayName = "TableFooter";
|
|
3946
|
-
var TableBody =
|
|
3947
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4021
|
+
var TableBody = React55.forwardRef(
|
|
4022
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx56("tbody", { ref, className, ...props })
|
|
3948
4023
|
);
|
|
3949
4024
|
TableBody.displayName = "TableBody";
|
|
3950
|
-
var TableRow =
|
|
3951
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */
|
|
4025
|
+
var TableRow = React55.forwardRef(
|
|
4026
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ jsx56(
|
|
3952
4027
|
"tr",
|
|
3953
4028
|
{
|
|
3954
4029
|
ref,
|
|
@@ -3965,10 +4040,10 @@ var TableRow = React53.forwardRef(
|
|
|
3965
4040
|
);
|
|
3966
4041
|
TableRow.displayName = "TableRow";
|
|
3967
4042
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3968
|
-
var TableHead =
|
|
4043
|
+
var TableHead = React55.forwardRef(
|
|
3969
4044
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, resizer, children, ...props }, ref) => {
|
|
3970
|
-
const caret = sort === "asc" ? /* @__PURE__ */
|
|
3971
|
-
return /* @__PURE__ */
|
|
4045
|
+
const caret = sort === "asc" ? /* @__PURE__ */ jsx56(CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ jsx56(CaretDown5, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
4046
|
+
return /* @__PURE__ */ jsxs43(
|
|
3972
4047
|
"th",
|
|
3973
4048
|
{
|
|
3974
4049
|
ref,
|
|
@@ -3983,7 +4058,7 @@ var TableHead = React53.forwardRef(
|
|
|
3983
4058
|
),
|
|
3984
4059
|
...props,
|
|
3985
4060
|
children: [
|
|
3986
|
-
sortable ? /* @__PURE__ */
|
|
4061
|
+
sortable ? /* @__PURE__ */ jsxs43(
|
|
3987
4062
|
"button",
|
|
3988
4063
|
{
|
|
3989
4064
|
type: "button",
|
|
@@ -3994,7 +4069,7 @@ var TableHead = React53.forwardRef(
|
|
|
3994
4069
|
caret
|
|
3995
4070
|
]
|
|
3996
4071
|
}
|
|
3997
|
-
) : checkbox ? /* @__PURE__ */
|
|
4072
|
+
) : checkbox ? /* @__PURE__ */ jsx56("div", { className: "flex items-center justify-center", children }) : children,
|
|
3998
4073
|
resizer
|
|
3999
4074
|
]
|
|
4000
4075
|
}
|
|
@@ -4002,8 +4077,8 @@ var TableHead = React53.forwardRef(
|
|
|
4002
4077
|
}
|
|
4003
4078
|
);
|
|
4004
4079
|
TableHead.displayName = "TableHead";
|
|
4005
|
-
var TableCell =
|
|
4006
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */
|
|
4080
|
+
var TableCell = React55.forwardRef(
|
|
4081
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ jsx56(
|
|
4007
4082
|
"td",
|
|
4008
4083
|
{
|
|
4009
4084
|
ref,
|
|
@@ -4016,24 +4091,24 @@ var TableCell = React53.forwardRef(
|
|
|
4016
4091
|
className
|
|
4017
4092
|
),
|
|
4018
4093
|
...props,
|
|
4019
|
-
children: checkbox ? /* @__PURE__ */
|
|
4094
|
+
children: checkbox ? /* @__PURE__ */ jsx56("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ jsx56("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
4020
4095
|
}
|
|
4021
4096
|
)
|
|
4022
4097
|
);
|
|
4023
4098
|
TableCell.displayName = "TableCell";
|
|
4024
4099
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
4025
|
-
return /* @__PURE__ */
|
|
4100
|
+
return /* @__PURE__ */ jsxs43("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
4026
4101
|
avatar,
|
|
4027
|
-
/* @__PURE__ */
|
|
4028
|
-
/* @__PURE__ */
|
|
4029
|
-
secondary && /* @__PURE__ */
|
|
4102
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
4103
|
+
/* @__PURE__ */ jsx56("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
4104
|
+
secondary && /* @__PURE__ */ jsx56("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
4030
4105
|
] })
|
|
4031
4106
|
] });
|
|
4032
4107
|
}
|
|
4033
4108
|
|
|
4034
4109
|
// src/components/Data Display/DataTable.tsx
|
|
4035
|
-
import * as
|
|
4036
|
-
import { CaretDown as
|
|
4110
|
+
import * as React57 from "react";
|
|
4111
|
+
import { CaretDown as CaretDown6, CaretRight as CaretRight4, PushPin, PushPinSlash, Rows, Sliders, Stack } from "@phosphor-icons/react";
|
|
4037
4112
|
import {
|
|
4038
4113
|
aggregationFn_count,
|
|
4039
4114
|
aggregationFn_extent,
|
|
@@ -4085,9 +4160,9 @@ import {
|
|
|
4085
4160
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4086
4161
|
|
|
4087
4162
|
// src/components/Utility/Pagination.tsx
|
|
4088
|
-
import * as
|
|
4163
|
+
import * as React56 from "react";
|
|
4089
4164
|
import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
|
|
4090
|
-
import { jsx as
|
|
4165
|
+
import { jsx as jsx57, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4091
4166
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
4092
4167
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
4093
4168
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -4101,10 +4176,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
4101
4176
|
});
|
|
4102
4177
|
return items;
|
|
4103
4178
|
}
|
|
4104
|
-
var Pagination =
|
|
4179
|
+
var Pagination = React56.forwardRef(
|
|
4105
4180
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
4106
4181
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
4107
|
-
const previous = /* @__PURE__ */
|
|
4182
|
+
const previous = /* @__PURE__ */ jsx57(
|
|
4108
4183
|
Button,
|
|
4109
4184
|
{
|
|
4110
4185
|
type: "button",
|
|
@@ -4113,10 +4188,10 @@ var Pagination = React54.forwardRef(
|
|
|
4113
4188
|
"aria-label": "Previous page",
|
|
4114
4189
|
disabled: page <= 1,
|
|
4115
4190
|
onClick: () => go(page - 1),
|
|
4116
|
-
children: /* @__PURE__ */
|
|
4191
|
+
children: /* @__PURE__ */ jsx57(ArrowLeft, { size: 16, "aria-hidden": true })
|
|
4117
4192
|
}
|
|
4118
4193
|
);
|
|
4119
|
-
const next = /* @__PURE__ */
|
|
4194
|
+
const next = /* @__PURE__ */ jsx57(
|
|
4120
4195
|
Button,
|
|
4121
4196
|
{
|
|
4122
4197
|
type: "button",
|
|
@@ -4125,10 +4200,10 @@ var Pagination = React54.forwardRef(
|
|
|
4125
4200
|
"aria-label": "Next page",
|
|
4126
4201
|
disabled: page >= pageCount,
|
|
4127
4202
|
onClick: () => go(page + 1),
|
|
4128
|
-
children: /* @__PURE__ */
|
|
4203
|
+
children: /* @__PURE__ */ jsx57(ArrowRight, { size: 16, "aria-hidden": true })
|
|
4129
4204
|
}
|
|
4130
4205
|
);
|
|
4131
|
-
return /* @__PURE__ */
|
|
4206
|
+
return /* @__PURE__ */ jsxs44(
|
|
4132
4207
|
"nav",
|
|
4133
4208
|
{
|
|
4134
4209
|
ref,
|
|
@@ -4137,14 +4212,14 @@ var Pagination = React54.forwardRef(
|
|
|
4137
4212
|
...props,
|
|
4138
4213
|
children: [
|
|
4139
4214
|
previous,
|
|
4140
|
-
variant === "compact" ? /* @__PURE__ */
|
|
4215
|
+
variant === "compact" ? /* @__PURE__ */ jsxs44("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
4141
4216
|
page,
|
|
4142
4217
|
"/",
|
|
4143
4218
|
pageCount
|
|
4144
|
-
] }) : /* @__PURE__ */
|
|
4145
|
-
/* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4147
|
-
] }) : /* @__PURE__ */
|
|
4219
|
+
] }) : /* @__PURE__ */ jsx57("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ jsx57("li", { children: item === "ellipsis" ? /* @__PURE__ */ jsxs44("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
4220
|
+
/* @__PURE__ */ jsx57(DotsThree2, { size: 16, "aria-hidden": true }),
|
|
4221
|
+
/* @__PURE__ */ jsx57("span", { className: "sr-only", children: "More pages" })
|
|
4222
|
+
] }) : /* @__PURE__ */ jsx57(
|
|
4148
4223
|
Button,
|
|
4149
4224
|
{
|
|
4150
4225
|
type: "button",
|
|
@@ -4165,7 +4240,7 @@ var Pagination = React54.forwardRef(
|
|
|
4165
4240
|
Pagination.displayName = "Pagination";
|
|
4166
4241
|
|
|
4167
4242
|
// src/components/Data Display/DataTable.tsx
|
|
4168
|
-
import { Fragment as Fragment15, jsx as
|
|
4243
|
+
import { Fragment as Fragment15, jsx as jsx58, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4169
4244
|
var features = tableFeatures({
|
|
4170
4245
|
rowSortingFeature,
|
|
4171
4246
|
rowPaginationFeature,
|
|
@@ -4220,9 +4295,9 @@ var features = tableFeatures({
|
|
|
4220
4295
|
});
|
|
4221
4296
|
var getMeta = (meta) => meta ?? {};
|
|
4222
4297
|
function useControllable(value, initial, onChange) {
|
|
4223
|
-
const [internal, setInternal] =
|
|
4298
|
+
const [internal, setInternal] = React57.useState(initial);
|
|
4224
4299
|
const current = value ?? internal;
|
|
4225
|
-
const update =
|
|
4300
|
+
const update = React57.useCallback(
|
|
4226
4301
|
(updater) => {
|
|
4227
4302
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
4228
4303
|
if (value === void 0) setInternal(next);
|
|
@@ -4261,16 +4336,16 @@ function ColumnFilter({ column }) {
|
|
|
4261
4336
|
const value = column.getFilterValue();
|
|
4262
4337
|
if (variant === "select") {
|
|
4263
4338
|
const options = [...column.getFacetedUniqueValues().entries()].sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
4264
|
-
return /* @__PURE__ */
|
|
4339
|
+
return /* @__PURE__ */ jsxs45(
|
|
4265
4340
|
Select,
|
|
4266
4341
|
{
|
|
4267
4342
|
value: typeof value === "string" ? value : ALL,
|
|
4268
4343
|
onValueChange: (next) => column.setFilterValue(next === ALL ? void 0 : next),
|
|
4269
4344
|
children: [
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
options.map(([option, count]) => /* @__PURE__ */
|
|
4345
|
+
/* @__PURE__ */ jsx58(SelectTrigger, { "aria-label": `Filter ${label}`, className: "h-8 text-body-small", children: /* @__PURE__ */ jsx58(SelectValue, {}) }),
|
|
4346
|
+
/* @__PURE__ */ jsxs45(SelectContent, { children: [
|
|
4347
|
+
/* @__PURE__ */ jsx58(SelectItem, { value: ALL, children: "All" }),
|
|
4348
|
+
options.map(([option, count]) => /* @__PURE__ */ jsxs45(SelectItem, { value: String(option), children: [
|
|
4274
4349
|
String(option),
|
|
4275
4350
|
" (",
|
|
4276
4351
|
count,
|
|
@@ -4289,8 +4364,8 @@ function ColumnFilter({ column }) {
|
|
|
4289
4364
|
next[index] = raw === "" ? void 0 : Number(raw);
|
|
4290
4365
|
column.setFilterValue(next[0] === void 0 && next[1] === void 0 ? void 0 : next);
|
|
4291
4366
|
};
|
|
4292
|
-
return /* @__PURE__ */
|
|
4293
|
-
/* @__PURE__ */
|
|
4367
|
+
return /* @__PURE__ */ jsxs45("div", { className: "flex gap-1", children: [
|
|
4368
|
+
/* @__PURE__ */ jsx58(
|
|
4294
4369
|
Input,
|
|
4295
4370
|
{
|
|
4296
4371
|
type: "number",
|
|
@@ -4301,7 +4376,7 @@ function ColumnFilter({ column }) {
|
|
|
4301
4376
|
className: "h-8 text-body-small"
|
|
4302
4377
|
}
|
|
4303
4378
|
),
|
|
4304
|
-
/* @__PURE__ */
|
|
4379
|
+
/* @__PURE__ */ jsx58(
|
|
4305
4380
|
Input,
|
|
4306
4381
|
{
|
|
4307
4382
|
type: "number",
|
|
@@ -4314,7 +4389,7 @@ function ColumnFilter({ column }) {
|
|
|
4314
4389
|
)
|
|
4315
4390
|
] });
|
|
4316
4391
|
}
|
|
4317
|
-
return /* @__PURE__ */
|
|
4392
|
+
return /* @__PURE__ */ jsx58(
|
|
4318
4393
|
Input,
|
|
4319
4394
|
{
|
|
4320
4395
|
"aria-label": `Filter ${label}`,
|
|
@@ -4327,9 +4402,9 @@ function ColumnFilter({ column }) {
|
|
|
4327
4402
|
}
|
|
4328
4403
|
function EditableCell({ value, label, type, onCommit }) {
|
|
4329
4404
|
const initial = value == null ? "" : String(value);
|
|
4330
|
-
const [draft, setDraft] =
|
|
4331
|
-
const cancelled =
|
|
4332
|
-
return /* @__PURE__ */
|
|
4405
|
+
const [draft, setDraft] = React57.useState(null);
|
|
4406
|
+
const cancelled = React57.useRef(false);
|
|
4407
|
+
return /* @__PURE__ */ jsx58(
|
|
4333
4408
|
Input,
|
|
4334
4409
|
{
|
|
4335
4410
|
type,
|
|
@@ -4467,7 +4542,7 @@ function DataTableInner({
|
|
|
4467
4542
|
onPaginationChange
|
|
4468
4543
|
);
|
|
4469
4544
|
const [density, setDensity] = useControllable(densityProp, "default", onDensityChange);
|
|
4470
|
-
const [cellSelection, setCellSelection] =
|
|
4545
|
+
const [cellSelection, setCellSelection] = React57.useState([]);
|
|
4471
4546
|
const infinite = Boolean(onLoadMore);
|
|
4472
4547
|
const paginate = !virtualized && !infinite;
|
|
4473
4548
|
const compact = density === "compact";
|
|
@@ -4540,12 +4615,12 @@ function DataTableInner({
|
|
|
4540
4615
|
const cellDensity = compact ? "h-8 py-1.5" : void 0;
|
|
4541
4616
|
const allSelected = table.getIsAllPageRowsSelected();
|
|
4542
4617
|
const someSelected = table.getIsSomePageRowsSelected();
|
|
4543
|
-
const dragged =
|
|
4618
|
+
const dragged = React57.useRef(null);
|
|
4544
4619
|
const topRows = enableRowPinning ? table.getTopRows() : [];
|
|
4545
4620
|
const bottomRows = enableRowPinning ? table.getBottomRows() : [];
|
|
4546
4621
|
const bodyRows = enableRowPinning ? table.getCenterRows() : table.getRowModel().rows;
|
|
4547
|
-
const scrollRef =
|
|
4548
|
-
const setScrollRef =
|
|
4622
|
+
const scrollRef = React57.useRef(null);
|
|
4623
|
+
const setScrollRef = React57.useCallback(
|
|
4549
4624
|
(node) => {
|
|
4550
4625
|
scrollRef.current = node;
|
|
4551
4626
|
if (typeof containerRef === "function") containerRef(node);
|
|
@@ -4564,8 +4639,8 @@ function DataTableInner({
|
|
|
4564
4639
|
const virtualItems = virtualized ? virtualizer.getVirtualItems() : [];
|
|
4565
4640
|
const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
|
|
4566
4641
|
const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems.at(-1)?.end ?? 0) : 0;
|
|
4567
|
-
const sentinelRef =
|
|
4568
|
-
|
|
4642
|
+
const sentinelRef = React57.useRef(null);
|
|
4643
|
+
React57.useEffect(() => {
|
|
4569
4644
|
const node = sentinelRef.current;
|
|
4570
4645
|
if (!node || !onLoadMore || !hasMore || loadingMore || typeof IntersectionObserver === "undefined") return;
|
|
4571
4646
|
const container = scrollRef.current;
|
|
@@ -4606,15 +4681,15 @@ function DataTableInner({
|
|
|
4606
4681
|
table.resetCellSelection(true);
|
|
4607
4682
|
}
|
|
4608
4683
|
};
|
|
4609
|
-
const skeletonRow = (rowKey) => /* @__PURE__ */
|
|
4684
|
+
const skeletonRow = (rowKey) => /* @__PURE__ */ jsx58(TableRow, { className: "hover:bg-transparent", children: Array.from({ length: columnSpan }, (_, cell) => /* @__PURE__ */ jsx58(TableCell, { checkbox: enableRowSelection && cell === 0, className: cellDensity, children: /* @__PURE__ */ jsx58("span", { "aria-hidden": true, className: "block h-4 w-3/4 animate-pulse rounded-xs bg-border" }) }, cell)) }, rowKey);
|
|
4610
4685
|
const renderRow = (row, options = {}) => {
|
|
4611
4686
|
const { pinned, pinnedIndex = 0, pinnedCount = 1, virtualIndex } = options;
|
|
4612
4687
|
const grouped = row.getIsGrouped();
|
|
4613
4688
|
const rowUnits = compact ? 8 : 10;
|
|
4614
4689
|
const pinStyle = pinned ? pinned === "top" ? { position: "sticky", top: `calc(var(--spacing) * ${rowUnits * (pinnedIndex + 1)})` } : { position: "sticky", bottom: `calc(var(--spacing) * ${rowUnits * (pinnedCount - 1 - pinnedIndex)})` } : void 0;
|
|
4615
4690
|
const cells = row.getVisibleCells();
|
|
4616
|
-
return /* @__PURE__ */
|
|
4617
|
-
/* @__PURE__ */
|
|
4691
|
+
return /* @__PURE__ */ jsxs45(React57.Fragment, { children: [
|
|
4692
|
+
/* @__PURE__ */ jsxs45(
|
|
4618
4693
|
TableRow,
|
|
4619
4694
|
{
|
|
4620
4695
|
ref: virtualized && virtualIndex !== void 0 ? virtualizer.measureElement : void 0,
|
|
@@ -4624,7 +4699,7 @@ function DataTableInner({
|
|
|
4624
4699
|
onClick: onRowClick && !grouped ? () => onRowClick(row.original) : void 0,
|
|
4625
4700
|
className: cn(pinned && "z-20 bg-surface", grouped && "bg-background", onRowClick && !grouped && "cursor-pointer"),
|
|
4626
4701
|
children: [
|
|
4627
|
-
enableRowSelection && /* @__PURE__ */
|
|
4702
|
+
enableRowSelection && /* @__PURE__ */ jsx58(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx58(
|
|
4628
4703
|
Checkbox,
|
|
4629
4704
|
{
|
|
4630
4705
|
"aria-label": "Select row",
|
|
@@ -4633,7 +4708,7 @@ function DataTableInner({
|
|
|
4633
4708
|
onCheckedChange: (checked) => row.toggleSelected(Boolean(checked))
|
|
4634
4709
|
}
|
|
4635
4710
|
) }),
|
|
4636
|
-
hasExpander && /* @__PURE__ */
|
|
4711
|
+
hasExpander && /* @__PURE__ */ jsx58(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && row.getCanExpand() && /* @__PURE__ */ jsx58(
|
|
4637
4712
|
Button,
|
|
4638
4713
|
{
|
|
4639
4714
|
type: "button",
|
|
@@ -4642,10 +4717,10 @@ function DataTableInner({
|
|
|
4642
4717
|
"aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
|
|
4643
4718
|
"aria-expanded": row.getIsExpanded(),
|
|
4644
4719
|
onClick: () => row.toggleExpanded(),
|
|
4645
|
-
children: row.getIsExpanded() ? /* @__PURE__ */
|
|
4720
|
+
children: row.getIsExpanded() ? /* @__PURE__ */ jsx58(CaretDown6, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx58(CaretRight4, { size: 16, "aria-hidden": true })
|
|
4646
4721
|
}
|
|
4647
4722
|
) }),
|
|
4648
|
-
enableRowPinning && /* @__PURE__ */
|
|
4723
|
+
enableRowPinning && /* @__PURE__ */ jsx58(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx58(
|
|
4649
4724
|
Button,
|
|
4650
4725
|
{
|
|
4651
4726
|
type: "button",
|
|
@@ -4654,7 +4729,7 @@ function DataTableInner({
|
|
|
4654
4729
|
"aria-label": row.getIsPinned() ? "Unpin row" : "Pin row to top",
|
|
4655
4730
|
"aria-pressed": Boolean(row.getIsPinned()),
|
|
4656
4731
|
onClick: () => row.pin(row.getIsPinned() ? false : "top"),
|
|
4657
|
-
children: row.getIsPinned() ? /* @__PURE__ */
|
|
4732
|
+
children: row.getIsPinned() ? /* @__PURE__ */ jsx58(PushPinSlash, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx58(PushPin, { size: 16, "aria-hidden": true })
|
|
4658
4733
|
}
|
|
4659
4734
|
) }),
|
|
4660
4735
|
cells.map((cell, index) => {
|
|
@@ -4667,7 +4742,7 @@ function DataTableInner({
|
|
|
4667
4742
|
const indent = index === 0 && hasExpander && row.depth > 0 ? row.depth * 4 : 0;
|
|
4668
4743
|
let content;
|
|
4669
4744
|
if (cell.getIsGrouped()) {
|
|
4670
|
-
content = /* @__PURE__ */
|
|
4745
|
+
content = /* @__PURE__ */ jsxs45(
|
|
4671
4746
|
"button",
|
|
4672
4747
|
{
|
|
4673
4748
|
type: "button",
|
|
@@ -4675,9 +4750,9 @@ function DataTableInner({
|
|
|
4675
4750
|
"aria-expanded": row.getIsExpanded(),
|
|
4676
4751
|
onClick: row.getToggleExpandedHandler(),
|
|
4677
4752
|
children: [
|
|
4678
|
-
row.getIsExpanded() ? /* @__PURE__ */
|
|
4753
|
+
row.getIsExpanded() ? /* @__PURE__ */ jsx58(CaretDown6, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx58(CaretRight4, { size: 16, "aria-hidden": true }),
|
|
4679
4754
|
flexRender(cell.column.columnDef.cell, cell.getContext()),
|
|
4680
|
-
/* @__PURE__ */
|
|
4755
|
+
/* @__PURE__ */ jsxs45("span", { className: "text-secondary-muted-foreground", children: [
|
|
4681
4756
|
"(",
|
|
4682
4757
|
row.subRows.length,
|
|
4683
4758
|
")"
|
|
@@ -4690,7 +4765,7 @@ function DataTableInner({
|
|
|
4690
4765
|
} else if (cell.getIsPlaceholder()) {
|
|
4691
4766
|
content = null;
|
|
4692
4767
|
} else if (meta.editable) {
|
|
4693
|
-
content = /* @__PURE__ */
|
|
4768
|
+
content = /* @__PURE__ */ jsx58(
|
|
4694
4769
|
EditableCell,
|
|
4695
4770
|
{
|
|
4696
4771
|
value: cell.getValue(),
|
|
@@ -4702,7 +4777,7 @@ function DataTableInner({
|
|
|
4702
4777
|
} else {
|
|
4703
4778
|
content = flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
4704
4779
|
}
|
|
4705
|
-
return /* @__PURE__ */
|
|
4780
|
+
return /* @__PURE__ */ jsx58(
|
|
4706
4781
|
TableCell,
|
|
4707
4782
|
{
|
|
4708
4783
|
align: meta.align,
|
|
@@ -4735,7 +4810,7 @@ function DataTableInner({
|
|
|
4735
4810
|
]
|
|
4736
4811
|
}
|
|
4737
4812
|
),
|
|
4738
|
-
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */
|
|
4813
|
+
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ jsx58(TableRow, { className: "bg-background hover:bg-background", children: /* @__PURE__ */ jsx58(TableCell, { colSpan: columnSpan, children: renderSubComponent(row.original) }) })
|
|
4739
4814
|
] }, row.id);
|
|
4740
4815
|
};
|
|
4741
4816
|
const renderHeaderCell = (header) => {
|
|
@@ -4746,7 +4821,7 @@ function DataTableInner({
|
|
|
4746
4821
|
const pin = pinning(column, sized, true);
|
|
4747
4822
|
const reorderable = enableColumnOrdering && leaf && !column.getIsPinned();
|
|
4748
4823
|
const label = labelOf(column);
|
|
4749
|
-
return /* @__PURE__ */
|
|
4824
|
+
return /* @__PURE__ */ jsx58(
|
|
4750
4825
|
TableHead,
|
|
4751
4826
|
{
|
|
4752
4827
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
@@ -4782,7 +4857,7 @@ function DataTableInner({
|
|
|
4782
4857
|
reorderable && "cursor-grab",
|
|
4783
4858
|
!leaf && "text-center"
|
|
4784
4859
|
),
|
|
4785
|
-
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */
|
|
4860
|
+
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ jsx58(
|
|
4786
4861
|
"div",
|
|
4787
4862
|
{
|
|
4788
4863
|
role: "separator",
|
|
@@ -4797,14 +4872,14 @@ function DataTableInner({
|
|
|
4797
4872
|
)
|
|
4798
4873
|
}
|
|
4799
4874
|
) : void 0,
|
|
4800
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */
|
|
4875
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ jsx58(table.FlexRender, { header })
|
|
4801
4876
|
},
|
|
4802
4877
|
header.id
|
|
4803
4878
|
);
|
|
4804
4879
|
};
|
|
4805
4880
|
const stickyLeading = cn(cellDensity, sticky && "sticky top-0 z-20 bg-surface");
|
|
4806
|
-
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */
|
|
4807
|
-
enableRowSelection && /* @__PURE__ */
|
|
4881
|
+
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
4882
|
+
enableRowSelection && /* @__PURE__ */ jsx58(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx58(
|
|
4808
4883
|
Checkbox,
|
|
4809
4884
|
{
|
|
4810
4885
|
"aria-label": "Select all rows",
|
|
@@ -4813,15 +4888,15 @@ function DataTableInner({
|
|
|
4813
4888
|
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(Boolean(checked))
|
|
4814
4889
|
}
|
|
4815
4890
|
) }),
|
|
4816
|
-
hasExpander && /* @__PURE__ */
|
|
4817
|
-
enableRowPinning && /* @__PURE__ */
|
|
4891
|
+
hasExpander && /* @__PURE__ */ jsx58(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx58("span", { className: "sr-only", children: "Expand" }) }),
|
|
4892
|
+
enableRowPinning && /* @__PURE__ */ jsx58(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx58("span", { className: "sr-only", children: "Pin" }) })
|
|
4818
4893
|
] });
|
|
4819
4894
|
const rowsToRender = virtualized ? virtualItems.map((item) => ({ row: bodyRows[item.index], index: item.index })) : null;
|
|
4820
4895
|
const totalRows = topRows.length + bodyRows.length + bottomRows.length;
|
|
4821
|
-
return /* @__PURE__ */
|
|
4822
|
-
showToolbar && /* @__PURE__ */
|
|
4823
|
-
/* @__PURE__ */
|
|
4824
|
-
enableGlobalFilter && /* @__PURE__ */
|
|
4896
|
+
return /* @__PURE__ */ jsxs45("div", { className: cn("flex w-full flex-col gap-2", wrapperClassName), children: [
|
|
4897
|
+
showToolbar && /* @__PURE__ */ jsxs45("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4898
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-2", children: [
|
|
4899
|
+
enableGlobalFilter && /* @__PURE__ */ jsx58(
|
|
4825
4900
|
SearchBar,
|
|
4826
4901
|
{
|
|
4827
4902
|
"aria-label": "Search table",
|
|
@@ -4834,8 +4909,8 @@ function DataTableInner({
|
|
|
4834
4909
|
),
|
|
4835
4910
|
toolbar
|
|
4836
4911
|
] }),
|
|
4837
|
-
/* @__PURE__ */
|
|
4838
|
-
enableDensityToggle && /* @__PURE__ */
|
|
4912
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-2", children: [
|
|
4913
|
+
enableDensityToggle && /* @__PURE__ */ jsxs45(
|
|
4839
4914
|
Button,
|
|
4840
4915
|
{
|
|
4841
4916
|
type: "button",
|
|
@@ -4844,20 +4919,20 @@ function DataTableInner({
|
|
|
4844
4919
|
"aria-pressed": compact,
|
|
4845
4920
|
onClick: () => setDensity(compact ? "default" : "compact"),
|
|
4846
4921
|
children: [
|
|
4847
|
-
/* @__PURE__ */
|
|
4922
|
+
/* @__PURE__ */ jsx58(Rows, { size: 16, "aria-hidden": true }),
|
|
4848
4923
|
"Compact"
|
|
4849
4924
|
]
|
|
4850
4925
|
}
|
|
4851
4926
|
),
|
|
4852
|
-
enableGrouping && /* @__PURE__ */
|
|
4853
|
-
/* @__PURE__ */
|
|
4854
|
-
/* @__PURE__ */
|
|
4927
|
+
enableGrouping && /* @__PURE__ */ jsxs45(DropdownMenu, { children: [
|
|
4928
|
+
/* @__PURE__ */ jsx58(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs45(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4929
|
+
/* @__PURE__ */ jsx58(Stack, { size: 16, "aria-hidden": true }),
|
|
4855
4930
|
"Group by"
|
|
4856
4931
|
] }) }),
|
|
4857
|
-
/* @__PURE__ */
|
|
4858
|
-
/* @__PURE__ */
|
|
4859
|
-
/* @__PURE__ */
|
|
4860
|
-
groupableColumns.map((column) => /* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ jsxs45(DropdownMenuContent, { align: "end", children: [
|
|
4933
|
+
/* @__PURE__ */ jsx58(DropdownMenuLabel, { children: "Group rows by" }),
|
|
4934
|
+
/* @__PURE__ */ jsx58(DropdownMenuSeparator, {}),
|
|
4935
|
+
groupableColumns.map((column) => /* @__PURE__ */ jsx58(
|
|
4861
4936
|
DropdownMenuCheckboxItem,
|
|
4862
4937
|
{
|
|
4863
4938
|
checked: column.getIsGrouped(),
|
|
@@ -4868,15 +4943,15 @@ function DataTableInner({
|
|
|
4868
4943
|
))
|
|
4869
4944
|
] })
|
|
4870
4945
|
] }),
|
|
4871
|
-
enableColumnVisibility && /* @__PURE__ */
|
|
4872
|
-
/* @__PURE__ */
|
|
4873
|
-
/* @__PURE__ */
|
|
4946
|
+
enableColumnVisibility && /* @__PURE__ */ jsxs45(DropdownMenu, { children: [
|
|
4947
|
+
/* @__PURE__ */ jsx58(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs45(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4948
|
+
/* @__PURE__ */ jsx58(Sliders, { size: 16, "aria-hidden": true }),
|
|
4874
4949
|
"Columns"
|
|
4875
4950
|
] }) }),
|
|
4876
|
-
/* @__PURE__ */
|
|
4877
|
-
/* @__PURE__ */
|
|
4878
|
-
/* @__PURE__ */
|
|
4879
|
-
hideableColumns.map((column) => /* @__PURE__ */
|
|
4951
|
+
/* @__PURE__ */ jsxs45(DropdownMenuContent, { align: "end", children: [
|
|
4952
|
+
/* @__PURE__ */ jsx58(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
4953
|
+
/* @__PURE__ */ jsx58(DropdownMenuSeparator, {}),
|
|
4954
|
+
hideableColumns.map((column) => /* @__PURE__ */ jsx58(
|
|
4880
4955
|
DropdownMenuCheckboxItem,
|
|
4881
4956
|
{
|
|
4882
4957
|
checked: column.getIsVisible(),
|
|
@@ -4889,7 +4964,7 @@ function DataTableInner({
|
|
|
4889
4964
|
] })
|
|
4890
4965
|
] })
|
|
4891
4966
|
] }),
|
|
4892
|
-
/* @__PURE__ */
|
|
4967
|
+
/* @__PURE__ */ jsxs45(
|
|
4893
4968
|
Table,
|
|
4894
4969
|
{
|
|
4895
4970
|
ref,
|
|
@@ -4902,52 +4977,52 @@ function DataTableInner({
|
|
|
4902
4977
|
tabIndex: enableCellSelection ? 0 : void 0,
|
|
4903
4978
|
...tableProps,
|
|
4904
4979
|
children: [
|
|
4905
|
-
/* @__PURE__ */
|
|
4906
|
-
headerGroups.map((group, groupIndex) => /* @__PURE__ */
|
|
4980
|
+
/* @__PURE__ */ jsxs45(TableHeader, { children: [
|
|
4981
|
+
headerGroups.map((group, groupIndex) => /* @__PURE__ */ jsxs45(TableRow, { className: "hover:bg-transparent", children: [
|
|
4907
4982
|
groupIndex === 0 && leadingHeaderCells(headerGroups.length + (enableColumnFilters ? 1 : 0)),
|
|
4908
4983
|
group.headers.map(renderHeaderCell)
|
|
4909
4984
|
] }, group.id)),
|
|
4910
|
-
enableColumnFilters && /* @__PURE__ */
|
|
4985
|
+
enableColumnFilters && /* @__PURE__ */ jsx58(TableRow, { className: "hover:bg-transparent", children: leafColumns.map((column) => {
|
|
4911
4986
|
const pin = pinning(column, sized, true);
|
|
4912
|
-
return /* @__PURE__ */
|
|
4987
|
+
return /* @__PURE__ */ jsx58(
|
|
4913
4988
|
TableHead,
|
|
4914
4989
|
{
|
|
4915
4990
|
style: pin.style,
|
|
4916
4991
|
className: cn("h-auto py-2 font-normal", pin.className, sticky && !column.getIsPinned() && "bg-surface"),
|
|
4917
|
-
children: column.getCanFilter() ? /* @__PURE__ */
|
|
4992
|
+
children: column.getCanFilter() ? /* @__PURE__ */ jsx58(ColumnFilter, { column }) : null
|
|
4918
4993
|
},
|
|
4919
4994
|
column.id
|
|
4920
4995
|
);
|
|
4921
4996
|
}) })
|
|
4922
4997
|
] }),
|
|
4923
|
-
/* @__PURE__ */
|
|
4924
|
-
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */
|
|
4998
|
+
/* @__PURE__ */ jsxs45(TableBody, { children: [
|
|
4999
|
+
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ jsx58(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx58(TableCell, { colSpan: columnSpan, muted: true, className: "h-24 text-center", children: emptyState ?? "No results." }) }) : /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
4925
5000
|
topRows.map((row, index) => renderRow(row, { pinned: "top", pinnedIndex: index, pinnedCount: topRows.length })),
|
|
4926
|
-
virtualized && paddingTop > 0 && /* @__PURE__ */
|
|
5001
|
+
virtualized && paddingTop > 0 && /* @__PURE__ */ jsx58("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx58("td", { colSpan: columnSpan, style: { height: paddingTop } }) }),
|
|
4927
5002
|
rowsToRender ? rowsToRender.map(({ row, index }) => renderRow(row, { virtualIndex: index })) : bodyRows.map((row) => renderRow(row)),
|
|
4928
|
-
virtualized && paddingBottom > 0 && /* @__PURE__ */
|
|
5003
|
+
virtualized && paddingBottom > 0 && /* @__PURE__ */ jsx58("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx58("td", { colSpan: columnSpan, style: { height: paddingBottom } }) }),
|
|
4929
5004
|
bottomRows.map(
|
|
4930
5005
|
(row, index) => renderRow(row, { pinned: "bottom", pinnedIndex: index, pinnedCount: bottomRows.length })
|
|
4931
5006
|
)
|
|
4932
5007
|
] }),
|
|
4933
|
-
infinite && /* @__PURE__ */
|
|
5008
|
+
infinite && /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
4934
5009
|
loadingMore && Array.from({ length: 3 }, (_, index) => skeletonRow(`more-${index}`)),
|
|
4935
|
-
/* @__PURE__ */
|
|
5010
|
+
/* @__PURE__ */ jsx58("tr", { ref: sentinelRef, "aria-hidden": true, children: /* @__PURE__ */ jsx58("td", { colSpan: columnSpan, className: "h-px p-0" }) })
|
|
4936
5011
|
] })
|
|
4937
5012
|
] }),
|
|
4938
|
-
showFooter && /* @__PURE__ */
|
|
4939
|
-
leadingCount > 0 && /* @__PURE__ */
|
|
5013
|
+
showFooter && /* @__PURE__ */ jsx58(TableFooter, { children: table.getFooterGroups().map((group) => /* @__PURE__ */ jsxs45(TableRow, { className: "hover:bg-transparent", children: [
|
|
5014
|
+
leadingCount > 0 && /* @__PURE__ */ jsx58(TableCell, { colSpan: leadingCount, className: cellDensity }),
|
|
4940
5015
|
group.headers.map((header) => {
|
|
4941
5016
|
const { align } = getMeta(header.column.columnDef.meta);
|
|
4942
5017
|
const pin = pinning(header.column, sized);
|
|
4943
|
-
return /* @__PURE__ */
|
|
5018
|
+
return /* @__PURE__ */ jsx58(
|
|
4944
5019
|
TableCell,
|
|
4945
5020
|
{
|
|
4946
5021
|
align,
|
|
4947
5022
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
4948
5023
|
style: pin.style,
|
|
4949
5024
|
className: cn("text-ui-label", pin.className, cellDensity),
|
|
4950
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */
|
|
5025
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ jsx58(table.FlexRender, { footer: header })
|
|
4951
5026
|
},
|
|
4952
5027
|
header.id
|
|
4953
5028
|
);
|
|
@@ -4956,9 +5031,9 @@ function DataTableInner({
|
|
|
4956
5031
|
]
|
|
4957
5032
|
}
|
|
4958
5033
|
),
|
|
4959
|
-
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */
|
|
4960
|
-
/* @__PURE__ */
|
|
4961
|
-
paginate && pageCount > 1 && /* @__PURE__ */
|
|
5034
|
+
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ jsxs45("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5035
|
+
/* @__PURE__ */ jsx58("span", { className: "text-body-small text-secondary-muted-foreground", "aria-live": "polite", children: enableRowSelection ? `${selectedCount} of ${table.getCoreRowModel().rows.length} row(s) selected` : null }),
|
|
5036
|
+
paginate && pageCount > 1 && /* @__PURE__ */ jsx58(
|
|
4962
5037
|
Pagination,
|
|
4963
5038
|
{
|
|
4964
5039
|
page: pagination.pageIndex + 1,
|
|
@@ -4969,13 +5044,13 @@ function DataTableInner({
|
|
|
4969
5044
|
] })
|
|
4970
5045
|
] });
|
|
4971
5046
|
}
|
|
4972
|
-
var DataTable =
|
|
5047
|
+
var DataTable = React57.forwardRef(DataTableInner);
|
|
4973
5048
|
DataTable.displayName = "DataTable";
|
|
4974
5049
|
|
|
4975
5050
|
// src/components/Data Display/StatCard.tsx
|
|
4976
|
-
import * as
|
|
5051
|
+
import * as React58 from "react";
|
|
4977
5052
|
import { cva as cva6 } from "class-variance-authority";
|
|
4978
|
-
import { jsx as
|
|
5053
|
+
import { jsx as jsx59, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4979
5054
|
var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
4980
5055
|
variants: {
|
|
4981
5056
|
variant: {
|
|
@@ -4989,26 +5064,26 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
4989
5064
|
},
|
|
4990
5065
|
defaultVariants: { variant: "default" }
|
|
4991
5066
|
});
|
|
4992
|
-
var StatCard =
|
|
4993
|
-
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */
|
|
4994
|
-
/* @__PURE__ */
|
|
4995
|
-
/* @__PURE__ */
|
|
4996
|
-
icon && /* @__PURE__ */
|
|
5067
|
+
var StatCard = React58.forwardRef(
|
|
5068
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ jsxs46("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
5069
|
+
/* @__PURE__ */ jsx59("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
5070
|
+
/* @__PURE__ */ jsxs46("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
5071
|
+
icon && /* @__PURE__ */ jsx59("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
4997
5072
|
value
|
|
4998
5073
|
] }),
|
|
4999
|
-
caption && /* @__PURE__ */
|
|
5074
|
+
caption && /* @__PURE__ */ jsx59("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
5000
5075
|
] })
|
|
5001
5076
|
);
|
|
5002
5077
|
StatCard.displayName = "StatCard";
|
|
5003
5078
|
|
|
5004
5079
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
5005
|
-
import * as
|
|
5080
|
+
import * as React60 from "react";
|
|
5006
5081
|
|
|
5007
5082
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
5008
|
-
import * as
|
|
5083
|
+
import * as React59 from "react";
|
|
5009
5084
|
import { Crown, Plus as Plus5, X as X6 } from "@phosphor-icons/react";
|
|
5010
5085
|
import { cva as cva7 } from "class-variance-authority";
|
|
5011
|
-
import { jsx as
|
|
5086
|
+
import { jsx as jsx60, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
5012
5087
|
var editableTagVariants = cva7(
|
|
5013
5088
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5014
5089
|
{
|
|
@@ -5023,27 +5098,27 @@ var editableTagVariants = cva7(
|
|
|
5023
5098
|
defaultVariants: { type: "default" }
|
|
5024
5099
|
}
|
|
5025
5100
|
);
|
|
5026
|
-
var EditableTag =
|
|
5101
|
+
var EditableTag = React59.forwardRef(
|
|
5027
5102
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
5028
5103
|
const classes = cn(editableTagVariants({ type }), className);
|
|
5029
|
-
const leading = type === "add" ? /* @__PURE__ */
|
|
5104
|
+
const leading = type === "add" ? /* @__PURE__ */ jsx60(Plus5, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ jsx60(Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
5030
5105
|
if (type === "add" || type === "multiple" && onClick) {
|
|
5031
|
-
return /* @__PURE__ */
|
|
5106
|
+
return /* @__PURE__ */ jsxs47("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
5032
5107
|
leading,
|
|
5033
5108
|
children
|
|
5034
5109
|
] });
|
|
5035
5110
|
}
|
|
5036
|
-
return /* @__PURE__ */
|
|
5111
|
+
return /* @__PURE__ */ jsxs47("span", { ref, className: classes, ...props, children: [
|
|
5037
5112
|
leading,
|
|
5038
5113
|
children,
|
|
5039
|
-
onRemove && /* @__PURE__ */
|
|
5114
|
+
onRemove && /* @__PURE__ */ jsx60(
|
|
5040
5115
|
"button",
|
|
5041
5116
|
{
|
|
5042
5117
|
type: "button",
|
|
5043
5118
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
5044
5119
|
onClick: onRemove,
|
|
5045
5120
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
5046
|
-
children: /* @__PURE__ */
|
|
5121
|
+
children: /* @__PURE__ */ jsx60(X6, { size: 12, "aria-hidden": true })
|
|
5047
5122
|
}
|
|
5048
5123
|
)
|
|
5049
5124
|
] });
|
|
@@ -5052,26 +5127,26 @@ var EditableTag = React57.forwardRef(
|
|
|
5052
5127
|
EditableTag.displayName = "EditableTag";
|
|
5053
5128
|
|
|
5054
5129
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
5055
|
-
import { jsx as
|
|
5056
|
-
var ActivityStructure =
|
|
5057
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */
|
|
5130
|
+
import { jsx as jsx61, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
5131
|
+
var ActivityStructure = React60.forwardRef(
|
|
5132
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ jsxs48(
|
|
5058
5133
|
"section",
|
|
5059
5134
|
{
|
|
5060
5135
|
ref,
|
|
5061
5136
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
5062
5137
|
...props,
|
|
5063
5138
|
children: [
|
|
5064
|
-
/* @__PURE__ */
|
|
5065
|
-
/* @__PURE__ */
|
|
5139
|
+
/* @__PURE__ */ jsxs48("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5140
|
+
/* @__PURE__ */ jsx61("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
5066
5141
|
action
|
|
5067
5142
|
] }),
|
|
5068
|
-
stats.length > 0 && /* @__PURE__ */
|
|
5069
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */
|
|
5070
|
-
/* @__PURE__ */
|
|
5071
|
-
/* @__PURE__ */
|
|
5072
|
-
(tags?.length || onAddTag) && /* @__PURE__ */
|
|
5073
|
-
tags?.map((tag) => /* @__PURE__ */
|
|
5074
|
-
onAddTag && /* @__PURE__ */
|
|
5143
|
+
stats.length > 0 && /* @__PURE__ */ jsx61("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx61(StatCard, { ...stat }, id)) }),
|
|
5144
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs48("div", { className: "flex flex-col gap-2", children: [
|
|
5145
|
+
/* @__PURE__ */ jsx61("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
5146
|
+
/* @__PURE__ */ jsx61("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
5147
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ jsxs48("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5148
|
+
tags?.map((tag) => /* @__PURE__ */ jsx61(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
5149
|
+
onAddTag && /* @__PURE__ */ jsx61(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
5075
5150
|
] })
|
|
5076
5151
|
] }, id)),
|
|
5077
5152
|
children
|
|
@@ -5082,10 +5157,10 @@ var ActivityStructure = React58.forwardRef(
|
|
|
5082
5157
|
ActivityStructure.displayName = "ActivityStructure";
|
|
5083
5158
|
|
|
5084
5159
|
// src/components/Tags & Badges/Badge.tsx
|
|
5085
|
-
import * as
|
|
5160
|
+
import * as React61 from "react";
|
|
5086
5161
|
import { DotsSixVertical as DotsSixVertical5, RadioButton as RadioButton3 } from "@phosphor-icons/react";
|
|
5087
5162
|
import { cva as cva8 } from "class-variance-authority";
|
|
5088
|
-
import { jsx as
|
|
5163
|
+
import { jsx as jsx62, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5089
5164
|
var roleTagVariants = cva8(
|
|
5090
5165
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5091
5166
|
{
|
|
@@ -5111,11 +5186,11 @@ var roleTagVariants = cva8(
|
|
|
5111
5186
|
defaultVariants: { type: "primary", selected: false }
|
|
5112
5187
|
}
|
|
5113
5188
|
);
|
|
5114
|
-
var Badge =
|
|
5189
|
+
var Badge = React61.forwardRef(
|
|
5115
5190
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
5116
5191
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
5117
5192
|
if (type === "interactable") {
|
|
5118
|
-
return /* @__PURE__ */
|
|
5193
|
+
return /* @__PURE__ */ jsxs49(
|
|
5119
5194
|
"button",
|
|
5120
5195
|
{
|
|
5121
5196
|
ref,
|
|
@@ -5125,26 +5200,55 @@ var Badge = React59.forwardRef(
|
|
|
5125
5200
|
onClick,
|
|
5126
5201
|
...props,
|
|
5127
5202
|
children: [
|
|
5128
|
-
/* @__PURE__ */
|
|
5203
|
+
/* @__PURE__ */ jsx62(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
5129
5204
|
children
|
|
5130
5205
|
]
|
|
5131
5206
|
}
|
|
5132
5207
|
);
|
|
5133
5208
|
}
|
|
5134
|
-
return /* @__PURE__ */
|
|
5135
|
-
type === "question" && /* @__PURE__ */
|
|
5136
|
-
type === "id" && /* @__PURE__ */
|
|
5209
|
+
return /* @__PURE__ */ jsxs49("span", { ref, className: classes, ...props, children: [
|
|
5210
|
+
type === "question" && /* @__PURE__ */ jsx62(RadioButton3, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
5211
|
+
type === "id" && /* @__PURE__ */ jsx62("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
5137
5212
|
children
|
|
5138
5213
|
] });
|
|
5139
5214
|
}
|
|
5140
5215
|
);
|
|
5141
5216
|
Badge.displayName = "Badge";
|
|
5217
|
+
|
|
5218
|
+
// src/components/Identity & People/Avatar.tsx
|
|
5219
|
+
import * as React62 from "react";
|
|
5220
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
5221
|
+
var initials = (name) => name.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
5222
|
+
var Avatar = React62.forwardRef(({ className, src, name, fallback, ...props }, ref) => {
|
|
5223
|
+
const [failed, setFailed] = React62.useState(false);
|
|
5224
|
+
React62.useEffect(() => setFailed(false), [src]);
|
|
5225
|
+
const showImage = Boolean(src) && !failed;
|
|
5226
|
+
return /* @__PURE__ */ jsx63(
|
|
5227
|
+
"span",
|
|
5228
|
+
{
|
|
5229
|
+
ref,
|
|
5230
|
+
role: showImage ? void 0 : "img",
|
|
5231
|
+
"aria-label": showImage ? void 0 : name,
|
|
5232
|
+
className: cn("flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-md bg-orchid-200 text-ui-label text-surface-foreground", className),
|
|
5233
|
+
...props,
|
|
5234
|
+
children: showImage ? /* @__PURE__ */ jsx63("img", { src, alt: name, className: "size-full object-cover", onError: () => setFailed(true) }) : /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", children: fallback ?? initials(name) })
|
|
5235
|
+
}
|
|
5236
|
+
);
|
|
5237
|
+
});
|
|
5238
|
+
Avatar.displayName = "Avatar";
|
|
5239
|
+
|
|
5240
|
+
// src/components/Identity & People/OrgMonogram.tsx
|
|
5241
|
+
import * as React63 from "react";
|
|
5242
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
5243
|
+
var OrgMonogram = React63.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx64("span", { ref, className: cn("flex size-10 shrink-0 items-center justify-center rounded-md bg-coral-500 text-ui-label font-semibold text-surface", className), ...props }));
|
|
5244
|
+
OrgMonogram.displayName = "OrgMonogram";
|
|
5142
5245
|
export {
|
|
5143
5246
|
AIMiniAvatar,
|
|
5144
5247
|
AIResponseContainer,
|
|
5145
5248
|
ActivityStructure,
|
|
5146
5249
|
AskAiInput,
|
|
5147
5250
|
AskAiToggle,
|
|
5251
|
+
Avatar,
|
|
5148
5252
|
Badge,
|
|
5149
5253
|
Button,
|
|
5150
5254
|
Calendar,
|
|
@@ -5201,9 +5305,11 @@ export {
|
|
|
5201
5305
|
NavRailItem,
|
|
5202
5306
|
NumberInput,
|
|
5203
5307
|
OpenEndAnswer,
|
|
5308
|
+
OrgMonogram,
|
|
5204
5309
|
Pagination,
|
|
5205
5310
|
Progress,
|
|
5206
5311
|
ProjectSelector,
|
|
5312
|
+
ProjectSidebar,
|
|
5207
5313
|
QuestionCard,
|
|
5208
5314
|
QuestionEditorCard,
|
|
5209
5315
|
QuestionHeader,
|
|
@@ -5225,6 +5331,7 @@ export {
|
|
|
5225
5331
|
SelectItem,
|
|
5226
5332
|
SelectTrigger,
|
|
5227
5333
|
SelectValue,
|
|
5334
|
+
SidebarNavItem,
|
|
5228
5335
|
Slider,
|
|
5229
5336
|
StatCard,
|
|
5230
5337
|
StatusTag,
|