@discuss-ds/ui 0.39.1 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +507 -461
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +505 -461
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -87,6 +87,8 @@ __export(index_exports, {
|
|
|
87
87
|
InputWithAction: () => InputWithAction,
|
|
88
88
|
Label: () => Label,
|
|
89
89
|
MediaInfo: () => MediaInfo,
|
|
90
|
+
NavRail: () => NavRail,
|
|
91
|
+
NavRailItem: () => NavRailItem,
|
|
90
92
|
NumberInput: () => NumberInput,
|
|
91
93
|
OpenEndAnswer: () => OpenEndAnswer,
|
|
92
94
|
Pagination: () => Pagination,
|
|
@@ -2511,24 +2513,66 @@ var Stepper = React33.forwardRef(({ steps, current, orientation = "horizontal",
|
|
|
2511
2513
|
});
|
|
2512
2514
|
Stepper.displayName = "Stepper";
|
|
2513
2515
|
|
|
2514
|
-
// src/components/
|
|
2516
|
+
// src/components/Navigation/NavRail.tsx
|
|
2515
2517
|
var React34 = __toESM(require("react"), 1);
|
|
2518
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2519
|
+
var NavRail = React34.forwardRef(({ className, children, footer, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("nav", { ref, className: cn("flex h-full w-16 shrink-0 flex-col border-r border-border", className), ...props, children: [
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("ul", { className: "flex flex-col items-center gap-2 px-2 pt-3", children }),
|
|
2521
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mt-auto flex flex-col items-center px-2 pb-3", children: footer })
|
|
2522
|
+
] }));
|
|
2523
|
+
NavRail.displayName = "NavRail";
|
|
2524
|
+
var NavRailItem = React34.forwardRef(({ className, icon, label, selected = false, type = "button", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("li", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
2525
|
+
"button",
|
|
2526
|
+
{
|
|
2527
|
+
ref,
|
|
2528
|
+
type,
|
|
2529
|
+
"aria-current": selected ? "page" : void 0,
|
|
2530
|
+
className: cn(
|
|
2531
|
+
"group flex w-full cursor-pointer flex-col items-center gap-1 rounded-md text-body-xxs outline-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
2532
|
+
// Hover (selected or not, Figma "Primary menu items" Hover=Yes): the caption and icon in accent-soft-foreground.
|
|
2533
|
+
selected ? "text-surface-foreground" : "text-secondary-muted-foreground",
|
|
2534
|
+
"hover:text-accent-soft-foreground",
|
|
2535
|
+
className
|
|
2536
|
+
),
|
|
2537
|
+
...props,
|
|
2538
|
+
children: [
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2540
|
+
"span",
|
|
2541
|
+
{
|
|
2542
|
+
"aria-hidden": "true",
|
|
2543
|
+
className: cn(
|
|
2544
|
+
"flex size-9 items-center justify-center rounded-md transition-colors [&>svg]:size-4",
|
|
2545
|
+
// Hover fills the square with accent-soft, over the selected fill too.
|
|
2546
|
+
selected ? "bg-secondary" : "",
|
|
2547
|
+
"group-hover:bg-accent-soft"
|
|
2548
|
+
),
|
|
2549
|
+
children: icon
|
|
2550
|
+
}
|
|
2551
|
+
),
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: label })
|
|
2553
|
+
]
|
|
2554
|
+
}
|
|
2555
|
+
) }));
|
|
2556
|
+
NavRailItem.displayName = "NavRailItem";
|
|
2557
|
+
|
|
2558
|
+
// src/components/Overlays & Feedback/Dialog.tsx
|
|
2559
|
+
var React35 = __toESM(require("react"), 1);
|
|
2516
2560
|
var import_react17 = require("@phosphor-icons/react");
|
|
2517
2561
|
var import_radix_ui17 = require("radix-ui");
|
|
2518
|
-
var
|
|
2562
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2519
2563
|
var Dialog = import_radix_ui17.Dialog.Root;
|
|
2520
2564
|
var DialogTrigger = import_radix_ui17.Dialog.Trigger;
|
|
2521
2565
|
var DialogClose = import_radix_ui17.Dialog.Close;
|
|
2522
|
-
var DialogContent =
|
|
2523
|
-
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2524
|
-
/* @__PURE__ */ (0,
|
|
2566
|
+
var DialogContent = React35.forwardRef(
|
|
2567
|
+
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_radix_ui17.Dialog.Portal, { children: [
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2525
2569
|
import_radix_ui17.Dialog.Overlay,
|
|
2526
2570
|
{
|
|
2527
2571
|
style: { zIndex: "var(--sys-z-30)" },
|
|
2528
2572
|
className: "fixed inset-0 bg-primary/30"
|
|
2529
2573
|
}
|
|
2530
2574
|
),
|
|
2531
|
-
/* @__PURE__ */ (0,
|
|
2575
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
2532
2576
|
import_radix_ui17.Dialog.Content,
|
|
2533
2577
|
{
|
|
2534
2578
|
ref,
|
|
@@ -2540,15 +2584,15 @@ var DialogContent = React34.forwardRef(
|
|
|
2540
2584
|
...props,
|
|
2541
2585
|
children: [
|
|
2542
2586
|
children,
|
|
2543
|
-
!hideClose && /* @__PURE__ */ (0,
|
|
2587
|
+
!hideClose && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_radix_ui17.Dialog.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Button, { variant: "ghost", size: "icon-sm", "aria-label": closeLabel, className: "absolute top-4 right-6", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_react17.X, { size: 16, "aria-hidden": true }) }) })
|
|
2544
2588
|
]
|
|
2545
2589
|
}
|
|
2546
2590
|
)
|
|
2547
2591
|
] })
|
|
2548
2592
|
);
|
|
2549
2593
|
DialogContent.displayName = "DialogContent";
|
|
2550
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
2551
|
-
var DialogTitle =
|
|
2594
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cn("flex flex-col gap-1.5 border-b border-border px-6 py-4 pr-16", className), ...props });
|
|
2595
|
+
var DialogTitle = React35.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2552
2596
|
import_radix_ui17.Dialog.Title,
|
|
2553
2597
|
{
|
|
2554
2598
|
ref,
|
|
@@ -2557,7 +2601,7 @@ var DialogTitle = React34.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2557
2601
|
}
|
|
2558
2602
|
));
|
|
2559
2603
|
DialogTitle.displayName = "DialogTitle";
|
|
2560
|
-
var DialogDescription =
|
|
2604
|
+
var DialogDescription = React35.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2561
2605
|
import_radix_ui17.Dialog.Description,
|
|
2562
2606
|
{
|
|
2563
2607
|
ref,
|
|
@@ -2566,15 +2610,15 @@ var DialogDescription = React34.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2566
2610
|
}
|
|
2567
2611
|
));
|
|
2568
2612
|
DialogDescription.displayName = "DialogDescription";
|
|
2569
|
-
var DialogBody = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
2570
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0,
|
|
2613
|
+
var DialogBody = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cn("flex flex-col gap-4 p-6", className), ...props });
|
|
2614
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cn("flex items-center justify-end gap-3 border-t border-border px-6 py-4", className), ...props });
|
|
2571
2615
|
|
|
2572
2616
|
// src/components/Overlays & Feedback/Toast.tsx
|
|
2573
|
-
var
|
|
2617
|
+
var React36 = __toESM(require("react"), 1);
|
|
2574
2618
|
var import_react18 = require("@phosphor-icons/react");
|
|
2575
2619
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
2576
2620
|
var import_radix_ui18 = require("radix-ui");
|
|
2577
|
-
var
|
|
2621
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2578
2622
|
var toastVariants = (0, import_class_variance_authority4.cva)("border", {
|
|
2579
2623
|
variants: {
|
|
2580
2624
|
variant: {
|
|
@@ -2612,13 +2656,13 @@ var titleColour = {
|
|
|
2612
2656
|
};
|
|
2613
2657
|
function VariantIcon({ variant, size }) {
|
|
2614
2658
|
const props = { size, "aria-hidden": true, className: cn("shrink-0", iconColour[variant]) };
|
|
2615
|
-
if (variant === "success") return /* @__PURE__ */ (0,
|
|
2616
|
-
if (variant === "warning") return /* @__PURE__ */ (0,
|
|
2617
|
-
if (variant === "destructive") return /* @__PURE__ */ (0,
|
|
2618
|
-
return /* @__PURE__ */ (0,
|
|
2659
|
+
if (variant === "success") return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react18.CheckCircle, { ...props });
|
|
2660
|
+
if (variant === "warning") return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react18.Warning, { ...props });
|
|
2661
|
+
if (variant === "destructive") return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react18.WarningCircle, { ...props });
|
|
2662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react18.Info, { ...props });
|
|
2619
2663
|
}
|
|
2620
2664
|
var ToastProvider = import_radix_ui18.Toast.Provider;
|
|
2621
|
-
var ToastViewport =
|
|
2665
|
+
var ToastViewport = React36.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2622
2666
|
import_radix_ui18.Toast.Viewport,
|
|
2623
2667
|
{
|
|
2624
2668
|
ref,
|
|
@@ -2628,10 +2672,10 @@ var ToastViewport = React35.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2628
2672
|
}
|
|
2629
2673
|
));
|
|
2630
2674
|
ToastViewport.displayName = "ToastViewport";
|
|
2631
|
-
var Toast =
|
|
2675
|
+
var Toast = React36.forwardRef(
|
|
2632
2676
|
({ className, variant = "info", title, description, action, closeLabel = "Close", children, ...props }, ref) => {
|
|
2633
2677
|
const v = variant ?? "info";
|
|
2634
|
-
return /* @__PURE__ */ (0,
|
|
2678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2635
2679
|
import_radix_ui18.Toast.Root,
|
|
2636
2680
|
{
|
|
2637
2681
|
ref,
|
|
@@ -2639,19 +2683,19 @@ var Toast = React35.forwardRef(
|
|
|
2639
2683
|
className: cn("flex items-start gap-3 rounded-lg p-4 shadow-lg", toastVariants({ variant: v }), className),
|
|
2640
2684
|
...props,
|
|
2641
2685
|
children: [
|
|
2642
|
-
/* @__PURE__ */ (0,
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2644
|
-
title != null && /* @__PURE__ */ (0,
|
|
2645
|
-
description != null && /* @__PURE__ */ (0,
|
|
2686
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(VariantIcon, { variant: v, size: 20 }),
|
|
2687
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1 text-body-small", children: [
|
|
2688
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_radix_ui18.Toast.Title, { className: cn("font-semibold", titleColour[v]), children: title }),
|
|
2689
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_radix_ui18.Toast.Description, { className: "text-secondary-muted-foreground", children: description }),
|
|
2646
2690
|
children,
|
|
2647
2691
|
action
|
|
2648
2692
|
] }),
|
|
2649
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2650
2694
|
import_radix_ui18.Toast.Close,
|
|
2651
2695
|
{
|
|
2652
2696
|
"aria-label": closeLabel,
|
|
2653
2697
|
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-xs text-surface-foreground",
|
|
2654
|
-
children: /* @__PURE__ */ (0,
|
|
2698
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react18.X, { size: 16, "aria-hidden": true })
|
|
2655
2699
|
}
|
|
2656
2700
|
)
|
|
2657
2701
|
]
|
|
@@ -2661,11 +2705,11 @@ var Toast = React35.forwardRef(
|
|
|
2661
2705
|
);
|
|
2662
2706
|
Toast.displayName = "Toast";
|
|
2663
2707
|
var ToastAction = import_radix_ui18.Toast.Action;
|
|
2664
|
-
var ToastInline =
|
|
2708
|
+
var ToastInline = React36.forwardRef(
|
|
2665
2709
|
({ className, variant = "info", actions, actionsPlacement = "end", onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2666
2710
|
const v = variant ?? "info";
|
|
2667
2711
|
const below = actionsPlacement === "bottom" && !!actions;
|
|
2668
|
-
return /* @__PURE__ */ (0,
|
|
2712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2669
2713
|
"div",
|
|
2670
2714
|
{
|
|
2671
2715
|
ref,
|
|
@@ -2673,15 +2717,15 @@ var ToastInline = React35.forwardRef(
|
|
|
2673
2717
|
className: cn("flex gap-2 rounded-sm px-2 py-1.5", below ? "items-start" : "items-center", inlineVariants({ variant: v }), className),
|
|
2674
2718
|
...props,
|
|
2675
2719
|
children: [
|
|
2676
|
-
/* @__PURE__ */ (0,
|
|
2677
|
-
below ? /* @__PURE__ */ (0,
|
|
2678
|
-
/* @__PURE__ */ (0,
|
|
2679
|
-
/* @__PURE__ */ (0,
|
|
2680
|
-
] }) : /* @__PURE__ */ (0,
|
|
2681
|
-
/* @__PURE__ */ (0,
|
|
2682
|
-
actions && /* @__PURE__ */ (0,
|
|
2720
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: cn("inline-flex shrink-0", below && "mt-0.5"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(VariantIcon, { variant: v === "neutral" ? "info" : v, size: 16 }) }),
|
|
2721
|
+
below ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2722
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "text-body-small text-secondary-muted-foreground", children }),
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex items-center gap-2", children: actions })
|
|
2724
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
2725
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "min-w-0 flex-1 text-body-small text-secondary-muted-foreground", children }),
|
|
2726
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
2683
2727
|
] }),
|
|
2684
|
-
onClose && /* @__PURE__ */ (0,
|
|
2728
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react18.X, { size: 16, "aria-hidden": true }) })
|
|
2685
2729
|
]
|
|
2686
2730
|
}
|
|
2687
2731
|
);
|
|
@@ -2690,16 +2734,16 @@ var ToastInline = React35.forwardRef(
|
|
|
2690
2734
|
ToastInline.displayName = "ToastInline";
|
|
2691
2735
|
|
|
2692
2736
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
2693
|
-
var
|
|
2737
|
+
var React37 = __toESM(require("react"), 1);
|
|
2694
2738
|
var import_radix_ui19 = require("radix-ui");
|
|
2695
|
-
var
|
|
2739
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2696
2740
|
var TooltipProvider = import_radix_ui19.Tooltip.Provider;
|
|
2697
2741
|
var Tooltip = import_radix_ui19.Tooltip.Root;
|
|
2698
2742
|
var TooltipTrigger = import_radix_ui19.Tooltip.Trigger;
|
|
2699
|
-
var TooltipContent =
|
|
2743
|
+
var TooltipContent = React37.forwardRef(
|
|
2700
2744
|
({ className, sideOffset = 4, title, description, action, arrow = true, children, ...props }, ref) => {
|
|
2701
2745
|
const detailed = title != null || description != null;
|
|
2702
|
-
return /* @__PURE__ */ (0,
|
|
2746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_radix_ui19.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2703
2747
|
import_radix_ui19.Tooltip.Content,
|
|
2704
2748
|
{
|
|
2705
2749
|
ref,
|
|
@@ -2713,12 +2757,12 @@ var TooltipContent = React36.forwardRef(
|
|
|
2713
2757
|
),
|
|
2714
2758
|
...props,
|
|
2715
2759
|
children: [
|
|
2716
|
-
detailed ? /* @__PURE__ */ (0,
|
|
2717
|
-
title != null && /* @__PURE__ */ (0,
|
|
2718
|
-
description != null && /* @__PURE__ */ (0,
|
|
2719
|
-
action != null && /* @__PURE__ */ (0,
|
|
2760
|
+
detailed ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
2761
|
+
title != null && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2762
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2763
|
+
action != null && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
2720
2764
|
] }) : children,
|
|
2721
|
-
arrow && /* @__PURE__ */ (0,
|
|
2765
|
+
arrow && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_radix_ui19.Tooltip.Arrow, { width: 12, height: 8, className: "fill-primary-soft-foreground" })
|
|
2722
2766
|
]
|
|
2723
2767
|
}
|
|
2724
2768
|
) });
|
|
@@ -2727,14 +2771,14 @@ var TooltipContent = React36.forwardRef(
|
|
|
2727
2771
|
TooltipContent.displayName = "TooltipContent";
|
|
2728
2772
|
|
|
2729
2773
|
// src/components/Question Types/FileUpload.tsx
|
|
2730
|
-
var
|
|
2774
|
+
var React39 = __toESM(require("react"), 1);
|
|
2731
2775
|
var import_react19 = require("@phosphor-icons/react");
|
|
2732
2776
|
var import_radix_ui20 = require("radix-ui");
|
|
2733
2777
|
|
|
2734
2778
|
// src/components/Tags & Badges/Tag.tsx
|
|
2735
|
-
var
|
|
2779
|
+
var React38 = __toESM(require("react"), 1);
|
|
2736
2780
|
var import_class_variance_authority5 = require("class-variance-authority");
|
|
2737
|
-
var
|
|
2781
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2738
2782
|
var tagVariants = (0, import_class_variance_authority5.cva)(
|
|
2739
2783
|
"inline-flex items-center gap-1.5 whitespace-nowrap rounded-sm border px-2.5 py-1 text-ui-caption",
|
|
2740
2784
|
{
|
|
@@ -2750,7 +2794,7 @@ var tagVariants = (0, import_class_variance_authority5.cva)(
|
|
|
2750
2794
|
defaultVariants: { variant: "neutral" }
|
|
2751
2795
|
}
|
|
2752
2796
|
);
|
|
2753
|
-
var Tag =
|
|
2797
|
+
var Tag = React38.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { ref, className: cn(tagVariants({ variant }), className), ...props }));
|
|
2754
2798
|
Tag.displayName = "Tag";
|
|
2755
2799
|
var statusDotVariants = (0, import_class_variance_authority5.cva)("size-1.5 shrink-0 rounded-full", {
|
|
2756
2800
|
variants: {
|
|
@@ -2763,20 +2807,20 @@ var statusDotVariants = (0, import_class_variance_authority5.cva)("size-1.5 shri
|
|
|
2763
2807
|
},
|
|
2764
2808
|
defaultVariants: { status: "active" }
|
|
2765
2809
|
});
|
|
2766
|
-
var StatusTag =
|
|
2767
|
-
({ className, status, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2768
|
-
/* @__PURE__ */ (0,
|
|
2810
|
+
var StatusTag = React38.forwardRef(
|
|
2811
|
+
({ className, status, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { ref, className: cn(tagVariants({ variant: "default" }), className), ...props, children: [
|
|
2812
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: statusDotVariants({ status }), "aria-hidden": "true" }),
|
|
2769
2813
|
children
|
|
2770
2814
|
] })
|
|
2771
2815
|
);
|
|
2772
2816
|
StatusTag.displayName = "StatusTag";
|
|
2773
2817
|
|
|
2774
2818
|
// src/components/Question Types/FileUpload.tsx
|
|
2775
|
-
var
|
|
2776
|
-
var FileUploadZone =
|
|
2819
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2820
|
+
var FileUploadZone = React39.forwardRef(
|
|
2777
2821
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2778
|
-
const [over, setOver] =
|
|
2779
|
-
return /* @__PURE__ */ (0,
|
|
2822
|
+
const [over, setOver] = React39.useState(false);
|
|
2823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2780
2824
|
"label",
|
|
2781
2825
|
{
|
|
2782
2826
|
className: cn(
|
|
@@ -2796,12 +2840,12 @@ var FileUploadZone = React38.forwardRef(
|
|
|
2796
2840
|
onFiles?.(Array.from(event.dataTransfer.files));
|
|
2797
2841
|
},
|
|
2798
2842
|
children: [
|
|
2799
|
-
/* @__PURE__ */ (0,
|
|
2800
|
-
/* @__PURE__ */ (0,
|
|
2801
|
-
/* @__PURE__ */ (0,
|
|
2802
|
-
hint && /* @__PURE__ */ (0,
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.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_runtime40.jsx)(import_react19.FileText, { size: 24, "aria-hidden": true }) }),
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "flex flex-col gap-1", children: [
|
|
2845
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-body-small text-surface-foreground", children: title }),
|
|
2846
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-ui-caption text-secondary-muted-foreground", children: hint })
|
|
2803
2847
|
] }),
|
|
2804
|
-
/* @__PURE__ */ (0,
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2805
2849
|
"input",
|
|
2806
2850
|
{
|
|
2807
2851
|
ref,
|
|
@@ -2817,47 +2861,47 @@ var FileUploadZone = React38.forwardRef(
|
|
|
2817
2861
|
}
|
|
2818
2862
|
);
|
|
2819
2863
|
FileUploadZone.displayName = "FileUploadZone";
|
|
2820
|
-
var FileUploadItem =
|
|
2864
|
+
var FileUploadItem = React39.forwardRef(
|
|
2821
2865
|
({ className, name, size, status = "uploading", progress = 0, timeLeft, icon, onRemove, removeLabel, ...props }, ref) => {
|
|
2822
2866
|
const uploading = status === "uploading";
|
|
2823
|
-
return /* @__PURE__ */ (0,
|
|
2867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2824
2868
|
"div",
|
|
2825
2869
|
{
|
|
2826
2870
|
ref,
|
|
2827
2871
|
className: cn("flex w-full flex-col justify-center gap-2 overflow-hidden rounded-sm border border-border p-2", className),
|
|
2828
2872
|
...props,
|
|
2829
2873
|
children: [
|
|
2830
|
-
/* @__PURE__ */ (0,
|
|
2831
|
-
/* @__PURE__ */ (0,
|
|
2832
|
-
/* @__PURE__ */ (0,
|
|
2833
|
-
/* @__PURE__ */ (0,
|
|
2834
|
-
/* @__PURE__ */ (0,
|
|
2835
|
-
onRemove && /* @__PURE__ */ (0,
|
|
2874
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2875
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.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_runtime40.jsx)(import_react19.FileText, { size: 24, "aria-hidden": true }) }),
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2877
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "min-w-0 truncate text-ui-label text-surface-foreground", children: name }),
|
|
2879
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react19.X, { size: 16, "aria-hidden": true }) })
|
|
2836
2880
|
] }),
|
|
2837
|
-
/* @__PURE__ */ (0,
|
|
2838
|
-
/* @__PURE__ */ (0,
|
|
2881
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
2839
2883
|
size,
|
|
2840
|
-
status === "complete" && /* @__PURE__ */ (0,
|
|
2841
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
2842
|
-
uploading && timeLeft && /* @__PURE__ */ (0,
|
|
2843
|
-
/* @__PURE__ */ (0,
|
|
2884
|
+
status === "complete" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Tag, { variant: "success", children: "Complete" }),
|
|
2885
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Tag, { variant: "destructive", children: "Error" }),
|
|
2886
|
+
uploading && timeLeft && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2844
2888
|
timeLeft
|
|
2845
2889
|
] })
|
|
2846
2890
|
] }),
|
|
2847
|
-
uploading && /* @__PURE__ */ (0,
|
|
2891
|
+
uploading && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "text-body-xxs font-normal", children: [
|
|
2848
2892
|
Math.round(progress),
|
|
2849
2893
|
"%"
|
|
2850
2894
|
] })
|
|
2851
2895
|
] })
|
|
2852
2896
|
] })
|
|
2853
2897
|
] }),
|
|
2854
|
-
uploading && /* @__PURE__ */ (0,
|
|
2898
|
+
uploading && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2855
2899
|
import_radix_ui20.Progress.Root,
|
|
2856
2900
|
{
|
|
2857
2901
|
value: progress,
|
|
2858
2902
|
"aria-label": `Uploading ${name}`,
|
|
2859
2903
|
className: "h-0.75 w-full overflow-hidden rounded-sm bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5",
|
|
2860
|
-
children: /* @__PURE__ */ (0,
|
|
2904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_radix_ui20.Progress.Indicator, { className: "h-full bg-accent transition-[width]", style: { width: `${progress}%` } })
|
|
2861
2905
|
}
|
|
2862
2906
|
)
|
|
2863
2907
|
]
|
|
@@ -2868,25 +2912,25 @@ var FileUploadItem = React38.forwardRef(
|
|
|
2868
2912
|
FileUploadItem.displayName = "FileUploadItem";
|
|
2869
2913
|
|
|
2870
2914
|
// src/components/Question Types/Media.tsx
|
|
2871
|
-
var
|
|
2915
|
+
var React40 = __toESM(require("react"), 1);
|
|
2872
2916
|
var import_react20 = require("@phosphor-icons/react");
|
|
2873
2917
|
var import_radix_ui21 = require("radix-ui");
|
|
2874
|
-
var
|
|
2918
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2875
2919
|
function MediaInfo({ name, details, onRemove, removeLabel, large, className, ...props }) {
|
|
2876
|
-
return /* @__PURE__ */ (0,
|
|
2877
|
-
/* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2879
|
-
details && /* @__PURE__ */ (0,
|
|
2880
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
2920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cn("flex items-center justify-between border-t border-border bg-surface px-6 py-4", className), ...props, children: [
|
|
2921
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: cn("truncate text-surface-foreground", large ? "text-body-section" : "text-ui-label"), children: name }),
|
|
2923
|
+
details && /* @__PURE__ */ (0, import_jsx_runtime41.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_runtime41.jsxs)(React40.Fragment, { children: [
|
|
2924
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2881
2925
|
part
|
|
2882
2926
|
] }, part)) })
|
|
2883
2927
|
] }),
|
|
2884
|
-
onRemove && /* @__PURE__ */ (0,
|
|
2928
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Button, { type: "button", variant: "destructive", size: "icon", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.Trash, { size: 16, "aria-hidden": true }) })
|
|
2885
2929
|
] });
|
|
2886
2930
|
}
|
|
2887
|
-
var ImagePreview =
|
|
2888
|
-
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2889
|
-
/* @__PURE__ */ (0,
|
|
2931
|
+
var ImagePreview = React40.forwardRef(
|
|
2932
|
+
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border", className), ...props, children: [
|
|
2933
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2890
2934
|
"div",
|
|
2891
2935
|
{
|
|
2892
2936
|
className: cn(
|
|
@@ -2897,12 +2941,12 @@ var ImagePreview = React39.forwardRef(
|
|
|
2897
2941
|
children
|
|
2898
2942
|
}
|
|
2899
2943
|
),
|
|
2900
|
-
/* @__PURE__ */ (0,
|
|
2944
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MediaInfo, { name, details, onRemove, large: true })
|
|
2901
2945
|
] })
|
|
2902
2946
|
);
|
|
2903
2947
|
ImagePreview.displayName = "ImagePreview";
|
|
2904
|
-
var ImageThumbnails =
|
|
2905
|
-
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ (0,
|
|
2948
|
+
var ImageThumbnails = React40.forwardRef(
|
|
2949
|
+
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2906
2950
|
import_radix_ui21.ToggleGroup.Root,
|
|
2907
2951
|
{
|
|
2908
2952
|
ref,
|
|
@@ -2914,17 +2958,17 @@ var ImageThumbnails = React39.forwardRef(
|
|
|
2914
2958
|
children: Array.from({ length: max }, (_, index) => {
|
|
2915
2959
|
const image = images[index];
|
|
2916
2960
|
if (!image) {
|
|
2917
|
-
return /* @__PURE__ */ (0,
|
|
2961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2918
2962
|
"span",
|
|
2919
2963
|
{
|
|
2920
2964
|
"aria-hidden": "true",
|
|
2921
2965
|
className: "flex h-20 min-w-0 flex-1 items-center justify-center rounded-sm border border-dashed border-border text-accent-foreground",
|
|
2922
|
-
children: /* @__PURE__ */ (0,
|
|
2966
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.Image, { size: 24 })
|
|
2923
2967
|
},
|
|
2924
2968
|
`empty-${index}`
|
|
2925
2969
|
);
|
|
2926
2970
|
}
|
|
2927
|
-
return /* @__PURE__ */ (0,
|
|
2971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2928
2972
|
import_radix_ui21.ToggleGroup.Item,
|
|
2929
2973
|
{
|
|
2930
2974
|
value: image.id,
|
|
@@ -2934,7 +2978,7 @@ var ImageThumbnails = React39.forwardRef(
|
|
|
2934
2978
|
"hover:bg-accent-soft hover:bg-none",
|
|
2935
2979
|
"data-[state=on]:border-accent-foreground data-[state=on]:bg-accent-soft data-[state=on]:bg-none data-[state=on]:text-accent-foreground"
|
|
2936
2980
|
),
|
|
2937
|
-
children: image.src ? /* @__PURE__ */ (0,
|
|
2981
|
+
children: image.src ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("img", { src: image.src, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.Image, { size: 24, "aria-hidden": true })
|
|
2938
2982
|
},
|
|
2939
2983
|
image.id
|
|
2940
2984
|
);
|
|
@@ -2947,13 +2991,13 @@ var formatTime = (seconds) => {
|
|
|
2947
2991
|
const total = Math.max(0, Math.floor(Number.isFinite(seconds) ? seconds : 0));
|
|
2948
2992
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
2949
2993
|
};
|
|
2950
|
-
var VideoPlayer =
|
|
2994
|
+
var VideoPlayer = React40.forwardRef(
|
|
2951
2995
|
({ className, src, name, details, onRemove, onMore, initialTime = 0, initialDuration = 0, ...props }, ref) => {
|
|
2952
|
-
const video =
|
|
2953
|
-
const [playing, setPlaying] =
|
|
2954
|
-
const [time, setTime] =
|
|
2955
|
-
const [duration, setDuration] =
|
|
2956
|
-
const [volume, setVolume] =
|
|
2996
|
+
const video = React40.useRef(null);
|
|
2997
|
+
const [playing, setPlaying] = React40.useState(false);
|
|
2998
|
+
const [time, setTime] = React40.useState(initialTime);
|
|
2999
|
+
const [duration, setDuration] = React40.useState(initialDuration);
|
|
3000
|
+
const [volume, setVolume] = React40.useState(1);
|
|
2957
3001
|
const muted = volume === 0;
|
|
2958
3002
|
const toggle2 = () => {
|
|
2959
3003
|
const el = video.current;
|
|
@@ -2961,9 +3005,9 @@ var VideoPlayer = React39.forwardRef(
|
|
|
2961
3005
|
if (el.paused) void el.play();
|
|
2962
3006
|
else el.pause();
|
|
2963
3007
|
};
|
|
2964
|
-
return /* @__PURE__ */ (0,
|
|
2965
|
-
/* @__PURE__ */ (0,
|
|
2966
|
-
src && /* @__PURE__ */ (0,
|
|
3008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface", className), ...props, children: [
|
|
3009
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "relative flex h-60.5 w-full items-end bg-accent-soft", children: [
|
|
3010
|
+
src && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2967
3011
|
"video",
|
|
2968
3012
|
{
|
|
2969
3013
|
ref: video,
|
|
@@ -2976,8 +3020,8 @@ var VideoPlayer = React39.forwardRef(
|
|
|
2976
3020
|
onVolumeChange: (event) => setVolume(event.currentTarget.muted ? 0 : event.currentTarget.volume)
|
|
2977
3021
|
}
|
|
2978
3022
|
),
|
|
2979
|
-
/* @__PURE__ */ (0,
|
|
2980
|
-
/* @__PURE__ */ (0,
|
|
3023
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.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: [
|
|
3024
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
2981
3025
|
import_radix_ui21.Slider.Root,
|
|
2982
3026
|
{
|
|
2983
3027
|
min: 0,
|
|
@@ -2991,31 +3035,31 @@ var VideoPlayer = React39.forwardRef(
|
|
|
2991
3035
|
},
|
|
2992
3036
|
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
2993
3037
|
children: [
|
|
2994
|
-
/* @__PURE__ */ (0,
|
|
2995
|
-
/* @__PURE__ */ (0,
|
|
3038
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.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_runtime41.jsx)(import_radix_ui21.Slider.Range, { className: "absolute h-full bg-accent-foreground" }) }),
|
|
3039
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_radix_ui21.Slider.Thumb, { "aria-label": "Seek", className: "block size-3 rounded-full border-2 border-surface bg-surface shadow-sm" })
|
|
2996
3040
|
]
|
|
2997
3041
|
}
|
|
2998
3042
|
),
|
|
2999
|
-
/* @__PURE__ */ (0,
|
|
3000
|
-
/* @__PURE__ */ (0,
|
|
3001
|
-
/* @__PURE__ */ (0,
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
3045
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3002
3046
|
"button",
|
|
3003
3047
|
{
|
|
3004
3048
|
type: "button",
|
|
3005
3049
|
"aria-label": playing ? "Pause" : "Play",
|
|
3006
3050
|
onClick: toggle2,
|
|
3007
3051
|
className: "inline-flex size-10 items-center justify-center rounded-full bg-surface/12 text-surface transition-colors hover:bg-surface/20",
|
|
3008
|
-
children: playing ? /* @__PURE__ */ (0,
|
|
3052
|
+
children: playing ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.Pause, { size: 16, weight: "fill", "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.Play, { size: 16, weight: "fill", "aria-hidden": true })
|
|
3009
3053
|
}
|
|
3010
3054
|
),
|
|
3011
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "text-ui-label whitespace-nowrap text-surface/80", children: [
|
|
3012
3056
|
formatTime(time),
|
|
3013
3057
|
" / ",
|
|
3014
3058
|
formatTime(duration)
|
|
3015
3059
|
] })
|
|
3016
3060
|
] }),
|
|
3017
|
-
/* @__PURE__ */ (0,
|
|
3018
|
-
/* @__PURE__ */ (0,
|
|
3061
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3019
3063
|
VolumeControl,
|
|
3020
3064
|
{
|
|
3021
3065
|
volume,
|
|
@@ -3028,41 +3072,41 @@ var VideoPlayer = React39.forwardRef(
|
|
|
3028
3072
|
}
|
|
3029
3073
|
}
|
|
3030
3074
|
),
|
|
3031
|
-
/* @__PURE__ */ (0,
|
|
3075
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3032
3076
|
"button",
|
|
3033
3077
|
{
|
|
3034
3078
|
type: "button",
|
|
3035
3079
|
"aria-label": "Full screen",
|
|
3036
3080
|
onClick: () => void video.current?.requestFullscreen?.(),
|
|
3037
3081
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
3038
|
-
children: /* @__PURE__ */ (0,
|
|
3082
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.CornersOut, { size: 16, "aria-hidden": true })
|
|
3039
3083
|
}
|
|
3040
3084
|
),
|
|
3041
|
-
/* @__PURE__ */ (0,
|
|
3085
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3042
3086
|
"button",
|
|
3043
3087
|
{
|
|
3044
3088
|
type: "button",
|
|
3045
3089
|
"aria-label": "More",
|
|
3046
3090
|
onClick: onMore,
|
|
3047
3091
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
3048
|
-
children: /* @__PURE__ */ (0,
|
|
3092
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.DotsThree, { size: 16, "aria-hidden": true })
|
|
3049
3093
|
}
|
|
3050
3094
|
)
|
|
3051
3095
|
] })
|
|
3052
3096
|
] })
|
|
3053
3097
|
] })
|
|
3054
3098
|
] }),
|
|
3055
|
-
name && /* @__PURE__ */ (0,
|
|
3056
|
-
/* @__PURE__ */ (0,
|
|
3099
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(MediaInfo, { name, details, onRemove }),
|
|
3100
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "sr-only", "aria-live": "polite", children: muted ? "Muted" : "" })
|
|
3057
3101
|
] });
|
|
3058
3102
|
}
|
|
3059
3103
|
);
|
|
3060
3104
|
VideoPlayer.displayName = "VideoPlayer";
|
|
3061
3105
|
function VolumeControl({ volume, onVolumeChange, className }) {
|
|
3062
|
-
const last =
|
|
3106
|
+
const last = React40.useRef(volume || 1);
|
|
3063
3107
|
if (volume > 0) last.current = volume;
|
|
3064
|
-
return /* @__PURE__ */ (0,
|
|
3065
|
-
/* @__PURE__ */ (0,
|
|
3108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: cn("group/volume flex items-center", className), children: [
|
|
3109
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.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_runtime41.jsxs)(
|
|
3066
3110
|
import_radix_ui21.Slider.Root,
|
|
3067
3111
|
{
|
|
3068
3112
|
min: 0,
|
|
@@ -3072,32 +3116,32 @@ function VolumeControl({ volume, onVolumeChange, className }) {
|
|
|
3072
3116
|
onValueChange: ([next]) => next !== void 0 && onVolumeChange(next),
|
|
3073
3117
|
className: "relative flex h-4 w-14 touch-none items-center select-none",
|
|
3074
3118
|
children: [
|
|
3075
|
-
/* @__PURE__ */ (0,
|
|
3076
|
-
/* @__PURE__ */ (0,
|
|
3119
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.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_runtime41.jsx)(import_radix_ui21.Slider.Range, { className: "absolute h-full bg-surface" }) }),
|
|
3120
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_radix_ui21.Slider.Thumb, { "aria-label": "Volume", className: "block size-3 rounded-full bg-surface shadow-sm" })
|
|
3077
3121
|
]
|
|
3078
3122
|
}
|
|
3079
3123
|
) }),
|
|
3080
|
-
/* @__PURE__ */ (0,
|
|
3124
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3081
3125
|
"button",
|
|
3082
3126
|
{
|
|
3083
3127
|
type: "button",
|
|
3084
3128
|
"aria-label": volume === 0 ? "Unmute" : "Mute",
|
|
3085
3129
|
onClick: () => onVolumeChange(volume === 0 ? last.current : 0),
|
|
3086
3130
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
3087
|
-
children: volume === 0 ? /* @__PURE__ */ (0,
|
|
3131
|
+
children: volume === 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.SpeakerSimpleX, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react20.SpeakerSimpleHigh, { size: 16, "aria-hidden": true })
|
|
3088
3132
|
}
|
|
3089
3133
|
)
|
|
3090
3134
|
] });
|
|
3091
3135
|
}
|
|
3092
3136
|
|
|
3093
3137
|
// src/components/Question Types/OpenEndAnswer.tsx
|
|
3094
|
-
var
|
|
3095
|
-
var
|
|
3096
|
-
var OpenEndAnswer =
|
|
3138
|
+
var React41 = __toESM(require("react"), 1);
|
|
3139
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3140
|
+
var OpenEndAnswer = React41.forwardRef(
|
|
3097
3141
|
({ value, defaultValue, onChange, maxLength = 1e3, placeholder = "Write your answer", ...props }, ref) => {
|
|
3098
|
-
const [internal, setInternal] =
|
|
3142
|
+
const [internal, setInternal] = React41.useState(String(defaultValue ?? ""));
|
|
3099
3143
|
const text = value !== void 0 ? String(value) : internal;
|
|
3100
|
-
return /* @__PURE__ */ (0,
|
|
3144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3101
3145
|
Textarea,
|
|
3102
3146
|
{
|
|
3103
3147
|
ref,
|
|
@@ -3117,10 +3161,10 @@ var OpenEndAnswer = React40.forwardRef(
|
|
|
3117
3161
|
OpenEndAnswer.displayName = "OpenEndAnswer";
|
|
3118
3162
|
|
|
3119
3163
|
// src/components/Question Types/QuestionCard.tsx
|
|
3120
|
-
var
|
|
3121
|
-
var
|
|
3122
|
-
var QuestionCard =
|
|
3123
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3164
|
+
var React42 = __toESM(require("react"), 1);
|
|
3165
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3166
|
+
var QuestionCard = React42.forwardRef(
|
|
3167
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3124
3168
|
"div",
|
|
3125
3169
|
{
|
|
3126
3170
|
ref,
|
|
@@ -3132,7 +3176,7 @@ var QuestionCard = React41.forwardRef(
|
|
|
3132
3176
|
QuestionCard.displayName = "QuestionCard";
|
|
3133
3177
|
|
|
3134
3178
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3135
|
-
var
|
|
3179
|
+
var React46 = __toESM(require("react"), 1);
|
|
3136
3180
|
var import_react23 = require("@phosphor-icons/react");
|
|
3137
3181
|
|
|
3138
3182
|
// src/lib/keepEditingFocus.ts
|
|
@@ -3144,16 +3188,16 @@ function keepEditingFocus(event) {
|
|
|
3144
3188
|
}
|
|
3145
3189
|
|
|
3146
3190
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3147
|
-
var
|
|
3191
|
+
var React45 = __toESM(require("react"), 1);
|
|
3148
3192
|
|
|
3149
3193
|
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3150
|
-
var
|
|
3194
|
+
var React44 = __toESM(require("react"), 1);
|
|
3151
3195
|
var import_react22 = require("@phosphor-icons/react");
|
|
3152
3196
|
|
|
3153
3197
|
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
3154
|
-
var
|
|
3198
|
+
var React43 = require("react");
|
|
3155
3199
|
var import_react21 = require("@phosphor-icons/react");
|
|
3156
|
-
var
|
|
3200
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3157
3201
|
var icons = {
|
|
3158
3202
|
"select-one": import_react21.RadioButton,
|
|
3159
3203
|
"select-multiple": import_react21.CheckSquare,
|
|
@@ -3168,13 +3212,13 @@ var icons = {
|
|
|
3168
3212
|
};
|
|
3169
3213
|
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
3170
3214
|
const Icon = icons[type];
|
|
3171
|
-
return /* @__PURE__ */ (0,
|
|
3215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
3172
3216
|
}
|
|
3173
3217
|
|
|
3174
3218
|
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3175
|
-
var
|
|
3176
|
-
var QuestionNumberTag =
|
|
3177
|
-
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3219
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3220
|
+
var QuestionNumberTag = React44.forwardRef(
|
|
3221
|
+
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
3178
3222
|
"span",
|
|
3179
3223
|
{
|
|
3180
3224
|
ref,
|
|
@@ -3193,7 +3237,7 @@ var QuestionNumberTag = React43.forwardRef(
|
|
|
3193
3237
|
dragHandleProps?.className
|
|
3194
3238
|
),
|
|
3195
3239
|
children: [
|
|
3196
|
-
questionType && /* @__PURE__ */ (0,
|
|
3240
|
+
questionType && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3197
3241
|
QuestionTypeIcon,
|
|
3198
3242
|
{
|
|
3199
3243
|
type: questionType,
|
|
@@ -3201,7 +3245,7 @@ var QuestionNumberTag = React43.forwardRef(
|
|
|
3201
3245
|
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3202
3246
|
}
|
|
3203
3247
|
),
|
|
3204
|
-
showDragHandle && /* @__PURE__ */ (0,
|
|
3248
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3205
3249
|
import_react22.DotsSixVertical,
|
|
3206
3250
|
{
|
|
3207
3251
|
size: 16,
|
|
@@ -3218,30 +3262,30 @@ var QuestionNumberTag = React43.forwardRef(
|
|
|
3218
3262
|
QuestionNumberTag.displayName = "QuestionNumberTag";
|
|
3219
3263
|
|
|
3220
3264
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3221
|
-
var
|
|
3265
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3222
3266
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
3223
|
-
var QuestionHeader =
|
|
3267
|
+
var QuestionHeader = React45.forwardRef(
|
|
3224
3268
|
({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, titleRecommendedMax, titleRecommendedNote, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, questionType, titleMarks, onTitleMarkApply, onTitleMarkDismiss, titleEditing, ...props }, ref) => {
|
|
3225
|
-
const [draft, setDraft] =
|
|
3269
|
+
const [draft, setDraft] = React45.useState(null);
|
|
3226
3270
|
const label = String(number).padStart(2, "0");
|
|
3227
3271
|
const showError = error !== void 0 && error !== false;
|
|
3228
3272
|
if (editor) {
|
|
3229
3273
|
const text = typeof title === "string" ? title : "";
|
|
3230
3274
|
const count = (draft ?? text).length;
|
|
3231
3275
|
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
3232
|
-
return /* @__PURE__ */ (0,
|
|
3233
|
-
/* @__PURE__ */ (0,
|
|
3234
|
-
/* @__PURE__ */ (0,
|
|
3235
|
-
/* @__PURE__ */ (0,
|
|
3276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3279
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(QuestionNumberTag, { number, active, questionType, showDragHandle, dragHandleProps }),
|
|
3236
3280
|
meta
|
|
3237
3281
|
] }),
|
|
3238
|
-
actions && /* @__PURE__ */ (0,
|
|
3282
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: cn(
|
|
3239
3283
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
3240
3284
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
3241
3285
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
3242
3286
|
), children: actions })
|
|
3243
3287
|
] }),
|
|
3244
|
-
/* @__PURE__ */ (0,
|
|
3288
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3245
3289
|
InlineEdit,
|
|
3246
3290
|
{
|
|
3247
3291
|
variant: "question",
|
|
@@ -3267,8 +3311,8 @@ var QuestionHeader = React44.forwardRef(
|
|
|
3267
3311
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
3268
3312
|
}
|
|
3269
3313
|
),
|
|
3270
|
-
long && titleRecommendedNote != null && /* @__PURE__ */ (0,
|
|
3271
|
-
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0,
|
|
3314
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
3315
|
+
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3272
3316
|
count,
|
|
3273
3317
|
"/",
|
|
3274
3318
|
maxLength,
|
|
@@ -3276,16 +3320,16 @@ var QuestionHeader = React44.forwardRef(
|
|
|
3276
3320
|
] })
|
|
3277
3321
|
] });
|
|
3278
3322
|
}
|
|
3279
|
-
return /* @__PURE__ */ (0,
|
|
3280
|
-
showError && /* @__PURE__ */ (0,
|
|
3281
|
-
/* @__PURE__ */ (0,
|
|
3323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3324
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ToastInline, { variant: "destructive", onClose: onDismissError, className: "min-h-10", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "text-ui-label text-destructive", children: error === true ? "This question is mandatory." : error }) }),
|
|
3325
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { className: eyebrow, children: [
|
|
3282
3326
|
"Question ",
|
|
3283
3327
|
label
|
|
3284
3328
|
] }),
|
|
3285
|
-
/* @__PURE__ */ (0,
|
|
3329
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
3286
3330
|
title,
|
|
3287
|
-
required && /* @__PURE__ */ (0,
|
|
3288
|
-
required && /* @__PURE__ */ (0,
|
|
3331
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
3332
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "sr-only", children: " (required)" })
|
|
3289
3333
|
] })
|
|
3290
3334
|
] });
|
|
3291
3335
|
}
|
|
@@ -3293,8 +3337,8 @@ var QuestionHeader = React44.forwardRef(
|
|
|
3293
3337
|
QuestionHeader.displayName = "QuestionHeader";
|
|
3294
3338
|
|
|
3295
3339
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3296
|
-
var
|
|
3297
|
-
var QuestionEditorCard =
|
|
3340
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3341
|
+
var QuestionEditorCard = React46.forwardRef(
|
|
3298
3342
|
({
|
|
3299
3343
|
className,
|
|
3300
3344
|
number,
|
|
@@ -3330,7 +3374,7 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3330
3374
|
...props
|
|
3331
3375
|
}, ref) => {
|
|
3332
3376
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
3333
|
-
return /* @__PURE__ */ (0,
|
|
3377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3334
3378
|
"div",
|
|
3335
3379
|
{
|
|
3336
3380
|
ref,
|
|
@@ -3342,7 +3386,7 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3342
3386
|
props.onMouseDown?.(event);
|
|
3343
3387
|
},
|
|
3344
3388
|
children: [
|
|
3345
|
-
/* @__PURE__ */ (0,
|
|
3389
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3346
3390
|
"div",
|
|
3347
3391
|
{
|
|
3348
3392
|
className: cn(
|
|
@@ -3350,9 +3394,9 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3350
3394
|
active ? "border-accent" : "border-border"
|
|
3351
3395
|
),
|
|
3352
3396
|
children: [
|
|
3353
|
-
/* @__PURE__ */ (0,
|
|
3354
|
-
/* @__PURE__ */ (0,
|
|
3355
|
-
/* @__PURE__ */ (0,
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
3398
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3356
3400
|
QuestionHeader,
|
|
3357
3401
|
{
|
|
3358
3402
|
editor: true,
|
|
@@ -3375,8 +3419,8 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3375
3419
|
titleEditing,
|
|
3376
3420
|
meta,
|
|
3377
3421
|
maxLength,
|
|
3378
|
-
actions: actions ?? /* @__PURE__ */ (0,
|
|
3379
|
-
/* @__PURE__ */ (0,
|
|
3422
|
+
actions: actions ?? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3423
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3380
3424
|
Button,
|
|
3381
3425
|
{
|
|
3382
3426
|
type: "button",
|
|
@@ -3384,10 +3428,10 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3384
3428
|
size: "icon-sm",
|
|
3385
3429
|
"aria-label": "Duplicate question",
|
|
3386
3430
|
onClick: onDuplicate,
|
|
3387
|
-
children: /* @__PURE__ */ (0,
|
|
3431
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react23.Copy, { size: 16, "aria-hidden": true })
|
|
3388
3432
|
}
|
|
3389
3433
|
),
|
|
3390
|
-
/* @__PURE__ */ (0,
|
|
3434
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3391
3435
|
Button,
|
|
3392
3436
|
{
|
|
3393
3437
|
type: "button",
|
|
@@ -3395,10 +3439,10 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3395
3439
|
size: "icon-sm",
|
|
3396
3440
|
"aria-label": "Delete question",
|
|
3397
3441
|
onClick: onDelete,
|
|
3398
|
-
children: /* @__PURE__ */ (0,
|
|
3442
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react23.Trash, { size: 16, "aria-hidden": true })
|
|
3399
3443
|
}
|
|
3400
3444
|
),
|
|
3401
|
-
/* @__PURE__ */ (0,
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3402
3446
|
Button,
|
|
3403
3447
|
{
|
|
3404
3448
|
type: "button",
|
|
@@ -3406,7 +3450,7 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3406
3450
|
size: "icon-sm",
|
|
3407
3451
|
"aria-label": "Preview question",
|
|
3408
3452
|
onClick: onPreview,
|
|
3409
|
-
children: /* @__PURE__ */ (0,
|
|
3453
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react23.Eye, { size: 16, "aria-hidden": true })
|
|
3410
3454
|
}
|
|
3411
3455
|
)
|
|
3412
3456
|
] })
|
|
@@ -3414,18 +3458,18 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3414
3458
|
),
|
|
3415
3459
|
children
|
|
3416
3460
|
] }),
|
|
3417
|
-
error && /* @__PURE__ */ (0,
|
|
3418
|
-
/* @__PURE__ */ (0,
|
|
3461
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3462
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react23.Warning, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3419
3463
|
error
|
|
3420
3464
|
] }),
|
|
3421
|
-
footer && /* @__PURE__ */ (0,
|
|
3422
|
-
/* @__PURE__ */ (0,
|
|
3423
|
-
/* @__PURE__ */ (0,
|
|
3424
|
-
onAdd && /* @__PURE__ */ (0,
|
|
3425
|
-
/* @__PURE__ */ (0,
|
|
3465
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3467
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3468
|
+
onAdd && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react23.Plus, { size: 16, "aria-hidden": true }),
|
|
3426
3470
|
"Add choice"
|
|
3427
3471
|
] }),
|
|
3428
|
-
onPaste && /* @__PURE__ */ (0,
|
|
3472
|
+
onPaste && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3429
3473
|
Button,
|
|
3430
3474
|
{
|
|
3431
3475
|
type: "button",
|
|
@@ -3433,17 +3477,17 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3433
3477
|
size: "icon",
|
|
3434
3478
|
"aria-label": "Paste choices",
|
|
3435
3479
|
onClick: onPaste,
|
|
3436
|
-
children: /* @__PURE__ */ (0,
|
|
3480
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react23.Clipboard, { size: 16, "aria-hidden": true })
|
|
3437
3481
|
}
|
|
3438
3482
|
)
|
|
3439
3483
|
] })
|
|
3440
3484
|
] })
|
|
3441
3485
|
] }),
|
|
3442
|
-
note && /* @__PURE__ */ (0,
|
|
3486
|
+
note && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
3443
3487
|
]
|
|
3444
3488
|
}
|
|
3445
3489
|
),
|
|
3446
|
-
onAskAi && /* @__PURE__ */ (0,
|
|
3490
|
+
onAskAi && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3447
3491
|
Button,
|
|
3448
3492
|
{
|
|
3449
3493
|
type: "button",
|
|
@@ -3452,7 +3496,7 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3452
3496
|
"aria-label": "Ask AI",
|
|
3453
3497
|
onClick: onAskAi,
|
|
3454
3498
|
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",
|
|
3455
|
-
children: /* @__PURE__ */ (0,
|
|
3499
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react23.Sparkle, { size: 16, "aria-hidden": true })
|
|
3456
3500
|
}
|
|
3457
3501
|
)
|
|
3458
3502
|
]
|
|
@@ -3463,15 +3507,15 @@ var QuestionEditorCard = React45.forwardRef(
|
|
|
3463
3507
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
3464
3508
|
|
|
3465
3509
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
3466
|
-
var
|
|
3510
|
+
var React47 = __toESM(require("react"), 1);
|
|
3467
3511
|
var import_react24 = require("@phosphor-icons/react");
|
|
3468
3512
|
var import_radix_ui22 = require("radix-ui");
|
|
3469
|
-
var
|
|
3470
|
-
var QuestionNavItem =
|
|
3513
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3514
|
+
var QuestionNavItem = React47.forwardRef(
|
|
3471
3515
|
({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3472
3516
|
const Comp = asChild ? import_radix_ui22.Slot.Root : "button";
|
|
3473
3517
|
const warn = !error && !!warning;
|
|
3474
|
-
return /* @__PURE__ */ (0,
|
|
3518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3475
3519
|
Comp,
|
|
3476
3520
|
{
|
|
3477
3521
|
ref,
|
|
@@ -3490,9 +3534,9 @@ var QuestionNavItem = React46.forwardRef(
|
|
|
3490
3534
|
),
|
|
3491
3535
|
...props,
|
|
3492
3536
|
children: [
|
|
3493
|
-
/* @__PURE__ */ (0,
|
|
3494
|
-
showDragHandle && /* @__PURE__ */ (0,
|
|
3495
|
-
/* @__PURE__ */ (0,
|
|
3537
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3538
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react24.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3539
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react24.WarningCircle, { size: 16, className: "text-destructive-foreground" }) : warn ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react24.Warning, { size: 16, className: "text-warning-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3496
3540
|
QuestionTypeIcon,
|
|
3497
3541
|
{
|
|
3498
3542
|
type: questionType,
|
|
@@ -3501,9 +3545,9 @@ var QuestionNavItem = React46.forwardRef(
|
|
|
3501
3545
|
}
|
|
3502
3546
|
) })
|
|
3503
3547
|
] }),
|
|
3504
|
-
/* @__PURE__ */ (0,
|
|
3505
|
-
error && /* @__PURE__ */ (0,
|
|
3506
|
-
warn && /* @__PURE__ */ (0,
|
|
3548
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3549
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "sr-only", children: ", has errors" }),
|
|
3550
|
+
warn && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "sr-only", children: ", has warnings" })
|
|
3507
3551
|
]
|
|
3508
3552
|
}
|
|
3509
3553
|
);
|
|
@@ -3512,14 +3556,14 @@ var QuestionNavItem = React46.forwardRef(
|
|
|
3512
3556
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
3513
3557
|
|
|
3514
3558
|
// src/components/Question Types/QuestionOption.tsx
|
|
3515
|
-
var
|
|
3559
|
+
var React48 = __toESM(require("react"), 1);
|
|
3516
3560
|
var import_react25 = require("@phosphor-icons/react");
|
|
3517
|
-
var
|
|
3561
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3518
3562
|
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";
|
|
3519
3563
|
function QuestionOption(props) {
|
|
3520
|
-
const id =
|
|
3521
|
-
return /* @__PURE__ */ (0,
|
|
3522
|
-
props.kind === "checkbox" ? /* @__PURE__ */ (0,
|
|
3564
|
+
const id = React48.useId();
|
|
3565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3566
|
+
props.kind === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3523
3567
|
Checkbox,
|
|
3524
3568
|
{
|
|
3525
3569
|
id,
|
|
@@ -3528,16 +3572,16 @@ function QuestionOption(props) {
|
|
|
3528
3572
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
3529
3573
|
disabled: props.disabled
|
|
3530
3574
|
}
|
|
3531
|
-
) : /* @__PURE__ */ (0,
|
|
3532
|
-
/* @__PURE__ */ (0,
|
|
3575
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3533
3577
|
] });
|
|
3534
3578
|
}
|
|
3535
|
-
var QuestionOtherOption =
|
|
3579
|
+
var QuestionOtherOption = React48.forwardRef(
|
|
3536
3580
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3537
|
-
const inner =
|
|
3538
|
-
|
|
3581
|
+
const inner = React48.useRef(null);
|
|
3582
|
+
React48.useImperativeHandle(ref, () => inner.current);
|
|
3539
3583
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3540
|
-
return /* @__PURE__ */ (0,
|
|
3584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3541
3585
|
"div",
|
|
3542
3586
|
{
|
|
3543
3587
|
className: cn(
|
|
@@ -3545,7 +3589,7 @@ var QuestionOtherOption = React47.forwardRef(
|
|
|
3545
3589
|
className
|
|
3546
3590
|
),
|
|
3547
3591
|
children: [
|
|
3548
|
-
/* @__PURE__ */ (0,
|
|
3592
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3549
3593
|
"input",
|
|
3550
3594
|
{
|
|
3551
3595
|
ref: inner,
|
|
@@ -3561,7 +3605,7 @@ var QuestionOtherOption = React47.forwardRef(
|
|
|
3561
3605
|
...props
|
|
3562
3606
|
}
|
|
3563
3607
|
),
|
|
3564
|
-
/* @__PURE__ */ (0,
|
|
3608
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Button, { type: "button", variant: "subtle", size: "icon-sm", "aria-label": confirmLabel, onClick: submit, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react25.Check, { size: 16, "aria-hidden": true }) })
|
|
3565
3609
|
]
|
|
3566
3610
|
}
|
|
3567
3611
|
);
|
|
@@ -3576,16 +3620,16 @@ function limitsText2(min, max) {
|
|
|
3576
3620
|
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3577
3621
|
const reveal = kind !== void 0;
|
|
3578
3622
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3579
|
-
const [draft, setDraft] =
|
|
3580
|
-
const [error, setError] =
|
|
3581
|
-
const helperId =
|
|
3582
|
-
const [focused, setFocused] =
|
|
3623
|
+
const [draft, setDraft] = React48.useState(null);
|
|
3624
|
+
const [error, setError] = React48.useState(null);
|
|
3625
|
+
const helperId = React48.useId();
|
|
3626
|
+
const [focused, setFocused] = React48.useState(false);
|
|
3583
3627
|
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3584
|
-
const fieldRef =
|
|
3585
|
-
const [editMarks, setEditMarks] =
|
|
3586
|
-
const [scroll, setScroll] =
|
|
3628
|
+
const fieldRef = React48.useRef(null);
|
|
3629
|
+
const [editMarks, setEditMarks] = React48.useState([]);
|
|
3630
|
+
const [scroll, setScroll] = React48.useState(0);
|
|
3587
3631
|
const typed = guarded ? draft ?? label : label;
|
|
3588
|
-
const skipBlur =
|
|
3632
|
+
const skipBlur = React48.useRef(false);
|
|
3589
3633
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3590
3634
|
const save = () => {
|
|
3591
3635
|
if (draft === null) return true;
|
|
@@ -3606,9 +3650,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3606
3650
|
...dragHandleProps,
|
|
3607
3651
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3608
3652
|
} : { "aria-hidden": true };
|
|
3609
|
-
const grip = dragHandleProps ? /* @__PURE__ */ (0,
|
|
3610
|
-
return /* @__PURE__ */ (0,
|
|
3611
|
-
/* @__PURE__ */ (0,
|
|
3653
|
+
const grip = dragHandleProps ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react25.DotsSixVertical, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react25.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
|
|
3654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3655
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3612
3656
|
"div",
|
|
3613
3657
|
{
|
|
3614
3658
|
className: cn(
|
|
@@ -3618,10 +3662,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3618
3662
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3619
3663
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3620
3664
|
),
|
|
3621
|
-
children: /* @__PURE__ */ (0,
|
|
3622
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */ (0,
|
|
3665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3666
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
3623
3667
|
!locked && grip,
|
|
3624
|
-
/* @__PURE__ */ (0,
|
|
3668
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3625
3669
|
"span",
|
|
3626
3670
|
{
|
|
3627
3671
|
"aria-hidden": "true",
|
|
@@ -3629,8 +3673,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3629
3673
|
children: rank
|
|
3630
3674
|
}
|
|
3631
3675
|
)
|
|
3632
|
-
] }) : reveal && locked ? /* @__PURE__ */ (0,
|
|
3633
|
-
/* @__PURE__ */ (0,
|
|
3676
|
+
] }) : reveal && locked ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.jsxs)("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3634
3678
|
"span",
|
|
3635
3679
|
{
|
|
3636
3680
|
"aria-hidden": "true",
|
|
@@ -3641,7 +3685,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3641
3685
|
)
|
|
3642
3686
|
}
|
|
3643
3687
|
),
|
|
3644
|
-
/* @__PURE__ */ (0,
|
|
3688
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3645
3689
|
import_react25.DotsSixVertical,
|
|
3646
3690
|
{
|
|
3647
3691
|
size: 20,
|
|
@@ -3653,10 +3697,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3653
3697
|
}
|
|
3654
3698
|
)
|
|
3655
3699
|
] }) : locked ? null : grip }),
|
|
3656
|
-
/* @__PURE__ */ (0,
|
|
3657
|
-
/* @__PURE__ */ (0,
|
|
3658
|
-
focused && editMarks.length > 0 && /* @__PURE__ */ (0,
|
|
3659
|
-
/* @__PURE__ */ (0,
|
|
3700
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3701
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "relative min-w-0", children: [
|
|
3702
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(DraftMarks, { layer: "behind", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3703
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3660
3704
|
"input",
|
|
3661
3705
|
{
|
|
3662
3706
|
ref: fieldRef,
|
|
@@ -3711,24 +3755,24 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3711
3755
|
)
|
|
3712
3756
|
}
|
|
3713
3757
|
),
|
|
3714
|
-
focused && editMarks.length > 0 && /* @__PURE__ */ (0,
|
|
3715
|
-
showMarks && /* @__PURE__ */ (0,
|
|
3716
|
-
(piece, i) => piece.mark ? /* @__PURE__ */ (0,
|
|
3758
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(DraftMarks, { layer: "over", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3759
|
+
showMarks && /* @__PURE__ */ (0, import_jsx_runtime49.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(
|
|
3760
|
+
(piece, i) => piece.mark ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: piece.text }, i)
|
|
3717
3761
|
) })
|
|
3718
3762
|
] }),
|
|
3719
|
-
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ (0,
|
|
3763
|
+
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3720
3764
|
"p",
|
|
3721
3765
|
{
|
|
3722
3766
|
id: helperId,
|
|
3723
3767
|
role: error ? "alert" : void 0,
|
|
3724
3768
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3725
3769
|
children: [
|
|
3726
|
-
/* @__PURE__ */ (0,
|
|
3727
|
-
error && /* @__PURE__ */ (0,
|
|
3770
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { className: "flex items-start gap-2", children: [
|
|
3771
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react25.WarningCircle, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3728
3772
|
limitsText2(minLength, maxLength),
|
|
3729
|
-
error && /* @__PURE__ */ (0,
|
|
3773
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "sr-only", children: error })
|
|
3730
3774
|
] }),
|
|
3731
|
-
/* @__PURE__ */ (0,
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3732
3776
|
draft.length,
|
|
3733
3777
|
maxLength !== void 0 && `/${maxLength}`
|
|
3734
3778
|
] })
|
|
@@ -3739,7 +3783,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3739
3783
|
] })
|
|
3740
3784
|
}
|
|
3741
3785
|
),
|
|
3742
|
-
!locked && /* @__PURE__ */ (0,
|
|
3786
|
+
!locked && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3743
3787
|
"div",
|
|
3744
3788
|
{
|
|
3745
3789
|
className: cn(
|
|
@@ -3747,8 +3791,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3747
3791
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3748
3792
|
),
|
|
3749
3793
|
children: [
|
|
3750
|
-
/* @__PURE__ */ (0,
|
|
3751
|
-
/* @__PURE__ */ (0,
|
|
3794
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", disabled: removeDisabled, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react25.Trash, { size: 16, "aria-hidden": true }) }),
|
|
3795
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", disabled: addDisabled, onClick: onAdd, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react25.Plus, { size: 16, "aria-hidden": true }) })
|
|
3752
3796
|
]
|
|
3753
3797
|
}
|
|
3754
3798
|
)
|
|
@@ -3756,9 +3800,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3756
3800
|
}
|
|
3757
3801
|
|
|
3758
3802
|
// src/components/Question Types/RankList.tsx
|
|
3759
|
-
var
|
|
3803
|
+
var React49 = __toESM(require("react"), 1);
|
|
3760
3804
|
var import_react26 = require("@phosphor-icons/react");
|
|
3761
|
-
var
|
|
3805
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3762
3806
|
function move(list, from, to) {
|
|
3763
3807
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3764
3808
|
const next = list.slice();
|
|
@@ -3766,13 +3810,13 @@ function move(list, from, to) {
|
|
|
3766
3810
|
next.splice(to, 0, item);
|
|
3767
3811
|
return next;
|
|
3768
3812
|
}
|
|
3769
|
-
var RankList =
|
|
3813
|
+
var RankList = React49.forwardRef(
|
|
3770
3814
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3771
|
-
const [dragIndex, setDragIndex] =
|
|
3772
|
-
const [announcement, setAnnouncement] =
|
|
3773
|
-
const handles =
|
|
3774
|
-
const refocus =
|
|
3775
|
-
|
|
3815
|
+
const [dragIndex, setDragIndex] = React49.useState(null);
|
|
3816
|
+
const [announcement, setAnnouncement] = React49.useState("");
|
|
3817
|
+
const handles = React49.useRef(/* @__PURE__ */ new Map());
|
|
3818
|
+
const refocus = React49.useRef(null);
|
|
3819
|
+
React49.useEffect(() => {
|
|
3776
3820
|
if (refocus.current) {
|
|
3777
3821
|
handles.current.get(refocus.current)?.focus();
|
|
3778
3822
|
refocus.current = null;
|
|
@@ -3785,8 +3829,8 @@ var RankList = React48.forwardRef(
|
|
|
3785
3829
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3786
3830
|
onItemsChange(next);
|
|
3787
3831
|
};
|
|
3788
|
-
return /* @__PURE__ */ (0,
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
3833
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.jsxs)(
|
|
3790
3834
|
"li",
|
|
3791
3835
|
{
|
|
3792
3836
|
draggable: true,
|
|
@@ -3803,7 +3847,7 @@ var RankList = React48.forwardRef(
|
|
|
3803
3847
|
dragIndex === index && "opacity-50"
|
|
3804
3848
|
),
|
|
3805
3849
|
children: [
|
|
3806
|
-
/* @__PURE__ */ (0,
|
|
3850
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3807
3851
|
"button",
|
|
3808
3852
|
{
|
|
3809
3853
|
type: "button",
|
|
@@ -3822,10 +3866,10 @@ var RankList = React48.forwardRef(
|
|
|
3822
3866
|
}
|
|
3823
3867
|
},
|
|
3824
3868
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3825
|
-
children: /* @__PURE__ */ (0,
|
|
3869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react26.DotsSixVertical, { size: 16, "aria-hidden": true })
|
|
3826
3870
|
}
|
|
3827
3871
|
),
|
|
3828
|
-
/* @__PURE__ */ (0,
|
|
3872
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3829
3873
|
"span",
|
|
3830
3874
|
{
|
|
3831
3875
|
"aria-hidden": "true",
|
|
@@ -3833,27 +3877,27 @@ var RankList = React48.forwardRef(
|
|
|
3833
3877
|
children: index + 1
|
|
3834
3878
|
}
|
|
3835
3879
|
),
|
|
3836
|
-
/* @__PURE__ */ (0,
|
|
3880
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3837
3881
|
]
|
|
3838
3882
|
},
|
|
3839
3883
|
item.id
|
|
3840
3884
|
)) }),
|
|
3841
|
-
/* @__PURE__ */ (0,
|
|
3885
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3842
3886
|
] });
|
|
3843
3887
|
}
|
|
3844
3888
|
);
|
|
3845
3889
|
RankList.displayName = "RankList";
|
|
3846
3890
|
|
|
3847
3891
|
// src/components/Question Types/RatingScale.tsx
|
|
3848
|
-
var
|
|
3892
|
+
var React50 = __toESM(require("react"), 1);
|
|
3849
3893
|
var import_radix_ui23 = require("radix-ui");
|
|
3850
|
-
var
|
|
3851
|
-
var RatingScale =
|
|
3894
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3895
|
+
var RatingScale = React50.forwardRef(
|
|
3852
3896
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3853
|
-
const [internal, setInternal] =
|
|
3897
|
+
const [internal, setInternal] = React50.useState(defaultValue);
|
|
3854
3898
|
const current = value !== void 0 ? value : internal;
|
|
3855
|
-
return /* @__PURE__ */ (0,
|
|
3856
|
-
/* @__PURE__ */ (0,
|
|
3899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3900
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3857
3901
|
import_radix_ui23.ToggleGroup.Root,
|
|
3858
3902
|
{
|
|
3859
3903
|
ref,
|
|
@@ -3866,7 +3910,7 @@ var RatingScale = React49.forwardRef(
|
|
|
3866
3910
|
},
|
|
3867
3911
|
className: "flex gap-2",
|
|
3868
3912
|
...props,
|
|
3869
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ (0,
|
|
3913
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3870
3914
|
import_radix_ui23.ToggleGroup.Item,
|
|
3871
3915
|
{
|
|
3872
3916
|
value: String(n),
|
|
@@ -3882,9 +3926,9 @@ var RatingScale = React49.forwardRef(
|
|
|
3882
3926
|
))
|
|
3883
3927
|
}
|
|
3884
3928
|
),
|
|
3885
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */ (0,
|
|
3886
|
-
/* @__PURE__ */ (0,
|
|
3887
|
-
/* @__PURE__ */ (0,
|
|
3929
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3930
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: lowLabel }),
|
|
3931
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: highLabel })
|
|
3888
3932
|
] })
|
|
3889
3933
|
] });
|
|
3890
3934
|
}
|
|
@@ -3892,15 +3936,15 @@ var RatingScale = React49.forwardRef(
|
|
|
3892
3936
|
RatingScale.displayName = "RatingScale";
|
|
3893
3937
|
|
|
3894
3938
|
// src/components/Question Types/StimulusCard.tsx
|
|
3895
|
-
var
|
|
3939
|
+
var React51 = __toESM(require("react"), 1);
|
|
3896
3940
|
var import_react27 = require("@phosphor-icons/react");
|
|
3897
|
-
var
|
|
3941
|
+
var import_jsx_runtime52 = (
|
|
3898
3942
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3899
3943
|
require("react/jsx-runtime")
|
|
3900
3944
|
);
|
|
3901
3945
|
var MIN_THUMBNAIL = 92;
|
|
3902
3946
|
var MAX_THUMBNAIL = 240;
|
|
3903
|
-
var StimulusCard =
|
|
3947
|
+
var StimulusCard = React51.forwardRef(
|
|
3904
3948
|
({
|
|
3905
3949
|
className,
|
|
3906
3950
|
thumbnail,
|
|
@@ -3917,14 +3961,14 @@ var StimulusCard = React50.forwardRef(
|
|
|
3917
3961
|
removeLabel = "Remove stimulus",
|
|
3918
3962
|
...props
|
|
3919
3963
|
}, ref) => {
|
|
3920
|
-
const [failedSrc, setFailedSrc] =
|
|
3964
|
+
const [failedSrc, setFailedSrc] = React51.useState();
|
|
3921
3965
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3922
3966
|
const showImage = thumbnail !== void 0 && !error;
|
|
3923
|
-
const [draft, setDraft] =
|
|
3967
|
+
const [draft, setDraft] = React51.useState(null);
|
|
3924
3968
|
const count = (draft ?? caption ?? "").length;
|
|
3925
|
-
const textRef =
|
|
3926
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3927
|
-
|
|
3969
|
+
const textRef = React51.useRef(null);
|
|
3970
|
+
const [thumbnailSize, setThumbnailSize] = React51.useState(MIN_THUMBNAIL);
|
|
3971
|
+
React51.useEffect(() => {
|
|
3928
3972
|
const el = textRef.current;
|
|
3929
3973
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3930
3974
|
const observer = new ResizeObserver(() => {
|
|
@@ -3933,7 +3977,7 @@ var StimulusCard = React50.forwardRef(
|
|
|
3933
3977
|
observer.observe(el);
|
|
3934
3978
|
return () => observer.disconnect();
|
|
3935
3979
|
}, []);
|
|
3936
|
-
return /* @__PURE__ */ (0,
|
|
3980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
3937
3981
|
"div",
|
|
3938
3982
|
{
|
|
3939
3983
|
ref,
|
|
@@ -3941,8 +3985,8 @@ var StimulusCard = React50.forwardRef(
|
|
|
3941
3985
|
className: cn("flex min-h-24.5 w-full items-center gap-4 rounded-md border border-border p-0.5 pr-4", className),
|
|
3942
3986
|
...props,
|
|
3943
3987
|
children: [
|
|
3944
|
-
/* @__PURE__ */ (0,
|
|
3945
|
-
/* @__PURE__ */ (0,
|
|
3988
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3946
3990
|
"span",
|
|
3947
3991
|
{
|
|
3948
3992
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3951,12 +3995,12 @@ var StimulusCard = React50.forwardRef(
|
|
|
3951
3995
|
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",
|
|
3952
3996
|
showImage && "bg-none"
|
|
3953
3997
|
),
|
|
3954
|
-
children: showImage ? /* @__PURE__ */ (0,
|
|
3998
|
+
children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react27.ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react27.Image, { size: 24, "aria-hidden": true })
|
|
3955
3999
|
}
|
|
3956
4000
|
),
|
|
3957
|
-
/* @__PURE__ */ (0,
|
|
3958
|
-
/* @__PURE__ */ (0,
|
|
3959
|
-
onCaptionChange ? /* @__PURE__ */ (0,
|
|
4001
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
4002
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "w-full text-ui-label", children: label }),
|
|
4003
|
+
onCaptionChange ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3960
4004
|
InlineEdit,
|
|
3961
4005
|
{
|
|
3962
4006
|
variant: "question",
|
|
@@ -3973,8 +4017,8 @@ var StimulusCard = React50.forwardRef(
|
|
|
3973
4017
|
},
|
|
3974
4018
|
textClassName: "text-body-base"
|
|
3975
4019
|
}
|
|
3976
|
-
) : /* @__PURE__ */ (0,
|
|
3977
|
-
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0,
|
|
4020
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
4021
|
+
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3978
4022
|
count,
|
|
3979
4023
|
"/",
|
|
3980
4024
|
maxLength,
|
|
@@ -3982,7 +4026,7 @@ var StimulusCard = React50.forwardRef(
|
|
|
3982
4026
|
] })
|
|
3983
4027
|
] })
|
|
3984
4028
|
] }),
|
|
3985
|
-
onRemove && /* @__PURE__ */ (0,
|
|
4029
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react27.Trash, { size: 16, "aria-hidden": true }) })
|
|
3986
4030
|
]
|
|
3987
4031
|
}
|
|
3988
4032
|
);
|
|
@@ -3991,27 +4035,27 @@ var StimulusCard = React50.forwardRef(
|
|
|
3991
4035
|
StimulusCard.displayName = "StimulusCard";
|
|
3992
4036
|
|
|
3993
4037
|
// src/components/Data Display/Progress.tsx
|
|
3994
|
-
var
|
|
4038
|
+
var React52 = __toESM(require("react"), 1);
|
|
3995
4039
|
var import_radix_ui24 = require("radix-ui");
|
|
3996
|
-
var
|
|
3997
|
-
var Progress =
|
|
4040
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4041
|
+
var Progress = React52.forwardRef(
|
|
3998
4042
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3999
4043
|
const hasHeader = label != null || valueLabel != null;
|
|
4000
4044
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
4001
4045
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
4002
|
-
return /* @__PURE__ */ (0,
|
|
4003
|
-
hasHeader && /* @__PURE__ */ (0,
|
|
4004
|
-
/* @__PURE__ */ (0,
|
|
4005
|
-
/* @__PURE__ */ (0,
|
|
4046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
4047
|
+
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
4048
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: label }),
|
|
4049
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
4006
4050
|
] }),
|
|
4007
|
-
/* @__PURE__ */ (0,
|
|
4051
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4008
4052
|
import_radix_ui24.Progress.Root,
|
|
4009
4053
|
{
|
|
4010
4054
|
ref,
|
|
4011
4055
|
value: clamped,
|
|
4012
4056
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
4013
4057
|
...props,
|
|
4014
|
-
children: /* @__PURE__ */ (0,
|
|
4058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4015
4059
|
import_radix_ui24.Progress.Indicator,
|
|
4016
4060
|
{
|
|
4017
4061
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -4020,9 +4064,9 @@ var Progress = React51.forwardRef(
|
|
|
4020
4064
|
)
|
|
4021
4065
|
}
|
|
4022
4066
|
),
|
|
4023
|
-
hasDetails && /* @__PURE__ */ (0,
|
|
4024
|
-
/* @__PURE__ */ (0,
|
|
4025
|
-
/* @__PURE__ */ (0,
|
|
4067
|
+
hasDetails && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
4068
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: detailsStart }),
|
|
4069
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: detailsEnd })
|
|
4026
4070
|
] })
|
|
4027
4071
|
] });
|
|
4028
4072
|
}
|
|
@@ -4030,11 +4074,11 @@ var Progress = React51.forwardRef(
|
|
|
4030
4074
|
Progress.displayName = "Progress";
|
|
4031
4075
|
|
|
4032
4076
|
// src/components/Data Display/Table.tsx
|
|
4033
|
-
var
|
|
4077
|
+
var React53 = __toESM(require("react"), 1);
|
|
4034
4078
|
var import_react28 = require("@phosphor-icons/react");
|
|
4035
|
-
var
|
|
4036
|
-
var Table =
|
|
4037
|
-
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4079
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4080
|
+
var Table = React53.forwardRef(
|
|
4081
|
+
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { ref: containerRef, className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4038
4082
|
"table",
|
|
4039
4083
|
{
|
|
4040
4084
|
ref,
|
|
@@ -4045,20 +4089,20 @@ var Table = React52.forwardRef(
|
|
|
4045
4089
|
) })
|
|
4046
4090
|
);
|
|
4047
4091
|
Table.displayName = "Table";
|
|
4048
|
-
var TableHeader =
|
|
4049
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4092
|
+
var TableHeader = React53.forwardRef(
|
|
4093
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("thead", { ref, className, ...props })
|
|
4050
4094
|
);
|
|
4051
4095
|
TableHeader.displayName = "TableHeader";
|
|
4052
|
-
var TableFooter =
|
|
4053
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4096
|
+
var TableFooter = React53.forwardRef(
|
|
4097
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tfoot", { ref, className: cn("border-t border-border bg-background text-ui-label", className), ...props })
|
|
4054
4098
|
);
|
|
4055
4099
|
TableFooter.displayName = "TableFooter";
|
|
4056
|
-
var TableBody =
|
|
4057
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4100
|
+
var TableBody = React53.forwardRef(
|
|
4101
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tbody", { ref, className, ...props })
|
|
4058
4102
|
);
|
|
4059
4103
|
TableBody.displayName = "TableBody";
|
|
4060
|
-
var TableRow =
|
|
4061
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4104
|
+
var TableRow = React53.forwardRef(
|
|
4105
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4062
4106
|
"tr",
|
|
4063
4107
|
{
|
|
4064
4108
|
ref,
|
|
@@ -4075,10 +4119,10 @@ var TableRow = React52.forwardRef(
|
|
|
4075
4119
|
);
|
|
4076
4120
|
TableRow.displayName = "TableRow";
|
|
4077
4121
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
4078
|
-
var TableHead =
|
|
4122
|
+
var TableHead = React53.forwardRef(
|
|
4079
4123
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, resizer, children, ...props }, ref) => {
|
|
4080
|
-
const caret = sort === "asc" ? /* @__PURE__ */ (0,
|
|
4081
|
-
return /* @__PURE__ */ (0,
|
|
4124
|
+
const caret = sort === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react28.CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react28.CaretDown, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
4125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4082
4126
|
"th",
|
|
4083
4127
|
{
|
|
4084
4128
|
ref,
|
|
@@ -4093,7 +4137,7 @@ var TableHead = React52.forwardRef(
|
|
|
4093
4137
|
),
|
|
4094
4138
|
...props,
|
|
4095
4139
|
children: [
|
|
4096
|
-
sortable ? /* @__PURE__ */ (0,
|
|
4140
|
+
sortable ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4097
4141
|
"button",
|
|
4098
4142
|
{
|
|
4099
4143
|
type: "button",
|
|
@@ -4104,7 +4148,7 @@ var TableHead = React52.forwardRef(
|
|
|
4104
4148
|
caret
|
|
4105
4149
|
]
|
|
4106
4150
|
}
|
|
4107
|
-
) : checkbox ? /* @__PURE__ */ (0,
|
|
4151
|
+
) : checkbox ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex items-center justify-center", children }) : children,
|
|
4108
4152
|
resizer
|
|
4109
4153
|
]
|
|
4110
4154
|
}
|
|
@@ -4112,8 +4156,8 @@ var TableHead = React52.forwardRef(
|
|
|
4112
4156
|
}
|
|
4113
4157
|
);
|
|
4114
4158
|
TableHead.displayName = "TableHead";
|
|
4115
|
-
var TableCell =
|
|
4116
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4159
|
+
var TableCell = React53.forwardRef(
|
|
4160
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4117
4161
|
"td",
|
|
4118
4162
|
{
|
|
4119
4163
|
ref,
|
|
@@ -4126,31 +4170,31 @@ var TableCell = React52.forwardRef(
|
|
|
4126
4170
|
className
|
|
4127
4171
|
),
|
|
4128
4172
|
...props,
|
|
4129
|
-
children: checkbox ? /* @__PURE__ */ (0,
|
|
4173
|
+
children: checkbox ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
4130
4174
|
}
|
|
4131
4175
|
)
|
|
4132
4176
|
);
|
|
4133
4177
|
TableCell.displayName = "TableCell";
|
|
4134
4178
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
4135
|
-
return /* @__PURE__ */ (0,
|
|
4179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
4136
4180
|
avatar,
|
|
4137
|
-
/* @__PURE__ */ (0,
|
|
4138
|
-
/* @__PURE__ */ (0,
|
|
4139
|
-
secondary && /* @__PURE__ */ (0,
|
|
4181
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
4182
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
4183
|
+
secondary && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
4140
4184
|
] })
|
|
4141
4185
|
] });
|
|
4142
4186
|
}
|
|
4143
4187
|
|
|
4144
4188
|
// src/components/Data Display/DataTable.tsx
|
|
4145
|
-
var
|
|
4189
|
+
var React55 = __toESM(require("react"), 1);
|
|
4146
4190
|
var import_react30 = require("@phosphor-icons/react");
|
|
4147
4191
|
var import_react_table = require("@tanstack/react-table");
|
|
4148
4192
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
4149
4193
|
|
|
4150
4194
|
// src/components/Utility/Pagination.tsx
|
|
4151
|
-
var
|
|
4195
|
+
var React54 = __toESM(require("react"), 1);
|
|
4152
4196
|
var import_react29 = require("@phosphor-icons/react");
|
|
4153
|
-
var
|
|
4197
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4154
4198
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
4155
4199
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
4156
4200
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -4164,10 +4208,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
4164
4208
|
});
|
|
4165
4209
|
return items;
|
|
4166
4210
|
}
|
|
4167
|
-
var Pagination =
|
|
4211
|
+
var Pagination = React54.forwardRef(
|
|
4168
4212
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
4169
4213
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
4170
|
-
const previous = /* @__PURE__ */ (0,
|
|
4214
|
+
const previous = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4171
4215
|
Button,
|
|
4172
4216
|
{
|
|
4173
4217
|
type: "button",
|
|
@@ -4176,10 +4220,10 @@ var Pagination = React53.forwardRef(
|
|
|
4176
4220
|
"aria-label": "Previous page",
|
|
4177
4221
|
disabled: page <= 1,
|
|
4178
4222
|
onClick: () => go(page - 1),
|
|
4179
|
-
children: /* @__PURE__ */ (0,
|
|
4223
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react29.ArrowLeft, { size: 16, "aria-hidden": true })
|
|
4180
4224
|
}
|
|
4181
4225
|
);
|
|
4182
|
-
const next = /* @__PURE__ */ (0,
|
|
4226
|
+
const next = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4183
4227
|
Button,
|
|
4184
4228
|
{
|
|
4185
4229
|
type: "button",
|
|
@@ -4188,10 +4232,10 @@ var Pagination = React53.forwardRef(
|
|
|
4188
4232
|
"aria-label": "Next page",
|
|
4189
4233
|
disabled: page >= pageCount,
|
|
4190
4234
|
onClick: () => go(page + 1),
|
|
4191
|
-
children: /* @__PURE__ */ (0,
|
|
4235
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react29.ArrowRight, { size: 16, "aria-hidden": true })
|
|
4192
4236
|
}
|
|
4193
4237
|
);
|
|
4194
|
-
return /* @__PURE__ */ (0,
|
|
4238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4195
4239
|
"nav",
|
|
4196
4240
|
{
|
|
4197
4241
|
ref,
|
|
@@ -4200,14 +4244,14 @@ var Pagination = React53.forwardRef(
|
|
|
4200
4244
|
...props,
|
|
4201
4245
|
children: [
|
|
4202
4246
|
previous,
|
|
4203
|
-
variant === "compact" ? /* @__PURE__ */ (0,
|
|
4247
|
+
variant === "compact" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
4204
4248
|
page,
|
|
4205
4249
|
"/",
|
|
4206
4250
|
pageCount
|
|
4207
|
-
] }) : /* @__PURE__ */ (0,
|
|
4208
|
-
/* @__PURE__ */ (0,
|
|
4209
|
-
/* @__PURE__ */ (0,
|
|
4210
|
-
] }) : /* @__PURE__ */ (0,
|
|
4251
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("li", { children: item === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
4252
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react29.DotsThree, { size: 16, "aria-hidden": true }),
|
|
4253
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sr-only", children: "More pages" })
|
|
4254
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4211
4255
|
Button,
|
|
4212
4256
|
{
|
|
4213
4257
|
type: "button",
|
|
@@ -4228,7 +4272,7 @@ var Pagination = React53.forwardRef(
|
|
|
4228
4272
|
Pagination.displayName = "Pagination";
|
|
4229
4273
|
|
|
4230
4274
|
// src/components/Data Display/DataTable.tsx
|
|
4231
|
-
var
|
|
4275
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4232
4276
|
var features = (0, import_react_table.tableFeatures)({
|
|
4233
4277
|
rowSortingFeature: import_react_table.rowSortingFeature,
|
|
4234
4278
|
rowPaginationFeature: import_react_table.rowPaginationFeature,
|
|
@@ -4283,9 +4327,9 @@ var features = (0, import_react_table.tableFeatures)({
|
|
|
4283
4327
|
});
|
|
4284
4328
|
var getMeta = (meta) => meta ?? {};
|
|
4285
4329
|
function useControllable(value, initial, onChange) {
|
|
4286
|
-
const [internal, setInternal] =
|
|
4330
|
+
const [internal, setInternal] = React55.useState(initial);
|
|
4287
4331
|
const current = value ?? internal;
|
|
4288
|
-
const update =
|
|
4332
|
+
const update = React55.useCallback(
|
|
4289
4333
|
(updater) => {
|
|
4290
4334
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
4291
4335
|
if (value === void 0) setInternal(next);
|
|
@@ -4324,16 +4368,16 @@ function ColumnFilter({ column }) {
|
|
|
4324
4368
|
const value = column.getFilterValue();
|
|
4325
4369
|
if (variant === "select") {
|
|
4326
4370
|
const options = [...column.getFacetedUniqueValues().entries()].sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
4327
|
-
return /* @__PURE__ */ (0,
|
|
4371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4328
4372
|
Select,
|
|
4329
4373
|
{
|
|
4330
4374
|
value: typeof value === "string" ? value : ALL,
|
|
4331
4375
|
onValueChange: (next) => column.setFilterValue(next === ALL ? void 0 : next),
|
|
4332
4376
|
children: [
|
|
4333
|
-
/* @__PURE__ */ (0,
|
|
4334
|
-
/* @__PURE__ */ (0,
|
|
4335
|
-
/* @__PURE__ */ (0,
|
|
4336
|
-
options.map(([option, count]) => /* @__PURE__ */ (0,
|
|
4377
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectTrigger, { "aria-label": `Filter ${label}`, className: "h-8 text-body-small", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectValue, {}) }),
|
|
4378
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(SelectContent, { children: [
|
|
4379
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SelectItem, { value: ALL, children: "All" }),
|
|
4380
|
+
options.map(([option, count]) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(SelectItem, { value: String(option), children: [
|
|
4337
4381
|
String(option),
|
|
4338
4382
|
" (",
|
|
4339
4383
|
count,
|
|
@@ -4352,8 +4396,8 @@ function ColumnFilter({ column }) {
|
|
|
4352
4396
|
next[index] = raw === "" ? void 0 : Number(raw);
|
|
4353
4397
|
column.setFilterValue(next[0] === void 0 && next[1] === void 0 ? void 0 : next);
|
|
4354
4398
|
};
|
|
4355
|
-
return /* @__PURE__ */ (0,
|
|
4356
|
-
/* @__PURE__ */ (0,
|
|
4399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex gap-1", children: [
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4357
4401
|
Input,
|
|
4358
4402
|
{
|
|
4359
4403
|
type: "number",
|
|
@@ -4364,7 +4408,7 @@ function ColumnFilter({ column }) {
|
|
|
4364
4408
|
className: "h-8 text-body-small"
|
|
4365
4409
|
}
|
|
4366
4410
|
),
|
|
4367
|
-
/* @__PURE__ */ (0,
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4368
4412
|
Input,
|
|
4369
4413
|
{
|
|
4370
4414
|
type: "number",
|
|
@@ -4377,7 +4421,7 @@ function ColumnFilter({ column }) {
|
|
|
4377
4421
|
)
|
|
4378
4422
|
] });
|
|
4379
4423
|
}
|
|
4380
|
-
return /* @__PURE__ */ (0,
|
|
4424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4381
4425
|
Input,
|
|
4382
4426
|
{
|
|
4383
4427
|
"aria-label": `Filter ${label}`,
|
|
@@ -4390,9 +4434,9 @@ function ColumnFilter({ column }) {
|
|
|
4390
4434
|
}
|
|
4391
4435
|
function EditableCell({ value, label, type, onCommit }) {
|
|
4392
4436
|
const initial = value == null ? "" : String(value);
|
|
4393
|
-
const [draft, setDraft] =
|
|
4394
|
-
const cancelled =
|
|
4395
|
-
return /* @__PURE__ */ (0,
|
|
4437
|
+
const [draft, setDraft] = React55.useState(null);
|
|
4438
|
+
const cancelled = React55.useRef(false);
|
|
4439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4396
4440
|
Input,
|
|
4397
4441
|
{
|
|
4398
4442
|
type,
|
|
@@ -4530,7 +4574,7 @@ function DataTableInner({
|
|
|
4530
4574
|
onPaginationChange
|
|
4531
4575
|
);
|
|
4532
4576
|
const [density, setDensity] = useControllable(densityProp, "default", onDensityChange);
|
|
4533
|
-
const [cellSelection, setCellSelection] =
|
|
4577
|
+
const [cellSelection, setCellSelection] = React55.useState([]);
|
|
4534
4578
|
const infinite = Boolean(onLoadMore);
|
|
4535
4579
|
const paginate = !virtualized && !infinite;
|
|
4536
4580
|
const compact = density === "compact";
|
|
@@ -4603,12 +4647,12 @@ function DataTableInner({
|
|
|
4603
4647
|
const cellDensity = compact ? "h-8 py-1.5" : void 0;
|
|
4604
4648
|
const allSelected = table.getIsAllPageRowsSelected();
|
|
4605
4649
|
const someSelected = table.getIsSomePageRowsSelected();
|
|
4606
|
-
const dragged =
|
|
4650
|
+
const dragged = React55.useRef(null);
|
|
4607
4651
|
const topRows = enableRowPinning ? table.getTopRows() : [];
|
|
4608
4652
|
const bottomRows = enableRowPinning ? table.getBottomRows() : [];
|
|
4609
4653
|
const bodyRows = enableRowPinning ? table.getCenterRows() : table.getRowModel().rows;
|
|
4610
|
-
const scrollRef =
|
|
4611
|
-
const setScrollRef =
|
|
4654
|
+
const scrollRef = React55.useRef(null);
|
|
4655
|
+
const setScrollRef = React55.useCallback(
|
|
4612
4656
|
(node) => {
|
|
4613
4657
|
scrollRef.current = node;
|
|
4614
4658
|
if (typeof containerRef === "function") containerRef(node);
|
|
@@ -4627,8 +4671,8 @@ function DataTableInner({
|
|
|
4627
4671
|
const virtualItems = virtualized ? virtualizer.getVirtualItems() : [];
|
|
4628
4672
|
const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
|
|
4629
4673
|
const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems.at(-1)?.end ?? 0) : 0;
|
|
4630
|
-
const sentinelRef =
|
|
4631
|
-
|
|
4674
|
+
const sentinelRef = React55.useRef(null);
|
|
4675
|
+
React55.useEffect(() => {
|
|
4632
4676
|
const node = sentinelRef.current;
|
|
4633
4677
|
if (!node || !onLoadMore || !hasMore || loadingMore || typeof IntersectionObserver === "undefined") return;
|
|
4634
4678
|
const container = scrollRef.current;
|
|
@@ -4669,15 +4713,15 @@ function DataTableInner({
|
|
|
4669
4713
|
table.resetCellSelection(true);
|
|
4670
4714
|
}
|
|
4671
4715
|
};
|
|
4672
|
-
const skeletonRow = (rowKey) => /* @__PURE__ */ (0,
|
|
4716
|
+
const skeletonRow = (rowKey) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableRow, { className: "hover:bg-transparent", children: Array.from({ length: columnSpan }, (_, cell) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableCell, { checkbox: enableRowSelection && cell === 0, className: cellDensity, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { "aria-hidden": true, className: "block h-4 w-3/4 animate-pulse rounded-xs bg-border" }) }, cell)) }, rowKey);
|
|
4673
4717
|
const renderRow = (row, options = {}) => {
|
|
4674
4718
|
const { pinned, pinnedIndex = 0, pinnedCount = 1, virtualIndex } = options;
|
|
4675
4719
|
const grouped = row.getIsGrouped();
|
|
4676
4720
|
const rowUnits = compact ? 8 : 10;
|
|
4677
4721
|
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;
|
|
4678
4722
|
const cells = row.getVisibleCells();
|
|
4679
|
-
return /* @__PURE__ */ (0,
|
|
4680
|
-
/* @__PURE__ */ (0,
|
|
4723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(React55.Fragment, { children: [
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4681
4725
|
TableRow,
|
|
4682
4726
|
{
|
|
4683
4727
|
ref: virtualized && virtualIndex !== void 0 ? virtualizer.measureElement : void 0,
|
|
@@ -4687,7 +4731,7 @@ function DataTableInner({
|
|
|
4687
4731
|
onClick: onRowClick && !grouped ? () => onRowClick(row.original) : void 0,
|
|
4688
4732
|
className: cn(pinned && "z-20 bg-surface", grouped && "bg-background", onRowClick && !grouped && "cursor-pointer"),
|
|
4689
4733
|
children: [
|
|
4690
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
4734
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4691
4735
|
Checkbox,
|
|
4692
4736
|
{
|
|
4693
4737
|
"aria-label": "Select row",
|
|
@@ -4696,7 +4740,7 @@ function DataTableInner({
|
|
|
4696
4740
|
onCheckedChange: (checked) => row.toggleSelected(Boolean(checked))
|
|
4697
4741
|
}
|
|
4698
4742
|
) }),
|
|
4699
|
-
hasExpander && /* @__PURE__ */ (0,
|
|
4743
|
+
hasExpander && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && row.getCanExpand() && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4700
4744
|
Button,
|
|
4701
4745
|
{
|
|
4702
4746
|
type: "button",
|
|
@@ -4705,10 +4749,10 @@ function DataTableInner({
|
|
|
4705
4749
|
"aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
|
|
4706
4750
|
"aria-expanded": row.getIsExpanded(),
|
|
4707
4751
|
onClick: () => row.toggleExpanded(),
|
|
4708
|
-
children: row.getIsExpanded() ? /* @__PURE__ */ (0,
|
|
4752
|
+
children: row.getIsExpanded() ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.CaretDown, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.CaretRight, { size: 16, "aria-hidden": true })
|
|
4709
4753
|
}
|
|
4710
4754
|
) }),
|
|
4711
|
-
enableRowPinning && /* @__PURE__ */ (0,
|
|
4755
|
+
enableRowPinning && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4712
4756
|
Button,
|
|
4713
4757
|
{
|
|
4714
4758
|
type: "button",
|
|
@@ -4717,7 +4761,7 @@ function DataTableInner({
|
|
|
4717
4761
|
"aria-label": row.getIsPinned() ? "Unpin row" : "Pin row to top",
|
|
4718
4762
|
"aria-pressed": Boolean(row.getIsPinned()),
|
|
4719
4763
|
onClick: () => row.pin(row.getIsPinned() ? false : "top"),
|
|
4720
|
-
children: row.getIsPinned() ? /* @__PURE__ */ (0,
|
|
4764
|
+
children: row.getIsPinned() ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.PushPinSlash, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.PushPin, { size: 16, "aria-hidden": true })
|
|
4721
4765
|
}
|
|
4722
4766
|
) }),
|
|
4723
4767
|
cells.map((cell, index) => {
|
|
@@ -4730,7 +4774,7 @@ function DataTableInner({
|
|
|
4730
4774
|
const indent = index === 0 && hasExpander && row.depth > 0 ? row.depth * 4 : 0;
|
|
4731
4775
|
let content;
|
|
4732
4776
|
if (cell.getIsGrouped()) {
|
|
4733
|
-
content = /* @__PURE__ */ (0,
|
|
4777
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4734
4778
|
"button",
|
|
4735
4779
|
{
|
|
4736
4780
|
type: "button",
|
|
@@ -4738,9 +4782,9 @@ function DataTableInner({
|
|
|
4738
4782
|
"aria-expanded": row.getIsExpanded(),
|
|
4739
4783
|
onClick: row.getToggleExpandedHandler(),
|
|
4740
4784
|
children: [
|
|
4741
|
-
row.getIsExpanded() ? /* @__PURE__ */ (0,
|
|
4785
|
+
row.getIsExpanded() ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.CaretDown, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.CaretRight, { size: 16, "aria-hidden": true }),
|
|
4742
4786
|
(0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()),
|
|
4743
|
-
/* @__PURE__ */ (0,
|
|
4787
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "text-secondary-muted-foreground", children: [
|
|
4744
4788
|
"(",
|
|
4745
4789
|
row.subRows.length,
|
|
4746
4790
|
")"
|
|
@@ -4753,7 +4797,7 @@ function DataTableInner({
|
|
|
4753
4797
|
} else if (cell.getIsPlaceholder()) {
|
|
4754
4798
|
content = null;
|
|
4755
4799
|
} else if (meta.editable) {
|
|
4756
|
-
content = /* @__PURE__ */ (0,
|
|
4800
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4757
4801
|
EditableCell,
|
|
4758
4802
|
{
|
|
4759
4803
|
value: cell.getValue(),
|
|
@@ -4765,7 +4809,7 @@ function DataTableInner({
|
|
|
4765
4809
|
} else {
|
|
4766
4810
|
content = (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
4767
4811
|
}
|
|
4768
|
-
return /* @__PURE__ */ (0,
|
|
4812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4769
4813
|
TableCell,
|
|
4770
4814
|
{
|
|
4771
4815
|
align: meta.align,
|
|
@@ -4798,7 +4842,7 @@ function DataTableInner({
|
|
|
4798
4842
|
]
|
|
4799
4843
|
}
|
|
4800
4844
|
),
|
|
4801
|
-
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ (0,
|
|
4845
|
+
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableRow, { className: "bg-background hover:bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableCell, { colSpan: columnSpan, children: renderSubComponent(row.original) }) })
|
|
4802
4846
|
] }, row.id);
|
|
4803
4847
|
};
|
|
4804
4848
|
const renderHeaderCell = (header) => {
|
|
@@ -4809,7 +4853,7 @@ function DataTableInner({
|
|
|
4809
4853
|
const pin = pinning(column, sized, true);
|
|
4810
4854
|
const reorderable = enableColumnOrdering && leaf && !column.getIsPinned();
|
|
4811
4855
|
const label = labelOf(column);
|
|
4812
|
-
return /* @__PURE__ */ (0,
|
|
4856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4813
4857
|
TableHead,
|
|
4814
4858
|
{
|
|
4815
4859
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
@@ -4845,7 +4889,7 @@ function DataTableInner({
|
|
|
4845
4889
|
reorderable && "cursor-grab",
|
|
4846
4890
|
!leaf && "text-center"
|
|
4847
4891
|
),
|
|
4848
|
-
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ (0,
|
|
4892
|
+
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4849
4893
|
"div",
|
|
4850
4894
|
{
|
|
4851
4895
|
role: "separator",
|
|
@@ -4860,14 +4904,14 @@ function DataTableInner({
|
|
|
4860
4904
|
)
|
|
4861
4905
|
}
|
|
4862
4906
|
) : void 0,
|
|
4863
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */ (0,
|
|
4907
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(table.FlexRender, { header })
|
|
4864
4908
|
},
|
|
4865
4909
|
header.id
|
|
4866
4910
|
);
|
|
4867
4911
|
};
|
|
4868
4912
|
const stickyLeading = cn(cellDensity, sticky && "sticky top-0 z-20 bg-surface");
|
|
4869
|
-
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ (0,
|
|
4870
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
4913
|
+
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
4914
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4871
4915
|
Checkbox,
|
|
4872
4916
|
{
|
|
4873
4917
|
"aria-label": "Select all rows",
|
|
@@ -4876,15 +4920,15 @@ function DataTableInner({
|
|
|
4876
4920
|
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(Boolean(checked))
|
|
4877
4921
|
}
|
|
4878
4922
|
) }),
|
|
4879
|
-
hasExpander && /* @__PURE__ */ (0,
|
|
4880
|
-
enableRowPinning && /* @__PURE__ */ (0,
|
|
4923
|
+
hasExpander && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "sr-only", children: "Expand" }) }),
|
|
4924
|
+
enableRowPinning && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "sr-only", children: "Pin" }) })
|
|
4881
4925
|
] });
|
|
4882
4926
|
const rowsToRender = virtualized ? virtualItems.map((item) => ({ row: bodyRows[item.index], index: item.index })) : null;
|
|
4883
4927
|
const totalRows = topRows.length + bodyRows.length + bottomRows.length;
|
|
4884
|
-
return /* @__PURE__ */ (0,
|
|
4885
|
-
showToolbar && /* @__PURE__ */ (0,
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4887
|
-
enableGlobalFilter && /* @__PURE__ */ (0,
|
|
4928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: cn("flex w-full flex-col gap-2", wrapperClassName), children: [
|
|
4929
|
+
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4930
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4931
|
+
enableGlobalFilter && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4888
4932
|
SearchBar,
|
|
4889
4933
|
{
|
|
4890
4934
|
"aria-label": "Search table",
|
|
@@ -4897,8 +4941,8 @@ function DataTableInner({
|
|
|
4897
4941
|
),
|
|
4898
4942
|
toolbar
|
|
4899
4943
|
] }),
|
|
4900
|
-
/* @__PURE__ */ (0,
|
|
4901
|
-
enableDensityToggle && /* @__PURE__ */ (0,
|
|
4944
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4945
|
+
enableDensityToggle && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4902
4946
|
Button,
|
|
4903
4947
|
{
|
|
4904
4948
|
type: "button",
|
|
@@ -4907,20 +4951,20 @@ function DataTableInner({
|
|
|
4907
4951
|
"aria-pressed": compact,
|
|
4908
4952
|
onClick: () => setDensity(compact ? "default" : "compact"),
|
|
4909
4953
|
children: [
|
|
4910
|
-
/* @__PURE__ */ (0,
|
|
4954
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.Rows, { size: 16, "aria-hidden": true }),
|
|
4911
4955
|
"Compact"
|
|
4912
4956
|
]
|
|
4913
4957
|
}
|
|
4914
4958
|
),
|
|
4915
|
-
enableGrouping && /* @__PURE__ */ (0,
|
|
4916
|
-
/* @__PURE__ */ (0,
|
|
4917
|
-
/* @__PURE__ */ (0,
|
|
4959
|
+
enableGrouping && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(DropdownMenu, { children: [
|
|
4960
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4961
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.Stack, { size: 16, "aria-hidden": true }),
|
|
4918
4962
|
"Group by"
|
|
4919
4963
|
] }) }),
|
|
4920
|
-
/* @__PURE__ */ (0,
|
|
4921
|
-
/* @__PURE__ */ (0,
|
|
4922
|
-
/* @__PURE__ */ (0,
|
|
4923
|
-
groupableColumns.map((column) => /* @__PURE__ */ (0,
|
|
4964
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
4965
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(DropdownMenuLabel, { children: "Group rows by" }),
|
|
4966
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(DropdownMenuSeparator, {}),
|
|
4967
|
+
groupableColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4924
4968
|
DropdownMenuCheckboxItem,
|
|
4925
4969
|
{
|
|
4926
4970
|
checked: column.getIsGrouped(),
|
|
@@ -4931,15 +4975,15 @@ function DataTableInner({
|
|
|
4931
4975
|
))
|
|
4932
4976
|
] })
|
|
4933
4977
|
] }),
|
|
4934
|
-
enableColumnVisibility && /* @__PURE__ */ (0,
|
|
4935
|
-
/* @__PURE__ */ (0,
|
|
4936
|
-
/* @__PURE__ */ (0,
|
|
4978
|
+
enableColumnVisibility && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(DropdownMenu, { children: [
|
|
4979
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4980
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react30.Sliders, { size: 16, "aria-hidden": true }),
|
|
4937
4981
|
"Columns"
|
|
4938
4982
|
] }) }),
|
|
4939
|
-
/* @__PURE__ */ (0,
|
|
4940
|
-
/* @__PURE__ */ (0,
|
|
4941
|
-
/* @__PURE__ */ (0,
|
|
4942
|
-
hideableColumns.map((column) => /* @__PURE__ */ (0,
|
|
4983
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
4984
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
4985
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(DropdownMenuSeparator, {}),
|
|
4986
|
+
hideableColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4943
4987
|
DropdownMenuCheckboxItem,
|
|
4944
4988
|
{
|
|
4945
4989
|
checked: column.getIsVisible(),
|
|
@@ -4952,7 +4996,7 @@ function DataTableInner({
|
|
|
4952
4996
|
] })
|
|
4953
4997
|
] })
|
|
4954
4998
|
] }),
|
|
4955
|
-
/* @__PURE__ */ (0,
|
|
4999
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
4956
5000
|
Table,
|
|
4957
5001
|
{
|
|
4958
5002
|
ref,
|
|
@@ -4965,52 +5009,52 @@ function DataTableInner({
|
|
|
4965
5009
|
tabIndex: enableCellSelection ? 0 : void 0,
|
|
4966
5010
|
...tableProps,
|
|
4967
5011
|
children: [
|
|
4968
|
-
/* @__PURE__ */ (0,
|
|
4969
|
-
headerGroups.map((group, groupIndex) => /* @__PURE__ */ (0,
|
|
5012
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(TableHeader, { children: [
|
|
5013
|
+
headerGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(TableRow, { className: "hover:bg-transparent", children: [
|
|
4970
5014
|
groupIndex === 0 && leadingHeaderCells(headerGroups.length + (enableColumnFilters ? 1 : 0)),
|
|
4971
5015
|
group.headers.map(renderHeaderCell)
|
|
4972
5016
|
] }, group.id)),
|
|
4973
|
-
enableColumnFilters && /* @__PURE__ */ (0,
|
|
5017
|
+
enableColumnFilters && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableRow, { className: "hover:bg-transparent", children: leafColumns.map((column) => {
|
|
4974
5018
|
const pin = pinning(column, sized, true);
|
|
4975
|
-
return /* @__PURE__ */ (0,
|
|
5019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4976
5020
|
TableHead,
|
|
4977
5021
|
{
|
|
4978
5022
|
style: pin.style,
|
|
4979
5023
|
className: cn("h-auto py-2 font-normal", pin.className, sticky && !column.getIsPinned() && "bg-surface"),
|
|
4980
|
-
children: column.getCanFilter() ? /* @__PURE__ */ (0,
|
|
5024
|
+
children: column.getCanFilter() ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ColumnFilter, { column }) : null
|
|
4981
5025
|
},
|
|
4982
5026
|
column.id
|
|
4983
5027
|
);
|
|
4984
5028
|
}) })
|
|
4985
5029
|
] }),
|
|
4986
|
-
/* @__PURE__ */ (0,
|
|
4987
|
-
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ (0,
|
|
5030
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(TableBody, { children: [
|
|
5031
|
+
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableCell, { colSpan: columnSpan, muted: true, className: "h-24 text-center", children: emptyState ?? "No results." }) }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
4988
5032
|
topRows.map((row, index) => renderRow(row, { pinned: "top", pinnedIndex: index, pinnedCount: topRows.length })),
|
|
4989
|
-
virtualized && paddingTop > 0 && /* @__PURE__ */ (0,
|
|
5033
|
+
virtualized && paddingTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("tr", { "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("td", { colSpan: columnSpan, style: { height: paddingTop } }) }),
|
|
4990
5034
|
rowsToRender ? rowsToRender.map(({ row, index }) => renderRow(row, { virtualIndex: index })) : bodyRows.map((row) => renderRow(row)),
|
|
4991
|
-
virtualized && paddingBottom > 0 && /* @__PURE__ */ (0,
|
|
5035
|
+
virtualized && paddingBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("tr", { "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("td", { colSpan: columnSpan, style: { height: paddingBottom } }) }),
|
|
4992
5036
|
bottomRows.map(
|
|
4993
5037
|
(row, index) => renderRow(row, { pinned: "bottom", pinnedIndex: index, pinnedCount: bottomRows.length })
|
|
4994
5038
|
)
|
|
4995
5039
|
] }),
|
|
4996
|
-
infinite && /* @__PURE__ */ (0,
|
|
5040
|
+
infinite && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
4997
5041
|
loadingMore && Array.from({ length: 3 }, (_, index) => skeletonRow(`more-${index}`)),
|
|
4998
|
-
/* @__PURE__ */ (0,
|
|
5042
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("tr", { ref: sentinelRef, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("td", { colSpan: columnSpan, className: "h-px p-0" }) })
|
|
4999
5043
|
] })
|
|
5000
5044
|
] }),
|
|
5001
|
-
showFooter && /* @__PURE__ */ (0,
|
|
5002
|
-
leadingCount > 0 && /* @__PURE__ */ (0,
|
|
5045
|
+
showFooter && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableFooter, { children: table.getFooterGroups().map((group) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(TableRow, { className: "hover:bg-transparent", children: [
|
|
5046
|
+
leadingCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(TableCell, { colSpan: leadingCount, className: cellDensity }),
|
|
5003
5047
|
group.headers.map((header) => {
|
|
5004
5048
|
const { align } = getMeta(header.column.columnDef.meta);
|
|
5005
5049
|
const pin = pinning(header.column, sized);
|
|
5006
|
-
return /* @__PURE__ */ (0,
|
|
5050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5007
5051
|
TableCell,
|
|
5008
5052
|
{
|
|
5009
5053
|
align,
|
|
5010
5054
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
5011
5055
|
style: pin.style,
|
|
5012
5056
|
className: cn("text-ui-label", pin.className, cellDensity),
|
|
5013
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */ (0,
|
|
5057
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(table.FlexRender, { footer: header })
|
|
5014
5058
|
},
|
|
5015
5059
|
header.id
|
|
5016
5060
|
);
|
|
@@ -5019,9 +5063,9 @@ function DataTableInner({
|
|
|
5019
5063
|
]
|
|
5020
5064
|
}
|
|
5021
5065
|
),
|
|
5022
|
-
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ (0,
|
|
5023
|
-
/* @__PURE__ */ (0,
|
|
5024
|
-
paginate && pageCount > 1 && /* @__PURE__ */ (0,
|
|
5066
|
+
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5067
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.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 }),
|
|
5068
|
+
paginate && pageCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5025
5069
|
Pagination,
|
|
5026
5070
|
{
|
|
5027
5071
|
page: pagination.pageIndex + 1,
|
|
@@ -5032,13 +5076,13 @@ function DataTableInner({
|
|
|
5032
5076
|
] })
|
|
5033
5077
|
] });
|
|
5034
5078
|
}
|
|
5035
|
-
var DataTable =
|
|
5079
|
+
var DataTable = React55.forwardRef(DataTableInner);
|
|
5036
5080
|
DataTable.displayName = "DataTable";
|
|
5037
5081
|
|
|
5038
5082
|
// src/components/Data Display/StatCard.tsx
|
|
5039
|
-
var
|
|
5083
|
+
var React56 = __toESM(require("react"), 1);
|
|
5040
5084
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
5041
|
-
var
|
|
5085
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5042
5086
|
var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
5043
5087
|
variants: {
|
|
5044
5088
|
variant: {
|
|
@@ -5052,26 +5096,26 @@ var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 f
|
|
|
5052
5096
|
},
|
|
5053
5097
|
defaultVariants: { variant: "default" }
|
|
5054
5098
|
});
|
|
5055
|
-
var StatCard =
|
|
5056
|
-
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5057
|
-
/* @__PURE__ */ (0,
|
|
5058
|
-
/* @__PURE__ */ (0,
|
|
5059
|
-
icon && /* @__PURE__ */ (0,
|
|
5099
|
+
var StatCard = React56.forwardRef(
|
|
5100
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
5101
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
5102
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
5103
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
5060
5104
|
value
|
|
5061
5105
|
] }),
|
|
5062
|
-
caption && /* @__PURE__ */ (0,
|
|
5106
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
5063
5107
|
] })
|
|
5064
5108
|
);
|
|
5065
5109
|
StatCard.displayName = "StatCard";
|
|
5066
5110
|
|
|
5067
5111
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
5068
|
-
var
|
|
5112
|
+
var React58 = __toESM(require("react"), 1);
|
|
5069
5113
|
|
|
5070
5114
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
5071
|
-
var
|
|
5115
|
+
var React57 = __toESM(require("react"), 1);
|
|
5072
5116
|
var import_react31 = require("@phosphor-icons/react");
|
|
5073
5117
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
5074
|
-
var
|
|
5118
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5075
5119
|
var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
5076
5120
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5077
5121
|
{
|
|
@@ -5086,27 +5130,27 @@ var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
|
5086
5130
|
defaultVariants: { type: "default" }
|
|
5087
5131
|
}
|
|
5088
5132
|
);
|
|
5089
|
-
var EditableTag =
|
|
5133
|
+
var EditableTag = React57.forwardRef(
|
|
5090
5134
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
5091
5135
|
const classes = cn(editableTagVariants({ type }), className);
|
|
5092
|
-
const leading = type === "add" ? /* @__PURE__ */ (0,
|
|
5136
|
+
const leading = type === "add" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react31.Plus, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react31.Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
5093
5137
|
if (type === "add" || type === "multiple" && onClick) {
|
|
5094
|
-
return /* @__PURE__ */ (0,
|
|
5138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
5095
5139
|
leading,
|
|
5096
5140
|
children
|
|
5097
5141
|
] });
|
|
5098
5142
|
}
|
|
5099
|
-
return /* @__PURE__ */ (0,
|
|
5143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
5100
5144
|
leading,
|
|
5101
5145
|
children,
|
|
5102
|
-
onRemove && /* @__PURE__ */ (0,
|
|
5146
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5103
5147
|
"button",
|
|
5104
5148
|
{
|
|
5105
5149
|
type: "button",
|
|
5106
5150
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
5107
5151
|
onClick: onRemove,
|
|
5108
5152
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
5109
|
-
children: /* @__PURE__ */ (0,
|
|
5153
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react31.X, { size: 12, "aria-hidden": true })
|
|
5110
5154
|
}
|
|
5111
5155
|
)
|
|
5112
5156
|
] });
|
|
@@ -5115,26 +5159,26 @@ var EditableTag = React56.forwardRef(
|
|
|
5115
5159
|
EditableTag.displayName = "EditableTag";
|
|
5116
5160
|
|
|
5117
5161
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
5118
|
-
var
|
|
5119
|
-
var ActivityStructure =
|
|
5120
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5162
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5163
|
+
var ActivityStructure = React58.forwardRef(
|
|
5164
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
5121
5165
|
"section",
|
|
5122
5166
|
{
|
|
5123
5167
|
ref,
|
|
5124
5168
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
5125
5169
|
...props,
|
|
5126
5170
|
children: [
|
|
5127
|
-
/* @__PURE__ */ (0,
|
|
5128
|
-
/* @__PURE__ */ (0,
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5172
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
5129
5173
|
action
|
|
5130
5174
|
] }),
|
|
5131
|
-
stats.length > 0 && /* @__PURE__ */ (0,
|
|
5132
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0,
|
|
5133
|
-
/* @__PURE__ */ (0,
|
|
5134
|
-
/* @__PURE__ */ (0,
|
|
5135
|
-
(tags?.length || onAddTag) && /* @__PURE__ */ (0,
|
|
5136
|
-
tags?.map((tag) => /* @__PURE__ */ (0,
|
|
5137
|
-
onAddTag && /* @__PURE__ */ (0,
|
|
5175
|
+
stats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(StatCard, { ...stat }, id)) }),
|
|
5176
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5177
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
5178
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
5179
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5180
|
+
tags?.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
5181
|
+
onAddTag && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
5138
5182
|
] })
|
|
5139
5183
|
] }, id)),
|
|
5140
5184
|
children
|
|
@@ -5145,10 +5189,10 @@ var ActivityStructure = React57.forwardRef(
|
|
|
5145
5189
|
ActivityStructure.displayName = "ActivityStructure";
|
|
5146
5190
|
|
|
5147
5191
|
// src/components/Tags & Badges/Badge.tsx
|
|
5148
|
-
var
|
|
5192
|
+
var React59 = __toESM(require("react"), 1);
|
|
5149
5193
|
var import_react32 = require("@phosphor-icons/react");
|
|
5150
5194
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
5151
|
-
var
|
|
5195
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5152
5196
|
var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
5153
5197
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5154
5198
|
{
|
|
@@ -5174,11 +5218,11 @@ var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
|
5174
5218
|
defaultVariants: { type: "primary", selected: false }
|
|
5175
5219
|
}
|
|
5176
5220
|
);
|
|
5177
|
-
var Badge =
|
|
5221
|
+
var Badge = React59.forwardRef(
|
|
5178
5222
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
5179
5223
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
5180
5224
|
if (type === "interactable") {
|
|
5181
|
-
return /* @__PURE__ */ (0,
|
|
5225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5182
5226
|
"button",
|
|
5183
5227
|
{
|
|
5184
5228
|
ref,
|
|
@@ -5188,15 +5232,15 @@ var Badge = React58.forwardRef(
|
|
|
5188
5232
|
onClick,
|
|
5189
5233
|
...props,
|
|
5190
5234
|
children: [
|
|
5191
|
-
/* @__PURE__ */ (0,
|
|
5235
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react32.DotsSixVertical, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
5192
5236
|
children
|
|
5193
5237
|
]
|
|
5194
5238
|
}
|
|
5195
5239
|
);
|
|
5196
5240
|
}
|
|
5197
|
-
return /* @__PURE__ */ (0,
|
|
5198
|
-
type === "question" && /* @__PURE__ */ (0,
|
|
5199
|
-
type === "id" && /* @__PURE__ */ (0,
|
|
5241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
5242
|
+
type === "question" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react32.RadioButton, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
5243
|
+
type === "id" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
5200
5244
|
children
|
|
5201
5245
|
] });
|
|
5202
5246
|
}
|
|
@@ -5261,6 +5305,8 @@ Badge.displayName = "Badge";
|
|
|
5261
5305
|
InputWithAction,
|
|
5262
5306
|
Label,
|
|
5263
5307
|
MediaInfo,
|
|
5308
|
+
NavRail,
|
|
5309
|
+
NavRailItem,
|
|
5264
5310
|
NumberInput,
|
|
5265
5311
|
OpenEndAnswer,
|
|
5266
5312
|
Pagination,
|