@discuss-ds/ui 0.30.1 → 0.32.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 +32 -0
- package/dist/index.cjs +759 -580
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -9
- package/dist/index.d.ts +66 -9
- package/dist/index.js +702 -523
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1440,18 +1440,140 @@ var FormMessage = React23.forwardRef(
|
|
|
1440
1440
|
FormMessage.displayName = "FormMessage";
|
|
1441
1441
|
|
|
1442
1442
|
// src/components/Forms & Data Entry/InlineEdit.tsx
|
|
1443
|
-
import * as
|
|
1443
|
+
import * as React25 from "react";
|
|
1444
1444
|
import { PencilSimple, WarningCircle as WarningCircle2 } from "@phosphor-icons/react";
|
|
1445
|
+
|
|
1446
|
+
// src/components/Forms & Data Entry/MarkedText.tsx
|
|
1447
|
+
import * as React24 from "react";
|
|
1448
|
+
import { Trash as Trash2 } from "@phosphor-icons/react";
|
|
1449
|
+
import { Popover as PopoverPrimitive2 } from "radix-ui";
|
|
1445
1450
|
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1451
|
+
function splitMarks(text, marks) {
|
|
1452
|
+
const valid = (marks ?? []).filter((m) => Number.isInteger(m.start) && Number.isInteger(m.end) && m.start >= 0 && m.end > m.start && m.end <= text.length).sort((a, b) => a.start - b.start);
|
|
1453
|
+
const out = [];
|
|
1454
|
+
let at = 0;
|
|
1455
|
+
for (const m of valid) {
|
|
1456
|
+
if (m.start < at) continue;
|
|
1457
|
+
if (m.start > at) out.push({ text: text.slice(at, m.start) });
|
|
1458
|
+
out.push({ text: text.slice(m.start, m.end), mark: m });
|
|
1459
|
+
at = m.end;
|
|
1460
|
+
}
|
|
1461
|
+
if (at < text.length) out.push({ text: text.slice(at) });
|
|
1462
|
+
return out;
|
|
1463
|
+
}
|
|
1464
|
+
var markClasses = "rounded-xxs border-b-2 border-destructive-foreground";
|
|
1465
|
+
function useMarkAlignment(ref, text) {
|
|
1466
|
+
const [padding, setPadding] = React24.useState({ top: 0, bottom: 0 });
|
|
1467
|
+
React24.useLayoutEffect(() => {
|
|
1468
|
+
const mark = ref.current;
|
|
1469
|
+
const button = mark?.closest("button");
|
|
1470
|
+
if (!mark || !button) return;
|
|
1471
|
+
const align = () => {
|
|
1472
|
+
const m = mark.getBoundingClientRect();
|
|
1473
|
+
const b = button.getBoundingClientRect();
|
|
1474
|
+
const markStyle = getComputedStyle(mark);
|
|
1475
|
+
const buttonStyle = getComputedStyle(button);
|
|
1476
|
+
const border = parseFloat(markStyle.borderBottomWidth);
|
|
1477
|
+
const baseTop = m.top + parseFloat(markStyle.paddingTop);
|
|
1478
|
+
const baseBottom = m.bottom - parseFloat(markStyle.paddingBottom) - border;
|
|
1479
|
+
const contentTop = b.top + parseFloat(buttonStyle.borderTopWidth) + parseFloat(buttonStyle.paddingTop);
|
|
1480
|
+
const contentBottom = b.bottom - parseFloat(buttonStyle.borderBottomWidth) - parseFloat(buttonStyle.paddingBottom);
|
|
1481
|
+
const lineHeight = parseFloat(buttonStyle.lineHeight) || contentBottom - contentTop;
|
|
1482
|
+
const lines = Math.max(1, Math.round((contentBottom - contentTop) / lineHeight));
|
|
1483
|
+
const lineIndex = Math.min(lines - 1, Math.max(0, Math.floor(((baseTop + baseBottom) / 2 - contentTop) / lineHeight)));
|
|
1484
|
+
const targetTop = lineIndex === 0 ? b.top : contentTop + lineIndex * lineHeight;
|
|
1485
|
+
const targetBottom = lineIndex === lines - 1 ? b.bottom : contentTop + (lineIndex + 1) * lineHeight;
|
|
1486
|
+
const next = { top: Math.max(0, baseTop - targetTop), bottom: Math.max(0, targetBottom - baseBottom - border) };
|
|
1487
|
+
setPadding((p) => Math.abs(p.top - next.top) < 0.5 && Math.abs(p.bottom - next.bottom) < 0.5 ? p : next);
|
|
1488
|
+
};
|
|
1489
|
+
align();
|
|
1490
|
+
const observer = new ResizeObserver(align);
|
|
1491
|
+
observer.observe(button);
|
|
1492
|
+
return () => observer.disconnect();
|
|
1493
|
+
}, [ref, text]);
|
|
1494
|
+
return padding;
|
|
1495
|
+
}
|
|
1496
|
+
var closeOpenMarkCard = null;
|
|
1497
|
+
function MarkedText({ mark, text, onApply, onDismiss }) {
|
|
1498
|
+
const ref = React24.useRef(null);
|
|
1499
|
+
const [open, setOpen] = React24.useState(false);
|
|
1500
|
+
const close = React24.useCallback(() => setOpen(false), []);
|
|
1501
|
+
React24.useEffect(
|
|
1502
|
+
() => () => {
|
|
1503
|
+
if (closeOpenMarkCard === close) closeOpenMarkCard = null;
|
|
1504
|
+
},
|
|
1505
|
+
[close]
|
|
1506
|
+
);
|
|
1507
|
+
const padding = useMarkAlignment(ref, text);
|
|
1508
|
+
const style = { paddingTop: padding.top, paddingBottom: padding.bottom };
|
|
1509
|
+
if (!onApply && !onDismiss) {
|
|
1510
|
+
return /* @__PURE__ */ jsx25("span", { ref, "data-mark": true, className: markClasses, style, children: text });
|
|
1511
|
+
}
|
|
1512
|
+
const suggestions = (mark.suggestions ?? []).slice(0, 3);
|
|
1513
|
+
const handleOpenChange = (next) => {
|
|
1514
|
+
if (next) {
|
|
1515
|
+
if (closeOpenMarkCard && closeOpenMarkCard !== close) closeOpenMarkCard();
|
|
1516
|
+
closeOpenMarkCard = close;
|
|
1517
|
+
} else if (closeOpenMarkCard === close) {
|
|
1518
|
+
closeOpenMarkCard = null;
|
|
1519
|
+
}
|
|
1520
|
+
setOpen(next);
|
|
1521
|
+
};
|
|
1522
|
+
const stop = (event) => event.stopPropagation();
|
|
1523
|
+
return /* @__PURE__ */ jsxs17(PopoverPrimitive2.Root, { open, onOpenChange: handleOpenChange, children: [
|
|
1524
|
+
/* @__PURE__ */ jsx25(PopoverPrimitive2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx25("span", { ref, "data-mark": true, role: "button", tabIndex: -1, onClick: stop, style, className: cn(markClasses, "cursor-pointer hover:bg-destructive-soft"), children: text }) }),
|
|
1525
|
+
/* @__PURE__ */ jsx25(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ jsxs17(
|
|
1526
|
+
PopoverPrimitive2.Content,
|
|
1527
|
+
{
|
|
1528
|
+
align: "start",
|
|
1529
|
+
sideOffset: 8,
|
|
1530
|
+
style: { zIndex: "var(--sys-z-40)" },
|
|
1531
|
+
onClick: stop,
|
|
1532
|
+
onKeyDown: stop,
|
|
1533
|
+
onCloseAutoFocus: (event) => event.preventDefault(),
|
|
1534
|
+
className: "flex w-72 flex-col gap-3 rounded-md border border-border bg-surface p-4 text-left text-body-base font-normal shadow-md outline-none",
|
|
1535
|
+
children: [
|
|
1536
|
+
suggestions.length > 1 && onApply ? (
|
|
1537
|
+
// Several possible fixes: each one is a choice, applied with a click, so there is no Apply button.
|
|
1538
|
+
/* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Choose a correction", children: suggestions.map((suggestion) => /* @__PURE__ */ jsxs17(Button, { type: "button", size: "sm", variant: "ghost", className: "h-auto justify-start px-2 py-1 whitespace-normal", onClick: () => onApply(mark, suggestion), children: [
|
|
1539
|
+
/* @__PURE__ */ jsx25("s", { className: "text-destructive-foreground", children: text }),
|
|
1540
|
+
" ",
|
|
1541
|
+
/* @__PURE__ */ jsx25("span", { className: "font-semibold text-accent-foreground", children: suggestion === "" ? "Remove" : suggestion })
|
|
1542
|
+
] }, suggestion)) })
|
|
1543
|
+
) : suggestions.length > 0 && /* @__PURE__ */ jsxs17("p", { className: "min-w-0 break-words", children: [
|
|
1544
|
+
/* @__PURE__ */ jsx25("s", { className: "text-destructive-foreground", children: text }),
|
|
1545
|
+
suggestions[0] !== "" && /* @__PURE__ */ jsxs17(Fragment4, { children: [
|
|
1546
|
+
" ",
|
|
1547
|
+
/* @__PURE__ */ jsx25("span", { className: "font-semibold text-accent-foreground", children: suggestions[0] })
|
|
1548
|
+
] })
|
|
1549
|
+
] }),
|
|
1550
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between gap-3", children: [
|
|
1551
|
+
onDismiss ? /* @__PURE__ */ jsxs17(Button, { type: "button", size: "sm", variant: "ghost", onClick: () => onDismiss(mark), children: [
|
|
1552
|
+
/* @__PURE__ */ jsx25(Trash2, { size: 16, "aria-hidden": true }),
|
|
1553
|
+
" Dismiss"
|
|
1554
|
+
] }) : /* @__PURE__ */ jsx25("span", {}),
|
|
1555
|
+
onApply && suggestions.length === 1 && /* @__PURE__ */ jsx25(Button, { type: "button", size: "sm", onClick: () => onApply(mark, suggestions[0]), children: suggestions[0] === "" ? "Remove" : "Apply" })
|
|
1556
|
+
] })
|
|
1557
|
+
]
|
|
1558
|
+
}
|
|
1559
|
+
) })
|
|
1560
|
+
] });
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
// src/components/Forms & Data Entry/InlineEdit.tsx
|
|
1564
|
+
import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1446
1565
|
function limitsText(min, max) {
|
|
1447
1566
|
if (min !== void 0) return `${min} ${min === 1 ? "character" : "characters"} required`;
|
|
1448
1567
|
if (max !== void 0) return `Up to ${max} characters`;
|
|
1449
1568
|
return "";
|
|
1450
1569
|
}
|
|
1451
|
-
var InlineEdit =
|
|
1570
|
+
var InlineEdit = React25.forwardRef(
|
|
1452
1571
|
({
|
|
1453
1572
|
className,
|
|
1454
1573
|
textClassName,
|
|
1574
|
+
marks,
|
|
1575
|
+
onMarkApply,
|
|
1576
|
+
onMarkDismiss,
|
|
1455
1577
|
value: valueProp,
|
|
1456
1578
|
defaultValue = "",
|
|
1457
1579
|
onValueChange,
|
|
@@ -1471,17 +1593,17 @@ var InlineEdit = React24.forwardRef(
|
|
|
1471
1593
|
"aria-label": ariaLabel,
|
|
1472
1594
|
...props
|
|
1473
1595
|
}, ref) => {
|
|
1474
|
-
const [internal, setInternal] =
|
|
1596
|
+
const [internal, setInternal] = React25.useState(defaultValue);
|
|
1475
1597
|
const value = valueProp ?? internal;
|
|
1476
|
-
const [editing, setEditing] =
|
|
1477
|
-
const [draft, setDraft] =
|
|
1478
|
-
const [error, setError] =
|
|
1479
|
-
const errorId =
|
|
1480
|
-
const fieldRef =
|
|
1481
|
-
const readRef =
|
|
1482
|
-
const cancelled =
|
|
1483
|
-
const restoreFocus =
|
|
1484
|
-
|
|
1598
|
+
const [editing, setEditing] = React25.useState(false);
|
|
1599
|
+
const [draft, setDraft] = React25.useState(value);
|
|
1600
|
+
const [error, setError] = React25.useState(null);
|
|
1601
|
+
const errorId = React25.useId();
|
|
1602
|
+
const fieldRef = React25.useRef(null);
|
|
1603
|
+
const readRef = React25.useRef(null);
|
|
1604
|
+
const cancelled = React25.useRef(false);
|
|
1605
|
+
const restoreFocus = React25.useRef(false);
|
|
1606
|
+
React25.useEffect(() => {
|
|
1485
1607
|
if (editing) {
|
|
1486
1608
|
fieldRef.current?.focus();
|
|
1487
1609
|
fieldRef.current?.select();
|
|
@@ -1525,14 +1647,14 @@ var InlineEdit = React24.forwardRef(
|
|
|
1525
1647
|
const textClasses = cn("text-ui-input-value text-surface-foreground", textClassName);
|
|
1526
1648
|
const question = variant === "question";
|
|
1527
1649
|
const fill = multiline || question;
|
|
1528
|
-
return /* @__PURE__ */
|
|
1650
|
+
return /* @__PURE__ */ jsx26(
|
|
1529
1651
|
"div",
|
|
1530
1652
|
{
|
|
1531
1653
|
ref,
|
|
1532
1654
|
className: cn(fill ? "flex w-full min-w-0" : "inline-flex min-w-0 max-w-full", editing && (error || showLimits) && "flex-col gap-1.5", className),
|
|
1533
1655
|
...props,
|
|
1534
|
-
children: editing ? /* @__PURE__ */
|
|
1535
|
-
|
|
1656
|
+
children: editing ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
|
|
1657
|
+
React25.createElement(multiline ? "textarea" : "input", {
|
|
1536
1658
|
ref: fieldRef,
|
|
1537
1659
|
value: draft,
|
|
1538
1660
|
maxLength,
|
|
@@ -1543,7 +1665,7 @@ var InlineEdit = React24.forwardRef(
|
|
|
1543
1665
|
className: cn(
|
|
1544
1666
|
"w-full px-3 py-1 outline-none",
|
|
1545
1667
|
multiline && "field-sizing-content resize-none",
|
|
1546
|
-
question ? cn("rounded-none border-0 border-b-2 bg-transparent", error ? "border-destructive" : "border-accent-
|
|
1668
|
+
question ? cn("rounded-none border-0 border-b-2 bg-transparent", error ? "border-destructive" : "border-accent-muted") : cn("rounded-md", !error && "focus-visible:border-input-accent", fieldSurfaceClasses(error ? "error" : "default")),
|
|
1547
1669
|
textClasses
|
|
1548
1670
|
),
|
|
1549
1671
|
onChange: (event) => {
|
|
@@ -1565,26 +1687,26 @@ var InlineEdit = React24.forwardRef(
|
|
|
1565
1687
|
if (!cancelled.current) finish(true, false);
|
|
1566
1688
|
}
|
|
1567
1689
|
}),
|
|
1568
|
-
(error || showLimits) && /* @__PURE__ */
|
|
1690
|
+
(error || showLimits) && /* @__PURE__ */ jsxs18(
|
|
1569
1691
|
"p",
|
|
1570
1692
|
{
|
|
1571
1693
|
id: errorId,
|
|
1572
1694
|
role: error ? "alert" : void 0,
|
|
1573
1695
|
className: cn("flex items-start justify-between gap-2 px-3 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
1574
1696
|
children: [
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
error && /* @__PURE__ */
|
|
1697
|
+
/* @__PURE__ */ jsxs18("span", { className: "flex items-start gap-2", children: [
|
|
1698
|
+
error && /* @__PURE__ */ jsx26(WarningCircle2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
1577
1699
|
showLimits ? limitsText(minLength, maxLength) : error,
|
|
1578
|
-
showLimits && error && /* @__PURE__ */
|
|
1700
|
+
showLimits && error && /* @__PURE__ */ jsx26("span", { className: "sr-only", children: error })
|
|
1579
1701
|
] }),
|
|
1580
|
-
showLimits && /* @__PURE__ */
|
|
1702
|
+
showLimits && /* @__PURE__ */ jsxs18("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
1581
1703
|
draft.length,
|
|
1582
1704
|
maxLength !== void 0 && `/${maxLength}`
|
|
1583
1705
|
] })
|
|
1584
1706
|
]
|
|
1585
1707
|
}
|
|
1586
1708
|
)
|
|
1587
|
-
] }) : /* @__PURE__ */
|
|
1709
|
+
] }) : /* @__PURE__ */ jsxs18(
|
|
1588
1710
|
"button",
|
|
1589
1711
|
{
|
|
1590
1712
|
ref: readRef,
|
|
@@ -1596,17 +1718,21 @@ var InlineEdit = React24.forwardRef(
|
|
|
1596
1718
|
"group inline-flex min-w-0 max-w-full items-center gap-2 px-3 text-left outline-none",
|
|
1597
1719
|
fill && "w-full",
|
|
1598
1720
|
question ? (
|
|
1599
|
-
// Hover and focus show a 1px bottom border in the input colour; only a selected question gets the 2px accent
|
|
1721
|
+
// Hover and focus show a 1px bottom border in the input colour; only a selected question gets the 2px muted accent
|
|
1600
1722
|
// one. The extra 1px of bottom padding keeps the height identical so the text never jumps.
|
|
1601
|
-
selected ? "rounded-none border-b-2 border-accent-
|
|
1723
|
+
selected ? "rounded-none border-b-2 border-accent-muted py-1" : "rounded-none border-b border-transparent pb-1.25 pt-1 enabled:hover:border-input-muted enabled:focus-visible:border-input-muted"
|
|
1602
1724
|
) : "rounded-md border border-transparent py-1 enabled:focus-visible:border-input-accent",
|
|
1603
1725
|
// The text is editable in place, so hovering it shows the text cursor.
|
|
1604
|
-
|
|
1726
|
+
// A selected question already stands out, so its text field takes no hover background.
|
|
1727
|
+
question && selected ? "enabled:cursor-text" : "enabled:cursor-text enabled:hover:bg-secondary",
|
|
1728
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1605
1729
|
textClasses
|
|
1606
1730
|
),
|
|
1607
1731
|
children: [
|
|
1608
|
-
/* @__PURE__ */
|
|
1609
|
-
|
|
1732
|
+
/* @__PURE__ */ jsx26("span", { className: cn("min-w-0", multiline ? "whitespace-pre-wrap" : "truncate", fill && "flex-1", !value && placeholderTone === "muted" && "text-muted-foreground"), children: value ? splitMarks(value, marks).map(
|
|
1733
|
+
(piece) => piece.mark ? /* @__PURE__ */ jsx26(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : piece.text
|
|
1734
|
+
) : placeholder }),
|
|
1735
|
+
!fill && /* @__PURE__ */ jsx26(
|
|
1610
1736
|
PencilSimple,
|
|
1611
1737
|
{
|
|
1612
1738
|
size: 16,
|
|
@@ -1624,17 +1750,17 @@ var InlineEdit = React24.forwardRef(
|
|
|
1624
1750
|
InlineEdit.displayName = "InlineEdit";
|
|
1625
1751
|
|
|
1626
1752
|
// src/components/Forms & Data Entry/Input.tsx
|
|
1627
|
-
import * as
|
|
1628
|
-
import { jsx as
|
|
1753
|
+
import * as React26 from "react";
|
|
1754
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1629
1755
|
var inputClasses = (status, className) => cn(
|
|
1630
1756
|
"flex h-10 w-full rounded-md px-3 py-2 text-ui-input-value placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
1631
1757
|
fieldSurfaceClasses(status),
|
|
1632
1758
|
className
|
|
1633
1759
|
);
|
|
1634
|
-
var Input =
|
|
1760
|
+
var Input = React26.forwardRef(
|
|
1635
1761
|
({ className, status = "default", label, description, message, id, ...props }, ref) => {
|
|
1636
1762
|
if (label == null && description == null && message == null) {
|
|
1637
|
-
return /* @__PURE__ */
|
|
1763
|
+
return /* @__PURE__ */ jsx27(
|
|
1638
1764
|
"input",
|
|
1639
1765
|
{
|
|
1640
1766
|
ref,
|
|
@@ -1645,16 +1771,16 @@ var Input = React25.forwardRef(
|
|
|
1645
1771
|
}
|
|
1646
1772
|
);
|
|
1647
1773
|
}
|
|
1648
|
-
return /* @__PURE__ */
|
|
1774
|
+
return /* @__PURE__ */ jsx27(Field, { label, description, message, status, id, children: (control) => /* @__PURE__ */ jsx27("input", { ref, className: inputClasses(status, className), ...control, ...props }) });
|
|
1649
1775
|
}
|
|
1650
1776
|
);
|
|
1651
1777
|
Input.displayName = "Input";
|
|
1652
1778
|
|
|
1653
1779
|
// src/components/Forms & Data Entry/InputWithAction.tsx
|
|
1654
|
-
import * as
|
|
1655
|
-
import { jsx as
|
|
1656
|
-
var InputWithAction =
|
|
1657
|
-
({ className, actionLabel, onAction, tags, status = "default", label, description, message, id, disabled, placeholder, ...props }, ref) => /* @__PURE__ */
|
|
1780
|
+
import * as React27 from "react";
|
|
1781
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1782
|
+
var InputWithAction = React27.forwardRef(
|
|
1783
|
+
({ className, actionLabel, onAction, tags, status = "default", label, description, message, id, disabled, placeholder, ...props }, ref) => /* @__PURE__ */ jsx28(Field, { label, description, message, status, id, children: (control) => /* @__PURE__ */ jsxs19(
|
|
1658
1784
|
"div",
|
|
1659
1785
|
{
|
|
1660
1786
|
className: cn(
|
|
@@ -1666,8 +1792,8 @@ var InputWithAction = React26.forwardRef(
|
|
|
1666
1792
|
className
|
|
1667
1793
|
),
|
|
1668
1794
|
children: [
|
|
1669
|
-
tags && /* @__PURE__ */
|
|
1670
|
-
/* @__PURE__ */
|
|
1795
|
+
tags && /* @__PURE__ */ jsx28("div", { className: "flex shrink-0 items-center gap-1", children: tags }),
|
|
1796
|
+
/* @__PURE__ */ jsx28(
|
|
1671
1797
|
"input",
|
|
1672
1798
|
{
|
|
1673
1799
|
ref,
|
|
@@ -1678,7 +1804,7 @@ var InputWithAction = React26.forwardRef(
|
|
|
1678
1804
|
...props
|
|
1679
1805
|
}
|
|
1680
1806
|
),
|
|
1681
|
-
/* @__PURE__ */
|
|
1807
|
+
/* @__PURE__ */ jsx28(Button, { type: "button", variant: "subtle", size: "sm", disabled, onClick: onAction, children: actionLabel })
|
|
1682
1808
|
]
|
|
1683
1809
|
}
|
|
1684
1810
|
) })
|
|
@@ -1686,10 +1812,10 @@ var InputWithAction = React26.forwardRef(
|
|
|
1686
1812
|
InputWithAction.displayName = "InputWithAction";
|
|
1687
1813
|
|
|
1688
1814
|
// src/components/Forms & Data Entry/NumberInput.tsx
|
|
1689
|
-
import * as
|
|
1815
|
+
import * as React28 from "react";
|
|
1690
1816
|
import { Minus as Minus2, Plus as Plus2 } from "@phosphor-icons/react";
|
|
1691
|
-
import { jsx as
|
|
1692
|
-
var NumberInput =
|
|
1817
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1818
|
+
var NumberInput = React28.forwardRef(
|
|
1693
1819
|
({
|
|
1694
1820
|
className,
|
|
1695
1821
|
value,
|
|
@@ -1707,7 +1833,7 @@ var NumberInput = React27.forwardRef(
|
|
|
1707
1833
|
disabled,
|
|
1708
1834
|
...props
|
|
1709
1835
|
}, ref) => {
|
|
1710
|
-
const [internal, setInternal] =
|
|
1836
|
+
const [internal, setInternal] = React28.useState(defaultValue);
|
|
1711
1837
|
const current = value ?? internal;
|
|
1712
1838
|
const clamp = (next) => Math.min(max, Math.max(min, next));
|
|
1713
1839
|
const commit = (next) => {
|
|
@@ -1715,7 +1841,7 @@ var NumberInput = React27.forwardRef(
|
|
|
1715
1841
|
setInternal(clamped);
|
|
1716
1842
|
onValueChange?.(clamped);
|
|
1717
1843
|
};
|
|
1718
|
-
return /* @__PURE__ */
|
|
1844
|
+
return /* @__PURE__ */ jsx29(Field, { label, description, message, status, id, className: "w-50", children: (control) => /* @__PURE__ */ jsxs20(
|
|
1719
1845
|
"div",
|
|
1720
1846
|
{
|
|
1721
1847
|
className: cn(
|
|
@@ -1726,7 +1852,7 @@ var NumberInput = React27.forwardRef(
|
|
|
1726
1852
|
className
|
|
1727
1853
|
),
|
|
1728
1854
|
children: [
|
|
1729
|
-
/* @__PURE__ */
|
|
1855
|
+
/* @__PURE__ */ jsx29(
|
|
1730
1856
|
Button,
|
|
1731
1857
|
{
|
|
1732
1858
|
type: "button",
|
|
@@ -1735,11 +1861,11 @@ var NumberInput = React27.forwardRef(
|
|
|
1735
1861
|
"aria-label": "Decrease",
|
|
1736
1862
|
disabled: disabled || current <= min,
|
|
1737
1863
|
onClick: () => commit(current - step),
|
|
1738
|
-
children: /* @__PURE__ */
|
|
1864
|
+
children: /* @__PURE__ */ jsx29(Minus2, { size: 16, "aria-hidden": true })
|
|
1739
1865
|
}
|
|
1740
1866
|
),
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
/* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-center gap-1 text-center", children: [
|
|
1868
|
+
/* @__PURE__ */ jsx29(
|
|
1743
1869
|
"input",
|
|
1744
1870
|
{
|
|
1745
1871
|
ref,
|
|
@@ -1769,9 +1895,9 @@ var NumberInput = React27.forwardRef(
|
|
|
1769
1895
|
...props
|
|
1770
1896
|
}
|
|
1771
1897
|
),
|
|
1772
|
-
unit && /* @__PURE__ */
|
|
1898
|
+
unit && /* @__PURE__ */ jsx29("span", { className: "text-body-small text-secondary-muted-foreground", children: unit })
|
|
1773
1899
|
] }),
|
|
1774
|
-
/* @__PURE__ */
|
|
1900
|
+
/* @__PURE__ */ jsx29(
|
|
1775
1901
|
Button,
|
|
1776
1902
|
{
|
|
1777
1903
|
type: "button",
|
|
@@ -1780,7 +1906,7 @@ var NumberInput = React27.forwardRef(
|
|
|
1780
1906
|
"aria-label": "Increase",
|
|
1781
1907
|
disabled: disabled || current >= max,
|
|
1782
1908
|
onClick: () => commit(current + step),
|
|
1783
|
-
children: /* @__PURE__ */
|
|
1909
|
+
children: /* @__PURE__ */ jsx29(Plus2, { size: 16, "aria-hidden": true })
|
|
1784
1910
|
}
|
|
1785
1911
|
)
|
|
1786
1912
|
]
|
|
@@ -1791,14 +1917,14 @@ var NumberInput = React27.forwardRef(
|
|
|
1791
1917
|
NumberInput.displayName = "NumberInput";
|
|
1792
1918
|
|
|
1793
1919
|
// src/components/Forms & Data Entry/SearchBar.tsx
|
|
1794
|
-
import * as
|
|
1920
|
+
import * as React29 from "react";
|
|
1795
1921
|
import { MagnifyingGlass, X as X2 } from "@phosphor-icons/react";
|
|
1796
|
-
import { jsx as
|
|
1797
|
-
var SearchBar =
|
|
1922
|
+
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1923
|
+
var SearchBar = React29.forwardRef(
|
|
1798
1924
|
({ className, value, defaultValue, onChange, onClear, clearLabel = "Clear search", disabled, ...props }, ref) => {
|
|
1799
|
-
const innerRef =
|
|
1800
|
-
|
|
1801
|
-
const [uncontrolled, setUncontrolled] =
|
|
1925
|
+
const innerRef = React29.useRef(null);
|
|
1926
|
+
React29.useImperativeHandle(ref, () => innerRef.current);
|
|
1927
|
+
const [uncontrolled, setUncontrolled] = React29.useState(String(defaultValue ?? ""));
|
|
1802
1928
|
const current = value !== void 0 ? String(value) : uncontrolled;
|
|
1803
1929
|
const clear = () => {
|
|
1804
1930
|
const input = innerRef.current;
|
|
@@ -1810,7 +1936,7 @@ var SearchBar = React28.forwardRef(
|
|
|
1810
1936
|
}
|
|
1811
1937
|
onClear?.();
|
|
1812
1938
|
};
|
|
1813
|
-
return /* @__PURE__ */
|
|
1939
|
+
return /* @__PURE__ */ jsxs21(
|
|
1814
1940
|
"div",
|
|
1815
1941
|
{
|
|
1816
1942
|
className: cn(
|
|
@@ -1821,8 +1947,8 @@ var SearchBar = React28.forwardRef(
|
|
|
1821
1947
|
className
|
|
1822
1948
|
),
|
|
1823
1949
|
children: [
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
1950
|
+
/* @__PURE__ */ jsx30(MagnifyingGlass, { size: 16, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
|
|
1951
|
+
/* @__PURE__ */ jsx30(
|
|
1826
1952
|
"input",
|
|
1827
1953
|
{
|
|
1828
1954
|
ref: innerRef,
|
|
@@ -1839,14 +1965,14 @@ var SearchBar = React28.forwardRef(
|
|
|
1839
1965
|
...props
|
|
1840
1966
|
}
|
|
1841
1967
|
),
|
|
1842
|
-
current !== "" && !disabled && /* @__PURE__ */
|
|
1968
|
+
current !== "" && !disabled && /* @__PURE__ */ jsx30(
|
|
1843
1969
|
"button",
|
|
1844
1970
|
{
|
|
1845
1971
|
type: "button",
|
|
1846
1972
|
"aria-label": clearLabel,
|
|
1847
1973
|
onClick: clear,
|
|
1848
1974
|
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-xs text-surface-foreground",
|
|
1849
|
-
children: /* @__PURE__ */
|
|
1975
|
+
children: /* @__PURE__ */ jsx30(X2, { size: 16, "aria-hidden": true })
|
|
1850
1976
|
}
|
|
1851
1977
|
)
|
|
1852
1978
|
]
|
|
@@ -1857,16 +1983,16 @@ var SearchBar = React28.forwardRef(
|
|
|
1857
1983
|
SearchBar.displayName = "SearchBar";
|
|
1858
1984
|
|
|
1859
1985
|
// src/components/Forms & Data Entry/Select.tsx
|
|
1860
|
-
import * as
|
|
1986
|
+
import * as React30 from "react";
|
|
1861
1987
|
import { CaretDown as CaretDown3 } from "@phosphor-icons/react";
|
|
1862
1988
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
1863
|
-
import { jsx as
|
|
1989
|
+
import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1864
1990
|
var Select = SelectPrimitive.Root;
|
|
1865
1991
|
var SelectValue = SelectPrimitive.Value;
|
|
1866
1992
|
var SelectGroup = SelectPrimitive.Group;
|
|
1867
|
-
var CheckIcon = () => /* @__PURE__ */
|
|
1868
|
-
var SelectTrigger =
|
|
1869
|
-
({ className, children, icon, ...props }, ref) => /* @__PURE__ */
|
|
1993
|
+
var CheckIcon = () => /* @__PURE__ */ jsx31("svg", { width: "10", height: "8", viewBox: "0 0 10 8", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx31("path", { d: "M1 4L3.5 6.5L9 1", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1994
|
+
var SelectTrigger = React30.forwardRef(
|
|
1995
|
+
({ className, children, icon, ...props }, ref) => /* @__PURE__ */ jsxs22(
|
|
1870
1996
|
SelectPrimitive.Trigger,
|
|
1871
1997
|
{
|
|
1872
1998
|
ref,
|
|
@@ -1879,16 +2005,16 @@ var SelectTrigger = React29.forwardRef(
|
|
|
1879
2005
|
),
|
|
1880
2006
|
...props,
|
|
1881
2007
|
children: [
|
|
1882
|
-
icon && /* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
/* @__PURE__ */
|
|
2008
|
+
icon && /* @__PURE__ */ jsx31("span", { className: "flex shrink-0 text-surface-foreground", children: icon }),
|
|
2009
|
+
/* @__PURE__ */ jsx31("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
2010
|
+
/* @__PURE__ */ jsx31(SelectPrimitive.Icon, { className: "shrink-0 text-surface-foreground", children: /* @__PURE__ */ jsx31(CaretDown3, { size: 16, "aria-hidden": true }) })
|
|
1885
2011
|
]
|
|
1886
2012
|
}
|
|
1887
2013
|
)
|
|
1888
2014
|
);
|
|
1889
2015
|
SelectTrigger.displayName = "SelectTrigger";
|
|
1890
|
-
var SelectContent =
|
|
1891
|
-
({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */
|
|
2016
|
+
var SelectContent = React30.forwardRef(
|
|
2017
|
+
({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx31(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx31(
|
|
1892
2018
|
SelectPrimitive.Content,
|
|
1893
2019
|
{
|
|
1894
2020
|
ref,
|
|
@@ -1902,13 +2028,13 @@ var SelectContent = React29.forwardRef(
|
|
|
1902
2028
|
className
|
|
1903
2029
|
),
|
|
1904
2030
|
...props,
|
|
1905
|
-
children: /* @__PURE__ */
|
|
2031
|
+
children: /* @__PURE__ */ jsx31(SelectPrimitive.Viewport, { className: "p-1", children })
|
|
1906
2032
|
}
|
|
1907
2033
|
) })
|
|
1908
2034
|
);
|
|
1909
2035
|
SelectContent.displayName = "SelectContent";
|
|
1910
|
-
var SelectItem =
|
|
1911
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
2036
|
+
var SelectItem = React30.forwardRef(
|
|
2037
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs22(
|
|
1912
2038
|
SelectPrimitive.Item,
|
|
1913
2039
|
{
|
|
1914
2040
|
ref,
|
|
@@ -1919,8 +2045,8 @@ var SelectItem = React29.forwardRef(
|
|
|
1919
2045
|
),
|
|
1920
2046
|
...props,
|
|
1921
2047
|
children: [
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
2048
|
+
/* @__PURE__ */ jsx31("span", { className: "absolute left-2 flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ jsx31(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx31(CheckIcon, {}) }) }),
|
|
2049
|
+
/* @__PURE__ */ jsx31(SelectPrimitive.ItemText, { children })
|
|
1924
2050
|
]
|
|
1925
2051
|
}
|
|
1926
2052
|
)
|
|
@@ -1928,10 +2054,10 @@ var SelectItem = React29.forwardRef(
|
|
|
1928
2054
|
SelectItem.displayName = "SelectItem";
|
|
1929
2055
|
|
|
1930
2056
|
// src/components/Forms & Data Entry/Slider.tsx
|
|
1931
|
-
import * as
|
|
2057
|
+
import * as React31 from "react";
|
|
1932
2058
|
import { Slider as SliderPrimitive } from "radix-ui";
|
|
1933
|
-
import { jsx as
|
|
1934
|
-
var Slider =
|
|
2059
|
+
import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2060
|
+
var Slider = React31.forwardRef(
|
|
1935
2061
|
({
|
|
1936
2062
|
className,
|
|
1937
2063
|
value,
|
|
@@ -1946,15 +2072,15 @@ var Slider = React30.forwardRef(
|
|
|
1946
2072
|
"aria-labelledby": ariaLabelledBy,
|
|
1947
2073
|
...props
|
|
1948
2074
|
}, ref) => {
|
|
1949
|
-
const [internal, setInternal] =
|
|
2075
|
+
const [internal, setInternal] = React31.useState(defaultValue ?? [min]);
|
|
1950
2076
|
const thumbValues = value ?? internal;
|
|
1951
2077
|
const hasHeader = label != null || showRange;
|
|
1952
|
-
return /* @__PURE__ */
|
|
1953
|
-
hasHeader && /* @__PURE__ */
|
|
1954
|
-
label != null ? /* @__PURE__ */
|
|
1955
|
-
/* @__PURE__ */
|
|
2078
|
+
return /* @__PURE__ */ jsxs23("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
2079
|
+
hasHeader && /* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between text-secondary-muted-foreground", children: [
|
|
2080
|
+
label != null ? /* @__PURE__ */ jsx32("span", { className: "text-ui-label text-surface-foreground", children: label }) : /* @__PURE__ */ jsx32("span", { className: "text-ui-caption", children: min }),
|
|
2081
|
+
/* @__PURE__ */ jsx32("span", { className: "text-body-small", children: max })
|
|
1956
2082
|
] }),
|
|
1957
|
-
/* @__PURE__ */
|
|
2083
|
+
/* @__PURE__ */ jsxs23(
|
|
1958
2084
|
SliderPrimitive.Root,
|
|
1959
2085
|
{
|
|
1960
2086
|
ref,
|
|
@@ -1969,19 +2095,19 @@ var Slider = React30.forwardRef(
|
|
|
1969
2095
|
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
1970
2096
|
...props,
|
|
1971
2097
|
children: [
|
|
1972
|
-
/* @__PURE__ */
|
|
2098
|
+
/* @__PURE__ */ jsx32(SliderPrimitive.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-muted", children: /* @__PURE__ */ jsx32(SliderPrimitive.Range, { className: "absolute h-full bg-input-accent" }) }),
|
|
1973
2099
|
thumbValues.map((thumbValue, index) => (
|
|
1974
2100
|
// The accessible name belongs on each individual thumb (the actual
|
|
1975
2101
|
// role="slider" element) — Root is just a group container. With
|
|
1976
2102
|
// more than one thumb this applies the same label to each; give a
|
|
1977
2103
|
// range slider distinct per-thumb labels via aria-labelledby instead.
|
|
1978
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ jsx32(
|
|
1979
2105
|
SliderPrimitive.Thumb,
|
|
1980
2106
|
{
|
|
1981
2107
|
"aria-label": ariaLabel,
|
|
1982
2108
|
"aria-labelledby": ariaLabelledBy,
|
|
1983
2109
|
className: "group relative block size-4 rounded-full border-2 border-surface bg-input-accent shadow-sm transition-colors disabled:pointer-events-none disabled:opacity-50",
|
|
1984
|
-
children: showValue && /* @__PURE__ */
|
|
2110
|
+
children: showValue && /* @__PURE__ */ jsx32(
|
|
1985
2111
|
"span",
|
|
1986
2112
|
{
|
|
1987
2113
|
"aria-hidden": "true",
|
|
@@ -2005,17 +2131,17 @@ var Slider = React30.forwardRef(
|
|
|
2005
2131
|
Slider.displayName = "Slider";
|
|
2006
2132
|
|
|
2007
2133
|
// src/components/Forms & Data Entry/Textarea.tsx
|
|
2008
|
-
import * as
|
|
2009
|
-
import { jsx as
|
|
2134
|
+
import * as React32 from "react";
|
|
2135
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
2010
2136
|
var textareaClasses = (status, className) => cn(
|
|
2011
2137
|
"flex field-sizing-content min-h-25 w-full rounded-md px-3 py-2.5 text-body-base placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
2012
2138
|
fieldSurfaceClasses(status),
|
|
2013
2139
|
className
|
|
2014
2140
|
);
|
|
2015
|
-
var Textarea =
|
|
2141
|
+
var Textarea = React32.forwardRef(
|
|
2016
2142
|
({ className, status = "default", label, description, message, id, ...props }, ref) => {
|
|
2017
2143
|
if (label == null && description == null && message == null) {
|
|
2018
|
-
return /* @__PURE__ */
|
|
2144
|
+
return /* @__PURE__ */ jsx33(
|
|
2019
2145
|
"textarea",
|
|
2020
2146
|
{
|
|
2021
2147
|
ref,
|
|
@@ -2026,29 +2152,29 @@ var Textarea = React31.forwardRef(
|
|
|
2026
2152
|
}
|
|
2027
2153
|
);
|
|
2028
2154
|
}
|
|
2029
|
-
return /* @__PURE__ */
|
|
2155
|
+
return /* @__PURE__ */ jsx33(Field, { label, description, message, status, id, children: (control) => /* @__PURE__ */ jsx33("textarea", { ref, className: textareaClasses(status, className), ...control, ...props }) });
|
|
2030
2156
|
}
|
|
2031
2157
|
);
|
|
2032
2158
|
Textarea.displayName = "Textarea";
|
|
2033
2159
|
|
|
2034
2160
|
// src/components/Overlays & Feedback/Dialog.tsx
|
|
2035
|
-
import * as
|
|
2161
|
+
import * as React33 from "react";
|
|
2036
2162
|
import { X as X3 } from "@phosphor-icons/react";
|
|
2037
2163
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
2038
|
-
import { jsx as
|
|
2164
|
+
import { jsx as jsx34, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2039
2165
|
var Dialog = DialogPrimitive.Root;
|
|
2040
2166
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
2041
2167
|
var DialogClose = DialogPrimitive.Close;
|
|
2042
|
-
var DialogContent =
|
|
2043
|
-
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */
|
|
2044
|
-
/* @__PURE__ */
|
|
2168
|
+
var DialogContent = React33.forwardRef(
|
|
2169
|
+
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */ jsxs24(DialogPrimitive.Portal, { children: [
|
|
2170
|
+
/* @__PURE__ */ jsx34(
|
|
2045
2171
|
DialogPrimitive.Overlay,
|
|
2046
2172
|
{
|
|
2047
2173
|
style: { zIndex: "var(--sys-z-30)" },
|
|
2048
2174
|
className: "fixed inset-0 bg-primary/30"
|
|
2049
2175
|
}
|
|
2050
2176
|
),
|
|
2051
|
-
/* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ jsxs24(
|
|
2052
2178
|
DialogPrimitive.Content,
|
|
2053
2179
|
{
|
|
2054
2180
|
ref,
|
|
@@ -2060,15 +2186,15 @@ var DialogContent = React32.forwardRef(
|
|
|
2060
2186
|
...props,
|
|
2061
2187
|
children: [
|
|
2062
2188
|
children,
|
|
2063
|
-
!hideClose && /* @__PURE__ */
|
|
2189
|
+
!hideClose && /* @__PURE__ */ jsx34(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx34(Button, { variant: "ghost", size: "icon-sm", "aria-label": closeLabel, className: "absolute top-4 right-6", children: /* @__PURE__ */ jsx34(X3, { size: 16, "aria-hidden": true }) }) })
|
|
2064
2190
|
]
|
|
2065
2191
|
}
|
|
2066
2192
|
)
|
|
2067
2193
|
] })
|
|
2068
2194
|
);
|
|
2069
2195
|
DialogContent.displayName = "DialogContent";
|
|
2070
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
2071
|
-
var DialogTitle =
|
|
2196
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx34("div", { className: cn("flex flex-col gap-1.5 border-b border-border px-6 py-4 pr-16", className), ...props });
|
|
2197
|
+
var DialogTitle = React33.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
2072
2198
|
DialogPrimitive.Title,
|
|
2073
2199
|
{
|
|
2074
2200
|
ref,
|
|
@@ -2077,7 +2203,7 @@ var DialogTitle = React32.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
2077
2203
|
}
|
|
2078
2204
|
));
|
|
2079
2205
|
DialogTitle.displayName = "DialogTitle";
|
|
2080
|
-
var DialogDescription =
|
|
2206
|
+
var DialogDescription = React33.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
2081
2207
|
DialogPrimitive.Description,
|
|
2082
2208
|
{
|
|
2083
2209
|
ref,
|
|
@@ -2086,15 +2212,15 @@ var DialogDescription = React32.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2086
2212
|
}
|
|
2087
2213
|
));
|
|
2088
2214
|
DialogDescription.displayName = "DialogDescription";
|
|
2089
|
-
var DialogBody = ({ className, ...props }) => /* @__PURE__ */
|
|
2090
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
2215
|
+
var DialogBody = ({ className, ...props }) => /* @__PURE__ */ jsx34("div", { className: cn("flex flex-col gap-4 p-6", className), ...props });
|
|
2216
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx34("div", { className: cn("flex items-center justify-end gap-3 border-t border-border px-6 py-4", className), ...props });
|
|
2091
2217
|
|
|
2092
2218
|
// src/components/Overlays & Feedback/Toast.tsx
|
|
2093
|
-
import * as
|
|
2219
|
+
import * as React34 from "react";
|
|
2094
2220
|
import { CheckCircle as CheckCircle2, Info, Warning, WarningCircle as WarningCircle3, X as X4 } from "@phosphor-icons/react";
|
|
2095
2221
|
import { cva as cva4 } from "class-variance-authority";
|
|
2096
2222
|
import { Toast as ToastPrimitive } from "radix-ui";
|
|
2097
|
-
import { jsx as
|
|
2223
|
+
import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2098
2224
|
var toastVariants = cva4("border", {
|
|
2099
2225
|
variants: {
|
|
2100
2226
|
variant: {
|
|
@@ -2132,13 +2258,13 @@ var titleColour = {
|
|
|
2132
2258
|
};
|
|
2133
2259
|
function VariantIcon({ variant, size }) {
|
|
2134
2260
|
const props = { size, "aria-hidden": true, className: cn("shrink-0", iconColour[variant]) };
|
|
2135
|
-
if (variant === "success") return /* @__PURE__ */
|
|
2136
|
-
if (variant === "warning") return /* @__PURE__ */
|
|
2137
|
-
if (variant === "destructive") return /* @__PURE__ */
|
|
2138
|
-
return /* @__PURE__ */
|
|
2261
|
+
if (variant === "success") return /* @__PURE__ */ jsx35(CheckCircle2, { ...props });
|
|
2262
|
+
if (variant === "warning") return /* @__PURE__ */ jsx35(Warning, { ...props });
|
|
2263
|
+
if (variant === "destructive") return /* @__PURE__ */ jsx35(WarningCircle3, { ...props });
|
|
2264
|
+
return /* @__PURE__ */ jsx35(Info, { ...props });
|
|
2139
2265
|
}
|
|
2140
2266
|
var ToastProvider = ToastPrimitive.Provider;
|
|
2141
|
-
var ToastViewport =
|
|
2267
|
+
var ToastViewport = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx35(
|
|
2142
2268
|
ToastPrimitive.Viewport,
|
|
2143
2269
|
{
|
|
2144
2270
|
ref,
|
|
@@ -2148,10 +2274,10 @@ var ToastViewport = React33.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
2148
2274
|
}
|
|
2149
2275
|
));
|
|
2150
2276
|
ToastViewport.displayName = "ToastViewport";
|
|
2151
|
-
var Toast =
|
|
2277
|
+
var Toast = React34.forwardRef(
|
|
2152
2278
|
({ className, variant = "info", title, description, action, closeLabel = "Close", children, ...props }, ref) => {
|
|
2153
2279
|
const v = variant ?? "info";
|
|
2154
|
-
return /* @__PURE__ */
|
|
2280
|
+
return /* @__PURE__ */ jsxs25(
|
|
2155
2281
|
ToastPrimitive.Root,
|
|
2156
2282
|
{
|
|
2157
2283
|
ref,
|
|
@@ -2159,19 +2285,19 @@ var Toast = React33.forwardRef(
|
|
|
2159
2285
|
className: cn("flex items-start gap-3 rounded-lg p-4 shadow-lg", toastVariants({ variant: v }), className),
|
|
2160
2286
|
...props,
|
|
2161
2287
|
children: [
|
|
2162
|
-
/* @__PURE__ */
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
title != null && /* @__PURE__ */
|
|
2165
|
-
description != null && /* @__PURE__ */
|
|
2288
|
+
/* @__PURE__ */ jsx35(VariantIcon, { variant: v, size: 20 }),
|
|
2289
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex min-w-0 flex-1 flex-col gap-1 text-body-small", children: [
|
|
2290
|
+
title != null && /* @__PURE__ */ jsx35(ToastPrimitive.Title, { className: cn("font-semibold", titleColour[v]), children: title }),
|
|
2291
|
+
description != null && /* @__PURE__ */ jsx35(ToastPrimitive.Description, { className: "text-secondary-muted-foreground", children: description }),
|
|
2166
2292
|
children,
|
|
2167
2293
|
action
|
|
2168
2294
|
] }),
|
|
2169
|
-
/* @__PURE__ */
|
|
2295
|
+
/* @__PURE__ */ jsx35(
|
|
2170
2296
|
ToastPrimitive.Close,
|
|
2171
2297
|
{
|
|
2172
2298
|
"aria-label": closeLabel,
|
|
2173
2299
|
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-xs text-surface-foreground",
|
|
2174
|
-
children: /* @__PURE__ */
|
|
2300
|
+
children: /* @__PURE__ */ jsx35(X4, { size: 16, "aria-hidden": true })
|
|
2175
2301
|
}
|
|
2176
2302
|
)
|
|
2177
2303
|
]
|
|
@@ -2181,21 +2307,27 @@ var Toast = React33.forwardRef(
|
|
|
2181
2307
|
);
|
|
2182
2308
|
Toast.displayName = "Toast";
|
|
2183
2309
|
var ToastAction = ToastPrimitive.Action;
|
|
2184
|
-
var ToastInline =
|
|
2185
|
-
({ className, variant = "info", actions, onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2310
|
+
var ToastInline = React34.forwardRef(
|
|
2311
|
+
({ className, variant = "info", actions, actionsPlacement = "end", onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2186
2312
|
const v = variant ?? "info";
|
|
2187
|
-
|
|
2313
|
+
const below = actionsPlacement === "bottom" && !!actions;
|
|
2314
|
+
return /* @__PURE__ */ jsxs25(
|
|
2188
2315
|
"div",
|
|
2189
2316
|
{
|
|
2190
2317
|
ref,
|
|
2191
2318
|
role: v === "destructive" ? "alert" : "status",
|
|
2192
|
-
className: cn("flex
|
|
2319
|
+
className: cn("flex gap-2 rounded-sm px-2 py-1.5", below ? "items-start" : "items-center", inlineVariants({ variant: v }), className),
|
|
2193
2320
|
...props,
|
|
2194
2321
|
children: [
|
|
2195
|
-
/* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
|
|
2198
|
-
|
|
2322
|
+
/* @__PURE__ */ jsx35("span", { className: cn("inline-flex shrink-0", below && "mt-0.5"), children: /* @__PURE__ */ jsx35(VariantIcon, { variant: v === "neutral" ? "info" : v, size: 16 }) }),
|
|
2323
|
+
below ? /* @__PURE__ */ jsxs25("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2324
|
+
/* @__PURE__ */ jsx35("p", { className: "text-body-small text-secondary-muted-foreground", children }),
|
|
2325
|
+
/* @__PURE__ */ jsx35("div", { className: "flex items-center gap-2", children: actions })
|
|
2326
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment6, { children: [
|
|
2327
|
+
/* @__PURE__ */ jsx35("p", { className: "min-w-0 flex-1 text-body-small text-secondary-muted-foreground", children }),
|
|
2328
|
+
actions && /* @__PURE__ */ jsx35("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
2329
|
+
] }),
|
|
2330
|
+
onClose && /* @__PURE__ */ jsx35(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx35(X4, { size: 16, "aria-hidden": true }) })
|
|
2199
2331
|
]
|
|
2200
2332
|
}
|
|
2201
2333
|
);
|
|
@@ -2204,16 +2336,16 @@ var ToastInline = React33.forwardRef(
|
|
|
2204
2336
|
ToastInline.displayName = "ToastInline";
|
|
2205
2337
|
|
|
2206
2338
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
2207
|
-
import * as
|
|
2339
|
+
import * as React35 from "react";
|
|
2208
2340
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2209
|
-
import { Fragment as
|
|
2341
|
+
import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2210
2342
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
2211
2343
|
var Tooltip = TooltipPrimitive.Root;
|
|
2212
2344
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
2213
|
-
var TooltipContent =
|
|
2345
|
+
var TooltipContent = React35.forwardRef(
|
|
2214
2346
|
({ className, sideOffset = 4, title, description, action, arrow = true, children, ...props }, ref) => {
|
|
2215
2347
|
const detailed = title != null || description != null;
|
|
2216
|
-
return /* @__PURE__ */
|
|
2348
|
+
return /* @__PURE__ */ jsx36(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs26(
|
|
2217
2349
|
TooltipPrimitive.Content,
|
|
2218
2350
|
{
|
|
2219
2351
|
ref,
|
|
@@ -2227,12 +2359,12 @@ var TooltipContent = React34.forwardRef(
|
|
|
2227
2359
|
),
|
|
2228
2360
|
...props,
|
|
2229
2361
|
children: [
|
|
2230
|
-
detailed ? /* @__PURE__ */
|
|
2231
|
-
title != null && /* @__PURE__ */
|
|
2232
|
-
description != null && /* @__PURE__ */
|
|
2233
|
-
action != null && /* @__PURE__ */
|
|
2362
|
+
detailed ? /* @__PURE__ */ jsxs26(Fragment7, { children: [
|
|
2363
|
+
title != null && /* @__PURE__ */ jsx36("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2364
|
+
description != null && /* @__PURE__ */ jsx36("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2365
|
+
action != null && /* @__PURE__ */ jsx36("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
2234
2366
|
] }) : children,
|
|
2235
|
-
arrow && /* @__PURE__ */
|
|
2367
|
+
arrow && /* @__PURE__ */ jsx36(TooltipPrimitive.Arrow, { width: 12, height: 8, className: "fill-primary-soft-foreground" })
|
|
2236
2368
|
]
|
|
2237
2369
|
}
|
|
2238
2370
|
) });
|
|
@@ -2241,14 +2373,14 @@ var TooltipContent = React34.forwardRef(
|
|
|
2241
2373
|
TooltipContent.displayName = "TooltipContent";
|
|
2242
2374
|
|
|
2243
2375
|
// src/components/Question Types/FileUpload.tsx
|
|
2244
|
-
import * as
|
|
2376
|
+
import * as React37 from "react";
|
|
2245
2377
|
import { FileText, X as X5 } from "@phosphor-icons/react";
|
|
2246
2378
|
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
2247
2379
|
|
|
2248
2380
|
// src/components/Tags & Badges/Tag.tsx
|
|
2249
|
-
import * as
|
|
2381
|
+
import * as React36 from "react";
|
|
2250
2382
|
import { cva as cva5 } from "class-variance-authority";
|
|
2251
|
-
import { jsx as
|
|
2383
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2252
2384
|
var tagVariants = cva5(
|
|
2253
2385
|
"inline-flex items-center gap-1.5 whitespace-nowrap rounded-sm border px-2.5 py-1 text-ui-caption",
|
|
2254
2386
|
{
|
|
@@ -2264,7 +2396,7 @@ var tagVariants = cva5(
|
|
|
2264
2396
|
defaultVariants: { variant: "neutral" }
|
|
2265
2397
|
}
|
|
2266
2398
|
);
|
|
2267
|
-
var Tag =
|
|
2399
|
+
var Tag = React36.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx37("span", { ref, className: cn(tagVariants({ variant }), className), ...props }));
|
|
2268
2400
|
Tag.displayName = "Tag";
|
|
2269
2401
|
var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
2270
2402
|
variants: {
|
|
@@ -2277,20 +2409,20 @@ var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
|
2277
2409
|
},
|
|
2278
2410
|
defaultVariants: { status: "active" }
|
|
2279
2411
|
});
|
|
2280
|
-
var StatusTag =
|
|
2281
|
-
({ className, status, children, ...props }, ref) => /* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2412
|
+
var StatusTag = React36.forwardRef(
|
|
2413
|
+
({ className, status, children, ...props }, ref) => /* @__PURE__ */ jsxs27("span", { ref, className: cn(tagVariants({ variant: "default" }), className), ...props, children: [
|
|
2414
|
+
/* @__PURE__ */ jsx37("span", { className: statusDotVariants({ status }), "aria-hidden": "true" }),
|
|
2283
2415
|
children
|
|
2284
2416
|
] })
|
|
2285
2417
|
);
|
|
2286
2418
|
StatusTag.displayName = "StatusTag";
|
|
2287
2419
|
|
|
2288
2420
|
// src/components/Question Types/FileUpload.tsx
|
|
2289
|
-
import { Fragment as
|
|
2290
|
-
var FileUploadZone =
|
|
2421
|
+
import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2422
|
+
var FileUploadZone = React37.forwardRef(
|
|
2291
2423
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2292
|
-
const [over, setOver] =
|
|
2293
|
-
return /* @__PURE__ */
|
|
2424
|
+
const [over, setOver] = React37.useState(false);
|
|
2425
|
+
return /* @__PURE__ */ jsxs28(
|
|
2294
2426
|
"label",
|
|
2295
2427
|
{
|
|
2296
2428
|
className: cn(
|
|
@@ -2310,12 +2442,12 @@ var FileUploadZone = React36.forwardRef(
|
|
|
2310
2442
|
onFiles?.(Array.from(event.dataTransfer.files));
|
|
2311
2443
|
},
|
|
2312
2444
|
children: [
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
hint && /* @__PURE__ */
|
|
2445
|
+
/* @__PURE__ */ jsx38("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__ */ jsx38(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2446
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex flex-col gap-1", children: [
|
|
2447
|
+
/* @__PURE__ */ jsx38("span", { className: "text-body-small text-surface-foreground", children: title }),
|
|
2448
|
+
hint && /* @__PURE__ */ jsx38("span", { className: "text-ui-caption text-secondary-muted-foreground", children: hint })
|
|
2317
2449
|
] }),
|
|
2318
|
-
/* @__PURE__ */
|
|
2450
|
+
/* @__PURE__ */ jsx38(
|
|
2319
2451
|
"input",
|
|
2320
2452
|
{
|
|
2321
2453
|
ref,
|
|
@@ -2331,47 +2463,47 @@ var FileUploadZone = React36.forwardRef(
|
|
|
2331
2463
|
}
|
|
2332
2464
|
);
|
|
2333
2465
|
FileUploadZone.displayName = "FileUploadZone";
|
|
2334
|
-
var FileUploadItem =
|
|
2466
|
+
var FileUploadItem = React37.forwardRef(
|
|
2335
2467
|
({ className, name, size, status = "uploading", progress = 0, timeLeft, icon, onRemove, removeLabel, ...props }, ref) => {
|
|
2336
2468
|
const uploading = status === "uploading";
|
|
2337
|
-
return /* @__PURE__ */
|
|
2469
|
+
return /* @__PURE__ */ jsxs28(
|
|
2338
2470
|
"div",
|
|
2339
2471
|
{
|
|
2340
2472
|
ref,
|
|
2341
2473
|
className: cn("flex w-full flex-col justify-center gap-2 overflow-hidden rounded-sm border border-border p-2", className),
|
|
2342
2474
|
...props,
|
|
2343
2475
|
children: [
|
|
2344
|
-
/* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2347
|
-
/* @__PURE__ */
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
onRemove && /* @__PURE__ */
|
|
2476
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
|
|
2477
|
+
/* @__PURE__ */ jsx38("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__ */ jsx38(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2478
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2479
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2480
|
+
/* @__PURE__ */ jsx38("p", { className: "min-w-0 truncate text-ui-label text-surface-foreground", children: name }),
|
|
2481
|
+
onRemove && /* @__PURE__ */ jsx38(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx38(X5, { size: 16, "aria-hidden": true }) })
|
|
2350
2482
|
] }),
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
/* @__PURE__ */
|
|
2483
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2484
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex items-center gap-2", children: [
|
|
2353
2485
|
size,
|
|
2354
|
-
status === "complete" && /* @__PURE__ */
|
|
2355
|
-
status === "error" && /* @__PURE__ */
|
|
2356
|
-
uploading && timeLeft && /* @__PURE__ */
|
|
2357
|
-
/* @__PURE__ */
|
|
2486
|
+
status === "complete" && /* @__PURE__ */ jsx38(Tag, { variant: "success", children: "Complete" }),
|
|
2487
|
+
status === "error" && /* @__PURE__ */ jsx38(Tag, { variant: "destructive", children: "Error" }),
|
|
2488
|
+
uploading && timeLeft && /* @__PURE__ */ jsxs28(Fragment8, { children: [
|
|
2489
|
+
/* @__PURE__ */ jsx38("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2358
2490
|
timeLeft
|
|
2359
2491
|
] })
|
|
2360
2492
|
] }),
|
|
2361
|
-
uploading && /* @__PURE__ */
|
|
2493
|
+
uploading && /* @__PURE__ */ jsxs28("span", { className: "text-body-xxs font-normal", children: [
|
|
2362
2494
|
Math.round(progress),
|
|
2363
2495
|
"%"
|
|
2364
2496
|
] })
|
|
2365
2497
|
] })
|
|
2366
2498
|
] })
|
|
2367
2499
|
] }),
|
|
2368
|
-
uploading && /* @__PURE__ */
|
|
2500
|
+
uploading && /* @__PURE__ */ jsx38(
|
|
2369
2501
|
ProgressPrimitive.Root,
|
|
2370
2502
|
{
|
|
2371
2503
|
value: progress,
|
|
2372
2504
|
"aria-label": `Uploading ${name}`,
|
|
2373
2505
|
className: "h-0.75 w-full overflow-hidden rounded-sm bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5",
|
|
2374
|
-
children: /* @__PURE__ */
|
|
2506
|
+
children: /* @__PURE__ */ jsx38(ProgressPrimitive.Indicator, { className: "h-full bg-accent transition-[width]", style: { width: `${progress}%` } })
|
|
2375
2507
|
}
|
|
2376
2508
|
)
|
|
2377
2509
|
]
|
|
@@ -2382,25 +2514,25 @@ var FileUploadItem = React36.forwardRef(
|
|
|
2382
2514
|
FileUploadItem.displayName = "FileUploadItem";
|
|
2383
2515
|
|
|
2384
2516
|
// src/components/Question Types/Media.tsx
|
|
2385
|
-
import * as
|
|
2386
|
-
import { CornersOut, DotsThree, Image as ImageIcon, Pause, Play, SpeakerSimpleHigh, SpeakerSimpleX, Trash as
|
|
2517
|
+
import * as React38 from "react";
|
|
2518
|
+
import { CornersOut, DotsThree, Image as ImageIcon, Pause, Play, SpeakerSimpleHigh, SpeakerSimpleX, Trash as Trash3 } from "@phosphor-icons/react";
|
|
2387
2519
|
import { Slider as SliderPrimitive2, ToggleGroup as ToggleGroupPrimitive2 } from "radix-ui";
|
|
2388
|
-
import { jsx as
|
|
2520
|
+
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2389
2521
|
function MediaInfo({ name, details, onRemove, removeLabel, large, className, ...props }) {
|
|
2390
|
-
return /* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2393
|
-
details && /* @__PURE__ */
|
|
2394
|
-
index > 0 && /* @__PURE__ */
|
|
2522
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("flex items-center justify-between border-t border-border bg-surface px-6 py-4", className), ...props, children: [
|
|
2523
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2524
|
+
/* @__PURE__ */ jsx39("p", { className: cn("truncate text-surface-foreground", large ? "text-body-section" : "text-ui-label"), children: name }),
|
|
2525
|
+
details && /* @__PURE__ */ jsx39("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__ */ jsxs29(React38.Fragment, { children: [
|
|
2526
|
+
index > 0 && /* @__PURE__ */ jsx39("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2395
2527
|
part
|
|
2396
2528
|
] }, part)) })
|
|
2397
2529
|
] }),
|
|
2398
|
-
onRemove && /* @__PURE__ */
|
|
2530
|
+
onRemove && /* @__PURE__ */ jsx39(Button, { type: "button", variant: "destructive", size: "icon", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx39(Trash3, { size: 16, "aria-hidden": true }) })
|
|
2399
2531
|
] });
|
|
2400
2532
|
}
|
|
2401
|
-
var ImagePreview =
|
|
2402
|
-
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */
|
|
2403
|
-
/* @__PURE__ */
|
|
2533
|
+
var ImagePreview = React38.forwardRef(
|
|
2534
|
+
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */ jsxs29("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border", className), ...props, children: [
|
|
2535
|
+
/* @__PURE__ */ jsx39(
|
|
2404
2536
|
"div",
|
|
2405
2537
|
{
|
|
2406
2538
|
className: cn(
|
|
@@ -2411,12 +2543,12 @@ var ImagePreview = React37.forwardRef(
|
|
|
2411
2543
|
children
|
|
2412
2544
|
}
|
|
2413
2545
|
),
|
|
2414
|
-
/* @__PURE__ */
|
|
2546
|
+
/* @__PURE__ */ jsx39(MediaInfo, { name, details, onRemove, large: true })
|
|
2415
2547
|
] })
|
|
2416
2548
|
);
|
|
2417
2549
|
ImagePreview.displayName = "ImagePreview";
|
|
2418
|
-
var ImageThumbnails =
|
|
2419
|
-
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */
|
|
2550
|
+
var ImageThumbnails = React38.forwardRef(
|
|
2551
|
+
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
2420
2552
|
ToggleGroupPrimitive2.Root,
|
|
2421
2553
|
{
|
|
2422
2554
|
ref,
|
|
@@ -2428,17 +2560,17 @@ var ImageThumbnails = React37.forwardRef(
|
|
|
2428
2560
|
children: Array.from({ length: max }, (_, index) => {
|
|
2429
2561
|
const image = images[index];
|
|
2430
2562
|
if (!image) {
|
|
2431
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ jsx39(
|
|
2432
2564
|
"span",
|
|
2433
2565
|
{
|
|
2434
2566
|
"aria-hidden": "true",
|
|
2435
2567
|
className: "flex h-20 min-w-0 flex-1 items-center justify-center rounded-sm border border-dashed border-border text-accent-foreground",
|
|
2436
|
-
children: /* @__PURE__ */
|
|
2568
|
+
children: /* @__PURE__ */ jsx39(ImageIcon, { size: 24 })
|
|
2437
2569
|
},
|
|
2438
2570
|
`empty-${index}`
|
|
2439
2571
|
);
|
|
2440
2572
|
}
|
|
2441
|
-
return /* @__PURE__ */
|
|
2573
|
+
return /* @__PURE__ */ jsx39(
|
|
2442
2574
|
ToggleGroupPrimitive2.Item,
|
|
2443
2575
|
{
|
|
2444
2576
|
value: image.id,
|
|
@@ -2448,7 +2580,7 @@ var ImageThumbnails = React37.forwardRef(
|
|
|
2448
2580
|
"hover:bg-accent-soft hover:bg-none",
|
|
2449
2581
|
"data-[state=on]:border-accent-foreground data-[state=on]:bg-accent-soft data-[state=on]:bg-none data-[state=on]:text-accent-foreground"
|
|
2450
2582
|
),
|
|
2451
|
-
children: image.src ? /* @__PURE__ */
|
|
2583
|
+
children: image.src ? /* @__PURE__ */ jsx39("img", { src: image.src, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx39(ImageIcon, { size: 24, "aria-hidden": true })
|
|
2452
2584
|
},
|
|
2453
2585
|
image.id
|
|
2454
2586
|
);
|
|
@@ -2461,13 +2593,13 @@ var formatTime = (seconds) => {
|
|
|
2461
2593
|
const total = Math.max(0, Math.floor(Number.isFinite(seconds) ? seconds : 0));
|
|
2462
2594
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
2463
2595
|
};
|
|
2464
|
-
var VideoPlayer =
|
|
2596
|
+
var VideoPlayer = React38.forwardRef(
|
|
2465
2597
|
({ className, src, name, details, onRemove, onMore, initialTime = 0, initialDuration = 0, ...props }, ref) => {
|
|
2466
|
-
const video =
|
|
2467
|
-
const [playing, setPlaying] =
|
|
2468
|
-
const [time, setTime] =
|
|
2469
|
-
const [duration, setDuration] =
|
|
2470
|
-
const [volume, setVolume] =
|
|
2598
|
+
const video = React38.useRef(null);
|
|
2599
|
+
const [playing, setPlaying] = React38.useState(false);
|
|
2600
|
+
const [time, setTime] = React38.useState(initialTime);
|
|
2601
|
+
const [duration, setDuration] = React38.useState(initialDuration);
|
|
2602
|
+
const [volume, setVolume] = React38.useState(1);
|
|
2471
2603
|
const muted = volume === 0;
|
|
2472
2604
|
const toggle2 = () => {
|
|
2473
2605
|
const el = video.current;
|
|
@@ -2475,9 +2607,9 @@ var VideoPlayer = React37.forwardRef(
|
|
|
2475
2607
|
if (el.paused) void el.play();
|
|
2476
2608
|
else el.pause();
|
|
2477
2609
|
};
|
|
2478
|
-
return /* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
src && /* @__PURE__ */
|
|
2610
|
+
return /* @__PURE__ */ jsxs29("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface", className), ...props, children: [
|
|
2611
|
+
/* @__PURE__ */ jsxs29("div", { className: "relative flex h-60.5 w-full items-end bg-accent-soft", children: [
|
|
2612
|
+
src && /* @__PURE__ */ jsx39(
|
|
2481
2613
|
"video",
|
|
2482
2614
|
{
|
|
2483
2615
|
ref: video,
|
|
@@ -2490,8 +2622,8 @@ var VideoPlayer = React37.forwardRef(
|
|
|
2490
2622
|
onVolumeChange: (event) => setVolume(event.currentTarget.muted ? 0 : event.currentTarget.volume)
|
|
2491
2623
|
}
|
|
2492
2624
|
),
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2625
|
+
/* @__PURE__ */ jsxs29("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: [
|
|
2626
|
+
/* @__PURE__ */ jsxs29(
|
|
2495
2627
|
SliderPrimitive2.Root,
|
|
2496
2628
|
{
|
|
2497
2629
|
min: 0,
|
|
@@ -2505,31 +2637,31 @@ var VideoPlayer = React37.forwardRef(
|
|
|
2505
2637
|
},
|
|
2506
2638
|
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
2507
2639
|
children: [
|
|
2508
|
-
/* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */
|
|
2640
|
+
/* @__PURE__ */ jsx39(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx39(SliderPrimitive2.Range, { className: "absolute h-full bg-accent-foreground" }) }),
|
|
2641
|
+
/* @__PURE__ */ jsx39(SliderPrimitive2.Thumb, { "aria-label": "Seek", className: "block size-3 rounded-full border-2 border-surface bg-surface shadow-sm" })
|
|
2510
2642
|
]
|
|
2511
2643
|
}
|
|
2512
2644
|
),
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
/* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2645
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
|
|
2646
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-4", children: [
|
|
2647
|
+
/* @__PURE__ */ jsx39(
|
|
2516
2648
|
"button",
|
|
2517
2649
|
{
|
|
2518
2650
|
type: "button",
|
|
2519
2651
|
"aria-label": playing ? "Pause" : "Play",
|
|
2520
2652
|
onClick: toggle2,
|
|
2521
2653
|
className: "inline-flex size-10 items-center justify-center rounded-full bg-surface/12 text-surface transition-colors hover:bg-surface/20",
|
|
2522
|
-
children: playing ? /* @__PURE__ */
|
|
2654
|
+
children: playing ? /* @__PURE__ */ jsx39(Pause, { size: 16, weight: "fill", "aria-hidden": true }) : /* @__PURE__ */ jsx39(Play, { size: 16, weight: "fill", "aria-hidden": true })
|
|
2523
2655
|
}
|
|
2524
2656
|
),
|
|
2525
|
-
/* @__PURE__ */
|
|
2657
|
+
/* @__PURE__ */ jsxs29("span", { className: "text-ui-label whitespace-nowrap text-surface/80", children: [
|
|
2526
2658
|
formatTime(time),
|
|
2527
2659
|
" / ",
|
|
2528
2660
|
formatTime(duration)
|
|
2529
2661
|
] })
|
|
2530
2662
|
] }),
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2663
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
2664
|
+
/* @__PURE__ */ jsx39(
|
|
2533
2665
|
VolumeControl,
|
|
2534
2666
|
{
|
|
2535
2667
|
volume,
|
|
@@ -2542,41 +2674,41 @@ var VideoPlayer = React37.forwardRef(
|
|
|
2542
2674
|
}
|
|
2543
2675
|
}
|
|
2544
2676
|
),
|
|
2545
|
-
/* @__PURE__ */
|
|
2677
|
+
/* @__PURE__ */ jsx39(
|
|
2546
2678
|
"button",
|
|
2547
2679
|
{
|
|
2548
2680
|
type: "button",
|
|
2549
2681
|
"aria-label": "Full screen",
|
|
2550
2682
|
onClick: () => void video.current?.requestFullscreen?.(),
|
|
2551
2683
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2552
|
-
children: /* @__PURE__ */
|
|
2684
|
+
children: /* @__PURE__ */ jsx39(CornersOut, { size: 16, "aria-hidden": true })
|
|
2553
2685
|
}
|
|
2554
2686
|
),
|
|
2555
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ jsx39(
|
|
2556
2688
|
"button",
|
|
2557
2689
|
{
|
|
2558
2690
|
type: "button",
|
|
2559
2691
|
"aria-label": "More",
|
|
2560
2692
|
onClick: onMore,
|
|
2561
2693
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2562
|
-
children: /* @__PURE__ */
|
|
2694
|
+
children: /* @__PURE__ */ jsx39(DotsThree, { size: 16, "aria-hidden": true })
|
|
2563
2695
|
}
|
|
2564
2696
|
)
|
|
2565
2697
|
] })
|
|
2566
2698
|
] })
|
|
2567
2699
|
] })
|
|
2568
2700
|
] }),
|
|
2569
|
-
name && /* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2701
|
+
name && /* @__PURE__ */ jsx39(MediaInfo, { name, details, onRemove }),
|
|
2702
|
+
/* @__PURE__ */ jsx39("span", { className: "sr-only", "aria-live": "polite", children: muted ? "Muted" : "" })
|
|
2571
2703
|
] });
|
|
2572
2704
|
}
|
|
2573
2705
|
);
|
|
2574
2706
|
VideoPlayer.displayName = "VideoPlayer";
|
|
2575
2707
|
function VolumeControl({ volume, onVolumeChange, className }) {
|
|
2576
|
-
const last =
|
|
2708
|
+
const last = React38.useRef(volume || 1);
|
|
2577
2709
|
if (volume > 0) last.current = volume;
|
|
2578
|
-
return /* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
2710
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("group/volume flex items-center", className), children: [
|
|
2711
|
+
/* @__PURE__ */ jsx39("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__ */ jsxs29(
|
|
2580
2712
|
SliderPrimitive2.Root,
|
|
2581
2713
|
{
|
|
2582
2714
|
min: 0,
|
|
@@ -2586,32 +2718,32 @@ function VolumeControl({ volume, onVolumeChange, className }) {
|
|
|
2586
2718
|
onValueChange: ([next]) => next !== void 0 && onVolumeChange(next),
|
|
2587
2719
|
className: "relative flex h-4 w-14 touch-none items-center select-none",
|
|
2588
2720
|
children: [
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */
|
|
2721
|
+
/* @__PURE__ */ jsx39(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx39(SliderPrimitive2.Range, { className: "absolute h-full bg-surface" }) }),
|
|
2722
|
+
/* @__PURE__ */ jsx39(SliderPrimitive2.Thumb, { "aria-label": "Volume", className: "block size-3 rounded-full bg-surface shadow-sm" })
|
|
2591
2723
|
]
|
|
2592
2724
|
}
|
|
2593
2725
|
) }),
|
|
2594
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ jsx39(
|
|
2595
2727
|
"button",
|
|
2596
2728
|
{
|
|
2597
2729
|
type: "button",
|
|
2598
2730
|
"aria-label": volume === 0 ? "Unmute" : "Mute",
|
|
2599
2731
|
onClick: () => onVolumeChange(volume === 0 ? last.current : 0),
|
|
2600
2732
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2601
|
-
children: volume === 0 ? /* @__PURE__ */
|
|
2733
|
+
children: volume === 0 ? /* @__PURE__ */ jsx39(SpeakerSimpleX, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx39(SpeakerSimpleHigh, { size: 16, "aria-hidden": true })
|
|
2602
2734
|
}
|
|
2603
2735
|
)
|
|
2604
2736
|
] });
|
|
2605
2737
|
}
|
|
2606
2738
|
|
|
2607
2739
|
// src/components/Question Types/OpenEndAnswer.tsx
|
|
2608
|
-
import * as
|
|
2609
|
-
import { jsx as
|
|
2610
|
-
var OpenEndAnswer =
|
|
2740
|
+
import * as React39 from "react";
|
|
2741
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2742
|
+
var OpenEndAnswer = React39.forwardRef(
|
|
2611
2743
|
({ value, defaultValue, onChange, maxLength = 1e3, placeholder = "Write your answer", ...props }, ref) => {
|
|
2612
|
-
const [internal, setInternal] =
|
|
2744
|
+
const [internal, setInternal] = React39.useState(String(defaultValue ?? ""));
|
|
2613
2745
|
const text = value !== void 0 ? String(value) : internal;
|
|
2614
|
-
return /* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ jsx40(
|
|
2615
2747
|
Textarea,
|
|
2616
2748
|
{
|
|
2617
2749
|
ref,
|
|
@@ -2631,10 +2763,10 @@ var OpenEndAnswer = React38.forwardRef(
|
|
|
2631
2763
|
OpenEndAnswer.displayName = "OpenEndAnswer";
|
|
2632
2764
|
|
|
2633
2765
|
// src/components/Question Types/QuestionCard.tsx
|
|
2634
|
-
import * as
|
|
2635
|
-
import { jsx as
|
|
2636
|
-
var QuestionCard =
|
|
2637
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2766
|
+
import * as React40 from "react";
|
|
2767
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2768
|
+
var QuestionCard = React40.forwardRef(
|
|
2769
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41(
|
|
2638
2770
|
"div",
|
|
2639
2771
|
{
|
|
2640
2772
|
ref,
|
|
@@ -2646,50 +2778,90 @@ var QuestionCard = React39.forwardRef(
|
|
|
2646
2778
|
QuestionCard.displayName = "QuestionCard";
|
|
2647
2779
|
|
|
2648
2780
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2649
|
-
import * as
|
|
2781
|
+
import * as React43 from "react";
|
|
2650
2782
|
import {
|
|
2651
2783
|
Clipboard,
|
|
2652
2784
|
Copy,
|
|
2653
2785
|
Eye,
|
|
2654
2786
|
Plus as Plus3,
|
|
2655
2787
|
Sparkle as Sparkle2,
|
|
2656
|
-
Trash as
|
|
2788
|
+
Trash as Trash4,
|
|
2657
2789
|
Warning as Warning2
|
|
2658
2790
|
} from "@phosphor-icons/react";
|
|
2659
2791
|
|
|
2792
|
+
// src/lib/keepEditingFocus.ts
|
|
2793
|
+
function keepEditingFocus(event) {
|
|
2794
|
+
const target = event.target;
|
|
2795
|
+
if (target.closest('button, a, input, textarea, select, label, [role="button"], [role="dialog"]')) return;
|
|
2796
|
+
const active = document.activeElement;
|
|
2797
|
+
if ((active instanceof HTMLTextAreaElement || active instanceof HTMLInputElement) && event.currentTarget.contains(active)) event.preventDefault();
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2660
2800
|
// src/components/Question Types/QuestionHeader.tsx
|
|
2661
|
-
import * as
|
|
2801
|
+
import * as React42 from "react";
|
|
2662
2802
|
import { DotsSixVertical } from "@phosphor-icons/react";
|
|
2663
|
-
|
|
2803
|
+
|
|
2804
|
+
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
2805
|
+
import "react";
|
|
2806
|
+
import { ChatsCircle, CheckSquare, FileArrowUp, FileText as FileText2, Image, ListNumbers, RadioButton, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
2807
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
2808
|
+
var icons = {
|
|
2809
|
+
"select-one": RadioButton,
|
|
2810
|
+
"select-multiple": CheckSquare,
|
|
2811
|
+
ranking: ListNumbers,
|
|
2812
|
+
upload: FileArrowUp,
|
|
2813
|
+
"upload-video": VideoCamera,
|
|
2814
|
+
"upload-photo": Image,
|
|
2815
|
+
"upload-document": FileText2,
|
|
2816
|
+
rating: StarHalf,
|
|
2817
|
+
"open-end": ChatsCircle,
|
|
2818
|
+
"screen-recording": VideoCamera
|
|
2819
|
+
};
|
|
2820
|
+
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
2821
|
+
const Icon = icons[type];
|
|
2822
|
+
return /* @__PURE__ */ jsx42(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
// src/components/Question Types/QuestionHeader.tsx
|
|
2826
|
+
import { jsx as jsx43, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2664
2827
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2665
|
-
var QuestionHeader =
|
|
2666
|
-
({ 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, ...props }, ref) => {
|
|
2667
|
-
const [draft, setDraft] =
|
|
2828
|
+
var QuestionHeader = React42.forwardRef(
|
|
2829
|
+
({ 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) => {
|
|
2830
|
+
const [draft, setDraft] = React42.useState(null);
|
|
2668
2831
|
const label = String(number).padStart(2, "0");
|
|
2669
2832
|
const showError = error !== void 0 && error !== false;
|
|
2670
2833
|
if (editor) {
|
|
2671
2834
|
const text = typeof title === "string" ? title : "";
|
|
2672
2835
|
const count = (draft ?? text).length;
|
|
2673
2836
|
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
2674
|
-
return /* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2837
|
+
return /* @__PURE__ */ jsxs30("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
2838
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between", children: [
|
|
2839
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
2840
|
+
/* @__PURE__ */ jsxs30(
|
|
2678
2841
|
"span",
|
|
2679
2842
|
{
|
|
2680
2843
|
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
2681
2844
|
...dragHandleProps,
|
|
2682
2845
|
className: cn(
|
|
2683
2846
|
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
2684
|
-
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered.
|
|
2685
|
-
|
|
2847
|
+
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered. With a type icon the grip
|
|
2848
|
+
// takes the icon's place, so the tag keeps its padding and its width.
|
|
2849
|
+
showDragHandle && !questionType && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
2686
2850
|
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",
|
|
2687
2851
|
dragHandleProps && "cursor-grab touch-none select-none",
|
|
2688
|
-
dragHandleProps && showDragHandle && "focus-visible:pl-1",
|
|
2852
|
+
dragHandleProps && showDragHandle && !questionType && "focus-visible:pl-1",
|
|
2689
2853
|
dragHandleProps?.className
|
|
2690
2854
|
),
|
|
2691
2855
|
children: [
|
|
2692
|
-
|
|
2856
|
+
questionType && /* @__PURE__ */ jsx43(
|
|
2857
|
+
QuestionTypeIcon,
|
|
2858
|
+
{
|
|
2859
|
+
type: questionType,
|
|
2860
|
+
size: 16,
|
|
2861
|
+
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
2862
|
+
}
|
|
2863
|
+
),
|
|
2864
|
+
showDragHandle && /* @__PURE__ */ jsx43(
|
|
2693
2865
|
DotsSixVertical,
|
|
2694
2866
|
{
|
|
2695
2867
|
size: 16,
|
|
@@ -2704,13 +2876,13 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2704
2876
|
),
|
|
2705
2877
|
meta
|
|
2706
2878
|
] }),
|
|
2707
|
-
actions && /* @__PURE__ */
|
|
2879
|
+
actions && /* @__PURE__ */ jsx43("div", { className: cn(
|
|
2708
2880
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
2709
2881
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
2710
2882
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
2711
2883
|
), children: actions })
|
|
2712
2884
|
] }),
|
|
2713
|
-
/* @__PURE__ */
|
|
2885
|
+
/* @__PURE__ */ jsx43(
|
|
2714
2886
|
InlineEdit,
|
|
2715
2887
|
{
|
|
2716
2888
|
variant: "question",
|
|
@@ -2729,11 +2901,14 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2729
2901
|
onEditingChange: (editing) => {
|
|
2730
2902
|
if (!editing) setDraft(null);
|
|
2731
2903
|
},
|
|
2904
|
+
marks: titleMarks,
|
|
2905
|
+
onMarkApply: onTitleMarkApply,
|
|
2906
|
+
onMarkDismiss: onTitleMarkDismiss,
|
|
2732
2907
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
2733
2908
|
}
|
|
2734
2909
|
),
|
|
2735
|
-
long && titleRecommendedNote != null && /* @__PURE__ */
|
|
2736
|
-
showCounter && titleMinLength === void 0 && /* @__PURE__ */
|
|
2910
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ jsx43("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
2911
|
+
showCounter && titleMinLength === void 0 && /* @__PURE__ */ jsxs30("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
2737
2912
|
count,
|
|
2738
2913
|
"/",
|
|
2739
2914
|
maxLength,
|
|
@@ -2741,16 +2916,16 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2741
2916
|
] })
|
|
2742
2917
|
] });
|
|
2743
2918
|
}
|
|
2744
|
-
return /* @__PURE__ */
|
|
2745
|
-
showError && /* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2919
|
+
return /* @__PURE__ */ jsxs30("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
2920
|
+
showError && /* @__PURE__ */ jsx43(ToastInline, { variant: "destructive", onClose: onDismissError, className: "min-h-10", children: /* @__PURE__ */ jsx43("span", { className: "text-ui-label text-destructive", children: error === true ? "This question is mandatory." : error }) }),
|
|
2921
|
+
/* @__PURE__ */ jsxs30("p", { className: eyebrow, children: [
|
|
2747
2922
|
"Question ",
|
|
2748
2923
|
label
|
|
2749
2924
|
] }),
|
|
2750
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ jsxs30("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
2751
2926
|
title,
|
|
2752
|
-
required && /* @__PURE__ */
|
|
2753
|
-
required && /* @__PURE__ */
|
|
2927
|
+
required && /* @__PURE__ */ jsx43("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
2928
|
+
required && /* @__PURE__ */ jsx43("span", { className: "sr-only", children: " (required)" })
|
|
2754
2929
|
] })
|
|
2755
2930
|
] });
|
|
2756
2931
|
}
|
|
@@ -2758,8 +2933,8 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2758
2933
|
QuestionHeader.displayName = "QuestionHeader";
|
|
2759
2934
|
|
|
2760
2935
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2761
|
-
import { Fragment as
|
|
2762
|
-
var QuestionEditorCard =
|
|
2936
|
+
import { Fragment as Fragment10, jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2937
|
+
var QuestionEditorCard = React43.forwardRef(
|
|
2763
2938
|
({
|
|
2764
2939
|
className,
|
|
2765
2940
|
number,
|
|
@@ -2786,19 +2961,27 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2786
2961
|
meta,
|
|
2787
2962
|
dragHandleProps,
|
|
2788
2963
|
showDragHandle,
|
|
2964
|
+
questionType,
|
|
2965
|
+
titleMarks,
|
|
2966
|
+
onTitleMarkApply,
|
|
2967
|
+
onTitleMarkDismiss,
|
|
2789
2968
|
children,
|
|
2790
2969
|
...props
|
|
2791
2970
|
}, ref) => {
|
|
2792
2971
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
2793
|
-
return /* @__PURE__ */
|
|
2972
|
+
return /* @__PURE__ */ jsxs31(
|
|
2794
2973
|
"div",
|
|
2795
2974
|
{
|
|
2796
2975
|
ref,
|
|
2797
2976
|
className: cn("group/editor flex w-full items-start gap-2", className),
|
|
2798
2977
|
"data-hovered": hovered ? "" : void 0,
|
|
2799
2978
|
...props,
|
|
2979
|
+
onMouseDown: (event) => {
|
|
2980
|
+
keepEditingFocus(event);
|
|
2981
|
+
props.onMouseDown?.(event);
|
|
2982
|
+
},
|
|
2800
2983
|
children: [
|
|
2801
|
-
/* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsxs31(
|
|
2802
2985
|
"div",
|
|
2803
2986
|
{
|
|
2804
2987
|
className: cn(
|
|
@@ -2806,9 +2989,9 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2806
2989
|
active ? "border-accent" : "border-border"
|
|
2807
2990
|
),
|
|
2808
2991
|
children: [
|
|
2809
|
-
/* @__PURE__ */
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2992
|
+
/* @__PURE__ */ jsxs31("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
2993
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-4", children: [
|
|
2994
|
+
/* @__PURE__ */ jsx44(
|
|
2812
2995
|
QuestionHeader,
|
|
2813
2996
|
{
|
|
2814
2997
|
editor: true,
|
|
@@ -2824,10 +3007,14 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2824
3007
|
showCounter: !!active,
|
|
2825
3008
|
dragHandleProps,
|
|
2826
3009
|
showDragHandle,
|
|
3010
|
+
questionType,
|
|
3011
|
+
titleMarks,
|
|
3012
|
+
onTitleMarkApply,
|
|
3013
|
+
onTitleMarkDismiss,
|
|
2827
3014
|
meta,
|
|
2828
3015
|
maxLength,
|
|
2829
|
-
actions: actions ?? /* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
3016
|
+
actions: actions ?? /* @__PURE__ */ jsxs31(Fragment10, { children: [
|
|
3017
|
+
/* @__PURE__ */ jsx44(
|
|
2831
3018
|
Button,
|
|
2832
3019
|
{
|
|
2833
3020
|
type: "button",
|
|
@@ -2835,10 +3022,10 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2835
3022
|
size: "icon-sm",
|
|
2836
3023
|
"aria-label": "Duplicate question",
|
|
2837
3024
|
onClick: onDuplicate,
|
|
2838
|
-
children: /* @__PURE__ */
|
|
3025
|
+
children: /* @__PURE__ */ jsx44(Copy, { size: 16, "aria-hidden": true })
|
|
2839
3026
|
}
|
|
2840
3027
|
),
|
|
2841
|
-
/* @__PURE__ */
|
|
3028
|
+
/* @__PURE__ */ jsx44(
|
|
2842
3029
|
Button,
|
|
2843
3030
|
{
|
|
2844
3031
|
type: "button",
|
|
@@ -2846,10 +3033,10 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2846
3033
|
size: "icon-sm",
|
|
2847
3034
|
"aria-label": "Delete question",
|
|
2848
3035
|
onClick: onDelete,
|
|
2849
|
-
children: /* @__PURE__ */
|
|
3036
|
+
children: /* @__PURE__ */ jsx44(Trash4, { size: 16, "aria-hidden": true })
|
|
2850
3037
|
}
|
|
2851
3038
|
),
|
|
2852
|
-
/* @__PURE__ */
|
|
3039
|
+
/* @__PURE__ */ jsx44(
|
|
2853
3040
|
Button,
|
|
2854
3041
|
{
|
|
2855
3042
|
type: "button",
|
|
@@ -2857,7 +3044,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2857
3044
|
size: "icon-sm",
|
|
2858
3045
|
"aria-label": "Preview question",
|
|
2859
3046
|
onClick: onPreview,
|
|
2860
|
-
children: /* @__PURE__ */
|
|
3047
|
+
children: /* @__PURE__ */ jsx44(Eye, { size: 16, "aria-hidden": true })
|
|
2861
3048
|
}
|
|
2862
3049
|
)
|
|
2863
3050
|
] })
|
|
@@ -2865,18 +3052,18 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2865
3052
|
),
|
|
2866
3053
|
children
|
|
2867
3054
|
] }),
|
|
2868
|
-
error && /* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
3055
|
+
error && /* @__PURE__ */ jsxs31("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3056
|
+
/* @__PURE__ */ jsx44(Warning2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
2870
3057
|
error
|
|
2871
3058
|
] }),
|
|
2872
|
-
footer && /* @__PURE__ */
|
|
2873
|
-
/* @__PURE__ */
|
|
2874
|
-
/* @__PURE__ */
|
|
2875
|
-
onAdd && /* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
3059
|
+
footer && /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
|
|
3060
|
+
/* @__PURE__ */ jsx44("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3061
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
3062
|
+
onAdd && /* @__PURE__ */ jsxs31(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3063
|
+
/* @__PURE__ */ jsx44(Plus3, { size: 16, "aria-hidden": true }),
|
|
2877
3064
|
"Add choice"
|
|
2878
3065
|
] }),
|
|
2879
|
-
onPaste && /* @__PURE__ */
|
|
3066
|
+
onPaste && /* @__PURE__ */ jsx44(
|
|
2880
3067
|
Button,
|
|
2881
3068
|
{
|
|
2882
3069
|
type: "button",
|
|
@@ -2884,17 +3071,17 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2884
3071
|
size: "icon",
|
|
2885
3072
|
"aria-label": "Paste choices",
|
|
2886
3073
|
onClick: onPaste,
|
|
2887
|
-
children: /* @__PURE__ */
|
|
3074
|
+
children: /* @__PURE__ */ jsx44(Clipboard, { size: 16, "aria-hidden": true })
|
|
2888
3075
|
}
|
|
2889
3076
|
)
|
|
2890
3077
|
] })
|
|
2891
3078
|
] })
|
|
2892
3079
|
] }),
|
|
2893
|
-
note && /* @__PURE__ */
|
|
3080
|
+
note && /* @__PURE__ */ jsx44("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
2894
3081
|
]
|
|
2895
3082
|
}
|
|
2896
3083
|
),
|
|
2897
|
-
onAskAi && /* @__PURE__ */
|
|
3084
|
+
onAskAi && /* @__PURE__ */ jsx44(
|
|
2898
3085
|
Button,
|
|
2899
3086
|
{
|
|
2900
3087
|
type: "button",
|
|
@@ -2903,7 +3090,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2903
3090
|
"aria-label": "Ask AI",
|
|
2904
3091
|
onClick: onAskAi,
|
|
2905
3092
|
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",
|
|
2906
|
-
children: /* @__PURE__ */
|
|
3093
|
+
children: /* @__PURE__ */ jsx44(Sparkle2, { size: 16, "aria-hidden": true })
|
|
2907
3094
|
}
|
|
2908
3095
|
)
|
|
2909
3096
|
]
|
|
@@ -2914,34 +3101,14 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2914
3101
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
2915
3102
|
|
|
2916
3103
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
2917
|
-
import * as
|
|
3104
|
+
import * as React44 from "react";
|
|
2918
3105
|
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3 } from "@phosphor-icons/react";
|
|
2919
3106
|
import { Slot as Slot3 } from "radix-ui";
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
import "react";
|
|
2923
|
-
import { ChatsCircle, CheckSquare, FileArrowUp, ListNumbers, RadioButton, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
2924
|
-
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
2925
|
-
var icons = {
|
|
2926
|
-
"select-one": RadioButton,
|
|
2927
|
-
"select-multiple": CheckSquare,
|
|
2928
|
-
ranking: ListNumbers,
|
|
2929
|
-
upload: FileArrowUp,
|
|
2930
|
-
rating: StarHalf,
|
|
2931
|
-
"open-end": ChatsCircle,
|
|
2932
|
-
"screen-recording": VideoCamera
|
|
2933
|
-
};
|
|
2934
|
-
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
2935
|
-
const Icon = icons[type];
|
|
2936
|
-
return /* @__PURE__ */ jsx43(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
2937
|
-
}
|
|
2938
|
-
|
|
2939
|
-
// src/components/Question Types/QuestionNavItem.tsx
|
|
2940
|
-
import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2941
|
-
var QuestionNavItem = React43.forwardRef(
|
|
3107
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3108
|
+
var QuestionNavItem = React44.forwardRef(
|
|
2942
3109
|
({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
2943
3110
|
const Comp = asChild ? Slot3.Root : "button";
|
|
2944
|
-
return /* @__PURE__ */
|
|
3111
|
+
return /* @__PURE__ */ jsxs32(
|
|
2945
3112
|
Comp,
|
|
2946
3113
|
{
|
|
2947
3114
|
ref,
|
|
@@ -2960,9 +3127,9 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2960
3127
|
),
|
|
2961
3128
|
...props,
|
|
2962
3129
|
children: [
|
|
2963
|
-
/* @__PURE__ */
|
|
2964
|
-
showDragHandle && /* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
3130
|
+
/* @__PURE__ */ jsxs32("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3131
|
+
showDragHandle && /* @__PURE__ */ jsx45(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3132
|
+
/* @__PURE__ */ jsx45("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx45(Warning3, { size: 16, className: "text-destructive-foreground" }) : /* @__PURE__ */ jsx45(
|
|
2966
3133
|
QuestionTypeIcon,
|
|
2967
3134
|
{
|
|
2968
3135
|
type: questionType,
|
|
@@ -2971,8 +3138,8 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2971
3138
|
}
|
|
2972
3139
|
) })
|
|
2973
3140
|
] }),
|
|
2974
|
-
/* @__PURE__ */
|
|
2975
|
-
error && /* @__PURE__ */
|
|
3141
|
+
/* @__PURE__ */ jsx45("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3142
|
+
error && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: ", has errors" })
|
|
2976
3143
|
]
|
|
2977
3144
|
}
|
|
2978
3145
|
);
|
|
@@ -2981,14 +3148,14 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2981
3148
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
2982
3149
|
|
|
2983
3150
|
// src/components/Question Types/QuestionOption.tsx
|
|
2984
|
-
import * as
|
|
2985
|
-
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as
|
|
2986
|
-
import { Fragment as
|
|
3151
|
+
import * as React45 from "react";
|
|
3152
|
+
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle4 } from "@phosphor-icons/react";
|
|
3153
|
+
import { Fragment as Fragment11, jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2987
3154
|
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";
|
|
2988
3155
|
function QuestionOption(props) {
|
|
2989
|
-
const id =
|
|
2990
|
-
return /* @__PURE__ */
|
|
2991
|
-
props.kind === "checkbox" ? /* @__PURE__ */
|
|
3156
|
+
const id = React45.useId();
|
|
3157
|
+
return /* @__PURE__ */ jsxs33("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3158
|
+
props.kind === "checkbox" ? /* @__PURE__ */ jsx46(
|
|
2992
3159
|
Checkbox,
|
|
2993
3160
|
{
|
|
2994
3161
|
id,
|
|
@@ -2997,16 +3164,16 @@ function QuestionOption(props) {
|
|
|
2997
3164
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
2998
3165
|
disabled: props.disabled
|
|
2999
3166
|
}
|
|
3000
|
-
) : /* @__PURE__ */
|
|
3001
|
-
/* @__PURE__ */
|
|
3167
|
+
) : /* @__PURE__ */ jsx46(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3168
|
+
/* @__PURE__ */ jsx46("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3002
3169
|
] });
|
|
3003
3170
|
}
|
|
3004
|
-
var QuestionOtherOption =
|
|
3171
|
+
var QuestionOtherOption = React45.forwardRef(
|
|
3005
3172
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3006
|
-
const inner =
|
|
3007
|
-
|
|
3173
|
+
const inner = React45.useRef(null);
|
|
3174
|
+
React45.useImperativeHandle(ref, () => inner.current);
|
|
3008
3175
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3009
|
-
return /* @__PURE__ */
|
|
3176
|
+
return /* @__PURE__ */ jsxs33(
|
|
3010
3177
|
"div",
|
|
3011
3178
|
{
|
|
3012
3179
|
className: cn(
|
|
@@ -3014,7 +3181,7 @@ var QuestionOtherOption = React44.forwardRef(
|
|
|
3014
3181
|
className
|
|
3015
3182
|
),
|
|
3016
3183
|
children: [
|
|
3017
|
-
/* @__PURE__ */
|
|
3184
|
+
/* @__PURE__ */ jsx46(
|
|
3018
3185
|
"input",
|
|
3019
3186
|
{
|
|
3020
3187
|
ref: inner,
|
|
@@ -3030,7 +3197,7 @@ var QuestionOtherOption = React44.forwardRef(
|
|
|
3030
3197
|
...props
|
|
3031
3198
|
}
|
|
3032
3199
|
),
|
|
3033
|
-
/* @__PURE__ */
|
|
3200
|
+
/* @__PURE__ */ jsx46(Button, { type: "button", variant: "subtle", size: "icon-sm", "aria-label": confirmLabel, onClick: submit, children: /* @__PURE__ */ jsx46(Check4, { size: 16, "aria-hidden": true }) })
|
|
3034
3201
|
]
|
|
3035
3202
|
}
|
|
3036
3203
|
);
|
|
@@ -3042,14 +3209,16 @@ function limitsText2(min, max) {
|
|
|
3042
3209
|
if (max !== void 0) return `Up to ${max} characters`;
|
|
3043
3210
|
return "";
|
|
3044
3211
|
}
|
|
3045
|
-
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }) {
|
|
3212
|
+
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3046
3213
|
const reveal = kind !== void 0;
|
|
3047
3214
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3048
|
-
const [draft, setDraft] =
|
|
3049
|
-
const [error, setError] =
|
|
3050
|
-
const helperId =
|
|
3051
|
-
const
|
|
3052
|
-
const
|
|
3215
|
+
const [draft, setDraft] = React45.useState(null);
|
|
3216
|
+
const [error, setError] = React45.useState(null);
|
|
3217
|
+
const helperId = React45.useId();
|
|
3218
|
+
const [focused, setFocused] = React45.useState(false);
|
|
3219
|
+
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3220
|
+
const fieldRef = React45.useRef(null);
|
|
3221
|
+
const skipBlur = React45.useRef(false);
|
|
3053
3222
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3054
3223
|
const save = () => {
|
|
3055
3224
|
if (draft === null) return true;
|
|
@@ -3070,9 +3239,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3070
3239
|
...dragHandleProps,
|
|
3071
3240
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3072
3241
|
} : { "aria-hidden": true };
|
|
3073
|
-
const grip = dragHandleProps ? /* @__PURE__ */
|
|
3074
|
-
return /* @__PURE__ */
|
|
3075
|
-
/* @__PURE__ */
|
|
3242
|
+
const grip = dragHandleProps ? /* @__PURE__ */ jsx46("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ jsx46(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ jsx46(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
|
|
3243
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3244
|
+
/* @__PURE__ */ jsx46(
|
|
3076
3245
|
"div",
|
|
3077
3246
|
{
|
|
3078
3247
|
className: cn(
|
|
@@ -3082,10 +3251,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3082
3251
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3083
3252
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3084
3253
|
),
|
|
3085
|
-
children: /* @__PURE__ */
|
|
3086
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */
|
|
3254
|
+
children: /* @__PURE__ */ jsxs33("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3255
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ jsx46("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ jsxs33(Fragment11, { children: [
|
|
3087
3256
|
!locked && grip,
|
|
3088
|
-
/* @__PURE__ */
|
|
3257
|
+
/* @__PURE__ */ jsx46(
|
|
3089
3258
|
"span",
|
|
3090
3259
|
{
|
|
3091
3260
|
"aria-hidden": "true",
|
|
@@ -3093,8 +3262,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3093
3262
|
children: rank
|
|
3094
3263
|
}
|
|
3095
3264
|
)
|
|
3096
|
-
] }) : reveal && locked ? /* @__PURE__ */
|
|
3097
|
-
/* @__PURE__ */
|
|
3265
|
+
] }) : reveal && locked ? /* @__PURE__ */ jsx46("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx46("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ jsxs33("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
|
|
3266
|
+
/* @__PURE__ */ jsx46(
|
|
3098
3267
|
"span",
|
|
3099
3268
|
{
|
|
3100
3269
|
"aria-hidden": "true",
|
|
@@ -3105,7 +3274,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3105
3274
|
)
|
|
3106
3275
|
}
|
|
3107
3276
|
),
|
|
3108
|
-
/* @__PURE__ */
|
|
3277
|
+
/* @__PURE__ */ jsx46(
|
|
3109
3278
|
DotsSixVertical3,
|
|
3110
3279
|
{
|
|
3111
3280
|
size: 20,
|
|
@@ -3117,67 +3286,76 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3117
3286
|
}
|
|
3118
3287
|
)
|
|
3119
3288
|
] }) : locked ? null : grip }),
|
|
3120
|
-
/* @__PURE__ */
|
|
3121
|
-
/* @__PURE__ */
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
setError(null);
|
|
3145
|
-
fieldRef.current?.blur();
|
|
3146
|
-
} else if (event.key === "Enter") {
|
|
3147
|
-
event.preventDefault();
|
|
3148
|
-
if (save()) {
|
|
3289
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3290
|
+
/* @__PURE__ */ jsxs33("div", { className: "relative min-w-0", children: [
|
|
3291
|
+
/* @__PURE__ */ jsx46(
|
|
3292
|
+
"input",
|
|
3293
|
+
{
|
|
3294
|
+
ref: fieldRef,
|
|
3295
|
+
"aria-label": "Option label",
|
|
3296
|
+
"aria-invalid": error ? true : void 0,
|
|
3297
|
+
"aria-describedby": guarded && draft !== null ? helperId : void 0,
|
|
3298
|
+
placeholder,
|
|
3299
|
+
maxLength,
|
|
3300
|
+
value: guarded ? draft ?? label : label,
|
|
3301
|
+
onFocus: () => {
|
|
3302
|
+
setFocused(true);
|
|
3303
|
+
if (guarded && draft === null) setDraft(label);
|
|
3304
|
+
},
|
|
3305
|
+
onChange: (event) => {
|
|
3306
|
+
if (!guarded) return onLabelChange?.(event.target.value);
|
|
3307
|
+
setDraft(event.target.value);
|
|
3308
|
+
if (error) setError(problemWith(event.target.value));
|
|
3309
|
+
},
|
|
3310
|
+
onKeyDown: (event) => {
|
|
3311
|
+
if (!guarded) return;
|
|
3312
|
+
if (event.key === "Escape") {
|
|
3149
3313
|
skipBlur.current = true;
|
|
3314
|
+
setDraft(null);
|
|
3315
|
+
setError(null);
|
|
3150
3316
|
fieldRef.current?.blur();
|
|
3317
|
+
} else if (event.key === "Enter") {
|
|
3318
|
+
event.preventDefault();
|
|
3319
|
+
if (save()) {
|
|
3320
|
+
skipBlur.current = true;
|
|
3321
|
+
fieldRef.current?.blur();
|
|
3322
|
+
}
|
|
3151
3323
|
}
|
|
3152
|
-
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3324
|
+
},
|
|
3325
|
+
onBlur: () => {
|
|
3326
|
+
setFocused(false);
|
|
3327
|
+
if (!guarded) return;
|
|
3328
|
+
if (skipBlur.current) {
|
|
3329
|
+
skipBlur.current = false;
|
|
3330
|
+
return;
|
|
3331
|
+
}
|
|
3332
|
+
save();
|
|
3333
|
+
},
|
|
3334
|
+
className: cn(
|
|
3335
|
+
"w-full min-w-0 bg-transparent text-body-base text-surface-foreground outline-none",
|
|
3336
|
+
placeholderTone === "regular" ? "placeholder:text-surface-foreground" : "placeholder:text-muted-foreground",
|
|
3337
|
+
// The marked text is drawn over the field, so the field's own letters step aside until it is edited.
|
|
3338
|
+
showMarks && "text-transparent"
|
|
3339
|
+
)
|
|
3340
|
+
}
|
|
3341
|
+
),
|
|
3342
|
+
showMarks && /* @__PURE__ */ jsx46("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(
|
|
3343
|
+
(piece, i) => piece.mark ? /* @__PURE__ */ jsx46(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : /* @__PURE__ */ jsx46("span", { children: piece.text }, i)
|
|
3344
|
+
) })
|
|
3345
|
+
] }),
|
|
3346
|
+
guarded && draft !== null && /* @__PURE__ */ jsxs33(
|
|
3169
3347
|
"p",
|
|
3170
3348
|
{
|
|
3171
3349
|
id: helperId,
|
|
3172
3350
|
role: error ? "alert" : void 0,
|
|
3173
3351
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3174
3352
|
children: [
|
|
3175
|
-
/* @__PURE__ */
|
|
3176
|
-
error && /* @__PURE__ */
|
|
3353
|
+
/* @__PURE__ */ jsxs33("span", { className: "flex items-start gap-2", children: [
|
|
3354
|
+
error && /* @__PURE__ */ jsx46(WarningCircle4, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3177
3355
|
limitsText2(minLength, maxLength),
|
|
3178
|
-
error && /* @__PURE__ */
|
|
3356
|
+
error && /* @__PURE__ */ jsx46("span", { className: "sr-only", children: error })
|
|
3179
3357
|
] }),
|
|
3180
|
-
/* @__PURE__ */
|
|
3358
|
+
/* @__PURE__ */ jsxs33("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3181
3359
|
draft.length,
|
|
3182
3360
|
maxLength !== void 0 && `/${maxLength}`
|
|
3183
3361
|
] })
|
|
@@ -3188,7 +3366,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3188
3366
|
] })
|
|
3189
3367
|
}
|
|
3190
3368
|
),
|
|
3191
|
-
!locked && /* @__PURE__ */
|
|
3369
|
+
!locked && /* @__PURE__ */ jsxs33(
|
|
3192
3370
|
"div",
|
|
3193
3371
|
{
|
|
3194
3372
|
className: cn(
|
|
@@ -3196,8 +3374,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3196
3374
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3197
3375
|
),
|
|
3198
3376
|
children: [
|
|
3199
|
-
/* @__PURE__ */
|
|
3200
|
-
/* @__PURE__ */
|
|
3377
|
+
/* @__PURE__ */ jsx46(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", disabled: removeDisabled, onClick: onRemove, children: /* @__PURE__ */ jsx46(Trash5, { size: 16, "aria-hidden": true }) }),
|
|
3378
|
+
/* @__PURE__ */ jsx46(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", disabled: addDisabled, onClick: onAdd, children: /* @__PURE__ */ jsx46(Plus4, { size: 16, "aria-hidden": true }) })
|
|
3201
3379
|
]
|
|
3202
3380
|
}
|
|
3203
3381
|
)
|
|
@@ -3205,9 +3383,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3205
3383
|
}
|
|
3206
3384
|
|
|
3207
3385
|
// src/components/Question Types/RankList.tsx
|
|
3208
|
-
import * as
|
|
3386
|
+
import * as React46 from "react";
|
|
3209
3387
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
3210
|
-
import { Fragment as
|
|
3388
|
+
import { Fragment as Fragment12, jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3211
3389
|
function move(list, from, to) {
|
|
3212
3390
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3213
3391
|
const next = list.slice();
|
|
@@ -3215,13 +3393,13 @@ function move(list, from, to) {
|
|
|
3215
3393
|
next.splice(to, 0, item);
|
|
3216
3394
|
return next;
|
|
3217
3395
|
}
|
|
3218
|
-
var RankList =
|
|
3396
|
+
var RankList = React46.forwardRef(
|
|
3219
3397
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3220
|
-
const [dragIndex, setDragIndex] =
|
|
3221
|
-
const [announcement, setAnnouncement] =
|
|
3222
|
-
const handles =
|
|
3223
|
-
const refocus =
|
|
3224
|
-
|
|
3398
|
+
const [dragIndex, setDragIndex] = React46.useState(null);
|
|
3399
|
+
const [announcement, setAnnouncement] = React46.useState("");
|
|
3400
|
+
const handles = React46.useRef(/* @__PURE__ */ new Map());
|
|
3401
|
+
const refocus = React46.useRef(null);
|
|
3402
|
+
React46.useEffect(() => {
|
|
3225
3403
|
if (refocus.current) {
|
|
3226
3404
|
handles.current.get(refocus.current)?.focus();
|
|
3227
3405
|
refocus.current = null;
|
|
@@ -3234,8 +3412,8 @@ var RankList = React45.forwardRef(
|
|
|
3234
3412
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3235
3413
|
onItemsChange(next);
|
|
3236
3414
|
};
|
|
3237
|
-
return /* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3415
|
+
return /* @__PURE__ */ jsxs34(Fragment12, { children: [
|
|
3416
|
+
/* @__PURE__ */ jsx47("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs34(
|
|
3239
3417
|
"li",
|
|
3240
3418
|
{
|
|
3241
3419
|
draggable: true,
|
|
@@ -3252,7 +3430,7 @@ var RankList = React45.forwardRef(
|
|
|
3252
3430
|
dragIndex === index && "opacity-50"
|
|
3253
3431
|
),
|
|
3254
3432
|
children: [
|
|
3255
|
-
/* @__PURE__ */
|
|
3433
|
+
/* @__PURE__ */ jsx47(
|
|
3256
3434
|
"button",
|
|
3257
3435
|
{
|
|
3258
3436
|
type: "button",
|
|
@@ -3271,10 +3449,10 @@ var RankList = React45.forwardRef(
|
|
|
3271
3449
|
}
|
|
3272
3450
|
},
|
|
3273
3451
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3274
|
-
children: /* @__PURE__ */
|
|
3452
|
+
children: /* @__PURE__ */ jsx47(DotsSixVertical4, { size: 16, "aria-hidden": true })
|
|
3275
3453
|
}
|
|
3276
3454
|
),
|
|
3277
|
-
/* @__PURE__ */
|
|
3455
|
+
/* @__PURE__ */ jsx47(
|
|
3278
3456
|
"span",
|
|
3279
3457
|
{
|
|
3280
3458
|
"aria-hidden": "true",
|
|
@@ -3282,27 +3460,27 @@ var RankList = React45.forwardRef(
|
|
|
3282
3460
|
children: index + 1
|
|
3283
3461
|
}
|
|
3284
3462
|
),
|
|
3285
|
-
/* @__PURE__ */
|
|
3463
|
+
/* @__PURE__ */ jsx47("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3286
3464
|
]
|
|
3287
3465
|
},
|
|
3288
3466
|
item.id
|
|
3289
3467
|
)) }),
|
|
3290
|
-
/* @__PURE__ */
|
|
3468
|
+
/* @__PURE__ */ jsx47("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3291
3469
|
] });
|
|
3292
3470
|
}
|
|
3293
3471
|
);
|
|
3294
3472
|
RankList.displayName = "RankList";
|
|
3295
3473
|
|
|
3296
3474
|
// src/components/Question Types/RatingScale.tsx
|
|
3297
|
-
import * as
|
|
3475
|
+
import * as React47 from "react";
|
|
3298
3476
|
import { ToggleGroup as ToggleGroupPrimitive3 } from "radix-ui";
|
|
3299
|
-
import { jsx as
|
|
3300
|
-
var RatingScale =
|
|
3477
|
+
import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3478
|
+
var RatingScale = React47.forwardRef(
|
|
3301
3479
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3302
|
-
const [internal, setInternal] =
|
|
3480
|
+
const [internal, setInternal] = React47.useState(defaultValue);
|
|
3303
3481
|
const current = value !== void 0 ? value : internal;
|
|
3304
|
-
return /* @__PURE__ */
|
|
3305
|
-
/* @__PURE__ */
|
|
3482
|
+
return /* @__PURE__ */ jsxs35("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3483
|
+
/* @__PURE__ */ jsx48(
|
|
3306
3484
|
ToggleGroupPrimitive3.Root,
|
|
3307
3485
|
{
|
|
3308
3486
|
ref,
|
|
@@ -3315,7 +3493,7 @@ var RatingScale = React46.forwardRef(
|
|
|
3315
3493
|
},
|
|
3316
3494
|
className: "flex gap-2",
|
|
3317
3495
|
...props,
|
|
3318
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */
|
|
3496
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsx48(
|
|
3319
3497
|
ToggleGroupPrimitive3.Item,
|
|
3320
3498
|
{
|
|
3321
3499
|
value: String(n),
|
|
@@ -3331,9 +3509,9 @@ var RatingScale = React46.forwardRef(
|
|
|
3331
3509
|
))
|
|
3332
3510
|
}
|
|
3333
3511
|
),
|
|
3334
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3336
|
-
/* @__PURE__ */
|
|
3512
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ jsxs35("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3513
|
+
/* @__PURE__ */ jsx48("span", { children: lowLabel }),
|
|
3514
|
+
/* @__PURE__ */ jsx48("span", { children: highLabel })
|
|
3337
3515
|
] })
|
|
3338
3516
|
] });
|
|
3339
3517
|
}
|
|
@@ -3341,12 +3519,12 @@ var RatingScale = React46.forwardRef(
|
|
|
3341
3519
|
RatingScale.displayName = "RatingScale";
|
|
3342
3520
|
|
|
3343
3521
|
// src/components/Question Types/StimulusCard.tsx
|
|
3344
|
-
import * as
|
|
3345
|
-
import { Image as ImageIcon2, ImageBroken, Trash as
|
|
3346
|
-
import { jsx as
|
|
3522
|
+
import * as React48 from "react";
|
|
3523
|
+
import { Image as ImageIcon2, ImageBroken, Trash as Trash6 } from "@phosphor-icons/react";
|
|
3524
|
+
import { jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3347
3525
|
var MIN_THUMBNAIL = 92;
|
|
3348
3526
|
var MAX_THUMBNAIL = 240;
|
|
3349
|
-
var StimulusCard =
|
|
3527
|
+
var StimulusCard = React48.forwardRef(
|
|
3350
3528
|
({
|
|
3351
3529
|
className,
|
|
3352
3530
|
thumbnail,
|
|
@@ -3363,14 +3541,14 @@ var StimulusCard = React47.forwardRef(
|
|
|
3363
3541
|
removeLabel = "Remove stimulus",
|
|
3364
3542
|
...props
|
|
3365
3543
|
}, ref) => {
|
|
3366
|
-
const [failedSrc, setFailedSrc] =
|
|
3544
|
+
const [failedSrc, setFailedSrc] = React48.useState();
|
|
3367
3545
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3368
3546
|
const showImage = thumbnail !== void 0 && !error;
|
|
3369
|
-
const [draft, setDraft] =
|
|
3547
|
+
const [draft, setDraft] = React48.useState(null);
|
|
3370
3548
|
const count = (draft ?? caption ?? "").length;
|
|
3371
|
-
const textRef =
|
|
3372
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3373
|
-
|
|
3549
|
+
const textRef = React48.useRef(null);
|
|
3550
|
+
const [thumbnailSize, setThumbnailSize] = React48.useState(MIN_THUMBNAIL);
|
|
3551
|
+
React48.useEffect(() => {
|
|
3374
3552
|
const el = textRef.current;
|
|
3375
3553
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3376
3554
|
const observer = new ResizeObserver(() => {
|
|
@@ -3379,7 +3557,7 @@ var StimulusCard = React47.forwardRef(
|
|
|
3379
3557
|
observer.observe(el);
|
|
3380
3558
|
return () => observer.disconnect();
|
|
3381
3559
|
}, []);
|
|
3382
|
-
return /* @__PURE__ */
|
|
3560
|
+
return /* @__PURE__ */ jsxs36(
|
|
3383
3561
|
"div",
|
|
3384
3562
|
{
|
|
3385
3563
|
ref,
|
|
@@ -3387,8 +3565,8 @@ var StimulusCard = React47.forwardRef(
|
|
|
3387
3565
|
className: cn("flex min-h-24.5 w-full items-center gap-4 rounded-md border border-border p-0.5 pr-4", className),
|
|
3388
3566
|
...props,
|
|
3389
3567
|
children: [
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3569
|
+
/* @__PURE__ */ jsx49(
|
|
3392
3570
|
"span",
|
|
3393
3571
|
{
|
|
3394
3572
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3399,13 +3577,13 @@ var StimulusCard = React47.forwardRef(
|
|
|
3399
3577
|
),
|
|
3400
3578
|
children: showImage ? (
|
|
3401
3579
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3402
|
-
/* @__PURE__ */
|
|
3403
|
-
) : error ? /* @__PURE__ */
|
|
3580
|
+
/* @__PURE__ */ jsx49("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) })
|
|
3581
|
+
) : error ? /* @__PURE__ */ jsx49(ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ jsx49(ImageIcon2, { size: 24, "aria-hidden": true })
|
|
3404
3582
|
}
|
|
3405
3583
|
),
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
onCaptionChange ? /* @__PURE__ */
|
|
3584
|
+
/* @__PURE__ */ jsxs36("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
3585
|
+
/* @__PURE__ */ jsx49("p", { className: "w-full text-ui-label", children: label }),
|
|
3586
|
+
onCaptionChange ? /* @__PURE__ */ jsx49(
|
|
3409
3587
|
InlineEdit,
|
|
3410
3588
|
{
|
|
3411
3589
|
variant: "question",
|
|
@@ -3422,8 +3600,8 @@ var StimulusCard = React47.forwardRef(
|
|
|
3422
3600
|
},
|
|
3423
3601
|
textClassName: "text-body-base"
|
|
3424
3602
|
}
|
|
3425
|
-
) : /* @__PURE__ */
|
|
3426
|
-
onCaptionChange && showCounter && maxLength !== void 0 && /* @__PURE__ */
|
|
3603
|
+
) : /* @__PURE__ */ jsx49("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
3604
|
+
onCaptionChange && showCounter && maxLength !== void 0 && /* @__PURE__ */ jsxs36("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3427
3605
|
count,
|
|
3428
3606
|
"/",
|
|
3429
3607
|
maxLength,
|
|
@@ -3431,7 +3609,7 @@ var StimulusCard = React47.forwardRef(
|
|
|
3431
3609
|
] })
|
|
3432
3610
|
] })
|
|
3433
3611
|
] }),
|
|
3434
|
-
onRemove && /* @__PURE__ */
|
|
3612
|
+
onRemove && /* @__PURE__ */ jsx49(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx49(Trash6, { size: 16, "aria-hidden": true }) })
|
|
3435
3613
|
]
|
|
3436
3614
|
}
|
|
3437
3615
|
);
|
|
@@ -3440,27 +3618,27 @@ var StimulusCard = React47.forwardRef(
|
|
|
3440
3618
|
StimulusCard.displayName = "StimulusCard";
|
|
3441
3619
|
|
|
3442
3620
|
// src/components/Data Display/Progress.tsx
|
|
3443
|
-
import * as
|
|
3621
|
+
import * as React49 from "react";
|
|
3444
3622
|
import { Progress as ProgressPrimitive2 } from "radix-ui";
|
|
3445
|
-
import { jsx as
|
|
3446
|
-
var Progress =
|
|
3623
|
+
import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3624
|
+
var Progress = React49.forwardRef(
|
|
3447
3625
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3448
3626
|
const hasHeader = label != null || valueLabel != null;
|
|
3449
3627
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3450
3628
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3451
|
-
return /* @__PURE__ */
|
|
3452
|
-
hasHeader && /* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */
|
|
3454
|
-
/* @__PURE__ */
|
|
3629
|
+
return /* @__PURE__ */ jsxs37("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
3630
|
+
hasHeader && /* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
3631
|
+
/* @__PURE__ */ jsx50("span", { children: label }),
|
|
3632
|
+
/* @__PURE__ */ jsx50("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3455
3633
|
] }),
|
|
3456
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsx50(
|
|
3457
3635
|
ProgressPrimitive2.Root,
|
|
3458
3636
|
{
|
|
3459
3637
|
ref,
|
|
3460
3638
|
value: clamped,
|
|
3461
3639
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3462
3640
|
...props,
|
|
3463
|
-
children: /* @__PURE__ */
|
|
3641
|
+
children: /* @__PURE__ */ jsx50(
|
|
3464
3642
|
ProgressPrimitive2.Indicator,
|
|
3465
3643
|
{
|
|
3466
3644
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3469,9 +3647,9 @@ var Progress = React48.forwardRef(
|
|
|
3469
3647
|
)
|
|
3470
3648
|
}
|
|
3471
3649
|
),
|
|
3472
|
-
hasDetails && /* @__PURE__ */
|
|
3473
|
-
/* @__PURE__ */
|
|
3474
|
-
/* @__PURE__ */
|
|
3650
|
+
hasDetails && /* @__PURE__ */ jsxs37("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3651
|
+
/* @__PURE__ */ jsx50("span", { children: detailsStart }),
|
|
3652
|
+
/* @__PURE__ */ jsx50("span", { children: detailsEnd })
|
|
3475
3653
|
] })
|
|
3476
3654
|
] });
|
|
3477
3655
|
}
|
|
@@ -3479,11 +3657,11 @@ var Progress = React48.forwardRef(
|
|
|
3479
3657
|
Progress.displayName = "Progress";
|
|
3480
3658
|
|
|
3481
3659
|
// src/components/Data Display/Table.tsx
|
|
3482
|
-
import * as
|
|
3660
|
+
import * as React50 from "react";
|
|
3483
3661
|
import { CaretDown as CaretDown4, CaretUp } from "@phosphor-icons/react";
|
|
3484
|
-
import { jsx as
|
|
3485
|
-
var Table =
|
|
3486
|
-
({ className, containerClassName, striped, ...props }, ref) => /* @__PURE__ */
|
|
3662
|
+
import { jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3663
|
+
var Table = React50.forwardRef(
|
|
3664
|
+
({ className, containerClassName, striped, ...props }, ref) => /* @__PURE__ */ jsx51("div", { className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ jsx51(
|
|
3487
3665
|
"table",
|
|
3488
3666
|
{
|
|
3489
3667
|
ref,
|
|
@@ -3494,16 +3672,16 @@ var Table = React49.forwardRef(
|
|
|
3494
3672
|
) })
|
|
3495
3673
|
);
|
|
3496
3674
|
Table.displayName = "Table";
|
|
3497
|
-
var TableHeader =
|
|
3498
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3675
|
+
var TableHeader = React50.forwardRef(
|
|
3676
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx51("thead", { ref, className, ...props })
|
|
3499
3677
|
);
|
|
3500
3678
|
TableHeader.displayName = "TableHeader";
|
|
3501
|
-
var TableBody =
|
|
3502
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3679
|
+
var TableBody = React50.forwardRef(
|
|
3680
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx51("tbody", { ref, className, ...props })
|
|
3503
3681
|
);
|
|
3504
3682
|
TableBody.displayName = "TableBody";
|
|
3505
|
-
var TableRow =
|
|
3506
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */
|
|
3683
|
+
var TableRow = React50.forwardRef(
|
|
3684
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ jsx51(
|
|
3507
3685
|
"tr",
|
|
3508
3686
|
{
|
|
3509
3687
|
ref,
|
|
@@ -3520,10 +3698,10 @@ var TableRow = React49.forwardRef(
|
|
|
3520
3698
|
);
|
|
3521
3699
|
TableRow.displayName = "TableRow";
|
|
3522
3700
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3523
|
-
var TableHead =
|
|
3701
|
+
var TableHead = React50.forwardRef(
|
|
3524
3702
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, children, ...props }, ref) => {
|
|
3525
|
-
const caret = sort === "asc" ? /* @__PURE__ */
|
|
3526
|
-
return /* @__PURE__ */
|
|
3703
|
+
const caret = sort === "asc" ? /* @__PURE__ */ jsx51(CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ jsx51(CaretDown4, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
3704
|
+
return /* @__PURE__ */ jsx51(
|
|
3527
3705
|
"th",
|
|
3528
3706
|
{
|
|
3529
3707
|
ref,
|
|
@@ -3536,7 +3714,7 @@ var TableHead = React49.forwardRef(
|
|
|
3536
3714
|
className
|
|
3537
3715
|
),
|
|
3538
3716
|
...props,
|
|
3539
|
-
children: sortable ? /* @__PURE__ */
|
|
3717
|
+
children: sortable ? /* @__PURE__ */ jsxs38(
|
|
3540
3718
|
"button",
|
|
3541
3719
|
{
|
|
3542
3720
|
type: "button",
|
|
@@ -3547,14 +3725,14 @@ var TableHead = React49.forwardRef(
|
|
|
3547
3725
|
caret
|
|
3548
3726
|
]
|
|
3549
3727
|
}
|
|
3550
|
-
) : checkbox ? /* @__PURE__ */
|
|
3728
|
+
) : checkbox ? /* @__PURE__ */ jsx51("div", { className: "flex items-center justify-center", children }) : children
|
|
3551
3729
|
}
|
|
3552
3730
|
);
|
|
3553
3731
|
}
|
|
3554
3732
|
);
|
|
3555
3733
|
TableHead.displayName = "TableHead";
|
|
3556
|
-
var TableCell =
|
|
3557
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */
|
|
3734
|
+
var TableCell = React50.forwardRef(
|
|
3735
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ jsx51(
|
|
3558
3736
|
"td",
|
|
3559
3737
|
{
|
|
3560
3738
|
ref,
|
|
@@ -3567,25 +3745,25 @@ var TableCell = React49.forwardRef(
|
|
|
3567
3745
|
className
|
|
3568
3746
|
),
|
|
3569
3747
|
...props,
|
|
3570
|
-
children: checkbox ? /* @__PURE__ */
|
|
3748
|
+
children: checkbox ? /* @__PURE__ */ jsx51("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ jsx51("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
3571
3749
|
}
|
|
3572
3750
|
)
|
|
3573
3751
|
);
|
|
3574
3752
|
TableCell.displayName = "TableCell";
|
|
3575
3753
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
3576
|
-
return /* @__PURE__ */
|
|
3754
|
+
return /* @__PURE__ */ jsxs38("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
3577
3755
|
avatar,
|
|
3578
|
-
/* @__PURE__ */
|
|
3579
|
-
/* @__PURE__ */
|
|
3580
|
-
secondary && /* @__PURE__ */
|
|
3756
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
3757
|
+
/* @__PURE__ */ jsx51("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
3758
|
+
secondary && /* @__PURE__ */ jsx51("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
3581
3759
|
] })
|
|
3582
3760
|
] });
|
|
3583
3761
|
}
|
|
3584
3762
|
|
|
3585
3763
|
// src/components/Data Display/StatCard.tsx
|
|
3586
|
-
import * as
|
|
3764
|
+
import * as React51 from "react";
|
|
3587
3765
|
import { cva as cva6 } from "class-variance-authority";
|
|
3588
|
-
import { jsx as
|
|
3766
|
+
import { jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3589
3767
|
var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
3590
3768
|
variants: {
|
|
3591
3769
|
variant: {
|
|
@@ -3599,25 +3777,26 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
3599
3777
|
},
|
|
3600
3778
|
defaultVariants: { variant: "default" }
|
|
3601
3779
|
});
|
|
3602
|
-
var StatCard =
|
|
3603
|
-
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
3605
|
-
/* @__PURE__ */
|
|
3606
|
-
icon && /* @__PURE__ */
|
|
3780
|
+
var StatCard = React51.forwardRef(
|
|
3781
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ jsxs39("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
3782
|
+
/* @__PURE__ */ jsx52("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
3783
|
+
/* @__PURE__ */ jsxs39("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
3784
|
+
icon && /* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
3607
3785
|
value
|
|
3608
|
-
] })
|
|
3786
|
+
] }),
|
|
3787
|
+
caption && /* @__PURE__ */ jsx52("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
3609
3788
|
] })
|
|
3610
3789
|
);
|
|
3611
3790
|
StatCard.displayName = "StatCard";
|
|
3612
3791
|
|
|
3613
3792
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3614
|
-
import * as
|
|
3793
|
+
import * as React53 from "react";
|
|
3615
3794
|
|
|
3616
3795
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
3617
|
-
import * as
|
|
3796
|
+
import * as React52 from "react";
|
|
3618
3797
|
import { Crown, Plus as Plus5, X as X6 } from "@phosphor-icons/react";
|
|
3619
3798
|
import { cva as cva7 } from "class-variance-authority";
|
|
3620
|
-
import { jsx as
|
|
3799
|
+
import { jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3621
3800
|
var editableTagVariants = cva7(
|
|
3622
3801
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3623
3802
|
{
|
|
@@ -3632,27 +3811,27 @@ var editableTagVariants = cva7(
|
|
|
3632
3811
|
defaultVariants: { type: "default" }
|
|
3633
3812
|
}
|
|
3634
3813
|
);
|
|
3635
|
-
var EditableTag =
|
|
3814
|
+
var EditableTag = React52.forwardRef(
|
|
3636
3815
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
3637
3816
|
const classes = cn(editableTagVariants({ type }), className);
|
|
3638
|
-
const leading = type === "add" ? /* @__PURE__ */
|
|
3817
|
+
const leading = type === "add" ? /* @__PURE__ */ jsx53(Plus5, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ jsx53(Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
3639
3818
|
if (type === "add" || type === "multiple" && onClick) {
|
|
3640
|
-
return /* @__PURE__ */
|
|
3819
|
+
return /* @__PURE__ */ jsxs40("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
3641
3820
|
leading,
|
|
3642
3821
|
children
|
|
3643
3822
|
] });
|
|
3644
3823
|
}
|
|
3645
|
-
return /* @__PURE__ */
|
|
3824
|
+
return /* @__PURE__ */ jsxs40("span", { ref, className: classes, ...props, children: [
|
|
3646
3825
|
leading,
|
|
3647
3826
|
children,
|
|
3648
|
-
onRemove && /* @__PURE__ */
|
|
3827
|
+
onRemove && /* @__PURE__ */ jsx53(
|
|
3649
3828
|
"button",
|
|
3650
3829
|
{
|
|
3651
3830
|
type: "button",
|
|
3652
3831
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
3653
3832
|
onClick: onRemove,
|
|
3654
3833
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
3655
|
-
children: /* @__PURE__ */
|
|
3834
|
+
children: /* @__PURE__ */ jsx53(X6, { size: 12, "aria-hidden": true })
|
|
3656
3835
|
}
|
|
3657
3836
|
)
|
|
3658
3837
|
] });
|
|
@@ -3661,26 +3840,26 @@ var EditableTag = React51.forwardRef(
|
|
|
3661
3840
|
EditableTag.displayName = "EditableTag";
|
|
3662
3841
|
|
|
3663
3842
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3664
|
-
import { jsx as
|
|
3665
|
-
var ActivityStructure =
|
|
3666
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */
|
|
3843
|
+
import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3844
|
+
var ActivityStructure = React53.forwardRef(
|
|
3845
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ jsxs41(
|
|
3667
3846
|
"section",
|
|
3668
3847
|
{
|
|
3669
3848
|
ref,
|
|
3670
3849
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
3671
3850
|
...props,
|
|
3672
3851
|
children: [
|
|
3673
|
-
/* @__PURE__ */
|
|
3674
|
-
/* @__PURE__ */
|
|
3852
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between gap-2", children: [
|
|
3853
|
+
/* @__PURE__ */ jsx54("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
3675
3854
|
action
|
|
3676
3855
|
] }),
|
|
3677
|
-
stats.length > 0 && /* @__PURE__ */
|
|
3678
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */
|
|
3679
|
-
/* @__PURE__ */
|
|
3680
|
-
/* @__PURE__ */
|
|
3681
|
-
(tags?.length || onAddTag) && /* @__PURE__ */
|
|
3682
|
-
tags?.map((tag) => /* @__PURE__ */
|
|
3683
|
-
onAddTag && /* @__PURE__ */
|
|
3856
|
+
stats.length > 0 && /* @__PURE__ */ jsx54("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx54(StatCard, { ...stat }, id)) }),
|
|
3857
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs41("div", { className: "flex flex-col gap-2", children: [
|
|
3858
|
+
/* @__PURE__ */ jsx54("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
3859
|
+
/* @__PURE__ */ jsx54("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
3860
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ jsxs41("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3861
|
+
tags?.map((tag) => /* @__PURE__ */ jsx54(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
3862
|
+
onAddTag && /* @__PURE__ */ jsx54(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
3684
3863
|
] })
|
|
3685
3864
|
] }, id)),
|
|
3686
3865
|
children
|
|
@@ -3691,10 +3870,10 @@ var ActivityStructure = React52.forwardRef(
|
|
|
3691
3870
|
ActivityStructure.displayName = "ActivityStructure";
|
|
3692
3871
|
|
|
3693
3872
|
// src/components/Tags & Badges/Badge.tsx
|
|
3694
|
-
import * as
|
|
3873
|
+
import * as React54 from "react";
|
|
3695
3874
|
import { DotsSixVertical as DotsSixVertical5, RadioButton as RadioButton2 } from "@phosphor-icons/react";
|
|
3696
3875
|
import { cva as cva8 } from "class-variance-authority";
|
|
3697
|
-
import { jsx as
|
|
3876
|
+
import { jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3698
3877
|
var roleTagVariants = cva8(
|
|
3699
3878
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3700
3879
|
{
|
|
@@ -3720,11 +3899,11 @@ var roleTagVariants = cva8(
|
|
|
3720
3899
|
defaultVariants: { type: "primary", selected: false }
|
|
3721
3900
|
}
|
|
3722
3901
|
);
|
|
3723
|
-
var Badge =
|
|
3902
|
+
var Badge = React54.forwardRef(
|
|
3724
3903
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
3725
3904
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
3726
3905
|
if (type === "interactable") {
|
|
3727
|
-
return /* @__PURE__ */
|
|
3906
|
+
return /* @__PURE__ */ jsxs42(
|
|
3728
3907
|
"button",
|
|
3729
3908
|
{
|
|
3730
3909
|
ref,
|
|
@@ -3734,15 +3913,15 @@ var Badge = React53.forwardRef(
|
|
|
3734
3913
|
onClick,
|
|
3735
3914
|
...props,
|
|
3736
3915
|
children: [
|
|
3737
|
-
/* @__PURE__ */
|
|
3916
|
+
/* @__PURE__ */ jsx55(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
3738
3917
|
children
|
|
3739
3918
|
]
|
|
3740
3919
|
}
|
|
3741
3920
|
);
|
|
3742
3921
|
}
|
|
3743
|
-
return /* @__PURE__ */
|
|
3744
|
-
type === "question" && /* @__PURE__ */
|
|
3745
|
-
type === "id" && /* @__PURE__ */
|
|
3922
|
+
return /* @__PURE__ */ jsxs42("span", { ref, className: classes, ...props, children: [
|
|
3923
|
+
type === "question" && /* @__PURE__ */ jsx55(RadioButton2, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
3924
|
+
type === "id" && /* @__PURE__ */ jsx55("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
3746
3925
|
children
|
|
3747
3926
|
] });
|
|
3748
3927
|
}
|
|
@@ -3750,9 +3929,9 @@ var Badge = React53.forwardRef(
|
|
|
3750
3929
|
Badge.displayName = "Badge";
|
|
3751
3930
|
|
|
3752
3931
|
// src/components/Utility/Pagination.tsx
|
|
3753
|
-
import * as
|
|
3932
|
+
import * as React55 from "react";
|
|
3754
3933
|
import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
|
|
3755
|
-
import { jsx as
|
|
3934
|
+
import { jsx as jsx56, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3756
3935
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
3757
3936
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
3758
3937
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -3766,10 +3945,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
3766
3945
|
});
|
|
3767
3946
|
return items;
|
|
3768
3947
|
}
|
|
3769
|
-
var Pagination =
|
|
3948
|
+
var Pagination = React55.forwardRef(
|
|
3770
3949
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
3771
3950
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
3772
|
-
const previous = /* @__PURE__ */
|
|
3951
|
+
const previous = /* @__PURE__ */ jsx56(
|
|
3773
3952
|
Button,
|
|
3774
3953
|
{
|
|
3775
3954
|
type: "button",
|
|
@@ -3778,10 +3957,10 @@ var Pagination = React54.forwardRef(
|
|
|
3778
3957
|
"aria-label": "Previous page",
|
|
3779
3958
|
disabled: page <= 1,
|
|
3780
3959
|
onClick: () => go(page - 1),
|
|
3781
|
-
children: /* @__PURE__ */
|
|
3960
|
+
children: /* @__PURE__ */ jsx56(ArrowLeft, { size: 16, "aria-hidden": true })
|
|
3782
3961
|
}
|
|
3783
3962
|
);
|
|
3784
|
-
const next = /* @__PURE__ */
|
|
3963
|
+
const next = /* @__PURE__ */ jsx56(
|
|
3785
3964
|
Button,
|
|
3786
3965
|
{
|
|
3787
3966
|
type: "button",
|
|
@@ -3790,10 +3969,10 @@ var Pagination = React54.forwardRef(
|
|
|
3790
3969
|
"aria-label": "Next page",
|
|
3791
3970
|
disabled: page >= pageCount,
|
|
3792
3971
|
onClick: () => go(page + 1),
|
|
3793
|
-
children: /* @__PURE__ */
|
|
3972
|
+
children: /* @__PURE__ */ jsx56(ArrowRight, { size: 16, "aria-hidden": true })
|
|
3794
3973
|
}
|
|
3795
3974
|
);
|
|
3796
|
-
return /* @__PURE__ */
|
|
3975
|
+
return /* @__PURE__ */ jsxs43(
|
|
3797
3976
|
"nav",
|
|
3798
3977
|
{
|
|
3799
3978
|
ref,
|
|
@@ -3802,14 +3981,14 @@ var Pagination = React54.forwardRef(
|
|
|
3802
3981
|
...props,
|
|
3803
3982
|
children: [
|
|
3804
3983
|
previous,
|
|
3805
|
-
variant === "compact" ? /* @__PURE__ */
|
|
3984
|
+
variant === "compact" ? /* @__PURE__ */ jsxs43("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
3806
3985
|
page,
|
|
3807
3986
|
"/",
|
|
3808
3987
|
pageCount
|
|
3809
|
-
] }) : /* @__PURE__ */
|
|
3810
|
-
/* @__PURE__ */
|
|
3811
|
-
/* @__PURE__ */
|
|
3812
|
-
] }) : /* @__PURE__ */
|
|
3988
|
+
] }) : /* @__PURE__ */ jsx56("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ jsx56("li", { children: item === "ellipsis" ? /* @__PURE__ */ jsxs43("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
3989
|
+
/* @__PURE__ */ jsx56(DotsThree2, { size: 16, "aria-hidden": true }),
|
|
3990
|
+
/* @__PURE__ */ jsx56("span", { className: "sr-only", children: "More pages" })
|
|
3991
|
+
] }) : /* @__PURE__ */ jsx56(
|
|
3813
3992
|
Button,
|
|
3814
3993
|
{
|
|
3815
3994
|
type: "button",
|