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