@discuss-ds/ui 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +604 -517
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +580 -497
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2276,24 +2276,90 @@ var Textarea = React32.forwardRef(
|
|
|
2276
2276
|
);
|
|
2277
2277
|
Textarea.displayName = "Textarea";
|
|
2278
2278
|
|
|
2279
|
-
// src/components/
|
|
2279
|
+
// src/components/Navigation/Stepper.tsx
|
|
2280
2280
|
import * as React33 from "react";
|
|
2281
|
+
import { CheckCircle as CheckCircle2, Circle, RadioButton, WarningCircle as WarningCircle3 } from "@phosphor-icons/react";
|
|
2282
|
+
import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2283
|
+
var STATUS_TEXT = { "not-completed": "not completed", completed: "completed", error: "error" };
|
|
2284
|
+
function StepIndicator({ status, selected }) {
|
|
2285
|
+
const props = { size: 24, "aria-hidden": true, className: "shrink-0" };
|
|
2286
|
+
if (status === "completed") return /* @__PURE__ */ jsx34(CheckCircle2, { ...props, weight: selected ? "fill" : "regular", className: "shrink-0 text-success-foreground" });
|
|
2287
|
+
if (status === "error") return /* @__PURE__ */ jsx34(WarningCircle3, { ...props, weight: selected ? "fill" : "regular", className: "shrink-0 text-destructive-foreground" });
|
|
2288
|
+
if (selected) return /* @__PURE__ */ jsx34(RadioButton, { ...props, weight: "fill", className: "shrink-0 text-accent-foreground" });
|
|
2289
|
+
return /* @__PURE__ */ jsx34(Circle, { ...props, className: "shrink-0 text-input-muted" });
|
|
2290
|
+
}
|
|
2291
|
+
var Step = React33.forwardRef(
|
|
2292
|
+
({ label, status = "not-completed", selected = false, orientation = "horizontal", className, ...props }, ref) => {
|
|
2293
|
+
const vertical = orientation === "vertical";
|
|
2294
|
+
return /* @__PURE__ */ jsxs24(
|
|
2295
|
+
"div",
|
|
2296
|
+
{
|
|
2297
|
+
ref,
|
|
2298
|
+
className: cn(
|
|
2299
|
+
"flex min-h-16 w-34 shrink-0",
|
|
2300
|
+
// The horizontal indicator sits 6px from the top, so a path beside it lines up whatever the label's length.
|
|
2301
|
+
vertical ? "items-center justify-end gap-4 p-2" : "flex-col items-center gap-2 pt-1.5",
|
|
2302
|
+
className
|
|
2303
|
+
),
|
|
2304
|
+
...props,
|
|
2305
|
+
children: [
|
|
2306
|
+
!vertical && /* @__PURE__ */ jsx34(StepIndicator, { status, selected }),
|
|
2307
|
+
/* @__PURE__ */ jsxs24(
|
|
2308
|
+
"span",
|
|
2309
|
+
{
|
|
2310
|
+
className: cn(
|
|
2311
|
+
vertical ? "min-w-0 flex-1 text-right" : "w-full text-center",
|
|
2312
|
+
selected ? "text-ui-label text-foreground" : "text-body-small text-secondary-muted-foreground"
|
|
2313
|
+
),
|
|
2314
|
+
children: [
|
|
2315
|
+
label,
|
|
2316
|
+
status !== "not-completed" && /* @__PURE__ */ jsx34("span", { className: "sr-only", children: `, ${STATUS_TEXT[status]}` })
|
|
2317
|
+
]
|
|
2318
|
+
}
|
|
2319
|
+
),
|
|
2320
|
+
vertical && /* @__PURE__ */ jsx34(StepIndicator, { status, selected })
|
|
2321
|
+
]
|
|
2322
|
+
}
|
|
2323
|
+
);
|
|
2324
|
+
}
|
|
2325
|
+
);
|
|
2326
|
+
Step.displayName = "Step";
|
|
2327
|
+
var StepPath = React33.forwardRef(
|
|
2328
|
+
({ orientation = "horizontal", completed = false, className, ...props }, ref) => {
|
|
2329
|
+
const vertical = orientation === "vertical";
|
|
2330
|
+
return /* @__PURE__ */ jsx34("div", { ref, "aria-hidden": true, className: cn("flex items-center justify-center", vertical ? "h-8 w-8 flex-col" : "h-8 flex-1", className), ...props, children: /* @__PURE__ */ jsx34("div", { className: cn(vertical ? "w-px flex-1" : "h-px flex-1", completed ? "bg-success-foreground" : "bg-border") }) });
|
|
2331
|
+
}
|
|
2332
|
+
);
|
|
2333
|
+
StepPath.displayName = "StepPath";
|
|
2334
|
+
var Stepper = React33.forwardRef(({ steps, current, orientation = "horizontal", className, ...props }, ref) => {
|
|
2335
|
+
const vertical = orientation === "vertical";
|
|
2336
|
+
const statusOf = (i, step) => step.error ? "error" : i < current ? "completed" : "not-completed";
|
|
2337
|
+
return /* @__PURE__ */ jsx34("ol", { ref, className: cn("flex", vertical ? "flex-col items-end" : "w-full items-start", className), ...props, children: steps.map((step, i) => /* @__PURE__ */ jsxs24(React33.Fragment, { children: [
|
|
2338
|
+
i > 0 && // Horizontal: the path runs from one indicator's edge to the next (it reaches 56px into each 136px step), level with the indicators' centre.
|
|
2339
|
+
/* @__PURE__ */ jsx34("li", { "aria-hidden": true, className: cn("flex", vertical ? "pr-1" : "-mx-14 flex-1 pt-1.5"), children: /* @__PURE__ */ jsx34(StepPath, { orientation, completed: i < current, className: vertical ? void 0 : "h-6" }) }),
|
|
2340
|
+
/* @__PURE__ */ jsx34("li", { "aria-current": i === current ? "step" : void 0, className: "flex", children: /* @__PURE__ */ jsx34(Step, { label: step.label, status: statusOf(i, step), selected: i === current, orientation }) })
|
|
2341
|
+
] }, i)) });
|
|
2342
|
+
});
|
|
2343
|
+
Stepper.displayName = "Stepper";
|
|
2344
|
+
|
|
2345
|
+
// src/components/Overlays & Feedback/Dialog.tsx
|
|
2346
|
+
import * as React34 from "react";
|
|
2281
2347
|
import { X as X3 } from "@phosphor-icons/react";
|
|
2282
2348
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
2283
|
-
import { jsx as
|
|
2349
|
+
import { jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2284
2350
|
var Dialog = DialogPrimitive.Root;
|
|
2285
2351
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
2286
2352
|
var DialogClose = DialogPrimitive.Close;
|
|
2287
|
-
var DialogContent =
|
|
2288
|
-
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */
|
|
2289
|
-
/* @__PURE__ */
|
|
2353
|
+
var DialogContent = React34.forwardRef(
|
|
2354
|
+
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */ jsxs25(DialogPrimitive.Portal, { children: [
|
|
2355
|
+
/* @__PURE__ */ jsx35(
|
|
2290
2356
|
DialogPrimitive.Overlay,
|
|
2291
2357
|
{
|
|
2292
2358
|
style: { zIndex: "var(--sys-z-30)" },
|
|
2293
2359
|
className: "fixed inset-0 bg-primary/30"
|
|
2294
2360
|
}
|
|
2295
2361
|
),
|
|
2296
|
-
/* @__PURE__ */
|
|
2362
|
+
/* @__PURE__ */ jsxs25(
|
|
2297
2363
|
DialogPrimitive.Content,
|
|
2298
2364
|
{
|
|
2299
2365
|
ref,
|
|
@@ -2305,15 +2371,15 @@ var DialogContent = React33.forwardRef(
|
|
|
2305
2371
|
...props,
|
|
2306
2372
|
children: [
|
|
2307
2373
|
children,
|
|
2308
|
-
!hideClose && /* @__PURE__ */
|
|
2374
|
+
!hideClose && /* @__PURE__ */ jsx35(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx35(Button, { variant: "ghost", size: "icon-sm", "aria-label": closeLabel, className: "absolute top-4 right-6", children: /* @__PURE__ */ jsx35(X3, { size: 16, "aria-hidden": true }) }) })
|
|
2309
2375
|
]
|
|
2310
2376
|
}
|
|
2311
2377
|
)
|
|
2312
2378
|
] })
|
|
2313
2379
|
);
|
|
2314
2380
|
DialogContent.displayName = "DialogContent";
|
|
2315
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
2316
|
-
var DialogTitle =
|
|
2381
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx35("div", { className: cn("flex flex-col gap-1.5 border-b border-border px-6 py-4 pr-16", className), ...props });
|
|
2382
|
+
var DialogTitle = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx35(
|
|
2317
2383
|
DialogPrimitive.Title,
|
|
2318
2384
|
{
|
|
2319
2385
|
ref,
|
|
@@ -2322,7 +2388,7 @@ var DialogTitle = React33.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2322
2388
|
}
|
|
2323
2389
|
));
|
|
2324
2390
|
DialogTitle.displayName = "DialogTitle";
|
|
2325
|
-
var DialogDescription =
|
|
2391
|
+
var DialogDescription = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx35(
|
|
2326
2392
|
DialogPrimitive.Description,
|
|
2327
2393
|
{
|
|
2328
2394
|
ref,
|
|
@@ -2331,15 +2397,15 @@ var DialogDescription = React33.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2331
2397
|
}
|
|
2332
2398
|
));
|
|
2333
2399
|
DialogDescription.displayName = "DialogDescription";
|
|
2334
|
-
var DialogBody = ({ className, ...props }) => /* @__PURE__ */
|
|
2335
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
2400
|
+
var DialogBody = ({ className, ...props }) => /* @__PURE__ */ jsx35("div", { className: cn("flex flex-col gap-4 p-6", className), ...props });
|
|
2401
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx35("div", { className: cn("flex items-center justify-end gap-3 border-t border-border px-6 py-4", className), ...props });
|
|
2336
2402
|
|
|
2337
2403
|
// src/components/Overlays & Feedback/Toast.tsx
|
|
2338
|
-
import * as
|
|
2339
|
-
import { CheckCircle as
|
|
2404
|
+
import * as React35 from "react";
|
|
2405
|
+
import { CheckCircle as CheckCircle3, Info, Warning, WarningCircle as WarningCircle4, X as X4 } from "@phosphor-icons/react";
|
|
2340
2406
|
import { cva as cva4 } from "class-variance-authority";
|
|
2341
2407
|
import { Toast as ToastPrimitive } from "radix-ui";
|
|
2342
|
-
import { Fragment as
|
|
2408
|
+
import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2343
2409
|
var toastVariants = cva4("border", {
|
|
2344
2410
|
variants: {
|
|
2345
2411
|
variant: {
|
|
@@ -2377,13 +2443,13 @@ var titleColour = {
|
|
|
2377
2443
|
};
|
|
2378
2444
|
function VariantIcon({ variant, size }) {
|
|
2379
2445
|
const props = { size, "aria-hidden": true, className: cn("shrink-0", iconColour[variant]) };
|
|
2380
|
-
if (variant === "success") return /* @__PURE__ */
|
|
2381
|
-
if (variant === "warning") return /* @__PURE__ */
|
|
2382
|
-
if (variant === "destructive") return /* @__PURE__ */
|
|
2383
|
-
return /* @__PURE__ */
|
|
2446
|
+
if (variant === "success") return /* @__PURE__ */ jsx36(CheckCircle3, { ...props });
|
|
2447
|
+
if (variant === "warning") return /* @__PURE__ */ jsx36(Warning, { ...props });
|
|
2448
|
+
if (variant === "destructive") return /* @__PURE__ */ jsx36(WarningCircle4, { ...props });
|
|
2449
|
+
return /* @__PURE__ */ jsx36(Info, { ...props });
|
|
2384
2450
|
}
|
|
2385
2451
|
var ToastProvider = ToastPrimitive.Provider;
|
|
2386
|
-
var ToastViewport =
|
|
2452
|
+
var ToastViewport = React35.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx36(
|
|
2387
2453
|
ToastPrimitive.Viewport,
|
|
2388
2454
|
{
|
|
2389
2455
|
ref,
|
|
@@ -2393,10 +2459,10 @@ var ToastViewport = React34.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2393
2459
|
}
|
|
2394
2460
|
));
|
|
2395
2461
|
ToastViewport.displayName = "ToastViewport";
|
|
2396
|
-
var Toast =
|
|
2462
|
+
var Toast = React35.forwardRef(
|
|
2397
2463
|
({ className, variant = "info", title, description, action, closeLabel = "Close", children, ...props }, ref) => {
|
|
2398
2464
|
const v = variant ?? "info";
|
|
2399
|
-
return /* @__PURE__ */
|
|
2465
|
+
return /* @__PURE__ */ jsxs26(
|
|
2400
2466
|
ToastPrimitive.Root,
|
|
2401
2467
|
{
|
|
2402
2468
|
ref,
|
|
@@ -2404,19 +2470,19 @@ var Toast = React34.forwardRef(
|
|
|
2404
2470
|
className: cn("flex items-start gap-3 rounded-lg p-4 shadow-lg", toastVariants({ variant: v }), className),
|
|
2405
2471
|
...props,
|
|
2406
2472
|
children: [
|
|
2407
|
-
/* @__PURE__ */
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
title != null && /* @__PURE__ */
|
|
2410
|
-
description != null && /* @__PURE__ */
|
|
2473
|
+
/* @__PURE__ */ jsx36(VariantIcon, { variant: v, size: 20 }),
|
|
2474
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 flex-1 flex-col gap-1 text-body-small", children: [
|
|
2475
|
+
title != null && /* @__PURE__ */ jsx36(ToastPrimitive.Title, { className: cn("font-semibold", titleColour[v]), children: title }),
|
|
2476
|
+
description != null && /* @__PURE__ */ jsx36(ToastPrimitive.Description, { className: "text-secondary-muted-foreground", children: description }),
|
|
2411
2477
|
children,
|
|
2412
2478
|
action
|
|
2413
2479
|
] }),
|
|
2414
|
-
/* @__PURE__ */
|
|
2480
|
+
/* @__PURE__ */ jsx36(
|
|
2415
2481
|
ToastPrimitive.Close,
|
|
2416
2482
|
{
|
|
2417
2483
|
"aria-label": closeLabel,
|
|
2418
2484
|
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-xs text-surface-foreground",
|
|
2419
|
-
children: /* @__PURE__ */
|
|
2485
|
+
children: /* @__PURE__ */ jsx36(X4, { size: 16, "aria-hidden": true })
|
|
2420
2486
|
}
|
|
2421
2487
|
)
|
|
2422
2488
|
]
|
|
@@ -2426,11 +2492,11 @@ var Toast = React34.forwardRef(
|
|
|
2426
2492
|
);
|
|
2427
2493
|
Toast.displayName = "Toast";
|
|
2428
2494
|
var ToastAction = ToastPrimitive.Action;
|
|
2429
|
-
var ToastInline =
|
|
2495
|
+
var ToastInline = React35.forwardRef(
|
|
2430
2496
|
({ className, variant = "info", actions, actionsPlacement = "end", onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2431
2497
|
const v = variant ?? "info";
|
|
2432
2498
|
const below = actionsPlacement === "bottom" && !!actions;
|
|
2433
|
-
return /* @__PURE__ */
|
|
2499
|
+
return /* @__PURE__ */ jsxs26(
|
|
2434
2500
|
"div",
|
|
2435
2501
|
{
|
|
2436
2502
|
ref,
|
|
@@ -2438,15 +2504,15 @@ var ToastInline = React34.forwardRef(
|
|
|
2438
2504
|
className: cn("flex gap-2 rounded-sm px-2 py-1.5", below ? "items-start" : "items-center", inlineVariants({ variant: v }), className),
|
|
2439
2505
|
...props,
|
|
2440
2506
|
children: [
|
|
2441
|
-
/* @__PURE__ */
|
|
2442
|
-
below ? /* @__PURE__ */
|
|
2443
|
-
/* @__PURE__ */
|
|
2444
|
-
/* @__PURE__ */
|
|
2445
|
-
] }) : /* @__PURE__ */
|
|
2446
|
-
/* @__PURE__ */
|
|
2447
|
-
actions && /* @__PURE__ */
|
|
2507
|
+
/* @__PURE__ */ jsx36("span", { className: cn("inline-flex shrink-0", below && "mt-0.5"), children: /* @__PURE__ */ jsx36(VariantIcon, { variant: v === "neutral" ? "info" : v, size: 16 }) }),
|
|
2508
|
+
below ? /* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2509
|
+
/* @__PURE__ */ jsx36("p", { className: "text-body-small text-secondary-muted-foreground", children }),
|
|
2510
|
+
/* @__PURE__ */ jsx36("div", { className: "flex items-center gap-2", children: actions })
|
|
2511
|
+
] }) : /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
2512
|
+
/* @__PURE__ */ jsx36("p", { className: "min-w-0 flex-1 text-body-small text-secondary-muted-foreground", children }),
|
|
2513
|
+
actions && /* @__PURE__ */ jsx36("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
2448
2514
|
] }),
|
|
2449
|
-
onClose && /* @__PURE__ */
|
|
2515
|
+
onClose && /* @__PURE__ */ jsx36(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx36(X4, { size: 16, "aria-hidden": true }) })
|
|
2450
2516
|
]
|
|
2451
2517
|
}
|
|
2452
2518
|
);
|
|
@@ -2455,16 +2521,16 @@ var ToastInline = React34.forwardRef(
|
|
|
2455
2521
|
ToastInline.displayName = "ToastInline";
|
|
2456
2522
|
|
|
2457
2523
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
2458
|
-
import * as
|
|
2524
|
+
import * as React36 from "react";
|
|
2459
2525
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2460
|
-
import { Fragment as
|
|
2526
|
+
import { Fragment as Fragment8, jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2461
2527
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
2462
2528
|
var Tooltip = TooltipPrimitive.Root;
|
|
2463
2529
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
2464
|
-
var TooltipContent =
|
|
2530
|
+
var TooltipContent = React36.forwardRef(
|
|
2465
2531
|
({ className, sideOffset = 4, title, description, action, arrow = true, children, ...props }, ref) => {
|
|
2466
2532
|
const detailed = title != null || description != null;
|
|
2467
|
-
return /* @__PURE__ */
|
|
2533
|
+
return /* @__PURE__ */ jsx37(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs27(
|
|
2468
2534
|
TooltipPrimitive.Content,
|
|
2469
2535
|
{
|
|
2470
2536
|
ref,
|
|
@@ -2478,12 +2544,12 @@ var TooltipContent = React35.forwardRef(
|
|
|
2478
2544
|
),
|
|
2479
2545
|
...props,
|
|
2480
2546
|
children: [
|
|
2481
|
-
detailed ? /* @__PURE__ */
|
|
2482
|
-
title != null && /* @__PURE__ */
|
|
2483
|
-
description != null && /* @__PURE__ */
|
|
2484
|
-
action != null && /* @__PURE__ */
|
|
2547
|
+
detailed ? /* @__PURE__ */ jsxs27(Fragment8, { children: [
|
|
2548
|
+
title != null && /* @__PURE__ */ jsx37("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2549
|
+
description != null && /* @__PURE__ */ jsx37("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2550
|
+
action != null && /* @__PURE__ */ jsx37("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
2485
2551
|
] }) : children,
|
|
2486
|
-
arrow && /* @__PURE__ */
|
|
2552
|
+
arrow && /* @__PURE__ */ jsx37(TooltipPrimitive.Arrow, { width: 12, height: 8, className: "fill-primary-soft-foreground" })
|
|
2487
2553
|
]
|
|
2488
2554
|
}
|
|
2489
2555
|
) });
|
|
@@ -2492,14 +2558,14 @@ var TooltipContent = React35.forwardRef(
|
|
|
2492
2558
|
TooltipContent.displayName = "TooltipContent";
|
|
2493
2559
|
|
|
2494
2560
|
// src/components/Question Types/FileUpload.tsx
|
|
2495
|
-
import * as
|
|
2561
|
+
import * as React38 from "react";
|
|
2496
2562
|
import { FileText, X as X5 } from "@phosphor-icons/react";
|
|
2497
2563
|
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
2498
2564
|
|
|
2499
2565
|
// src/components/Tags & Badges/Tag.tsx
|
|
2500
|
-
import * as
|
|
2566
|
+
import * as React37 from "react";
|
|
2501
2567
|
import { cva as cva5 } from "class-variance-authority";
|
|
2502
|
-
import { jsx as
|
|
2568
|
+
import { jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2503
2569
|
var tagVariants = cva5(
|
|
2504
2570
|
"inline-flex items-center gap-1.5 whitespace-nowrap rounded-sm border px-2.5 py-1 text-ui-caption",
|
|
2505
2571
|
{
|
|
@@ -2515,7 +2581,7 @@ var tagVariants = cva5(
|
|
|
2515
2581
|
defaultVariants: { variant: "neutral" }
|
|
2516
2582
|
}
|
|
2517
2583
|
);
|
|
2518
|
-
var Tag =
|
|
2584
|
+
var Tag = React37.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx38("span", { ref, className: cn(tagVariants({ variant }), className), ...props }));
|
|
2519
2585
|
Tag.displayName = "Tag";
|
|
2520
2586
|
var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
2521
2587
|
variants: {
|
|
@@ -2528,20 +2594,20 @@ var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
|
2528
2594
|
},
|
|
2529
2595
|
defaultVariants: { status: "active" }
|
|
2530
2596
|
});
|
|
2531
|
-
var StatusTag =
|
|
2532
|
-
({ className, status, children, ...props }, ref) => /* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2597
|
+
var StatusTag = React37.forwardRef(
|
|
2598
|
+
({ className, status, children, ...props }, ref) => /* @__PURE__ */ jsxs28("span", { ref, className: cn(tagVariants({ variant: "default" }), className), ...props, children: [
|
|
2599
|
+
/* @__PURE__ */ jsx38("span", { className: statusDotVariants({ status }), "aria-hidden": "true" }),
|
|
2534
2600
|
children
|
|
2535
2601
|
] })
|
|
2536
2602
|
);
|
|
2537
2603
|
StatusTag.displayName = "StatusTag";
|
|
2538
2604
|
|
|
2539
2605
|
// src/components/Question Types/FileUpload.tsx
|
|
2540
|
-
import { Fragment as
|
|
2541
|
-
var FileUploadZone =
|
|
2606
|
+
import { Fragment as Fragment9, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2607
|
+
var FileUploadZone = React38.forwardRef(
|
|
2542
2608
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2543
|
-
const [over, setOver] =
|
|
2544
|
-
return /* @__PURE__ */
|
|
2609
|
+
const [over, setOver] = React38.useState(false);
|
|
2610
|
+
return /* @__PURE__ */ jsxs29(
|
|
2545
2611
|
"label",
|
|
2546
2612
|
{
|
|
2547
2613
|
className: cn(
|
|
@@ -2561,12 +2627,12 @@ var FileUploadZone = React37.forwardRef(
|
|
|
2561
2627
|
onFiles?.(Array.from(event.dataTransfer.files));
|
|
2562
2628
|
},
|
|
2563
2629
|
children: [
|
|
2564
|
-
/* @__PURE__ */
|
|
2565
|
-
/* @__PURE__ */
|
|
2566
|
-
/* @__PURE__ */
|
|
2567
|
-
hint && /* @__PURE__ */
|
|
2630
|
+
/* @__PURE__ */ jsx39("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__ */ jsx39(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2631
|
+
/* @__PURE__ */ jsxs29("span", { className: "flex flex-col gap-1", children: [
|
|
2632
|
+
/* @__PURE__ */ jsx39("span", { className: "text-body-small text-surface-foreground", children: title }),
|
|
2633
|
+
hint && /* @__PURE__ */ jsx39("span", { className: "text-ui-caption text-secondary-muted-foreground", children: hint })
|
|
2568
2634
|
] }),
|
|
2569
|
-
/* @__PURE__ */
|
|
2635
|
+
/* @__PURE__ */ jsx39(
|
|
2570
2636
|
"input",
|
|
2571
2637
|
{
|
|
2572
2638
|
ref,
|
|
@@ -2582,47 +2648,47 @@ var FileUploadZone = React37.forwardRef(
|
|
|
2582
2648
|
}
|
|
2583
2649
|
);
|
|
2584
2650
|
FileUploadZone.displayName = "FileUploadZone";
|
|
2585
|
-
var FileUploadItem =
|
|
2651
|
+
var FileUploadItem = React38.forwardRef(
|
|
2586
2652
|
({ className, name, size, status = "uploading", progress = 0, timeLeft, icon, onRemove, removeLabel, ...props }, ref) => {
|
|
2587
2653
|
const uploading = status === "uploading";
|
|
2588
|
-
return /* @__PURE__ */
|
|
2654
|
+
return /* @__PURE__ */ jsxs29(
|
|
2589
2655
|
"div",
|
|
2590
2656
|
{
|
|
2591
2657
|
ref,
|
|
2592
2658
|
className: cn("flex w-full flex-col justify-center gap-2 overflow-hidden rounded-sm border border-border p-2", className),
|
|
2593
2659
|
...props,
|
|
2594
2660
|
children: [
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2597
|
-
/* @__PURE__ */
|
|
2598
|
-
/* @__PURE__ */
|
|
2599
|
-
/* @__PURE__ */
|
|
2600
|
-
onRemove && /* @__PURE__ */
|
|
2661
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
2662
|
+
/* @__PURE__ */ jsx39("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__ */ jsx39(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2663
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2664
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2665
|
+
/* @__PURE__ */ jsx39("p", { className: "min-w-0 truncate text-ui-label text-surface-foreground", children: name }),
|
|
2666
|
+
onRemove && /* @__PURE__ */ jsx39(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx39(X5, { size: 16, "aria-hidden": true }) })
|
|
2601
2667
|
] }),
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2669
|
+
/* @__PURE__ */ jsxs29("span", { className: "flex items-center gap-2", children: [
|
|
2604
2670
|
size,
|
|
2605
|
-
status === "complete" && /* @__PURE__ */
|
|
2606
|
-
status === "error" && /* @__PURE__ */
|
|
2607
|
-
uploading && timeLeft && /* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2671
|
+
status === "complete" && /* @__PURE__ */ jsx39(Tag, { variant: "success", children: "Complete" }),
|
|
2672
|
+
status === "error" && /* @__PURE__ */ jsx39(Tag, { variant: "destructive", children: "Error" }),
|
|
2673
|
+
uploading && timeLeft && /* @__PURE__ */ jsxs29(Fragment9, { children: [
|
|
2674
|
+
/* @__PURE__ */ jsx39("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2609
2675
|
timeLeft
|
|
2610
2676
|
] })
|
|
2611
2677
|
] }),
|
|
2612
|
-
uploading && /* @__PURE__ */
|
|
2678
|
+
uploading && /* @__PURE__ */ jsxs29("span", { className: "text-body-xxs font-normal", children: [
|
|
2613
2679
|
Math.round(progress),
|
|
2614
2680
|
"%"
|
|
2615
2681
|
] })
|
|
2616
2682
|
] })
|
|
2617
2683
|
] })
|
|
2618
2684
|
] }),
|
|
2619
|
-
uploading && /* @__PURE__ */
|
|
2685
|
+
uploading && /* @__PURE__ */ jsx39(
|
|
2620
2686
|
ProgressPrimitive.Root,
|
|
2621
2687
|
{
|
|
2622
2688
|
value: progress,
|
|
2623
2689
|
"aria-label": `Uploading ${name}`,
|
|
2624
2690
|
className: "h-0.75 w-full overflow-hidden rounded-sm bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5",
|
|
2625
|
-
children: /* @__PURE__ */
|
|
2691
|
+
children: /* @__PURE__ */ jsx39(ProgressPrimitive.Indicator, { className: "h-full bg-accent transition-[width]", style: { width: `${progress}%` } })
|
|
2626
2692
|
}
|
|
2627
2693
|
)
|
|
2628
2694
|
]
|
|
@@ -2633,25 +2699,25 @@ var FileUploadItem = React37.forwardRef(
|
|
|
2633
2699
|
FileUploadItem.displayName = "FileUploadItem";
|
|
2634
2700
|
|
|
2635
2701
|
// src/components/Question Types/Media.tsx
|
|
2636
|
-
import * as
|
|
2702
|
+
import * as React39 from "react";
|
|
2637
2703
|
import { CornersOut, DotsThree, Image as ImageIcon, Pause, Play, SpeakerSimpleHigh, SpeakerSimpleX, Trash as Trash3 } from "@phosphor-icons/react";
|
|
2638
2704
|
import { Slider as SliderPrimitive2, ToggleGroup as ToggleGroupPrimitive2 } from "radix-ui";
|
|
2639
|
-
import { jsx as
|
|
2705
|
+
import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2640
2706
|
function MediaInfo({ name, details, onRemove, removeLabel, large, className, ...props }) {
|
|
2641
|
-
return /* @__PURE__ */
|
|
2642
|
-
/* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2644
|
-
details && /* @__PURE__ */
|
|
2645
|
-
index > 0 && /* @__PURE__ */
|
|
2707
|
+
return /* @__PURE__ */ jsxs30("div", { className: cn("flex items-center justify-between border-t border-border bg-surface px-6 py-4", className), ...props, children: [
|
|
2708
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2709
|
+
/* @__PURE__ */ jsx40("p", { className: cn("truncate text-surface-foreground", large ? "text-body-section" : "text-ui-label"), children: name }),
|
|
2710
|
+
details && /* @__PURE__ */ jsx40("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__ */ jsxs30(React39.Fragment, { children: [
|
|
2711
|
+
index > 0 && /* @__PURE__ */ jsx40("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2646
2712
|
part
|
|
2647
2713
|
] }, part)) })
|
|
2648
2714
|
] }),
|
|
2649
|
-
onRemove && /* @__PURE__ */
|
|
2715
|
+
onRemove && /* @__PURE__ */ jsx40(Button, { type: "button", variant: "destructive", size: "icon", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx40(Trash3, { size: 16, "aria-hidden": true }) })
|
|
2650
2716
|
] });
|
|
2651
2717
|
}
|
|
2652
|
-
var ImagePreview =
|
|
2653
|
-
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
2718
|
+
var ImagePreview = React39.forwardRef(
|
|
2719
|
+
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */ jsxs30("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border", className), ...props, children: [
|
|
2720
|
+
/* @__PURE__ */ jsx40(
|
|
2655
2721
|
"div",
|
|
2656
2722
|
{
|
|
2657
2723
|
className: cn(
|
|
@@ -2662,12 +2728,12 @@ var ImagePreview = React38.forwardRef(
|
|
|
2662
2728
|
children
|
|
2663
2729
|
}
|
|
2664
2730
|
),
|
|
2665
|
-
/* @__PURE__ */
|
|
2731
|
+
/* @__PURE__ */ jsx40(MediaInfo, { name, details, onRemove, large: true })
|
|
2666
2732
|
] })
|
|
2667
2733
|
);
|
|
2668
2734
|
ImagePreview.displayName = "ImagePreview";
|
|
2669
|
-
var ImageThumbnails =
|
|
2670
|
-
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */
|
|
2735
|
+
var ImageThumbnails = React39.forwardRef(
|
|
2736
|
+
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ jsx40(
|
|
2671
2737
|
ToggleGroupPrimitive2.Root,
|
|
2672
2738
|
{
|
|
2673
2739
|
ref,
|
|
@@ -2679,17 +2745,17 @@ var ImageThumbnails = React38.forwardRef(
|
|
|
2679
2745
|
children: Array.from({ length: max }, (_, index) => {
|
|
2680
2746
|
const image = images[index];
|
|
2681
2747
|
if (!image) {
|
|
2682
|
-
return /* @__PURE__ */
|
|
2748
|
+
return /* @__PURE__ */ jsx40(
|
|
2683
2749
|
"span",
|
|
2684
2750
|
{
|
|
2685
2751
|
"aria-hidden": "true",
|
|
2686
2752
|
className: "flex h-20 min-w-0 flex-1 items-center justify-center rounded-sm border border-dashed border-border text-accent-foreground",
|
|
2687
|
-
children: /* @__PURE__ */
|
|
2753
|
+
children: /* @__PURE__ */ jsx40(ImageIcon, { size: 24 })
|
|
2688
2754
|
},
|
|
2689
2755
|
`empty-${index}`
|
|
2690
2756
|
);
|
|
2691
2757
|
}
|
|
2692
|
-
return /* @__PURE__ */
|
|
2758
|
+
return /* @__PURE__ */ jsx40(
|
|
2693
2759
|
ToggleGroupPrimitive2.Item,
|
|
2694
2760
|
{
|
|
2695
2761
|
value: image.id,
|
|
@@ -2699,7 +2765,7 @@ var ImageThumbnails = React38.forwardRef(
|
|
|
2699
2765
|
"hover:bg-accent-soft hover:bg-none",
|
|
2700
2766
|
"data-[state=on]:border-accent-foreground data-[state=on]:bg-accent-soft data-[state=on]:bg-none data-[state=on]:text-accent-foreground"
|
|
2701
2767
|
),
|
|
2702
|
-
children: image.src ? /* @__PURE__ */
|
|
2768
|
+
children: image.src ? /* @__PURE__ */ jsx40("img", { src: image.src, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx40(ImageIcon, { size: 24, "aria-hidden": true })
|
|
2703
2769
|
},
|
|
2704
2770
|
image.id
|
|
2705
2771
|
);
|
|
@@ -2712,13 +2778,13 @@ var formatTime = (seconds) => {
|
|
|
2712
2778
|
const total = Math.max(0, Math.floor(Number.isFinite(seconds) ? seconds : 0));
|
|
2713
2779
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
2714
2780
|
};
|
|
2715
|
-
var VideoPlayer =
|
|
2781
|
+
var VideoPlayer = React39.forwardRef(
|
|
2716
2782
|
({ className, src, name, details, onRemove, onMore, initialTime = 0, initialDuration = 0, ...props }, ref) => {
|
|
2717
|
-
const video =
|
|
2718
|
-
const [playing, setPlaying] =
|
|
2719
|
-
const [time, setTime] =
|
|
2720
|
-
const [duration, setDuration] =
|
|
2721
|
-
const [volume, setVolume] =
|
|
2783
|
+
const video = React39.useRef(null);
|
|
2784
|
+
const [playing, setPlaying] = React39.useState(false);
|
|
2785
|
+
const [time, setTime] = React39.useState(initialTime);
|
|
2786
|
+
const [duration, setDuration] = React39.useState(initialDuration);
|
|
2787
|
+
const [volume, setVolume] = React39.useState(1);
|
|
2722
2788
|
const muted = volume === 0;
|
|
2723
2789
|
const toggle2 = () => {
|
|
2724
2790
|
const el = video.current;
|
|
@@ -2726,9 +2792,9 @@ var VideoPlayer = React38.forwardRef(
|
|
|
2726
2792
|
if (el.paused) void el.play();
|
|
2727
2793
|
else el.pause();
|
|
2728
2794
|
};
|
|
2729
|
-
return /* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
src && /* @__PURE__ */
|
|
2795
|
+
return /* @__PURE__ */ jsxs30("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface", className), ...props, children: [
|
|
2796
|
+
/* @__PURE__ */ jsxs30("div", { className: "relative flex h-60.5 w-full items-end bg-accent-soft", children: [
|
|
2797
|
+
src && /* @__PURE__ */ jsx40(
|
|
2732
2798
|
"video",
|
|
2733
2799
|
{
|
|
2734
2800
|
ref: video,
|
|
@@ -2741,8 +2807,8 @@ var VideoPlayer = React38.forwardRef(
|
|
|
2741
2807
|
onVolumeChange: (event) => setVolume(event.currentTarget.muted ? 0 : event.currentTarget.volume)
|
|
2742
2808
|
}
|
|
2743
2809
|
),
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2810
|
+
/* @__PURE__ */ jsxs30("div", { className: "relative flex w-full flex-col gap-2 bg-surface-foreground bg-linear-to-r from-primary/30 to-primary/30 px-4 pt-3 pb-4 text-surface", children: [
|
|
2811
|
+
/* @__PURE__ */ jsxs30(
|
|
2746
2812
|
SliderPrimitive2.Root,
|
|
2747
2813
|
{
|
|
2748
2814
|
min: 0,
|
|
@@ -2756,31 +2822,31 @@ var VideoPlayer = React38.forwardRef(
|
|
|
2756
2822
|
},
|
|
2757
2823
|
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
2758
2824
|
children: [
|
|
2759
|
-
/* @__PURE__ */
|
|
2760
|
-
/* @__PURE__ */
|
|
2825
|
+
/* @__PURE__ */ jsx40(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx40(SliderPrimitive2.Range, { className: "absolute h-full bg-accent-foreground" }) }),
|
|
2826
|
+
/* @__PURE__ */ jsx40(SliderPrimitive2.Thumb, { "aria-label": "Seek", className: "block size-3 rounded-full border-2 border-surface bg-surface shadow-sm" })
|
|
2761
2827
|
]
|
|
2762
2828
|
}
|
|
2763
2829
|
),
|
|
2764
|
-
/* @__PURE__ */
|
|
2765
|
-
/* @__PURE__ */
|
|
2766
|
-
/* @__PURE__ */
|
|
2830
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between", children: [
|
|
2831
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-4", children: [
|
|
2832
|
+
/* @__PURE__ */ jsx40(
|
|
2767
2833
|
"button",
|
|
2768
2834
|
{
|
|
2769
2835
|
type: "button",
|
|
2770
2836
|
"aria-label": playing ? "Pause" : "Play",
|
|
2771
2837
|
onClick: toggle2,
|
|
2772
2838
|
className: "inline-flex size-10 items-center justify-center rounded-full bg-surface/12 text-surface transition-colors hover:bg-surface/20",
|
|
2773
|
-
children: playing ? /* @__PURE__ */
|
|
2839
|
+
children: playing ? /* @__PURE__ */ jsx40(Pause, { size: 16, weight: "fill", "aria-hidden": true }) : /* @__PURE__ */ jsx40(Play, { size: 16, weight: "fill", "aria-hidden": true })
|
|
2774
2840
|
}
|
|
2775
2841
|
),
|
|
2776
|
-
/* @__PURE__ */
|
|
2842
|
+
/* @__PURE__ */ jsxs30("span", { className: "text-ui-label whitespace-nowrap text-surface/80", children: [
|
|
2777
2843
|
formatTime(time),
|
|
2778
2844
|
" / ",
|
|
2779
2845
|
formatTime(duration)
|
|
2780
2846
|
] })
|
|
2781
2847
|
] }),
|
|
2782
|
-
/* @__PURE__ */
|
|
2783
|
-
/* @__PURE__ */
|
|
2848
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
2849
|
+
/* @__PURE__ */ jsx40(
|
|
2784
2850
|
VolumeControl,
|
|
2785
2851
|
{
|
|
2786
2852
|
volume,
|
|
@@ -2793,41 +2859,41 @@ var VideoPlayer = React38.forwardRef(
|
|
|
2793
2859
|
}
|
|
2794
2860
|
}
|
|
2795
2861
|
),
|
|
2796
|
-
/* @__PURE__ */
|
|
2862
|
+
/* @__PURE__ */ jsx40(
|
|
2797
2863
|
"button",
|
|
2798
2864
|
{
|
|
2799
2865
|
type: "button",
|
|
2800
2866
|
"aria-label": "Full screen",
|
|
2801
2867
|
onClick: () => void video.current?.requestFullscreen?.(),
|
|
2802
2868
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2803
|
-
children: /* @__PURE__ */
|
|
2869
|
+
children: /* @__PURE__ */ jsx40(CornersOut, { size: 16, "aria-hidden": true })
|
|
2804
2870
|
}
|
|
2805
2871
|
),
|
|
2806
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ jsx40(
|
|
2807
2873
|
"button",
|
|
2808
2874
|
{
|
|
2809
2875
|
type: "button",
|
|
2810
2876
|
"aria-label": "More",
|
|
2811
2877
|
onClick: onMore,
|
|
2812
2878
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2813
|
-
children: /* @__PURE__ */
|
|
2879
|
+
children: /* @__PURE__ */ jsx40(DotsThree, { size: 16, "aria-hidden": true })
|
|
2814
2880
|
}
|
|
2815
2881
|
)
|
|
2816
2882
|
] })
|
|
2817
2883
|
] })
|
|
2818
2884
|
] })
|
|
2819
2885
|
] }),
|
|
2820
|
-
name && /* @__PURE__ */
|
|
2821
|
-
/* @__PURE__ */
|
|
2886
|
+
name && /* @__PURE__ */ jsx40(MediaInfo, { name, details, onRemove }),
|
|
2887
|
+
/* @__PURE__ */ jsx40("span", { className: "sr-only", "aria-live": "polite", children: muted ? "Muted" : "" })
|
|
2822
2888
|
] });
|
|
2823
2889
|
}
|
|
2824
2890
|
);
|
|
2825
2891
|
VideoPlayer.displayName = "VideoPlayer";
|
|
2826
2892
|
function VolumeControl({ volume, onVolumeChange, className }) {
|
|
2827
|
-
const last =
|
|
2893
|
+
const last = React39.useRef(volume || 1);
|
|
2828
2894
|
if (volume > 0) last.current = volume;
|
|
2829
|
-
return /* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
2895
|
+
return /* @__PURE__ */ jsxs30("div", { className: cn("group/volume flex items-center", className), children: [
|
|
2896
|
+
/* @__PURE__ */ jsx40("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__ */ jsxs30(
|
|
2831
2897
|
SliderPrimitive2.Root,
|
|
2832
2898
|
{
|
|
2833
2899
|
min: 0,
|
|
@@ -2837,32 +2903,32 @@ function VolumeControl({ volume, onVolumeChange, className }) {
|
|
|
2837
2903
|
onValueChange: ([next]) => next !== void 0 && onVolumeChange(next),
|
|
2838
2904
|
className: "relative flex h-4 w-14 touch-none items-center select-none",
|
|
2839
2905
|
children: [
|
|
2840
|
-
/* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2906
|
+
/* @__PURE__ */ jsx40(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx40(SliderPrimitive2.Range, { className: "absolute h-full bg-surface" }) }),
|
|
2907
|
+
/* @__PURE__ */ jsx40(SliderPrimitive2.Thumb, { "aria-label": "Volume", className: "block size-3 rounded-full bg-surface shadow-sm" })
|
|
2842
2908
|
]
|
|
2843
2909
|
}
|
|
2844
2910
|
) }),
|
|
2845
|
-
/* @__PURE__ */
|
|
2911
|
+
/* @__PURE__ */ jsx40(
|
|
2846
2912
|
"button",
|
|
2847
2913
|
{
|
|
2848
2914
|
type: "button",
|
|
2849
2915
|
"aria-label": volume === 0 ? "Unmute" : "Mute",
|
|
2850
2916
|
onClick: () => onVolumeChange(volume === 0 ? last.current : 0),
|
|
2851
2917
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2852
|
-
children: volume === 0 ? /* @__PURE__ */
|
|
2918
|
+
children: volume === 0 ? /* @__PURE__ */ jsx40(SpeakerSimpleX, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx40(SpeakerSimpleHigh, { size: 16, "aria-hidden": true })
|
|
2853
2919
|
}
|
|
2854
2920
|
)
|
|
2855
2921
|
] });
|
|
2856
2922
|
}
|
|
2857
2923
|
|
|
2858
2924
|
// src/components/Question Types/OpenEndAnswer.tsx
|
|
2859
|
-
import * as
|
|
2860
|
-
import { jsx as
|
|
2861
|
-
var OpenEndAnswer =
|
|
2925
|
+
import * as React40 from "react";
|
|
2926
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2927
|
+
var OpenEndAnswer = React40.forwardRef(
|
|
2862
2928
|
({ value, defaultValue, onChange, maxLength = 1e3, placeholder = "Write your answer", ...props }, ref) => {
|
|
2863
|
-
const [internal, setInternal] =
|
|
2929
|
+
const [internal, setInternal] = React40.useState(String(defaultValue ?? ""));
|
|
2864
2930
|
const text = value !== void 0 ? String(value) : internal;
|
|
2865
|
-
return /* @__PURE__ */
|
|
2931
|
+
return /* @__PURE__ */ jsx41(
|
|
2866
2932
|
Textarea,
|
|
2867
2933
|
{
|
|
2868
2934
|
ref,
|
|
@@ -2882,10 +2948,10 @@ var OpenEndAnswer = React39.forwardRef(
|
|
|
2882
2948
|
OpenEndAnswer.displayName = "OpenEndAnswer";
|
|
2883
2949
|
|
|
2884
2950
|
// src/components/Question Types/QuestionCard.tsx
|
|
2885
|
-
import * as
|
|
2886
|
-
import { jsx as
|
|
2887
|
-
var QuestionCard =
|
|
2888
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2951
|
+
import * as React41 from "react";
|
|
2952
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
2953
|
+
var QuestionCard = React41.forwardRef(
|
|
2954
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx42(
|
|
2889
2955
|
"div",
|
|
2890
2956
|
{
|
|
2891
2957
|
ref,
|
|
@@ -2897,7 +2963,7 @@ var QuestionCard = React40.forwardRef(
|
|
|
2897
2963
|
QuestionCard.displayName = "QuestionCard";
|
|
2898
2964
|
|
|
2899
2965
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2900
|
-
import * as
|
|
2966
|
+
import * as React45 from "react";
|
|
2901
2967
|
import {
|
|
2902
2968
|
Clipboard,
|
|
2903
2969
|
Copy,
|
|
@@ -2917,15 +2983,18 @@ function keepEditingFocus(event) {
|
|
|
2917
2983
|
}
|
|
2918
2984
|
|
|
2919
2985
|
// src/components/Question Types/QuestionHeader.tsx
|
|
2920
|
-
import * as
|
|
2986
|
+
import * as React44 from "react";
|
|
2987
|
+
|
|
2988
|
+
// src/components/Question Types/QuestionNumberTag.tsx
|
|
2989
|
+
import * as React43 from "react";
|
|
2921
2990
|
import { DotsSixVertical } from "@phosphor-icons/react";
|
|
2922
2991
|
|
|
2923
2992
|
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
2924
2993
|
import "react";
|
|
2925
|
-
import { ChatsCircle, CheckSquare, FileArrowUp, FileText as FileText2, Image, ListNumbers, RadioButton, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
2926
|
-
import { jsx as
|
|
2994
|
+
import { ChatsCircle, CheckSquare, FileArrowUp, FileText as FileText2, Image, ListNumbers, RadioButton as RadioButton2, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
2995
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
2927
2996
|
var icons = {
|
|
2928
|
-
"select-one":
|
|
2997
|
+
"select-one": RadioButton2,
|
|
2929
2998
|
"select-multiple": CheckSquare,
|
|
2930
2999
|
ranking: ListNumbers,
|
|
2931
3000
|
upload: FileArrowUp,
|
|
@@ -2938,70 +3007,80 @@ var icons = {
|
|
|
2938
3007
|
};
|
|
2939
3008
|
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
2940
3009
|
const Icon = icons[type];
|
|
2941
|
-
return /* @__PURE__ */
|
|
3010
|
+
return /* @__PURE__ */ jsx43(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
2942
3011
|
}
|
|
2943
3012
|
|
|
3013
|
+
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3014
|
+
import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3015
|
+
var QuestionNumberTag = React43.forwardRef(
|
|
3016
|
+
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */ jsxs31(
|
|
3017
|
+
"span",
|
|
3018
|
+
{
|
|
3019
|
+
ref,
|
|
3020
|
+
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
3021
|
+
...props,
|
|
3022
|
+
...dragHandleProps,
|
|
3023
|
+
className: cn(
|
|
3024
|
+
"group/handle inline-flex h-6 shrink-0 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
3025
|
+
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered. With a type icon the grip
|
|
3026
|
+
// takes the icon's place, so the tag keeps its padding and its width.
|
|
3027
|
+
showDragHandle && !questionType && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
3028
|
+
active ? "bg-accent-soft text-accent-soft-foreground" : "bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground",
|
|
3029
|
+
dragHandleProps && "cursor-grab touch-none select-none",
|
|
3030
|
+
dragHandleProps && showDragHandle && !questionType && "focus-visible:pl-1",
|
|
3031
|
+
className,
|
|
3032
|
+
dragHandleProps?.className
|
|
3033
|
+
),
|
|
3034
|
+
children: [
|
|
3035
|
+
questionType && /* @__PURE__ */ jsx44(
|
|
3036
|
+
QuestionTypeIcon,
|
|
3037
|
+
{
|
|
3038
|
+
type: questionType,
|
|
3039
|
+
size: 16,
|
|
3040
|
+
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3041
|
+
}
|
|
3042
|
+
),
|
|
3043
|
+
showDragHandle && /* @__PURE__ */ jsx44(
|
|
3044
|
+
DotsSixVertical,
|
|
3045
|
+
{
|
|
3046
|
+
size: 16,
|
|
3047
|
+
"aria-hidden": true,
|
|
3048
|
+
className: "hidden shrink-0 group-hover/editor:block group-data-[hovered]/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
3049
|
+
}
|
|
3050
|
+
),
|
|
3051
|
+
"Question ",
|
|
3052
|
+
number
|
|
3053
|
+
]
|
|
3054
|
+
}
|
|
3055
|
+
)
|
|
3056
|
+
);
|
|
3057
|
+
QuestionNumberTag.displayName = "QuestionNumberTag";
|
|
3058
|
+
|
|
2944
3059
|
// src/components/Question Types/QuestionHeader.tsx
|
|
2945
|
-
import { jsx as
|
|
3060
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2946
3061
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2947
|
-
var QuestionHeader =
|
|
3062
|
+
var QuestionHeader = React44.forwardRef(
|
|
2948
3063
|
({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, titleRecommendedMax, titleRecommendedNote, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, questionType, titleMarks, onTitleMarkApply, onTitleMarkDismiss, ...props }, ref) => {
|
|
2949
|
-
const [draft, setDraft] =
|
|
3064
|
+
const [draft, setDraft] = React44.useState(null);
|
|
2950
3065
|
const label = String(number).padStart(2, "0");
|
|
2951
3066
|
const showError = error !== void 0 && error !== false;
|
|
2952
3067
|
if (editor) {
|
|
2953
3068
|
const text = typeof title === "string" ? title : "";
|
|
2954
3069
|
const count = (draft ?? text).length;
|
|
2955
3070
|
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
2956
|
-
return /* @__PURE__ */
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
2960
|
-
"span",
|
|
2961
|
-
{
|
|
2962
|
-
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
2963
|
-
...dragHandleProps,
|
|
2964
|
-
className: cn(
|
|
2965
|
-
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
2966
|
-
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered. With a type icon the grip
|
|
2967
|
-
// takes the icon's place, so the tag keeps its padding and its width.
|
|
2968
|
-
showDragHandle && !questionType && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
2969
|
-
active ? "bg-accent-soft text-accent-soft-foreground" : "bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground",
|
|
2970
|
-
dragHandleProps && "cursor-grab touch-none select-none",
|
|
2971
|
-
dragHandleProps && showDragHandle && !questionType && "focus-visible:pl-1",
|
|
2972
|
-
dragHandleProps?.className
|
|
2973
|
-
),
|
|
2974
|
-
children: [
|
|
2975
|
-
questionType && /* @__PURE__ */ jsx43(
|
|
2976
|
-
QuestionTypeIcon,
|
|
2977
|
-
{
|
|
2978
|
-
type: questionType,
|
|
2979
|
-
size: 16,
|
|
2980
|
-
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
2981
|
-
}
|
|
2982
|
-
),
|
|
2983
|
-
showDragHandle && /* @__PURE__ */ jsx43(
|
|
2984
|
-
DotsSixVertical,
|
|
2985
|
-
{
|
|
2986
|
-
size: 16,
|
|
2987
|
-
"aria-hidden": true,
|
|
2988
|
-
className: "hidden shrink-0 group-hover/editor:block group-data-[hovered]/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
2989
|
-
}
|
|
2990
|
-
),
|
|
2991
|
-
"Question ",
|
|
2992
|
-
number
|
|
2993
|
-
]
|
|
2994
|
-
}
|
|
2995
|
-
),
|
|
3071
|
+
return /* @__PURE__ */ jsxs32("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
3072
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between", children: [
|
|
3073
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-2", children: [
|
|
3074
|
+
/* @__PURE__ */ jsx45(QuestionNumberTag, { number, active, questionType, showDragHandle, dragHandleProps }),
|
|
2996
3075
|
meta
|
|
2997
3076
|
] }),
|
|
2998
|
-
actions && /* @__PURE__ */
|
|
3077
|
+
actions && /* @__PURE__ */ jsx45("div", { className: cn(
|
|
2999
3078
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
3000
3079
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
3001
3080
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
3002
3081
|
), children: actions })
|
|
3003
3082
|
] }),
|
|
3004
|
-
/* @__PURE__ */
|
|
3083
|
+
/* @__PURE__ */ jsx45(
|
|
3005
3084
|
InlineEdit,
|
|
3006
3085
|
{
|
|
3007
3086
|
variant: "question",
|
|
@@ -3026,8 +3105,8 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3026
3105
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
3027
3106
|
}
|
|
3028
3107
|
),
|
|
3029
|
-
long && titleRecommendedNote != null && /* @__PURE__ */
|
|
3030
|
-
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */
|
|
3108
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ jsx45("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
3109
|
+
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs32("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3031
3110
|
count,
|
|
3032
3111
|
"/",
|
|
3033
3112
|
maxLength,
|
|
@@ -3035,16 +3114,16 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3035
3114
|
] })
|
|
3036
3115
|
] });
|
|
3037
3116
|
}
|
|
3038
|
-
return /* @__PURE__ */
|
|
3039
|
-
showError && /* @__PURE__ */
|
|
3040
|
-
/* @__PURE__ */
|
|
3117
|
+
return /* @__PURE__ */ jsxs32("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3118
|
+
showError && /* @__PURE__ */ jsx45(ToastInline, { variant: "destructive", onClose: onDismissError, className: "min-h-10", children: /* @__PURE__ */ jsx45("span", { className: "text-ui-label text-destructive", children: error === true ? "This question is mandatory." : error }) }),
|
|
3119
|
+
/* @__PURE__ */ jsxs32("p", { className: eyebrow, children: [
|
|
3041
3120
|
"Question ",
|
|
3042
3121
|
label
|
|
3043
3122
|
] }),
|
|
3044
|
-
/* @__PURE__ */
|
|
3123
|
+
/* @__PURE__ */ jsxs32("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
3045
3124
|
title,
|
|
3046
|
-
required && /* @__PURE__ */
|
|
3047
|
-
required && /* @__PURE__ */
|
|
3125
|
+
required && /* @__PURE__ */ jsx45("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
3126
|
+
required && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: " (required)" })
|
|
3048
3127
|
] })
|
|
3049
3128
|
] });
|
|
3050
3129
|
}
|
|
@@ -3052,8 +3131,8 @@ var QuestionHeader = React42.forwardRef(
|
|
|
3052
3131
|
QuestionHeader.displayName = "QuestionHeader";
|
|
3053
3132
|
|
|
3054
3133
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3055
|
-
import { Fragment as
|
|
3056
|
-
var QuestionEditorCard =
|
|
3134
|
+
import { Fragment as Fragment11, jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3135
|
+
var QuestionEditorCard = React45.forwardRef(
|
|
3057
3136
|
({
|
|
3058
3137
|
className,
|
|
3059
3138
|
number,
|
|
@@ -3088,7 +3167,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3088
3167
|
...props
|
|
3089
3168
|
}, ref) => {
|
|
3090
3169
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
3091
|
-
return /* @__PURE__ */
|
|
3170
|
+
return /* @__PURE__ */ jsxs33(
|
|
3092
3171
|
"div",
|
|
3093
3172
|
{
|
|
3094
3173
|
ref,
|
|
@@ -3100,7 +3179,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3100
3179
|
props.onMouseDown?.(event);
|
|
3101
3180
|
},
|
|
3102
3181
|
children: [
|
|
3103
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ jsxs33(
|
|
3104
3183
|
"div",
|
|
3105
3184
|
{
|
|
3106
3185
|
className: cn(
|
|
@@ -3108,9 +3187,9 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3108
3187
|
active ? "border-accent" : "border-border"
|
|
3109
3188
|
),
|
|
3110
3189
|
children: [
|
|
3111
|
-
/* @__PURE__ */
|
|
3112
|
-
/* @__PURE__ */
|
|
3113
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsxs33("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
3191
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-4", children: [
|
|
3192
|
+
/* @__PURE__ */ jsx46(
|
|
3114
3193
|
QuestionHeader,
|
|
3115
3194
|
{
|
|
3116
3195
|
editor: true,
|
|
@@ -3132,8 +3211,8 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3132
3211
|
onTitleMarkDismiss,
|
|
3133
3212
|
meta,
|
|
3134
3213
|
maxLength,
|
|
3135
|
-
actions: actions ?? /* @__PURE__ */
|
|
3136
|
-
/* @__PURE__ */
|
|
3214
|
+
actions: actions ?? /* @__PURE__ */ jsxs33(Fragment11, { children: [
|
|
3215
|
+
/* @__PURE__ */ jsx46(
|
|
3137
3216
|
Button,
|
|
3138
3217
|
{
|
|
3139
3218
|
type: "button",
|
|
@@ -3141,10 +3220,10 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3141
3220
|
size: "icon-sm",
|
|
3142
3221
|
"aria-label": "Duplicate question",
|
|
3143
3222
|
onClick: onDuplicate,
|
|
3144
|
-
children: /* @__PURE__ */
|
|
3223
|
+
children: /* @__PURE__ */ jsx46(Copy, { size: 16, "aria-hidden": true })
|
|
3145
3224
|
}
|
|
3146
3225
|
),
|
|
3147
|
-
/* @__PURE__ */
|
|
3226
|
+
/* @__PURE__ */ jsx46(
|
|
3148
3227
|
Button,
|
|
3149
3228
|
{
|
|
3150
3229
|
type: "button",
|
|
@@ -3152,10 +3231,10 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3152
3231
|
size: "icon-sm",
|
|
3153
3232
|
"aria-label": "Delete question",
|
|
3154
3233
|
onClick: onDelete,
|
|
3155
|
-
children: /* @__PURE__ */
|
|
3234
|
+
children: /* @__PURE__ */ jsx46(Trash4, { size: 16, "aria-hidden": true })
|
|
3156
3235
|
}
|
|
3157
3236
|
),
|
|
3158
|
-
/* @__PURE__ */
|
|
3237
|
+
/* @__PURE__ */ jsx46(
|
|
3159
3238
|
Button,
|
|
3160
3239
|
{
|
|
3161
3240
|
type: "button",
|
|
@@ -3163,7 +3242,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3163
3242
|
size: "icon-sm",
|
|
3164
3243
|
"aria-label": "Preview question",
|
|
3165
3244
|
onClick: onPreview,
|
|
3166
|
-
children: /* @__PURE__ */
|
|
3245
|
+
children: /* @__PURE__ */ jsx46(Eye, { size: 16, "aria-hidden": true })
|
|
3167
3246
|
}
|
|
3168
3247
|
)
|
|
3169
3248
|
] })
|
|
@@ -3171,18 +3250,18 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3171
3250
|
),
|
|
3172
3251
|
children
|
|
3173
3252
|
] }),
|
|
3174
|
-
error && /* @__PURE__ */
|
|
3175
|
-
/* @__PURE__ */
|
|
3253
|
+
error && /* @__PURE__ */ jsxs33("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3254
|
+
/* @__PURE__ */ jsx46(Warning2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3176
3255
|
error
|
|
3177
3256
|
] }),
|
|
3178
|
-
footer && /* @__PURE__ */
|
|
3179
|
-
/* @__PURE__ */
|
|
3180
|
-
/* @__PURE__ */
|
|
3181
|
-
onAdd && /* @__PURE__ */
|
|
3182
|
-
/* @__PURE__ */
|
|
3257
|
+
footer && /* @__PURE__ */ jsxs33("div", { className: "flex items-center justify-between", children: [
|
|
3258
|
+
/* @__PURE__ */ jsx46("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3259
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
|
|
3260
|
+
onAdd && /* @__PURE__ */ jsxs33(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3261
|
+
/* @__PURE__ */ jsx46(Plus3, { size: 16, "aria-hidden": true }),
|
|
3183
3262
|
"Add choice"
|
|
3184
3263
|
] }),
|
|
3185
|
-
onPaste && /* @__PURE__ */
|
|
3264
|
+
onPaste && /* @__PURE__ */ jsx46(
|
|
3186
3265
|
Button,
|
|
3187
3266
|
{
|
|
3188
3267
|
type: "button",
|
|
@@ -3190,17 +3269,17 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3190
3269
|
size: "icon",
|
|
3191
3270
|
"aria-label": "Paste choices",
|
|
3192
3271
|
onClick: onPaste,
|
|
3193
|
-
children: /* @__PURE__ */
|
|
3272
|
+
children: /* @__PURE__ */ jsx46(Clipboard, { size: 16, "aria-hidden": true })
|
|
3194
3273
|
}
|
|
3195
3274
|
)
|
|
3196
3275
|
] })
|
|
3197
3276
|
] })
|
|
3198
3277
|
] }),
|
|
3199
|
-
note && /* @__PURE__ */
|
|
3278
|
+
note && /* @__PURE__ */ jsx46("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
3200
3279
|
]
|
|
3201
3280
|
}
|
|
3202
3281
|
),
|
|
3203
|
-
onAskAi && /* @__PURE__ */
|
|
3282
|
+
onAskAi && /* @__PURE__ */ jsx46(
|
|
3204
3283
|
Button,
|
|
3205
3284
|
{
|
|
3206
3285
|
type: "button",
|
|
@@ -3209,7 +3288,7 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3209
3288
|
"aria-label": "Ask AI",
|
|
3210
3289
|
onClick: onAskAi,
|
|
3211
3290
|
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",
|
|
3212
|
-
children: /* @__PURE__ */
|
|
3291
|
+
children: /* @__PURE__ */ jsx46(Sparkle2, { size: 16, "aria-hidden": true })
|
|
3213
3292
|
}
|
|
3214
3293
|
)
|
|
3215
3294
|
]
|
|
@@ -3220,15 +3299,15 @@ var QuestionEditorCard = React43.forwardRef(
|
|
|
3220
3299
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
3221
3300
|
|
|
3222
3301
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
3223
|
-
import * as
|
|
3224
|
-
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3, WarningCircle as
|
|
3302
|
+
import * as React46 from "react";
|
|
3303
|
+
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3, WarningCircle as WarningCircle5 } from "@phosphor-icons/react";
|
|
3225
3304
|
import { Slot as Slot3 } from "radix-ui";
|
|
3226
|
-
import { jsx as
|
|
3227
|
-
var QuestionNavItem =
|
|
3305
|
+
import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3306
|
+
var QuestionNavItem = React46.forwardRef(
|
|
3228
3307
|
({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3229
3308
|
const Comp = asChild ? Slot3.Root : "button";
|
|
3230
3309
|
const warn = !error && !!warning;
|
|
3231
|
-
return /* @__PURE__ */
|
|
3310
|
+
return /* @__PURE__ */ jsxs34(
|
|
3232
3311
|
Comp,
|
|
3233
3312
|
{
|
|
3234
3313
|
ref,
|
|
@@ -3247,9 +3326,9 @@ var QuestionNavItem = React44.forwardRef(
|
|
|
3247
3326
|
),
|
|
3248
3327
|
...props,
|
|
3249
3328
|
children: [
|
|
3250
|
-
/* @__PURE__ */
|
|
3251
|
-
showDragHandle && /* @__PURE__ */
|
|
3252
|
-
/* @__PURE__ */
|
|
3329
|
+
/* @__PURE__ */ jsxs34("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3330
|
+
showDragHandle && /* @__PURE__ */ jsx47(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3331
|
+
/* @__PURE__ */ jsx47("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx47(WarningCircle5, { size: 16, className: "text-destructive-foreground" }) : warn ? /* @__PURE__ */ jsx47(Warning3, { size: 16, className: "text-warning-foreground" }) : /* @__PURE__ */ jsx47(
|
|
3253
3332
|
QuestionTypeIcon,
|
|
3254
3333
|
{
|
|
3255
3334
|
type: questionType,
|
|
@@ -3258,9 +3337,9 @@ var QuestionNavItem = React44.forwardRef(
|
|
|
3258
3337
|
}
|
|
3259
3338
|
) })
|
|
3260
3339
|
] }),
|
|
3261
|
-
/* @__PURE__ */
|
|
3262
|
-
error && /* @__PURE__ */
|
|
3263
|
-
warn && /* @__PURE__ */
|
|
3340
|
+
/* @__PURE__ */ jsx47("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3341
|
+
error && /* @__PURE__ */ jsx47("span", { className: "sr-only", children: ", has errors" }),
|
|
3342
|
+
warn && /* @__PURE__ */ jsx47("span", { className: "sr-only", children: ", has warnings" })
|
|
3264
3343
|
]
|
|
3265
3344
|
}
|
|
3266
3345
|
);
|
|
@@ -3269,14 +3348,14 @@ var QuestionNavItem = React44.forwardRef(
|
|
|
3269
3348
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
3270
3349
|
|
|
3271
3350
|
// src/components/Question Types/QuestionOption.tsx
|
|
3272
|
-
import * as
|
|
3273
|
-
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as
|
|
3274
|
-
import { Fragment as
|
|
3351
|
+
import * as React47 from "react";
|
|
3352
|
+
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle6 } from "@phosphor-icons/react";
|
|
3353
|
+
import { Fragment as Fragment12, jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3275
3354
|
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";
|
|
3276
3355
|
function QuestionOption(props) {
|
|
3277
|
-
const id =
|
|
3278
|
-
return /* @__PURE__ */
|
|
3279
|
-
props.kind === "checkbox" ? /* @__PURE__ */
|
|
3356
|
+
const id = React47.useId();
|
|
3357
|
+
return /* @__PURE__ */ jsxs35("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3358
|
+
props.kind === "checkbox" ? /* @__PURE__ */ jsx48(
|
|
3280
3359
|
Checkbox,
|
|
3281
3360
|
{
|
|
3282
3361
|
id,
|
|
@@ -3285,16 +3364,16 @@ function QuestionOption(props) {
|
|
|
3285
3364
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
3286
3365
|
disabled: props.disabled
|
|
3287
3366
|
}
|
|
3288
|
-
) : /* @__PURE__ */
|
|
3289
|
-
/* @__PURE__ */
|
|
3367
|
+
) : /* @__PURE__ */ jsx48(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3368
|
+
/* @__PURE__ */ jsx48("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3290
3369
|
] });
|
|
3291
3370
|
}
|
|
3292
|
-
var QuestionOtherOption =
|
|
3371
|
+
var QuestionOtherOption = React47.forwardRef(
|
|
3293
3372
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3294
|
-
const inner =
|
|
3295
|
-
|
|
3373
|
+
const inner = React47.useRef(null);
|
|
3374
|
+
React47.useImperativeHandle(ref, () => inner.current);
|
|
3296
3375
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3297
|
-
return /* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ jsxs35(
|
|
3298
3377
|
"div",
|
|
3299
3378
|
{
|
|
3300
3379
|
className: cn(
|
|
@@ -3302,7 +3381,7 @@ var QuestionOtherOption = React45.forwardRef(
|
|
|
3302
3381
|
className
|
|
3303
3382
|
),
|
|
3304
3383
|
children: [
|
|
3305
|
-
/* @__PURE__ */
|
|
3384
|
+
/* @__PURE__ */ jsx48(
|
|
3306
3385
|
"input",
|
|
3307
3386
|
{
|
|
3308
3387
|
ref: inner,
|
|
@@ -3318,7 +3397,7 @@ var QuestionOtherOption = React45.forwardRef(
|
|
|
3318
3397
|
...props
|
|
3319
3398
|
}
|
|
3320
3399
|
),
|
|
3321
|
-
/* @__PURE__ */
|
|
3400
|
+
/* @__PURE__ */ jsx48(Button, { type: "button", variant: "subtle", size: "icon-sm", "aria-label": confirmLabel, onClick: submit, children: /* @__PURE__ */ jsx48(Check4, { size: 16, "aria-hidden": true }) })
|
|
3322
3401
|
]
|
|
3323
3402
|
}
|
|
3324
3403
|
);
|
|
@@ -3333,16 +3412,16 @@ function limitsText2(min, max) {
|
|
|
3333
3412
|
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3334
3413
|
const reveal = kind !== void 0;
|
|
3335
3414
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3336
|
-
const [draft, setDraft] =
|
|
3337
|
-
const [error, setError] =
|
|
3338
|
-
const helperId =
|
|
3339
|
-
const [focused, setFocused] =
|
|
3415
|
+
const [draft, setDraft] = React47.useState(null);
|
|
3416
|
+
const [error, setError] = React47.useState(null);
|
|
3417
|
+
const helperId = React47.useId();
|
|
3418
|
+
const [focused, setFocused] = React47.useState(false);
|
|
3340
3419
|
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3341
|
-
const fieldRef =
|
|
3342
|
-
const [editMarks, setEditMarks] =
|
|
3343
|
-
const [scroll, setScroll] =
|
|
3420
|
+
const fieldRef = React47.useRef(null);
|
|
3421
|
+
const [editMarks, setEditMarks] = React47.useState([]);
|
|
3422
|
+
const [scroll, setScroll] = React47.useState(0);
|
|
3344
3423
|
const typed = guarded ? draft ?? label : label;
|
|
3345
|
-
const skipBlur =
|
|
3424
|
+
const skipBlur = React47.useRef(false);
|
|
3346
3425
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3347
3426
|
const save = () => {
|
|
3348
3427
|
if (draft === null) return true;
|
|
@@ -3363,9 +3442,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3363
3442
|
...dragHandleProps,
|
|
3364
3443
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3365
3444
|
} : { "aria-hidden": true };
|
|
3366
|
-
const grip = dragHandleProps ? /* @__PURE__ */
|
|
3367
|
-
return /* @__PURE__ */
|
|
3368
|
-
/* @__PURE__ */
|
|
3445
|
+
const grip = dragHandleProps ? /* @__PURE__ */ jsx48("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ jsx48(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ jsx48(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
|
|
3446
|
+
return /* @__PURE__ */ jsxs35("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3447
|
+
/* @__PURE__ */ jsx48(
|
|
3369
3448
|
"div",
|
|
3370
3449
|
{
|
|
3371
3450
|
className: cn(
|
|
@@ -3375,10 +3454,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3375
3454
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3376
3455
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3377
3456
|
),
|
|
3378
|
-
children: /* @__PURE__ */
|
|
3379
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */
|
|
3457
|
+
children: /* @__PURE__ */ jsxs35("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3458
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ jsx48("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ jsxs35(Fragment12, { children: [
|
|
3380
3459
|
!locked && grip,
|
|
3381
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ jsx48(
|
|
3382
3461
|
"span",
|
|
3383
3462
|
{
|
|
3384
3463
|
"aria-hidden": "true",
|
|
@@ -3386,8 +3465,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3386
3465
|
children: rank
|
|
3387
3466
|
}
|
|
3388
3467
|
)
|
|
3389
|
-
] }) : reveal && locked ? /* @__PURE__ */
|
|
3390
|
-
/* @__PURE__ */
|
|
3468
|
+
] }) : reveal && locked ? /* @__PURE__ */ jsx48("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx48("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ jsxs35("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
|
|
3469
|
+
/* @__PURE__ */ jsx48(
|
|
3391
3470
|
"span",
|
|
3392
3471
|
{
|
|
3393
3472
|
"aria-hidden": "true",
|
|
@@ -3398,7 +3477,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3398
3477
|
)
|
|
3399
3478
|
}
|
|
3400
3479
|
),
|
|
3401
|
-
/* @__PURE__ */
|
|
3480
|
+
/* @__PURE__ */ jsx48(
|
|
3402
3481
|
DotsSixVertical3,
|
|
3403
3482
|
{
|
|
3404
3483
|
size: 20,
|
|
@@ -3410,10 +3489,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3410
3489
|
}
|
|
3411
3490
|
)
|
|
3412
3491
|
] }) : locked ? null : grip }),
|
|
3413
|
-
/* @__PURE__ */
|
|
3414
|
-
/* @__PURE__ */
|
|
3415
|
-
focused && editMarks.length > 0 && /* @__PURE__ */
|
|
3416
|
-
/* @__PURE__ */
|
|
3492
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3493
|
+
/* @__PURE__ */ jsxs35("div", { className: "relative min-w-0", children: [
|
|
3494
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ jsx48(DraftMarks, { layer: "behind", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3495
|
+
/* @__PURE__ */ jsx48(
|
|
3417
3496
|
"input",
|
|
3418
3497
|
{
|
|
3419
3498
|
ref: fieldRef,
|
|
@@ -3468,24 +3547,24 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3468
3547
|
)
|
|
3469
3548
|
}
|
|
3470
3549
|
),
|
|
3471
|
-
focused && editMarks.length > 0 && /* @__PURE__ */
|
|
3472
|
-
showMarks && /* @__PURE__ */
|
|
3473
|
-
(piece, i) => piece.mark ? /* @__PURE__ */
|
|
3550
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ jsx48(DraftMarks, { layer: "over", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3551
|
+
showMarks && /* @__PURE__ */ jsx48("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(
|
|
3552
|
+
(piece, i) => piece.mark ? /* @__PURE__ */ jsx48(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : /* @__PURE__ */ jsx48("span", { children: piece.text }, i)
|
|
3474
3553
|
) })
|
|
3475
3554
|
] }),
|
|
3476
|
-
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */
|
|
3555
|
+
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ jsxs35(
|
|
3477
3556
|
"p",
|
|
3478
3557
|
{
|
|
3479
3558
|
id: helperId,
|
|
3480
3559
|
role: error ? "alert" : void 0,
|
|
3481
3560
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3482
3561
|
children: [
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
error && /* @__PURE__ */
|
|
3562
|
+
/* @__PURE__ */ jsxs35("span", { className: "flex items-start gap-2", children: [
|
|
3563
|
+
error && /* @__PURE__ */ jsx48(WarningCircle6, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3485
3564
|
limitsText2(minLength, maxLength),
|
|
3486
|
-
error && /* @__PURE__ */
|
|
3565
|
+
error && /* @__PURE__ */ jsx48("span", { className: "sr-only", children: error })
|
|
3487
3566
|
] }),
|
|
3488
|
-
/* @__PURE__ */
|
|
3567
|
+
/* @__PURE__ */ jsxs35("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3489
3568
|
draft.length,
|
|
3490
3569
|
maxLength !== void 0 && `/${maxLength}`
|
|
3491
3570
|
] })
|
|
@@ -3496,7 +3575,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3496
3575
|
] })
|
|
3497
3576
|
}
|
|
3498
3577
|
),
|
|
3499
|
-
!locked && /* @__PURE__ */
|
|
3578
|
+
!locked && /* @__PURE__ */ jsxs35(
|
|
3500
3579
|
"div",
|
|
3501
3580
|
{
|
|
3502
3581
|
className: cn(
|
|
@@ -3504,8 +3583,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3504
3583
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3505
3584
|
),
|
|
3506
3585
|
children: [
|
|
3507
|
-
/* @__PURE__ */
|
|
3508
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsx48(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", disabled: removeDisabled, onClick: onRemove, children: /* @__PURE__ */ jsx48(Trash5, { size: 16, "aria-hidden": true }) }),
|
|
3587
|
+
/* @__PURE__ */ jsx48(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", disabled: addDisabled, onClick: onAdd, children: /* @__PURE__ */ jsx48(Plus4, { size: 16, "aria-hidden": true }) })
|
|
3509
3588
|
]
|
|
3510
3589
|
}
|
|
3511
3590
|
)
|
|
@@ -3513,9 +3592,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3513
3592
|
}
|
|
3514
3593
|
|
|
3515
3594
|
// src/components/Question Types/RankList.tsx
|
|
3516
|
-
import * as
|
|
3595
|
+
import * as React48 from "react";
|
|
3517
3596
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
3518
|
-
import { Fragment as
|
|
3597
|
+
import { Fragment as Fragment13, jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3519
3598
|
function move(list, from, to) {
|
|
3520
3599
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3521
3600
|
const next = list.slice();
|
|
@@ -3523,13 +3602,13 @@ function move(list, from, to) {
|
|
|
3523
3602
|
next.splice(to, 0, item);
|
|
3524
3603
|
return next;
|
|
3525
3604
|
}
|
|
3526
|
-
var RankList =
|
|
3605
|
+
var RankList = React48.forwardRef(
|
|
3527
3606
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3528
|
-
const [dragIndex, setDragIndex] =
|
|
3529
|
-
const [announcement, setAnnouncement] =
|
|
3530
|
-
const handles =
|
|
3531
|
-
const refocus =
|
|
3532
|
-
|
|
3607
|
+
const [dragIndex, setDragIndex] = React48.useState(null);
|
|
3608
|
+
const [announcement, setAnnouncement] = React48.useState("");
|
|
3609
|
+
const handles = React48.useRef(/* @__PURE__ */ new Map());
|
|
3610
|
+
const refocus = React48.useRef(null);
|
|
3611
|
+
React48.useEffect(() => {
|
|
3533
3612
|
if (refocus.current) {
|
|
3534
3613
|
handles.current.get(refocus.current)?.focus();
|
|
3535
3614
|
refocus.current = null;
|
|
@@ -3542,8 +3621,8 @@ var RankList = React46.forwardRef(
|
|
|
3542
3621
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3543
3622
|
onItemsChange(next);
|
|
3544
3623
|
};
|
|
3545
|
-
return /* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3624
|
+
return /* @__PURE__ */ jsxs36(Fragment13, { children: [
|
|
3625
|
+
/* @__PURE__ */ jsx49("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs36(
|
|
3547
3626
|
"li",
|
|
3548
3627
|
{
|
|
3549
3628
|
draggable: true,
|
|
@@ -3560,7 +3639,7 @@ var RankList = React46.forwardRef(
|
|
|
3560
3639
|
dragIndex === index && "opacity-50"
|
|
3561
3640
|
),
|
|
3562
3641
|
children: [
|
|
3563
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsx49(
|
|
3564
3643
|
"button",
|
|
3565
3644
|
{
|
|
3566
3645
|
type: "button",
|
|
@@ -3579,10 +3658,10 @@ var RankList = React46.forwardRef(
|
|
|
3579
3658
|
}
|
|
3580
3659
|
},
|
|
3581
3660
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3582
|
-
children: /* @__PURE__ */
|
|
3661
|
+
children: /* @__PURE__ */ jsx49(DotsSixVertical4, { size: 16, "aria-hidden": true })
|
|
3583
3662
|
}
|
|
3584
3663
|
),
|
|
3585
|
-
/* @__PURE__ */
|
|
3664
|
+
/* @__PURE__ */ jsx49(
|
|
3586
3665
|
"span",
|
|
3587
3666
|
{
|
|
3588
3667
|
"aria-hidden": "true",
|
|
@@ -3590,27 +3669,27 @@ var RankList = React46.forwardRef(
|
|
|
3590
3669
|
children: index + 1
|
|
3591
3670
|
}
|
|
3592
3671
|
),
|
|
3593
|
-
/* @__PURE__ */
|
|
3672
|
+
/* @__PURE__ */ jsx49("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3594
3673
|
]
|
|
3595
3674
|
},
|
|
3596
3675
|
item.id
|
|
3597
3676
|
)) }),
|
|
3598
|
-
/* @__PURE__ */
|
|
3677
|
+
/* @__PURE__ */ jsx49("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3599
3678
|
] });
|
|
3600
3679
|
}
|
|
3601
3680
|
);
|
|
3602
3681
|
RankList.displayName = "RankList";
|
|
3603
3682
|
|
|
3604
3683
|
// src/components/Question Types/RatingScale.tsx
|
|
3605
|
-
import * as
|
|
3684
|
+
import * as React49 from "react";
|
|
3606
3685
|
import { ToggleGroup as ToggleGroupPrimitive3 } from "radix-ui";
|
|
3607
|
-
import { jsx as
|
|
3608
|
-
var RatingScale =
|
|
3686
|
+
import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3687
|
+
var RatingScale = React49.forwardRef(
|
|
3609
3688
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3610
|
-
const [internal, setInternal] =
|
|
3689
|
+
const [internal, setInternal] = React49.useState(defaultValue);
|
|
3611
3690
|
const current = value !== void 0 ? value : internal;
|
|
3612
|
-
return /* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3691
|
+
return /* @__PURE__ */ jsxs37("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3692
|
+
/* @__PURE__ */ jsx50(
|
|
3614
3693
|
ToggleGroupPrimitive3.Root,
|
|
3615
3694
|
{
|
|
3616
3695
|
ref,
|
|
@@ -3623,7 +3702,7 @@ var RatingScale = React47.forwardRef(
|
|
|
3623
3702
|
},
|
|
3624
3703
|
className: "flex gap-2",
|
|
3625
3704
|
...props,
|
|
3626
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */
|
|
3705
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsx50(
|
|
3627
3706
|
ToggleGroupPrimitive3.Item,
|
|
3628
3707
|
{
|
|
3629
3708
|
value: String(n),
|
|
@@ -3639,9 +3718,9 @@ var RatingScale = React47.forwardRef(
|
|
|
3639
3718
|
))
|
|
3640
3719
|
}
|
|
3641
3720
|
),
|
|
3642
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */
|
|
3643
|
-
/* @__PURE__ */
|
|
3644
|
-
/* @__PURE__ */
|
|
3721
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ jsxs37("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3722
|
+
/* @__PURE__ */ jsx50("span", { children: lowLabel }),
|
|
3723
|
+
/* @__PURE__ */ jsx50("span", { children: highLabel })
|
|
3645
3724
|
] })
|
|
3646
3725
|
] });
|
|
3647
3726
|
}
|
|
@@ -3649,12 +3728,12 @@ var RatingScale = React47.forwardRef(
|
|
|
3649
3728
|
RatingScale.displayName = "RatingScale";
|
|
3650
3729
|
|
|
3651
3730
|
// src/components/Question Types/StimulusCard.tsx
|
|
3652
|
-
import * as
|
|
3731
|
+
import * as React50 from "react";
|
|
3653
3732
|
import { Image as ImageIcon2, ImageBroken, Trash as Trash6 } from "@phosphor-icons/react";
|
|
3654
|
-
import { jsx as
|
|
3733
|
+
import { jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3655
3734
|
var MIN_THUMBNAIL = 92;
|
|
3656
3735
|
var MAX_THUMBNAIL = 240;
|
|
3657
|
-
var StimulusCard =
|
|
3736
|
+
var StimulusCard = React50.forwardRef(
|
|
3658
3737
|
({
|
|
3659
3738
|
className,
|
|
3660
3739
|
thumbnail,
|
|
@@ -3671,14 +3750,14 @@ var StimulusCard = React48.forwardRef(
|
|
|
3671
3750
|
removeLabel = "Remove stimulus",
|
|
3672
3751
|
...props
|
|
3673
3752
|
}, ref) => {
|
|
3674
|
-
const [failedSrc, setFailedSrc] =
|
|
3753
|
+
const [failedSrc, setFailedSrc] = React50.useState();
|
|
3675
3754
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3676
3755
|
const showImage = thumbnail !== void 0 && !error;
|
|
3677
|
-
const [draft, setDraft] =
|
|
3756
|
+
const [draft, setDraft] = React50.useState(null);
|
|
3678
3757
|
const count = (draft ?? caption ?? "").length;
|
|
3679
|
-
const textRef =
|
|
3680
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3681
|
-
|
|
3758
|
+
const textRef = React50.useRef(null);
|
|
3759
|
+
const [thumbnailSize, setThumbnailSize] = React50.useState(MIN_THUMBNAIL);
|
|
3760
|
+
React50.useEffect(() => {
|
|
3682
3761
|
const el = textRef.current;
|
|
3683
3762
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3684
3763
|
const observer = new ResizeObserver(() => {
|
|
@@ -3687,7 +3766,7 @@ var StimulusCard = React48.forwardRef(
|
|
|
3687
3766
|
observer.observe(el);
|
|
3688
3767
|
return () => observer.disconnect();
|
|
3689
3768
|
}, []);
|
|
3690
|
-
return /* @__PURE__ */
|
|
3769
|
+
return /* @__PURE__ */ jsxs38(
|
|
3691
3770
|
"div",
|
|
3692
3771
|
{
|
|
3693
3772
|
ref,
|
|
@@ -3695,8 +3774,8 @@ var StimulusCard = React48.forwardRef(
|
|
|
3695
3774
|
className: cn("flex min-h-24.5 w-full items-center gap-4 rounded-md border border-border p-0.5 pr-4", className),
|
|
3696
3775
|
...props,
|
|
3697
3776
|
children: [
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3777
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3778
|
+
/* @__PURE__ */ jsx51(
|
|
3700
3779
|
"span",
|
|
3701
3780
|
{
|
|
3702
3781
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3707,13 +3786,13 @@ var StimulusCard = React48.forwardRef(
|
|
|
3707
3786
|
),
|
|
3708
3787
|
children: showImage ? (
|
|
3709
3788
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3710
|
-
/* @__PURE__ */
|
|
3711
|
-
) : error ? /* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ jsx51("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) })
|
|
3790
|
+
) : error ? /* @__PURE__ */ jsx51(ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ jsx51(ImageIcon2, { size: 24, "aria-hidden": true })
|
|
3712
3791
|
}
|
|
3713
3792
|
),
|
|
3714
|
-
/* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */
|
|
3716
|
-
onCaptionChange ? /* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ jsxs38("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
3794
|
+
/* @__PURE__ */ jsx51("p", { className: "w-full text-ui-label", children: label }),
|
|
3795
|
+
onCaptionChange ? /* @__PURE__ */ jsx51(
|
|
3717
3796
|
InlineEdit,
|
|
3718
3797
|
{
|
|
3719
3798
|
variant: "question",
|
|
@@ -3730,8 +3809,8 @@ var StimulusCard = React48.forwardRef(
|
|
|
3730
3809
|
},
|
|
3731
3810
|
textClassName: "text-body-base"
|
|
3732
3811
|
}
|
|
3733
|
-
) : /* @__PURE__ */
|
|
3734
|
-
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */
|
|
3812
|
+
) : /* @__PURE__ */ jsx51("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
3813
|
+
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs38("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3735
3814
|
count,
|
|
3736
3815
|
"/",
|
|
3737
3816
|
maxLength,
|
|
@@ -3739,7 +3818,7 @@ var StimulusCard = React48.forwardRef(
|
|
|
3739
3818
|
] })
|
|
3740
3819
|
] })
|
|
3741
3820
|
] }),
|
|
3742
|
-
onRemove && /* @__PURE__ */
|
|
3821
|
+
onRemove && /* @__PURE__ */ jsx51(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx51(Trash6, { size: 16, "aria-hidden": true }) })
|
|
3743
3822
|
]
|
|
3744
3823
|
}
|
|
3745
3824
|
);
|
|
@@ -3748,27 +3827,27 @@ var StimulusCard = React48.forwardRef(
|
|
|
3748
3827
|
StimulusCard.displayName = "StimulusCard";
|
|
3749
3828
|
|
|
3750
3829
|
// src/components/Data Display/Progress.tsx
|
|
3751
|
-
import * as
|
|
3830
|
+
import * as React51 from "react";
|
|
3752
3831
|
import { Progress as ProgressPrimitive2 } from "radix-ui";
|
|
3753
|
-
import { jsx as
|
|
3754
|
-
var Progress =
|
|
3832
|
+
import { jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3833
|
+
var Progress = React51.forwardRef(
|
|
3755
3834
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3756
3835
|
const hasHeader = label != null || valueLabel != null;
|
|
3757
3836
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3758
3837
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3759
|
-
return /* @__PURE__ */
|
|
3760
|
-
hasHeader && /* @__PURE__ */
|
|
3761
|
-
/* @__PURE__ */
|
|
3762
|
-
/* @__PURE__ */
|
|
3838
|
+
return /* @__PURE__ */ jsxs39("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
3839
|
+
hasHeader && /* @__PURE__ */ jsxs39("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
3840
|
+
/* @__PURE__ */ jsx52("span", { children: label }),
|
|
3841
|
+
/* @__PURE__ */ jsx52("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3763
3842
|
] }),
|
|
3764
|
-
/* @__PURE__ */
|
|
3843
|
+
/* @__PURE__ */ jsx52(
|
|
3765
3844
|
ProgressPrimitive2.Root,
|
|
3766
3845
|
{
|
|
3767
3846
|
ref,
|
|
3768
3847
|
value: clamped,
|
|
3769
3848
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3770
3849
|
...props,
|
|
3771
|
-
children: /* @__PURE__ */
|
|
3850
|
+
children: /* @__PURE__ */ jsx52(
|
|
3772
3851
|
ProgressPrimitive2.Indicator,
|
|
3773
3852
|
{
|
|
3774
3853
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3777,9 +3856,9 @@ var Progress = React49.forwardRef(
|
|
|
3777
3856
|
)
|
|
3778
3857
|
}
|
|
3779
3858
|
),
|
|
3780
|
-
hasDetails && /* @__PURE__ */
|
|
3781
|
-
/* @__PURE__ */
|
|
3782
|
-
/* @__PURE__ */
|
|
3859
|
+
hasDetails && /* @__PURE__ */ jsxs39("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3860
|
+
/* @__PURE__ */ jsx52("span", { children: detailsStart }),
|
|
3861
|
+
/* @__PURE__ */ jsx52("span", { children: detailsEnd })
|
|
3783
3862
|
] })
|
|
3784
3863
|
] });
|
|
3785
3864
|
}
|
|
@@ -3787,11 +3866,11 @@ var Progress = React49.forwardRef(
|
|
|
3787
3866
|
Progress.displayName = "Progress";
|
|
3788
3867
|
|
|
3789
3868
|
// src/components/Data Display/Table.tsx
|
|
3790
|
-
import * as
|
|
3869
|
+
import * as React52 from "react";
|
|
3791
3870
|
import { CaretDown as CaretDown4, CaretUp } from "@phosphor-icons/react";
|
|
3792
|
-
import { jsx as
|
|
3793
|
-
var Table =
|
|
3794
|
-
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */
|
|
3871
|
+
import { jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3872
|
+
var Table = React52.forwardRef(
|
|
3873
|
+
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ jsx53("div", { ref: containerRef, className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ jsx53(
|
|
3795
3874
|
"table",
|
|
3796
3875
|
{
|
|
3797
3876
|
ref,
|
|
@@ -3802,20 +3881,20 @@ var Table = React50.forwardRef(
|
|
|
3802
3881
|
) })
|
|
3803
3882
|
);
|
|
3804
3883
|
Table.displayName = "Table";
|
|
3805
|
-
var TableHeader =
|
|
3806
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3884
|
+
var TableHeader = React52.forwardRef(
|
|
3885
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx53("thead", { ref, className, ...props })
|
|
3807
3886
|
);
|
|
3808
3887
|
TableHeader.displayName = "TableHeader";
|
|
3809
|
-
var TableFooter =
|
|
3810
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3888
|
+
var TableFooter = React52.forwardRef(
|
|
3889
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx53("tfoot", { ref, className: cn("border-t border-border bg-background text-ui-label", className), ...props })
|
|
3811
3890
|
);
|
|
3812
3891
|
TableFooter.displayName = "TableFooter";
|
|
3813
|
-
var TableBody =
|
|
3814
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3892
|
+
var TableBody = React52.forwardRef(
|
|
3893
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx53("tbody", { ref, className, ...props })
|
|
3815
3894
|
);
|
|
3816
3895
|
TableBody.displayName = "TableBody";
|
|
3817
|
-
var TableRow =
|
|
3818
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */
|
|
3896
|
+
var TableRow = React52.forwardRef(
|
|
3897
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ jsx53(
|
|
3819
3898
|
"tr",
|
|
3820
3899
|
{
|
|
3821
3900
|
ref,
|
|
@@ -3832,10 +3911,10 @@ var TableRow = React50.forwardRef(
|
|
|
3832
3911
|
);
|
|
3833
3912
|
TableRow.displayName = "TableRow";
|
|
3834
3913
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3835
|
-
var TableHead =
|
|
3914
|
+
var TableHead = React52.forwardRef(
|
|
3836
3915
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, resizer, children, ...props }, ref) => {
|
|
3837
|
-
const caret = sort === "asc" ? /* @__PURE__ */
|
|
3838
|
-
return /* @__PURE__ */
|
|
3916
|
+
const caret = sort === "asc" ? /* @__PURE__ */ jsx53(CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ jsx53(CaretDown4, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
3917
|
+
return /* @__PURE__ */ jsxs40(
|
|
3839
3918
|
"th",
|
|
3840
3919
|
{
|
|
3841
3920
|
ref,
|
|
@@ -3850,7 +3929,7 @@ var TableHead = React50.forwardRef(
|
|
|
3850
3929
|
),
|
|
3851
3930
|
...props,
|
|
3852
3931
|
children: [
|
|
3853
|
-
sortable ? /* @__PURE__ */
|
|
3932
|
+
sortable ? /* @__PURE__ */ jsxs40(
|
|
3854
3933
|
"button",
|
|
3855
3934
|
{
|
|
3856
3935
|
type: "button",
|
|
@@ -3861,7 +3940,7 @@ var TableHead = React50.forwardRef(
|
|
|
3861
3940
|
caret
|
|
3862
3941
|
]
|
|
3863
3942
|
}
|
|
3864
|
-
) : checkbox ? /* @__PURE__ */
|
|
3943
|
+
) : checkbox ? /* @__PURE__ */ jsx53("div", { className: "flex items-center justify-center", children }) : children,
|
|
3865
3944
|
resizer
|
|
3866
3945
|
]
|
|
3867
3946
|
}
|
|
@@ -3869,8 +3948,8 @@ var TableHead = React50.forwardRef(
|
|
|
3869
3948
|
}
|
|
3870
3949
|
);
|
|
3871
3950
|
TableHead.displayName = "TableHead";
|
|
3872
|
-
var TableCell =
|
|
3873
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */
|
|
3951
|
+
var TableCell = React52.forwardRef(
|
|
3952
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ jsx53(
|
|
3874
3953
|
"td",
|
|
3875
3954
|
{
|
|
3876
3955
|
ref,
|
|
@@ -3883,23 +3962,23 @@ var TableCell = React50.forwardRef(
|
|
|
3883
3962
|
className
|
|
3884
3963
|
),
|
|
3885
3964
|
...props,
|
|
3886
|
-
children: checkbox ? /* @__PURE__ */
|
|
3965
|
+
children: checkbox ? /* @__PURE__ */ jsx53("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ jsx53("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
3887
3966
|
}
|
|
3888
3967
|
)
|
|
3889
3968
|
);
|
|
3890
3969
|
TableCell.displayName = "TableCell";
|
|
3891
3970
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
3892
|
-
return /* @__PURE__ */
|
|
3971
|
+
return /* @__PURE__ */ jsxs40("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
3893
3972
|
avatar,
|
|
3894
|
-
/* @__PURE__ */
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
secondary && /* @__PURE__ */
|
|
3973
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
3974
|
+
/* @__PURE__ */ jsx53("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
3975
|
+
secondary && /* @__PURE__ */ jsx53("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
3897
3976
|
] })
|
|
3898
3977
|
] });
|
|
3899
3978
|
}
|
|
3900
3979
|
|
|
3901
3980
|
// src/components/Data Display/DataTable.tsx
|
|
3902
|
-
import * as
|
|
3981
|
+
import * as React54 from "react";
|
|
3903
3982
|
import { CaretDown as CaretDown5, CaretRight as CaretRight4, PushPin, PushPinSlash, Rows, Sliders, Stack } from "@phosphor-icons/react";
|
|
3904
3983
|
import {
|
|
3905
3984
|
aggregationFn_count,
|
|
@@ -3952,9 +4031,9 @@ import {
|
|
|
3952
4031
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
3953
4032
|
|
|
3954
4033
|
// src/components/Utility/Pagination.tsx
|
|
3955
|
-
import * as
|
|
4034
|
+
import * as React53 from "react";
|
|
3956
4035
|
import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
|
|
3957
|
-
import { jsx as
|
|
4036
|
+
import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3958
4037
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
3959
4038
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
3960
4039
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -3968,10 +4047,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
3968
4047
|
});
|
|
3969
4048
|
return items;
|
|
3970
4049
|
}
|
|
3971
|
-
var Pagination =
|
|
4050
|
+
var Pagination = React53.forwardRef(
|
|
3972
4051
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
3973
4052
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
3974
|
-
const previous = /* @__PURE__ */
|
|
4053
|
+
const previous = /* @__PURE__ */ jsx54(
|
|
3975
4054
|
Button,
|
|
3976
4055
|
{
|
|
3977
4056
|
type: "button",
|
|
@@ -3980,10 +4059,10 @@ var Pagination = React51.forwardRef(
|
|
|
3980
4059
|
"aria-label": "Previous page",
|
|
3981
4060
|
disabled: page <= 1,
|
|
3982
4061
|
onClick: () => go(page - 1),
|
|
3983
|
-
children: /* @__PURE__ */
|
|
4062
|
+
children: /* @__PURE__ */ jsx54(ArrowLeft, { size: 16, "aria-hidden": true })
|
|
3984
4063
|
}
|
|
3985
4064
|
);
|
|
3986
|
-
const next = /* @__PURE__ */
|
|
4065
|
+
const next = /* @__PURE__ */ jsx54(
|
|
3987
4066
|
Button,
|
|
3988
4067
|
{
|
|
3989
4068
|
type: "button",
|
|
@@ -3992,10 +4071,10 @@ var Pagination = React51.forwardRef(
|
|
|
3992
4071
|
"aria-label": "Next page",
|
|
3993
4072
|
disabled: page >= pageCount,
|
|
3994
4073
|
onClick: () => go(page + 1),
|
|
3995
|
-
children: /* @__PURE__ */
|
|
4074
|
+
children: /* @__PURE__ */ jsx54(ArrowRight, { size: 16, "aria-hidden": true })
|
|
3996
4075
|
}
|
|
3997
4076
|
);
|
|
3998
|
-
return /* @__PURE__ */
|
|
4077
|
+
return /* @__PURE__ */ jsxs41(
|
|
3999
4078
|
"nav",
|
|
4000
4079
|
{
|
|
4001
4080
|
ref,
|
|
@@ -4004,14 +4083,14 @@ var Pagination = React51.forwardRef(
|
|
|
4004
4083
|
...props,
|
|
4005
4084
|
children: [
|
|
4006
4085
|
previous,
|
|
4007
|
-
variant === "compact" ? /* @__PURE__ */
|
|
4086
|
+
variant === "compact" ? /* @__PURE__ */ jsxs41("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
4008
4087
|
page,
|
|
4009
4088
|
"/",
|
|
4010
4089
|
pageCount
|
|
4011
|
-
] }) : /* @__PURE__ */
|
|
4012
|
-
/* @__PURE__ */
|
|
4013
|
-
/* @__PURE__ */
|
|
4014
|
-
] }) : /* @__PURE__ */
|
|
4090
|
+
] }) : /* @__PURE__ */ jsx54("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ jsx54("li", { children: item === "ellipsis" ? /* @__PURE__ */ jsxs41("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
4091
|
+
/* @__PURE__ */ jsx54(DotsThree2, { size: 16, "aria-hidden": true }),
|
|
4092
|
+
/* @__PURE__ */ jsx54("span", { className: "sr-only", children: "More pages" })
|
|
4093
|
+
] }) : /* @__PURE__ */ jsx54(
|
|
4015
4094
|
Button,
|
|
4016
4095
|
{
|
|
4017
4096
|
type: "button",
|
|
@@ -4032,7 +4111,7 @@ var Pagination = React51.forwardRef(
|
|
|
4032
4111
|
Pagination.displayName = "Pagination";
|
|
4033
4112
|
|
|
4034
4113
|
// src/components/Data Display/DataTable.tsx
|
|
4035
|
-
import { Fragment as
|
|
4114
|
+
import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4036
4115
|
var features = tableFeatures({
|
|
4037
4116
|
rowSortingFeature,
|
|
4038
4117
|
rowPaginationFeature,
|
|
@@ -4087,9 +4166,9 @@ var features = tableFeatures({
|
|
|
4087
4166
|
});
|
|
4088
4167
|
var getMeta = (meta) => meta ?? {};
|
|
4089
4168
|
function useControllable(value, initial, onChange) {
|
|
4090
|
-
const [internal, setInternal] =
|
|
4169
|
+
const [internal, setInternal] = React54.useState(initial);
|
|
4091
4170
|
const current = value ?? internal;
|
|
4092
|
-
const update =
|
|
4171
|
+
const update = React54.useCallback(
|
|
4093
4172
|
(updater) => {
|
|
4094
4173
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
4095
4174
|
if (value === void 0) setInternal(next);
|
|
@@ -4128,16 +4207,16 @@ function ColumnFilter({ column }) {
|
|
|
4128
4207
|
const value = column.getFilterValue();
|
|
4129
4208
|
if (variant === "select") {
|
|
4130
4209
|
const options = [...column.getFacetedUniqueValues().entries()].sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
4131
|
-
return /* @__PURE__ */
|
|
4210
|
+
return /* @__PURE__ */ jsxs42(
|
|
4132
4211
|
Select,
|
|
4133
4212
|
{
|
|
4134
4213
|
value: typeof value === "string" ? value : ALL,
|
|
4135
4214
|
onValueChange: (next) => column.setFilterValue(next === ALL ? void 0 : next),
|
|
4136
4215
|
children: [
|
|
4137
|
-
/* @__PURE__ */
|
|
4138
|
-
/* @__PURE__ */
|
|
4139
|
-
/* @__PURE__ */
|
|
4140
|
-
options.map(([option, count]) => /* @__PURE__ */
|
|
4216
|
+
/* @__PURE__ */ jsx55(SelectTrigger, { "aria-label": `Filter ${label}`, className: "h-8 text-body-small", children: /* @__PURE__ */ jsx55(SelectValue, {}) }),
|
|
4217
|
+
/* @__PURE__ */ jsxs42(SelectContent, { children: [
|
|
4218
|
+
/* @__PURE__ */ jsx55(SelectItem, { value: ALL, children: "All" }),
|
|
4219
|
+
options.map(([option, count]) => /* @__PURE__ */ jsxs42(SelectItem, { value: String(option), children: [
|
|
4141
4220
|
String(option),
|
|
4142
4221
|
" (",
|
|
4143
4222
|
count,
|
|
@@ -4156,8 +4235,8 @@ function ColumnFilter({ column }) {
|
|
|
4156
4235
|
next[index] = raw === "" ? void 0 : Number(raw);
|
|
4157
4236
|
column.setFilterValue(next[0] === void 0 && next[1] === void 0 ? void 0 : next);
|
|
4158
4237
|
};
|
|
4159
|
-
return /* @__PURE__ */
|
|
4160
|
-
/* @__PURE__ */
|
|
4238
|
+
return /* @__PURE__ */ jsxs42("div", { className: "flex gap-1", children: [
|
|
4239
|
+
/* @__PURE__ */ jsx55(
|
|
4161
4240
|
Input,
|
|
4162
4241
|
{
|
|
4163
4242
|
type: "number",
|
|
@@ -4168,7 +4247,7 @@ function ColumnFilter({ column }) {
|
|
|
4168
4247
|
className: "h-8 text-body-small"
|
|
4169
4248
|
}
|
|
4170
4249
|
),
|
|
4171
|
-
/* @__PURE__ */
|
|
4250
|
+
/* @__PURE__ */ jsx55(
|
|
4172
4251
|
Input,
|
|
4173
4252
|
{
|
|
4174
4253
|
type: "number",
|
|
@@ -4181,7 +4260,7 @@ function ColumnFilter({ column }) {
|
|
|
4181
4260
|
)
|
|
4182
4261
|
] });
|
|
4183
4262
|
}
|
|
4184
|
-
return /* @__PURE__ */
|
|
4263
|
+
return /* @__PURE__ */ jsx55(
|
|
4185
4264
|
Input,
|
|
4186
4265
|
{
|
|
4187
4266
|
"aria-label": `Filter ${label}`,
|
|
@@ -4194,9 +4273,9 @@ function ColumnFilter({ column }) {
|
|
|
4194
4273
|
}
|
|
4195
4274
|
function EditableCell({ value, label, type, onCommit }) {
|
|
4196
4275
|
const initial = value == null ? "" : String(value);
|
|
4197
|
-
const [draft, setDraft] =
|
|
4198
|
-
const cancelled =
|
|
4199
|
-
return /* @__PURE__ */
|
|
4276
|
+
const [draft, setDraft] = React54.useState(null);
|
|
4277
|
+
const cancelled = React54.useRef(false);
|
|
4278
|
+
return /* @__PURE__ */ jsx55(
|
|
4200
4279
|
Input,
|
|
4201
4280
|
{
|
|
4202
4281
|
type,
|
|
@@ -4334,7 +4413,7 @@ function DataTableInner({
|
|
|
4334
4413
|
onPaginationChange
|
|
4335
4414
|
);
|
|
4336
4415
|
const [density, setDensity] = useControllable(densityProp, "default", onDensityChange);
|
|
4337
|
-
const [cellSelection, setCellSelection] =
|
|
4416
|
+
const [cellSelection, setCellSelection] = React54.useState([]);
|
|
4338
4417
|
const infinite = Boolean(onLoadMore);
|
|
4339
4418
|
const paginate = !virtualized && !infinite;
|
|
4340
4419
|
const compact = density === "compact";
|
|
@@ -4407,12 +4486,12 @@ function DataTableInner({
|
|
|
4407
4486
|
const cellDensity = compact ? "h-8 py-1.5" : void 0;
|
|
4408
4487
|
const allSelected = table.getIsAllPageRowsSelected();
|
|
4409
4488
|
const someSelected = table.getIsSomePageRowsSelected();
|
|
4410
|
-
const dragged =
|
|
4489
|
+
const dragged = React54.useRef(null);
|
|
4411
4490
|
const topRows = enableRowPinning ? table.getTopRows() : [];
|
|
4412
4491
|
const bottomRows = enableRowPinning ? table.getBottomRows() : [];
|
|
4413
4492
|
const bodyRows = enableRowPinning ? table.getCenterRows() : table.getRowModel().rows;
|
|
4414
|
-
const scrollRef =
|
|
4415
|
-
const setScrollRef =
|
|
4493
|
+
const scrollRef = React54.useRef(null);
|
|
4494
|
+
const setScrollRef = React54.useCallback(
|
|
4416
4495
|
(node) => {
|
|
4417
4496
|
scrollRef.current = node;
|
|
4418
4497
|
if (typeof containerRef === "function") containerRef(node);
|
|
@@ -4431,8 +4510,8 @@ function DataTableInner({
|
|
|
4431
4510
|
const virtualItems = virtualized ? virtualizer.getVirtualItems() : [];
|
|
4432
4511
|
const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
|
|
4433
4512
|
const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems.at(-1)?.end ?? 0) : 0;
|
|
4434
|
-
const sentinelRef =
|
|
4435
|
-
|
|
4513
|
+
const sentinelRef = React54.useRef(null);
|
|
4514
|
+
React54.useEffect(() => {
|
|
4436
4515
|
const node = sentinelRef.current;
|
|
4437
4516
|
if (!node || !onLoadMore || !hasMore || loadingMore || typeof IntersectionObserver === "undefined") return;
|
|
4438
4517
|
const container = scrollRef.current;
|
|
@@ -4473,15 +4552,15 @@ function DataTableInner({
|
|
|
4473
4552
|
table.resetCellSelection(true);
|
|
4474
4553
|
}
|
|
4475
4554
|
};
|
|
4476
|
-
const skeletonRow = (rowKey) => /* @__PURE__ */
|
|
4555
|
+
const skeletonRow = (rowKey) => /* @__PURE__ */ jsx55(TableRow, { className: "hover:bg-transparent", children: Array.from({ length: columnSpan }, (_, cell) => /* @__PURE__ */ jsx55(TableCell, { checkbox: enableRowSelection && cell === 0, className: cellDensity, children: /* @__PURE__ */ jsx55("span", { "aria-hidden": true, className: "block h-4 w-3/4 animate-pulse rounded-xs bg-border" }) }, cell)) }, rowKey);
|
|
4477
4556
|
const renderRow = (row, options = {}) => {
|
|
4478
4557
|
const { pinned, pinnedIndex = 0, pinnedCount = 1, virtualIndex } = options;
|
|
4479
4558
|
const grouped = row.getIsGrouped();
|
|
4480
4559
|
const rowUnits = compact ? 8 : 10;
|
|
4481
4560
|
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;
|
|
4482
4561
|
const cells = row.getVisibleCells();
|
|
4483
|
-
return /* @__PURE__ */
|
|
4484
|
-
/* @__PURE__ */
|
|
4562
|
+
return /* @__PURE__ */ jsxs42(React54.Fragment, { children: [
|
|
4563
|
+
/* @__PURE__ */ jsxs42(
|
|
4485
4564
|
TableRow,
|
|
4486
4565
|
{
|
|
4487
4566
|
ref: virtualized && virtualIndex !== void 0 ? virtualizer.measureElement : void 0,
|
|
@@ -4491,7 +4570,7 @@ function DataTableInner({
|
|
|
4491
4570
|
onClick: onRowClick && !grouped ? () => onRowClick(row.original) : void 0,
|
|
4492
4571
|
className: cn(pinned && "z-20 bg-surface", grouped && "bg-background", onRowClick && !grouped && "cursor-pointer"),
|
|
4493
4572
|
children: [
|
|
4494
|
-
enableRowSelection && /* @__PURE__ */
|
|
4573
|
+
enableRowSelection && /* @__PURE__ */ jsx55(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx55(
|
|
4495
4574
|
Checkbox,
|
|
4496
4575
|
{
|
|
4497
4576
|
"aria-label": "Select row",
|
|
@@ -4500,7 +4579,7 @@ function DataTableInner({
|
|
|
4500
4579
|
onCheckedChange: (checked) => row.toggleSelected(Boolean(checked))
|
|
4501
4580
|
}
|
|
4502
4581
|
) }),
|
|
4503
|
-
hasExpander && /* @__PURE__ */
|
|
4582
|
+
hasExpander && /* @__PURE__ */ jsx55(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && row.getCanExpand() && /* @__PURE__ */ jsx55(
|
|
4504
4583
|
Button,
|
|
4505
4584
|
{
|
|
4506
4585
|
type: "button",
|
|
@@ -4509,10 +4588,10 @@ function DataTableInner({
|
|
|
4509
4588
|
"aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
|
|
4510
4589
|
"aria-expanded": row.getIsExpanded(),
|
|
4511
4590
|
onClick: () => row.toggleExpanded(),
|
|
4512
|
-
children: row.getIsExpanded() ? /* @__PURE__ */
|
|
4591
|
+
children: row.getIsExpanded() ? /* @__PURE__ */ jsx55(CaretDown5, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx55(CaretRight4, { size: 16, "aria-hidden": true })
|
|
4513
4592
|
}
|
|
4514
4593
|
) }),
|
|
4515
|
-
enableRowPinning && /* @__PURE__ */
|
|
4594
|
+
enableRowPinning && /* @__PURE__ */ jsx55(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx55(
|
|
4516
4595
|
Button,
|
|
4517
4596
|
{
|
|
4518
4597
|
type: "button",
|
|
@@ -4521,7 +4600,7 @@ function DataTableInner({
|
|
|
4521
4600
|
"aria-label": row.getIsPinned() ? "Unpin row" : "Pin row to top",
|
|
4522
4601
|
"aria-pressed": Boolean(row.getIsPinned()),
|
|
4523
4602
|
onClick: () => row.pin(row.getIsPinned() ? false : "top"),
|
|
4524
|
-
children: row.getIsPinned() ? /* @__PURE__ */
|
|
4603
|
+
children: row.getIsPinned() ? /* @__PURE__ */ jsx55(PushPinSlash, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx55(PushPin, { size: 16, "aria-hidden": true })
|
|
4525
4604
|
}
|
|
4526
4605
|
) }),
|
|
4527
4606
|
cells.map((cell, index) => {
|
|
@@ -4534,7 +4613,7 @@ function DataTableInner({
|
|
|
4534
4613
|
const indent = index === 0 && hasExpander && row.depth > 0 ? row.depth * 4 : 0;
|
|
4535
4614
|
let content;
|
|
4536
4615
|
if (cell.getIsGrouped()) {
|
|
4537
|
-
content = /* @__PURE__ */
|
|
4616
|
+
content = /* @__PURE__ */ jsxs42(
|
|
4538
4617
|
"button",
|
|
4539
4618
|
{
|
|
4540
4619
|
type: "button",
|
|
@@ -4542,9 +4621,9 @@ function DataTableInner({
|
|
|
4542
4621
|
"aria-expanded": row.getIsExpanded(),
|
|
4543
4622
|
onClick: row.getToggleExpandedHandler(),
|
|
4544
4623
|
children: [
|
|
4545
|
-
row.getIsExpanded() ? /* @__PURE__ */
|
|
4624
|
+
row.getIsExpanded() ? /* @__PURE__ */ jsx55(CaretDown5, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx55(CaretRight4, { size: 16, "aria-hidden": true }),
|
|
4546
4625
|
flexRender(cell.column.columnDef.cell, cell.getContext()),
|
|
4547
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsxs42("span", { className: "text-secondary-muted-foreground", children: [
|
|
4548
4627
|
"(",
|
|
4549
4628
|
row.subRows.length,
|
|
4550
4629
|
")"
|
|
@@ -4557,7 +4636,7 @@ function DataTableInner({
|
|
|
4557
4636
|
} else if (cell.getIsPlaceholder()) {
|
|
4558
4637
|
content = null;
|
|
4559
4638
|
} else if (meta.editable) {
|
|
4560
|
-
content = /* @__PURE__ */
|
|
4639
|
+
content = /* @__PURE__ */ jsx55(
|
|
4561
4640
|
EditableCell,
|
|
4562
4641
|
{
|
|
4563
4642
|
value: cell.getValue(),
|
|
@@ -4569,7 +4648,7 @@ function DataTableInner({
|
|
|
4569
4648
|
} else {
|
|
4570
4649
|
content = flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
4571
4650
|
}
|
|
4572
|
-
return /* @__PURE__ */
|
|
4651
|
+
return /* @__PURE__ */ jsx55(
|
|
4573
4652
|
TableCell,
|
|
4574
4653
|
{
|
|
4575
4654
|
align: meta.align,
|
|
@@ -4602,7 +4681,7 @@ function DataTableInner({
|
|
|
4602
4681
|
]
|
|
4603
4682
|
}
|
|
4604
4683
|
),
|
|
4605
|
-
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */
|
|
4684
|
+
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ jsx55(TableRow, { className: "bg-background hover:bg-background", children: /* @__PURE__ */ jsx55(TableCell, { colSpan: columnSpan, children: renderSubComponent(row.original) }) })
|
|
4606
4685
|
] }, row.id);
|
|
4607
4686
|
};
|
|
4608
4687
|
const renderHeaderCell = (header) => {
|
|
@@ -4613,7 +4692,7 @@ function DataTableInner({
|
|
|
4613
4692
|
const pin = pinning(column, sized, true);
|
|
4614
4693
|
const reorderable = enableColumnOrdering && leaf && !column.getIsPinned();
|
|
4615
4694
|
const label = labelOf(column);
|
|
4616
|
-
return /* @__PURE__ */
|
|
4695
|
+
return /* @__PURE__ */ jsx55(
|
|
4617
4696
|
TableHead,
|
|
4618
4697
|
{
|
|
4619
4698
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
@@ -4649,7 +4728,7 @@ function DataTableInner({
|
|
|
4649
4728
|
reorderable && "cursor-grab",
|
|
4650
4729
|
!leaf && "text-center"
|
|
4651
4730
|
),
|
|
4652
|
-
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */
|
|
4731
|
+
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ jsx55(
|
|
4653
4732
|
"div",
|
|
4654
4733
|
{
|
|
4655
4734
|
role: "separator",
|
|
@@ -4664,14 +4743,14 @@ function DataTableInner({
|
|
|
4664
4743
|
)
|
|
4665
4744
|
}
|
|
4666
4745
|
) : void 0,
|
|
4667
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */
|
|
4746
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ jsx55(table.FlexRender, { header })
|
|
4668
4747
|
},
|
|
4669
4748
|
header.id
|
|
4670
4749
|
);
|
|
4671
4750
|
};
|
|
4672
4751
|
const stickyLeading = cn(cellDensity, sticky && "sticky top-0 z-20 bg-surface");
|
|
4673
|
-
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */
|
|
4674
|
-
enableRowSelection && /* @__PURE__ */
|
|
4752
|
+
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ jsxs42(Fragment15, { children: [
|
|
4753
|
+
enableRowSelection && /* @__PURE__ */ jsx55(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx55(
|
|
4675
4754
|
Checkbox,
|
|
4676
4755
|
{
|
|
4677
4756
|
"aria-label": "Select all rows",
|
|
@@ -4680,15 +4759,15 @@ function DataTableInner({
|
|
|
4680
4759
|
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(Boolean(checked))
|
|
4681
4760
|
}
|
|
4682
4761
|
) }),
|
|
4683
|
-
hasExpander && /* @__PURE__ */
|
|
4684
|
-
enableRowPinning && /* @__PURE__ */
|
|
4762
|
+
hasExpander && /* @__PURE__ */ jsx55(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx55("span", { className: "sr-only", children: "Expand" }) }),
|
|
4763
|
+
enableRowPinning && /* @__PURE__ */ jsx55(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx55("span", { className: "sr-only", children: "Pin" }) })
|
|
4685
4764
|
] });
|
|
4686
4765
|
const rowsToRender = virtualized ? virtualItems.map((item) => ({ row: bodyRows[item.index], index: item.index })) : null;
|
|
4687
4766
|
const totalRows = topRows.length + bodyRows.length + bottomRows.length;
|
|
4688
|
-
return /* @__PURE__ */
|
|
4689
|
-
showToolbar && /* @__PURE__ */
|
|
4690
|
-
/* @__PURE__ */
|
|
4691
|
-
enableGlobalFilter && /* @__PURE__ */
|
|
4767
|
+
return /* @__PURE__ */ jsxs42("div", { className: cn("flex w-full flex-col gap-2", wrapperClassName), children: [
|
|
4768
|
+
showToolbar && /* @__PURE__ */ jsxs42("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4769
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex items-center gap-2", children: [
|
|
4770
|
+
enableGlobalFilter && /* @__PURE__ */ jsx55(
|
|
4692
4771
|
SearchBar,
|
|
4693
4772
|
{
|
|
4694
4773
|
"aria-label": "Search table",
|
|
@@ -4701,8 +4780,8 @@ function DataTableInner({
|
|
|
4701
4780
|
),
|
|
4702
4781
|
toolbar
|
|
4703
4782
|
] }),
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
enableDensityToggle && /* @__PURE__ */
|
|
4783
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex items-center gap-2", children: [
|
|
4784
|
+
enableDensityToggle && /* @__PURE__ */ jsxs42(
|
|
4706
4785
|
Button,
|
|
4707
4786
|
{
|
|
4708
4787
|
type: "button",
|
|
@@ -4711,20 +4790,20 @@ function DataTableInner({
|
|
|
4711
4790
|
"aria-pressed": compact,
|
|
4712
4791
|
onClick: () => setDensity(compact ? "default" : "compact"),
|
|
4713
4792
|
children: [
|
|
4714
|
-
/* @__PURE__ */
|
|
4793
|
+
/* @__PURE__ */ jsx55(Rows, { size: 16, "aria-hidden": true }),
|
|
4715
4794
|
"Compact"
|
|
4716
4795
|
]
|
|
4717
4796
|
}
|
|
4718
4797
|
),
|
|
4719
|
-
enableGrouping && /* @__PURE__ */
|
|
4720
|
-
/* @__PURE__ */
|
|
4721
|
-
/* @__PURE__ */
|
|
4798
|
+
enableGrouping && /* @__PURE__ */ jsxs42(DropdownMenu, { children: [
|
|
4799
|
+
/* @__PURE__ */ jsx55(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs42(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4800
|
+
/* @__PURE__ */ jsx55(Stack, { size: 16, "aria-hidden": true }),
|
|
4722
4801
|
"Group by"
|
|
4723
4802
|
] }) }),
|
|
4724
|
-
/* @__PURE__ */
|
|
4725
|
-
/* @__PURE__ */
|
|
4726
|
-
/* @__PURE__ */
|
|
4727
|
-
groupableColumns.map((column) => /* @__PURE__ */
|
|
4803
|
+
/* @__PURE__ */ jsxs42(DropdownMenuContent, { align: "end", children: [
|
|
4804
|
+
/* @__PURE__ */ jsx55(DropdownMenuLabel, { children: "Group rows by" }),
|
|
4805
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {}),
|
|
4806
|
+
groupableColumns.map((column) => /* @__PURE__ */ jsx55(
|
|
4728
4807
|
DropdownMenuCheckboxItem,
|
|
4729
4808
|
{
|
|
4730
4809
|
checked: column.getIsGrouped(),
|
|
@@ -4735,15 +4814,15 @@ function DataTableInner({
|
|
|
4735
4814
|
))
|
|
4736
4815
|
] })
|
|
4737
4816
|
] }),
|
|
4738
|
-
enableColumnVisibility && /* @__PURE__ */
|
|
4739
|
-
/* @__PURE__ */
|
|
4740
|
-
/* @__PURE__ */
|
|
4817
|
+
enableColumnVisibility && /* @__PURE__ */ jsxs42(DropdownMenu, { children: [
|
|
4818
|
+
/* @__PURE__ */ jsx55(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs42(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4819
|
+
/* @__PURE__ */ jsx55(Sliders, { size: 16, "aria-hidden": true }),
|
|
4741
4820
|
"Columns"
|
|
4742
4821
|
] }) }),
|
|
4743
|
-
/* @__PURE__ */
|
|
4744
|
-
/* @__PURE__ */
|
|
4745
|
-
/* @__PURE__ */
|
|
4746
|
-
hideableColumns.map((column) => /* @__PURE__ */
|
|
4822
|
+
/* @__PURE__ */ jsxs42(DropdownMenuContent, { align: "end", children: [
|
|
4823
|
+
/* @__PURE__ */ jsx55(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
4824
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {}),
|
|
4825
|
+
hideableColumns.map((column) => /* @__PURE__ */ jsx55(
|
|
4747
4826
|
DropdownMenuCheckboxItem,
|
|
4748
4827
|
{
|
|
4749
4828
|
checked: column.getIsVisible(),
|
|
@@ -4756,7 +4835,7 @@ function DataTableInner({
|
|
|
4756
4835
|
] })
|
|
4757
4836
|
] })
|
|
4758
4837
|
] }),
|
|
4759
|
-
/* @__PURE__ */
|
|
4838
|
+
/* @__PURE__ */ jsxs42(
|
|
4760
4839
|
Table,
|
|
4761
4840
|
{
|
|
4762
4841
|
ref,
|
|
@@ -4769,52 +4848,52 @@ function DataTableInner({
|
|
|
4769
4848
|
tabIndex: enableCellSelection ? 0 : void 0,
|
|
4770
4849
|
...tableProps,
|
|
4771
4850
|
children: [
|
|
4772
|
-
/* @__PURE__ */
|
|
4773
|
-
headerGroups.map((group, groupIndex) => /* @__PURE__ */
|
|
4851
|
+
/* @__PURE__ */ jsxs42(TableHeader, { children: [
|
|
4852
|
+
headerGroups.map((group, groupIndex) => /* @__PURE__ */ jsxs42(TableRow, { className: "hover:bg-transparent", children: [
|
|
4774
4853
|
groupIndex === 0 && leadingHeaderCells(headerGroups.length + (enableColumnFilters ? 1 : 0)),
|
|
4775
4854
|
group.headers.map(renderHeaderCell)
|
|
4776
4855
|
] }, group.id)),
|
|
4777
|
-
enableColumnFilters && /* @__PURE__ */
|
|
4856
|
+
enableColumnFilters && /* @__PURE__ */ jsx55(TableRow, { className: "hover:bg-transparent", children: leafColumns.map((column) => {
|
|
4778
4857
|
const pin = pinning(column, sized, true);
|
|
4779
|
-
return /* @__PURE__ */
|
|
4858
|
+
return /* @__PURE__ */ jsx55(
|
|
4780
4859
|
TableHead,
|
|
4781
4860
|
{
|
|
4782
4861
|
style: pin.style,
|
|
4783
4862
|
className: cn("h-auto py-2 font-normal", pin.className, sticky && !column.getIsPinned() && "bg-surface"),
|
|
4784
|
-
children: column.getCanFilter() ? /* @__PURE__ */
|
|
4863
|
+
children: column.getCanFilter() ? /* @__PURE__ */ jsx55(ColumnFilter, { column }) : null
|
|
4785
4864
|
},
|
|
4786
4865
|
column.id
|
|
4787
4866
|
);
|
|
4788
4867
|
}) })
|
|
4789
4868
|
] }),
|
|
4790
|
-
/* @__PURE__ */
|
|
4791
|
-
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */
|
|
4869
|
+
/* @__PURE__ */ jsxs42(TableBody, { children: [
|
|
4870
|
+
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ jsx55(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx55(TableCell, { colSpan: columnSpan, muted: true, className: "h-24 text-center", children: emptyState ?? "No results." }) }) : /* @__PURE__ */ jsxs42(Fragment15, { children: [
|
|
4792
4871
|
topRows.map((row, index) => renderRow(row, { pinned: "top", pinnedIndex: index, pinnedCount: topRows.length })),
|
|
4793
|
-
virtualized && paddingTop > 0 && /* @__PURE__ */
|
|
4872
|
+
virtualized && paddingTop > 0 && /* @__PURE__ */ jsx55("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx55("td", { colSpan: columnSpan, style: { height: paddingTop } }) }),
|
|
4794
4873
|
rowsToRender ? rowsToRender.map(({ row, index }) => renderRow(row, { virtualIndex: index })) : bodyRows.map((row) => renderRow(row)),
|
|
4795
|
-
virtualized && paddingBottom > 0 && /* @__PURE__ */
|
|
4874
|
+
virtualized && paddingBottom > 0 && /* @__PURE__ */ jsx55("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx55("td", { colSpan: columnSpan, style: { height: paddingBottom } }) }),
|
|
4796
4875
|
bottomRows.map(
|
|
4797
4876
|
(row, index) => renderRow(row, { pinned: "bottom", pinnedIndex: index, pinnedCount: bottomRows.length })
|
|
4798
4877
|
)
|
|
4799
4878
|
] }),
|
|
4800
|
-
infinite && /* @__PURE__ */
|
|
4879
|
+
infinite && /* @__PURE__ */ jsxs42(Fragment15, { children: [
|
|
4801
4880
|
loadingMore && Array.from({ length: 3 }, (_, index) => skeletonRow(`more-${index}`)),
|
|
4802
|
-
/* @__PURE__ */
|
|
4881
|
+
/* @__PURE__ */ jsx55("tr", { ref: sentinelRef, "aria-hidden": true, children: /* @__PURE__ */ jsx55("td", { colSpan: columnSpan, className: "h-px p-0" }) })
|
|
4803
4882
|
] })
|
|
4804
4883
|
] }),
|
|
4805
|
-
showFooter && /* @__PURE__ */
|
|
4806
|
-
leadingCount > 0 && /* @__PURE__ */
|
|
4884
|
+
showFooter && /* @__PURE__ */ jsx55(TableFooter, { children: table.getFooterGroups().map((group) => /* @__PURE__ */ jsxs42(TableRow, { className: "hover:bg-transparent", children: [
|
|
4885
|
+
leadingCount > 0 && /* @__PURE__ */ jsx55(TableCell, { colSpan: leadingCount, className: cellDensity }),
|
|
4807
4886
|
group.headers.map((header) => {
|
|
4808
4887
|
const { align } = getMeta(header.column.columnDef.meta);
|
|
4809
4888
|
const pin = pinning(header.column, sized);
|
|
4810
|
-
return /* @__PURE__ */
|
|
4889
|
+
return /* @__PURE__ */ jsx55(
|
|
4811
4890
|
TableCell,
|
|
4812
4891
|
{
|
|
4813
4892
|
align,
|
|
4814
4893
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
4815
4894
|
style: pin.style,
|
|
4816
4895
|
className: cn("text-ui-label", pin.className, cellDensity),
|
|
4817
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */
|
|
4896
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ jsx55(table.FlexRender, { footer: header })
|
|
4818
4897
|
},
|
|
4819
4898
|
header.id
|
|
4820
4899
|
);
|
|
@@ -4823,9 +4902,9 @@ function DataTableInner({
|
|
|
4823
4902
|
]
|
|
4824
4903
|
}
|
|
4825
4904
|
),
|
|
4826
|
-
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */
|
|
4827
|
-
/* @__PURE__ */
|
|
4828
|
-
paginate && pageCount > 1 && /* @__PURE__ */
|
|
4905
|
+
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ jsxs42("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4906
|
+
/* @__PURE__ */ jsx55("span", { className: "text-body-small text-secondary-muted-foreground", "aria-live": "polite", children: enableRowSelection ? `${selectedCount} of ${table.getCoreRowModel().rows.length} row(s) selected` : null }),
|
|
4907
|
+
paginate && pageCount > 1 && /* @__PURE__ */ jsx55(
|
|
4829
4908
|
Pagination,
|
|
4830
4909
|
{
|
|
4831
4910
|
page: pagination.pageIndex + 1,
|
|
@@ -4836,13 +4915,13 @@ function DataTableInner({
|
|
|
4836
4915
|
] })
|
|
4837
4916
|
] });
|
|
4838
4917
|
}
|
|
4839
|
-
var DataTable =
|
|
4918
|
+
var DataTable = React54.forwardRef(DataTableInner);
|
|
4840
4919
|
DataTable.displayName = "DataTable";
|
|
4841
4920
|
|
|
4842
4921
|
// src/components/Data Display/StatCard.tsx
|
|
4843
|
-
import * as
|
|
4922
|
+
import * as React55 from "react";
|
|
4844
4923
|
import { cva as cva6 } from "class-variance-authority";
|
|
4845
|
-
import { jsx as
|
|
4924
|
+
import { jsx as jsx56, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4846
4925
|
var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
4847
4926
|
variants: {
|
|
4848
4927
|
variant: {
|
|
@@ -4856,26 +4935,26 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
4856
4935
|
},
|
|
4857
4936
|
defaultVariants: { variant: "default" }
|
|
4858
4937
|
});
|
|
4859
|
-
var StatCard =
|
|
4860
|
-
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */
|
|
4861
|
-
/* @__PURE__ */
|
|
4862
|
-
/* @__PURE__ */
|
|
4863
|
-
icon && /* @__PURE__ */
|
|
4938
|
+
var StatCard = React55.forwardRef(
|
|
4939
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ jsxs43("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
4940
|
+
/* @__PURE__ */ jsx56("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
4941
|
+
/* @__PURE__ */ jsxs43("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
4942
|
+
icon && /* @__PURE__ */ jsx56("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
4864
4943
|
value
|
|
4865
4944
|
] }),
|
|
4866
|
-
caption && /* @__PURE__ */
|
|
4945
|
+
caption && /* @__PURE__ */ jsx56("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
4867
4946
|
] })
|
|
4868
4947
|
);
|
|
4869
4948
|
StatCard.displayName = "StatCard";
|
|
4870
4949
|
|
|
4871
4950
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
4872
|
-
import * as
|
|
4951
|
+
import * as React57 from "react";
|
|
4873
4952
|
|
|
4874
4953
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
4875
|
-
import * as
|
|
4954
|
+
import * as React56 from "react";
|
|
4876
4955
|
import { Crown, Plus as Plus5, X as X6 } from "@phosphor-icons/react";
|
|
4877
4956
|
import { cva as cva7 } from "class-variance-authority";
|
|
4878
|
-
import { jsx as
|
|
4957
|
+
import { jsx as jsx57, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4879
4958
|
var editableTagVariants = cva7(
|
|
4880
4959
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
4881
4960
|
{
|
|
@@ -4890,27 +4969,27 @@ var editableTagVariants = cva7(
|
|
|
4890
4969
|
defaultVariants: { type: "default" }
|
|
4891
4970
|
}
|
|
4892
4971
|
);
|
|
4893
|
-
var EditableTag =
|
|
4972
|
+
var EditableTag = React56.forwardRef(
|
|
4894
4973
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
4895
4974
|
const classes = cn(editableTagVariants({ type }), className);
|
|
4896
|
-
const leading = type === "add" ? /* @__PURE__ */
|
|
4975
|
+
const leading = type === "add" ? /* @__PURE__ */ jsx57(Plus5, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ jsx57(Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
4897
4976
|
if (type === "add" || type === "multiple" && onClick) {
|
|
4898
|
-
return /* @__PURE__ */
|
|
4977
|
+
return /* @__PURE__ */ jsxs44("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
4899
4978
|
leading,
|
|
4900
4979
|
children
|
|
4901
4980
|
] });
|
|
4902
4981
|
}
|
|
4903
|
-
return /* @__PURE__ */
|
|
4982
|
+
return /* @__PURE__ */ jsxs44("span", { ref, className: classes, ...props, children: [
|
|
4904
4983
|
leading,
|
|
4905
4984
|
children,
|
|
4906
|
-
onRemove && /* @__PURE__ */
|
|
4985
|
+
onRemove && /* @__PURE__ */ jsx57(
|
|
4907
4986
|
"button",
|
|
4908
4987
|
{
|
|
4909
4988
|
type: "button",
|
|
4910
4989
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
4911
4990
|
onClick: onRemove,
|
|
4912
4991
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
4913
|
-
children: /* @__PURE__ */
|
|
4992
|
+
children: /* @__PURE__ */ jsx57(X6, { size: 12, "aria-hidden": true })
|
|
4914
4993
|
}
|
|
4915
4994
|
)
|
|
4916
4995
|
] });
|
|
@@ -4919,26 +4998,26 @@ var EditableTag = React54.forwardRef(
|
|
|
4919
4998
|
EditableTag.displayName = "EditableTag";
|
|
4920
4999
|
|
|
4921
5000
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
4922
|
-
import { jsx as
|
|
4923
|
-
var ActivityStructure =
|
|
4924
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */
|
|
5001
|
+
import { jsx as jsx58, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5002
|
+
var ActivityStructure = React57.forwardRef(
|
|
5003
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ jsxs45(
|
|
4925
5004
|
"section",
|
|
4926
5005
|
{
|
|
4927
5006
|
ref,
|
|
4928
5007
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
4929
5008
|
...props,
|
|
4930
5009
|
children: [
|
|
4931
|
-
/* @__PURE__ */
|
|
4932
|
-
/* @__PURE__ */
|
|
5010
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5011
|
+
/* @__PURE__ */ jsx58("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
4933
5012
|
action
|
|
4934
5013
|
] }),
|
|
4935
|
-
stats.length > 0 && /* @__PURE__ */
|
|
4936
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
4938
|
-
/* @__PURE__ */
|
|
4939
|
-
(tags?.length || onAddTag) && /* @__PURE__ */
|
|
4940
|
-
tags?.map((tag) => /* @__PURE__ */
|
|
4941
|
-
onAddTag && /* @__PURE__ */
|
|
5014
|
+
stats.length > 0 && /* @__PURE__ */ jsx58("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx58(StatCard, { ...stat }, id)) }),
|
|
5015
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs45("div", { className: "flex flex-col gap-2", children: [
|
|
5016
|
+
/* @__PURE__ */ jsx58("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
5017
|
+
/* @__PURE__ */ jsx58("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
5018
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ jsxs45("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5019
|
+
tags?.map((tag) => /* @__PURE__ */ jsx58(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
5020
|
+
onAddTag && /* @__PURE__ */ jsx58(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
4942
5021
|
] })
|
|
4943
5022
|
] }, id)),
|
|
4944
5023
|
children
|
|
@@ -4949,10 +5028,10 @@ var ActivityStructure = React55.forwardRef(
|
|
|
4949
5028
|
ActivityStructure.displayName = "ActivityStructure";
|
|
4950
5029
|
|
|
4951
5030
|
// src/components/Tags & Badges/Badge.tsx
|
|
4952
|
-
import * as
|
|
4953
|
-
import { DotsSixVertical as DotsSixVertical5, RadioButton as
|
|
5031
|
+
import * as React58 from "react";
|
|
5032
|
+
import { DotsSixVertical as DotsSixVertical5, RadioButton as RadioButton3 } from "@phosphor-icons/react";
|
|
4954
5033
|
import { cva as cva8 } from "class-variance-authority";
|
|
4955
|
-
import { jsx as
|
|
5034
|
+
import { jsx as jsx59, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4956
5035
|
var roleTagVariants = cva8(
|
|
4957
5036
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
4958
5037
|
{
|
|
@@ -4978,11 +5057,11 @@ var roleTagVariants = cva8(
|
|
|
4978
5057
|
defaultVariants: { type: "primary", selected: false }
|
|
4979
5058
|
}
|
|
4980
5059
|
);
|
|
4981
|
-
var Badge =
|
|
5060
|
+
var Badge = React58.forwardRef(
|
|
4982
5061
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
4983
5062
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
4984
5063
|
if (type === "interactable") {
|
|
4985
|
-
return /* @__PURE__ */
|
|
5064
|
+
return /* @__PURE__ */ jsxs46(
|
|
4986
5065
|
"button",
|
|
4987
5066
|
{
|
|
4988
5067
|
ref,
|
|
@@ -4992,15 +5071,15 @@ var Badge = React56.forwardRef(
|
|
|
4992
5071
|
onClick,
|
|
4993
5072
|
...props,
|
|
4994
5073
|
children: [
|
|
4995
|
-
/* @__PURE__ */
|
|
5074
|
+
/* @__PURE__ */ jsx59(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
4996
5075
|
children
|
|
4997
5076
|
]
|
|
4998
5077
|
}
|
|
4999
5078
|
);
|
|
5000
5079
|
}
|
|
5001
|
-
return /* @__PURE__ */
|
|
5002
|
-
type === "question" && /* @__PURE__ */
|
|
5003
|
-
type === "id" && /* @__PURE__ */
|
|
5080
|
+
return /* @__PURE__ */ jsxs46("span", { ref, className: classes, ...props, children: [
|
|
5081
|
+
type === "question" && /* @__PURE__ */ jsx59(RadioButton3, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
5082
|
+
type === "id" && /* @__PURE__ */ jsx59("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
5004
5083
|
children
|
|
5005
5084
|
] });
|
|
5006
5085
|
}
|
|
@@ -5073,6 +5152,7 @@ export {
|
|
|
5073
5152
|
QuestionEditorCard,
|
|
5074
5153
|
QuestionHeader,
|
|
5075
5154
|
QuestionNavItem,
|
|
5155
|
+
QuestionNumberTag,
|
|
5076
5156
|
QuestionOption,
|
|
5077
5157
|
QuestionOptionEditor,
|
|
5078
5158
|
QuestionOtherOption,
|
|
@@ -5092,6 +5172,9 @@ export {
|
|
|
5092
5172
|
Slider,
|
|
5093
5173
|
StatCard,
|
|
5094
5174
|
StatusTag,
|
|
5175
|
+
Step,
|
|
5176
|
+
StepPath,
|
|
5177
|
+
Stepper,
|
|
5095
5178
|
StimulusCard,
|
|
5096
5179
|
Switch,
|
|
5097
5180
|
TabItem,
|