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