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