@discuss-ds/ui 0.40.1 → 0.42.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 +26 -0
- package/dist/index.cjs +692 -580
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -6
- package/dist/index.d.ts +77 -6
- package/dist/index.js +664 -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, compact = false, className, ...props }) {
|
|
2812
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("flex items-center justify-between border-t border-border bg-surface", compact ? "p-4" : "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, aspect = "fixed", compactInfo = false, ...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: cn("group/player relative flex w-full items-end bg-accent-soft", aspect === "video" ? "aspect-video" : "h-60.5"), children: [
|
|
2905
|
+
src && /* @__PURE__ */ jsx43(
|
|
2849
2906
|
"video",
|
|
2850
2907
|
{
|
|
2851
2908
|
ref: video,
|
|
@@ -2858,93 +2915,112 @@ 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
|
+
compact: compactInfo,
|
|
3011
|
+
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 }) })
|
|
3012
|
+
}
|
|
3013
|
+
),
|
|
3014
|
+
/* @__PURE__ */ jsx43("span", { className: "sr-only", "aria-live": "polite", children: muted ? "Muted" : "" })
|
|
2939
3015
|
] });
|
|
2940
3016
|
}
|
|
2941
3017
|
);
|
|
2942
3018
|
VideoPlayer.displayName = "VideoPlayer";
|
|
2943
3019
|
function VolumeControl({ volume, onVolumeChange, className }) {
|
|
2944
|
-
const last =
|
|
3020
|
+
const last = React42.useRef(volume || 1);
|
|
2945
3021
|
if (volume > 0) last.current = volume;
|
|
2946
|
-
return /* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
3022
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("group/volume flex items-center", className), children: [
|
|
3023
|
+
/* @__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
3024
|
SliderPrimitive2.Root,
|
|
2949
3025
|
{
|
|
2950
3026
|
min: 0,
|
|
@@ -2954,32 +3030,32 @@ function VolumeControl({ volume, onVolumeChange, className }) {
|
|
|
2954
3030
|
onValueChange: ([next]) => next !== void 0 && onVolumeChange(next),
|
|
2955
3031
|
className: "relative flex h-4 w-14 touch-none items-center select-none",
|
|
2956
3032
|
children: [
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
3033
|
+
/* @__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" }) }),
|
|
3034
|
+
/* @__PURE__ */ jsx43(SliderPrimitive2.Thumb, { "aria-label": "Volume", className: "block size-3 rounded-full bg-surface shadow-sm" })
|
|
2959
3035
|
]
|
|
2960
3036
|
}
|
|
2961
3037
|
) }),
|
|
2962
|
-
/* @__PURE__ */
|
|
3038
|
+
/* @__PURE__ */ jsx43(
|
|
2963
3039
|
"button",
|
|
2964
3040
|
{
|
|
2965
3041
|
type: "button",
|
|
2966
3042
|
"aria-label": volume === 0 ? "Unmute" : "Mute",
|
|
2967
3043
|
onClick: () => onVolumeChange(volume === 0 ? last.current : 0),
|
|
2968
3044
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2969
|
-
children: volume === 0 ? /* @__PURE__ */
|
|
3045
|
+
children: volume === 0 ? /* @__PURE__ */ jsx43(SpeakerSimpleX, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx43(SpeakerSimpleHigh, { size: 16, "aria-hidden": true })
|
|
2970
3046
|
}
|
|
2971
3047
|
)
|
|
2972
3048
|
] });
|
|
2973
3049
|
}
|
|
2974
3050
|
|
|
2975
3051
|
// src/components/Question Types/OpenEndAnswer.tsx
|
|
2976
|
-
import * as
|
|
2977
|
-
import { jsx as
|
|
2978
|
-
var OpenEndAnswer =
|
|
3052
|
+
import * as React43 from "react";
|
|
3053
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
3054
|
+
var OpenEndAnswer = React43.forwardRef(
|
|
2979
3055
|
({ value, defaultValue, onChange, maxLength = 1e3, placeholder = "Write your answer", ...props }, ref) => {
|
|
2980
|
-
const [internal, setInternal] =
|
|
3056
|
+
const [internal, setInternal] = React43.useState(String(defaultValue ?? ""));
|
|
2981
3057
|
const text = value !== void 0 ? String(value) : internal;
|
|
2982
|
-
return /* @__PURE__ */
|
|
3058
|
+
return /* @__PURE__ */ jsx44(
|
|
2983
3059
|
Textarea,
|
|
2984
3060
|
{
|
|
2985
3061
|
ref,
|
|
@@ -2999,10 +3075,10 @@ var OpenEndAnswer = React41.forwardRef(
|
|
|
2999
3075
|
OpenEndAnswer.displayName = "OpenEndAnswer";
|
|
3000
3076
|
|
|
3001
3077
|
// src/components/Question Types/QuestionCard.tsx
|
|
3002
|
-
import * as
|
|
3003
|
-
import { jsx as
|
|
3004
|
-
var QuestionCard =
|
|
3005
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3078
|
+
import * as React44 from "react";
|
|
3079
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
3080
|
+
var QuestionCard = React44.forwardRef(
|
|
3081
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx45(
|
|
3006
3082
|
"div",
|
|
3007
3083
|
{
|
|
3008
3084
|
ref,
|
|
@@ -3014,7 +3090,7 @@ var QuestionCard = React42.forwardRef(
|
|
|
3014
3090
|
QuestionCard.displayName = "QuestionCard";
|
|
3015
3091
|
|
|
3016
3092
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3017
|
-
import * as
|
|
3093
|
+
import * as React48 from "react";
|
|
3018
3094
|
import {
|
|
3019
3095
|
Clipboard,
|
|
3020
3096
|
Copy,
|
|
@@ -3034,16 +3110,16 @@ function keepEditingFocus(event) {
|
|
|
3034
3110
|
}
|
|
3035
3111
|
|
|
3036
3112
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3037
|
-
import * as
|
|
3113
|
+
import * as React47 from "react";
|
|
3038
3114
|
|
|
3039
3115
|
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3040
|
-
import * as
|
|
3116
|
+
import * as React46 from "react";
|
|
3041
3117
|
import { DotsSixVertical } from "@phosphor-icons/react";
|
|
3042
3118
|
|
|
3043
3119
|
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
3044
3120
|
import "react";
|
|
3045
3121
|
import { ChatsCircle, CheckSquare, FileArrowUp, FileText as FileText2, Image, ListNumbers, RadioButton as RadioButton2, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
3046
|
-
import { jsx as
|
|
3122
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
3047
3123
|
var icons = {
|
|
3048
3124
|
"select-one": RadioButton2,
|
|
3049
3125
|
"select-multiple": CheckSquare,
|
|
@@ -3058,13 +3134,13 @@ var icons = {
|
|
|
3058
3134
|
};
|
|
3059
3135
|
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
3060
3136
|
const Icon = icons[type];
|
|
3061
|
-
return /* @__PURE__ */
|
|
3137
|
+
return /* @__PURE__ */ jsx46(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
3062
3138
|
}
|
|
3063
3139
|
|
|
3064
3140
|
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3065
|
-
import { jsx as
|
|
3066
|
-
var QuestionNumberTag =
|
|
3067
|
-
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */
|
|
3141
|
+
import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3142
|
+
var QuestionNumberTag = React46.forwardRef(
|
|
3143
|
+
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */ jsxs34(
|
|
3068
3144
|
"span",
|
|
3069
3145
|
{
|
|
3070
3146
|
ref,
|
|
@@ -3083,7 +3159,7 @@ var QuestionNumberTag = React44.forwardRef(
|
|
|
3083
3159
|
dragHandleProps?.className
|
|
3084
3160
|
),
|
|
3085
3161
|
children: [
|
|
3086
|
-
questionType && /* @__PURE__ */
|
|
3162
|
+
questionType && /* @__PURE__ */ jsx47(
|
|
3087
3163
|
QuestionTypeIcon,
|
|
3088
3164
|
{
|
|
3089
3165
|
type: questionType,
|
|
@@ -3091,7 +3167,7 @@ var QuestionNumberTag = React44.forwardRef(
|
|
|
3091
3167
|
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3092
3168
|
}
|
|
3093
3169
|
),
|
|
3094
|
-
showDragHandle && /* @__PURE__ */
|
|
3170
|
+
showDragHandle && /* @__PURE__ */ jsx47(
|
|
3095
3171
|
DotsSixVertical,
|
|
3096
3172
|
{
|
|
3097
3173
|
size: 16,
|
|
@@ -3108,30 +3184,30 @@ var QuestionNumberTag = React44.forwardRef(
|
|
|
3108
3184
|
QuestionNumberTag.displayName = "QuestionNumberTag";
|
|
3109
3185
|
|
|
3110
3186
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3111
|
-
import { jsx as
|
|
3187
|
+
import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3112
3188
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
3113
|
-
var QuestionHeader =
|
|
3189
|
+
var QuestionHeader = React47.forwardRef(
|
|
3114
3190
|
({ 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] =
|
|
3191
|
+
const [draft, setDraft] = React47.useState(null);
|
|
3116
3192
|
const label = String(number).padStart(2, "0");
|
|
3117
3193
|
const showError = error !== void 0 && error !== false;
|
|
3118
3194
|
if (editor) {
|
|
3119
3195
|
const text = typeof title === "string" ? title : "";
|
|
3120
3196
|
const count = (draft ?? text).length;
|
|
3121
3197
|
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
3122
|
-
return /* @__PURE__ */
|
|
3123
|
-
/* @__PURE__ */
|
|
3124
|
-
/* @__PURE__ */
|
|
3125
|
-
/* @__PURE__ */
|
|
3198
|
+
return /* @__PURE__ */ jsxs35("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
3199
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between", children: [
|
|
3200
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2", children: [
|
|
3201
|
+
/* @__PURE__ */ jsx48(QuestionNumberTag, { number, active, questionType, showDragHandle, dragHandleProps }),
|
|
3126
3202
|
meta
|
|
3127
3203
|
] }),
|
|
3128
|
-
actions && /* @__PURE__ */
|
|
3204
|
+
actions && /* @__PURE__ */ jsx48("div", { className: cn(
|
|
3129
3205
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
3130
3206
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
3131
3207
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
3132
3208
|
), children: actions })
|
|
3133
3209
|
] }),
|
|
3134
|
-
/* @__PURE__ */
|
|
3210
|
+
/* @__PURE__ */ jsx48(
|
|
3135
3211
|
InlineEdit,
|
|
3136
3212
|
{
|
|
3137
3213
|
variant: "question",
|
|
@@ -3157,8 +3233,8 @@ var QuestionHeader = React45.forwardRef(
|
|
|
3157
3233
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
3158
3234
|
}
|
|
3159
3235
|
),
|
|
3160
|
-
long && titleRecommendedNote != null && /* @__PURE__ */
|
|
3161
|
-
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */
|
|
3236
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ jsx48("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
3237
|
+
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs35("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3162
3238
|
count,
|
|
3163
3239
|
"/",
|
|
3164
3240
|
maxLength,
|
|
@@ -3166,16 +3242,16 @@ var QuestionHeader = React45.forwardRef(
|
|
|
3166
3242
|
] })
|
|
3167
3243
|
] });
|
|
3168
3244
|
}
|
|
3169
|
-
return /* @__PURE__ */
|
|
3170
|
-
showError && /* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3245
|
+
return /* @__PURE__ */ jsxs35("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3246
|
+
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 }) }),
|
|
3247
|
+
/* @__PURE__ */ jsxs35("p", { className: eyebrow, children: [
|
|
3172
3248
|
"Question ",
|
|
3173
3249
|
label
|
|
3174
3250
|
] }),
|
|
3175
|
-
/* @__PURE__ */
|
|
3251
|
+
/* @__PURE__ */ jsxs35("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
3176
3252
|
title,
|
|
3177
|
-
required && /* @__PURE__ */
|
|
3178
|
-
required && /* @__PURE__ */
|
|
3253
|
+
required && /* @__PURE__ */ jsx48("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
3254
|
+
required && /* @__PURE__ */ jsx48("span", { className: "sr-only", children: " (required)" })
|
|
3179
3255
|
] })
|
|
3180
3256
|
] });
|
|
3181
3257
|
}
|
|
@@ -3183,8 +3259,8 @@ var QuestionHeader = React45.forwardRef(
|
|
|
3183
3259
|
QuestionHeader.displayName = "QuestionHeader";
|
|
3184
3260
|
|
|
3185
3261
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3186
|
-
import { Fragment as Fragment11, jsx as
|
|
3187
|
-
var QuestionEditorCard =
|
|
3262
|
+
import { Fragment as Fragment11, jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3263
|
+
var QuestionEditorCard = React48.forwardRef(
|
|
3188
3264
|
({
|
|
3189
3265
|
className,
|
|
3190
3266
|
number,
|
|
@@ -3220,7 +3296,7 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3220
3296
|
...props
|
|
3221
3297
|
}, ref) => {
|
|
3222
3298
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
3223
|
-
return /* @__PURE__ */
|
|
3299
|
+
return /* @__PURE__ */ jsxs36(
|
|
3224
3300
|
"div",
|
|
3225
3301
|
{
|
|
3226
3302
|
ref,
|
|
@@ -3232,7 +3308,7 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3232
3308
|
props.onMouseDown?.(event);
|
|
3233
3309
|
},
|
|
3234
3310
|
children: [
|
|
3235
|
-
/* @__PURE__ */
|
|
3311
|
+
/* @__PURE__ */ jsxs36(
|
|
3236
3312
|
"div",
|
|
3237
3313
|
{
|
|
3238
3314
|
className: cn(
|
|
@@ -3240,9 +3316,9 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3240
3316
|
active ? "border-accent" : "border-border"
|
|
3241
3317
|
),
|
|
3242
3318
|
children: [
|
|
3243
|
-
/* @__PURE__ */
|
|
3244
|
-
/* @__PURE__ */
|
|
3245
|
-
/* @__PURE__ */
|
|
3319
|
+
/* @__PURE__ */ jsxs36("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
3320
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-4", children: [
|
|
3321
|
+
/* @__PURE__ */ jsx49(
|
|
3246
3322
|
QuestionHeader,
|
|
3247
3323
|
{
|
|
3248
3324
|
editor: true,
|
|
@@ -3265,8 +3341,8 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3265
3341
|
titleEditing,
|
|
3266
3342
|
meta,
|
|
3267
3343
|
maxLength,
|
|
3268
|
-
actions: actions ?? /* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3344
|
+
actions: actions ?? /* @__PURE__ */ jsxs36(Fragment11, { children: [
|
|
3345
|
+
/* @__PURE__ */ jsx49(
|
|
3270
3346
|
Button,
|
|
3271
3347
|
{
|
|
3272
3348
|
type: "button",
|
|
@@ -3274,10 +3350,10 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3274
3350
|
size: "icon-sm",
|
|
3275
3351
|
"aria-label": "Duplicate question",
|
|
3276
3352
|
onClick: onDuplicate,
|
|
3277
|
-
children: /* @__PURE__ */
|
|
3353
|
+
children: /* @__PURE__ */ jsx49(Copy, { size: 16, "aria-hidden": true })
|
|
3278
3354
|
}
|
|
3279
3355
|
),
|
|
3280
|
-
/* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ jsx49(
|
|
3281
3357
|
Button,
|
|
3282
3358
|
{
|
|
3283
3359
|
type: "button",
|
|
@@ -3285,10 +3361,10 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3285
3361
|
size: "icon-sm",
|
|
3286
3362
|
"aria-label": "Delete question",
|
|
3287
3363
|
onClick: onDelete,
|
|
3288
|
-
children: /* @__PURE__ */
|
|
3364
|
+
children: /* @__PURE__ */ jsx49(Trash4, { size: 16, "aria-hidden": true })
|
|
3289
3365
|
}
|
|
3290
3366
|
),
|
|
3291
|
-
/* @__PURE__ */
|
|
3367
|
+
/* @__PURE__ */ jsx49(
|
|
3292
3368
|
Button,
|
|
3293
3369
|
{
|
|
3294
3370
|
type: "button",
|
|
@@ -3296,7 +3372,7 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3296
3372
|
size: "icon-sm",
|
|
3297
3373
|
"aria-label": "Preview question",
|
|
3298
3374
|
onClick: onPreview,
|
|
3299
|
-
children: /* @__PURE__ */
|
|
3375
|
+
children: /* @__PURE__ */ jsx49(Eye, { size: 16, "aria-hidden": true })
|
|
3300
3376
|
}
|
|
3301
3377
|
)
|
|
3302
3378
|
] })
|
|
@@ -3304,18 +3380,18 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3304
3380
|
),
|
|
3305
3381
|
children
|
|
3306
3382
|
] }),
|
|
3307
|
-
error && /* @__PURE__ */
|
|
3308
|
-
/* @__PURE__ */
|
|
3383
|
+
error && /* @__PURE__ */ jsxs36("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3384
|
+
/* @__PURE__ */ jsx49(Warning2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3309
3385
|
error
|
|
3310
3386
|
] }),
|
|
3311
|
-
footer && /* @__PURE__ */
|
|
3312
|
-
/* @__PURE__ */
|
|
3313
|
-
/* @__PURE__ */
|
|
3314
|
-
onAdd && /* @__PURE__ */
|
|
3315
|
-
/* @__PURE__ */
|
|
3387
|
+
footer && /* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between", children: [
|
|
3388
|
+
/* @__PURE__ */ jsx49("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3389
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
3390
|
+
onAdd && /* @__PURE__ */ jsxs36(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3391
|
+
/* @__PURE__ */ jsx49(Plus3, { size: 16, "aria-hidden": true }),
|
|
3316
3392
|
"Add choice"
|
|
3317
3393
|
] }),
|
|
3318
|
-
onPaste && /* @__PURE__ */
|
|
3394
|
+
onPaste && /* @__PURE__ */ jsx49(
|
|
3319
3395
|
Button,
|
|
3320
3396
|
{
|
|
3321
3397
|
type: "button",
|
|
@@ -3323,17 +3399,17 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3323
3399
|
size: "icon",
|
|
3324
3400
|
"aria-label": "Paste choices",
|
|
3325
3401
|
onClick: onPaste,
|
|
3326
|
-
children: /* @__PURE__ */
|
|
3402
|
+
children: /* @__PURE__ */ jsx49(Clipboard, { size: 16, "aria-hidden": true })
|
|
3327
3403
|
}
|
|
3328
3404
|
)
|
|
3329
3405
|
] })
|
|
3330
3406
|
] })
|
|
3331
3407
|
] }),
|
|
3332
|
-
note && /* @__PURE__ */
|
|
3408
|
+
note && /* @__PURE__ */ jsx49("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
3333
3409
|
]
|
|
3334
3410
|
}
|
|
3335
3411
|
),
|
|
3336
|
-
onAskAi && /* @__PURE__ */
|
|
3412
|
+
onAskAi && /* @__PURE__ */ jsx49(
|
|
3337
3413
|
Button,
|
|
3338
3414
|
{
|
|
3339
3415
|
type: "button",
|
|
@@ -3342,7 +3418,7 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3342
3418
|
"aria-label": "Ask AI",
|
|
3343
3419
|
onClick: onAskAi,
|
|
3344
3420
|
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__ */
|
|
3421
|
+
children: /* @__PURE__ */ jsx49(Sparkle2, { size: 16, "aria-hidden": true })
|
|
3346
3422
|
}
|
|
3347
3423
|
)
|
|
3348
3424
|
]
|
|
@@ -3353,15 +3429,15 @@ var QuestionEditorCard = React46.forwardRef(
|
|
|
3353
3429
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
3354
3430
|
|
|
3355
3431
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
3356
|
-
import * as
|
|
3432
|
+
import * as React49 from "react";
|
|
3357
3433
|
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3, WarningCircle as WarningCircle5 } from "@phosphor-icons/react";
|
|
3358
3434
|
import { Slot as Slot3 } from "radix-ui";
|
|
3359
|
-
import { jsx as
|
|
3360
|
-
var QuestionNavItem =
|
|
3435
|
+
import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3436
|
+
var QuestionNavItem = React49.forwardRef(
|
|
3361
3437
|
({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3362
3438
|
const Comp = asChild ? Slot3.Root : "button";
|
|
3363
3439
|
const warn = !error && !!warning;
|
|
3364
|
-
return /* @__PURE__ */
|
|
3440
|
+
return /* @__PURE__ */ jsxs37(
|
|
3365
3441
|
Comp,
|
|
3366
3442
|
{
|
|
3367
3443
|
ref,
|
|
@@ -3380,9 +3456,9 @@ var QuestionNavItem = React47.forwardRef(
|
|
|
3380
3456
|
),
|
|
3381
3457
|
...props,
|
|
3382
3458
|
children: [
|
|
3383
|
-
/* @__PURE__ */
|
|
3384
|
-
showDragHandle && /* @__PURE__ */
|
|
3385
|
-
/* @__PURE__ */
|
|
3459
|
+
/* @__PURE__ */ jsxs37("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3460
|
+
showDragHandle && /* @__PURE__ */ jsx50(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3461
|
+
/* @__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
3462
|
QuestionTypeIcon,
|
|
3387
3463
|
{
|
|
3388
3464
|
type: questionType,
|
|
@@ -3391,9 +3467,9 @@ var QuestionNavItem = React47.forwardRef(
|
|
|
3391
3467
|
}
|
|
3392
3468
|
) })
|
|
3393
3469
|
] }),
|
|
3394
|
-
/* @__PURE__ */
|
|
3395
|
-
error && /* @__PURE__ */
|
|
3396
|
-
warn && /* @__PURE__ */
|
|
3470
|
+
/* @__PURE__ */ jsx50("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3471
|
+
error && /* @__PURE__ */ jsx50("span", { className: "sr-only", children: ", has errors" }),
|
|
3472
|
+
warn && /* @__PURE__ */ jsx50("span", { className: "sr-only", children: ", has warnings" })
|
|
3397
3473
|
]
|
|
3398
3474
|
}
|
|
3399
3475
|
);
|
|
@@ -3402,14 +3478,14 @@ var QuestionNavItem = React47.forwardRef(
|
|
|
3402
3478
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
3403
3479
|
|
|
3404
3480
|
// src/components/Question Types/QuestionOption.tsx
|
|
3405
|
-
import * as
|
|
3481
|
+
import * as React50 from "react";
|
|
3406
3482
|
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
|
|
3483
|
+
import { Fragment as Fragment12, jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3408
3484
|
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
3485
|
function QuestionOption(props) {
|
|
3410
|
-
const id =
|
|
3411
|
-
return /* @__PURE__ */
|
|
3412
|
-
props.kind === "checkbox" ? /* @__PURE__ */
|
|
3486
|
+
const id = React50.useId();
|
|
3487
|
+
return /* @__PURE__ */ jsxs38("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3488
|
+
props.kind === "checkbox" ? /* @__PURE__ */ jsx51(
|
|
3413
3489
|
Checkbox,
|
|
3414
3490
|
{
|
|
3415
3491
|
id,
|
|
@@ -3418,16 +3494,16 @@ function QuestionOption(props) {
|
|
|
3418
3494
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
3419
3495
|
disabled: props.disabled
|
|
3420
3496
|
}
|
|
3421
|
-
) : /* @__PURE__ */
|
|
3422
|
-
/* @__PURE__ */
|
|
3497
|
+
) : /* @__PURE__ */ jsx51(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3498
|
+
/* @__PURE__ */ jsx51("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3423
3499
|
] });
|
|
3424
3500
|
}
|
|
3425
|
-
var QuestionOtherOption =
|
|
3501
|
+
var QuestionOtherOption = React50.forwardRef(
|
|
3426
3502
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3427
|
-
const inner =
|
|
3428
|
-
|
|
3503
|
+
const inner = React50.useRef(null);
|
|
3504
|
+
React50.useImperativeHandle(ref, () => inner.current);
|
|
3429
3505
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3430
|
-
return /* @__PURE__ */
|
|
3506
|
+
return /* @__PURE__ */ jsxs38(
|
|
3431
3507
|
"div",
|
|
3432
3508
|
{
|
|
3433
3509
|
className: cn(
|
|
@@ -3435,7 +3511,7 @@ var QuestionOtherOption = React48.forwardRef(
|
|
|
3435
3511
|
className
|
|
3436
3512
|
),
|
|
3437
3513
|
children: [
|
|
3438
|
-
/* @__PURE__ */
|
|
3514
|
+
/* @__PURE__ */ jsx51(
|
|
3439
3515
|
"input",
|
|
3440
3516
|
{
|
|
3441
3517
|
ref: inner,
|
|
@@ -3451,7 +3527,7 @@ var QuestionOtherOption = React48.forwardRef(
|
|
|
3451
3527
|
...props
|
|
3452
3528
|
}
|
|
3453
3529
|
),
|
|
3454
|
-
/* @__PURE__ */
|
|
3530
|
+
/* @__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
3531
|
]
|
|
3456
3532
|
}
|
|
3457
3533
|
);
|
|
@@ -3466,16 +3542,16 @@ function limitsText2(min, max) {
|
|
|
3466
3542
|
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3467
3543
|
const reveal = kind !== void 0;
|
|
3468
3544
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3469
|
-
const [draft, setDraft] =
|
|
3470
|
-
const [error, setError] =
|
|
3471
|
-
const helperId =
|
|
3472
|
-
const [focused, setFocused] =
|
|
3545
|
+
const [draft, setDraft] = React50.useState(null);
|
|
3546
|
+
const [error, setError] = React50.useState(null);
|
|
3547
|
+
const helperId = React50.useId();
|
|
3548
|
+
const [focused, setFocused] = React50.useState(false);
|
|
3473
3549
|
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3474
|
-
const fieldRef =
|
|
3475
|
-
const [editMarks, setEditMarks] =
|
|
3476
|
-
const [scroll, setScroll] =
|
|
3550
|
+
const fieldRef = React50.useRef(null);
|
|
3551
|
+
const [editMarks, setEditMarks] = React50.useState([]);
|
|
3552
|
+
const [scroll, setScroll] = React50.useState(0);
|
|
3477
3553
|
const typed = guarded ? draft ?? label : label;
|
|
3478
|
-
const skipBlur =
|
|
3554
|
+
const skipBlur = React50.useRef(false);
|
|
3479
3555
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3480
3556
|
const save = () => {
|
|
3481
3557
|
if (draft === null) return true;
|
|
@@ -3496,9 +3572,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3496
3572
|
...dragHandleProps,
|
|
3497
3573
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3498
3574
|
} : { "aria-hidden": true };
|
|
3499
|
-
const grip = dragHandleProps ? /* @__PURE__ */
|
|
3500
|
-
return /* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
3575
|
+
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" });
|
|
3576
|
+
return /* @__PURE__ */ jsxs38("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3577
|
+
/* @__PURE__ */ jsx51(
|
|
3502
3578
|
"div",
|
|
3503
3579
|
{
|
|
3504
3580
|
className: cn(
|
|
@@ -3508,10 +3584,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3508
3584
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3509
3585
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3510
3586
|
),
|
|
3511
|
-
children: /* @__PURE__ */
|
|
3512
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */
|
|
3587
|
+
children: /* @__PURE__ */ jsxs38("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3588
|
+
(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
3589
|
!locked && grip,
|
|
3514
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsx51(
|
|
3515
3591
|
"span",
|
|
3516
3592
|
{
|
|
3517
3593
|
"aria-hidden": "true",
|
|
@@ -3519,8 +3595,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3519
3595
|
children: rank
|
|
3520
3596
|
}
|
|
3521
3597
|
)
|
|
3522
|
-
] }) : reveal && locked ? /* @__PURE__ */
|
|
3523
|
-
/* @__PURE__ */
|
|
3598
|
+
] }) : 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: [
|
|
3599
|
+
/* @__PURE__ */ jsx51(
|
|
3524
3600
|
"span",
|
|
3525
3601
|
{
|
|
3526
3602
|
"aria-hidden": "true",
|
|
@@ -3531,7 +3607,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3531
3607
|
)
|
|
3532
3608
|
}
|
|
3533
3609
|
),
|
|
3534
|
-
/* @__PURE__ */
|
|
3610
|
+
/* @__PURE__ */ jsx51(
|
|
3535
3611
|
DotsSixVertical3,
|
|
3536
3612
|
{
|
|
3537
3613
|
size: 20,
|
|
@@ -3543,10 +3619,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3543
3619
|
}
|
|
3544
3620
|
)
|
|
3545
3621
|
] }) : locked ? null : grip }),
|
|
3546
|
-
/* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3548
|
-
focused && editMarks.length > 0 && /* @__PURE__ */
|
|
3549
|
-
/* @__PURE__ */
|
|
3622
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3623
|
+
/* @__PURE__ */ jsxs38("div", { className: "relative min-w-0", children: [
|
|
3624
|
+
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" }),
|
|
3625
|
+
/* @__PURE__ */ jsx51(
|
|
3550
3626
|
"input",
|
|
3551
3627
|
{
|
|
3552
3628
|
ref: fieldRef,
|
|
@@ -3601,24 +3677,24 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3601
3677
|
)
|
|
3602
3678
|
}
|
|
3603
3679
|
),
|
|
3604
|
-
focused && editMarks.length > 0 && /* @__PURE__ */
|
|
3605
|
-
showMarks && /* @__PURE__ */
|
|
3606
|
-
(piece, i) => piece.mark ? /* @__PURE__ */
|
|
3680
|
+
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" }),
|
|
3681
|
+
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(
|
|
3682
|
+
(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
3683
|
) })
|
|
3608
3684
|
] }),
|
|
3609
|
-
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */
|
|
3685
|
+
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ jsxs38(
|
|
3610
3686
|
"p",
|
|
3611
3687
|
{
|
|
3612
3688
|
id: helperId,
|
|
3613
3689
|
role: error ? "alert" : void 0,
|
|
3614
3690
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3615
3691
|
children: [
|
|
3616
|
-
/* @__PURE__ */
|
|
3617
|
-
error && /* @__PURE__ */
|
|
3692
|
+
/* @__PURE__ */ jsxs38("span", { className: "flex items-start gap-2", children: [
|
|
3693
|
+
error && /* @__PURE__ */ jsx51(WarningCircle6, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3618
3694
|
limitsText2(minLength, maxLength),
|
|
3619
|
-
error && /* @__PURE__ */
|
|
3695
|
+
error && /* @__PURE__ */ jsx51("span", { className: "sr-only", children: error })
|
|
3620
3696
|
] }),
|
|
3621
|
-
/* @__PURE__ */
|
|
3697
|
+
/* @__PURE__ */ jsxs38("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3622
3698
|
draft.length,
|
|
3623
3699
|
maxLength !== void 0 && `/${maxLength}`
|
|
3624
3700
|
] })
|
|
@@ -3629,7 +3705,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3629
3705
|
] })
|
|
3630
3706
|
}
|
|
3631
3707
|
),
|
|
3632
|
-
!locked && /* @__PURE__ */
|
|
3708
|
+
!locked && /* @__PURE__ */ jsxs38(
|
|
3633
3709
|
"div",
|
|
3634
3710
|
{
|
|
3635
3711
|
className: cn(
|
|
@@ -3637,8 +3713,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3637
3713
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3638
3714
|
),
|
|
3639
3715
|
children: [
|
|
3640
|
-
/* @__PURE__ */
|
|
3641
|
-
/* @__PURE__ */
|
|
3716
|
+
/* @__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 }) }),
|
|
3717
|
+
/* @__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
3718
|
]
|
|
3643
3719
|
}
|
|
3644
3720
|
)
|
|
@@ -3646,9 +3722,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3646
3722
|
}
|
|
3647
3723
|
|
|
3648
3724
|
// src/components/Question Types/RankList.tsx
|
|
3649
|
-
import * as
|
|
3725
|
+
import * as React51 from "react";
|
|
3650
3726
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
3651
|
-
import { Fragment as Fragment13, jsx as
|
|
3727
|
+
import { Fragment as Fragment13, jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3652
3728
|
function move(list, from, to) {
|
|
3653
3729
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3654
3730
|
const next = list.slice();
|
|
@@ -3656,13 +3732,13 @@ function move(list, from, to) {
|
|
|
3656
3732
|
next.splice(to, 0, item);
|
|
3657
3733
|
return next;
|
|
3658
3734
|
}
|
|
3659
|
-
var RankList =
|
|
3735
|
+
var RankList = React51.forwardRef(
|
|
3660
3736
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3661
|
-
const [dragIndex, setDragIndex] =
|
|
3662
|
-
const [announcement, setAnnouncement] =
|
|
3663
|
-
const handles =
|
|
3664
|
-
const refocus =
|
|
3665
|
-
|
|
3737
|
+
const [dragIndex, setDragIndex] = React51.useState(null);
|
|
3738
|
+
const [announcement, setAnnouncement] = React51.useState("");
|
|
3739
|
+
const handles = React51.useRef(/* @__PURE__ */ new Map());
|
|
3740
|
+
const refocus = React51.useRef(null);
|
|
3741
|
+
React51.useEffect(() => {
|
|
3666
3742
|
if (refocus.current) {
|
|
3667
3743
|
handles.current.get(refocus.current)?.focus();
|
|
3668
3744
|
refocus.current = null;
|
|
@@ -3675,8 +3751,8 @@ var RankList = React49.forwardRef(
|
|
|
3675
3751
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3676
3752
|
onItemsChange(next);
|
|
3677
3753
|
};
|
|
3678
|
-
return /* @__PURE__ */
|
|
3679
|
-
/* @__PURE__ */
|
|
3754
|
+
return /* @__PURE__ */ jsxs39(Fragment13, { children: [
|
|
3755
|
+
/* @__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
3756
|
"li",
|
|
3681
3757
|
{
|
|
3682
3758
|
draggable: true,
|
|
@@ -3693,7 +3769,7 @@ var RankList = React49.forwardRef(
|
|
|
3693
3769
|
dragIndex === index && "opacity-50"
|
|
3694
3770
|
),
|
|
3695
3771
|
children: [
|
|
3696
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ jsx52(
|
|
3697
3773
|
"button",
|
|
3698
3774
|
{
|
|
3699
3775
|
type: "button",
|
|
@@ -3712,10 +3788,10 @@ var RankList = React49.forwardRef(
|
|
|
3712
3788
|
}
|
|
3713
3789
|
},
|
|
3714
3790
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3715
|
-
children: /* @__PURE__ */
|
|
3791
|
+
children: /* @__PURE__ */ jsx52(DotsSixVertical4, { size: 16, "aria-hidden": true })
|
|
3716
3792
|
}
|
|
3717
3793
|
),
|
|
3718
|
-
/* @__PURE__ */
|
|
3794
|
+
/* @__PURE__ */ jsx52(
|
|
3719
3795
|
"span",
|
|
3720
3796
|
{
|
|
3721
3797
|
"aria-hidden": "true",
|
|
@@ -3723,27 +3799,27 @@ var RankList = React49.forwardRef(
|
|
|
3723
3799
|
children: index + 1
|
|
3724
3800
|
}
|
|
3725
3801
|
),
|
|
3726
|
-
/* @__PURE__ */
|
|
3802
|
+
/* @__PURE__ */ jsx52("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3727
3803
|
]
|
|
3728
3804
|
},
|
|
3729
3805
|
item.id
|
|
3730
3806
|
)) }),
|
|
3731
|
-
/* @__PURE__ */
|
|
3807
|
+
/* @__PURE__ */ jsx52("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3732
3808
|
] });
|
|
3733
3809
|
}
|
|
3734
3810
|
);
|
|
3735
3811
|
RankList.displayName = "RankList";
|
|
3736
3812
|
|
|
3737
3813
|
// src/components/Question Types/RatingScale.tsx
|
|
3738
|
-
import * as
|
|
3814
|
+
import * as React52 from "react";
|
|
3739
3815
|
import { ToggleGroup as ToggleGroupPrimitive3 } from "radix-ui";
|
|
3740
|
-
import { jsx as
|
|
3741
|
-
var RatingScale =
|
|
3816
|
+
import { jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3817
|
+
var RatingScale = React52.forwardRef(
|
|
3742
3818
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3743
|
-
const [internal, setInternal] =
|
|
3819
|
+
const [internal, setInternal] = React52.useState(defaultValue);
|
|
3744
3820
|
const current = value !== void 0 ? value : internal;
|
|
3745
|
-
return /* @__PURE__ */
|
|
3746
|
-
/* @__PURE__ */
|
|
3821
|
+
return /* @__PURE__ */ jsxs40("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3822
|
+
/* @__PURE__ */ jsx53(
|
|
3747
3823
|
ToggleGroupPrimitive3.Root,
|
|
3748
3824
|
{
|
|
3749
3825
|
ref,
|
|
@@ -3756,7 +3832,7 @@ var RatingScale = React50.forwardRef(
|
|
|
3756
3832
|
},
|
|
3757
3833
|
className: "flex gap-2",
|
|
3758
3834
|
...props,
|
|
3759
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */
|
|
3835
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsx53(
|
|
3760
3836
|
ToggleGroupPrimitive3.Item,
|
|
3761
3837
|
{
|
|
3762
3838
|
value: String(n),
|
|
@@ -3772,9 +3848,9 @@ var RatingScale = React50.forwardRef(
|
|
|
3772
3848
|
))
|
|
3773
3849
|
}
|
|
3774
3850
|
),
|
|
3775
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */
|
|
3776
|
-
/* @__PURE__ */
|
|
3777
|
-
/* @__PURE__ */
|
|
3851
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ jsxs40("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3852
|
+
/* @__PURE__ */ jsx53("span", { children: lowLabel }),
|
|
3853
|
+
/* @__PURE__ */ jsx53("span", { children: highLabel })
|
|
3778
3854
|
] })
|
|
3779
3855
|
] });
|
|
3780
3856
|
}
|
|
@@ -3782,12 +3858,12 @@ var RatingScale = React50.forwardRef(
|
|
|
3782
3858
|
RatingScale.displayName = "RatingScale";
|
|
3783
3859
|
|
|
3784
3860
|
// src/components/Question Types/StimulusCard.tsx
|
|
3785
|
-
import * as
|
|
3861
|
+
import * as React53 from "react";
|
|
3786
3862
|
import { Image as ImageIcon2, ImageBroken, Trash as Trash6 } from "@phosphor-icons/react";
|
|
3787
|
-
import { jsx as
|
|
3863
|
+
import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3788
3864
|
var MIN_THUMBNAIL = 92;
|
|
3789
3865
|
var MAX_THUMBNAIL = 240;
|
|
3790
|
-
var StimulusCard =
|
|
3866
|
+
var StimulusCard = React53.forwardRef(
|
|
3791
3867
|
({
|
|
3792
3868
|
className,
|
|
3793
3869
|
thumbnail,
|
|
@@ -3804,14 +3880,14 @@ var StimulusCard = React51.forwardRef(
|
|
|
3804
3880
|
removeLabel = "Remove stimulus",
|
|
3805
3881
|
...props
|
|
3806
3882
|
}, ref) => {
|
|
3807
|
-
const [failedSrc, setFailedSrc] =
|
|
3883
|
+
const [failedSrc, setFailedSrc] = React53.useState();
|
|
3808
3884
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3809
3885
|
const showImage = thumbnail !== void 0 && !error;
|
|
3810
|
-
const [draft, setDraft] =
|
|
3886
|
+
const [draft, setDraft] = React53.useState(null);
|
|
3811
3887
|
const count = (draft ?? caption ?? "").length;
|
|
3812
|
-
const textRef =
|
|
3813
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3814
|
-
|
|
3888
|
+
const textRef = React53.useRef(null);
|
|
3889
|
+
const [thumbnailSize, setThumbnailSize] = React53.useState(MIN_THUMBNAIL);
|
|
3890
|
+
React53.useEffect(() => {
|
|
3815
3891
|
const el = textRef.current;
|
|
3816
3892
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3817
3893
|
const observer = new ResizeObserver(() => {
|
|
@@ -3820,7 +3896,7 @@ var StimulusCard = React51.forwardRef(
|
|
|
3820
3896
|
observer.observe(el);
|
|
3821
3897
|
return () => observer.disconnect();
|
|
3822
3898
|
}, []);
|
|
3823
|
-
return /* @__PURE__ */
|
|
3899
|
+
return /* @__PURE__ */ jsxs41(
|
|
3824
3900
|
"div",
|
|
3825
3901
|
{
|
|
3826
3902
|
ref,
|
|
@@ -3828,8 +3904,8 @@ var StimulusCard = React51.forwardRef(
|
|
|
3828
3904
|
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
3905
|
...props,
|
|
3830
3906
|
children: [
|
|
3831
|
-
/* @__PURE__ */
|
|
3832
|
-
/* @__PURE__ */
|
|
3907
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3908
|
+
/* @__PURE__ */ jsx54(
|
|
3833
3909
|
"span",
|
|
3834
3910
|
{
|
|
3835
3911
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3840,13 +3916,13 @@ var StimulusCard = React51.forwardRef(
|
|
|
3840
3916
|
),
|
|
3841
3917
|
children: showImage ? (
|
|
3842
3918
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3843
|
-
/* @__PURE__ */
|
|
3844
|
-
) : error ? /* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsx54("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) })
|
|
3920
|
+
) : error ? /* @__PURE__ */ jsx54(ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ jsx54(ImageIcon2, { size: 24, "aria-hidden": true })
|
|
3845
3921
|
}
|
|
3846
3922
|
),
|
|
3847
|
-
/* @__PURE__ */
|
|
3848
|
-
/* @__PURE__ */
|
|
3849
|
-
onCaptionChange ? /* @__PURE__ */
|
|
3923
|
+
/* @__PURE__ */ jsxs41("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
3924
|
+
/* @__PURE__ */ jsx54("p", { className: "w-full text-ui-label", children: label }),
|
|
3925
|
+
onCaptionChange ? /* @__PURE__ */ jsx54(
|
|
3850
3926
|
InlineEdit,
|
|
3851
3927
|
{
|
|
3852
3928
|
variant: "question",
|
|
@@ -3863,8 +3939,8 @@ var StimulusCard = React51.forwardRef(
|
|
|
3863
3939
|
},
|
|
3864
3940
|
textClassName: "text-body-base"
|
|
3865
3941
|
}
|
|
3866
|
-
) : /* @__PURE__ */
|
|
3867
|
-
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */
|
|
3942
|
+
) : /* @__PURE__ */ jsx54("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
3943
|
+
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs41("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3868
3944
|
count,
|
|
3869
3945
|
"/",
|
|
3870
3946
|
maxLength,
|
|
@@ -3872,7 +3948,7 @@ var StimulusCard = React51.forwardRef(
|
|
|
3872
3948
|
] })
|
|
3873
3949
|
] })
|
|
3874
3950
|
] }),
|
|
3875
|
-
onRemove && /* @__PURE__ */
|
|
3951
|
+
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
3952
|
]
|
|
3877
3953
|
}
|
|
3878
3954
|
);
|
|
@@ -3881,27 +3957,27 @@ var StimulusCard = React51.forwardRef(
|
|
|
3881
3957
|
StimulusCard.displayName = "StimulusCard";
|
|
3882
3958
|
|
|
3883
3959
|
// src/components/Data Display/Progress.tsx
|
|
3884
|
-
import * as
|
|
3960
|
+
import * as React54 from "react";
|
|
3885
3961
|
import { Progress as ProgressPrimitive2 } from "radix-ui";
|
|
3886
|
-
import { jsx as
|
|
3887
|
-
var Progress =
|
|
3962
|
+
import { jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3963
|
+
var Progress = React54.forwardRef(
|
|
3888
3964
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3889
3965
|
const hasHeader = label != null || valueLabel != null;
|
|
3890
3966
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3891
3967
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3892
|
-
return /* @__PURE__ */
|
|
3893
|
-
hasHeader && /* @__PURE__ */
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3968
|
+
return /* @__PURE__ */ jsxs42("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
3969
|
+
hasHeader && /* @__PURE__ */ jsxs42("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
3970
|
+
/* @__PURE__ */ jsx55("span", { children: label }),
|
|
3971
|
+
/* @__PURE__ */ jsx55("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3896
3972
|
] }),
|
|
3897
|
-
/* @__PURE__ */
|
|
3973
|
+
/* @__PURE__ */ jsx55(
|
|
3898
3974
|
ProgressPrimitive2.Root,
|
|
3899
3975
|
{
|
|
3900
3976
|
ref,
|
|
3901
3977
|
value: clamped,
|
|
3902
3978
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3903
3979
|
...props,
|
|
3904
|
-
children: /* @__PURE__ */
|
|
3980
|
+
children: /* @__PURE__ */ jsx55(
|
|
3905
3981
|
ProgressPrimitive2.Indicator,
|
|
3906
3982
|
{
|
|
3907
3983
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3910,9 +3986,9 @@ var Progress = React52.forwardRef(
|
|
|
3910
3986
|
)
|
|
3911
3987
|
}
|
|
3912
3988
|
),
|
|
3913
|
-
hasDetails && /* @__PURE__ */
|
|
3914
|
-
/* @__PURE__ */
|
|
3915
|
-
/* @__PURE__ */
|
|
3989
|
+
hasDetails && /* @__PURE__ */ jsxs42("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3990
|
+
/* @__PURE__ */ jsx55("span", { children: detailsStart }),
|
|
3991
|
+
/* @__PURE__ */ jsx55("span", { children: detailsEnd })
|
|
3916
3992
|
] })
|
|
3917
3993
|
] });
|
|
3918
3994
|
}
|
|
@@ -3920,11 +3996,11 @@ var Progress = React52.forwardRef(
|
|
|
3920
3996
|
Progress.displayName = "Progress";
|
|
3921
3997
|
|
|
3922
3998
|
// 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__ */
|
|
3999
|
+
import * as React55 from "react";
|
|
4000
|
+
import { CaretDown as CaretDown5, CaretUp } from "@phosphor-icons/react";
|
|
4001
|
+
import { jsx as jsx56, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4002
|
+
var Table = React55.forwardRef(
|
|
4003
|
+
({ 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
4004
|
"table",
|
|
3929
4005
|
{
|
|
3930
4006
|
ref,
|
|
@@ -3935,20 +4011,20 @@ var Table = React53.forwardRef(
|
|
|
3935
4011
|
) })
|
|
3936
4012
|
);
|
|
3937
4013
|
Table.displayName = "Table";
|
|
3938
|
-
var TableHeader =
|
|
3939
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4014
|
+
var TableHeader = React55.forwardRef(
|
|
4015
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx56("thead", { ref, className, ...props })
|
|
3940
4016
|
);
|
|
3941
4017
|
TableHeader.displayName = "TableHeader";
|
|
3942
|
-
var TableFooter =
|
|
3943
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4018
|
+
var TableFooter = React55.forwardRef(
|
|
4019
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx56("tfoot", { ref, className: cn("border-t border-border bg-background text-ui-label", className), ...props })
|
|
3944
4020
|
);
|
|
3945
4021
|
TableFooter.displayName = "TableFooter";
|
|
3946
|
-
var TableBody =
|
|
3947
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
4022
|
+
var TableBody = React55.forwardRef(
|
|
4023
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx56("tbody", { ref, className, ...props })
|
|
3948
4024
|
);
|
|
3949
4025
|
TableBody.displayName = "TableBody";
|
|
3950
|
-
var TableRow =
|
|
3951
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */
|
|
4026
|
+
var TableRow = React55.forwardRef(
|
|
4027
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ jsx56(
|
|
3952
4028
|
"tr",
|
|
3953
4029
|
{
|
|
3954
4030
|
ref,
|
|
@@ -3965,10 +4041,10 @@ var TableRow = React53.forwardRef(
|
|
|
3965
4041
|
);
|
|
3966
4042
|
TableRow.displayName = "TableRow";
|
|
3967
4043
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3968
|
-
var TableHead =
|
|
4044
|
+
var TableHead = React55.forwardRef(
|
|
3969
4045
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, resizer, children, ...props }, ref) => {
|
|
3970
|
-
const caret = sort === "asc" ? /* @__PURE__ */
|
|
3971
|
-
return /* @__PURE__ */
|
|
4046
|
+
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" });
|
|
4047
|
+
return /* @__PURE__ */ jsxs43(
|
|
3972
4048
|
"th",
|
|
3973
4049
|
{
|
|
3974
4050
|
ref,
|
|
@@ -3983,7 +4059,7 @@ var TableHead = React53.forwardRef(
|
|
|
3983
4059
|
),
|
|
3984
4060
|
...props,
|
|
3985
4061
|
children: [
|
|
3986
|
-
sortable ? /* @__PURE__ */
|
|
4062
|
+
sortable ? /* @__PURE__ */ jsxs43(
|
|
3987
4063
|
"button",
|
|
3988
4064
|
{
|
|
3989
4065
|
type: "button",
|
|
@@ -3994,7 +4070,7 @@ var TableHead = React53.forwardRef(
|
|
|
3994
4070
|
caret
|
|
3995
4071
|
]
|
|
3996
4072
|
}
|
|
3997
|
-
) : checkbox ? /* @__PURE__ */
|
|
4073
|
+
) : checkbox ? /* @__PURE__ */ jsx56("div", { className: "flex items-center justify-center", children }) : children,
|
|
3998
4074
|
resizer
|
|
3999
4075
|
]
|
|
4000
4076
|
}
|
|
@@ -4002,8 +4078,8 @@ var TableHead = React53.forwardRef(
|
|
|
4002
4078
|
}
|
|
4003
4079
|
);
|
|
4004
4080
|
TableHead.displayName = "TableHead";
|
|
4005
|
-
var TableCell =
|
|
4006
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */
|
|
4081
|
+
var TableCell = React55.forwardRef(
|
|
4082
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ jsx56(
|
|
4007
4083
|
"td",
|
|
4008
4084
|
{
|
|
4009
4085
|
ref,
|
|
@@ -4016,24 +4092,24 @@ var TableCell = React53.forwardRef(
|
|
|
4016
4092
|
className
|
|
4017
4093
|
),
|
|
4018
4094
|
...props,
|
|
4019
|
-
children: checkbox ? /* @__PURE__ */
|
|
4095
|
+
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
4096
|
}
|
|
4021
4097
|
)
|
|
4022
4098
|
);
|
|
4023
4099
|
TableCell.displayName = "TableCell";
|
|
4024
4100
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
4025
|
-
return /* @__PURE__ */
|
|
4101
|
+
return /* @__PURE__ */ jsxs43("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
4026
4102
|
avatar,
|
|
4027
|
-
/* @__PURE__ */
|
|
4028
|
-
/* @__PURE__ */
|
|
4029
|
-
secondary && /* @__PURE__ */
|
|
4103
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
4104
|
+
/* @__PURE__ */ jsx56("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
4105
|
+
secondary && /* @__PURE__ */ jsx56("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
4030
4106
|
] })
|
|
4031
4107
|
] });
|
|
4032
4108
|
}
|
|
4033
4109
|
|
|
4034
4110
|
// src/components/Data Display/DataTable.tsx
|
|
4035
|
-
import * as
|
|
4036
|
-
import { CaretDown as
|
|
4111
|
+
import * as React57 from "react";
|
|
4112
|
+
import { CaretDown as CaretDown6, CaretRight as CaretRight4, PushPin, PushPinSlash, Rows, Sliders, Stack } from "@phosphor-icons/react";
|
|
4037
4113
|
import {
|
|
4038
4114
|
aggregationFn_count,
|
|
4039
4115
|
aggregationFn_extent,
|
|
@@ -4085,9 +4161,9 @@ import {
|
|
|
4085
4161
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4086
4162
|
|
|
4087
4163
|
// src/components/Utility/Pagination.tsx
|
|
4088
|
-
import * as
|
|
4164
|
+
import * as React56 from "react";
|
|
4089
4165
|
import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
|
|
4090
|
-
import { jsx as
|
|
4166
|
+
import { jsx as jsx57, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4091
4167
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
4092
4168
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
4093
4169
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -4101,10 +4177,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
4101
4177
|
});
|
|
4102
4178
|
return items;
|
|
4103
4179
|
}
|
|
4104
|
-
var Pagination =
|
|
4180
|
+
var Pagination = React56.forwardRef(
|
|
4105
4181
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
4106
4182
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
4107
|
-
const previous = /* @__PURE__ */
|
|
4183
|
+
const previous = /* @__PURE__ */ jsx57(
|
|
4108
4184
|
Button,
|
|
4109
4185
|
{
|
|
4110
4186
|
type: "button",
|
|
@@ -4113,10 +4189,10 @@ var Pagination = React54.forwardRef(
|
|
|
4113
4189
|
"aria-label": "Previous page",
|
|
4114
4190
|
disabled: page <= 1,
|
|
4115
4191
|
onClick: () => go(page - 1),
|
|
4116
|
-
children: /* @__PURE__ */
|
|
4192
|
+
children: /* @__PURE__ */ jsx57(ArrowLeft, { size: 16, "aria-hidden": true })
|
|
4117
4193
|
}
|
|
4118
4194
|
);
|
|
4119
|
-
const next = /* @__PURE__ */
|
|
4195
|
+
const next = /* @__PURE__ */ jsx57(
|
|
4120
4196
|
Button,
|
|
4121
4197
|
{
|
|
4122
4198
|
type: "button",
|
|
@@ -4125,10 +4201,10 @@ var Pagination = React54.forwardRef(
|
|
|
4125
4201
|
"aria-label": "Next page",
|
|
4126
4202
|
disabled: page >= pageCount,
|
|
4127
4203
|
onClick: () => go(page + 1),
|
|
4128
|
-
children: /* @__PURE__ */
|
|
4204
|
+
children: /* @__PURE__ */ jsx57(ArrowRight, { size: 16, "aria-hidden": true })
|
|
4129
4205
|
}
|
|
4130
4206
|
);
|
|
4131
|
-
return /* @__PURE__ */
|
|
4207
|
+
return /* @__PURE__ */ jsxs44(
|
|
4132
4208
|
"nav",
|
|
4133
4209
|
{
|
|
4134
4210
|
ref,
|
|
@@ -4137,14 +4213,14 @@ var Pagination = React54.forwardRef(
|
|
|
4137
4213
|
...props,
|
|
4138
4214
|
children: [
|
|
4139
4215
|
previous,
|
|
4140
|
-
variant === "compact" ? /* @__PURE__ */
|
|
4216
|
+
variant === "compact" ? /* @__PURE__ */ jsxs44("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
4141
4217
|
page,
|
|
4142
4218
|
"/",
|
|
4143
4219
|
pageCount
|
|
4144
|
-
] }) : /* @__PURE__ */
|
|
4145
|
-
/* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4147
|
-
] }) : /* @__PURE__ */
|
|
4220
|
+
] }) : /* @__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: [
|
|
4221
|
+
/* @__PURE__ */ jsx57(DotsThree2, { size: 16, "aria-hidden": true }),
|
|
4222
|
+
/* @__PURE__ */ jsx57("span", { className: "sr-only", children: "More pages" })
|
|
4223
|
+
] }) : /* @__PURE__ */ jsx57(
|
|
4148
4224
|
Button,
|
|
4149
4225
|
{
|
|
4150
4226
|
type: "button",
|
|
@@ -4165,7 +4241,7 @@ var Pagination = React54.forwardRef(
|
|
|
4165
4241
|
Pagination.displayName = "Pagination";
|
|
4166
4242
|
|
|
4167
4243
|
// src/components/Data Display/DataTable.tsx
|
|
4168
|
-
import { Fragment as Fragment15, jsx as
|
|
4244
|
+
import { Fragment as Fragment15, jsx as jsx58, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4169
4245
|
var features = tableFeatures({
|
|
4170
4246
|
rowSortingFeature,
|
|
4171
4247
|
rowPaginationFeature,
|
|
@@ -4220,9 +4296,9 @@ var features = tableFeatures({
|
|
|
4220
4296
|
});
|
|
4221
4297
|
var getMeta = (meta) => meta ?? {};
|
|
4222
4298
|
function useControllable(value, initial, onChange) {
|
|
4223
|
-
const [internal, setInternal] =
|
|
4299
|
+
const [internal, setInternal] = React57.useState(initial);
|
|
4224
4300
|
const current = value ?? internal;
|
|
4225
|
-
const update =
|
|
4301
|
+
const update = React57.useCallback(
|
|
4226
4302
|
(updater) => {
|
|
4227
4303
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
4228
4304
|
if (value === void 0) setInternal(next);
|
|
@@ -4261,16 +4337,16 @@ function ColumnFilter({ column }) {
|
|
|
4261
4337
|
const value = column.getFilterValue();
|
|
4262
4338
|
if (variant === "select") {
|
|
4263
4339
|
const options = [...column.getFacetedUniqueValues().entries()].sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
4264
|
-
return /* @__PURE__ */
|
|
4340
|
+
return /* @__PURE__ */ jsxs45(
|
|
4265
4341
|
Select,
|
|
4266
4342
|
{
|
|
4267
4343
|
value: typeof value === "string" ? value : ALL,
|
|
4268
4344
|
onValueChange: (next) => column.setFilterValue(next === ALL ? void 0 : next),
|
|
4269
4345
|
children: [
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
options.map(([option, count]) => /* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsx58(SelectTrigger, { "aria-label": `Filter ${label}`, className: "h-8 text-body-small", children: /* @__PURE__ */ jsx58(SelectValue, {}) }),
|
|
4347
|
+
/* @__PURE__ */ jsxs45(SelectContent, { children: [
|
|
4348
|
+
/* @__PURE__ */ jsx58(SelectItem, { value: ALL, children: "All" }),
|
|
4349
|
+
options.map(([option, count]) => /* @__PURE__ */ jsxs45(SelectItem, { value: String(option), children: [
|
|
4274
4350
|
String(option),
|
|
4275
4351
|
" (",
|
|
4276
4352
|
count,
|
|
@@ -4289,8 +4365,8 @@ function ColumnFilter({ column }) {
|
|
|
4289
4365
|
next[index] = raw === "" ? void 0 : Number(raw);
|
|
4290
4366
|
column.setFilterValue(next[0] === void 0 && next[1] === void 0 ? void 0 : next);
|
|
4291
4367
|
};
|
|
4292
|
-
return /* @__PURE__ */
|
|
4293
|
-
/* @__PURE__ */
|
|
4368
|
+
return /* @__PURE__ */ jsxs45("div", { className: "flex gap-1", children: [
|
|
4369
|
+
/* @__PURE__ */ jsx58(
|
|
4294
4370
|
Input,
|
|
4295
4371
|
{
|
|
4296
4372
|
type: "number",
|
|
@@ -4301,7 +4377,7 @@ function ColumnFilter({ column }) {
|
|
|
4301
4377
|
className: "h-8 text-body-small"
|
|
4302
4378
|
}
|
|
4303
4379
|
),
|
|
4304
|
-
/* @__PURE__ */
|
|
4380
|
+
/* @__PURE__ */ jsx58(
|
|
4305
4381
|
Input,
|
|
4306
4382
|
{
|
|
4307
4383
|
type: "number",
|
|
@@ -4314,7 +4390,7 @@ function ColumnFilter({ column }) {
|
|
|
4314
4390
|
)
|
|
4315
4391
|
] });
|
|
4316
4392
|
}
|
|
4317
|
-
return /* @__PURE__ */
|
|
4393
|
+
return /* @__PURE__ */ jsx58(
|
|
4318
4394
|
Input,
|
|
4319
4395
|
{
|
|
4320
4396
|
"aria-label": `Filter ${label}`,
|
|
@@ -4327,9 +4403,9 @@ function ColumnFilter({ column }) {
|
|
|
4327
4403
|
}
|
|
4328
4404
|
function EditableCell({ value, label, type, onCommit }) {
|
|
4329
4405
|
const initial = value == null ? "" : String(value);
|
|
4330
|
-
const [draft, setDraft] =
|
|
4331
|
-
const cancelled =
|
|
4332
|
-
return /* @__PURE__ */
|
|
4406
|
+
const [draft, setDraft] = React57.useState(null);
|
|
4407
|
+
const cancelled = React57.useRef(false);
|
|
4408
|
+
return /* @__PURE__ */ jsx58(
|
|
4333
4409
|
Input,
|
|
4334
4410
|
{
|
|
4335
4411
|
type,
|
|
@@ -4467,7 +4543,7 @@ function DataTableInner({
|
|
|
4467
4543
|
onPaginationChange
|
|
4468
4544
|
);
|
|
4469
4545
|
const [density, setDensity] = useControllable(densityProp, "default", onDensityChange);
|
|
4470
|
-
const [cellSelection, setCellSelection] =
|
|
4546
|
+
const [cellSelection, setCellSelection] = React57.useState([]);
|
|
4471
4547
|
const infinite = Boolean(onLoadMore);
|
|
4472
4548
|
const paginate = !virtualized && !infinite;
|
|
4473
4549
|
const compact = density === "compact";
|
|
@@ -4540,12 +4616,12 @@ function DataTableInner({
|
|
|
4540
4616
|
const cellDensity = compact ? "h-8 py-1.5" : void 0;
|
|
4541
4617
|
const allSelected = table.getIsAllPageRowsSelected();
|
|
4542
4618
|
const someSelected = table.getIsSomePageRowsSelected();
|
|
4543
|
-
const dragged =
|
|
4619
|
+
const dragged = React57.useRef(null);
|
|
4544
4620
|
const topRows = enableRowPinning ? table.getTopRows() : [];
|
|
4545
4621
|
const bottomRows = enableRowPinning ? table.getBottomRows() : [];
|
|
4546
4622
|
const bodyRows = enableRowPinning ? table.getCenterRows() : table.getRowModel().rows;
|
|
4547
|
-
const scrollRef =
|
|
4548
|
-
const setScrollRef =
|
|
4623
|
+
const scrollRef = React57.useRef(null);
|
|
4624
|
+
const setScrollRef = React57.useCallback(
|
|
4549
4625
|
(node) => {
|
|
4550
4626
|
scrollRef.current = node;
|
|
4551
4627
|
if (typeof containerRef === "function") containerRef(node);
|
|
@@ -4564,8 +4640,8 @@ function DataTableInner({
|
|
|
4564
4640
|
const virtualItems = virtualized ? virtualizer.getVirtualItems() : [];
|
|
4565
4641
|
const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
|
|
4566
4642
|
const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems.at(-1)?.end ?? 0) : 0;
|
|
4567
|
-
const sentinelRef =
|
|
4568
|
-
|
|
4643
|
+
const sentinelRef = React57.useRef(null);
|
|
4644
|
+
React57.useEffect(() => {
|
|
4569
4645
|
const node = sentinelRef.current;
|
|
4570
4646
|
if (!node || !onLoadMore || !hasMore || loadingMore || typeof IntersectionObserver === "undefined") return;
|
|
4571
4647
|
const container = scrollRef.current;
|
|
@@ -4606,15 +4682,15 @@ function DataTableInner({
|
|
|
4606
4682
|
table.resetCellSelection(true);
|
|
4607
4683
|
}
|
|
4608
4684
|
};
|
|
4609
|
-
const skeletonRow = (rowKey) => /* @__PURE__ */
|
|
4685
|
+
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
4686
|
const renderRow = (row, options = {}) => {
|
|
4611
4687
|
const { pinned, pinnedIndex = 0, pinnedCount = 1, virtualIndex } = options;
|
|
4612
4688
|
const grouped = row.getIsGrouped();
|
|
4613
4689
|
const rowUnits = compact ? 8 : 10;
|
|
4614
4690
|
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
4691
|
const cells = row.getVisibleCells();
|
|
4616
|
-
return /* @__PURE__ */
|
|
4617
|
-
/* @__PURE__ */
|
|
4692
|
+
return /* @__PURE__ */ jsxs45(React57.Fragment, { children: [
|
|
4693
|
+
/* @__PURE__ */ jsxs45(
|
|
4618
4694
|
TableRow,
|
|
4619
4695
|
{
|
|
4620
4696
|
ref: virtualized && virtualIndex !== void 0 ? virtualizer.measureElement : void 0,
|
|
@@ -4624,7 +4700,7 @@ function DataTableInner({
|
|
|
4624
4700
|
onClick: onRowClick && !grouped ? () => onRowClick(row.original) : void 0,
|
|
4625
4701
|
className: cn(pinned && "z-20 bg-surface", grouped && "bg-background", onRowClick && !grouped && "cursor-pointer"),
|
|
4626
4702
|
children: [
|
|
4627
|
-
enableRowSelection && /* @__PURE__ */
|
|
4703
|
+
enableRowSelection && /* @__PURE__ */ jsx58(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx58(
|
|
4628
4704
|
Checkbox,
|
|
4629
4705
|
{
|
|
4630
4706
|
"aria-label": "Select row",
|
|
@@ -4633,7 +4709,7 @@ function DataTableInner({
|
|
|
4633
4709
|
onCheckedChange: (checked) => row.toggleSelected(Boolean(checked))
|
|
4634
4710
|
}
|
|
4635
4711
|
) }),
|
|
4636
|
-
hasExpander && /* @__PURE__ */
|
|
4712
|
+
hasExpander && /* @__PURE__ */ jsx58(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && row.getCanExpand() && /* @__PURE__ */ jsx58(
|
|
4637
4713
|
Button,
|
|
4638
4714
|
{
|
|
4639
4715
|
type: "button",
|
|
@@ -4642,10 +4718,10 @@ function DataTableInner({
|
|
|
4642
4718
|
"aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
|
|
4643
4719
|
"aria-expanded": row.getIsExpanded(),
|
|
4644
4720
|
onClick: () => row.toggleExpanded(),
|
|
4645
|
-
children: row.getIsExpanded() ? /* @__PURE__ */
|
|
4721
|
+
children: row.getIsExpanded() ? /* @__PURE__ */ jsx58(CaretDown6, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx58(CaretRight4, { size: 16, "aria-hidden": true })
|
|
4646
4722
|
}
|
|
4647
4723
|
) }),
|
|
4648
|
-
enableRowPinning && /* @__PURE__ */
|
|
4724
|
+
enableRowPinning && /* @__PURE__ */ jsx58(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx58(
|
|
4649
4725
|
Button,
|
|
4650
4726
|
{
|
|
4651
4727
|
type: "button",
|
|
@@ -4654,7 +4730,7 @@ function DataTableInner({
|
|
|
4654
4730
|
"aria-label": row.getIsPinned() ? "Unpin row" : "Pin row to top",
|
|
4655
4731
|
"aria-pressed": Boolean(row.getIsPinned()),
|
|
4656
4732
|
onClick: () => row.pin(row.getIsPinned() ? false : "top"),
|
|
4657
|
-
children: row.getIsPinned() ? /* @__PURE__ */
|
|
4733
|
+
children: row.getIsPinned() ? /* @__PURE__ */ jsx58(PushPinSlash, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx58(PushPin, { size: 16, "aria-hidden": true })
|
|
4658
4734
|
}
|
|
4659
4735
|
) }),
|
|
4660
4736
|
cells.map((cell, index) => {
|
|
@@ -4667,7 +4743,7 @@ function DataTableInner({
|
|
|
4667
4743
|
const indent = index === 0 && hasExpander && row.depth > 0 ? row.depth * 4 : 0;
|
|
4668
4744
|
let content;
|
|
4669
4745
|
if (cell.getIsGrouped()) {
|
|
4670
|
-
content = /* @__PURE__ */
|
|
4746
|
+
content = /* @__PURE__ */ jsxs45(
|
|
4671
4747
|
"button",
|
|
4672
4748
|
{
|
|
4673
4749
|
type: "button",
|
|
@@ -4675,9 +4751,9 @@ function DataTableInner({
|
|
|
4675
4751
|
"aria-expanded": row.getIsExpanded(),
|
|
4676
4752
|
onClick: row.getToggleExpandedHandler(),
|
|
4677
4753
|
children: [
|
|
4678
|
-
row.getIsExpanded() ? /* @__PURE__ */
|
|
4754
|
+
row.getIsExpanded() ? /* @__PURE__ */ jsx58(CaretDown6, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx58(CaretRight4, { size: 16, "aria-hidden": true }),
|
|
4679
4755
|
flexRender(cell.column.columnDef.cell, cell.getContext()),
|
|
4680
|
-
/* @__PURE__ */
|
|
4756
|
+
/* @__PURE__ */ jsxs45("span", { className: "text-secondary-muted-foreground", children: [
|
|
4681
4757
|
"(",
|
|
4682
4758
|
row.subRows.length,
|
|
4683
4759
|
")"
|
|
@@ -4690,7 +4766,7 @@ function DataTableInner({
|
|
|
4690
4766
|
} else if (cell.getIsPlaceholder()) {
|
|
4691
4767
|
content = null;
|
|
4692
4768
|
} else if (meta.editable) {
|
|
4693
|
-
content = /* @__PURE__ */
|
|
4769
|
+
content = /* @__PURE__ */ jsx58(
|
|
4694
4770
|
EditableCell,
|
|
4695
4771
|
{
|
|
4696
4772
|
value: cell.getValue(),
|
|
@@ -4702,7 +4778,7 @@ function DataTableInner({
|
|
|
4702
4778
|
} else {
|
|
4703
4779
|
content = flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
4704
4780
|
}
|
|
4705
|
-
return /* @__PURE__ */
|
|
4781
|
+
return /* @__PURE__ */ jsx58(
|
|
4706
4782
|
TableCell,
|
|
4707
4783
|
{
|
|
4708
4784
|
align: meta.align,
|
|
@@ -4735,7 +4811,7 @@ function DataTableInner({
|
|
|
4735
4811
|
]
|
|
4736
4812
|
}
|
|
4737
4813
|
),
|
|
4738
|
-
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */
|
|
4814
|
+
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ jsx58(TableRow, { className: "bg-background hover:bg-background", children: /* @__PURE__ */ jsx58(TableCell, { colSpan: columnSpan, children: renderSubComponent(row.original) }) })
|
|
4739
4815
|
] }, row.id);
|
|
4740
4816
|
};
|
|
4741
4817
|
const renderHeaderCell = (header) => {
|
|
@@ -4746,7 +4822,7 @@ function DataTableInner({
|
|
|
4746
4822
|
const pin = pinning(column, sized, true);
|
|
4747
4823
|
const reorderable = enableColumnOrdering && leaf && !column.getIsPinned();
|
|
4748
4824
|
const label = labelOf(column);
|
|
4749
|
-
return /* @__PURE__ */
|
|
4825
|
+
return /* @__PURE__ */ jsx58(
|
|
4750
4826
|
TableHead,
|
|
4751
4827
|
{
|
|
4752
4828
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
@@ -4782,7 +4858,7 @@ function DataTableInner({
|
|
|
4782
4858
|
reorderable && "cursor-grab",
|
|
4783
4859
|
!leaf && "text-center"
|
|
4784
4860
|
),
|
|
4785
|
-
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */
|
|
4861
|
+
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ jsx58(
|
|
4786
4862
|
"div",
|
|
4787
4863
|
{
|
|
4788
4864
|
role: "separator",
|
|
@@ -4797,14 +4873,14 @@ function DataTableInner({
|
|
|
4797
4873
|
)
|
|
4798
4874
|
}
|
|
4799
4875
|
) : void 0,
|
|
4800
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */
|
|
4876
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ jsx58(table.FlexRender, { header })
|
|
4801
4877
|
},
|
|
4802
4878
|
header.id
|
|
4803
4879
|
);
|
|
4804
4880
|
};
|
|
4805
4881
|
const stickyLeading = cn(cellDensity, sticky && "sticky top-0 z-20 bg-surface");
|
|
4806
|
-
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */
|
|
4807
|
-
enableRowSelection && /* @__PURE__ */
|
|
4882
|
+
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
4883
|
+
enableRowSelection && /* @__PURE__ */ jsx58(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx58(
|
|
4808
4884
|
Checkbox,
|
|
4809
4885
|
{
|
|
4810
4886
|
"aria-label": "Select all rows",
|
|
@@ -4813,15 +4889,15 @@ function DataTableInner({
|
|
|
4813
4889
|
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(Boolean(checked))
|
|
4814
4890
|
}
|
|
4815
4891
|
) }),
|
|
4816
|
-
hasExpander && /* @__PURE__ */
|
|
4817
|
-
enableRowPinning && /* @__PURE__ */
|
|
4892
|
+
hasExpander && /* @__PURE__ */ jsx58(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx58("span", { className: "sr-only", children: "Expand" }) }),
|
|
4893
|
+
enableRowPinning && /* @__PURE__ */ jsx58(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx58("span", { className: "sr-only", children: "Pin" }) })
|
|
4818
4894
|
] });
|
|
4819
4895
|
const rowsToRender = virtualized ? virtualItems.map((item) => ({ row: bodyRows[item.index], index: item.index })) : null;
|
|
4820
4896
|
const totalRows = topRows.length + bodyRows.length + bottomRows.length;
|
|
4821
|
-
return /* @__PURE__ */
|
|
4822
|
-
showToolbar && /* @__PURE__ */
|
|
4823
|
-
/* @__PURE__ */
|
|
4824
|
-
enableGlobalFilter && /* @__PURE__ */
|
|
4897
|
+
return /* @__PURE__ */ jsxs45("div", { className: cn("flex w-full flex-col gap-2", wrapperClassName), children: [
|
|
4898
|
+
showToolbar && /* @__PURE__ */ jsxs45("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4899
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-2", children: [
|
|
4900
|
+
enableGlobalFilter && /* @__PURE__ */ jsx58(
|
|
4825
4901
|
SearchBar,
|
|
4826
4902
|
{
|
|
4827
4903
|
"aria-label": "Search table",
|
|
@@ -4834,8 +4910,8 @@ function DataTableInner({
|
|
|
4834
4910
|
),
|
|
4835
4911
|
toolbar
|
|
4836
4912
|
] }),
|
|
4837
|
-
/* @__PURE__ */
|
|
4838
|
-
enableDensityToggle && /* @__PURE__ */
|
|
4913
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-2", children: [
|
|
4914
|
+
enableDensityToggle && /* @__PURE__ */ jsxs45(
|
|
4839
4915
|
Button,
|
|
4840
4916
|
{
|
|
4841
4917
|
type: "button",
|
|
@@ -4844,20 +4920,20 @@ function DataTableInner({
|
|
|
4844
4920
|
"aria-pressed": compact,
|
|
4845
4921
|
onClick: () => setDensity(compact ? "default" : "compact"),
|
|
4846
4922
|
children: [
|
|
4847
|
-
/* @__PURE__ */
|
|
4923
|
+
/* @__PURE__ */ jsx58(Rows, { size: 16, "aria-hidden": true }),
|
|
4848
4924
|
"Compact"
|
|
4849
4925
|
]
|
|
4850
4926
|
}
|
|
4851
4927
|
),
|
|
4852
|
-
enableGrouping && /* @__PURE__ */
|
|
4853
|
-
/* @__PURE__ */
|
|
4854
|
-
/* @__PURE__ */
|
|
4928
|
+
enableGrouping && /* @__PURE__ */ jsxs45(DropdownMenu, { children: [
|
|
4929
|
+
/* @__PURE__ */ jsx58(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs45(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4930
|
+
/* @__PURE__ */ jsx58(Stack, { size: 16, "aria-hidden": true }),
|
|
4855
4931
|
"Group by"
|
|
4856
4932
|
] }) }),
|
|
4857
|
-
/* @__PURE__ */
|
|
4858
|
-
/* @__PURE__ */
|
|
4859
|
-
/* @__PURE__ */
|
|
4860
|
-
groupableColumns.map((column) => /* @__PURE__ */
|
|
4933
|
+
/* @__PURE__ */ jsxs45(DropdownMenuContent, { align: "end", children: [
|
|
4934
|
+
/* @__PURE__ */ jsx58(DropdownMenuLabel, { children: "Group rows by" }),
|
|
4935
|
+
/* @__PURE__ */ jsx58(DropdownMenuSeparator, {}),
|
|
4936
|
+
groupableColumns.map((column) => /* @__PURE__ */ jsx58(
|
|
4861
4937
|
DropdownMenuCheckboxItem,
|
|
4862
4938
|
{
|
|
4863
4939
|
checked: column.getIsGrouped(),
|
|
@@ -4868,15 +4944,15 @@ function DataTableInner({
|
|
|
4868
4944
|
))
|
|
4869
4945
|
] })
|
|
4870
4946
|
] }),
|
|
4871
|
-
enableColumnVisibility && /* @__PURE__ */
|
|
4872
|
-
/* @__PURE__ */
|
|
4873
|
-
/* @__PURE__ */
|
|
4947
|
+
enableColumnVisibility && /* @__PURE__ */ jsxs45(DropdownMenu, { children: [
|
|
4948
|
+
/* @__PURE__ */ jsx58(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs45(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4949
|
+
/* @__PURE__ */ jsx58(Sliders, { size: 16, "aria-hidden": true }),
|
|
4874
4950
|
"Columns"
|
|
4875
4951
|
] }) }),
|
|
4876
|
-
/* @__PURE__ */
|
|
4877
|
-
/* @__PURE__ */
|
|
4878
|
-
/* @__PURE__ */
|
|
4879
|
-
hideableColumns.map((column) => /* @__PURE__ */
|
|
4952
|
+
/* @__PURE__ */ jsxs45(DropdownMenuContent, { align: "end", children: [
|
|
4953
|
+
/* @__PURE__ */ jsx58(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
4954
|
+
/* @__PURE__ */ jsx58(DropdownMenuSeparator, {}),
|
|
4955
|
+
hideableColumns.map((column) => /* @__PURE__ */ jsx58(
|
|
4880
4956
|
DropdownMenuCheckboxItem,
|
|
4881
4957
|
{
|
|
4882
4958
|
checked: column.getIsVisible(),
|
|
@@ -4889,7 +4965,7 @@ function DataTableInner({
|
|
|
4889
4965
|
] })
|
|
4890
4966
|
] })
|
|
4891
4967
|
] }),
|
|
4892
|
-
/* @__PURE__ */
|
|
4968
|
+
/* @__PURE__ */ jsxs45(
|
|
4893
4969
|
Table,
|
|
4894
4970
|
{
|
|
4895
4971
|
ref,
|
|
@@ -4902,52 +4978,52 @@ function DataTableInner({
|
|
|
4902
4978
|
tabIndex: enableCellSelection ? 0 : void 0,
|
|
4903
4979
|
...tableProps,
|
|
4904
4980
|
children: [
|
|
4905
|
-
/* @__PURE__ */
|
|
4906
|
-
headerGroups.map((group, groupIndex) => /* @__PURE__ */
|
|
4981
|
+
/* @__PURE__ */ jsxs45(TableHeader, { children: [
|
|
4982
|
+
headerGroups.map((group, groupIndex) => /* @__PURE__ */ jsxs45(TableRow, { className: "hover:bg-transparent", children: [
|
|
4907
4983
|
groupIndex === 0 && leadingHeaderCells(headerGroups.length + (enableColumnFilters ? 1 : 0)),
|
|
4908
4984
|
group.headers.map(renderHeaderCell)
|
|
4909
4985
|
] }, group.id)),
|
|
4910
|
-
enableColumnFilters && /* @__PURE__ */
|
|
4986
|
+
enableColumnFilters && /* @__PURE__ */ jsx58(TableRow, { className: "hover:bg-transparent", children: leafColumns.map((column) => {
|
|
4911
4987
|
const pin = pinning(column, sized, true);
|
|
4912
|
-
return /* @__PURE__ */
|
|
4988
|
+
return /* @__PURE__ */ jsx58(
|
|
4913
4989
|
TableHead,
|
|
4914
4990
|
{
|
|
4915
4991
|
style: pin.style,
|
|
4916
4992
|
className: cn("h-auto py-2 font-normal", pin.className, sticky && !column.getIsPinned() && "bg-surface"),
|
|
4917
|
-
children: column.getCanFilter() ? /* @__PURE__ */
|
|
4993
|
+
children: column.getCanFilter() ? /* @__PURE__ */ jsx58(ColumnFilter, { column }) : null
|
|
4918
4994
|
},
|
|
4919
4995
|
column.id
|
|
4920
4996
|
);
|
|
4921
4997
|
}) })
|
|
4922
4998
|
] }),
|
|
4923
|
-
/* @__PURE__ */
|
|
4924
|
-
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */
|
|
4999
|
+
/* @__PURE__ */ jsxs45(TableBody, { children: [
|
|
5000
|
+
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
5001
|
topRows.map((row, index) => renderRow(row, { pinned: "top", pinnedIndex: index, pinnedCount: topRows.length })),
|
|
4926
|
-
virtualized && paddingTop > 0 && /* @__PURE__ */
|
|
5002
|
+
virtualized && paddingTop > 0 && /* @__PURE__ */ jsx58("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx58("td", { colSpan: columnSpan, style: { height: paddingTop } }) }),
|
|
4927
5003
|
rowsToRender ? rowsToRender.map(({ row, index }) => renderRow(row, { virtualIndex: index })) : bodyRows.map((row) => renderRow(row)),
|
|
4928
|
-
virtualized && paddingBottom > 0 && /* @__PURE__ */
|
|
5004
|
+
virtualized && paddingBottom > 0 && /* @__PURE__ */ jsx58("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx58("td", { colSpan: columnSpan, style: { height: paddingBottom } }) }),
|
|
4929
5005
|
bottomRows.map(
|
|
4930
5006
|
(row, index) => renderRow(row, { pinned: "bottom", pinnedIndex: index, pinnedCount: bottomRows.length })
|
|
4931
5007
|
)
|
|
4932
5008
|
] }),
|
|
4933
|
-
infinite && /* @__PURE__ */
|
|
5009
|
+
infinite && /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
4934
5010
|
loadingMore && Array.from({ length: 3 }, (_, index) => skeletonRow(`more-${index}`)),
|
|
4935
|
-
/* @__PURE__ */
|
|
5011
|
+
/* @__PURE__ */ jsx58("tr", { ref: sentinelRef, "aria-hidden": true, children: /* @__PURE__ */ jsx58("td", { colSpan: columnSpan, className: "h-px p-0" }) })
|
|
4936
5012
|
] })
|
|
4937
5013
|
] }),
|
|
4938
|
-
showFooter && /* @__PURE__ */
|
|
4939
|
-
leadingCount > 0 && /* @__PURE__ */
|
|
5014
|
+
showFooter && /* @__PURE__ */ jsx58(TableFooter, { children: table.getFooterGroups().map((group) => /* @__PURE__ */ jsxs45(TableRow, { className: "hover:bg-transparent", children: [
|
|
5015
|
+
leadingCount > 0 && /* @__PURE__ */ jsx58(TableCell, { colSpan: leadingCount, className: cellDensity }),
|
|
4940
5016
|
group.headers.map((header) => {
|
|
4941
5017
|
const { align } = getMeta(header.column.columnDef.meta);
|
|
4942
5018
|
const pin = pinning(header.column, sized);
|
|
4943
|
-
return /* @__PURE__ */
|
|
5019
|
+
return /* @__PURE__ */ jsx58(
|
|
4944
5020
|
TableCell,
|
|
4945
5021
|
{
|
|
4946
5022
|
align,
|
|
4947
5023
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
4948
5024
|
style: pin.style,
|
|
4949
5025
|
className: cn("text-ui-label", pin.className, cellDensity),
|
|
4950
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */
|
|
5026
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ jsx58(table.FlexRender, { footer: header })
|
|
4951
5027
|
},
|
|
4952
5028
|
header.id
|
|
4953
5029
|
);
|
|
@@ -4956,9 +5032,9 @@ function DataTableInner({
|
|
|
4956
5032
|
]
|
|
4957
5033
|
}
|
|
4958
5034
|
),
|
|
4959
|
-
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */
|
|
4960
|
-
/* @__PURE__ */
|
|
4961
|
-
paginate && pageCount > 1 && /* @__PURE__ */
|
|
5035
|
+
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ jsxs45("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5036
|
+
/* @__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 }),
|
|
5037
|
+
paginate && pageCount > 1 && /* @__PURE__ */ jsx58(
|
|
4962
5038
|
Pagination,
|
|
4963
5039
|
{
|
|
4964
5040
|
page: pagination.pageIndex + 1,
|
|
@@ -4969,13 +5045,13 @@ function DataTableInner({
|
|
|
4969
5045
|
] })
|
|
4970
5046
|
] });
|
|
4971
5047
|
}
|
|
4972
|
-
var DataTable =
|
|
5048
|
+
var DataTable = React57.forwardRef(DataTableInner);
|
|
4973
5049
|
DataTable.displayName = "DataTable";
|
|
4974
5050
|
|
|
4975
5051
|
// src/components/Data Display/StatCard.tsx
|
|
4976
|
-
import * as
|
|
5052
|
+
import * as React58 from "react";
|
|
4977
5053
|
import { cva as cva6 } from "class-variance-authority";
|
|
4978
|
-
import { jsx as
|
|
5054
|
+
import { jsx as jsx59, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4979
5055
|
var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
4980
5056
|
variants: {
|
|
4981
5057
|
variant: {
|
|
@@ -4989,26 +5065,26 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
4989
5065
|
},
|
|
4990
5066
|
defaultVariants: { variant: "default" }
|
|
4991
5067
|
});
|
|
4992
|
-
var StatCard =
|
|
4993
|
-
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */
|
|
4994
|
-
/* @__PURE__ */
|
|
4995
|
-
/* @__PURE__ */
|
|
4996
|
-
icon && /* @__PURE__ */
|
|
5068
|
+
var StatCard = React58.forwardRef(
|
|
5069
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ jsxs46("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
5070
|
+
/* @__PURE__ */ jsx59("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
5071
|
+
/* @__PURE__ */ jsxs46("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
5072
|
+
icon && /* @__PURE__ */ jsx59("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
4997
5073
|
value
|
|
4998
5074
|
] }),
|
|
4999
|
-
caption && /* @__PURE__ */
|
|
5075
|
+
caption && /* @__PURE__ */ jsx59("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
5000
5076
|
] })
|
|
5001
5077
|
);
|
|
5002
5078
|
StatCard.displayName = "StatCard";
|
|
5003
5079
|
|
|
5004
5080
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
5005
|
-
import * as
|
|
5081
|
+
import * as React60 from "react";
|
|
5006
5082
|
|
|
5007
5083
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
5008
|
-
import * as
|
|
5084
|
+
import * as React59 from "react";
|
|
5009
5085
|
import { Crown, Plus as Plus5, X as X6 } from "@phosphor-icons/react";
|
|
5010
5086
|
import { cva as cva7 } from "class-variance-authority";
|
|
5011
|
-
import { jsx as
|
|
5087
|
+
import { jsx as jsx60, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
5012
5088
|
var editableTagVariants = cva7(
|
|
5013
5089
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5014
5090
|
{
|
|
@@ -5023,27 +5099,27 @@ var editableTagVariants = cva7(
|
|
|
5023
5099
|
defaultVariants: { type: "default" }
|
|
5024
5100
|
}
|
|
5025
5101
|
);
|
|
5026
|
-
var EditableTag =
|
|
5102
|
+
var EditableTag = React59.forwardRef(
|
|
5027
5103
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
5028
5104
|
const classes = cn(editableTagVariants({ type }), className);
|
|
5029
|
-
const leading = type === "add" ? /* @__PURE__ */
|
|
5105
|
+
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
5106
|
if (type === "add" || type === "multiple" && onClick) {
|
|
5031
|
-
return /* @__PURE__ */
|
|
5107
|
+
return /* @__PURE__ */ jsxs47("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
5032
5108
|
leading,
|
|
5033
5109
|
children
|
|
5034
5110
|
] });
|
|
5035
5111
|
}
|
|
5036
|
-
return /* @__PURE__ */
|
|
5112
|
+
return /* @__PURE__ */ jsxs47("span", { ref, className: classes, ...props, children: [
|
|
5037
5113
|
leading,
|
|
5038
5114
|
children,
|
|
5039
|
-
onRemove && /* @__PURE__ */
|
|
5115
|
+
onRemove && /* @__PURE__ */ jsx60(
|
|
5040
5116
|
"button",
|
|
5041
5117
|
{
|
|
5042
5118
|
type: "button",
|
|
5043
5119
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
5044
5120
|
onClick: onRemove,
|
|
5045
5121
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
5046
|
-
children: /* @__PURE__ */
|
|
5122
|
+
children: /* @__PURE__ */ jsx60(X6, { size: 12, "aria-hidden": true })
|
|
5047
5123
|
}
|
|
5048
5124
|
)
|
|
5049
5125
|
] });
|
|
@@ -5052,26 +5128,26 @@ var EditableTag = React57.forwardRef(
|
|
|
5052
5128
|
EditableTag.displayName = "EditableTag";
|
|
5053
5129
|
|
|
5054
5130
|
// 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__ */
|
|
5131
|
+
import { jsx as jsx61, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
5132
|
+
var ActivityStructure = React60.forwardRef(
|
|
5133
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ jsxs48(
|
|
5058
5134
|
"section",
|
|
5059
5135
|
{
|
|
5060
5136
|
ref,
|
|
5061
5137
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
5062
5138
|
...props,
|
|
5063
5139
|
children: [
|
|
5064
|
-
/* @__PURE__ */
|
|
5065
|
-
/* @__PURE__ */
|
|
5140
|
+
/* @__PURE__ */ jsxs48("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5141
|
+
/* @__PURE__ */ jsx61("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
5066
5142
|
action
|
|
5067
5143
|
] }),
|
|
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__ */
|
|
5144
|
+
stats.length > 0 && /* @__PURE__ */ jsx61("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx61(StatCard, { ...stat }, id)) }),
|
|
5145
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs48("div", { className: "flex flex-col gap-2", children: [
|
|
5146
|
+
/* @__PURE__ */ jsx61("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
5147
|
+
/* @__PURE__ */ jsx61("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
5148
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ jsxs48("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5149
|
+
tags?.map((tag) => /* @__PURE__ */ jsx61(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
5150
|
+
onAddTag && /* @__PURE__ */ jsx61(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
5075
5151
|
] })
|
|
5076
5152
|
] }, id)),
|
|
5077
5153
|
children
|
|
@@ -5082,10 +5158,10 @@ var ActivityStructure = React58.forwardRef(
|
|
|
5082
5158
|
ActivityStructure.displayName = "ActivityStructure";
|
|
5083
5159
|
|
|
5084
5160
|
// src/components/Tags & Badges/Badge.tsx
|
|
5085
|
-
import * as
|
|
5161
|
+
import * as React61 from "react";
|
|
5086
5162
|
import { DotsSixVertical as DotsSixVertical5, RadioButton as RadioButton3 } from "@phosphor-icons/react";
|
|
5087
5163
|
import { cva as cva8 } from "class-variance-authority";
|
|
5088
|
-
import { jsx as
|
|
5164
|
+
import { jsx as jsx62, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5089
5165
|
var roleTagVariants = cva8(
|
|
5090
5166
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5091
5167
|
{
|
|
@@ -5111,11 +5187,11 @@ var roleTagVariants = cva8(
|
|
|
5111
5187
|
defaultVariants: { type: "primary", selected: false }
|
|
5112
5188
|
}
|
|
5113
5189
|
);
|
|
5114
|
-
var Badge =
|
|
5190
|
+
var Badge = React61.forwardRef(
|
|
5115
5191
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
5116
5192
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
5117
5193
|
if (type === "interactable") {
|
|
5118
|
-
return /* @__PURE__ */
|
|
5194
|
+
return /* @__PURE__ */ jsxs49(
|
|
5119
5195
|
"button",
|
|
5120
5196
|
{
|
|
5121
5197
|
ref,
|
|
@@ -5125,26 +5201,55 @@ var Badge = React59.forwardRef(
|
|
|
5125
5201
|
onClick,
|
|
5126
5202
|
...props,
|
|
5127
5203
|
children: [
|
|
5128
|
-
/* @__PURE__ */
|
|
5204
|
+
/* @__PURE__ */ jsx62(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
5129
5205
|
children
|
|
5130
5206
|
]
|
|
5131
5207
|
}
|
|
5132
5208
|
);
|
|
5133
5209
|
}
|
|
5134
|
-
return /* @__PURE__ */
|
|
5135
|
-
type === "question" && /* @__PURE__ */
|
|
5136
|
-
type === "id" && /* @__PURE__ */
|
|
5210
|
+
return /* @__PURE__ */ jsxs49("span", { ref, className: classes, ...props, children: [
|
|
5211
|
+
type === "question" && /* @__PURE__ */ jsx62(RadioButton3, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
5212
|
+
type === "id" && /* @__PURE__ */ jsx62("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
5137
5213
|
children
|
|
5138
5214
|
] });
|
|
5139
5215
|
}
|
|
5140
5216
|
);
|
|
5141
5217
|
Badge.displayName = "Badge";
|
|
5218
|
+
|
|
5219
|
+
// src/components/Identity & People/Avatar.tsx
|
|
5220
|
+
import * as React62 from "react";
|
|
5221
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
5222
|
+
var initials = (name) => name.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
5223
|
+
var Avatar = React62.forwardRef(({ className, src, name, fallback, ...props }, ref) => {
|
|
5224
|
+
const [failed, setFailed] = React62.useState(false);
|
|
5225
|
+
React62.useEffect(() => setFailed(false), [src]);
|
|
5226
|
+
const showImage = Boolean(src) && !failed;
|
|
5227
|
+
return /* @__PURE__ */ jsx63(
|
|
5228
|
+
"span",
|
|
5229
|
+
{
|
|
5230
|
+
ref,
|
|
5231
|
+
role: showImage ? void 0 : "img",
|
|
5232
|
+
"aria-label": showImage ? void 0 : name,
|
|
5233
|
+
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),
|
|
5234
|
+
...props,
|
|
5235
|
+
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) })
|
|
5236
|
+
}
|
|
5237
|
+
);
|
|
5238
|
+
});
|
|
5239
|
+
Avatar.displayName = "Avatar";
|
|
5240
|
+
|
|
5241
|
+
// src/components/Identity & People/OrgMonogram.tsx
|
|
5242
|
+
import * as React63 from "react";
|
|
5243
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
5244
|
+
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 }));
|
|
5245
|
+
OrgMonogram.displayName = "OrgMonogram";
|
|
5142
5246
|
export {
|
|
5143
5247
|
AIMiniAvatar,
|
|
5144
5248
|
AIResponseContainer,
|
|
5145
5249
|
ActivityStructure,
|
|
5146
5250
|
AskAiInput,
|
|
5147
5251
|
AskAiToggle,
|
|
5252
|
+
Avatar,
|
|
5148
5253
|
Badge,
|
|
5149
5254
|
Button,
|
|
5150
5255
|
Calendar,
|
|
@@ -5201,9 +5306,11 @@ export {
|
|
|
5201
5306
|
NavRailItem,
|
|
5202
5307
|
NumberInput,
|
|
5203
5308
|
OpenEndAnswer,
|
|
5309
|
+
OrgMonogram,
|
|
5204
5310
|
Pagination,
|
|
5205
5311
|
Progress,
|
|
5206
5312
|
ProjectSelector,
|
|
5313
|
+
ProjectSidebar,
|
|
5207
5314
|
QuestionCard,
|
|
5208
5315
|
QuestionEditorCard,
|
|
5209
5316
|
QuestionHeader,
|
|
@@ -5225,6 +5332,7 @@ export {
|
|
|
5225
5332
|
SelectItem,
|
|
5226
5333
|
SelectTrigger,
|
|
5227
5334
|
SelectValue,
|
|
5335
|
+
SidebarNavItem,
|
|
5228
5336
|
Slider,
|
|
5229
5337
|
StatCard,
|
|
5230
5338
|
StatusTag,
|