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