@discuss-ds/ui 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/index.cjs +747 -578
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -13
- package/dist/index.d.ts +61 -13
- package/dist/index.js +690 -521
- 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 { 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,10 +2307,10 @@ var Toast = React33.forwardRef(
|
|
|
2181
2307
|
);
|
|
2182
2308
|
Toast.displayName = "Toast";
|
|
2183
2309
|
var ToastAction = ToastPrimitive.Action;
|
|
2184
|
-
var ToastInline =
|
|
2310
|
+
var ToastInline = React34.forwardRef(
|
|
2185
2311
|
({ className, variant = "info", actions, onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
2186
2312
|
const v = variant ?? "info";
|
|
2187
|
-
return /* @__PURE__ */
|
|
2313
|
+
return /* @__PURE__ */ jsxs25(
|
|
2188
2314
|
"div",
|
|
2189
2315
|
{
|
|
2190
2316
|
ref,
|
|
@@ -2192,10 +2318,10 @@ var ToastInline = React33.forwardRef(
|
|
|
2192
2318
|
className: cn("flex items-center gap-2 rounded-sm px-2 py-1.5", inlineVariants({ variant: v }), className),
|
|
2193
2319
|
...props,
|
|
2194
2320
|
children: [
|
|
2195
|
-
/* @__PURE__ */
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
actions && /* @__PURE__ */
|
|
2198
|
-
onClose && /* @__PURE__ */
|
|
2321
|
+
/* @__PURE__ */ jsx35(VariantIcon, { variant: v === "neutral" ? "info" : v, size: 16 }),
|
|
2322
|
+
/* @__PURE__ */ jsx35("p", { className: "min-w-0 flex-1 text-body-small text-secondary-muted-foreground", children }),
|
|
2323
|
+
actions && /* @__PURE__ */ jsx35("div", { className: "flex shrink-0 items-center gap-2", children: actions }),
|
|
2324
|
+
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
2325
|
]
|
|
2200
2326
|
}
|
|
2201
2327
|
);
|
|
@@ -2204,16 +2330,16 @@ var ToastInline = React33.forwardRef(
|
|
|
2204
2330
|
ToastInline.displayName = "ToastInline";
|
|
2205
2331
|
|
|
2206
2332
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
2207
|
-
import * as
|
|
2333
|
+
import * as React35 from "react";
|
|
2208
2334
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2209
|
-
import { Fragment as
|
|
2335
|
+
import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2210
2336
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
2211
2337
|
var Tooltip = TooltipPrimitive.Root;
|
|
2212
2338
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
2213
|
-
var TooltipContent =
|
|
2339
|
+
var TooltipContent = React35.forwardRef(
|
|
2214
2340
|
({ className, sideOffset = 4, title, description, action, arrow = true, children, ...props }, ref) => {
|
|
2215
2341
|
const detailed = title != null || description != null;
|
|
2216
|
-
return /* @__PURE__ */
|
|
2342
|
+
return /* @__PURE__ */ jsx36(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs26(
|
|
2217
2343
|
TooltipPrimitive.Content,
|
|
2218
2344
|
{
|
|
2219
2345
|
ref,
|
|
@@ -2227,12 +2353,12 @@ var TooltipContent = React34.forwardRef(
|
|
|
2227
2353
|
),
|
|
2228
2354
|
...props,
|
|
2229
2355
|
children: [
|
|
2230
|
-
detailed ? /* @__PURE__ */
|
|
2231
|
-
title != null && /* @__PURE__ */
|
|
2232
|
-
description != null && /* @__PURE__ */
|
|
2233
|
-
action != null && /* @__PURE__ */
|
|
2356
|
+
detailed ? /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2357
|
+
title != null && /* @__PURE__ */ jsx36("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2358
|
+
description != null && /* @__PURE__ */ jsx36("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2359
|
+
action != null && /* @__PURE__ */ jsx36("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
2234
2360
|
] }) : children,
|
|
2235
|
-
arrow && /* @__PURE__ */
|
|
2361
|
+
arrow && /* @__PURE__ */ jsx36(TooltipPrimitive.Arrow, { width: 12, height: 8, className: "fill-primary-soft-foreground" })
|
|
2236
2362
|
]
|
|
2237
2363
|
}
|
|
2238
2364
|
) });
|
|
@@ -2241,14 +2367,14 @@ var TooltipContent = React34.forwardRef(
|
|
|
2241
2367
|
TooltipContent.displayName = "TooltipContent";
|
|
2242
2368
|
|
|
2243
2369
|
// src/components/Question Types/FileUpload.tsx
|
|
2244
|
-
import * as
|
|
2370
|
+
import * as React37 from "react";
|
|
2245
2371
|
import { FileText, X as X5 } from "@phosphor-icons/react";
|
|
2246
2372
|
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
2247
2373
|
|
|
2248
2374
|
// src/components/Tags & Badges/Tag.tsx
|
|
2249
|
-
import * as
|
|
2375
|
+
import * as React36 from "react";
|
|
2250
2376
|
import { cva as cva5 } from "class-variance-authority";
|
|
2251
|
-
import { jsx as
|
|
2377
|
+
import { jsx as jsx37, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2252
2378
|
var tagVariants = cva5(
|
|
2253
2379
|
"inline-flex items-center gap-1.5 whitespace-nowrap rounded-sm border px-2.5 py-1 text-ui-caption",
|
|
2254
2380
|
{
|
|
@@ -2264,7 +2390,7 @@ var tagVariants = cva5(
|
|
|
2264
2390
|
defaultVariants: { variant: "neutral" }
|
|
2265
2391
|
}
|
|
2266
2392
|
);
|
|
2267
|
-
var Tag =
|
|
2393
|
+
var Tag = React36.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx37("span", { ref, className: cn(tagVariants({ variant }), className), ...props }));
|
|
2268
2394
|
Tag.displayName = "Tag";
|
|
2269
2395
|
var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
2270
2396
|
variants: {
|
|
@@ -2277,20 +2403,20 @@ var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
|
2277
2403
|
},
|
|
2278
2404
|
defaultVariants: { status: "active" }
|
|
2279
2405
|
});
|
|
2280
|
-
var StatusTag =
|
|
2281
|
-
({ className, status, children, ...props }, ref) => /* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2406
|
+
var StatusTag = React36.forwardRef(
|
|
2407
|
+
({ className, status, children, ...props }, ref) => /* @__PURE__ */ jsxs27("span", { ref, className: cn(tagVariants({ variant: "default" }), className), ...props, children: [
|
|
2408
|
+
/* @__PURE__ */ jsx37("span", { className: statusDotVariants({ status }), "aria-hidden": "true" }),
|
|
2283
2409
|
children
|
|
2284
2410
|
] })
|
|
2285
2411
|
);
|
|
2286
2412
|
StatusTag.displayName = "StatusTag";
|
|
2287
2413
|
|
|
2288
2414
|
// src/components/Question Types/FileUpload.tsx
|
|
2289
|
-
import { Fragment as
|
|
2290
|
-
var FileUploadZone =
|
|
2415
|
+
import { Fragment as Fragment7, jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2416
|
+
var FileUploadZone = React37.forwardRef(
|
|
2291
2417
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2292
|
-
const [over, setOver] =
|
|
2293
|
-
return /* @__PURE__ */
|
|
2418
|
+
const [over, setOver] = React37.useState(false);
|
|
2419
|
+
return /* @__PURE__ */ jsxs28(
|
|
2294
2420
|
"label",
|
|
2295
2421
|
{
|
|
2296
2422
|
className: cn(
|
|
@@ -2310,12 +2436,12 @@ var FileUploadZone = React36.forwardRef(
|
|
|
2310
2436
|
onFiles?.(Array.from(event.dataTransfer.files));
|
|
2311
2437
|
},
|
|
2312
2438
|
children: [
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
hint && /* @__PURE__ */
|
|
2439
|
+
/* @__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 }) }),
|
|
2440
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex flex-col gap-1", children: [
|
|
2441
|
+
/* @__PURE__ */ jsx38("span", { className: "text-body-small text-surface-foreground", children: title }),
|
|
2442
|
+
hint && /* @__PURE__ */ jsx38("span", { className: "text-ui-caption text-secondary-muted-foreground", children: hint })
|
|
2317
2443
|
] }),
|
|
2318
|
-
/* @__PURE__ */
|
|
2444
|
+
/* @__PURE__ */ jsx38(
|
|
2319
2445
|
"input",
|
|
2320
2446
|
{
|
|
2321
2447
|
ref,
|
|
@@ -2331,47 +2457,47 @@ var FileUploadZone = React36.forwardRef(
|
|
|
2331
2457
|
}
|
|
2332
2458
|
);
|
|
2333
2459
|
FileUploadZone.displayName = "FileUploadZone";
|
|
2334
|
-
var FileUploadItem =
|
|
2460
|
+
var FileUploadItem = React37.forwardRef(
|
|
2335
2461
|
({ className, name, size, status = "uploading", progress = 0, timeLeft, icon, onRemove, removeLabel, ...props }, ref) => {
|
|
2336
2462
|
const uploading = status === "uploading";
|
|
2337
|
-
return /* @__PURE__ */
|
|
2463
|
+
return /* @__PURE__ */ jsxs28(
|
|
2338
2464
|
"div",
|
|
2339
2465
|
{
|
|
2340
2466
|
ref,
|
|
2341
2467
|
className: cn("flex w-full flex-col justify-center gap-2 overflow-hidden rounded-sm border border-border p-2", className),
|
|
2342
2468
|
...props,
|
|
2343
2469
|
children: [
|
|
2344
|
-
/* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2347
|
-
/* @__PURE__ */
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
onRemove && /* @__PURE__ */
|
|
2470
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
|
|
2471
|
+
/* @__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 }) }),
|
|
2472
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2473
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2474
|
+
/* @__PURE__ */ jsx38("p", { className: "min-w-0 truncate text-ui-label text-surface-foreground", children: name }),
|
|
2475
|
+
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
2476
|
] }),
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
/* @__PURE__ */
|
|
2477
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2478
|
+
/* @__PURE__ */ jsxs28("span", { className: "flex items-center gap-2", children: [
|
|
2353
2479
|
size,
|
|
2354
|
-
status === "complete" && /* @__PURE__ */
|
|
2355
|
-
status === "error" && /* @__PURE__ */
|
|
2356
|
-
uploading && timeLeft && /* @__PURE__ */
|
|
2357
|
-
/* @__PURE__ */
|
|
2480
|
+
status === "complete" && /* @__PURE__ */ jsx38(Tag, { variant: "success", children: "Complete" }),
|
|
2481
|
+
status === "error" && /* @__PURE__ */ jsx38(Tag, { variant: "destructive", children: "Error" }),
|
|
2482
|
+
uploading && timeLeft && /* @__PURE__ */ jsxs28(Fragment7, { children: [
|
|
2483
|
+
/* @__PURE__ */ jsx38("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2358
2484
|
timeLeft
|
|
2359
2485
|
] })
|
|
2360
2486
|
] }),
|
|
2361
|
-
uploading && /* @__PURE__ */
|
|
2487
|
+
uploading && /* @__PURE__ */ jsxs28("span", { className: "text-body-xxs font-normal", children: [
|
|
2362
2488
|
Math.round(progress),
|
|
2363
2489
|
"%"
|
|
2364
2490
|
] })
|
|
2365
2491
|
] })
|
|
2366
2492
|
] })
|
|
2367
2493
|
] }),
|
|
2368
|
-
uploading && /* @__PURE__ */
|
|
2494
|
+
uploading && /* @__PURE__ */ jsx38(
|
|
2369
2495
|
ProgressPrimitive.Root,
|
|
2370
2496
|
{
|
|
2371
2497
|
value: progress,
|
|
2372
2498
|
"aria-label": `Uploading ${name}`,
|
|
2373
2499
|
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__ */
|
|
2500
|
+
children: /* @__PURE__ */ jsx38(ProgressPrimitive.Indicator, { className: "h-full bg-accent transition-[width]", style: { width: `${progress}%` } })
|
|
2375
2501
|
}
|
|
2376
2502
|
)
|
|
2377
2503
|
]
|
|
@@ -2382,25 +2508,25 @@ var FileUploadItem = React36.forwardRef(
|
|
|
2382
2508
|
FileUploadItem.displayName = "FileUploadItem";
|
|
2383
2509
|
|
|
2384
2510
|
// src/components/Question Types/Media.tsx
|
|
2385
|
-
import * as
|
|
2386
|
-
import { CornersOut, DotsThree, Image as ImageIcon, Pause, Play, SpeakerSimpleHigh, SpeakerSimpleX, Trash as
|
|
2511
|
+
import * as React38 from "react";
|
|
2512
|
+
import { CornersOut, DotsThree, Image as ImageIcon, Pause, Play, SpeakerSimpleHigh, SpeakerSimpleX, Trash as Trash3 } from "@phosphor-icons/react";
|
|
2387
2513
|
import { Slider as SliderPrimitive2, ToggleGroup as ToggleGroupPrimitive2 } from "radix-ui";
|
|
2388
|
-
import { jsx as
|
|
2514
|
+
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2389
2515
|
function MediaInfo({ name, details, onRemove, removeLabel, large, className, ...props }) {
|
|
2390
|
-
return /* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2393
|
-
details && /* @__PURE__ */
|
|
2394
|
-
index > 0 && /* @__PURE__ */
|
|
2516
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("flex items-center justify-between border-t border-border bg-surface px-6 py-4", className), ...props, children: [
|
|
2517
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2518
|
+
/* @__PURE__ */ jsx39("p", { className: cn("truncate text-surface-foreground", large ? "text-body-section" : "text-ui-label"), children: name }),
|
|
2519
|
+
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: [
|
|
2520
|
+
index > 0 && /* @__PURE__ */ jsx39("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2395
2521
|
part
|
|
2396
2522
|
] }, part)) })
|
|
2397
2523
|
] }),
|
|
2398
|
-
onRemove && /* @__PURE__ */
|
|
2524
|
+
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
2525
|
] });
|
|
2400
2526
|
}
|
|
2401
|
-
var ImagePreview =
|
|
2402
|
-
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */
|
|
2403
|
-
/* @__PURE__ */
|
|
2527
|
+
var ImagePreview = React38.forwardRef(
|
|
2528
|
+
({ 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: [
|
|
2529
|
+
/* @__PURE__ */ jsx39(
|
|
2404
2530
|
"div",
|
|
2405
2531
|
{
|
|
2406
2532
|
className: cn(
|
|
@@ -2411,12 +2537,12 @@ var ImagePreview = React37.forwardRef(
|
|
|
2411
2537
|
children
|
|
2412
2538
|
}
|
|
2413
2539
|
),
|
|
2414
|
-
/* @__PURE__ */
|
|
2540
|
+
/* @__PURE__ */ jsx39(MediaInfo, { name, details, onRemove, large: true })
|
|
2415
2541
|
] })
|
|
2416
2542
|
);
|
|
2417
2543
|
ImagePreview.displayName = "ImagePreview";
|
|
2418
|
-
var ImageThumbnails =
|
|
2419
|
-
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */
|
|
2544
|
+
var ImageThumbnails = React38.forwardRef(
|
|
2545
|
+
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
2420
2546
|
ToggleGroupPrimitive2.Root,
|
|
2421
2547
|
{
|
|
2422
2548
|
ref,
|
|
@@ -2428,17 +2554,17 @@ var ImageThumbnails = React37.forwardRef(
|
|
|
2428
2554
|
children: Array.from({ length: max }, (_, index) => {
|
|
2429
2555
|
const image = images[index];
|
|
2430
2556
|
if (!image) {
|
|
2431
|
-
return /* @__PURE__ */
|
|
2557
|
+
return /* @__PURE__ */ jsx39(
|
|
2432
2558
|
"span",
|
|
2433
2559
|
{
|
|
2434
2560
|
"aria-hidden": "true",
|
|
2435
2561
|
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__ */
|
|
2562
|
+
children: /* @__PURE__ */ jsx39(ImageIcon, { size: 24 })
|
|
2437
2563
|
},
|
|
2438
2564
|
`empty-${index}`
|
|
2439
2565
|
);
|
|
2440
2566
|
}
|
|
2441
|
-
return /* @__PURE__ */
|
|
2567
|
+
return /* @__PURE__ */ jsx39(
|
|
2442
2568
|
ToggleGroupPrimitive2.Item,
|
|
2443
2569
|
{
|
|
2444
2570
|
value: image.id,
|
|
@@ -2448,7 +2574,7 @@ var ImageThumbnails = React37.forwardRef(
|
|
|
2448
2574
|
"hover:bg-accent-soft hover:bg-none",
|
|
2449
2575
|
"data-[state=on]:border-accent-foreground data-[state=on]:bg-accent-soft data-[state=on]:bg-none data-[state=on]:text-accent-foreground"
|
|
2450
2576
|
),
|
|
2451
|
-
children: image.src ? /* @__PURE__ */
|
|
2577
|
+
children: image.src ? /* @__PURE__ */ jsx39("img", { src: image.src, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx39(ImageIcon, { size: 24, "aria-hidden": true })
|
|
2452
2578
|
},
|
|
2453
2579
|
image.id
|
|
2454
2580
|
);
|
|
@@ -2461,13 +2587,13 @@ var formatTime = (seconds) => {
|
|
|
2461
2587
|
const total = Math.max(0, Math.floor(Number.isFinite(seconds) ? seconds : 0));
|
|
2462
2588
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
2463
2589
|
};
|
|
2464
|
-
var VideoPlayer =
|
|
2590
|
+
var VideoPlayer = React38.forwardRef(
|
|
2465
2591
|
({ 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] =
|
|
2592
|
+
const video = React38.useRef(null);
|
|
2593
|
+
const [playing, setPlaying] = React38.useState(false);
|
|
2594
|
+
const [time, setTime] = React38.useState(initialTime);
|
|
2595
|
+
const [duration, setDuration] = React38.useState(initialDuration);
|
|
2596
|
+
const [volume, setVolume] = React38.useState(1);
|
|
2471
2597
|
const muted = volume === 0;
|
|
2472
2598
|
const toggle2 = () => {
|
|
2473
2599
|
const el = video.current;
|
|
@@ -2475,9 +2601,9 @@ var VideoPlayer = React37.forwardRef(
|
|
|
2475
2601
|
if (el.paused) void el.play();
|
|
2476
2602
|
else el.pause();
|
|
2477
2603
|
};
|
|
2478
|
-
return /* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
src && /* @__PURE__ */
|
|
2604
|
+
return /* @__PURE__ */ jsxs29("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface", className), ...props, children: [
|
|
2605
|
+
/* @__PURE__ */ jsxs29("div", { className: "relative flex h-60.5 w-full items-end bg-accent-soft", children: [
|
|
2606
|
+
src && /* @__PURE__ */ jsx39(
|
|
2481
2607
|
"video",
|
|
2482
2608
|
{
|
|
2483
2609
|
ref: video,
|
|
@@ -2490,8 +2616,8 @@ var VideoPlayer = React37.forwardRef(
|
|
|
2490
2616
|
onVolumeChange: (event) => setVolume(event.currentTarget.muted ? 0 : event.currentTarget.volume)
|
|
2491
2617
|
}
|
|
2492
2618
|
),
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2619
|
+
/* @__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: [
|
|
2620
|
+
/* @__PURE__ */ jsxs29(
|
|
2495
2621
|
SliderPrimitive2.Root,
|
|
2496
2622
|
{
|
|
2497
2623
|
min: 0,
|
|
@@ -2505,31 +2631,31 @@ var VideoPlayer = React37.forwardRef(
|
|
|
2505
2631
|
},
|
|
2506
2632
|
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
2507
2633
|
children: [
|
|
2508
|
-
/* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */
|
|
2634
|
+
/* @__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" }) }),
|
|
2635
|
+
/* @__PURE__ */ jsx39(SliderPrimitive2.Thumb, { "aria-label": "Seek", className: "block size-3 rounded-full border-2 border-surface bg-surface shadow-sm" })
|
|
2510
2636
|
]
|
|
2511
2637
|
}
|
|
2512
2638
|
),
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
/* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2639
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
|
|
2640
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-4", children: [
|
|
2641
|
+
/* @__PURE__ */ jsx39(
|
|
2516
2642
|
"button",
|
|
2517
2643
|
{
|
|
2518
2644
|
type: "button",
|
|
2519
2645
|
"aria-label": playing ? "Pause" : "Play",
|
|
2520
2646
|
onClick: toggle2,
|
|
2521
2647
|
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__ */
|
|
2648
|
+
children: playing ? /* @__PURE__ */ jsx39(Pause, { size: 16, weight: "fill", "aria-hidden": true }) : /* @__PURE__ */ jsx39(Play, { size: 16, weight: "fill", "aria-hidden": true })
|
|
2523
2649
|
}
|
|
2524
2650
|
),
|
|
2525
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ jsxs29("span", { className: "text-ui-label whitespace-nowrap text-surface/80", children: [
|
|
2526
2652
|
formatTime(time),
|
|
2527
2653
|
" / ",
|
|
2528
2654
|
formatTime(duration)
|
|
2529
2655
|
] })
|
|
2530
2656
|
] }),
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2657
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
2658
|
+
/* @__PURE__ */ jsx39(
|
|
2533
2659
|
VolumeControl,
|
|
2534
2660
|
{
|
|
2535
2661
|
volume,
|
|
@@ -2542,41 +2668,41 @@ var VideoPlayer = React37.forwardRef(
|
|
|
2542
2668
|
}
|
|
2543
2669
|
}
|
|
2544
2670
|
),
|
|
2545
|
-
/* @__PURE__ */
|
|
2671
|
+
/* @__PURE__ */ jsx39(
|
|
2546
2672
|
"button",
|
|
2547
2673
|
{
|
|
2548
2674
|
type: "button",
|
|
2549
2675
|
"aria-label": "Full screen",
|
|
2550
2676
|
onClick: () => void video.current?.requestFullscreen?.(),
|
|
2551
2677
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2552
|
-
children: /* @__PURE__ */
|
|
2678
|
+
children: /* @__PURE__ */ jsx39(CornersOut, { size: 16, "aria-hidden": true })
|
|
2553
2679
|
}
|
|
2554
2680
|
),
|
|
2555
|
-
/* @__PURE__ */
|
|
2681
|
+
/* @__PURE__ */ jsx39(
|
|
2556
2682
|
"button",
|
|
2557
2683
|
{
|
|
2558
2684
|
type: "button",
|
|
2559
2685
|
"aria-label": "More",
|
|
2560
2686
|
onClick: onMore,
|
|
2561
2687
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2562
|
-
children: /* @__PURE__ */
|
|
2688
|
+
children: /* @__PURE__ */ jsx39(DotsThree, { size: 16, "aria-hidden": true })
|
|
2563
2689
|
}
|
|
2564
2690
|
)
|
|
2565
2691
|
] })
|
|
2566
2692
|
] })
|
|
2567
2693
|
] })
|
|
2568
2694
|
] }),
|
|
2569
|
-
name && /* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2695
|
+
name && /* @__PURE__ */ jsx39(MediaInfo, { name, details, onRemove }),
|
|
2696
|
+
/* @__PURE__ */ jsx39("span", { className: "sr-only", "aria-live": "polite", children: muted ? "Muted" : "" })
|
|
2571
2697
|
] });
|
|
2572
2698
|
}
|
|
2573
2699
|
);
|
|
2574
2700
|
VideoPlayer.displayName = "VideoPlayer";
|
|
2575
2701
|
function VolumeControl({ volume, onVolumeChange, className }) {
|
|
2576
|
-
const last =
|
|
2702
|
+
const last = React38.useRef(volume || 1);
|
|
2577
2703
|
if (volume > 0) last.current = volume;
|
|
2578
|
-
return /* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
2704
|
+
return /* @__PURE__ */ jsxs29("div", { className: cn("group/volume flex items-center", className), children: [
|
|
2705
|
+
/* @__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
2706
|
SliderPrimitive2.Root,
|
|
2581
2707
|
{
|
|
2582
2708
|
min: 0,
|
|
@@ -2586,32 +2712,32 @@ function VolumeControl({ volume, onVolumeChange, className }) {
|
|
|
2586
2712
|
onValueChange: ([next]) => next !== void 0 && onVolumeChange(next),
|
|
2587
2713
|
className: "relative flex h-4 w-14 touch-none items-center select-none",
|
|
2588
2714
|
children: [
|
|
2589
|
-
/* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */
|
|
2715
|
+
/* @__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" }) }),
|
|
2716
|
+
/* @__PURE__ */ jsx39(SliderPrimitive2.Thumb, { "aria-label": "Volume", className: "block size-3 rounded-full bg-surface shadow-sm" })
|
|
2591
2717
|
]
|
|
2592
2718
|
}
|
|
2593
2719
|
) }),
|
|
2594
|
-
/* @__PURE__ */
|
|
2720
|
+
/* @__PURE__ */ jsx39(
|
|
2595
2721
|
"button",
|
|
2596
2722
|
{
|
|
2597
2723
|
type: "button",
|
|
2598
2724
|
"aria-label": volume === 0 ? "Unmute" : "Mute",
|
|
2599
2725
|
onClick: () => onVolumeChange(volume === 0 ? last.current : 0),
|
|
2600
2726
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2601
|
-
children: volume === 0 ? /* @__PURE__ */
|
|
2727
|
+
children: volume === 0 ? /* @__PURE__ */ jsx39(SpeakerSimpleX, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx39(SpeakerSimpleHigh, { size: 16, "aria-hidden": true })
|
|
2602
2728
|
}
|
|
2603
2729
|
)
|
|
2604
2730
|
] });
|
|
2605
2731
|
}
|
|
2606
2732
|
|
|
2607
2733
|
// src/components/Question Types/OpenEndAnswer.tsx
|
|
2608
|
-
import * as
|
|
2609
|
-
import { jsx as
|
|
2610
|
-
var OpenEndAnswer =
|
|
2734
|
+
import * as React39 from "react";
|
|
2735
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2736
|
+
var OpenEndAnswer = React39.forwardRef(
|
|
2611
2737
|
({ value, defaultValue, onChange, maxLength = 1e3, placeholder = "Write your answer", ...props }, ref) => {
|
|
2612
|
-
const [internal, setInternal] =
|
|
2738
|
+
const [internal, setInternal] = React39.useState(String(defaultValue ?? ""));
|
|
2613
2739
|
const text = value !== void 0 ? String(value) : internal;
|
|
2614
|
-
return /* @__PURE__ */
|
|
2740
|
+
return /* @__PURE__ */ jsx40(
|
|
2615
2741
|
Textarea,
|
|
2616
2742
|
{
|
|
2617
2743
|
ref,
|
|
@@ -2631,10 +2757,10 @@ var OpenEndAnswer = React38.forwardRef(
|
|
|
2631
2757
|
OpenEndAnswer.displayName = "OpenEndAnswer";
|
|
2632
2758
|
|
|
2633
2759
|
// src/components/Question Types/QuestionCard.tsx
|
|
2634
|
-
import * as
|
|
2635
|
-
import { jsx as
|
|
2636
|
-
var QuestionCard =
|
|
2637
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2760
|
+
import * as React40 from "react";
|
|
2761
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2762
|
+
var QuestionCard = React40.forwardRef(
|
|
2763
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx41(
|
|
2638
2764
|
"div",
|
|
2639
2765
|
{
|
|
2640
2766
|
ref,
|
|
@@ -2646,50 +2772,87 @@ var QuestionCard = React39.forwardRef(
|
|
|
2646
2772
|
QuestionCard.displayName = "QuestionCard";
|
|
2647
2773
|
|
|
2648
2774
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2649
|
-
import * as
|
|
2775
|
+
import * as React43 from "react";
|
|
2650
2776
|
import {
|
|
2651
2777
|
Clipboard,
|
|
2652
2778
|
Copy,
|
|
2653
2779
|
Eye,
|
|
2654
2780
|
Plus as Plus3,
|
|
2655
2781
|
Sparkle as Sparkle2,
|
|
2656
|
-
Trash as
|
|
2782
|
+
Trash as Trash4,
|
|
2657
2783
|
Warning as Warning2
|
|
2658
2784
|
} from "@phosphor-icons/react";
|
|
2659
2785
|
|
|
2786
|
+
// src/lib/keepEditingFocus.ts
|
|
2787
|
+
function keepEditingFocus(event) {
|
|
2788
|
+
const target = event.target;
|
|
2789
|
+
if (target.closest('button, a, input, textarea, select, label, [role="button"], [role="dialog"]')) return;
|
|
2790
|
+
const active = document.activeElement;
|
|
2791
|
+
if ((active instanceof HTMLTextAreaElement || active instanceof HTMLInputElement) && event.currentTarget.contains(active)) event.preventDefault();
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2660
2794
|
// src/components/Question Types/QuestionHeader.tsx
|
|
2661
|
-
import * as
|
|
2795
|
+
import * as React42 from "react";
|
|
2662
2796
|
import { DotsSixVertical } from "@phosphor-icons/react";
|
|
2663
|
-
|
|
2797
|
+
|
|
2798
|
+
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
2799
|
+
import "react";
|
|
2800
|
+
import { ChatsCircle, CheckSquare, FileArrowUp, ListNumbers, RadioButton, StarHalf, VideoCamera } from "@phosphor-icons/react";
|
|
2801
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
2802
|
+
var icons = {
|
|
2803
|
+
"select-one": RadioButton,
|
|
2804
|
+
"select-multiple": CheckSquare,
|
|
2805
|
+
ranking: ListNumbers,
|
|
2806
|
+
upload: FileArrowUp,
|
|
2807
|
+
rating: StarHalf,
|
|
2808
|
+
"open-end": ChatsCircle,
|
|
2809
|
+
"screen-recording": VideoCamera
|
|
2810
|
+
};
|
|
2811
|
+
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
2812
|
+
const Icon = icons[type];
|
|
2813
|
+
return /* @__PURE__ */ jsx42(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
// src/components/Question Types/QuestionHeader.tsx
|
|
2817
|
+
import { jsx as jsx43, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2664
2818
|
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] =
|
|
2819
|
+
var QuestionHeader = React42.forwardRef(
|
|
2820
|
+
({ 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) => {
|
|
2821
|
+
const [draft, setDraft] = React42.useState(null);
|
|
2668
2822
|
const label = String(number).padStart(2, "0");
|
|
2669
2823
|
const showError = error !== void 0 && error !== false;
|
|
2670
2824
|
if (editor) {
|
|
2671
2825
|
const text = typeof title === "string" ? title : "";
|
|
2672
2826
|
const count = (draft ?? text).length;
|
|
2673
|
-
const long = titleRecommendedMax !== void 0 &&
|
|
2674
|
-
return /* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2827
|
+
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
2828
|
+
return /* @__PURE__ */ jsxs30("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
2829
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between", children: [
|
|
2830
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-center gap-2", children: [
|
|
2831
|
+
/* @__PURE__ */ jsxs30(
|
|
2678
2832
|
"span",
|
|
2679
2833
|
{
|
|
2680
2834
|
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
2681
2835
|
...dragHandleProps,
|
|
2682
2836
|
className: cn(
|
|
2683
2837
|
"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
|
-
|
|
2838
|
+
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered. With a type icon the grip
|
|
2839
|
+
// takes the icon's place, so the tag keeps its padding and its width.
|
|
2840
|
+
showDragHandle && !questionType && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
2686
2841
|
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
2842
|
dragHandleProps && "cursor-grab touch-none select-none",
|
|
2688
|
-
dragHandleProps && showDragHandle && "focus-visible:pl-1",
|
|
2843
|
+
dragHandleProps && showDragHandle && !questionType && "focus-visible:pl-1",
|
|
2689
2844
|
dragHandleProps?.className
|
|
2690
2845
|
),
|
|
2691
2846
|
children: [
|
|
2692
|
-
|
|
2847
|
+
questionType && /* @__PURE__ */ jsx43(
|
|
2848
|
+
QuestionTypeIcon,
|
|
2849
|
+
{
|
|
2850
|
+
type: questionType,
|
|
2851
|
+
size: 16,
|
|
2852
|
+
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
2853
|
+
}
|
|
2854
|
+
),
|
|
2855
|
+
showDragHandle && /* @__PURE__ */ jsx43(
|
|
2693
2856
|
DotsSixVertical,
|
|
2694
2857
|
{
|
|
2695
2858
|
size: 16,
|
|
@@ -2704,13 +2867,13 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2704
2867
|
),
|
|
2705
2868
|
meta
|
|
2706
2869
|
] }),
|
|
2707
|
-
actions && /* @__PURE__ */
|
|
2870
|
+
actions && /* @__PURE__ */ jsx43("div", { className: cn(
|
|
2708
2871
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
2709
2872
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
2710
2873
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
2711
2874
|
), children: actions })
|
|
2712
2875
|
] }),
|
|
2713
|
-
/* @__PURE__ */
|
|
2876
|
+
/* @__PURE__ */ jsx43(
|
|
2714
2877
|
InlineEdit,
|
|
2715
2878
|
{
|
|
2716
2879
|
variant: "question",
|
|
@@ -2729,11 +2892,14 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2729
2892
|
onEditingChange: (editing) => {
|
|
2730
2893
|
if (!editing) setDraft(null);
|
|
2731
2894
|
},
|
|
2895
|
+
marks: titleMarks,
|
|
2896
|
+
onMarkApply: onTitleMarkApply,
|
|
2897
|
+
onMarkDismiss: onTitleMarkDismiss,
|
|
2732
2898
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
2733
2899
|
}
|
|
2734
2900
|
),
|
|
2735
|
-
long && /* @__PURE__ */
|
|
2736
|
-
showCounter && titleMinLength === void 0 && /* @__PURE__ */
|
|
2901
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ jsx43("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
2902
|
+
showCounter && titleMinLength === void 0 && /* @__PURE__ */ jsxs30("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
2737
2903
|
count,
|
|
2738
2904
|
"/",
|
|
2739
2905
|
maxLength,
|
|
@@ -2741,16 +2907,16 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2741
2907
|
] })
|
|
2742
2908
|
] });
|
|
2743
2909
|
}
|
|
2744
|
-
return /* @__PURE__ */
|
|
2745
|
-
showError && /* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2910
|
+
return /* @__PURE__ */ jsxs30("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
2911
|
+
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 }) }),
|
|
2912
|
+
/* @__PURE__ */ jsxs30("p", { className: eyebrow, children: [
|
|
2747
2913
|
"Question ",
|
|
2748
2914
|
label
|
|
2749
2915
|
] }),
|
|
2750
|
-
/* @__PURE__ */
|
|
2916
|
+
/* @__PURE__ */ jsxs30("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
2751
2917
|
title,
|
|
2752
|
-
required && /* @__PURE__ */
|
|
2753
|
-
required && /* @__PURE__ */
|
|
2918
|
+
required && /* @__PURE__ */ jsx43("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
2919
|
+
required && /* @__PURE__ */ jsx43("span", { className: "sr-only", children: " (required)" })
|
|
2754
2920
|
] })
|
|
2755
2921
|
] });
|
|
2756
2922
|
}
|
|
@@ -2758,8 +2924,8 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2758
2924
|
QuestionHeader.displayName = "QuestionHeader";
|
|
2759
2925
|
|
|
2760
2926
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2761
|
-
import { Fragment as
|
|
2762
|
-
var QuestionEditorCard =
|
|
2927
|
+
import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2928
|
+
var QuestionEditorCard = React43.forwardRef(
|
|
2763
2929
|
({
|
|
2764
2930
|
className,
|
|
2765
2931
|
number,
|
|
@@ -2786,19 +2952,27 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2786
2952
|
meta,
|
|
2787
2953
|
dragHandleProps,
|
|
2788
2954
|
showDragHandle,
|
|
2955
|
+
questionType,
|
|
2956
|
+
titleMarks,
|
|
2957
|
+
onTitleMarkApply,
|
|
2958
|
+
onTitleMarkDismiss,
|
|
2789
2959
|
children,
|
|
2790
2960
|
...props
|
|
2791
2961
|
}, ref) => {
|
|
2792
2962
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
2793
|
-
return /* @__PURE__ */
|
|
2963
|
+
return /* @__PURE__ */ jsxs31(
|
|
2794
2964
|
"div",
|
|
2795
2965
|
{
|
|
2796
2966
|
ref,
|
|
2797
2967
|
className: cn("group/editor flex w-full items-start gap-2", className),
|
|
2798
2968
|
"data-hovered": hovered ? "" : void 0,
|
|
2799
2969
|
...props,
|
|
2970
|
+
onMouseDown: (event) => {
|
|
2971
|
+
keepEditingFocus(event);
|
|
2972
|
+
props.onMouseDown?.(event);
|
|
2973
|
+
},
|
|
2800
2974
|
children: [
|
|
2801
|
-
/* @__PURE__ */
|
|
2975
|
+
/* @__PURE__ */ jsxs31(
|
|
2802
2976
|
"div",
|
|
2803
2977
|
{
|
|
2804
2978
|
className: cn(
|
|
@@ -2806,9 +2980,9 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2806
2980
|
active ? "border-accent" : "border-border"
|
|
2807
2981
|
),
|
|
2808
2982
|
children: [
|
|
2809
|
-
/* @__PURE__ */
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ jsxs31("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
2984
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex flex-col gap-4", children: [
|
|
2985
|
+
/* @__PURE__ */ jsx44(
|
|
2812
2986
|
QuestionHeader,
|
|
2813
2987
|
{
|
|
2814
2988
|
editor: true,
|
|
@@ -2824,10 +2998,14 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2824
2998
|
showCounter: !!active,
|
|
2825
2999
|
dragHandleProps,
|
|
2826
3000
|
showDragHandle,
|
|
3001
|
+
questionType,
|
|
3002
|
+
titleMarks,
|
|
3003
|
+
onTitleMarkApply,
|
|
3004
|
+
onTitleMarkDismiss,
|
|
2827
3005
|
meta,
|
|
2828
3006
|
maxLength,
|
|
2829
|
-
actions: actions ?? /* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
3007
|
+
actions: actions ?? /* @__PURE__ */ jsxs31(Fragment9, { children: [
|
|
3008
|
+
/* @__PURE__ */ jsx44(
|
|
2831
3009
|
Button,
|
|
2832
3010
|
{
|
|
2833
3011
|
type: "button",
|
|
@@ -2835,10 +3013,10 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2835
3013
|
size: "icon-sm",
|
|
2836
3014
|
"aria-label": "Duplicate question",
|
|
2837
3015
|
onClick: onDuplicate,
|
|
2838
|
-
children: /* @__PURE__ */
|
|
3016
|
+
children: /* @__PURE__ */ jsx44(Copy, { size: 16, "aria-hidden": true })
|
|
2839
3017
|
}
|
|
2840
3018
|
),
|
|
2841
|
-
/* @__PURE__ */
|
|
3019
|
+
/* @__PURE__ */ jsx44(
|
|
2842
3020
|
Button,
|
|
2843
3021
|
{
|
|
2844
3022
|
type: "button",
|
|
@@ -2846,10 +3024,10 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2846
3024
|
size: "icon-sm",
|
|
2847
3025
|
"aria-label": "Delete question",
|
|
2848
3026
|
onClick: onDelete,
|
|
2849
|
-
children: /* @__PURE__ */
|
|
3027
|
+
children: /* @__PURE__ */ jsx44(Trash4, { size: 16, "aria-hidden": true })
|
|
2850
3028
|
}
|
|
2851
3029
|
),
|
|
2852
|
-
/* @__PURE__ */
|
|
3030
|
+
/* @__PURE__ */ jsx44(
|
|
2853
3031
|
Button,
|
|
2854
3032
|
{
|
|
2855
3033
|
type: "button",
|
|
@@ -2857,7 +3035,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2857
3035
|
size: "icon-sm",
|
|
2858
3036
|
"aria-label": "Preview question",
|
|
2859
3037
|
onClick: onPreview,
|
|
2860
|
-
children: /* @__PURE__ */
|
|
3038
|
+
children: /* @__PURE__ */ jsx44(Eye, { size: 16, "aria-hidden": true })
|
|
2861
3039
|
}
|
|
2862
3040
|
)
|
|
2863
3041
|
] })
|
|
@@ -2865,18 +3043,18 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2865
3043
|
),
|
|
2866
3044
|
children
|
|
2867
3045
|
] }),
|
|
2868
|
-
error && /* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
3046
|
+
error && /* @__PURE__ */ jsxs31("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3047
|
+
/* @__PURE__ */ jsx44(Warning2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
2870
3048
|
error
|
|
2871
3049
|
] }),
|
|
2872
|
-
footer && /* @__PURE__ */
|
|
2873
|
-
/* @__PURE__ */
|
|
2874
|
-
/* @__PURE__ */
|
|
2875
|
-
onAdd && /* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
3050
|
+
footer && /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
|
|
3051
|
+
/* @__PURE__ */ jsx44("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3052
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
3053
|
+
onAdd && /* @__PURE__ */ jsxs31(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3054
|
+
/* @__PURE__ */ jsx44(Plus3, { size: 16, "aria-hidden": true }),
|
|
2877
3055
|
"Add choice"
|
|
2878
3056
|
] }),
|
|
2879
|
-
onPaste && /* @__PURE__ */
|
|
3057
|
+
onPaste && /* @__PURE__ */ jsx44(
|
|
2880
3058
|
Button,
|
|
2881
3059
|
{
|
|
2882
3060
|
type: "button",
|
|
@@ -2884,17 +3062,17 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2884
3062
|
size: "icon",
|
|
2885
3063
|
"aria-label": "Paste choices",
|
|
2886
3064
|
onClick: onPaste,
|
|
2887
|
-
children: /* @__PURE__ */
|
|
3065
|
+
children: /* @__PURE__ */ jsx44(Clipboard, { size: 16, "aria-hidden": true })
|
|
2888
3066
|
}
|
|
2889
3067
|
)
|
|
2890
3068
|
] })
|
|
2891
3069
|
] })
|
|
2892
3070
|
] }),
|
|
2893
|
-
note && /* @__PURE__ */
|
|
3071
|
+
note && /* @__PURE__ */ jsx44("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
2894
3072
|
]
|
|
2895
3073
|
}
|
|
2896
3074
|
),
|
|
2897
|
-
onAskAi && /* @__PURE__ */
|
|
3075
|
+
onAskAi && /* @__PURE__ */ jsx44(
|
|
2898
3076
|
Button,
|
|
2899
3077
|
{
|
|
2900
3078
|
type: "button",
|
|
@@ -2903,7 +3081,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2903
3081
|
"aria-label": "Ask AI",
|
|
2904
3082
|
onClick: onAskAi,
|
|
2905
3083
|
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__ */
|
|
3084
|
+
children: /* @__PURE__ */ jsx44(Sparkle2, { size: 16, "aria-hidden": true })
|
|
2907
3085
|
}
|
|
2908
3086
|
)
|
|
2909
3087
|
]
|
|
@@ -2914,34 +3092,14 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2914
3092
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
2915
3093
|
|
|
2916
3094
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
2917
|
-
import * as
|
|
3095
|
+
import * as React44 from "react";
|
|
2918
3096
|
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3 } from "@phosphor-icons/react";
|
|
2919
3097
|
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(
|
|
3098
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3099
|
+
var QuestionNavItem = React44.forwardRef(
|
|
2942
3100
|
({ className, questionType = "select-one", selected, error, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
2943
3101
|
const Comp = asChild ? Slot3.Root : "button";
|
|
2944
|
-
return /* @__PURE__ */
|
|
3102
|
+
return /* @__PURE__ */ jsxs32(
|
|
2945
3103
|
Comp,
|
|
2946
3104
|
{
|
|
2947
3105
|
ref,
|
|
@@ -2960,9 +3118,9 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2960
3118
|
),
|
|
2961
3119
|
...props,
|
|
2962
3120
|
children: [
|
|
2963
|
-
/* @__PURE__ */
|
|
2964
|
-
showDragHandle && /* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
3121
|
+
/* @__PURE__ */ jsxs32("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3122
|
+
showDragHandle && /* @__PURE__ */ jsx45(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3123
|
+
/* @__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
3124
|
QuestionTypeIcon,
|
|
2967
3125
|
{
|
|
2968
3126
|
type: questionType,
|
|
@@ -2971,8 +3129,8 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2971
3129
|
}
|
|
2972
3130
|
) })
|
|
2973
3131
|
] }),
|
|
2974
|
-
/* @__PURE__ */
|
|
2975
|
-
error && /* @__PURE__ */
|
|
3132
|
+
/* @__PURE__ */ jsx45("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3133
|
+
error && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: ", has errors" })
|
|
2976
3134
|
]
|
|
2977
3135
|
}
|
|
2978
3136
|
);
|
|
@@ -2981,14 +3139,14 @@ var QuestionNavItem = React43.forwardRef(
|
|
|
2981
3139
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
2982
3140
|
|
|
2983
3141
|
// 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
|
|
3142
|
+
import * as React45 from "react";
|
|
3143
|
+
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle4 } from "@phosphor-icons/react";
|
|
3144
|
+
import { Fragment as Fragment10, jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2987
3145
|
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
3146
|
function QuestionOption(props) {
|
|
2989
|
-
const id =
|
|
2990
|
-
return /* @__PURE__ */
|
|
2991
|
-
props.kind === "checkbox" ? /* @__PURE__ */
|
|
3147
|
+
const id = React45.useId();
|
|
3148
|
+
return /* @__PURE__ */ jsxs33("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3149
|
+
props.kind === "checkbox" ? /* @__PURE__ */ jsx46(
|
|
2992
3150
|
Checkbox,
|
|
2993
3151
|
{
|
|
2994
3152
|
id,
|
|
@@ -2997,16 +3155,16 @@ function QuestionOption(props) {
|
|
|
2997
3155
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
2998
3156
|
disabled: props.disabled
|
|
2999
3157
|
}
|
|
3000
|
-
) : /* @__PURE__ */
|
|
3001
|
-
/* @__PURE__ */
|
|
3158
|
+
) : /* @__PURE__ */ jsx46(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3159
|
+
/* @__PURE__ */ jsx46("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3002
3160
|
] });
|
|
3003
3161
|
}
|
|
3004
|
-
var QuestionOtherOption =
|
|
3162
|
+
var QuestionOtherOption = React45.forwardRef(
|
|
3005
3163
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3006
|
-
const inner =
|
|
3007
|
-
|
|
3164
|
+
const inner = React45.useRef(null);
|
|
3165
|
+
React45.useImperativeHandle(ref, () => inner.current);
|
|
3008
3166
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3009
|
-
return /* @__PURE__ */
|
|
3167
|
+
return /* @__PURE__ */ jsxs33(
|
|
3010
3168
|
"div",
|
|
3011
3169
|
{
|
|
3012
3170
|
className: cn(
|
|
@@ -3014,7 +3172,7 @@ var QuestionOtherOption = React44.forwardRef(
|
|
|
3014
3172
|
className
|
|
3015
3173
|
),
|
|
3016
3174
|
children: [
|
|
3017
|
-
/* @__PURE__ */
|
|
3175
|
+
/* @__PURE__ */ jsx46(
|
|
3018
3176
|
"input",
|
|
3019
3177
|
{
|
|
3020
3178
|
ref: inner,
|
|
@@ -3030,7 +3188,7 @@ var QuestionOtherOption = React44.forwardRef(
|
|
|
3030
3188
|
...props
|
|
3031
3189
|
}
|
|
3032
3190
|
),
|
|
3033
|
-
/* @__PURE__ */
|
|
3191
|
+
/* @__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
3192
|
]
|
|
3035
3193
|
}
|
|
3036
3194
|
);
|
|
@@ -3042,14 +3200,16 @@ function limitsText2(min, max) {
|
|
|
3042
3200
|
if (max !== void 0) return `Up to ${max} characters`;
|
|
3043
3201
|
return "";
|
|
3044
3202
|
}
|
|
3045
|
-
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked }) {
|
|
3203
|
+
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3046
3204
|
const reveal = kind !== void 0;
|
|
3047
3205
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3048
|
-
const [draft, setDraft] =
|
|
3049
|
-
const [error, setError] =
|
|
3050
|
-
const helperId =
|
|
3051
|
-
const
|
|
3052
|
-
const
|
|
3206
|
+
const [draft, setDraft] = React45.useState(null);
|
|
3207
|
+
const [error, setError] = React45.useState(null);
|
|
3208
|
+
const helperId = React45.useId();
|
|
3209
|
+
const [focused, setFocused] = React45.useState(false);
|
|
3210
|
+
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3211
|
+
const fieldRef = React45.useRef(null);
|
|
3212
|
+
const skipBlur = React45.useRef(false);
|
|
3053
3213
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3054
3214
|
const save = () => {
|
|
3055
3215
|
if (draft === null) return true;
|
|
@@ -3070,9 +3230,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3070
3230
|
...dragHandleProps,
|
|
3071
3231
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3072
3232
|
} : { "aria-hidden": true };
|
|
3073
|
-
const grip = dragHandleProps ? /* @__PURE__ */
|
|
3074
|
-
return /* @__PURE__ */
|
|
3075
|
-
/* @__PURE__ */
|
|
3233
|
+
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" });
|
|
3234
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3235
|
+
/* @__PURE__ */ jsx46(
|
|
3076
3236
|
"div",
|
|
3077
3237
|
{
|
|
3078
3238
|
className: cn(
|
|
@@ -3082,10 +3242,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3082
3242
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3083
3243
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3084
3244
|
),
|
|
3085
|
-
children: /* @__PURE__ */
|
|
3086
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */
|
|
3245
|
+
children: /* @__PURE__ */ jsxs33("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3246
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ jsx46("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ jsxs33(Fragment10, { children: [
|
|
3087
3247
|
!locked && grip,
|
|
3088
|
-
/* @__PURE__ */
|
|
3248
|
+
/* @__PURE__ */ jsx46(
|
|
3089
3249
|
"span",
|
|
3090
3250
|
{
|
|
3091
3251
|
"aria-hidden": "true",
|
|
@@ -3093,8 +3253,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3093
3253
|
children: rank
|
|
3094
3254
|
}
|
|
3095
3255
|
)
|
|
3096
|
-
] }) : reveal && locked ? /* @__PURE__ */
|
|
3097
|
-
/* @__PURE__ */
|
|
3256
|
+
] }) : 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: [
|
|
3257
|
+
/* @__PURE__ */ jsx46(
|
|
3098
3258
|
"span",
|
|
3099
3259
|
{
|
|
3100
3260
|
"aria-hidden": "true",
|
|
@@ -3105,7 +3265,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3105
3265
|
)
|
|
3106
3266
|
}
|
|
3107
3267
|
),
|
|
3108
|
-
/* @__PURE__ */
|
|
3268
|
+
/* @__PURE__ */ jsx46(
|
|
3109
3269
|
DotsSixVertical3,
|
|
3110
3270
|
{
|
|
3111
3271
|
size: 20,
|
|
@@ -3117,67 +3277,76 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3117
3277
|
}
|
|
3118
3278
|
)
|
|
3119
3279
|
] }) : 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()) {
|
|
3280
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3281
|
+
/* @__PURE__ */ jsxs33("div", { className: "relative min-w-0", children: [
|
|
3282
|
+
/* @__PURE__ */ jsx46(
|
|
3283
|
+
"input",
|
|
3284
|
+
{
|
|
3285
|
+
ref: fieldRef,
|
|
3286
|
+
"aria-label": "Option label",
|
|
3287
|
+
"aria-invalid": error ? true : void 0,
|
|
3288
|
+
"aria-describedby": guarded && draft !== null ? helperId : void 0,
|
|
3289
|
+
placeholder,
|
|
3290
|
+
maxLength,
|
|
3291
|
+
value: guarded ? draft ?? label : label,
|
|
3292
|
+
onFocus: () => {
|
|
3293
|
+
setFocused(true);
|
|
3294
|
+
if (guarded && draft === null) setDraft(label);
|
|
3295
|
+
},
|
|
3296
|
+
onChange: (event) => {
|
|
3297
|
+
if (!guarded) return onLabelChange?.(event.target.value);
|
|
3298
|
+
setDraft(event.target.value);
|
|
3299
|
+
if (error) setError(problemWith(event.target.value));
|
|
3300
|
+
},
|
|
3301
|
+
onKeyDown: (event) => {
|
|
3302
|
+
if (!guarded) return;
|
|
3303
|
+
if (event.key === "Escape") {
|
|
3149
3304
|
skipBlur.current = true;
|
|
3305
|
+
setDraft(null);
|
|
3306
|
+
setError(null);
|
|
3150
3307
|
fieldRef.current?.blur();
|
|
3308
|
+
} else if (event.key === "Enter") {
|
|
3309
|
+
event.preventDefault();
|
|
3310
|
+
if (save()) {
|
|
3311
|
+
skipBlur.current = true;
|
|
3312
|
+
fieldRef.current?.blur();
|
|
3313
|
+
}
|
|
3151
3314
|
}
|
|
3152
|
-
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3315
|
+
},
|
|
3316
|
+
onBlur: () => {
|
|
3317
|
+
setFocused(false);
|
|
3318
|
+
if (!guarded) return;
|
|
3319
|
+
if (skipBlur.current) {
|
|
3320
|
+
skipBlur.current = false;
|
|
3321
|
+
return;
|
|
3322
|
+
}
|
|
3323
|
+
save();
|
|
3324
|
+
},
|
|
3325
|
+
className: cn(
|
|
3326
|
+
"w-full min-w-0 bg-transparent text-body-base text-surface-foreground outline-none",
|
|
3327
|
+
placeholderTone === "regular" ? "placeholder:text-surface-foreground" : "placeholder:text-muted-foreground",
|
|
3328
|
+
// The marked text is drawn over the field, so the field's own letters step aside until it is edited.
|
|
3329
|
+
showMarks && "text-transparent"
|
|
3330
|
+
)
|
|
3331
|
+
}
|
|
3332
|
+
),
|
|
3333
|
+
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(
|
|
3334
|
+
(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)
|
|
3335
|
+
) })
|
|
3336
|
+
] }),
|
|
3337
|
+
guarded && draft !== null && /* @__PURE__ */ jsxs33(
|
|
3169
3338
|
"p",
|
|
3170
3339
|
{
|
|
3171
3340
|
id: helperId,
|
|
3172
3341
|
role: error ? "alert" : void 0,
|
|
3173
3342
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3174
3343
|
children: [
|
|
3175
|
-
/* @__PURE__ */
|
|
3176
|
-
error && /* @__PURE__ */
|
|
3344
|
+
/* @__PURE__ */ jsxs33("span", { className: "flex items-start gap-2", children: [
|
|
3345
|
+
error && /* @__PURE__ */ jsx46(WarningCircle4, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3177
3346
|
limitsText2(minLength, maxLength),
|
|
3178
|
-
error && /* @__PURE__ */
|
|
3347
|
+
error && /* @__PURE__ */ jsx46("span", { className: "sr-only", children: error })
|
|
3179
3348
|
] }),
|
|
3180
|
-
/* @__PURE__ */
|
|
3349
|
+
/* @__PURE__ */ jsxs33("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3181
3350
|
draft.length,
|
|
3182
3351
|
maxLength !== void 0 && `/${maxLength}`
|
|
3183
3352
|
] })
|
|
@@ -3188,7 +3357,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3188
3357
|
] })
|
|
3189
3358
|
}
|
|
3190
3359
|
),
|
|
3191
|
-
!locked && /* @__PURE__ */
|
|
3360
|
+
!locked && /* @__PURE__ */ jsxs33(
|
|
3192
3361
|
"div",
|
|
3193
3362
|
{
|
|
3194
3363
|
className: cn(
|
|
@@ -3196,8 +3365,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3196
3365
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3197
3366
|
),
|
|
3198
3367
|
children: [
|
|
3199
|
-
/* @__PURE__ */
|
|
3200
|
-
/* @__PURE__ */
|
|
3368
|
+
/* @__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 }) }),
|
|
3369
|
+
/* @__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
3370
|
]
|
|
3202
3371
|
}
|
|
3203
3372
|
)
|
|
@@ -3205,9 +3374,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3205
3374
|
}
|
|
3206
3375
|
|
|
3207
3376
|
// src/components/Question Types/RankList.tsx
|
|
3208
|
-
import * as
|
|
3377
|
+
import * as React46 from "react";
|
|
3209
3378
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
3210
|
-
import { Fragment as
|
|
3379
|
+
import { Fragment as Fragment11, jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3211
3380
|
function move(list, from, to) {
|
|
3212
3381
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3213
3382
|
const next = list.slice();
|
|
@@ -3215,13 +3384,13 @@ function move(list, from, to) {
|
|
|
3215
3384
|
next.splice(to, 0, item);
|
|
3216
3385
|
return next;
|
|
3217
3386
|
}
|
|
3218
|
-
var RankList =
|
|
3387
|
+
var RankList = React46.forwardRef(
|
|
3219
3388
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3220
|
-
const [dragIndex, setDragIndex] =
|
|
3221
|
-
const [announcement, setAnnouncement] =
|
|
3222
|
-
const handles =
|
|
3223
|
-
const refocus =
|
|
3224
|
-
|
|
3389
|
+
const [dragIndex, setDragIndex] = React46.useState(null);
|
|
3390
|
+
const [announcement, setAnnouncement] = React46.useState("");
|
|
3391
|
+
const handles = React46.useRef(/* @__PURE__ */ new Map());
|
|
3392
|
+
const refocus = React46.useRef(null);
|
|
3393
|
+
React46.useEffect(() => {
|
|
3225
3394
|
if (refocus.current) {
|
|
3226
3395
|
handles.current.get(refocus.current)?.focus();
|
|
3227
3396
|
refocus.current = null;
|
|
@@ -3234,8 +3403,8 @@ var RankList = React45.forwardRef(
|
|
|
3234
3403
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3235
3404
|
onItemsChange(next);
|
|
3236
3405
|
};
|
|
3237
|
-
return /* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3406
|
+
return /* @__PURE__ */ jsxs34(Fragment11, { children: [
|
|
3407
|
+
/* @__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
3408
|
"li",
|
|
3240
3409
|
{
|
|
3241
3410
|
draggable: true,
|
|
@@ -3252,7 +3421,7 @@ var RankList = React45.forwardRef(
|
|
|
3252
3421
|
dragIndex === index && "opacity-50"
|
|
3253
3422
|
),
|
|
3254
3423
|
children: [
|
|
3255
|
-
/* @__PURE__ */
|
|
3424
|
+
/* @__PURE__ */ jsx47(
|
|
3256
3425
|
"button",
|
|
3257
3426
|
{
|
|
3258
3427
|
type: "button",
|
|
@@ -3271,10 +3440,10 @@ var RankList = React45.forwardRef(
|
|
|
3271
3440
|
}
|
|
3272
3441
|
},
|
|
3273
3442
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3274
|
-
children: /* @__PURE__ */
|
|
3443
|
+
children: /* @__PURE__ */ jsx47(DotsSixVertical4, { size: 16, "aria-hidden": true })
|
|
3275
3444
|
}
|
|
3276
3445
|
),
|
|
3277
|
-
/* @__PURE__ */
|
|
3446
|
+
/* @__PURE__ */ jsx47(
|
|
3278
3447
|
"span",
|
|
3279
3448
|
{
|
|
3280
3449
|
"aria-hidden": "true",
|
|
@@ -3282,27 +3451,27 @@ var RankList = React45.forwardRef(
|
|
|
3282
3451
|
children: index + 1
|
|
3283
3452
|
}
|
|
3284
3453
|
),
|
|
3285
|
-
/* @__PURE__ */
|
|
3454
|
+
/* @__PURE__ */ jsx47("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3286
3455
|
]
|
|
3287
3456
|
},
|
|
3288
3457
|
item.id
|
|
3289
3458
|
)) }),
|
|
3290
|
-
/* @__PURE__ */
|
|
3459
|
+
/* @__PURE__ */ jsx47("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3291
3460
|
] });
|
|
3292
3461
|
}
|
|
3293
3462
|
);
|
|
3294
3463
|
RankList.displayName = "RankList";
|
|
3295
3464
|
|
|
3296
3465
|
// src/components/Question Types/RatingScale.tsx
|
|
3297
|
-
import * as
|
|
3466
|
+
import * as React47 from "react";
|
|
3298
3467
|
import { ToggleGroup as ToggleGroupPrimitive3 } from "radix-ui";
|
|
3299
|
-
import { jsx as
|
|
3300
|
-
var RatingScale =
|
|
3468
|
+
import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3469
|
+
var RatingScale = React47.forwardRef(
|
|
3301
3470
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3302
|
-
const [internal, setInternal] =
|
|
3471
|
+
const [internal, setInternal] = React47.useState(defaultValue);
|
|
3303
3472
|
const current = value !== void 0 ? value : internal;
|
|
3304
|
-
return /* @__PURE__ */
|
|
3305
|
-
/* @__PURE__ */
|
|
3473
|
+
return /* @__PURE__ */ jsxs35("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3474
|
+
/* @__PURE__ */ jsx48(
|
|
3306
3475
|
ToggleGroupPrimitive3.Root,
|
|
3307
3476
|
{
|
|
3308
3477
|
ref,
|
|
@@ -3315,7 +3484,7 @@ var RatingScale = React46.forwardRef(
|
|
|
3315
3484
|
},
|
|
3316
3485
|
className: "flex gap-2",
|
|
3317
3486
|
...props,
|
|
3318
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */
|
|
3487
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsx48(
|
|
3319
3488
|
ToggleGroupPrimitive3.Item,
|
|
3320
3489
|
{
|
|
3321
3490
|
value: String(n),
|
|
@@ -3331,9 +3500,9 @@ var RatingScale = React46.forwardRef(
|
|
|
3331
3500
|
))
|
|
3332
3501
|
}
|
|
3333
3502
|
),
|
|
3334
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3336
|
-
/* @__PURE__ */
|
|
3503
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ jsxs35("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3504
|
+
/* @__PURE__ */ jsx48("span", { children: lowLabel }),
|
|
3505
|
+
/* @__PURE__ */ jsx48("span", { children: highLabel })
|
|
3337
3506
|
] })
|
|
3338
3507
|
] });
|
|
3339
3508
|
}
|
|
@@ -3341,12 +3510,12 @@ var RatingScale = React46.forwardRef(
|
|
|
3341
3510
|
RatingScale.displayName = "RatingScale";
|
|
3342
3511
|
|
|
3343
3512
|
// src/components/Question Types/StimulusCard.tsx
|
|
3344
|
-
import * as
|
|
3345
|
-
import { Image as ImageIcon2, ImageBroken, Trash as
|
|
3346
|
-
import { jsx as
|
|
3513
|
+
import * as React48 from "react";
|
|
3514
|
+
import { Image as ImageIcon2, ImageBroken, Trash as Trash6 } from "@phosphor-icons/react";
|
|
3515
|
+
import { jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3347
3516
|
var MIN_THUMBNAIL = 92;
|
|
3348
3517
|
var MAX_THUMBNAIL = 240;
|
|
3349
|
-
var StimulusCard =
|
|
3518
|
+
var StimulusCard = React48.forwardRef(
|
|
3350
3519
|
({
|
|
3351
3520
|
className,
|
|
3352
3521
|
thumbnail,
|
|
@@ -3363,14 +3532,14 @@ var StimulusCard = React47.forwardRef(
|
|
|
3363
3532
|
removeLabel = "Remove stimulus",
|
|
3364
3533
|
...props
|
|
3365
3534
|
}, ref) => {
|
|
3366
|
-
const [failedSrc, setFailedSrc] =
|
|
3535
|
+
const [failedSrc, setFailedSrc] = React48.useState();
|
|
3367
3536
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3368
3537
|
const showImage = thumbnail !== void 0 && !error;
|
|
3369
|
-
const [draft, setDraft] =
|
|
3538
|
+
const [draft, setDraft] = React48.useState(null);
|
|
3370
3539
|
const count = (draft ?? caption ?? "").length;
|
|
3371
|
-
const textRef =
|
|
3372
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3373
|
-
|
|
3540
|
+
const textRef = React48.useRef(null);
|
|
3541
|
+
const [thumbnailSize, setThumbnailSize] = React48.useState(MIN_THUMBNAIL);
|
|
3542
|
+
React48.useEffect(() => {
|
|
3374
3543
|
const el = textRef.current;
|
|
3375
3544
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3376
3545
|
const observer = new ResizeObserver(() => {
|
|
@@ -3379,7 +3548,7 @@ var StimulusCard = React47.forwardRef(
|
|
|
3379
3548
|
observer.observe(el);
|
|
3380
3549
|
return () => observer.disconnect();
|
|
3381
3550
|
}, []);
|
|
3382
|
-
return /* @__PURE__ */
|
|
3551
|
+
return /* @__PURE__ */ jsxs36(
|
|
3383
3552
|
"div",
|
|
3384
3553
|
{
|
|
3385
3554
|
ref,
|
|
@@ -3387,8 +3556,8 @@ var StimulusCard = React47.forwardRef(
|
|
|
3387
3556
|
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
3557
|
...props,
|
|
3389
3558
|
children: [
|
|
3390
|
-
/* @__PURE__ */
|
|
3391
|
-
/* @__PURE__ */
|
|
3559
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3560
|
+
/* @__PURE__ */ jsx49(
|
|
3392
3561
|
"span",
|
|
3393
3562
|
{
|
|
3394
3563
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3399,13 +3568,13 @@ var StimulusCard = React47.forwardRef(
|
|
|
3399
3568
|
),
|
|
3400
3569
|
children: showImage ? (
|
|
3401
3570
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3402
|
-
/* @__PURE__ */
|
|
3403
|
-
) : error ? /* @__PURE__ */
|
|
3571
|
+
/* @__PURE__ */ jsx49("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) })
|
|
3572
|
+
) : error ? /* @__PURE__ */ jsx49(ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ jsx49(ImageIcon2, { size: 24, "aria-hidden": true })
|
|
3404
3573
|
}
|
|
3405
3574
|
),
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
onCaptionChange ? /* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ jsxs36("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
3576
|
+
/* @__PURE__ */ jsx49("p", { className: "w-full text-ui-label", children: label }),
|
|
3577
|
+
onCaptionChange ? /* @__PURE__ */ jsx49(
|
|
3409
3578
|
InlineEdit,
|
|
3410
3579
|
{
|
|
3411
3580
|
variant: "question",
|
|
@@ -3422,8 +3591,8 @@ var StimulusCard = React47.forwardRef(
|
|
|
3422
3591
|
},
|
|
3423
3592
|
textClassName: "text-body-base"
|
|
3424
3593
|
}
|
|
3425
|
-
) : /* @__PURE__ */
|
|
3426
|
-
onCaptionChange && showCounter && maxLength !== void 0 && /* @__PURE__ */
|
|
3594
|
+
) : /* @__PURE__ */ jsx49("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
3595
|
+
onCaptionChange && showCounter && maxLength !== void 0 && /* @__PURE__ */ jsxs36("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3427
3596
|
count,
|
|
3428
3597
|
"/",
|
|
3429
3598
|
maxLength,
|
|
@@ -3431,7 +3600,7 @@ var StimulusCard = React47.forwardRef(
|
|
|
3431
3600
|
] })
|
|
3432
3601
|
] })
|
|
3433
3602
|
] }),
|
|
3434
|
-
onRemove && /* @__PURE__ */
|
|
3603
|
+
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
3604
|
]
|
|
3436
3605
|
}
|
|
3437
3606
|
);
|
|
@@ -3440,27 +3609,27 @@ var StimulusCard = React47.forwardRef(
|
|
|
3440
3609
|
StimulusCard.displayName = "StimulusCard";
|
|
3441
3610
|
|
|
3442
3611
|
// src/components/Data Display/Progress.tsx
|
|
3443
|
-
import * as
|
|
3612
|
+
import * as React49 from "react";
|
|
3444
3613
|
import { Progress as ProgressPrimitive2 } from "radix-ui";
|
|
3445
|
-
import { jsx as
|
|
3446
|
-
var Progress =
|
|
3614
|
+
import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3615
|
+
var Progress = React49.forwardRef(
|
|
3447
3616
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3448
3617
|
const hasHeader = label != null || valueLabel != null;
|
|
3449
3618
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3450
3619
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3451
|
-
return /* @__PURE__ */
|
|
3452
|
-
hasHeader && /* @__PURE__ */
|
|
3453
|
-
/* @__PURE__ */
|
|
3454
|
-
/* @__PURE__ */
|
|
3620
|
+
return /* @__PURE__ */ jsxs37("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
3621
|
+
hasHeader && /* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
3622
|
+
/* @__PURE__ */ jsx50("span", { children: label }),
|
|
3623
|
+
/* @__PURE__ */ jsx50("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3455
3624
|
] }),
|
|
3456
|
-
/* @__PURE__ */
|
|
3625
|
+
/* @__PURE__ */ jsx50(
|
|
3457
3626
|
ProgressPrimitive2.Root,
|
|
3458
3627
|
{
|
|
3459
3628
|
ref,
|
|
3460
3629
|
value: clamped,
|
|
3461
3630
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3462
3631
|
...props,
|
|
3463
|
-
children: /* @__PURE__ */
|
|
3632
|
+
children: /* @__PURE__ */ jsx50(
|
|
3464
3633
|
ProgressPrimitive2.Indicator,
|
|
3465
3634
|
{
|
|
3466
3635
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3469,9 +3638,9 @@ var Progress = React48.forwardRef(
|
|
|
3469
3638
|
)
|
|
3470
3639
|
}
|
|
3471
3640
|
),
|
|
3472
|
-
hasDetails && /* @__PURE__ */
|
|
3473
|
-
/* @__PURE__ */
|
|
3474
|
-
/* @__PURE__ */
|
|
3641
|
+
hasDetails && /* @__PURE__ */ jsxs37("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3642
|
+
/* @__PURE__ */ jsx50("span", { children: detailsStart }),
|
|
3643
|
+
/* @__PURE__ */ jsx50("span", { children: detailsEnd })
|
|
3475
3644
|
] })
|
|
3476
3645
|
] });
|
|
3477
3646
|
}
|
|
@@ -3479,11 +3648,11 @@ var Progress = React48.forwardRef(
|
|
|
3479
3648
|
Progress.displayName = "Progress";
|
|
3480
3649
|
|
|
3481
3650
|
// src/components/Data Display/Table.tsx
|
|
3482
|
-
import * as
|
|
3651
|
+
import * as React50 from "react";
|
|
3483
3652
|
import { CaretDown as CaretDown4, CaretUp } from "@phosphor-icons/react";
|
|
3484
|
-
import { jsx as
|
|
3485
|
-
var Table =
|
|
3486
|
-
({ className, containerClassName, striped, ...props }, ref) => /* @__PURE__ */
|
|
3653
|
+
import { jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3654
|
+
var Table = React50.forwardRef(
|
|
3655
|
+
({ 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
3656
|
"table",
|
|
3488
3657
|
{
|
|
3489
3658
|
ref,
|
|
@@ -3494,16 +3663,16 @@ var Table = React49.forwardRef(
|
|
|
3494
3663
|
) })
|
|
3495
3664
|
);
|
|
3496
3665
|
Table.displayName = "Table";
|
|
3497
|
-
var TableHeader =
|
|
3498
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3666
|
+
var TableHeader = React50.forwardRef(
|
|
3667
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx51("thead", { ref, className, ...props })
|
|
3499
3668
|
);
|
|
3500
3669
|
TableHeader.displayName = "TableHeader";
|
|
3501
|
-
var TableBody =
|
|
3502
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3670
|
+
var TableBody = React50.forwardRef(
|
|
3671
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx51("tbody", { ref, className, ...props })
|
|
3503
3672
|
);
|
|
3504
3673
|
TableBody.displayName = "TableBody";
|
|
3505
|
-
var TableRow =
|
|
3506
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */
|
|
3674
|
+
var TableRow = React50.forwardRef(
|
|
3675
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ jsx51(
|
|
3507
3676
|
"tr",
|
|
3508
3677
|
{
|
|
3509
3678
|
ref,
|
|
@@ -3520,10 +3689,10 @@ var TableRow = React49.forwardRef(
|
|
|
3520
3689
|
);
|
|
3521
3690
|
TableRow.displayName = "TableRow";
|
|
3522
3691
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3523
|
-
var TableHead =
|
|
3692
|
+
var TableHead = React50.forwardRef(
|
|
3524
3693
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, children, ...props }, ref) => {
|
|
3525
|
-
const caret = sort === "asc" ? /* @__PURE__ */
|
|
3526
|
-
return /* @__PURE__ */
|
|
3694
|
+
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" });
|
|
3695
|
+
return /* @__PURE__ */ jsx51(
|
|
3527
3696
|
"th",
|
|
3528
3697
|
{
|
|
3529
3698
|
ref,
|
|
@@ -3536,7 +3705,7 @@ var TableHead = React49.forwardRef(
|
|
|
3536
3705
|
className
|
|
3537
3706
|
),
|
|
3538
3707
|
...props,
|
|
3539
|
-
children: sortable ? /* @__PURE__ */
|
|
3708
|
+
children: sortable ? /* @__PURE__ */ jsxs38(
|
|
3540
3709
|
"button",
|
|
3541
3710
|
{
|
|
3542
3711
|
type: "button",
|
|
@@ -3547,14 +3716,14 @@ var TableHead = React49.forwardRef(
|
|
|
3547
3716
|
caret
|
|
3548
3717
|
]
|
|
3549
3718
|
}
|
|
3550
|
-
) : checkbox ? /* @__PURE__ */
|
|
3719
|
+
) : checkbox ? /* @__PURE__ */ jsx51("div", { className: "flex items-center justify-center", children }) : children
|
|
3551
3720
|
}
|
|
3552
3721
|
);
|
|
3553
3722
|
}
|
|
3554
3723
|
);
|
|
3555
3724
|
TableHead.displayName = "TableHead";
|
|
3556
|
-
var TableCell =
|
|
3557
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */
|
|
3725
|
+
var TableCell = React50.forwardRef(
|
|
3726
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ jsx51(
|
|
3558
3727
|
"td",
|
|
3559
3728
|
{
|
|
3560
3729
|
ref,
|
|
@@ -3567,25 +3736,25 @@ var TableCell = React49.forwardRef(
|
|
|
3567
3736
|
className
|
|
3568
3737
|
),
|
|
3569
3738
|
...props,
|
|
3570
|
-
children: checkbox ? /* @__PURE__ */
|
|
3739
|
+
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
3740
|
}
|
|
3572
3741
|
)
|
|
3573
3742
|
);
|
|
3574
3743
|
TableCell.displayName = "TableCell";
|
|
3575
3744
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
3576
|
-
return /* @__PURE__ */
|
|
3745
|
+
return /* @__PURE__ */ jsxs38("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
3577
3746
|
avatar,
|
|
3578
|
-
/* @__PURE__ */
|
|
3579
|
-
/* @__PURE__ */
|
|
3580
|
-
secondary && /* @__PURE__ */
|
|
3747
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
3748
|
+
/* @__PURE__ */ jsx51("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
3749
|
+
secondary && /* @__PURE__ */ jsx51("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
3581
3750
|
] })
|
|
3582
3751
|
] });
|
|
3583
3752
|
}
|
|
3584
3753
|
|
|
3585
3754
|
// src/components/Data Display/StatCard.tsx
|
|
3586
|
-
import * as
|
|
3755
|
+
import * as React51 from "react";
|
|
3587
3756
|
import { cva as cva6 } from "class-variance-authority";
|
|
3588
|
-
import { jsx as
|
|
3757
|
+
import { jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3589
3758
|
var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
3590
3759
|
variants: {
|
|
3591
3760
|
variant: {
|
|
@@ -3599,11 +3768,11 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
3599
3768
|
},
|
|
3600
3769
|
defaultVariants: { variant: "default" }
|
|
3601
3770
|
});
|
|
3602
|
-
var StatCard =
|
|
3603
|
-
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */
|
|
3604
|
-
/* @__PURE__ */
|
|
3605
|
-
/* @__PURE__ */
|
|
3606
|
-
icon && /* @__PURE__ */
|
|
3771
|
+
var StatCard = React51.forwardRef(
|
|
3772
|
+
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */ jsxs39("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
3773
|
+
/* @__PURE__ */ jsx52("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
3774
|
+
/* @__PURE__ */ jsxs39("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
3775
|
+
icon && /* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
3607
3776
|
value
|
|
3608
3777
|
] })
|
|
3609
3778
|
] })
|
|
@@ -3611,13 +3780,13 @@ var StatCard = React50.forwardRef(
|
|
|
3611
3780
|
StatCard.displayName = "StatCard";
|
|
3612
3781
|
|
|
3613
3782
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3614
|
-
import * as
|
|
3783
|
+
import * as React53 from "react";
|
|
3615
3784
|
|
|
3616
3785
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
3617
|
-
import * as
|
|
3786
|
+
import * as React52 from "react";
|
|
3618
3787
|
import { Crown, Plus as Plus5, X as X6 } from "@phosphor-icons/react";
|
|
3619
3788
|
import { cva as cva7 } from "class-variance-authority";
|
|
3620
|
-
import { jsx as
|
|
3789
|
+
import { jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3621
3790
|
var editableTagVariants = cva7(
|
|
3622
3791
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3623
3792
|
{
|
|
@@ -3632,27 +3801,27 @@ var editableTagVariants = cva7(
|
|
|
3632
3801
|
defaultVariants: { type: "default" }
|
|
3633
3802
|
}
|
|
3634
3803
|
);
|
|
3635
|
-
var EditableTag =
|
|
3804
|
+
var EditableTag = React52.forwardRef(
|
|
3636
3805
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
3637
3806
|
const classes = cn(editableTagVariants({ type }), className);
|
|
3638
|
-
const leading = type === "add" ? /* @__PURE__ */
|
|
3807
|
+
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
3808
|
if (type === "add" || type === "multiple" && onClick) {
|
|
3640
|
-
return /* @__PURE__ */
|
|
3809
|
+
return /* @__PURE__ */ jsxs40("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
3641
3810
|
leading,
|
|
3642
3811
|
children
|
|
3643
3812
|
] });
|
|
3644
3813
|
}
|
|
3645
|
-
return /* @__PURE__ */
|
|
3814
|
+
return /* @__PURE__ */ jsxs40("span", { ref, className: classes, ...props, children: [
|
|
3646
3815
|
leading,
|
|
3647
3816
|
children,
|
|
3648
|
-
onRemove && /* @__PURE__ */
|
|
3817
|
+
onRemove && /* @__PURE__ */ jsx53(
|
|
3649
3818
|
"button",
|
|
3650
3819
|
{
|
|
3651
3820
|
type: "button",
|
|
3652
3821
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
3653
3822
|
onClick: onRemove,
|
|
3654
3823
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
3655
|
-
children: /* @__PURE__ */
|
|
3824
|
+
children: /* @__PURE__ */ jsx53(X6, { size: 12, "aria-hidden": true })
|
|
3656
3825
|
}
|
|
3657
3826
|
)
|
|
3658
3827
|
] });
|
|
@@ -3661,26 +3830,26 @@ var EditableTag = React51.forwardRef(
|
|
|
3661
3830
|
EditableTag.displayName = "EditableTag";
|
|
3662
3831
|
|
|
3663
3832
|
// 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__ */
|
|
3833
|
+
import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
3834
|
+
var ActivityStructure = React53.forwardRef(
|
|
3835
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ jsxs41(
|
|
3667
3836
|
"section",
|
|
3668
3837
|
{
|
|
3669
3838
|
ref,
|
|
3670
3839
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
3671
3840
|
...props,
|
|
3672
3841
|
children: [
|
|
3673
|
-
/* @__PURE__ */
|
|
3674
|
-
/* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ jsxs41("div", { className: "flex items-center justify-between gap-2", children: [
|
|
3843
|
+
/* @__PURE__ */ jsx54("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
3675
3844
|
action
|
|
3676
3845
|
] }),
|
|
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__ */
|
|
3846
|
+
stats.length > 0 && /* @__PURE__ */ jsx54("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx54(StatCard, { ...stat }, id)) }),
|
|
3847
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs41("div", { className: "flex flex-col gap-2", children: [
|
|
3848
|
+
/* @__PURE__ */ jsx54("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
3849
|
+
/* @__PURE__ */ jsx54("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
3850
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ jsxs41("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3851
|
+
tags?.map((tag) => /* @__PURE__ */ jsx54(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
3852
|
+
onAddTag && /* @__PURE__ */ jsx54(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
3684
3853
|
] })
|
|
3685
3854
|
] }, id)),
|
|
3686
3855
|
children
|
|
@@ -3691,10 +3860,10 @@ var ActivityStructure = React52.forwardRef(
|
|
|
3691
3860
|
ActivityStructure.displayName = "ActivityStructure";
|
|
3692
3861
|
|
|
3693
3862
|
// src/components/Tags & Badges/Badge.tsx
|
|
3694
|
-
import * as
|
|
3863
|
+
import * as React54 from "react";
|
|
3695
3864
|
import { DotsSixVertical as DotsSixVertical5, RadioButton as RadioButton2 } from "@phosphor-icons/react";
|
|
3696
3865
|
import { cva as cva8 } from "class-variance-authority";
|
|
3697
|
-
import { jsx as
|
|
3866
|
+
import { jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
3698
3867
|
var roleTagVariants = cva8(
|
|
3699
3868
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3700
3869
|
{
|
|
@@ -3720,11 +3889,11 @@ var roleTagVariants = cva8(
|
|
|
3720
3889
|
defaultVariants: { type: "primary", selected: false }
|
|
3721
3890
|
}
|
|
3722
3891
|
);
|
|
3723
|
-
var Badge =
|
|
3892
|
+
var Badge = React54.forwardRef(
|
|
3724
3893
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
3725
3894
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
3726
3895
|
if (type === "interactable") {
|
|
3727
|
-
return /* @__PURE__ */
|
|
3896
|
+
return /* @__PURE__ */ jsxs42(
|
|
3728
3897
|
"button",
|
|
3729
3898
|
{
|
|
3730
3899
|
ref,
|
|
@@ -3734,15 +3903,15 @@ var Badge = React53.forwardRef(
|
|
|
3734
3903
|
onClick,
|
|
3735
3904
|
...props,
|
|
3736
3905
|
children: [
|
|
3737
|
-
/* @__PURE__ */
|
|
3906
|
+
/* @__PURE__ */ jsx55(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
3738
3907
|
children
|
|
3739
3908
|
]
|
|
3740
3909
|
}
|
|
3741
3910
|
);
|
|
3742
3911
|
}
|
|
3743
|
-
return /* @__PURE__ */
|
|
3744
|
-
type === "question" && /* @__PURE__ */
|
|
3745
|
-
type === "id" && /* @__PURE__ */
|
|
3912
|
+
return /* @__PURE__ */ jsxs42("span", { ref, className: classes, ...props, children: [
|
|
3913
|
+
type === "question" && /* @__PURE__ */ jsx55(RadioButton2, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
3914
|
+
type === "id" && /* @__PURE__ */ jsx55("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
3746
3915
|
children
|
|
3747
3916
|
] });
|
|
3748
3917
|
}
|
|
@@ -3750,9 +3919,9 @@ var Badge = React53.forwardRef(
|
|
|
3750
3919
|
Badge.displayName = "Badge";
|
|
3751
3920
|
|
|
3752
3921
|
// src/components/Utility/Pagination.tsx
|
|
3753
|
-
import * as
|
|
3922
|
+
import * as React55 from "react";
|
|
3754
3923
|
import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
|
|
3755
|
-
import { jsx as
|
|
3924
|
+
import { jsx as jsx56, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
3756
3925
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
3757
3926
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
3758
3927
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -3766,10 +3935,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
3766
3935
|
});
|
|
3767
3936
|
return items;
|
|
3768
3937
|
}
|
|
3769
|
-
var Pagination =
|
|
3938
|
+
var Pagination = React55.forwardRef(
|
|
3770
3939
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
3771
3940
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
3772
|
-
const previous = /* @__PURE__ */
|
|
3941
|
+
const previous = /* @__PURE__ */ jsx56(
|
|
3773
3942
|
Button,
|
|
3774
3943
|
{
|
|
3775
3944
|
type: "button",
|
|
@@ -3778,10 +3947,10 @@ var Pagination = React54.forwardRef(
|
|
|
3778
3947
|
"aria-label": "Previous page",
|
|
3779
3948
|
disabled: page <= 1,
|
|
3780
3949
|
onClick: () => go(page - 1),
|
|
3781
|
-
children: /* @__PURE__ */
|
|
3950
|
+
children: /* @__PURE__ */ jsx56(ArrowLeft, { size: 16, "aria-hidden": true })
|
|
3782
3951
|
}
|
|
3783
3952
|
);
|
|
3784
|
-
const next = /* @__PURE__ */
|
|
3953
|
+
const next = /* @__PURE__ */ jsx56(
|
|
3785
3954
|
Button,
|
|
3786
3955
|
{
|
|
3787
3956
|
type: "button",
|
|
@@ -3790,10 +3959,10 @@ var Pagination = React54.forwardRef(
|
|
|
3790
3959
|
"aria-label": "Next page",
|
|
3791
3960
|
disabled: page >= pageCount,
|
|
3792
3961
|
onClick: () => go(page + 1),
|
|
3793
|
-
children: /* @__PURE__ */
|
|
3962
|
+
children: /* @__PURE__ */ jsx56(ArrowRight, { size: 16, "aria-hidden": true })
|
|
3794
3963
|
}
|
|
3795
3964
|
);
|
|
3796
|
-
return /* @__PURE__ */
|
|
3965
|
+
return /* @__PURE__ */ jsxs43(
|
|
3797
3966
|
"nav",
|
|
3798
3967
|
{
|
|
3799
3968
|
ref,
|
|
@@ -3802,14 +3971,14 @@ var Pagination = React54.forwardRef(
|
|
|
3802
3971
|
...props,
|
|
3803
3972
|
children: [
|
|
3804
3973
|
previous,
|
|
3805
|
-
variant === "compact" ? /* @__PURE__ */
|
|
3974
|
+
variant === "compact" ? /* @__PURE__ */ jsxs43("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
3806
3975
|
page,
|
|
3807
3976
|
"/",
|
|
3808
3977
|
pageCount
|
|
3809
|
-
] }) : /* @__PURE__ */
|
|
3810
|
-
/* @__PURE__ */
|
|
3811
|
-
/* @__PURE__ */
|
|
3812
|
-
] }) : /* @__PURE__ */
|
|
3978
|
+
] }) : /* @__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: [
|
|
3979
|
+
/* @__PURE__ */ jsx56(DotsThree2, { size: 16, "aria-hidden": true }),
|
|
3980
|
+
/* @__PURE__ */ jsx56("span", { className: "sr-only", children: "More pages" })
|
|
3981
|
+
] }) : /* @__PURE__ */ jsx56(
|
|
3813
3982
|
Button,
|
|
3814
3983
|
{
|
|
3815
3984
|
type: "button",
|