@discuss-ds/ui 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +556 -484
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +532 -463
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -115,6 +115,9 @@ __export(index_exports, {
|
|
|
115
115
|
Slider: () => Slider,
|
|
116
116
|
StatCard: () => StatCard,
|
|
117
117
|
StatusTag: () => StatusTag,
|
|
118
|
+
Step: () => Step,
|
|
119
|
+
StepPath: () => StepPath,
|
|
120
|
+
Stepper: () => Stepper,
|
|
118
121
|
StimulusCard: () => StimulusCard,
|
|
119
122
|
Switch: () => Switch,
|
|
120
123
|
TabItem: () => TabItem,
|
|
@@ -2432,24 +2435,90 @@ var Textarea = React32.forwardRef(
|
|
|
2432
2435
|
);
|
|
2433
2436
|
Textarea.displayName = "Textarea";
|
|
2434
2437
|
|
|
2435
|
-
// src/components/
|
|
2438
|
+
// src/components/Navigation/Stepper.tsx
|
|
2436
2439
|
var React33 = __toESM(require("react"), 1);
|
|
2437
2440
|
var import_react16 = require("@phosphor-icons/react");
|
|
2438
|
-
var import_radix_ui17 = require("radix-ui");
|
|
2439
2441
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2442
|
+
var STATUS_TEXT = { "not-completed": "not completed", completed: "completed", error: "error" };
|
|
2443
|
+
function StepIndicator({ status, selected }) {
|
|
2444
|
+
const props = { size: 24, "aria-hidden": true, className: "shrink-0" };
|
|
2445
|
+
if (status === "completed") return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react16.CheckCircle, { ...props, weight: selected ? "fill" : "regular", className: "shrink-0 text-success-foreground" });
|
|
2446
|
+
if (status === "error") return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react16.WarningCircle, { ...props, weight: selected ? "fill" : "regular", className: "shrink-0 text-destructive-foreground" });
|
|
2447
|
+
if (selected) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react16.RadioButton, { ...props, weight: "fill", className: "shrink-0 text-accent-foreground" });
|
|
2448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react16.Circle, { ...props, className: "shrink-0 text-input-muted" });
|
|
2449
|
+
}
|
|
2450
|
+
var Step = React33.forwardRef(
|
|
2451
|
+
({ label, status = "not-completed", selected = false, orientation = "horizontal", className, ...props }, ref) => {
|
|
2452
|
+
const vertical = orientation === "vertical";
|
|
2453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2454
|
+
"div",
|
|
2455
|
+
{
|
|
2456
|
+
ref,
|
|
2457
|
+
className: cn(
|
|
2458
|
+
"flex min-h-16 w-34 shrink-0",
|
|
2459
|
+
// The horizontal indicator sits 6px from the top, so a path beside it lines up whatever the label's length.
|
|
2460
|
+
vertical ? "items-center justify-end gap-4 p-2" : "flex-col items-center gap-2 pt-1.5",
|
|
2461
|
+
className
|
|
2462
|
+
),
|
|
2463
|
+
...props,
|
|
2464
|
+
children: [
|
|
2465
|
+
!vertical && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StepIndicator, { status, selected }),
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2467
|
+
"span",
|
|
2468
|
+
{
|
|
2469
|
+
className: cn(
|
|
2470
|
+
vertical ? "min-w-0 flex-1 text-right" : "w-full text-center",
|
|
2471
|
+
selected ? "text-ui-label text-foreground" : "text-body-small text-secondary-muted-foreground"
|
|
2472
|
+
),
|
|
2473
|
+
children: [
|
|
2474
|
+
label,
|
|
2475
|
+
status !== "not-completed" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "sr-only", children: `, ${STATUS_TEXT[status]}` })
|
|
2476
|
+
]
|
|
2477
|
+
}
|
|
2478
|
+
),
|
|
2479
|
+
vertical && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StepIndicator, { status, selected })
|
|
2480
|
+
]
|
|
2481
|
+
}
|
|
2482
|
+
);
|
|
2483
|
+
}
|
|
2484
|
+
);
|
|
2485
|
+
Step.displayName = "Step";
|
|
2486
|
+
var StepPath = React33.forwardRef(
|
|
2487
|
+
({ orientation = "horizontal", completed = false, className, ...props }, ref) => {
|
|
2488
|
+
const vertical = orientation === "vertical";
|
|
2489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref, "aria-hidden": true, className: cn("flex items-center justify-center", vertical ? "h-8 w-8 flex-col" : "h-8 flex-1", className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: cn(vertical ? "w-px flex-1" : "h-px flex-1", completed ? "bg-success-foreground" : "bg-border") }) });
|
|
2490
|
+
}
|
|
2491
|
+
);
|
|
2492
|
+
StepPath.displayName = "StepPath";
|
|
2493
|
+
var Stepper = React33.forwardRef(({ steps, current, orientation = "horizontal", className, ...props }, ref) => {
|
|
2494
|
+
const vertical = orientation === "vertical";
|
|
2495
|
+
const statusOf = (i, step) => step.error ? "error" : i < current ? "completed" : "not-completed";
|
|
2496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("ol", { ref, className: cn("flex", vertical ? "flex-col items-end" : "w-full items-start", className), ...props, children: steps.map((step, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(React33.Fragment, { children: [
|
|
2497
|
+
i > 0 && // Horizontal: the path runs from one indicator's edge to the next (it reaches 56px into each 136px step), level with the indicators' centre.
|
|
2498
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("li", { "aria-hidden": true, className: cn("flex", vertical ? "pr-1" : "-mx-14 flex-1 pt-1.5"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(StepPath, { orientation, completed: i < current, className: vertical ? void 0 : "h-6" }) }),
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("li", { "aria-current": i === current ? "step" : void 0, className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Step, { label: step.label, status: statusOf(i, step), selected: i === current, orientation }) })
|
|
2500
|
+
] }, i)) });
|
|
2501
|
+
});
|
|
2502
|
+
Stepper.displayName = "Stepper";
|
|
2503
|
+
|
|
2504
|
+
// src/components/Overlays & Feedback/Dialog.tsx
|
|
2505
|
+
var React34 = __toESM(require("react"), 1);
|
|
2506
|
+
var import_react17 = require("@phosphor-icons/react");
|
|
2507
|
+
var import_radix_ui17 = require("radix-ui");
|
|
2508
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2440
2509
|
var Dialog = import_radix_ui17.Dialog.Root;
|
|
2441
2510
|
var DialogTrigger = import_radix_ui17.Dialog.Trigger;
|
|
2442
2511
|
var DialogClose = import_radix_ui17.Dialog.Close;
|
|
2443
|
-
var DialogContent =
|
|
2444
|
-
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2445
|
-
/* @__PURE__ */ (0,
|
|
2512
|
+
var DialogContent = React34.forwardRef(
|
|
2513
|
+
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_radix_ui17.Dialog.Portal, { children: [
|
|
2514
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2446
2515
|
import_radix_ui17.Dialog.Overlay,
|
|
2447
2516
|
{
|
|
2448
2517
|
style: { zIndex: "var(--sys-z-30)" },
|
|
2449
2518
|
className: "fixed inset-0 bg-primary/30"
|
|
2450
2519
|
}
|
|
2451
2520
|
),
|
|
2452
|
-
/* @__PURE__ */ (0,
|
|
2521
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2453
2522
|
import_radix_ui17.Dialog.Content,
|
|
2454
2523
|
{
|
|
2455
2524
|
ref,
|
|
@@ -2461,15 +2530,15 @@ var DialogContent = React33.forwardRef(
|
|
|
2461
2530
|
...props,
|
|
2462
2531
|
children: [
|
|
2463
2532
|
children,
|
|
2464
|
-
!hideClose && /* @__PURE__ */ (0,
|
|
2533
|
+
!hideClose && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_radix_ui17.Dialog.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Button, { variant: "ghost", size: "icon-sm", "aria-label": closeLabel, className: "absolute top-4 right-6", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react17.X, { size: 16, "aria-hidden": true }) }) })
|
|
2465
2534
|
]
|
|
2466
2535
|
}
|
|
2467
2536
|
)
|
|
2468
2537
|
] })
|
|
2469
2538
|
);
|
|
2470
2539
|
DialogContent.displayName = "DialogContent";
|
|
2471
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
2472
|
-
var DialogTitle =
|
|
2540
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: cn("flex flex-col gap-1.5 border-b border-border px-6 py-4 pr-16", className), ...props });
|
|
2541
|
+
var DialogTitle = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2473
2542
|
import_radix_ui17.Dialog.Title,
|
|
2474
2543
|
{
|
|
2475
2544
|
ref,
|
|
@@ -2478,7 +2547,7 @@ var DialogTitle = React33.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2478
2547
|
}
|
|
2479
2548
|
));
|
|
2480
2549
|
DialogTitle.displayName = "DialogTitle";
|
|
2481
|
-
var DialogDescription =
|
|
2550
|
+
var DialogDescription = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2482
2551
|
import_radix_ui17.Dialog.Description,
|
|
2483
2552
|
{
|
|
2484
2553
|
ref,
|
|
@@ -2487,15 +2556,15 @@ var DialogDescription = React33.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2487
2556
|
}
|
|
2488
2557
|
));
|
|
2489
2558
|
DialogDescription.displayName = "DialogDescription";
|
|
2490
|
-
var DialogBody = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
2491
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
2559
|
+
var DialogBody = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: cn("flex flex-col gap-4 p-6", className), ...props });
|
|
2560
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: cn("flex items-center justify-end gap-3 border-t border-border px-6 py-4", className), ...props });
|
|
2492
2561
|
|
|
2493
2562
|
// src/components/Overlays & Feedback/Toast.tsx
|
|
2494
|
-
var
|
|
2495
|
-
var
|
|
2563
|
+
var React35 = __toESM(require("react"), 1);
|
|
2564
|
+
var import_react18 = require("@phosphor-icons/react");
|
|
2496
2565
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
2497
2566
|
var import_radix_ui18 = require("radix-ui");
|
|
2498
|
-
var
|
|
2567
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2499
2568
|
var toastVariants = (0, import_class_variance_authority4.cva)("border", {
|
|
2500
2569
|
variants: {
|
|
2501
2570
|
variant: {
|
|
@@ -2533,13 +2602,13 @@ var titleColour = {
|
|
|
2533
2602
|
};
|
|
2534
2603
|
function VariantIcon({ variant, size }) {
|
|
2535
2604
|
const props = { size, "aria-hidden": true, className: cn("shrink-0", iconColour[variant]) };
|
|
2536
|
-
if (variant === "success") return /* @__PURE__ */ (0,
|
|
2537
|
-
if (variant === "warning") return /* @__PURE__ */ (0,
|
|
2538
|
-
if (variant === "destructive") return /* @__PURE__ */ (0,
|
|
2539
|
-
return /* @__PURE__ */ (0,
|
|
2605
|
+
if (variant === "success") return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react18.CheckCircle, { ...props });
|
|
2606
|
+
if (variant === "warning") return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react18.Warning, { ...props });
|
|
2607
|
+
if (variant === "destructive") return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react18.WarningCircle, { ...props });
|
|
2608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react18.Info, { ...props });
|
|
2540
2609
|
}
|
|
2541
2610
|
var ToastProvider = import_radix_ui18.Toast.Provider;
|
|
2542
|
-
var ToastViewport =
|
|
2611
|
+
var ToastViewport = React35.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2543
2612
|
import_radix_ui18.Toast.Viewport,
|
|
2544
2613
|
{
|
|
2545
2614
|
ref,
|
|
@@ -2549,10 +2618,10 @@ var ToastViewport = React34.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2549
2618
|
}
|
|
2550
2619
|
));
|
|
2551
2620
|
ToastViewport.displayName = "ToastViewport";
|
|
2552
|
-
var Toast =
|
|
2621
|
+
var Toast = React35.forwardRef(
|
|
2553
2622
|
({ className, variant = "info", title, description, action, closeLabel = "Close", children, ...props }, ref) => {
|
|
2554
2623
|
const v = variant ?? "info";
|
|
2555
|
-
return /* @__PURE__ */ (0,
|
|
2624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2556
2625
|
import_radix_ui18.Toast.Root,
|
|
2557
2626
|
{
|
|
2558
2627
|
ref,
|
|
@@ -2560,19 +2629,19 @@ var Toast = React34.forwardRef(
|
|
|
2560
2629
|
className: cn("flex items-start gap-3 rounded-lg p-4 shadow-lg", toastVariants({ variant: v }), className),
|
|
2561
2630
|
...props,
|
|
2562
2631
|
children: [
|
|
2563
|
-
/* @__PURE__ */ (0,
|
|
2564
|
-
/* @__PURE__ */ (0,
|
|
2565
|
-
title != null && /* @__PURE__ */ (0,
|
|
2566
|
-
description != null && /* @__PURE__ */ (0,
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VariantIcon, { variant: v, size: 20 }),
|
|
2633
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1 text-body-small", children: [
|
|
2634
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_radix_ui18.Toast.Title, { className: cn("font-semibold", titleColour[v]), children: title }),
|
|
2635
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_radix_ui18.Toast.Description, { className: "text-secondary-muted-foreground", children: description }),
|
|
2567
2636
|
children,
|
|
2568
2637
|
action
|
|
2569
2638
|
] }),
|
|
2570
|
-
/* @__PURE__ */ (0,
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2571
2640
|
import_radix_ui18.Toast.Close,
|
|
2572
2641
|
{
|
|
2573
2642
|
"aria-label": closeLabel,
|
|
2574
2643
|
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-xs text-surface-foreground",
|
|
2575
|
-
children: /* @__PURE__ */ (0,
|
|
2644
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react18.X, { size: 16, "aria-hidden": true })
|
|
2576
2645
|
}
|
|
2577
2646
|
)
|
|
2578
2647
|
]
|
|
@@ -2582,11 +2651,11 @@ var Toast = React34.forwardRef(
|
|
|
2582
2651
|
);
|
|
2583
2652
|
Toast.displayName = "Toast";
|
|
2584
2653
|
var ToastAction = import_radix_ui18.Toast.Action;
|
|
2585
|
-
var ToastInline =
|
|
2654
|
+
var ToastInline = React35.forwardRef(
|
|
2586
2655
|
({ className, variant = "info", actions, actionsPlacement = "end", onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2587
2656
|
const v = variant ?? "info";
|
|
2588
2657
|
const below = actionsPlacement === "bottom" && !!actions;
|
|
2589
|
-
return /* @__PURE__ */ (0,
|
|
2658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2590
2659
|
"div",
|
|
2591
2660
|
{
|
|
2592
2661
|
ref,
|
|
@@ -2594,15 +2663,15 @@ var ToastInline = React34.forwardRef(
|
|
|
2594
2663
|
className: cn("flex gap-2 rounded-sm px-2 py-1.5", below ? "items-start" : "items-center", inlineVariants({ variant: v }), className),
|
|
2595
2664
|
...props,
|
|
2596
2665
|
children: [
|
|
2597
|
-
/* @__PURE__ */ (0,
|
|
2598
|
-
below ? /* @__PURE__ */ (0,
|
|
2599
|
-
/* @__PURE__ */ (0,
|
|
2600
|
-
/* @__PURE__ */ (0,
|
|
2601
|
-
] }) : /* @__PURE__ */ (0,
|
|
2602
|
-
/* @__PURE__ */ (0,
|
|
2603
|
-
actions && /* @__PURE__ */ (0,
|
|
2666
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: cn("inline-flex shrink-0", below && "mt-0.5"), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VariantIcon, { variant: v === "neutral" ? "info" : v, size: 16 }) }),
|
|
2667
|
+
below ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2668
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-body-small text-secondary-muted-foreground", children }),
|
|
2669
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex items-center gap-2", children: actions })
|
|
2670
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
2671
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "min-w-0 flex-1 text-body-small text-secondary-muted-foreground", children }),
|
|
2672
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
2604
2673
|
] }),
|
|
2605
|
-
onClose && /* @__PURE__ */ (0,
|
|
2674
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react18.X, { size: 16, "aria-hidden": true }) })
|
|
2606
2675
|
]
|
|
2607
2676
|
}
|
|
2608
2677
|
);
|
|
@@ -2611,16 +2680,16 @@ var ToastInline = React34.forwardRef(
|
|
|
2611
2680
|
ToastInline.displayName = "ToastInline";
|
|
2612
2681
|
|
|
2613
2682
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
2614
|
-
var
|
|
2683
|
+
var React36 = __toESM(require("react"), 1);
|
|
2615
2684
|
var import_radix_ui19 = require("radix-ui");
|
|
2616
|
-
var
|
|
2685
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2617
2686
|
var TooltipProvider = import_radix_ui19.Tooltip.Provider;
|
|
2618
2687
|
var Tooltip = import_radix_ui19.Tooltip.Root;
|
|
2619
2688
|
var TooltipTrigger = import_radix_ui19.Tooltip.Trigger;
|
|
2620
|
-
var TooltipContent =
|
|
2689
|
+
var TooltipContent = React36.forwardRef(
|
|
2621
2690
|
({ className, sideOffset = 4, title, description, action, arrow = true, children, ...props }, ref) => {
|
|
2622
2691
|
const detailed = title != null || description != null;
|
|
2623
|
-
return /* @__PURE__ */ (0,
|
|
2692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_radix_ui19.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2624
2693
|
import_radix_ui19.Tooltip.Content,
|
|
2625
2694
|
{
|
|
2626
2695
|
ref,
|
|
@@ -2634,12 +2703,12 @@ var TooltipContent = React35.forwardRef(
|
|
|
2634
2703
|
),
|
|
2635
2704
|
...props,
|
|
2636
2705
|
children: [
|
|
2637
|
-
detailed ? /* @__PURE__ */ (0,
|
|
2638
|
-
title != null && /* @__PURE__ */ (0,
|
|
2639
|
-
description != null && /* @__PURE__ */ (0,
|
|
2640
|
-
action != null && /* @__PURE__ */ (0,
|
|
2706
|
+
detailed ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
2707
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2708
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2709
|
+
action != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
2641
2710
|
] }) : children,
|
|
2642
|
-
arrow && /* @__PURE__ */ (0,
|
|
2711
|
+
arrow && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_radix_ui19.Tooltip.Arrow, { width: 12, height: 8, className: "fill-primary-soft-foreground" })
|
|
2643
2712
|
]
|
|
2644
2713
|
}
|
|
2645
2714
|
) });
|
|
@@ -2648,14 +2717,14 @@ var TooltipContent = React35.forwardRef(
|
|
|
2648
2717
|
TooltipContent.displayName = "TooltipContent";
|
|
2649
2718
|
|
|
2650
2719
|
// src/components/Question Types/FileUpload.tsx
|
|
2651
|
-
var
|
|
2652
|
-
var
|
|
2720
|
+
var React38 = __toESM(require("react"), 1);
|
|
2721
|
+
var import_react19 = require("@phosphor-icons/react");
|
|
2653
2722
|
var import_radix_ui20 = require("radix-ui");
|
|
2654
2723
|
|
|
2655
2724
|
// src/components/Tags & Badges/Tag.tsx
|
|
2656
|
-
var
|
|
2725
|
+
var React37 = __toESM(require("react"), 1);
|
|
2657
2726
|
var import_class_variance_authority5 = require("class-variance-authority");
|
|
2658
|
-
var
|
|
2727
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2659
2728
|
var tagVariants = (0, import_class_variance_authority5.cva)(
|
|
2660
2729
|
"inline-flex items-center gap-1.5 whitespace-nowrap rounded-sm border px-2.5 py-1 text-ui-caption",
|
|
2661
2730
|
{
|
|
@@ -2671,7 +2740,7 @@ var tagVariants = (0, import_class_variance_authority5.cva)(
|
|
|
2671
2740
|
defaultVariants: { variant: "neutral" }
|
|
2672
2741
|
}
|
|
2673
2742
|
);
|
|
2674
|
-
var Tag =
|
|
2743
|
+
var Tag = React37.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { ref, className: cn(tagVariants({ variant }), className), ...props }));
|
|
2675
2744
|
Tag.displayName = "Tag";
|
|
2676
2745
|
var statusDotVariants = (0, import_class_variance_authority5.cva)("size-1.5 shrink-0 rounded-full", {
|
|
2677
2746
|
variants: {
|
|
@@ -2684,20 +2753,20 @@ var statusDotVariants = (0, import_class_variance_authority5.cva)("size-1.5 shri
|
|
|
2684
2753
|
},
|
|
2685
2754
|
defaultVariants: { status: "active" }
|
|
2686
2755
|
});
|
|
2687
|
-
var StatusTag =
|
|
2688
|
-
({ className, status, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2689
|
-
/* @__PURE__ */ (0,
|
|
2756
|
+
var StatusTag = React37.forwardRef(
|
|
2757
|
+
({ className, status, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { ref, className: cn(tagVariants({ variant: "default" }), className), ...props, children: [
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: statusDotVariants({ status }), "aria-hidden": "true" }),
|
|
2690
2759
|
children
|
|
2691
2760
|
] })
|
|
2692
2761
|
);
|
|
2693
2762
|
StatusTag.displayName = "StatusTag";
|
|
2694
2763
|
|
|
2695
2764
|
// src/components/Question Types/FileUpload.tsx
|
|
2696
|
-
var
|
|
2697
|
-
var FileUploadZone =
|
|
2765
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2766
|
+
var FileUploadZone = React38.forwardRef(
|
|
2698
2767
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2699
|
-
const [over, setOver] =
|
|
2700
|
-
return /* @__PURE__ */ (0,
|
|
2768
|
+
const [over, setOver] = React38.useState(false);
|
|
2769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
2701
2770
|
"label",
|
|
2702
2771
|
{
|
|
2703
2772
|
className: cn(
|
|
@@ -2717,12 +2786,12 @@ var FileUploadZone = React37.forwardRef(
|
|
|
2717
2786
|
onFiles?.(Array.from(event.dataTransfer.files));
|
|
2718
2787
|
},
|
|
2719
2788
|
children: [
|
|
2720
|
-
/* @__PURE__ */ (0,
|
|
2721
|
-
/* @__PURE__ */ (0,
|
|
2722
|
-
/* @__PURE__ */ (0,
|
|
2723
|
-
hint && /* @__PURE__ */ (0,
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("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__ */ (0, import_jsx_runtime39.jsx)(import_react19.FileText, { size: 24, "aria-hidden": true }) }),
|
|
2790
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex flex-col gap-1", children: [
|
|
2791
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-body-small text-surface-foreground", children: title }),
|
|
2792
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-ui-caption text-secondary-muted-foreground", children: hint })
|
|
2724
2793
|
] }),
|
|
2725
|
-
/* @__PURE__ */ (0,
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2726
2795
|
"input",
|
|
2727
2796
|
{
|
|
2728
2797
|
ref,
|
|
@@ -2738,47 +2807,47 @@ var FileUploadZone = React37.forwardRef(
|
|
|
2738
2807
|
}
|
|
2739
2808
|
);
|
|
2740
2809
|
FileUploadZone.displayName = "FileUploadZone";
|
|
2741
|
-
var FileUploadItem =
|
|
2810
|
+
var FileUploadItem = React38.forwardRef(
|
|
2742
2811
|
({ className, name, size, status = "uploading", progress = 0, timeLeft, icon, onRemove, removeLabel, ...props }, ref) => {
|
|
2743
2812
|
const uploading = status === "uploading";
|
|
2744
|
-
return /* @__PURE__ */ (0,
|
|
2813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
2745
2814
|
"div",
|
|
2746
2815
|
{
|
|
2747
2816
|
ref,
|
|
2748
2817
|
className: cn("flex w-full flex-col justify-center gap-2 overflow-hidden rounded-sm border border-border p-2", className),
|
|
2749
2818
|
...props,
|
|
2750
2819
|
children: [
|
|
2751
|
-
/* @__PURE__ */ (0,
|
|
2752
|
-
/* @__PURE__ */ (0,
|
|
2753
|
-
/* @__PURE__ */ (0,
|
|
2754
|
-
/* @__PURE__ */ (0,
|
|
2755
|
-
/* @__PURE__ */ (0,
|
|
2756
|
-
onRemove && /* @__PURE__ */ (0,
|
|
2820
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("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__ */ (0, import_jsx_runtime39.jsx)(import_react19.FileText, { size: 24, "aria-hidden": true }) }),
|
|
2822
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2823
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2824
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "min-w-0 truncate text-ui-label text-surface-foreground", children: name }),
|
|
2825
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react19.X, { size: 16, "aria-hidden": true }) })
|
|
2757
2826
|
] }),
|
|
2758
|
-
/* @__PURE__ */ (0,
|
|
2759
|
-
/* @__PURE__ */ (0,
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
2760
2829
|
size,
|
|
2761
|
-
status === "complete" && /* @__PURE__ */ (0,
|
|
2762
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
2763
|
-
uploading && timeLeft && /* @__PURE__ */ (0,
|
|
2764
|
-
/* @__PURE__ */ (0,
|
|
2830
|
+
status === "complete" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Tag, { variant: "success", children: "Complete" }),
|
|
2831
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Tag, { variant: "destructive", children: "Error" }),
|
|
2832
|
+
uploading && timeLeft && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
2833
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2765
2834
|
timeLeft
|
|
2766
2835
|
] })
|
|
2767
2836
|
] }),
|
|
2768
|
-
uploading && /* @__PURE__ */ (0,
|
|
2837
|
+
uploading && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: "text-body-xxs font-normal", children: [
|
|
2769
2838
|
Math.round(progress),
|
|
2770
2839
|
"%"
|
|
2771
2840
|
] })
|
|
2772
2841
|
] })
|
|
2773
2842
|
] })
|
|
2774
2843
|
] }),
|
|
2775
|
-
uploading && /* @__PURE__ */ (0,
|
|
2844
|
+
uploading && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2776
2845
|
import_radix_ui20.Progress.Root,
|
|
2777
2846
|
{
|
|
2778
2847
|
value: progress,
|
|
2779
2848
|
"aria-label": `Uploading ${name}`,
|
|
2780
2849
|
className: "h-0.75 w-full overflow-hidden rounded-sm bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5",
|
|
2781
|
-
children: /* @__PURE__ */ (0,
|
|
2850
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_radix_ui20.Progress.Indicator, { className: "h-full bg-accent transition-[width]", style: { width: `${progress}%` } })
|
|
2782
2851
|
}
|
|
2783
2852
|
)
|
|
2784
2853
|
]
|
|
@@ -2789,25 +2858,25 @@ var FileUploadItem = React37.forwardRef(
|
|
|
2789
2858
|
FileUploadItem.displayName = "FileUploadItem";
|
|
2790
2859
|
|
|
2791
2860
|
// src/components/Question Types/Media.tsx
|
|
2792
|
-
var
|
|
2793
|
-
var
|
|
2861
|
+
var React39 = __toESM(require("react"), 1);
|
|
2862
|
+
var import_react20 = require("@phosphor-icons/react");
|
|
2794
2863
|
var import_radix_ui21 = require("radix-ui");
|
|
2795
|
-
var
|
|
2864
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2796
2865
|
function MediaInfo({ name, details, onRemove, removeLabel, large, className, ...props }) {
|
|
2797
|
-
return /* @__PURE__ */ (0,
|
|
2798
|
-
/* @__PURE__ */ (0,
|
|
2799
|
-
/* @__PURE__ */ (0,
|
|
2800
|
-
details && /* @__PURE__ */ (0,
|
|
2801
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
2866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: cn("flex items-center justify-between border-t border-border bg-surface px-6 py-4", className), ...props, children: [
|
|
2867
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2868
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: cn("truncate text-surface-foreground", large ? "text-body-section" : "text-ui-label"), children: name }),
|
|
2869
|
+
details && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("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__ */ (0, import_jsx_runtime40.jsxs)(React39.Fragment, { children: [
|
|
2870
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2802
2871
|
part
|
|
2803
2872
|
] }, part)) })
|
|
2804
2873
|
] }),
|
|
2805
|
-
onRemove && /* @__PURE__ */ (0,
|
|
2874
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { type: "button", variant: "destructive", size: "icon", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.Trash, { size: 16, "aria-hidden": true }) })
|
|
2806
2875
|
] });
|
|
2807
2876
|
}
|
|
2808
|
-
var ImagePreview =
|
|
2809
|
-
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2810
|
-
/* @__PURE__ */ (0,
|
|
2877
|
+
var ImagePreview = React39.forwardRef(
|
|
2878
|
+
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border", className), ...props, children: [
|
|
2879
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2811
2880
|
"div",
|
|
2812
2881
|
{
|
|
2813
2882
|
className: cn(
|
|
@@ -2818,12 +2887,12 @@ var ImagePreview = React38.forwardRef(
|
|
|
2818
2887
|
children
|
|
2819
2888
|
}
|
|
2820
2889
|
),
|
|
2821
|
-
/* @__PURE__ */ (0,
|
|
2890
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MediaInfo, { name, details, onRemove, large: true })
|
|
2822
2891
|
] })
|
|
2823
2892
|
);
|
|
2824
2893
|
ImagePreview.displayName = "ImagePreview";
|
|
2825
|
-
var ImageThumbnails =
|
|
2826
|
-
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2894
|
+
var ImageThumbnails = React39.forwardRef(
|
|
2895
|
+
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2827
2896
|
import_radix_ui21.ToggleGroup.Root,
|
|
2828
2897
|
{
|
|
2829
2898
|
ref,
|
|
@@ -2835,17 +2904,17 @@ var ImageThumbnails = React38.forwardRef(
|
|
|
2835
2904
|
children: Array.from({ length: max }, (_, index) => {
|
|
2836
2905
|
const image = images[index];
|
|
2837
2906
|
if (!image) {
|
|
2838
|
-
return /* @__PURE__ */ (0,
|
|
2907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2839
2908
|
"span",
|
|
2840
2909
|
{
|
|
2841
2910
|
"aria-hidden": "true",
|
|
2842
2911
|
className: "flex h-20 min-w-0 flex-1 items-center justify-center rounded-sm border border-dashed border-border text-accent-foreground",
|
|
2843
|
-
children: /* @__PURE__ */ (0,
|
|
2912
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.Image, { size: 24 })
|
|
2844
2913
|
},
|
|
2845
2914
|
`empty-${index}`
|
|
2846
2915
|
);
|
|
2847
2916
|
}
|
|
2848
|
-
return /* @__PURE__ */ (0,
|
|
2917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2849
2918
|
import_radix_ui21.ToggleGroup.Item,
|
|
2850
2919
|
{
|
|
2851
2920
|
value: image.id,
|
|
@@ -2855,7 +2924,7 @@ var ImageThumbnails = React38.forwardRef(
|
|
|
2855
2924
|
"hover:bg-accent-soft hover:bg-none",
|
|
2856
2925
|
"data-[state=on]:border-accent-foreground data-[state=on]:bg-accent-soft data-[state=on]:bg-none data-[state=on]:text-accent-foreground"
|
|
2857
2926
|
),
|
|
2858
|
-
children: image.src ? /* @__PURE__ */ (0,
|
|
2927
|
+
children: image.src ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("img", { src: image.src, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.Image, { size: 24, "aria-hidden": true })
|
|
2859
2928
|
},
|
|
2860
2929
|
image.id
|
|
2861
2930
|
);
|
|
@@ -2868,13 +2937,13 @@ var formatTime = (seconds) => {
|
|
|
2868
2937
|
const total = Math.max(0, Math.floor(Number.isFinite(seconds) ? seconds : 0));
|
|
2869
2938
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
2870
2939
|
};
|
|
2871
|
-
var VideoPlayer =
|
|
2940
|
+
var VideoPlayer = React39.forwardRef(
|
|
2872
2941
|
({ className, src, name, details, onRemove, onMore, initialTime = 0, initialDuration = 0, ...props }, ref) => {
|
|
2873
|
-
const video =
|
|
2874
|
-
const [playing, setPlaying] =
|
|
2875
|
-
const [time, setTime] =
|
|
2876
|
-
const [duration, setDuration] =
|
|
2877
|
-
const [volume, setVolume] =
|
|
2942
|
+
const video = React39.useRef(null);
|
|
2943
|
+
const [playing, setPlaying] = React39.useState(false);
|
|
2944
|
+
const [time, setTime] = React39.useState(initialTime);
|
|
2945
|
+
const [duration, setDuration] = React39.useState(initialDuration);
|
|
2946
|
+
const [volume, setVolume] = React39.useState(1);
|
|
2878
2947
|
const muted = volume === 0;
|
|
2879
2948
|
const toggle2 = () => {
|
|
2880
2949
|
const el = video.current;
|
|
@@ -2882,9 +2951,9 @@ var VideoPlayer = React38.forwardRef(
|
|
|
2882
2951
|
if (el.paused) void el.play();
|
|
2883
2952
|
else el.pause();
|
|
2884
2953
|
};
|
|
2885
|
-
return /* @__PURE__ */ (0,
|
|
2886
|
-
/* @__PURE__ */ (0,
|
|
2887
|
-
src && /* @__PURE__ */ (0,
|
|
2954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface", className), ...props, children: [
|
|
2955
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "relative flex h-60.5 w-full items-end bg-accent-soft", children: [
|
|
2956
|
+
src && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2888
2957
|
"video",
|
|
2889
2958
|
{
|
|
2890
2959
|
ref: video,
|
|
@@ -2897,8 +2966,8 @@ var VideoPlayer = React38.forwardRef(
|
|
|
2897
2966
|
onVolumeChange: (event) => setVolume(event.currentTarget.muted ? 0 : event.currentTarget.volume)
|
|
2898
2967
|
}
|
|
2899
2968
|
),
|
|
2900
|
-
/* @__PURE__ */ (0,
|
|
2901
|
-
/* @__PURE__ */ (0,
|
|
2969
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("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: [
|
|
2970
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2902
2971
|
import_radix_ui21.Slider.Root,
|
|
2903
2972
|
{
|
|
2904
2973
|
min: 0,
|
|
@@ -2912,31 +2981,31 @@ var VideoPlayer = React38.forwardRef(
|
|
|
2912
2981
|
},
|
|
2913
2982
|
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
2914
2983
|
children: [
|
|
2915
|
-
/* @__PURE__ */ (0,
|
|
2916
|
-
/* @__PURE__ */ (0,
|
|
2984
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui21.Slider.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui21.Slider.Range, { className: "absolute h-full bg-accent-foreground" }) }),
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui21.Slider.Thumb, { "aria-label": "Seek", className: "block size-3 rounded-full border-2 border-surface bg-surface shadow-sm" })
|
|
2917
2986
|
]
|
|
2918
2987
|
}
|
|
2919
2988
|
),
|
|
2920
|
-
/* @__PURE__ */ (0,
|
|
2921
|
-
/* @__PURE__ */ (0,
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
2990
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
2991
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2923
2992
|
"button",
|
|
2924
2993
|
{
|
|
2925
2994
|
type: "button",
|
|
2926
2995
|
"aria-label": playing ? "Pause" : "Play",
|
|
2927
2996
|
onClick: toggle2,
|
|
2928
2997
|
className: "inline-flex size-10 items-center justify-center rounded-full bg-surface/12 text-surface transition-colors hover:bg-surface/20",
|
|
2929
|
-
children: playing ? /* @__PURE__ */ (0,
|
|
2998
|
+
children: playing ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.Pause, { size: 16, weight: "fill", "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.Play, { size: 16, weight: "fill", "aria-hidden": true })
|
|
2930
2999
|
}
|
|
2931
3000
|
),
|
|
2932
|
-
/* @__PURE__ */ (0,
|
|
3001
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "text-ui-label whitespace-nowrap text-surface/80", children: [
|
|
2933
3002
|
formatTime(time),
|
|
2934
3003
|
" / ",
|
|
2935
3004
|
formatTime(duration)
|
|
2936
3005
|
] })
|
|
2937
3006
|
] }),
|
|
2938
|
-
/* @__PURE__ */ (0,
|
|
2939
|
-
/* @__PURE__ */ (0,
|
|
3007
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3008
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2940
3009
|
VolumeControl,
|
|
2941
3010
|
{
|
|
2942
3011
|
volume,
|
|
@@ -2949,41 +3018,41 @@ var VideoPlayer = React38.forwardRef(
|
|
|
2949
3018
|
}
|
|
2950
3019
|
}
|
|
2951
3020
|
),
|
|
2952
|
-
/* @__PURE__ */ (0,
|
|
3021
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2953
3022
|
"button",
|
|
2954
3023
|
{
|
|
2955
3024
|
type: "button",
|
|
2956
3025
|
"aria-label": "Full screen",
|
|
2957
3026
|
onClick: () => void video.current?.requestFullscreen?.(),
|
|
2958
3027
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2959
|
-
children: /* @__PURE__ */ (0,
|
|
3028
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.CornersOut, { size: 16, "aria-hidden": true })
|
|
2960
3029
|
}
|
|
2961
3030
|
),
|
|
2962
|
-
/* @__PURE__ */ (0,
|
|
3031
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2963
3032
|
"button",
|
|
2964
3033
|
{
|
|
2965
3034
|
type: "button",
|
|
2966
3035
|
"aria-label": "More",
|
|
2967
3036
|
onClick: onMore,
|
|
2968
3037
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2969
|
-
children: /* @__PURE__ */ (0,
|
|
3038
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.DotsThree, { size: 16, "aria-hidden": true })
|
|
2970
3039
|
}
|
|
2971
3040
|
)
|
|
2972
3041
|
] })
|
|
2973
3042
|
] })
|
|
2974
3043
|
] })
|
|
2975
3044
|
] }),
|
|
2976
|
-
name && /* @__PURE__ */ (0,
|
|
2977
|
-
/* @__PURE__ */ (0,
|
|
3045
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MediaInfo, { name, details, onRemove }),
|
|
3046
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "sr-only", "aria-live": "polite", children: muted ? "Muted" : "" })
|
|
2978
3047
|
] });
|
|
2979
3048
|
}
|
|
2980
3049
|
);
|
|
2981
3050
|
VideoPlayer.displayName = "VideoPlayer";
|
|
2982
3051
|
function VolumeControl({ volume, onVolumeChange, className }) {
|
|
2983
|
-
const last =
|
|
3052
|
+
const last = React39.useRef(volume || 1);
|
|
2984
3053
|
if (volume > 0) last.current = volume;
|
|
2985
|
-
return /* @__PURE__ */ (0,
|
|
2986
|
-
/* @__PURE__ */ (0,
|
|
3054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: cn("group/volume flex items-center", className), children: [
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("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__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2987
3056
|
import_radix_ui21.Slider.Root,
|
|
2988
3057
|
{
|
|
2989
3058
|
min: 0,
|
|
@@ -2993,32 +3062,32 @@ function VolumeControl({ volume, onVolumeChange, className }) {
|
|
|
2993
3062
|
onValueChange: ([next]) => next !== void 0 && onVolumeChange(next),
|
|
2994
3063
|
className: "relative flex h-4 w-14 touch-none items-center select-none",
|
|
2995
3064
|
children: [
|
|
2996
|
-
/* @__PURE__ */ (0,
|
|
2997
|
-
/* @__PURE__ */ (0,
|
|
3065
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui21.Slider.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui21.Slider.Range, { className: "absolute h-full bg-surface" }) }),
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui21.Slider.Thumb, { "aria-label": "Volume", className: "block size-3 rounded-full bg-surface shadow-sm" })
|
|
2998
3067
|
]
|
|
2999
3068
|
}
|
|
3000
3069
|
) }),
|
|
3001
|
-
/* @__PURE__ */ (0,
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3002
3071
|
"button",
|
|
3003
3072
|
{
|
|
3004
3073
|
type: "button",
|
|
3005
3074
|
"aria-label": volume === 0 ? "Unmute" : "Mute",
|
|
3006
3075
|
onClick: () => onVolumeChange(volume === 0 ? last.current : 0),
|
|
3007
3076
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
3008
|
-
children: volume === 0 ? /* @__PURE__ */ (0,
|
|
3077
|
+
children: volume === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.SpeakerSimpleX, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react20.SpeakerSimpleHigh, { size: 16, "aria-hidden": true })
|
|
3009
3078
|
}
|
|
3010
3079
|
)
|
|
3011
3080
|
] });
|
|
3012
3081
|
}
|
|
3013
3082
|
|
|
3014
3083
|
// src/components/Question Types/OpenEndAnswer.tsx
|
|
3015
|
-
var
|
|
3016
|
-
var
|
|
3017
|
-
var OpenEndAnswer =
|
|
3084
|
+
var React40 = __toESM(require("react"), 1);
|
|
3085
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3086
|
+
var OpenEndAnswer = React40.forwardRef(
|
|
3018
3087
|
({ value, defaultValue, onChange, maxLength = 1e3, placeholder = "Write your answer", ...props }, ref) => {
|
|
3019
|
-
const [internal, setInternal] =
|
|
3088
|
+
const [internal, setInternal] = React40.useState(String(defaultValue ?? ""));
|
|
3020
3089
|
const text = value !== void 0 ? String(value) : internal;
|
|
3021
|
-
return /* @__PURE__ */ (0,
|
|
3090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3022
3091
|
Textarea,
|
|
3023
3092
|
{
|
|
3024
3093
|
ref,
|
|
@@ -3038,10 +3107,10 @@ var OpenEndAnswer = React39.forwardRef(
|
|
|
3038
3107
|
OpenEndAnswer.displayName = "OpenEndAnswer";
|
|
3039
3108
|
|
|
3040
3109
|
// src/components/Question Types/QuestionCard.tsx
|
|
3041
|
-
var
|
|
3042
|
-
var
|
|
3043
|
-
var QuestionCard =
|
|
3044
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3110
|
+
var React41 = __toESM(require("react"), 1);
|
|
3111
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3112
|
+
var QuestionCard = React41.forwardRef(
|
|
3113
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3045
3114
|
"div",
|
|
3046
3115
|
{
|
|
3047
3116
|
ref,
|
|
@@ -3053,8 +3122,8 @@ var QuestionCard = React40.forwardRef(
|
|
|
3053
3122
|
QuestionCard.displayName = "QuestionCard";
|
|
3054
3123
|
|
|
3055
3124
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3056
|
-
var
|
|
3057
|
-
var
|
|
3125
|
+
var React44 = __toESM(require("react"), 1);
|
|
3126
|
+
var import_react23 = require("@phosphor-icons/react");
|
|
3058
3127
|
|
|
3059
3128
|
// src/lib/keepEditingFocus.ts
|
|
3060
3129
|
function keepEditingFocus(event) {
|
|
@@ -3065,46 +3134,46 @@ function keepEditingFocus(event) {
|
|
|
3065
3134
|
}
|
|
3066
3135
|
|
|
3067
3136
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3068
|
-
var
|
|
3069
|
-
var
|
|
3137
|
+
var React43 = __toESM(require("react"), 1);
|
|
3138
|
+
var import_react22 = require("@phosphor-icons/react");
|
|
3070
3139
|
|
|
3071
3140
|
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
3072
|
-
var
|
|
3073
|
-
var
|
|
3074
|
-
var
|
|
3141
|
+
var React42 = require("react");
|
|
3142
|
+
var import_react21 = require("@phosphor-icons/react");
|
|
3143
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3075
3144
|
var icons = {
|
|
3076
|
-
"select-one":
|
|
3077
|
-
"select-multiple":
|
|
3078
|
-
ranking:
|
|
3079
|
-
upload:
|
|
3080
|
-
"upload-video":
|
|
3081
|
-
"upload-photo":
|
|
3082
|
-
"upload-document":
|
|
3083
|
-
rating:
|
|
3084
|
-
"open-end":
|
|
3085
|
-
"screen-recording":
|
|
3145
|
+
"select-one": import_react21.RadioButton,
|
|
3146
|
+
"select-multiple": import_react21.CheckSquare,
|
|
3147
|
+
ranking: import_react21.ListNumbers,
|
|
3148
|
+
upload: import_react21.FileArrowUp,
|
|
3149
|
+
"upload-video": import_react21.VideoCamera,
|
|
3150
|
+
"upload-photo": import_react21.Image,
|
|
3151
|
+
"upload-document": import_react21.FileText,
|
|
3152
|
+
rating: import_react21.StarHalf,
|
|
3153
|
+
"open-end": import_react21.ChatsCircle,
|
|
3154
|
+
"screen-recording": import_react21.VideoCamera
|
|
3086
3155
|
};
|
|
3087
3156
|
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
3088
3157
|
const Icon = icons[type];
|
|
3089
|
-
return /* @__PURE__ */ (0,
|
|
3158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
3090
3159
|
}
|
|
3091
3160
|
|
|
3092
3161
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3093
|
-
var
|
|
3162
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3094
3163
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
3095
|
-
var QuestionHeader =
|
|
3164
|
+
var QuestionHeader = React43.forwardRef(
|
|
3096
3165
|
({ 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, ...props }, ref) => {
|
|
3097
|
-
const [draft, setDraft] =
|
|
3166
|
+
const [draft, setDraft] = React43.useState(null);
|
|
3098
3167
|
const label = String(number).padStart(2, "0");
|
|
3099
3168
|
const showError = error !== void 0 && error !== false;
|
|
3100
3169
|
if (editor) {
|
|
3101
3170
|
const text = typeof title === "string" ? title : "";
|
|
3102
3171
|
const count = (draft ?? text).length;
|
|
3103
3172
|
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
3104
|
-
return /* @__PURE__ */ (0,
|
|
3105
|
-
/* @__PURE__ */ (0,
|
|
3106
|
-
/* @__PURE__ */ (0,
|
|
3107
|
-
/* @__PURE__ */ (0,
|
|
3173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
3174
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3176
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3108
3177
|
"span",
|
|
3109
3178
|
{
|
|
3110
3179
|
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
@@ -3120,7 +3189,7 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3120
3189
|
dragHandleProps?.className
|
|
3121
3190
|
),
|
|
3122
3191
|
children: [
|
|
3123
|
-
questionType && /* @__PURE__ */ (0,
|
|
3192
|
+
questionType && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3124
3193
|
QuestionTypeIcon,
|
|
3125
3194
|
{
|
|
3126
3195
|
type: questionType,
|
|
@@ -3128,8 +3197,8 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3128
3197
|
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3129
3198
|
}
|
|
3130
3199
|
),
|
|
3131
|
-
showDragHandle && /* @__PURE__ */ (0,
|
|
3132
|
-
|
|
3200
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3201
|
+
import_react22.DotsSixVertical,
|
|
3133
3202
|
{
|
|
3134
3203
|
size: 16,
|
|
3135
3204
|
"aria-hidden": true,
|
|
@@ -3143,13 +3212,13 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3143
3212
|
),
|
|
3144
3213
|
meta
|
|
3145
3214
|
] }),
|
|
3146
|
-
actions && /* @__PURE__ */ (0,
|
|
3215
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: cn(
|
|
3147
3216
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
3148
3217
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
3149
3218
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
3150
3219
|
), children: actions })
|
|
3151
3220
|
] }),
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3221
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3153
3222
|
InlineEdit,
|
|
3154
3223
|
{
|
|
3155
3224
|
variant: "question",
|
|
@@ -3174,8 +3243,8 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3174
3243
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
3175
3244
|
}
|
|
3176
3245
|
),
|
|
3177
|
-
long && titleRecommendedNote != null && /* @__PURE__ */ (0,
|
|
3178
|
-
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0,
|
|
3246
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
3247
|
+
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3179
3248
|
count,
|
|
3180
3249
|
"/",
|
|
3181
3250
|
maxLength,
|
|
@@ -3183,16 +3252,16 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3183
3252
|
] })
|
|
3184
3253
|
] });
|
|
3185
3254
|
}
|
|
3186
|
-
return /* @__PURE__ */ (0,
|
|
3187
|
-
showError && /* @__PURE__ */ (0,
|
|
3188
|
-
/* @__PURE__ */ (0,
|
|
3255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3256
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ToastInline, { variant: "destructive", onClose: onDismissError, className: "min-h-10", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-ui-label text-destructive", children: error === true ? "This question is mandatory." : error }) }),
|
|
3257
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("p", { className: eyebrow, children: [
|
|
3189
3258
|
"Question ",
|
|
3190
3259
|
label
|
|
3191
3260
|
] }),
|
|
3192
|
-
/* @__PURE__ */ (0,
|
|
3261
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
3193
3262
|
title,
|
|
3194
|
-
required && /* @__PURE__ */ (0,
|
|
3195
|
-
required && /* @__PURE__ */ (0,
|
|
3263
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
3264
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "sr-only", children: " (required)" })
|
|
3196
3265
|
] })
|
|
3197
3266
|
] });
|
|
3198
3267
|
}
|
|
@@ -3200,8 +3269,8 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3200
3269
|
QuestionHeader.displayName = "QuestionHeader";
|
|
3201
3270
|
|
|
3202
3271
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3203
|
-
var
|
|
3204
|
-
var QuestionEditorCard =
|
|
3272
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3273
|
+
var QuestionEditorCard = React44.forwardRef(
|
|
3205
3274
|
({
|
|
3206
3275
|
className,
|
|
3207
3276
|
number,
|
|
@@ -3236,7 +3305,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3236
3305
|
...props
|
|
3237
3306
|
}, ref) => {
|
|
3238
3307
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
3239
|
-
return /* @__PURE__ */ (0,
|
|
3308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3240
3309
|
"div",
|
|
3241
3310
|
{
|
|
3242
3311
|
ref,
|
|
@@ -3248,7 +3317,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3248
3317
|
props.onMouseDown?.(event);
|
|
3249
3318
|
},
|
|
3250
3319
|
children: [
|
|
3251
|
-
/* @__PURE__ */ (0,
|
|
3320
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3252
3321
|
"div",
|
|
3253
3322
|
{
|
|
3254
3323
|
className: cn(
|
|
@@ -3256,9 +3325,9 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3256
3325
|
active ? "border-accent" : "border-border"
|
|
3257
3326
|
),
|
|
3258
3327
|
children: [
|
|
3259
|
-
/* @__PURE__ */ (0,
|
|
3260
|
-
/* @__PURE__ */ (0,
|
|
3261
|
-
/* @__PURE__ */ (0,
|
|
3328
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
3329
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
3330
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3262
3331
|
QuestionHeader,
|
|
3263
3332
|
{
|
|
3264
3333
|
editor: true,
|
|
@@ -3280,8 +3349,8 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3280
3349
|
onTitleMarkDismiss,
|
|
3281
3350
|
meta,
|
|
3282
3351
|
maxLength,
|
|
3283
|
-
actions: actions ?? /* @__PURE__ */ (0,
|
|
3284
|
-
/* @__PURE__ */ (0,
|
|
3352
|
+
actions: actions ?? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3285
3354
|
Button,
|
|
3286
3355
|
{
|
|
3287
3356
|
type: "button",
|
|
@@ -3289,10 +3358,10 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3289
3358
|
size: "icon-sm",
|
|
3290
3359
|
"aria-label": "Duplicate question",
|
|
3291
3360
|
onClick: onDuplicate,
|
|
3292
|
-
children: /* @__PURE__ */ (0,
|
|
3361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Copy, { size: 16, "aria-hidden": true })
|
|
3293
3362
|
}
|
|
3294
3363
|
),
|
|
3295
|
-
/* @__PURE__ */ (0,
|
|
3364
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3296
3365
|
Button,
|
|
3297
3366
|
{
|
|
3298
3367
|
type: "button",
|
|
@@ -3300,10 +3369,10 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3300
3369
|
size: "icon-sm",
|
|
3301
3370
|
"aria-label": "Delete question",
|
|
3302
3371
|
onClick: onDelete,
|
|
3303
|
-
children: /* @__PURE__ */ (0,
|
|
3372
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Trash, { size: 16, "aria-hidden": true })
|
|
3304
3373
|
}
|
|
3305
3374
|
),
|
|
3306
|
-
/* @__PURE__ */ (0,
|
|
3375
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3307
3376
|
Button,
|
|
3308
3377
|
{
|
|
3309
3378
|
type: "button",
|
|
@@ -3311,7 +3380,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3311
3380
|
size: "icon-sm",
|
|
3312
3381
|
"aria-label": "Preview question",
|
|
3313
3382
|
onClick: onPreview,
|
|
3314
|
-
children: /* @__PURE__ */ (0,
|
|
3383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Eye, { size: 16, "aria-hidden": true })
|
|
3315
3384
|
}
|
|
3316
3385
|
)
|
|
3317
3386
|
] })
|
|
@@ -3319,18 +3388,18 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3319
3388
|
),
|
|
3320
3389
|
children
|
|
3321
3390
|
] }),
|
|
3322
|
-
error && /* @__PURE__ */ (0,
|
|
3323
|
-
/* @__PURE__ */ (0,
|
|
3391
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3392
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Warning, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3324
3393
|
error
|
|
3325
3394
|
] }),
|
|
3326
|
-
footer && /* @__PURE__ */ (0,
|
|
3327
|
-
/* @__PURE__ */ (0,
|
|
3328
|
-
/* @__PURE__ */ (0,
|
|
3329
|
-
onAdd && /* @__PURE__ */ (0,
|
|
3330
|
-
/* @__PURE__ */ (0,
|
|
3395
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3398
|
+
onAdd && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Plus, { size: 16, "aria-hidden": true }),
|
|
3331
3400
|
"Add choice"
|
|
3332
3401
|
] }),
|
|
3333
|
-
onPaste && /* @__PURE__ */ (0,
|
|
3402
|
+
onPaste && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3334
3403
|
Button,
|
|
3335
3404
|
{
|
|
3336
3405
|
type: "button",
|
|
@@ -3338,17 +3407,17 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3338
3407
|
size: "icon",
|
|
3339
3408
|
"aria-label": "Paste choices",
|
|
3340
3409
|
onClick: onPaste,
|
|
3341
|
-
children: /* @__PURE__ */ (0,
|
|
3410
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Clipboard, { size: 16, "aria-hidden": true })
|
|
3342
3411
|
}
|
|
3343
3412
|
)
|
|
3344
3413
|
] })
|
|
3345
3414
|
] })
|
|
3346
3415
|
] }),
|
|
3347
|
-
note && /* @__PURE__ */ (0,
|
|
3416
|
+
note && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
3348
3417
|
]
|
|
3349
3418
|
}
|
|
3350
3419
|
),
|
|
3351
|
-
onAskAi && /* @__PURE__ */ (0,
|
|
3420
|
+
onAskAi && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3352
3421
|
Button,
|
|
3353
3422
|
{
|
|
3354
3423
|
type: "button",
|
|
@@ -3357,7 +3426,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3357
3426
|
"aria-label": "Ask AI",
|
|
3358
3427
|
onClick: onAskAi,
|
|
3359
3428
|
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",
|
|
3360
|
-
children: /* @__PURE__ */ (0,
|
|
3429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react23.Sparkle, { size: 16, "aria-hidden": true })
|
|
3361
3430
|
}
|
|
3362
3431
|
)
|
|
3363
3432
|
]
|
|
@@ -3368,15 +3437,15 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3368
3437
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
3369
3438
|
|
|
3370
3439
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
3371
|
-
var
|
|
3372
|
-
var
|
|
3440
|
+
var React45 = __toESM(require("react"), 1);
|
|
3441
|
+
var import_react24 = require("@phosphor-icons/react");
|
|
3373
3442
|
var import_radix_ui22 = require("radix-ui");
|
|
3374
|
-
var
|
|
3375
|
-
var QuestionNavItem =
|
|
3443
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3444
|
+
var QuestionNavItem = React45.forwardRef(
|
|
3376
3445
|
({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3377
3446
|
const Comp = asChild ? import_radix_ui22.Slot.Root : "button";
|
|
3378
3447
|
const warn = !error && !!warning;
|
|
3379
|
-
return /* @__PURE__ */ (0,
|
|
3448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3380
3449
|
Comp,
|
|
3381
3450
|
{
|
|
3382
3451
|
ref,
|
|
@@ -3395,9 +3464,9 @@ var QuestionNavItem = React44.forwardRef(
|
|
|
3395
3464
|
),
|
|
3396
3465
|
...props,
|
|
3397
3466
|
children: [
|
|
3398
|
-
/* @__PURE__ */ (0,
|
|
3399
|
-
showDragHandle && /* @__PURE__ */ (0,
|
|
3400
|
-
/* @__PURE__ */ (0,
|
|
3467
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3468
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react24.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react24.WarningCircle, { size: 16, className: "text-destructive-foreground" }) : warn ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react24.Warning, { size: 16, className: "text-warning-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3401
3470
|
QuestionTypeIcon,
|
|
3402
3471
|
{
|
|
3403
3472
|
type: questionType,
|
|
@@ -3406,9 +3475,9 @@ var QuestionNavItem = React44.forwardRef(
|
|
|
3406
3475
|
}
|
|
3407
3476
|
) })
|
|
3408
3477
|
] }),
|
|
3409
|
-
/* @__PURE__ */ (0,
|
|
3410
|
-
error && /* @__PURE__ */ (0,
|
|
3411
|
-
warn && /* @__PURE__ */ (0,
|
|
3478
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3479
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "sr-only", children: ", has errors" }),
|
|
3480
|
+
warn && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "sr-only", children: ", has warnings" })
|
|
3412
3481
|
]
|
|
3413
3482
|
}
|
|
3414
3483
|
);
|
|
@@ -3417,14 +3486,14 @@ var QuestionNavItem = React44.forwardRef(
|
|
|
3417
3486
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
3418
3487
|
|
|
3419
3488
|
// src/components/Question Types/QuestionOption.tsx
|
|
3420
|
-
var
|
|
3421
|
-
var
|
|
3422
|
-
var
|
|
3489
|
+
var React46 = __toESM(require("react"), 1);
|
|
3490
|
+
var import_react25 = require("@phosphor-icons/react");
|
|
3491
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3423
3492
|
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";
|
|
3424
3493
|
function QuestionOption(props) {
|
|
3425
|
-
const id =
|
|
3426
|
-
return /* @__PURE__ */ (0,
|
|
3427
|
-
props.kind === "checkbox" ? /* @__PURE__ */ (0,
|
|
3494
|
+
const id = React46.useId();
|
|
3495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3496
|
+
props.kind === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3428
3497
|
Checkbox,
|
|
3429
3498
|
{
|
|
3430
3499
|
id,
|
|
@@ -3433,16 +3502,16 @@ function QuestionOption(props) {
|
|
|
3433
3502
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
3434
3503
|
disabled: props.disabled
|
|
3435
3504
|
}
|
|
3436
|
-
) : /* @__PURE__ */ (0,
|
|
3437
|
-
/* @__PURE__ */ (0,
|
|
3505
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3506
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3438
3507
|
] });
|
|
3439
3508
|
}
|
|
3440
|
-
var QuestionOtherOption =
|
|
3509
|
+
var QuestionOtherOption = React46.forwardRef(
|
|
3441
3510
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3442
|
-
const inner =
|
|
3443
|
-
|
|
3511
|
+
const inner = React46.useRef(null);
|
|
3512
|
+
React46.useImperativeHandle(ref, () => inner.current);
|
|
3444
3513
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3445
|
-
return /* @__PURE__ */ (0,
|
|
3514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3446
3515
|
"div",
|
|
3447
3516
|
{
|
|
3448
3517
|
className: cn(
|
|
@@ -3450,7 +3519,7 @@ var QuestionOtherOption = React45.forwardRef(
|
|
|
3450
3519
|
className
|
|
3451
3520
|
),
|
|
3452
3521
|
children: [
|
|
3453
|
-
/* @__PURE__ */ (0,
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3454
3523
|
"input",
|
|
3455
3524
|
{
|
|
3456
3525
|
ref: inner,
|
|
@@ -3466,7 +3535,7 @@ var QuestionOtherOption = React45.forwardRef(
|
|
|
3466
3535
|
...props
|
|
3467
3536
|
}
|
|
3468
3537
|
),
|
|
3469
|
-
/* @__PURE__ */ (0,
|
|
3538
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { type: "button", variant: "subtle", size: "icon-sm", "aria-label": confirmLabel, onClick: submit, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react25.Check, { size: 16, "aria-hidden": true }) })
|
|
3470
3539
|
]
|
|
3471
3540
|
}
|
|
3472
3541
|
);
|
|
@@ -3481,16 +3550,16 @@ function limitsText2(min, max) {
|
|
|
3481
3550
|
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3482
3551
|
const reveal = kind !== void 0;
|
|
3483
3552
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3484
|
-
const [draft, setDraft] =
|
|
3485
|
-
const [error, setError] =
|
|
3486
|
-
const helperId =
|
|
3487
|
-
const [focused, setFocused] =
|
|
3553
|
+
const [draft, setDraft] = React46.useState(null);
|
|
3554
|
+
const [error, setError] = React46.useState(null);
|
|
3555
|
+
const helperId = React46.useId();
|
|
3556
|
+
const [focused, setFocused] = React46.useState(false);
|
|
3488
3557
|
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3489
|
-
const fieldRef =
|
|
3490
|
-
const [editMarks, setEditMarks] =
|
|
3491
|
-
const [scroll, setScroll] =
|
|
3558
|
+
const fieldRef = React46.useRef(null);
|
|
3559
|
+
const [editMarks, setEditMarks] = React46.useState([]);
|
|
3560
|
+
const [scroll, setScroll] = React46.useState(0);
|
|
3492
3561
|
const typed = guarded ? draft ?? label : label;
|
|
3493
|
-
const skipBlur =
|
|
3562
|
+
const skipBlur = React46.useRef(false);
|
|
3494
3563
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3495
3564
|
const save = () => {
|
|
3496
3565
|
if (draft === null) return true;
|
|
@@ -3511,9 +3580,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3511
3580
|
...dragHandleProps,
|
|
3512
3581
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3513
3582
|
} : { "aria-hidden": true };
|
|
3514
|
-
const grip = dragHandleProps ? /* @__PURE__ */ (0,
|
|
3515
|
-
return /* @__PURE__ */ (0,
|
|
3516
|
-
/* @__PURE__ */ (0,
|
|
3583
|
+
const grip = dragHandleProps ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react25.DotsSixVertical, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react25.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
|
|
3584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3585
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3517
3586
|
"div",
|
|
3518
3587
|
{
|
|
3519
3588
|
className: cn(
|
|
@@ -3523,10 +3592,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3523
3592
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3524
3593
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3525
3594
|
),
|
|
3526
|
-
children: /* @__PURE__ */ (0,
|
|
3527
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */ (0,
|
|
3595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3596
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3528
3597
|
!locked && grip,
|
|
3529
|
-
/* @__PURE__ */ (0,
|
|
3598
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3530
3599
|
"span",
|
|
3531
3600
|
{
|
|
3532
3601
|
"aria-hidden": "true",
|
|
@@ -3534,8 +3603,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3534
3603
|
children: rank
|
|
3535
3604
|
}
|
|
3536
3605
|
)
|
|
3537
|
-
] }) : reveal && locked ? /* @__PURE__ */ (0,
|
|
3538
|
-
/* @__PURE__ */ (0,
|
|
3606
|
+
] }) : reveal && locked ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3539
3608
|
"span",
|
|
3540
3609
|
{
|
|
3541
3610
|
"aria-hidden": "true",
|
|
@@ -3546,8 +3615,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3546
3615
|
)
|
|
3547
3616
|
}
|
|
3548
3617
|
),
|
|
3549
|
-
/* @__PURE__ */ (0,
|
|
3550
|
-
|
|
3618
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3619
|
+
import_react25.DotsSixVertical,
|
|
3551
3620
|
{
|
|
3552
3621
|
size: 20,
|
|
3553
3622
|
"aria-hidden": true,
|
|
@@ -3558,10 +3627,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3558
3627
|
}
|
|
3559
3628
|
)
|
|
3560
3629
|
] }) : locked ? null : grip }),
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
3562
|
-
/* @__PURE__ */ (0,
|
|
3563
|
-
focused && editMarks.length > 0 && /* @__PURE__ */ (0,
|
|
3564
|
-
/* @__PURE__ */ (0,
|
|
3630
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3631
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "relative min-w-0", children: [
|
|
3632
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DraftMarks, { layer: "behind", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3633
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3565
3634
|
"input",
|
|
3566
3635
|
{
|
|
3567
3636
|
ref: fieldRef,
|
|
@@ -3616,24 +3685,24 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3616
3685
|
)
|
|
3617
3686
|
}
|
|
3618
3687
|
),
|
|
3619
|
-
focused && editMarks.length > 0 && /* @__PURE__ */ (0,
|
|
3620
|
-
showMarks && /* @__PURE__ */ (0,
|
|
3621
|
-
(piece, i) => piece.mark ? /* @__PURE__ */ (0,
|
|
3688
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DraftMarks, { layer: "over", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3689
|
+
showMarks && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("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(
|
|
3690
|
+
(piece, i) => piece.mark ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: piece.text }, i)
|
|
3622
3691
|
) })
|
|
3623
3692
|
] }),
|
|
3624
|
-
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ (0,
|
|
3693
|
+
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3625
3694
|
"p",
|
|
3626
3695
|
{
|
|
3627
3696
|
id: helperId,
|
|
3628
3697
|
role: error ? "alert" : void 0,
|
|
3629
3698
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3630
3699
|
children: [
|
|
3631
|
-
/* @__PURE__ */ (0,
|
|
3632
|
-
error && /* @__PURE__ */ (0,
|
|
3700
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex items-start gap-2", children: [
|
|
3701
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react25.WarningCircle, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3633
3702
|
limitsText2(minLength, maxLength),
|
|
3634
|
-
error && /* @__PURE__ */ (0,
|
|
3703
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sr-only", children: error })
|
|
3635
3704
|
] }),
|
|
3636
|
-
/* @__PURE__ */ (0,
|
|
3705
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3637
3706
|
draft.length,
|
|
3638
3707
|
maxLength !== void 0 && `/${maxLength}`
|
|
3639
3708
|
] })
|
|
@@ -3644,7 +3713,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3644
3713
|
] })
|
|
3645
3714
|
}
|
|
3646
3715
|
),
|
|
3647
|
-
!locked && /* @__PURE__ */ (0,
|
|
3716
|
+
!locked && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3648
3717
|
"div",
|
|
3649
3718
|
{
|
|
3650
3719
|
className: cn(
|
|
@@ -3652,8 +3721,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3652
3721
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3653
3722
|
),
|
|
3654
3723
|
children: [
|
|
3655
|
-
/* @__PURE__ */ (0,
|
|
3656
|
-
/* @__PURE__ */ (0,
|
|
3724
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", disabled: removeDisabled, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react25.Trash, { size: 16, "aria-hidden": true }) }),
|
|
3725
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", disabled: addDisabled, onClick: onAdd, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react25.Plus, { size: 16, "aria-hidden": true }) })
|
|
3657
3726
|
]
|
|
3658
3727
|
}
|
|
3659
3728
|
)
|
|
@@ -3661,9 +3730,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3661
3730
|
}
|
|
3662
3731
|
|
|
3663
3732
|
// src/components/Question Types/RankList.tsx
|
|
3664
|
-
var
|
|
3665
|
-
var
|
|
3666
|
-
var
|
|
3733
|
+
var React47 = __toESM(require("react"), 1);
|
|
3734
|
+
var import_react26 = require("@phosphor-icons/react");
|
|
3735
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3667
3736
|
function move(list, from, to) {
|
|
3668
3737
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3669
3738
|
const next = list.slice();
|
|
@@ -3671,13 +3740,13 @@ function move(list, from, to) {
|
|
|
3671
3740
|
next.splice(to, 0, item);
|
|
3672
3741
|
return next;
|
|
3673
3742
|
}
|
|
3674
|
-
var RankList =
|
|
3743
|
+
var RankList = React47.forwardRef(
|
|
3675
3744
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3676
|
-
const [dragIndex, setDragIndex] =
|
|
3677
|
-
const [announcement, setAnnouncement] =
|
|
3678
|
-
const handles =
|
|
3679
|
-
const refocus =
|
|
3680
|
-
|
|
3745
|
+
const [dragIndex, setDragIndex] = React47.useState(null);
|
|
3746
|
+
const [announcement, setAnnouncement] = React47.useState("");
|
|
3747
|
+
const handles = React47.useRef(/* @__PURE__ */ new Map());
|
|
3748
|
+
const refocus = React47.useRef(null);
|
|
3749
|
+
React47.useEffect(() => {
|
|
3681
3750
|
if (refocus.current) {
|
|
3682
3751
|
handles.current.get(refocus.current)?.focus();
|
|
3683
3752
|
refocus.current = null;
|
|
@@ -3690,8 +3759,8 @@ var RankList = React46.forwardRef(
|
|
|
3690
3759
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3691
3760
|
onItemsChange(next);
|
|
3692
3761
|
};
|
|
3693
|
-
return /* @__PURE__ */ (0,
|
|
3694
|
-
/* @__PURE__ */ (0,
|
|
3762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3695
3764
|
"li",
|
|
3696
3765
|
{
|
|
3697
3766
|
draggable: true,
|
|
@@ -3708,7 +3777,7 @@ var RankList = React46.forwardRef(
|
|
|
3708
3777
|
dragIndex === index && "opacity-50"
|
|
3709
3778
|
),
|
|
3710
3779
|
children: [
|
|
3711
|
-
/* @__PURE__ */ (0,
|
|
3780
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3712
3781
|
"button",
|
|
3713
3782
|
{
|
|
3714
3783
|
type: "button",
|
|
@@ -3727,10 +3796,10 @@ var RankList = React46.forwardRef(
|
|
|
3727
3796
|
}
|
|
3728
3797
|
},
|
|
3729
3798
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3730
|
-
children: /* @__PURE__ */ (0,
|
|
3799
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react26.DotsSixVertical, { size: 16, "aria-hidden": true })
|
|
3731
3800
|
}
|
|
3732
3801
|
),
|
|
3733
|
-
/* @__PURE__ */ (0,
|
|
3802
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3734
3803
|
"span",
|
|
3735
3804
|
{
|
|
3736
3805
|
"aria-hidden": "true",
|
|
@@ -3738,27 +3807,27 @@ var RankList = React46.forwardRef(
|
|
|
3738
3807
|
children: index + 1
|
|
3739
3808
|
}
|
|
3740
3809
|
),
|
|
3741
|
-
/* @__PURE__ */ (0,
|
|
3810
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3742
3811
|
]
|
|
3743
3812
|
},
|
|
3744
3813
|
item.id
|
|
3745
3814
|
)) }),
|
|
3746
|
-
/* @__PURE__ */ (0,
|
|
3815
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3747
3816
|
] });
|
|
3748
3817
|
}
|
|
3749
3818
|
);
|
|
3750
3819
|
RankList.displayName = "RankList";
|
|
3751
3820
|
|
|
3752
3821
|
// src/components/Question Types/RatingScale.tsx
|
|
3753
|
-
var
|
|
3822
|
+
var React48 = __toESM(require("react"), 1);
|
|
3754
3823
|
var import_radix_ui23 = require("radix-ui");
|
|
3755
|
-
var
|
|
3756
|
-
var RatingScale =
|
|
3824
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3825
|
+
var RatingScale = React48.forwardRef(
|
|
3757
3826
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3758
|
-
const [internal, setInternal] =
|
|
3827
|
+
const [internal, setInternal] = React48.useState(defaultValue);
|
|
3759
3828
|
const current = value !== void 0 ? value : internal;
|
|
3760
|
-
return /* @__PURE__ */ (0,
|
|
3761
|
-
/* @__PURE__ */ (0,
|
|
3829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3830
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3762
3831
|
import_radix_ui23.ToggleGroup.Root,
|
|
3763
3832
|
{
|
|
3764
3833
|
ref,
|
|
@@ -3771,7 +3840,7 @@ var RatingScale = React47.forwardRef(
|
|
|
3771
3840
|
},
|
|
3772
3841
|
className: "flex gap-2",
|
|
3773
3842
|
...props,
|
|
3774
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ (0,
|
|
3843
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3775
3844
|
import_radix_ui23.ToggleGroup.Item,
|
|
3776
3845
|
{
|
|
3777
3846
|
value: String(n),
|
|
@@ -3787,9 +3856,9 @@ var RatingScale = React47.forwardRef(
|
|
|
3787
3856
|
))
|
|
3788
3857
|
}
|
|
3789
3858
|
),
|
|
3790
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */ (0,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
3792
|
-
/* @__PURE__ */ (0,
|
|
3859
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3860
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: lowLabel }),
|
|
3861
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: highLabel })
|
|
3793
3862
|
] })
|
|
3794
3863
|
] });
|
|
3795
3864
|
}
|
|
@@ -3797,15 +3866,15 @@ var RatingScale = React47.forwardRef(
|
|
|
3797
3866
|
RatingScale.displayName = "RatingScale";
|
|
3798
3867
|
|
|
3799
3868
|
// src/components/Question Types/StimulusCard.tsx
|
|
3800
|
-
var
|
|
3801
|
-
var
|
|
3802
|
-
var
|
|
3869
|
+
var React49 = __toESM(require("react"), 1);
|
|
3870
|
+
var import_react27 = require("@phosphor-icons/react");
|
|
3871
|
+
var import_jsx_runtime50 = (
|
|
3803
3872
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3804
3873
|
require("react/jsx-runtime")
|
|
3805
3874
|
);
|
|
3806
3875
|
var MIN_THUMBNAIL = 92;
|
|
3807
3876
|
var MAX_THUMBNAIL = 240;
|
|
3808
|
-
var StimulusCard =
|
|
3877
|
+
var StimulusCard = React49.forwardRef(
|
|
3809
3878
|
({
|
|
3810
3879
|
className,
|
|
3811
3880
|
thumbnail,
|
|
@@ -3822,14 +3891,14 @@ var StimulusCard = React48.forwardRef(
|
|
|
3822
3891
|
removeLabel = "Remove stimulus",
|
|
3823
3892
|
...props
|
|
3824
3893
|
}, ref) => {
|
|
3825
|
-
const [failedSrc, setFailedSrc] =
|
|
3894
|
+
const [failedSrc, setFailedSrc] = React49.useState();
|
|
3826
3895
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3827
3896
|
const showImage = thumbnail !== void 0 && !error;
|
|
3828
|
-
const [draft, setDraft] =
|
|
3897
|
+
const [draft, setDraft] = React49.useState(null);
|
|
3829
3898
|
const count = (draft ?? caption ?? "").length;
|
|
3830
|
-
const textRef =
|
|
3831
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3832
|
-
|
|
3899
|
+
const textRef = React49.useRef(null);
|
|
3900
|
+
const [thumbnailSize, setThumbnailSize] = React49.useState(MIN_THUMBNAIL);
|
|
3901
|
+
React49.useEffect(() => {
|
|
3833
3902
|
const el = textRef.current;
|
|
3834
3903
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3835
3904
|
const observer = new ResizeObserver(() => {
|
|
@@ -3838,7 +3907,7 @@ var StimulusCard = React48.forwardRef(
|
|
|
3838
3907
|
observer.observe(el);
|
|
3839
3908
|
return () => observer.disconnect();
|
|
3840
3909
|
}, []);
|
|
3841
|
-
return /* @__PURE__ */ (0,
|
|
3910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
3842
3911
|
"div",
|
|
3843
3912
|
{
|
|
3844
3913
|
ref,
|
|
@@ -3846,8 +3915,8 @@ var StimulusCard = React48.forwardRef(
|
|
|
3846
3915
|
className: cn("flex min-h-24.5 w-full items-center gap-4 rounded-md border border-border p-0.5 pr-4", className),
|
|
3847
3916
|
...props,
|
|
3848
3917
|
children: [
|
|
3849
|
-
/* @__PURE__ */ (0,
|
|
3850
|
-
/* @__PURE__ */ (0,
|
|
3918
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3919
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3851
3920
|
"span",
|
|
3852
3921
|
{
|
|
3853
3922
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3856,12 +3925,12 @@ var StimulusCard = React48.forwardRef(
|
|
|
3856
3925
|
error ? "border-destructive-soft-border bg-destructive-soft bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-destructive" : "border-border bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground",
|
|
3857
3926
|
showImage && "bg-none"
|
|
3858
3927
|
),
|
|
3859
|
-
children: showImage ? /* @__PURE__ */ (0,
|
|
3928
|
+
children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react27.ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react27.Image, { size: 24, "aria-hidden": true })
|
|
3860
3929
|
}
|
|
3861
3930
|
),
|
|
3862
|
-
/* @__PURE__ */ (0,
|
|
3863
|
-
/* @__PURE__ */ (0,
|
|
3864
|
-
onCaptionChange ? /* @__PURE__ */ (0,
|
|
3931
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
3932
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "w-full text-ui-label", children: label }),
|
|
3933
|
+
onCaptionChange ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3865
3934
|
InlineEdit,
|
|
3866
3935
|
{
|
|
3867
3936
|
variant: "question",
|
|
@@ -3878,8 +3947,8 @@ var StimulusCard = React48.forwardRef(
|
|
|
3878
3947
|
},
|
|
3879
3948
|
textClassName: "text-body-base"
|
|
3880
3949
|
}
|
|
3881
|
-
) : /* @__PURE__ */ (0,
|
|
3882
|
-
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0,
|
|
3950
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
3951
|
+
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3883
3952
|
count,
|
|
3884
3953
|
"/",
|
|
3885
3954
|
maxLength,
|
|
@@ -3887,7 +3956,7 @@ var StimulusCard = React48.forwardRef(
|
|
|
3887
3956
|
] })
|
|
3888
3957
|
] })
|
|
3889
3958
|
] }),
|
|
3890
|
-
onRemove && /* @__PURE__ */ (0,
|
|
3959
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react27.Trash, { size: 16, "aria-hidden": true }) })
|
|
3891
3960
|
]
|
|
3892
3961
|
}
|
|
3893
3962
|
);
|
|
@@ -3896,27 +3965,27 @@ var StimulusCard = React48.forwardRef(
|
|
|
3896
3965
|
StimulusCard.displayName = "StimulusCard";
|
|
3897
3966
|
|
|
3898
3967
|
// src/components/Data Display/Progress.tsx
|
|
3899
|
-
var
|
|
3968
|
+
var React50 = __toESM(require("react"), 1);
|
|
3900
3969
|
var import_radix_ui24 = require("radix-ui");
|
|
3901
|
-
var
|
|
3902
|
-
var Progress =
|
|
3970
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3971
|
+
var Progress = React50.forwardRef(
|
|
3903
3972
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3904
3973
|
const hasHeader = label != null || valueLabel != null;
|
|
3905
3974
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3906
3975
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3907
|
-
return /* @__PURE__ */ (0,
|
|
3908
|
-
hasHeader && /* @__PURE__ */ (0,
|
|
3909
|
-
/* @__PURE__ */ (0,
|
|
3910
|
-
/* @__PURE__ */ (0,
|
|
3976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
3977
|
+
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
3978
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: label }),
|
|
3979
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3911
3980
|
] }),
|
|
3912
|
-
/* @__PURE__ */ (0,
|
|
3981
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3913
3982
|
import_radix_ui24.Progress.Root,
|
|
3914
3983
|
{
|
|
3915
3984
|
ref,
|
|
3916
3985
|
value: clamped,
|
|
3917
3986
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3918
3987
|
...props,
|
|
3919
|
-
children: /* @__PURE__ */ (0,
|
|
3988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3920
3989
|
import_radix_ui24.Progress.Indicator,
|
|
3921
3990
|
{
|
|
3922
3991
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3925,9 +3994,9 @@ var Progress = React49.forwardRef(
|
|
|
3925
3994
|
)
|
|
3926
3995
|
}
|
|
3927
3996
|
),
|
|
3928
|
-
hasDetails && /* @__PURE__ */ (0,
|
|
3929
|
-
/* @__PURE__ */ (0,
|
|
3930
|
-
/* @__PURE__ */ (0,
|
|
3997
|
+
hasDetails && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3998
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: detailsStart }),
|
|
3999
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: detailsEnd })
|
|
3931
4000
|
] })
|
|
3932
4001
|
] });
|
|
3933
4002
|
}
|
|
@@ -3935,11 +4004,11 @@ var Progress = React49.forwardRef(
|
|
|
3935
4004
|
Progress.displayName = "Progress";
|
|
3936
4005
|
|
|
3937
4006
|
// src/components/Data Display/Table.tsx
|
|
3938
|
-
var
|
|
3939
|
-
var
|
|
3940
|
-
var
|
|
3941
|
-
var Table =
|
|
3942
|
-
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4007
|
+
var React51 = __toESM(require("react"), 1);
|
|
4008
|
+
var import_react28 = require("@phosphor-icons/react");
|
|
4009
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
4010
|
+
var Table = React51.forwardRef(
|
|
4011
|
+
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { ref: containerRef, className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3943
4012
|
"table",
|
|
3944
4013
|
{
|
|
3945
4014
|
ref,
|
|
@@ -3950,20 +4019,20 @@ var Table = React50.forwardRef(
|
|
|
3950
4019
|
) })
|
|
3951
4020
|
);
|
|
3952
4021
|
Table.displayName = "Table";
|
|
3953
|
-
var TableHeader =
|
|
3954
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4022
|
+
var TableHeader = React51.forwardRef(
|
|
4023
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("thead", { ref, className, ...props })
|
|
3955
4024
|
);
|
|
3956
4025
|
TableHeader.displayName = "TableHeader";
|
|
3957
|
-
var TableFooter =
|
|
3958
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4026
|
+
var TableFooter = React51.forwardRef(
|
|
4027
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("tfoot", { ref, className: cn("border-t border-border bg-background text-ui-label", className), ...props })
|
|
3959
4028
|
);
|
|
3960
4029
|
TableFooter.displayName = "TableFooter";
|
|
3961
|
-
var TableBody =
|
|
3962
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4030
|
+
var TableBody = React51.forwardRef(
|
|
4031
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("tbody", { ref, className, ...props })
|
|
3963
4032
|
);
|
|
3964
4033
|
TableBody.displayName = "TableBody";
|
|
3965
|
-
var TableRow =
|
|
3966
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4034
|
+
var TableRow = React51.forwardRef(
|
|
4035
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3967
4036
|
"tr",
|
|
3968
4037
|
{
|
|
3969
4038
|
ref,
|
|
@@ -3980,10 +4049,10 @@ var TableRow = React50.forwardRef(
|
|
|
3980
4049
|
);
|
|
3981
4050
|
TableRow.displayName = "TableRow";
|
|
3982
4051
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3983
|
-
var TableHead =
|
|
4052
|
+
var TableHead = React51.forwardRef(
|
|
3984
4053
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, resizer, children, ...props }, ref) => {
|
|
3985
|
-
const caret = sort === "asc" ? /* @__PURE__ */ (0,
|
|
3986
|
-
return /* @__PURE__ */ (0,
|
|
4054
|
+
const caret = sort === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react28.CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react28.CaretDown, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
4055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
3987
4056
|
"th",
|
|
3988
4057
|
{
|
|
3989
4058
|
ref,
|
|
@@ -3998,7 +4067,7 @@ var TableHead = React50.forwardRef(
|
|
|
3998
4067
|
),
|
|
3999
4068
|
...props,
|
|
4000
4069
|
children: [
|
|
4001
|
-
sortable ? /* @__PURE__ */ (0,
|
|
4070
|
+
sortable ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
4002
4071
|
"button",
|
|
4003
4072
|
{
|
|
4004
4073
|
type: "button",
|
|
@@ -4009,7 +4078,7 @@ var TableHead = React50.forwardRef(
|
|
|
4009
4078
|
caret
|
|
4010
4079
|
]
|
|
4011
4080
|
}
|
|
4012
|
-
) : checkbox ? /* @__PURE__ */ (0,
|
|
4081
|
+
) : checkbox ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex items-center justify-center", children }) : children,
|
|
4013
4082
|
resizer
|
|
4014
4083
|
]
|
|
4015
4084
|
}
|
|
@@ -4017,8 +4086,8 @@ var TableHead = React50.forwardRef(
|
|
|
4017
4086
|
}
|
|
4018
4087
|
);
|
|
4019
4088
|
TableHead.displayName = "TableHead";
|
|
4020
|
-
var TableCell =
|
|
4021
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4089
|
+
var TableCell = React51.forwardRef(
|
|
4090
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
4022
4091
|
"td",
|
|
4023
4092
|
{
|
|
4024
4093
|
ref,
|
|
@@ -4031,31 +4100,31 @@ var TableCell = React50.forwardRef(
|
|
|
4031
4100
|
className
|
|
4032
4101
|
),
|
|
4033
4102
|
...props,
|
|
4034
|
-
children: checkbox ? /* @__PURE__ */ (0,
|
|
4103
|
+
children: checkbox ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
4035
4104
|
}
|
|
4036
4105
|
)
|
|
4037
4106
|
);
|
|
4038
4107
|
TableCell.displayName = "TableCell";
|
|
4039
4108
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
4040
|
-
return /* @__PURE__ */ (0,
|
|
4109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
4041
4110
|
avatar,
|
|
4042
|
-
/* @__PURE__ */ (0,
|
|
4043
|
-
/* @__PURE__ */ (0,
|
|
4044
|
-
secondary && /* @__PURE__ */ (0,
|
|
4111
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
4112
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
4113
|
+
secondary && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
4045
4114
|
] })
|
|
4046
4115
|
] });
|
|
4047
4116
|
}
|
|
4048
4117
|
|
|
4049
4118
|
// src/components/Data Display/DataTable.tsx
|
|
4050
|
-
var
|
|
4051
|
-
var
|
|
4119
|
+
var React53 = __toESM(require("react"), 1);
|
|
4120
|
+
var import_react30 = require("@phosphor-icons/react");
|
|
4052
4121
|
var import_react_table = require("@tanstack/react-table");
|
|
4053
4122
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
4054
4123
|
|
|
4055
4124
|
// src/components/Utility/Pagination.tsx
|
|
4056
|
-
var
|
|
4057
|
-
var
|
|
4058
|
-
var
|
|
4125
|
+
var React52 = __toESM(require("react"), 1);
|
|
4126
|
+
var import_react29 = require("@phosphor-icons/react");
|
|
4127
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4059
4128
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
4060
4129
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
4061
4130
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -4069,10 +4138,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
4069
4138
|
});
|
|
4070
4139
|
return items;
|
|
4071
4140
|
}
|
|
4072
|
-
var Pagination =
|
|
4141
|
+
var Pagination = React52.forwardRef(
|
|
4073
4142
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
4074
4143
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
4075
|
-
const previous = /* @__PURE__ */ (0,
|
|
4144
|
+
const previous = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4076
4145
|
Button,
|
|
4077
4146
|
{
|
|
4078
4147
|
type: "button",
|
|
@@ -4081,10 +4150,10 @@ var Pagination = React51.forwardRef(
|
|
|
4081
4150
|
"aria-label": "Previous page",
|
|
4082
4151
|
disabled: page <= 1,
|
|
4083
4152
|
onClick: () => go(page - 1),
|
|
4084
|
-
children: /* @__PURE__ */ (0,
|
|
4153
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react29.ArrowLeft, { size: 16, "aria-hidden": true })
|
|
4085
4154
|
}
|
|
4086
4155
|
);
|
|
4087
|
-
const next = /* @__PURE__ */ (0,
|
|
4156
|
+
const next = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4088
4157
|
Button,
|
|
4089
4158
|
{
|
|
4090
4159
|
type: "button",
|
|
@@ -4093,10 +4162,10 @@ var Pagination = React51.forwardRef(
|
|
|
4093
4162
|
"aria-label": "Next page",
|
|
4094
4163
|
disabled: page >= pageCount,
|
|
4095
4164
|
onClick: () => go(page + 1),
|
|
4096
|
-
children: /* @__PURE__ */ (0,
|
|
4165
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react29.ArrowRight, { size: 16, "aria-hidden": true })
|
|
4097
4166
|
}
|
|
4098
4167
|
);
|
|
4099
|
-
return /* @__PURE__ */ (0,
|
|
4168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4100
4169
|
"nav",
|
|
4101
4170
|
{
|
|
4102
4171
|
ref,
|
|
@@ -4105,14 +4174,14 @@ var Pagination = React51.forwardRef(
|
|
|
4105
4174
|
...props,
|
|
4106
4175
|
children: [
|
|
4107
4176
|
previous,
|
|
4108
|
-
variant === "compact" ? /* @__PURE__ */ (0,
|
|
4177
|
+
variant === "compact" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
4109
4178
|
page,
|
|
4110
4179
|
"/",
|
|
4111
4180
|
pageCount
|
|
4112
|
-
] }) : /* @__PURE__ */ (0,
|
|
4113
|
-
/* @__PURE__ */ (0,
|
|
4114
|
-
/* @__PURE__ */ (0,
|
|
4115
|
-
] }) : /* @__PURE__ */ (0,
|
|
4181
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("li", { children: item === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
4182
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react29.DotsThree, { size: 16, "aria-hidden": true }),
|
|
4183
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "sr-only", children: "More pages" })
|
|
4184
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4116
4185
|
Button,
|
|
4117
4186
|
{
|
|
4118
4187
|
type: "button",
|
|
@@ -4133,7 +4202,7 @@ var Pagination = React51.forwardRef(
|
|
|
4133
4202
|
Pagination.displayName = "Pagination";
|
|
4134
4203
|
|
|
4135
4204
|
// src/components/Data Display/DataTable.tsx
|
|
4136
|
-
var
|
|
4205
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4137
4206
|
var features = (0, import_react_table.tableFeatures)({
|
|
4138
4207
|
rowSortingFeature: import_react_table.rowSortingFeature,
|
|
4139
4208
|
rowPaginationFeature: import_react_table.rowPaginationFeature,
|
|
@@ -4188,9 +4257,9 @@ var features = (0, import_react_table.tableFeatures)({
|
|
|
4188
4257
|
});
|
|
4189
4258
|
var getMeta = (meta) => meta ?? {};
|
|
4190
4259
|
function useControllable(value, initial, onChange) {
|
|
4191
|
-
const [internal, setInternal] =
|
|
4260
|
+
const [internal, setInternal] = React53.useState(initial);
|
|
4192
4261
|
const current = value ?? internal;
|
|
4193
|
-
const update =
|
|
4262
|
+
const update = React53.useCallback(
|
|
4194
4263
|
(updater) => {
|
|
4195
4264
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
4196
4265
|
if (value === void 0) setInternal(next);
|
|
@@ -4229,16 +4298,16 @@ function ColumnFilter({ column }) {
|
|
|
4229
4298
|
const value = column.getFilterValue();
|
|
4230
4299
|
if (variant === "select") {
|
|
4231
4300
|
const options = [...column.getFacetedUniqueValues().entries()].sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
4232
|
-
return /* @__PURE__ */ (0,
|
|
4301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4233
4302
|
Select,
|
|
4234
4303
|
{
|
|
4235
4304
|
value: typeof value === "string" ? value : ALL,
|
|
4236
4305
|
onValueChange: (next) => column.setFilterValue(next === ALL ? void 0 : next),
|
|
4237
4306
|
children: [
|
|
4238
|
-
/* @__PURE__ */ (0,
|
|
4239
|
-
/* @__PURE__ */ (0,
|
|
4240
|
-
/* @__PURE__ */ (0,
|
|
4241
|
-
options.map(([option, count]) => /* @__PURE__ */ (0,
|
|
4307
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectTrigger, { "aria-label": `Filter ${label}`, className: "h-8 text-body-small", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectValue, {}) }),
|
|
4308
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(SelectContent, { children: [
|
|
4309
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectItem, { value: ALL, children: "All" }),
|
|
4310
|
+
options.map(([option, count]) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(SelectItem, { value: String(option), children: [
|
|
4242
4311
|
String(option),
|
|
4243
4312
|
" (",
|
|
4244
4313
|
count,
|
|
@@ -4257,8 +4326,8 @@ function ColumnFilter({ column }) {
|
|
|
4257
4326
|
next[index] = raw === "" ? void 0 : Number(raw);
|
|
4258
4327
|
column.setFilterValue(next[0] === void 0 && next[1] === void 0 ? void 0 : next);
|
|
4259
4328
|
};
|
|
4260
|
-
return /* @__PURE__ */ (0,
|
|
4261
|
-
/* @__PURE__ */ (0,
|
|
4329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex gap-1", children: [
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4262
4331
|
Input,
|
|
4263
4332
|
{
|
|
4264
4333
|
type: "number",
|
|
@@ -4269,7 +4338,7 @@ function ColumnFilter({ column }) {
|
|
|
4269
4338
|
className: "h-8 text-body-small"
|
|
4270
4339
|
}
|
|
4271
4340
|
),
|
|
4272
|
-
/* @__PURE__ */ (0,
|
|
4341
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4273
4342
|
Input,
|
|
4274
4343
|
{
|
|
4275
4344
|
type: "number",
|
|
@@ -4282,7 +4351,7 @@ function ColumnFilter({ column }) {
|
|
|
4282
4351
|
)
|
|
4283
4352
|
] });
|
|
4284
4353
|
}
|
|
4285
|
-
return /* @__PURE__ */ (0,
|
|
4354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4286
4355
|
Input,
|
|
4287
4356
|
{
|
|
4288
4357
|
"aria-label": `Filter ${label}`,
|
|
@@ -4295,9 +4364,9 @@ function ColumnFilter({ column }) {
|
|
|
4295
4364
|
}
|
|
4296
4365
|
function EditableCell({ value, label, type, onCommit }) {
|
|
4297
4366
|
const initial = value == null ? "" : String(value);
|
|
4298
|
-
const [draft, setDraft] =
|
|
4299
|
-
const cancelled =
|
|
4300
|
-
return /* @__PURE__ */ (0,
|
|
4367
|
+
const [draft, setDraft] = React53.useState(null);
|
|
4368
|
+
const cancelled = React53.useRef(false);
|
|
4369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4301
4370
|
Input,
|
|
4302
4371
|
{
|
|
4303
4372
|
type,
|
|
@@ -4435,7 +4504,7 @@ function DataTableInner({
|
|
|
4435
4504
|
onPaginationChange
|
|
4436
4505
|
);
|
|
4437
4506
|
const [density, setDensity] = useControllable(densityProp, "default", onDensityChange);
|
|
4438
|
-
const [cellSelection, setCellSelection] =
|
|
4507
|
+
const [cellSelection, setCellSelection] = React53.useState([]);
|
|
4439
4508
|
const infinite = Boolean(onLoadMore);
|
|
4440
4509
|
const paginate = !virtualized && !infinite;
|
|
4441
4510
|
const compact = density === "compact";
|
|
@@ -4508,12 +4577,12 @@ function DataTableInner({
|
|
|
4508
4577
|
const cellDensity = compact ? "h-8 py-1.5" : void 0;
|
|
4509
4578
|
const allSelected = table.getIsAllPageRowsSelected();
|
|
4510
4579
|
const someSelected = table.getIsSomePageRowsSelected();
|
|
4511
|
-
const dragged =
|
|
4580
|
+
const dragged = React53.useRef(null);
|
|
4512
4581
|
const topRows = enableRowPinning ? table.getTopRows() : [];
|
|
4513
4582
|
const bottomRows = enableRowPinning ? table.getBottomRows() : [];
|
|
4514
4583
|
const bodyRows = enableRowPinning ? table.getCenterRows() : table.getRowModel().rows;
|
|
4515
|
-
const scrollRef =
|
|
4516
|
-
const setScrollRef =
|
|
4584
|
+
const scrollRef = React53.useRef(null);
|
|
4585
|
+
const setScrollRef = React53.useCallback(
|
|
4517
4586
|
(node) => {
|
|
4518
4587
|
scrollRef.current = node;
|
|
4519
4588
|
if (typeof containerRef === "function") containerRef(node);
|
|
@@ -4532,8 +4601,8 @@ function DataTableInner({
|
|
|
4532
4601
|
const virtualItems = virtualized ? virtualizer.getVirtualItems() : [];
|
|
4533
4602
|
const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
|
|
4534
4603
|
const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems.at(-1)?.end ?? 0) : 0;
|
|
4535
|
-
const sentinelRef =
|
|
4536
|
-
|
|
4604
|
+
const sentinelRef = React53.useRef(null);
|
|
4605
|
+
React53.useEffect(() => {
|
|
4537
4606
|
const node = sentinelRef.current;
|
|
4538
4607
|
if (!node || !onLoadMore || !hasMore || loadingMore || typeof IntersectionObserver === "undefined") return;
|
|
4539
4608
|
const container = scrollRef.current;
|
|
@@ -4574,15 +4643,15 @@ function DataTableInner({
|
|
|
4574
4643
|
table.resetCellSelection(true);
|
|
4575
4644
|
}
|
|
4576
4645
|
};
|
|
4577
|
-
const skeletonRow = (rowKey) => /* @__PURE__ */ (0,
|
|
4646
|
+
const skeletonRow = (rowKey) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableRow, { className: "hover:bg-transparent", children: Array.from({ length: columnSpan }, (_, cell) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableCell, { checkbox: enableRowSelection && cell === 0, className: cellDensity, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": true, className: "block h-4 w-3/4 animate-pulse rounded-xs bg-border" }) }, cell)) }, rowKey);
|
|
4578
4647
|
const renderRow = (row, options = {}) => {
|
|
4579
4648
|
const { pinned, pinnedIndex = 0, pinnedCount = 1, virtualIndex } = options;
|
|
4580
4649
|
const grouped = row.getIsGrouped();
|
|
4581
4650
|
const rowUnits = compact ? 8 : 10;
|
|
4582
4651
|
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;
|
|
4583
4652
|
const cells = row.getVisibleCells();
|
|
4584
|
-
return /* @__PURE__ */ (0,
|
|
4585
|
-
/* @__PURE__ */ (0,
|
|
4653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(React53.Fragment, { children: [
|
|
4654
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4586
4655
|
TableRow,
|
|
4587
4656
|
{
|
|
4588
4657
|
ref: virtualized && virtualIndex !== void 0 ? virtualizer.measureElement : void 0,
|
|
@@ -4592,7 +4661,7 @@ function DataTableInner({
|
|
|
4592
4661
|
onClick: onRowClick && !grouped ? () => onRowClick(row.original) : void 0,
|
|
4593
4662
|
className: cn(pinned && "z-20 bg-surface", grouped && "bg-background", onRowClick && !grouped && "cursor-pointer"),
|
|
4594
4663
|
children: [
|
|
4595
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
4664
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4596
4665
|
Checkbox,
|
|
4597
4666
|
{
|
|
4598
4667
|
"aria-label": "Select row",
|
|
@@ -4601,7 +4670,7 @@ function DataTableInner({
|
|
|
4601
4670
|
onCheckedChange: (checked) => row.toggleSelected(Boolean(checked))
|
|
4602
4671
|
}
|
|
4603
4672
|
) }),
|
|
4604
|
-
hasExpander && /* @__PURE__ */ (0,
|
|
4673
|
+
hasExpander && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && row.getCanExpand() && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4605
4674
|
Button,
|
|
4606
4675
|
{
|
|
4607
4676
|
type: "button",
|
|
@@ -4610,10 +4679,10 @@ function DataTableInner({
|
|
|
4610
4679
|
"aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
|
|
4611
4680
|
"aria-expanded": row.getIsExpanded(),
|
|
4612
4681
|
onClick: () => row.toggleExpanded(),
|
|
4613
|
-
children: row.getIsExpanded() ? /* @__PURE__ */ (0,
|
|
4682
|
+
children: row.getIsExpanded() ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.CaretDown, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.CaretRight, { size: 16, "aria-hidden": true })
|
|
4614
4683
|
}
|
|
4615
4684
|
) }),
|
|
4616
|
-
enableRowPinning && /* @__PURE__ */ (0,
|
|
4685
|
+
enableRowPinning && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4617
4686
|
Button,
|
|
4618
4687
|
{
|
|
4619
4688
|
type: "button",
|
|
@@ -4622,7 +4691,7 @@ function DataTableInner({
|
|
|
4622
4691
|
"aria-label": row.getIsPinned() ? "Unpin row" : "Pin row to top",
|
|
4623
4692
|
"aria-pressed": Boolean(row.getIsPinned()),
|
|
4624
4693
|
onClick: () => row.pin(row.getIsPinned() ? false : "top"),
|
|
4625
|
-
children: row.getIsPinned() ? /* @__PURE__ */ (0,
|
|
4694
|
+
children: row.getIsPinned() ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.PushPinSlash, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.PushPin, { size: 16, "aria-hidden": true })
|
|
4626
4695
|
}
|
|
4627
4696
|
) }),
|
|
4628
4697
|
cells.map((cell, index) => {
|
|
@@ -4635,7 +4704,7 @@ function DataTableInner({
|
|
|
4635
4704
|
const indent = index === 0 && hasExpander && row.depth > 0 ? row.depth * 4 : 0;
|
|
4636
4705
|
let content;
|
|
4637
4706
|
if (cell.getIsGrouped()) {
|
|
4638
|
-
content = /* @__PURE__ */ (0,
|
|
4707
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4639
4708
|
"button",
|
|
4640
4709
|
{
|
|
4641
4710
|
type: "button",
|
|
@@ -4643,9 +4712,9 @@ function DataTableInner({
|
|
|
4643
4712
|
"aria-expanded": row.getIsExpanded(),
|
|
4644
4713
|
onClick: row.getToggleExpandedHandler(),
|
|
4645
4714
|
children: [
|
|
4646
|
-
row.getIsExpanded() ? /* @__PURE__ */ (0,
|
|
4715
|
+
row.getIsExpanded() ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.CaretDown, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.CaretRight, { size: 16, "aria-hidden": true }),
|
|
4647
4716
|
(0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()),
|
|
4648
|
-
/* @__PURE__ */ (0,
|
|
4717
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-secondary-muted-foreground", children: [
|
|
4649
4718
|
"(",
|
|
4650
4719
|
row.subRows.length,
|
|
4651
4720
|
")"
|
|
@@ -4658,7 +4727,7 @@ function DataTableInner({
|
|
|
4658
4727
|
} else if (cell.getIsPlaceholder()) {
|
|
4659
4728
|
content = null;
|
|
4660
4729
|
} else if (meta.editable) {
|
|
4661
|
-
content = /* @__PURE__ */ (0,
|
|
4730
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4662
4731
|
EditableCell,
|
|
4663
4732
|
{
|
|
4664
4733
|
value: cell.getValue(),
|
|
@@ -4670,7 +4739,7 @@ function DataTableInner({
|
|
|
4670
4739
|
} else {
|
|
4671
4740
|
content = (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
4672
4741
|
}
|
|
4673
|
-
return /* @__PURE__ */ (0,
|
|
4742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4674
4743
|
TableCell,
|
|
4675
4744
|
{
|
|
4676
4745
|
align: meta.align,
|
|
@@ -4703,7 +4772,7 @@ function DataTableInner({
|
|
|
4703
4772
|
]
|
|
4704
4773
|
}
|
|
4705
4774
|
),
|
|
4706
|
-
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ (0,
|
|
4775
|
+
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableRow, { className: "bg-background hover:bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableCell, { colSpan: columnSpan, children: renderSubComponent(row.original) }) })
|
|
4707
4776
|
] }, row.id);
|
|
4708
4777
|
};
|
|
4709
4778
|
const renderHeaderCell = (header) => {
|
|
@@ -4714,7 +4783,7 @@ function DataTableInner({
|
|
|
4714
4783
|
const pin = pinning(column, sized, true);
|
|
4715
4784
|
const reorderable = enableColumnOrdering && leaf && !column.getIsPinned();
|
|
4716
4785
|
const label = labelOf(column);
|
|
4717
|
-
return /* @__PURE__ */ (0,
|
|
4786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4718
4787
|
TableHead,
|
|
4719
4788
|
{
|
|
4720
4789
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
@@ -4750,7 +4819,7 @@ function DataTableInner({
|
|
|
4750
4819
|
reorderable && "cursor-grab",
|
|
4751
4820
|
!leaf && "text-center"
|
|
4752
4821
|
),
|
|
4753
|
-
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ (0,
|
|
4822
|
+
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4754
4823
|
"div",
|
|
4755
4824
|
{
|
|
4756
4825
|
role: "separator",
|
|
@@ -4765,14 +4834,14 @@ function DataTableInner({
|
|
|
4765
4834
|
)
|
|
4766
4835
|
}
|
|
4767
4836
|
) : void 0,
|
|
4768
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */ (0,
|
|
4837
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(table.FlexRender, { header })
|
|
4769
4838
|
},
|
|
4770
4839
|
header.id
|
|
4771
4840
|
);
|
|
4772
4841
|
};
|
|
4773
4842
|
const stickyLeading = cn(cellDensity, sticky && "sticky top-0 z-20 bg-surface");
|
|
4774
|
-
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ (0,
|
|
4775
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
4843
|
+
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
4844
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4776
4845
|
Checkbox,
|
|
4777
4846
|
{
|
|
4778
4847
|
"aria-label": "Select all rows",
|
|
@@ -4781,15 +4850,15 @@ function DataTableInner({
|
|
|
4781
4850
|
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(Boolean(checked))
|
|
4782
4851
|
}
|
|
4783
4852
|
) }),
|
|
4784
|
-
hasExpander && /* @__PURE__ */ (0,
|
|
4785
|
-
enableRowPinning && /* @__PURE__ */ (0,
|
|
4853
|
+
hasExpander && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "sr-only", children: "Expand" }) }),
|
|
4854
|
+
enableRowPinning && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "sr-only", children: "Pin" }) })
|
|
4786
4855
|
] });
|
|
4787
4856
|
const rowsToRender = virtualized ? virtualItems.map((item) => ({ row: bodyRows[item.index], index: item.index })) : null;
|
|
4788
4857
|
const totalRows = topRows.length + bodyRows.length + bottomRows.length;
|
|
4789
|
-
return /* @__PURE__ */ (0,
|
|
4790
|
-
showToolbar && /* @__PURE__ */ (0,
|
|
4791
|
-
/* @__PURE__ */ (0,
|
|
4792
|
-
enableGlobalFilter && /* @__PURE__ */ (0,
|
|
4858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cn("flex w-full flex-col gap-2", wrapperClassName), children: [
|
|
4859
|
+
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4860
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4861
|
+
enableGlobalFilter && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4793
4862
|
SearchBar,
|
|
4794
4863
|
{
|
|
4795
4864
|
"aria-label": "Search table",
|
|
@@ -4802,8 +4871,8 @@ function DataTableInner({
|
|
|
4802
4871
|
),
|
|
4803
4872
|
toolbar
|
|
4804
4873
|
] }),
|
|
4805
|
-
/* @__PURE__ */ (0,
|
|
4806
|
-
enableDensityToggle && /* @__PURE__ */ (0,
|
|
4874
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4875
|
+
enableDensityToggle && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4807
4876
|
Button,
|
|
4808
4877
|
{
|
|
4809
4878
|
type: "button",
|
|
@@ -4812,20 +4881,20 @@ function DataTableInner({
|
|
|
4812
4881
|
"aria-pressed": compact,
|
|
4813
4882
|
onClick: () => setDensity(compact ? "default" : "compact"),
|
|
4814
4883
|
children: [
|
|
4815
|
-
/* @__PURE__ */ (0,
|
|
4884
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.Rows, { size: 16, "aria-hidden": true }),
|
|
4816
4885
|
"Compact"
|
|
4817
4886
|
]
|
|
4818
4887
|
}
|
|
4819
4888
|
),
|
|
4820
|
-
enableGrouping && /* @__PURE__ */ (0,
|
|
4821
|
-
/* @__PURE__ */ (0,
|
|
4822
|
-
/* @__PURE__ */ (0,
|
|
4889
|
+
enableGrouping && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(DropdownMenu, { children: [
|
|
4890
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4891
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.Stack, { size: 16, "aria-hidden": true }),
|
|
4823
4892
|
"Group by"
|
|
4824
4893
|
] }) }),
|
|
4825
|
-
/* @__PURE__ */ (0,
|
|
4826
|
-
/* @__PURE__ */ (0,
|
|
4827
|
-
/* @__PURE__ */ (0,
|
|
4828
|
-
groupableColumns.map((column) => /* @__PURE__ */ (0,
|
|
4894
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
4895
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DropdownMenuLabel, { children: "Group rows by" }),
|
|
4896
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DropdownMenuSeparator, {}),
|
|
4897
|
+
groupableColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4829
4898
|
DropdownMenuCheckboxItem,
|
|
4830
4899
|
{
|
|
4831
4900
|
checked: column.getIsGrouped(),
|
|
@@ -4836,15 +4905,15 @@ function DataTableInner({
|
|
|
4836
4905
|
))
|
|
4837
4906
|
] })
|
|
4838
4907
|
] }),
|
|
4839
|
-
enableColumnVisibility && /* @__PURE__ */ (0,
|
|
4840
|
-
/* @__PURE__ */ (0,
|
|
4841
|
-
/* @__PURE__ */ (0,
|
|
4908
|
+
enableColumnVisibility && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(DropdownMenu, { children: [
|
|
4909
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4910
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react30.Sliders, { size: 16, "aria-hidden": true }),
|
|
4842
4911
|
"Columns"
|
|
4843
4912
|
] }) }),
|
|
4844
|
-
/* @__PURE__ */ (0,
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
4846
|
-
/* @__PURE__ */ (0,
|
|
4847
|
-
hideableColumns.map((column) => /* @__PURE__ */ (0,
|
|
4913
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
4914
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
4915
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DropdownMenuSeparator, {}),
|
|
4916
|
+
hideableColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4848
4917
|
DropdownMenuCheckboxItem,
|
|
4849
4918
|
{
|
|
4850
4919
|
checked: column.getIsVisible(),
|
|
@@ -4857,7 +4926,7 @@ function DataTableInner({
|
|
|
4857
4926
|
] })
|
|
4858
4927
|
] })
|
|
4859
4928
|
] }),
|
|
4860
|
-
/* @__PURE__ */ (0,
|
|
4929
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4861
4930
|
Table,
|
|
4862
4931
|
{
|
|
4863
4932
|
ref,
|
|
@@ -4870,52 +4939,52 @@ function DataTableInner({
|
|
|
4870
4939
|
tabIndex: enableCellSelection ? 0 : void 0,
|
|
4871
4940
|
...tableProps,
|
|
4872
4941
|
children: [
|
|
4873
|
-
/* @__PURE__ */ (0,
|
|
4874
|
-
headerGroups.map((group, groupIndex) => /* @__PURE__ */ (0,
|
|
4942
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(TableHeader, { children: [
|
|
4943
|
+
headerGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(TableRow, { className: "hover:bg-transparent", children: [
|
|
4875
4944
|
groupIndex === 0 && leadingHeaderCells(headerGroups.length + (enableColumnFilters ? 1 : 0)),
|
|
4876
4945
|
group.headers.map(renderHeaderCell)
|
|
4877
4946
|
] }, group.id)),
|
|
4878
|
-
enableColumnFilters && /* @__PURE__ */ (0,
|
|
4947
|
+
enableColumnFilters && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableRow, { className: "hover:bg-transparent", children: leafColumns.map((column) => {
|
|
4879
4948
|
const pin = pinning(column, sized, true);
|
|
4880
|
-
return /* @__PURE__ */ (0,
|
|
4949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4881
4950
|
TableHead,
|
|
4882
4951
|
{
|
|
4883
4952
|
style: pin.style,
|
|
4884
4953
|
className: cn("h-auto py-2 font-normal", pin.className, sticky && !column.getIsPinned() && "bg-surface"),
|
|
4885
|
-
children: column.getCanFilter() ? /* @__PURE__ */ (0,
|
|
4954
|
+
children: column.getCanFilter() ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ColumnFilter, { column }) : null
|
|
4886
4955
|
},
|
|
4887
4956
|
column.id
|
|
4888
4957
|
);
|
|
4889
4958
|
}) })
|
|
4890
4959
|
] }),
|
|
4891
|
-
/* @__PURE__ */ (0,
|
|
4892
|
-
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ (0,
|
|
4960
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(TableBody, { children: [
|
|
4961
|
+
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableCell, { colSpan: columnSpan, muted: true, className: "h-24 text-center", children: emptyState ?? "No results." }) }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
4893
4962
|
topRows.map((row, index) => renderRow(row, { pinned: "top", pinnedIndex: index, pinnedCount: topRows.length })),
|
|
4894
|
-
virtualized && paddingTop > 0 && /* @__PURE__ */ (0,
|
|
4963
|
+
virtualized && paddingTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { colSpan: columnSpan, style: { height: paddingTop } }) }),
|
|
4895
4964
|
rowsToRender ? rowsToRender.map(({ row, index }) => renderRow(row, { virtualIndex: index })) : bodyRows.map((row) => renderRow(row)),
|
|
4896
|
-
virtualized && paddingBottom > 0 && /* @__PURE__ */ (0,
|
|
4965
|
+
virtualized && paddingBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { colSpan: columnSpan, style: { height: paddingBottom } }) }),
|
|
4897
4966
|
bottomRows.map(
|
|
4898
4967
|
(row, index) => renderRow(row, { pinned: "bottom", pinnedIndex: index, pinnedCount: bottomRows.length })
|
|
4899
4968
|
)
|
|
4900
4969
|
] }),
|
|
4901
|
-
infinite && /* @__PURE__ */ (0,
|
|
4970
|
+
infinite && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
4902
4971
|
loadingMore && Array.from({ length: 3 }, (_, index) => skeletonRow(`more-${index}`)),
|
|
4903
|
-
/* @__PURE__ */ (0,
|
|
4972
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { ref: sentinelRef, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { colSpan: columnSpan, className: "h-px p-0" }) })
|
|
4904
4973
|
] })
|
|
4905
4974
|
] }),
|
|
4906
|
-
showFooter && /* @__PURE__ */ (0,
|
|
4907
|
-
leadingCount > 0 && /* @__PURE__ */ (0,
|
|
4975
|
+
showFooter && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableFooter, { children: table.getFooterGroups().map((group) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(TableRow, { className: "hover:bg-transparent", children: [
|
|
4976
|
+
leadingCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableCell, { colSpan: leadingCount, className: cellDensity }),
|
|
4908
4977
|
group.headers.map((header) => {
|
|
4909
4978
|
const { align } = getMeta(header.column.columnDef.meta);
|
|
4910
4979
|
const pin = pinning(header.column, sized);
|
|
4911
|
-
return /* @__PURE__ */ (0,
|
|
4980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4912
4981
|
TableCell,
|
|
4913
4982
|
{
|
|
4914
4983
|
align,
|
|
4915
4984
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
4916
4985
|
style: pin.style,
|
|
4917
4986
|
className: cn("text-ui-label", pin.className, cellDensity),
|
|
4918
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */ (0,
|
|
4987
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(table.FlexRender, { footer: header })
|
|
4919
4988
|
},
|
|
4920
4989
|
header.id
|
|
4921
4990
|
);
|
|
@@ -4924,9 +4993,9 @@ function DataTableInner({
|
|
|
4924
4993
|
]
|
|
4925
4994
|
}
|
|
4926
4995
|
),
|
|
4927
|
-
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ (0,
|
|
4928
|
-
/* @__PURE__ */ (0,
|
|
4929
|
-
paginate && pageCount > 1 && /* @__PURE__ */ (0,
|
|
4996
|
+
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4997
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-body-small text-secondary-muted-foreground", "aria-live": "polite", children: enableRowSelection ? `${selectedCount} of ${table.getCoreRowModel().rows.length} row(s) selected` : null }),
|
|
4998
|
+
paginate && pageCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4930
4999
|
Pagination,
|
|
4931
5000
|
{
|
|
4932
5001
|
page: pagination.pageIndex + 1,
|
|
@@ -4937,13 +5006,13 @@ function DataTableInner({
|
|
|
4937
5006
|
] })
|
|
4938
5007
|
] });
|
|
4939
5008
|
}
|
|
4940
|
-
var DataTable =
|
|
5009
|
+
var DataTable = React53.forwardRef(DataTableInner);
|
|
4941
5010
|
DataTable.displayName = "DataTable";
|
|
4942
5011
|
|
|
4943
5012
|
// src/components/Data Display/StatCard.tsx
|
|
4944
|
-
var
|
|
5013
|
+
var React54 = __toESM(require("react"), 1);
|
|
4945
5014
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
4946
|
-
var
|
|
5015
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4947
5016
|
var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
4948
5017
|
variants: {
|
|
4949
5018
|
variant: {
|
|
@@ -4957,26 +5026,26 @@ var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 f
|
|
|
4957
5026
|
},
|
|
4958
5027
|
defaultVariants: { variant: "default" }
|
|
4959
5028
|
});
|
|
4960
|
-
var StatCard =
|
|
4961
|
-
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4962
|
-
/* @__PURE__ */ (0,
|
|
4963
|
-
/* @__PURE__ */ (0,
|
|
4964
|
-
icon && /* @__PURE__ */ (0,
|
|
5029
|
+
var StatCard = React54.forwardRef(
|
|
5030
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
5031
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
5033
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
4965
5034
|
value
|
|
4966
5035
|
] }),
|
|
4967
|
-
caption && /* @__PURE__ */ (0,
|
|
5036
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
4968
5037
|
] })
|
|
4969
5038
|
);
|
|
4970
5039
|
StatCard.displayName = "StatCard";
|
|
4971
5040
|
|
|
4972
5041
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
4973
|
-
var
|
|
5042
|
+
var React56 = __toESM(require("react"), 1);
|
|
4974
5043
|
|
|
4975
5044
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
4976
|
-
var
|
|
4977
|
-
var
|
|
5045
|
+
var React55 = __toESM(require("react"), 1);
|
|
5046
|
+
var import_react31 = require("@phosphor-icons/react");
|
|
4978
5047
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
4979
|
-
var
|
|
5048
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4980
5049
|
var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
4981
5050
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
4982
5051
|
{
|
|
@@ -4991,27 +5060,27 @@ var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
|
4991
5060
|
defaultVariants: { type: "default" }
|
|
4992
5061
|
}
|
|
4993
5062
|
);
|
|
4994
|
-
var EditableTag =
|
|
5063
|
+
var EditableTag = React55.forwardRef(
|
|
4995
5064
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
4996
5065
|
const classes = cn(editableTagVariants({ type }), className);
|
|
4997
|
-
const leading = type === "add" ? /* @__PURE__ */ (0,
|
|
5066
|
+
const leading = type === "add" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react31.Plus, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react31.Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
4998
5067
|
if (type === "add" || type === "multiple" && onClick) {
|
|
4999
|
-
return /* @__PURE__ */ (0,
|
|
5068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
5000
5069
|
leading,
|
|
5001
5070
|
children
|
|
5002
5071
|
] });
|
|
5003
5072
|
}
|
|
5004
|
-
return /* @__PURE__ */ (0,
|
|
5073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
5005
5074
|
leading,
|
|
5006
5075
|
children,
|
|
5007
|
-
onRemove && /* @__PURE__ */ (0,
|
|
5076
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5008
5077
|
"button",
|
|
5009
5078
|
{
|
|
5010
5079
|
type: "button",
|
|
5011
5080
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
5012
5081
|
onClick: onRemove,
|
|
5013
5082
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
5014
|
-
children: /* @__PURE__ */ (0,
|
|
5083
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react31.X, { size: 12, "aria-hidden": true })
|
|
5015
5084
|
}
|
|
5016
5085
|
)
|
|
5017
5086
|
] });
|
|
@@ -5020,26 +5089,26 @@ var EditableTag = React54.forwardRef(
|
|
|
5020
5089
|
EditableTag.displayName = "EditableTag";
|
|
5021
5090
|
|
|
5022
5091
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
5023
|
-
var
|
|
5024
|
-
var ActivityStructure =
|
|
5025
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5092
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5093
|
+
var ActivityStructure = React56.forwardRef(
|
|
5094
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
5026
5095
|
"section",
|
|
5027
5096
|
{
|
|
5028
5097
|
ref,
|
|
5029
5098
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
5030
5099
|
...props,
|
|
5031
5100
|
children: [
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5033
|
-
/* @__PURE__ */ (0,
|
|
5101
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5102
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
5034
5103
|
action
|
|
5035
5104
|
] }),
|
|
5036
|
-
stats.length > 0 && /* @__PURE__ */ (0,
|
|
5037
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0,
|
|
5038
|
-
/* @__PURE__ */ (0,
|
|
5039
|
-
/* @__PURE__ */ (0,
|
|
5040
|
-
(tags?.length || onAddTag) && /* @__PURE__ */ (0,
|
|
5041
|
-
tags?.map((tag) => /* @__PURE__ */ (0,
|
|
5042
|
-
onAddTag && /* @__PURE__ */ (0,
|
|
5105
|
+
stats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(StatCard, { ...stat }, id)) }),
|
|
5106
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5107
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
5108
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
5109
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5110
|
+
tags?.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
5111
|
+
onAddTag && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
5043
5112
|
] })
|
|
5044
5113
|
] }, id)),
|
|
5045
5114
|
children
|
|
@@ -5050,10 +5119,10 @@ var ActivityStructure = React55.forwardRef(
|
|
|
5050
5119
|
ActivityStructure.displayName = "ActivityStructure";
|
|
5051
5120
|
|
|
5052
5121
|
// src/components/Tags & Badges/Badge.tsx
|
|
5053
|
-
var
|
|
5054
|
-
var
|
|
5122
|
+
var React57 = __toESM(require("react"), 1);
|
|
5123
|
+
var import_react32 = require("@phosphor-icons/react");
|
|
5055
5124
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
5056
|
-
var
|
|
5125
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5057
5126
|
var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
5058
5127
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5059
5128
|
{
|
|
@@ -5079,11 +5148,11 @@ var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
|
5079
5148
|
defaultVariants: { type: "primary", selected: false }
|
|
5080
5149
|
}
|
|
5081
5150
|
);
|
|
5082
|
-
var Badge =
|
|
5151
|
+
var Badge = React57.forwardRef(
|
|
5083
5152
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
5084
5153
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
5085
5154
|
if (type === "interactable") {
|
|
5086
|
-
return /* @__PURE__ */ (0,
|
|
5155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
5087
5156
|
"button",
|
|
5088
5157
|
{
|
|
5089
5158
|
ref,
|
|
@@ -5093,15 +5162,15 @@ var Badge = React56.forwardRef(
|
|
|
5093
5162
|
onClick,
|
|
5094
5163
|
...props,
|
|
5095
5164
|
children: [
|
|
5096
|
-
/* @__PURE__ */ (0,
|
|
5165
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react32.DotsSixVertical, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
5097
5166
|
children
|
|
5098
5167
|
]
|
|
5099
5168
|
}
|
|
5100
5169
|
);
|
|
5101
5170
|
}
|
|
5102
|
-
return /* @__PURE__ */ (0,
|
|
5103
|
-
type === "question" && /* @__PURE__ */ (0,
|
|
5104
|
-
type === "id" && /* @__PURE__ */ (0,
|
|
5171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
5172
|
+
type === "question" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react32.RadioButton, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
5173
|
+
type === "id" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
5105
5174
|
children
|
|
5106
5175
|
] });
|
|
5107
5176
|
}
|
|
@@ -5194,6 +5263,9 @@ Badge.displayName = "Badge";
|
|
|
5194
5263
|
Slider,
|
|
5195
5264
|
StatCard,
|
|
5196
5265
|
StatusTag,
|
|
5266
|
+
Step,
|
|
5267
|
+
StepPath,
|
|
5268
|
+
Stepper,
|
|
5197
5269
|
StimulusCard,
|
|
5198
5270
|
Switch,
|
|
5199
5271
|
TabItem,
|