@discuss-ds/ui 0.1.0 → 0.3.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 +16 -0
- package/dist/index.cjs +547 -412
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -5
- package/dist/index.d.ts +40 -5
- package/dist/index.js +522 -388
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1362,18 +1362,138 @@ var FormMessage = React23.forwardRef(
|
|
|
1362
1362
|
);
|
|
1363
1363
|
FormMessage.displayName = "FormMessage";
|
|
1364
1364
|
|
|
1365
|
-
// src/components/Forms & Data Entry/
|
|
1365
|
+
// src/components/Forms & Data Entry/InlineEdit.tsx
|
|
1366
1366
|
import * as React24 from "react";
|
|
1367
|
-
import {
|
|
1367
|
+
import { PencilSimple } from "@phosphor-icons/react";
|
|
1368
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1369
|
+
var InlineEdit = React24.forwardRef(
|
|
1370
|
+
({
|
|
1371
|
+
className,
|
|
1372
|
+
textClassName,
|
|
1373
|
+
value: valueProp,
|
|
1374
|
+
defaultValue = "",
|
|
1375
|
+
onValueChange,
|
|
1376
|
+
placeholder = "Click to edit",
|
|
1377
|
+
multiline,
|
|
1378
|
+
maxLength,
|
|
1379
|
+
disabled,
|
|
1380
|
+
onEditingChange,
|
|
1381
|
+
onDraftChange,
|
|
1382
|
+
variant = "default",
|
|
1383
|
+
selected,
|
|
1384
|
+
"aria-label": ariaLabel,
|
|
1385
|
+
...props
|
|
1386
|
+
}, ref) => {
|
|
1387
|
+
const [internal, setInternal] = React24.useState(defaultValue);
|
|
1388
|
+
const value = valueProp ?? internal;
|
|
1389
|
+
const [editing, setEditing] = React24.useState(false);
|
|
1390
|
+
const [draft, setDraft] = React24.useState(value);
|
|
1391
|
+
const fieldRef = React24.useRef(null);
|
|
1392
|
+
const readRef = React24.useRef(null);
|
|
1393
|
+
const cancelled = React24.useRef(false);
|
|
1394
|
+
const restoreFocus = React24.useRef(false);
|
|
1395
|
+
React24.useEffect(() => {
|
|
1396
|
+
if (editing) {
|
|
1397
|
+
fieldRef.current?.focus();
|
|
1398
|
+
fieldRef.current?.select();
|
|
1399
|
+
} else if (restoreFocus.current) {
|
|
1400
|
+
restoreFocus.current = false;
|
|
1401
|
+
readRef.current?.focus();
|
|
1402
|
+
}
|
|
1403
|
+
}, [editing]);
|
|
1404
|
+
const start = () => {
|
|
1405
|
+
if (disabled) return;
|
|
1406
|
+
setDraft(value);
|
|
1407
|
+
cancelled.current = false;
|
|
1408
|
+
setEditing(true);
|
|
1409
|
+
onEditingChange?.(true);
|
|
1410
|
+
};
|
|
1411
|
+
const finish = (commit, refocus) => {
|
|
1412
|
+
restoreFocus.current = refocus;
|
|
1413
|
+
if (commit && draft !== value) {
|
|
1414
|
+
if (valueProp === void 0) setInternal(draft);
|
|
1415
|
+
onValueChange?.(draft);
|
|
1416
|
+
}
|
|
1417
|
+
setEditing(false);
|
|
1418
|
+
onEditingChange?.(false);
|
|
1419
|
+
onDraftChange?.(commit ? draft : value);
|
|
1420
|
+
};
|
|
1421
|
+
const textClasses = cn("text-ui-input-value text-surface-foreground", textClassName);
|
|
1422
|
+
const question = variant === "question";
|
|
1423
|
+
const fill = multiline || question;
|
|
1424
|
+
return /* @__PURE__ */ jsx25("div", { ref, className: cn(fill ? "flex w-full min-w-0" : "inline-flex min-w-0 max-w-full", className), ...props, children: editing ? React24.createElement(multiline ? "textarea" : "input", {
|
|
1425
|
+
ref: fieldRef,
|
|
1426
|
+
value: draft,
|
|
1427
|
+
maxLength,
|
|
1428
|
+
"aria-label": ariaLabel,
|
|
1429
|
+
...multiline ? { rows: 1 } : { type: "text" },
|
|
1430
|
+
className: cn(
|
|
1431
|
+
"w-full px-3 py-1 outline-none",
|
|
1432
|
+
multiline && "field-sizing-content resize-none",
|
|
1433
|
+
question ? "rounded-none border-0 border-b-2 border-input-accent bg-transparent" : cn("rounded-md focus-visible:border-input-accent", fieldSurfaceClasses("default")),
|
|
1434
|
+
textClasses
|
|
1435
|
+
),
|
|
1436
|
+
onChange: (event) => {
|
|
1437
|
+
setDraft(event.target.value);
|
|
1438
|
+
onDraftChange?.(event.target.value);
|
|
1439
|
+
},
|
|
1440
|
+
onKeyDown: (event) => {
|
|
1441
|
+
if (event.key === "Escape") {
|
|
1442
|
+
cancelled.current = true;
|
|
1443
|
+
finish(false, true);
|
|
1444
|
+
} else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || question && !event.shiftKey)) {
|
|
1445
|
+
event.preventDefault();
|
|
1446
|
+
finish(true, true);
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
onBlur: () => {
|
|
1450
|
+
if (!cancelled.current) finish(true, false);
|
|
1451
|
+
}
|
|
1452
|
+
}) : /* @__PURE__ */ jsxs16(
|
|
1453
|
+
"button",
|
|
1454
|
+
{
|
|
1455
|
+
ref: readRef,
|
|
1456
|
+
type: "button",
|
|
1457
|
+
disabled,
|
|
1458
|
+
"aria-label": `${ariaLabel}: ${value || placeholder}. Edit`,
|
|
1459
|
+
onClick: start,
|
|
1460
|
+
className: cn(
|
|
1461
|
+
"group inline-flex min-w-0 max-w-full items-center gap-2 px-3 py-1 text-left outline-none",
|
|
1462
|
+
fill && "w-full",
|
|
1463
|
+
question ? cn("rounded-none border-b-2", selected ? "border-input-accent" : "border-transparent") : "rounded-md border border-transparent",
|
|
1464
|
+
"enabled:hover:bg-secondary enabled:focus-visible:border-input-accent disabled:cursor-not-allowed disabled:opacity-50",
|
|
1465
|
+
question && "enabled:hover:border-input-accent",
|
|
1466
|
+
textClasses
|
|
1467
|
+
),
|
|
1468
|
+
children: [
|
|
1469
|
+
/* @__PURE__ */ jsx25("span", { className: cn("min-w-0", multiline ? "whitespace-pre-wrap" : "truncate", fill && "flex-1", !value && "text-muted-foreground"), children: value || placeholder }),
|
|
1470
|
+
!fill && /* @__PURE__ */ jsx25(
|
|
1471
|
+
PencilSimple,
|
|
1472
|
+
{
|
|
1473
|
+
size: 16,
|
|
1474
|
+
"aria-hidden": true,
|
|
1475
|
+
className: "shrink-0 text-secondary-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
|
|
1476
|
+
}
|
|
1477
|
+
)
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
) });
|
|
1481
|
+
}
|
|
1482
|
+
);
|
|
1483
|
+
InlineEdit.displayName = "InlineEdit";
|
|
1484
|
+
|
|
1485
|
+
// src/components/Forms & Data Entry/Input.tsx
|
|
1486
|
+
import * as React25 from "react";
|
|
1487
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1368
1488
|
var inputClasses = (status, className) => cn(
|
|
1369
1489
|
"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",
|
|
1370
1490
|
fieldSurfaceClasses(status),
|
|
1371
1491
|
className
|
|
1372
1492
|
);
|
|
1373
|
-
var Input =
|
|
1493
|
+
var Input = React25.forwardRef(
|
|
1374
1494
|
({ className, status = "default", label, description, message, id, ...props }, ref) => {
|
|
1375
1495
|
if (label == null && description == null && message == null) {
|
|
1376
|
-
return /* @__PURE__ */
|
|
1496
|
+
return /* @__PURE__ */ jsx26(
|
|
1377
1497
|
"input",
|
|
1378
1498
|
{
|
|
1379
1499
|
ref,
|
|
@@ -1384,16 +1504,16 @@ var Input = React24.forwardRef(
|
|
|
1384
1504
|
}
|
|
1385
1505
|
);
|
|
1386
1506
|
}
|
|
1387
|
-
return /* @__PURE__ */
|
|
1507
|
+
return /* @__PURE__ */ jsx26(Field, { label, description, message, status, id, children: (control) => /* @__PURE__ */ jsx26("input", { ref, className: inputClasses(status, className), ...control, ...props }) });
|
|
1388
1508
|
}
|
|
1389
1509
|
);
|
|
1390
1510
|
Input.displayName = "Input";
|
|
1391
1511
|
|
|
1392
1512
|
// src/components/Forms & Data Entry/InputWithAction.tsx
|
|
1393
|
-
import * as
|
|
1394
|
-
import { jsx as
|
|
1395
|
-
var InputWithAction =
|
|
1396
|
-
({ className, actionLabel, onAction, tags, status = "default", label, description, message, id, disabled, placeholder, ...props }, ref) => /* @__PURE__ */
|
|
1513
|
+
import * as React26 from "react";
|
|
1514
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1515
|
+
var InputWithAction = React26.forwardRef(
|
|
1516
|
+
({ className, actionLabel, onAction, tags, status = "default", label, description, message, id, disabled, placeholder, ...props }, ref) => /* @__PURE__ */ jsx27(Field, { label, description, message, status, id, children: (control) => /* @__PURE__ */ jsxs17(
|
|
1397
1517
|
"div",
|
|
1398
1518
|
{
|
|
1399
1519
|
className: cn(
|
|
@@ -1405,8 +1525,8 @@ var InputWithAction = React25.forwardRef(
|
|
|
1405
1525
|
className
|
|
1406
1526
|
),
|
|
1407
1527
|
children: [
|
|
1408
|
-
tags && /* @__PURE__ */
|
|
1409
|
-
/* @__PURE__ */
|
|
1528
|
+
tags && /* @__PURE__ */ jsx27("div", { className: "flex shrink-0 items-center gap-1", children: tags }),
|
|
1529
|
+
/* @__PURE__ */ jsx27(
|
|
1410
1530
|
"input",
|
|
1411
1531
|
{
|
|
1412
1532
|
ref,
|
|
@@ -1417,7 +1537,7 @@ var InputWithAction = React25.forwardRef(
|
|
|
1417
1537
|
...props
|
|
1418
1538
|
}
|
|
1419
1539
|
),
|
|
1420
|
-
/* @__PURE__ */
|
|
1540
|
+
/* @__PURE__ */ jsx27(Button, { type: "button", variant: "subtle", size: "sm", disabled, onClick: onAction, children: actionLabel })
|
|
1421
1541
|
]
|
|
1422
1542
|
}
|
|
1423
1543
|
) })
|
|
@@ -1425,10 +1545,10 @@ var InputWithAction = React25.forwardRef(
|
|
|
1425
1545
|
InputWithAction.displayName = "InputWithAction";
|
|
1426
1546
|
|
|
1427
1547
|
// src/components/Forms & Data Entry/NumberInput.tsx
|
|
1428
|
-
import * as
|
|
1548
|
+
import * as React27 from "react";
|
|
1429
1549
|
import { Minus as Minus2, Plus as Plus2 } from "@phosphor-icons/react";
|
|
1430
|
-
import { jsx as
|
|
1431
|
-
var NumberInput =
|
|
1550
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1551
|
+
var NumberInput = React27.forwardRef(
|
|
1432
1552
|
({
|
|
1433
1553
|
className,
|
|
1434
1554
|
value,
|
|
@@ -1446,7 +1566,7 @@ var NumberInput = React26.forwardRef(
|
|
|
1446
1566
|
disabled,
|
|
1447
1567
|
...props
|
|
1448
1568
|
}, ref) => {
|
|
1449
|
-
const [internal, setInternal] =
|
|
1569
|
+
const [internal, setInternal] = React27.useState(defaultValue);
|
|
1450
1570
|
const current = value ?? internal;
|
|
1451
1571
|
const clamp = (next) => Math.min(max, Math.max(min, next));
|
|
1452
1572
|
const commit = (next) => {
|
|
@@ -1454,7 +1574,7 @@ var NumberInput = React26.forwardRef(
|
|
|
1454
1574
|
setInternal(clamped);
|
|
1455
1575
|
onValueChange?.(clamped);
|
|
1456
1576
|
};
|
|
1457
|
-
return /* @__PURE__ */
|
|
1577
|
+
return /* @__PURE__ */ jsx28(Field, { label, description, message, status, id, className: "w-50", children: (control) => /* @__PURE__ */ jsxs18(
|
|
1458
1578
|
"div",
|
|
1459
1579
|
{
|
|
1460
1580
|
className: cn(
|
|
@@ -1465,7 +1585,7 @@ var NumberInput = React26.forwardRef(
|
|
|
1465
1585
|
className
|
|
1466
1586
|
),
|
|
1467
1587
|
children: [
|
|
1468
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ jsx28(
|
|
1469
1589
|
Button,
|
|
1470
1590
|
{
|
|
1471
1591
|
type: "button",
|
|
@@ -1474,11 +1594,11 @@ var NumberInput = React26.forwardRef(
|
|
|
1474
1594
|
"aria-label": "Decrease",
|
|
1475
1595
|
disabled: disabled || current <= min,
|
|
1476
1596
|
onClick: () => commit(current - step),
|
|
1477
|
-
children: /* @__PURE__ */
|
|
1597
|
+
children: /* @__PURE__ */ jsx28(Minus2, { size: 16, "aria-hidden": true })
|
|
1478
1598
|
}
|
|
1479
1599
|
),
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1600
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-center gap-1 text-center", children: [
|
|
1601
|
+
/* @__PURE__ */ jsx28(
|
|
1482
1602
|
"input",
|
|
1483
1603
|
{
|
|
1484
1604
|
ref,
|
|
@@ -1508,9 +1628,9 @@ var NumberInput = React26.forwardRef(
|
|
|
1508
1628
|
...props
|
|
1509
1629
|
}
|
|
1510
1630
|
),
|
|
1511
|
-
unit && /* @__PURE__ */
|
|
1631
|
+
unit && /* @__PURE__ */ jsx28("span", { className: "text-body-small text-secondary-muted-foreground", children: unit })
|
|
1512
1632
|
] }),
|
|
1513
|
-
/* @__PURE__ */
|
|
1633
|
+
/* @__PURE__ */ jsx28(
|
|
1514
1634
|
Button,
|
|
1515
1635
|
{
|
|
1516
1636
|
type: "button",
|
|
@@ -1519,7 +1639,7 @@ var NumberInput = React26.forwardRef(
|
|
|
1519
1639
|
"aria-label": "Increase",
|
|
1520
1640
|
disabled: disabled || current >= max,
|
|
1521
1641
|
onClick: () => commit(current + step),
|
|
1522
|
-
children: /* @__PURE__ */
|
|
1642
|
+
children: /* @__PURE__ */ jsx28(Plus2, { size: 16, "aria-hidden": true })
|
|
1523
1643
|
}
|
|
1524
1644
|
)
|
|
1525
1645
|
]
|
|
@@ -1530,14 +1650,14 @@ var NumberInput = React26.forwardRef(
|
|
|
1530
1650
|
NumberInput.displayName = "NumberInput";
|
|
1531
1651
|
|
|
1532
1652
|
// src/components/Forms & Data Entry/SearchBar.tsx
|
|
1533
|
-
import * as
|
|
1653
|
+
import * as React28 from "react";
|
|
1534
1654
|
import { MagnifyingGlass, X as X2 } from "@phosphor-icons/react";
|
|
1535
|
-
import { jsx as
|
|
1536
|
-
var SearchBar =
|
|
1655
|
+
import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1656
|
+
var SearchBar = React28.forwardRef(
|
|
1537
1657
|
({ className, value, defaultValue, onChange, onClear, clearLabel = "Clear search", disabled, ...props }, ref) => {
|
|
1538
|
-
const innerRef =
|
|
1539
|
-
|
|
1540
|
-
const [uncontrolled, setUncontrolled] =
|
|
1658
|
+
const innerRef = React28.useRef(null);
|
|
1659
|
+
React28.useImperativeHandle(ref, () => innerRef.current);
|
|
1660
|
+
const [uncontrolled, setUncontrolled] = React28.useState(String(defaultValue ?? ""));
|
|
1541
1661
|
const current = value !== void 0 ? String(value) : uncontrolled;
|
|
1542
1662
|
const clear = () => {
|
|
1543
1663
|
const input = innerRef.current;
|
|
@@ -1549,7 +1669,7 @@ var SearchBar = React27.forwardRef(
|
|
|
1549
1669
|
}
|
|
1550
1670
|
onClear?.();
|
|
1551
1671
|
};
|
|
1552
|
-
return /* @__PURE__ */
|
|
1672
|
+
return /* @__PURE__ */ jsxs19(
|
|
1553
1673
|
"div",
|
|
1554
1674
|
{
|
|
1555
1675
|
className: cn(
|
|
@@ -1560,8 +1680,8 @@ var SearchBar = React27.forwardRef(
|
|
|
1560
1680
|
className
|
|
1561
1681
|
),
|
|
1562
1682
|
children: [
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1683
|
+
/* @__PURE__ */ jsx29(MagnifyingGlass, { size: 16, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
|
|
1684
|
+
/* @__PURE__ */ jsx29(
|
|
1565
1685
|
"input",
|
|
1566
1686
|
{
|
|
1567
1687
|
ref: innerRef,
|
|
@@ -1578,14 +1698,14 @@ var SearchBar = React27.forwardRef(
|
|
|
1578
1698
|
...props
|
|
1579
1699
|
}
|
|
1580
1700
|
),
|
|
1581
|
-
current !== "" && !disabled && /* @__PURE__ */
|
|
1701
|
+
current !== "" && !disabled && /* @__PURE__ */ jsx29(
|
|
1582
1702
|
"button",
|
|
1583
1703
|
{
|
|
1584
1704
|
type: "button",
|
|
1585
1705
|
"aria-label": clearLabel,
|
|
1586
1706
|
onClick: clear,
|
|
1587
1707
|
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-xs text-surface-foreground",
|
|
1588
|
-
children: /* @__PURE__ */
|
|
1708
|
+
children: /* @__PURE__ */ jsx29(X2, { size: 16, "aria-hidden": true })
|
|
1589
1709
|
}
|
|
1590
1710
|
)
|
|
1591
1711
|
]
|
|
@@ -1596,16 +1716,16 @@ var SearchBar = React27.forwardRef(
|
|
|
1596
1716
|
SearchBar.displayName = "SearchBar";
|
|
1597
1717
|
|
|
1598
1718
|
// src/components/Forms & Data Entry/Select.tsx
|
|
1599
|
-
import * as
|
|
1719
|
+
import * as React29 from "react";
|
|
1600
1720
|
import { CaretDown as CaretDown3 } from "@phosphor-icons/react";
|
|
1601
1721
|
import { Select as SelectPrimitive } from "radix-ui";
|
|
1602
|
-
import { jsx as
|
|
1722
|
+
import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1603
1723
|
var Select = SelectPrimitive.Root;
|
|
1604
1724
|
var SelectValue = SelectPrimitive.Value;
|
|
1605
1725
|
var SelectGroup = SelectPrimitive.Group;
|
|
1606
|
-
var CheckIcon = () => /* @__PURE__ */
|
|
1607
|
-
var SelectTrigger =
|
|
1608
|
-
({ className, children, icon, ...props }, ref) => /* @__PURE__ */
|
|
1726
|
+
var CheckIcon = () => /* @__PURE__ */ jsx30("svg", { width: "10", height: "8", viewBox: "0 0 10 8", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx30("path", { d: "M1 4L3.5 6.5L9 1", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1727
|
+
var SelectTrigger = React29.forwardRef(
|
|
1728
|
+
({ className, children, icon, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
1609
1729
|
SelectPrimitive.Trigger,
|
|
1610
1730
|
{
|
|
1611
1731
|
ref,
|
|
@@ -1618,16 +1738,16 @@ var SelectTrigger = React28.forwardRef(
|
|
|
1618
1738
|
),
|
|
1619
1739
|
...props,
|
|
1620
1740
|
children: [
|
|
1621
|
-
icon && /* @__PURE__ */
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
/* @__PURE__ */
|
|
1741
|
+
icon && /* @__PURE__ */ jsx30("span", { className: "flex shrink-0 text-surface-foreground", children: icon }),
|
|
1742
|
+
/* @__PURE__ */ jsx30("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
1743
|
+
/* @__PURE__ */ jsx30(SelectPrimitive.Icon, { className: "shrink-0 text-surface-foreground", children: /* @__PURE__ */ jsx30(CaretDown3, { size: 16, "aria-hidden": true }) })
|
|
1624
1744
|
]
|
|
1625
1745
|
}
|
|
1626
1746
|
)
|
|
1627
1747
|
);
|
|
1628
1748
|
SelectTrigger.displayName = "SelectTrigger";
|
|
1629
|
-
var SelectContent =
|
|
1630
|
-
({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */
|
|
1749
|
+
var SelectContent = React29.forwardRef(
|
|
1750
|
+
({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx30(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx30(
|
|
1631
1751
|
SelectPrimitive.Content,
|
|
1632
1752
|
{
|
|
1633
1753
|
ref,
|
|
@@ -1641,13 +1761,13 @@ var SelectContent = React28.forwardRef(
|
|
|
1641
1761
|
className
|
|
1642
1762
|
),
|
|
1643
1763
|
...props,
|
|
1644
|
-
children: /* @__PURE__ */
|
|
1764
|
+
children: /* @__PURE__ */ jsx30(SelectPrimitive.Viewport, { className: "p-1", children })
|
|
1645
1765
|
}
|
|
1646
1766
|
) })
|
|
1647
1767
|
);
|
|
1648
1768
|
SelectContent.displayName = "SelectContent";
|
|
1649
|
-
var SelectItem =
|
|
1650
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
1769
|
+
var SelectItem = React29.forwardRef(
|
|
1770
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
1651
1771
|
SelectPrimitive.Item,
|
|
1652
1772
|
{
|
|
1653
1773
|
ref,
|
|
@@ -1658,8 +1778,8 @@ var SelectItem = React28.forwardRef(
|
|
|
1658
1778
|
),
|
|
1659
1779
|
...props,
|
|
1660
1780
|
children: [
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */
|
|
1781
|
+
/* @__PURE__ */ jsx30("span", { className: "absolute left-2 flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ jsx30(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx30(CheckIcon, {}) }) }),
|
|
1782
|
+
/* @__PURE__ */ jsx30(SelectPrimitive.ItemText, { children })
|
|
1663
1783
|
]
|
|
1664
1784
|
}
|
|
1665
1785
|
)
|
|
@@ -1667,10 +1787,10 @@ var SelectItem = React28.forwardRef(
|
|
|
1667
1787
|
SelectItem.displayName = "SelectItem";
|
|
1668
1788
|
|
|
1669
1789
|
// src/components/Forms & Data Entry/Slider.tsx
|
|
1670
|
-
import * as
|
|
1790
|
+
import * as React30 from "react";
|
|
1671
1791
|
import { Slider as SliderPrimitive } from "radix-ui";
|
|
1672
|
-
import { jsx as
|
|
1673
|
-
var Slider =
|
|
1792
|
+
import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1793
|
+
var Slider = React30.forwardRef(
|
|
1674
1794
|
({
|
|
1675
1795
|
className,
|
|
1676
1796
|
value,
|
|
@@ -1685,15 +1805,15 @@ var Slider = React29.forwardRef(
|
|
|
1685
1805
|
"aria-labelledby": ariaLabelledBy,
|
|
1686
1806
|
...props
|
|
1687
1807
|
}, ref) => {
|
|
1688
|
-
const [internal, setInternal] =
|
|
1808
|
+
const [internal, setInternal] = React30.useState(defaultValue ?? [min]);
|
|
1689
1809
|
const thumbValues = value ?? internal;
|
|
1690
1810
|
const hasHeader = label != null || showRange;
|
|
1691
|
-
return /* @__PURE__ */
|
|
1692
|
-
hasHeader && /* @__PURE__ */
|
|
1693
|
-
label != null ? /* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1811
|
+
return /* @__PURE__ */ jsxs21("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
1812
|
+
hasHeader && /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between text-secondary-muted-foreground", children: [
|
|
1813
|
+
label != null ? /* @__PURE__ */ jsx31("span", { className: "text-ui-label text-surface-foreground", children: label }) : /* @__PURE__ */ jsx31("span", { className: "text-ui-caption", children: min }),
|
|
1814
|
+
/* @__PURE__ */ jsx31("span", { className: "text-body-small", children: max })
|
|
1695
1815
|
] }),
|
|
1696
|
-
/* @__PURE__ */
|
|
1816
|
+
/* @__PURE__ */ jsxs21(
|
|
1697
1817
|
SliderPrimitive.Root,
|
|
1698
1818
|
{
|
|
1699
1819
|
ref,
|
|
@@ -1708,19 +1828,19 @@ var Slider = React29.forwardRef(
|
|
|
1708
1828
|
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
1709
1829
|
...props,
|
|
1710
1830
|
children: [
|
|
1711
|
-
/* @__PURE__ */
|
|
1831
|
+
/* @__PURE__ */ jsx31(SliderPrimitive.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-muted", children: /* @__PURE__ */ jsx31(SliderPrimitive.Range, { className: "absolute h-full bg-input-accent" }) }),
|
|
1712
1832
|
thumbValues.map((thumbValue, index) => (
|
|
1713
1833
|
// The accessible name belongs on each individual thumb (the actual
|
|
1714
1834
|
// role="slider" element) — Root is just a group container. With
|
|
1715
1835
|
// more than one thumb this applies the same label to each; give a
|
|
1716
1836
|
// range slider distinct per-thumb labels via aria-labelledby instead.
|
|
1717
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ jsx31(
|
|
1718
1838
|
SliderPrimitive.Thumb,
|
|
1719
1839
|
{
|
|
1720
1840
|
"aria-label": ariaLabel,
|
|
1721
1841
|
"aria-labelledby": ariaLabelledBy,
|
|
1722
1842
|
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",
|
|
1723
|
-
children: showValue && /* @__PURE__ */
|
|
1843
|
+
children: showValue && /* @__PURE__ */ jsx31(
|
|
1724
1844
|
"span",
|
|
1725
1845
|
{
|
|
1726
1846
|
"aria-hidden": "true",
|
|
@@ -1744,17 +1864,17 @@ var Slider = React29.forwardRef(
|
|
|
1744
1864
|
Slider.displayName = "Slider";
|
|
1745
1865
|
|
|
1746
1866
|
// src/components/Forms & Data Entry/Textarea.tsx
|
|
1747
|
-
import * as
|
|
1748
|
-
import { jsx as
|
|
1867
|
+
import * as React31 from "react";
|
|
1868
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
1749
1869
|
var textareaClasses = (status, className) => cn(
|
|
1750
1870
|
"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",
|
|
1751
1871
|
fieldSurfaceClasses(status),
|
|
1752
1872
|
className
|
|
1753
1873
|
);
|
|
1754
|
-
var Textarea =
|
|
1874
|
+
var Textarea = React31.forwardRef(
|
|
1755
1875
|
({ className, status = "default", label, description, message, id, ...props }, ref) => {
|
|
1756
1876
|
if (label == null && description == null && message == null) {
|
|
1757
|
-
return /* @__PURE__ */
|
|
1877
|
+
return /* @__PURE__ */ jsx32(
|
|
1758
1878
|
"textarea",
|
|
1759
1879
|
{
|
|
1760
1880
|
ref,
|
|
@@ -1765,29 +1885,29 @@ var Textarea = React30.forwardRef(
|
|
|
1765
1885
|
}
|
|
1766
1886
|
);
|
|
1767
1887
|
}
|
|
1768
|
-
return /* @__PURE__ */
|
|
1888
|
+
return /* @__PURE__ */ jsx32(Field, { label, description, message, status, id, children: (control) => /* @__PURE__ */ jsx32("textarea", { ref, className: textareaClasses(status, className), ...control, ...props }) });
|
|
1769
1889
|
}
|
|
1770
1890
|
);
|
|
1771
1891
|
Textarea.displayName = "Textarea";
|
|
1772
1892
|
|
|
1773
1893
|
// src/components/Overlays & Feedback/Dialog.tsx
|
|
1774
|
-
import * as
|
|
1894
|
+
import * as React32 from "react";
|
|
1775
1895
|
import { X as X3 } from "@phosphor-icons/react";
|
|
1776
1896
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
1777
|
-
import { jsx as
|
|
1897
|
+
import { jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1778
1898
|
var Dialog = DialogPrimitive.Root;
|
|
1779
1899
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
1780
1900
|
var DialogClose = DialogPrimitive.Close;
|
|
1781
|
-
var DialogContent =
|
|
1782
|
-
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */
|
|
1783
|
-
/* @__PURE__ */
|
|
1901
|
+
var DialogContent = React32.forwardRef(
|
|
1902
|
+
({ className, children, closeLabel = "Close", hideClose, ...props }, ref) => /* @__PURE__ */ jsxs22(DialogPrimitive.Portal, { children: [
|
|
1903
|
+
/* @__PURE__ */ jsx33(
|
|
1784
1904
|
DialogPrimitive.Overlay,
|
|
1785
1905
|
{
|
|
1786
1906
|
style: { zIndex: "var(--sys-z-30)" },
|
|
1787
1907
|
className: "fixed inset-0 bg-primary/30"
|
|
1788
1908
|
}
|
|
1789
1909
|
),
|
|
1790
|
-
/* @__PURE__ */
|
|
1910
|
+
/* @__PURE__ */ jsxs22(
|
|
1791
1911
|
DialogPrimitive.Content,
|
|
1792
1912
|
{
|
|
1793
1913
|
ref,
|
|
@@ -1799,15 +1919,15 @@ var DialogContent = React31.forwardRef(
|
|
|
1799
1919
|
...props,
|
|
1800
1920
|
children: [
|
|
1801
1921
|
children,
|
|
1802
|
-
!hideClose && /* @__PURE__ */
|
|
1922
|
+
!hideClose && /* @__PURE__ */ jsx33(DialogPrimitive.Close, { asChild: true, children: /* @__PURE__ */ jsx33(Button, { variant: "ghost", size: "icon-sm", "aria-label": closeLabel, className: "absolute top-4 right-6", children: /* @__PURE__ */ jsx33(X3, { size: 16, "aria-hidden": true }) }) })
|
|
1803
1923
|
]
|
|
1804
1924
|
}
|
|
1805
1925
|
)
|
|
1806
1926
|
] })
|
|
1807
1927
|
);
|
|
1808
1928
|
DialogContent.displayName = "DialogContent";
|
|
1809
|
-
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */
|
|
1810
|
-
var DialogTitle =
|
|
1929
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx33("div", { className: cn("flex flex-col gap-1.5 border-b border-border px-6 py-4 pr-16", className), ...props });
|
|
1930
|
+
var DialogTitle = React32.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx33(
|
|
1811
1931
|
DialogPrimitive.Title,
|
|
1812
1932
|
{
|
|
1813
1933
|
ref,
|
|
@@ -1816,7 +1936,7 @@ var DialogTitle = React31.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1816
1936
|
}
|
|
1817
1937
|
));
|
|
1818
1938
|
DialogTitle.displayName = "DialogTitle";
|
|
1819
|
-
var DialogDescription =
|
|
1939
|
+
var DialogDescription = React32.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx33(
|
|
1820
1940
|
DialogPrimitive.Description,
|
|
1821
1941
|
{
|
|
1822
1942
|
ref,
|
|
@@ -1825,15 +1945,15 @@ var DialogDescription = React31.forwardRef(({ className, ...props }, ref) => /*
|
|
|
1825
1945
|
}
|
|
1826
1946
|
));
|
|
1827
1947
|
DialogDescription.displayName = "DialogDescription";
|
|
1828
|
-
var DialogBody = ({ className, ...props }) => /* @__PURE__ */
|
|
1829
|
-
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */
|
|
1948
|
+
var DialogBody = ({ className, ...props }) => /* @__PURE__ */ jsx33("div", { className: cn("flex flex-col gap-4 p-6", className), ...props });
|
|
1949
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx33("div", { className: cn("flex items-center justify-end gap-3 border-t border-border px-6 py-4", className), ...props });
|
|
1830
1950
|
|
|
1831
1951
|
// src/components/Overlays & Feedback/Toast.tsx
|
|
1832
|
-
import * as
|
|
1952
|
+
import * as React33 from "react";
|
|
1833
1953
|
import { CheckCircle as CheckCircle2, Info, Warning, WarningCircle as WarningCircle2, X as X4 } from "@phosphor-icons/react";
|
|
1834
1954
|
import { cva as cva4 } from "class-variance-authority";
|
|
1835
1955
|
import { Toast as ToastPrimitive } from "radix-ui";
|
|
1836
|
-
import { jsx as
|
|
1956
|
+
import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1837
1957
|
var toastVariants = cva4("border", {
|
|
1838
1958
|
variants: {
|
|
1839
1959
|
variant: {
|
|
@@ -1859,13 +1979,13 @@ var titleColour = {
|
|
|
1859
1979
|
};
|
|
1860
1980
|
function VariantIcon({ variant, size }) {
|
|
1861
1981
|
const props = { size, "aria-hidden": true, className: cn("shrink-0", iconColour[variant]) };
|
|
1862
|
-
if (variant === "success") return /* @__PURE__ */
|
|
1863
|
-
if (variant === "warning") return /* @__PURE__ */
|
|
1864
|
-
if (variant === "destructive") return /* @__PURE__ */
|
|
1865
|
-
return /* @__PURE__ */
|
|
1982
|
+
if (variant === "success") return /* @__PURE__ */ jsx34(CheckCircle2, { ...props });
|
|
1983
|
+
if (variant === "warning") return /* @__PURE__ */ jsx34(Warning, { ...props });
|
|
1984
|
+
if (variant === "destructive") return /* @__PURE__ */ jsx34(WarningCircle2, { ...props });
|
|
1985
|
+
return /* @__PURE__ */ jsx34(Info, { ...props });
|
|
1866
1986
|
}
|
|
1867
1987
|
var ToastProvider = ToastPrimitive.Provider;
|
|
1868
|
-
var ToastViewport =
|
|
1988
|
+
var ToastViewport = React33.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
1869
1989
|
ToastPrimitive.Viewport,
|
|
1870
1990
|
{
|
|
1871
1991
|
ref,
|
|
@@ -1875,10 +1995,10 @@ var ToastViewport = React32.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
1875
1995
|
}
|
|
1876
1996
|
));
|
|
1877
1997
|
ToastViewport.displayName = "ToastViewport";
|
|
1878
|
-
var Toast =
|
|
1998
|
+
var Toast = React33.forwardRef(
|
|
1879
1999
|
({ className, variant = "info", title, description, action, closeLabel = "Close", children, ...props }, ref) => {
|
|
1880
2000
|
const v = variant ?? "info";
|
|
1881
|
-
return /* @__PURE__ */
|
|
2001
|
+
return /* @__PURE__ */ jsxs23(
|
|
1882
2002
|
ToastPrimitive.Root,
|
|
1883
2003
|
{
|
|
1884
2004
|
ref,
|
|
@@ -1886,19 +2006,19 @@ var Toast = React32.forwardRef(
|
|
|
1886
2006
|
className: cn("flex items-start gap-3 rounded-lg p-4 shadow-lg", toastVariants({ variant: v }), className),
|
|
1887
2007
|
...props,
|
|
1888
2008
|
children: [
|
|
1889
|
-
/* @__PURE__ */
|
|
1890
|
-
/* @__PURE__ */
|
|
1891
|
-
title != null && /* @__PURE__ */
|
|
1892
|
-
description != null && /* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsx34(VariantIcon, { variant: v, size: 20 }),
|
|
2010
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex min-w-0 flex-1 flex-col gap-1 text-body-small", children: [
|
|
2011
|
+
title != null && /* @__PURE__ */ jsx34(ToastPrimitive.Title, { className: cn("font-semibold", titleColour[v]), children: title }),
|
|
2012
|
+
description != null && /* @__PURE__ */ jsx34(ToastPrimitive.Description, { className: "text-secondary-muted-foreground", children: description }),
|
|
1893
2013
|
children,
|
|
1894
2014
|
action
|
|
1895
2015
|
] }),
|
|
1896
|
-
/* @__PURE__ */
|
|
2016
|
+
/* @__PURE__ */ jsx34(
|
|
1897
2017
|
ToastPrimitive.Close,
|
|
1898
2018
|
{
|
|
1899
2019
|
"aria-label": closeLabel,
|
|
1900
2020
|
className: "inline-flex size-4 shrink-0 items-center justify-center rounded-xs text-surface-foreground",
|
|
1901
|
-
children: /* @__PURE__ */
|
|
2021
|
+
children: /* @__PURE__ */ jsx34(X4, { size: 16, "aria-hidden": true })
|
|
1902
2022
|
}
|
|
1903
2023
|
)
|
|
1904
2024
|
]
|
|
@@ -1908,10 +2028,10 @@ var Toast = React32.forwardRef(
|
|
|
1908
2028
|
);
|
|
1909
2029
|
Toast.displayName = "Toast";
|
|
1910
2030
|
var ToastAction = ToastPrimitive.Action;
|
|
1911
|
-
var ToastInline =
|
|
2031
|
+
var ToastInline = React33.forwardRef(
|
|
1912
2032
|
({ className, variant = "info", onClose, closeLabel = "Close", children, ...props }, ref) => {
|
|
1913
2033
|
const v = variant ?? "info";
|
|
1914
|
-
return /* @__PURE__ */
|
|
2034
|
+
return /* @__PURE__ */ jsxs23(
|
|
1915
2035
|
"div",
|
|
1916
2036
|
{
|
|
1917
2037
|
ref,
|
|
@@ -1919,9 +2039,9 @@ var ToastInline = React32.forwardRef(
|
|
|
1919
2039
|
className: cn("flex items-center gap-2 rounded-sm px-2 py-1.5", toastVariants({ variant: v }), className),
|
|
1920
2040
|
...props,
|
|
1921
2041
|
children: [
|
|
1922
|
-
/* @__PURE__ */
|
|
1923
|
-
/* @__PURE__ */
|
|
1924
|
-
onClose && /* @__PURE__ */
|
|
2042
|
+
/* @__PURE__ */ jsx34(VariantIcon, { variant: v, size: 16 }),
|
|
2043
|
+
/* @__PURE__ */ jsx34("p", { className: "min-w-0 flex-1 text-body-small text-secondary-muted-foreground", children }),
|
|
2044
|
+
onClose && /* @__PURE__ */ jsx34(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx34(X4, { size: 16, "aria-hidden": true }) })
|
|
1925
2045
|
]
|
|
1926
2046
|
}
|
|
1927
2047
|
);
|
|
@@ -1930,16 +2050,16 @@ var ToastInline = React32.forwardRef(
|
|
|
1930
2050
|
ToastInline.displayName = "ToastInline";
|
|
1931
2051
|
|
|
1932
2052
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
1933
|
-
import * as
|
|
2053
|
+
import * as React34 from "react";
|
|
1934
2054
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
1935
|
-
import { Fragment as Fragment4, jsx as
|
|
2055
|
+
import { Fragment as Fragment4, jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1936
2056
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
1937
2057
|
var Tooltip = TooltipPrimitive.Root;
|
|
1938
2058
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
1939
|
-
var TooltipContent =
|
|
2059
|
+
var TooltipContent = React34.forwardRef(
|
|
1940
2060
|
({ className, sideOffset = 4, title, description, action, arrow = true, children, ...props }, ref) => {
|
|
1941
2061
|
const detailed = title != null || description != null;
|
|
1942
|
-
return /* @__PURE__ */
|
|
2062
|
+
return /* @__PURE__ */ jsx35(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs24(
|
|
1943
2063
|
TooltipPrimitive.Content,
|
|
1944
2064
|
{
|
|
1945
2065
|
ref,
|
|
@@ -1953,12 +2073,12 @@ var TooltipContent = React33.forwardRef(
|
|
|
1953
2073
|
),
|
|
1954
2074
|
...props,
|
|
1955
2075
|
children: [
|
|
1956
|
-
detailed ? /* @__PURE__ */
|
|
1957
|
-
title != null && /* @__PURE__ */
|
|
1958
|
-
description != null && /* @__PURE__ */
|
|
1959
|
-
action != null && /* @__PURE__ */
|
|
2076
|
+
detailed ? /* @__PURE__ */ jsxs24(Fragment4, { children: [
|
|
2077
|
+
title != null && /* @__PURE__ */ jsx35("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2078
|
+
description != null && /* @__PURE__ */ jsx35("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2079
|
+
action != null && /* @__PURE__ */ jsx35("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
1960
2080
|
] }) : children,
|
|
1961
|
-
arrow && /* @__PURE__ */
|
|
2081
|
+
arrow && /* @__PURE__ */ jsx35(TooltipPrimitive.Arrow, { width: 12, height: 8, className: "fill-primary-soft-foreground" })
|
|
1962
2082
|
]
|
|
1963
2083
|
}
|
|
1964
2084
|
) });
|
|
@@ -1967,14 +2087,14 @@ var TooltipContent = React33.forwardRef(
|
|
|
1967
2087
|
TooltipContent.displayName = "TooltipContent";
|
|
1968
2088
|
|
|
1969
2089
|
// src/components/Question Types/FileUpload.tsx
|
|
1970
|
-
import * as
|
|
2090
|
+
import * as React36 from "react";
|
|
1971
2091
|
import { FileText, X as X5 } from "@phosphor-icons/react";
|
|
1972
2092
|
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
1973
2093
|
|
|
1974
2094
|
// src/components/Tags & Badges/Tag.tsx
|
|
1975
|
-
import * as
|
|
2095
|
+
import * as React35 from "react";
|
|
1976
2096
|
import { cva as cva5 } from "class-variance-authority";
|
|
1977
|
-
import { jsx as
|
|
2097
|
+
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1978
2098
|
var tagVariants = cva5(
|
|
1979
2099
|
"inline-flex items-center gap-1.5 whitespace-nowrap rounded-sm border px-2.5 py-1 text-ui-caption",
|
|
1980
2100
|
{
|
|
@@ -1990,7 +2110,7 @@ var tagVariants = cva5(
|
|
|
1990
2110
|
defaultVariants: { variant: "neutral" }
|
|
1991
2111
|
}
|
|
1992
2112
|
);
|
|
1993
|
-
var Tag =
|
|
2113
|
+
var Tag = React35.forwardRef(({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx36("span", { ref, className: cn(tagVariants({ variant }), className), ...props }));
|
|
1994
2114
|
Tag.displayName = "Tag";
|
|
1995
2115
|
var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
1996
2116
|
variants: {
|
|
@@ -2003,20 +2123,20 @@ var statusDotVariants = cva5("size-1.5 shrink-0 rounded-full", {
|
|
|
2003
2123
|
},
|
|
2004
2124
|
defaultVariants: { status: "active" }
|
|
2005
2125
|
});
|
|
2006
|
-
var StatusTag =
|
|
2007
|
-
({ className, status, children, ...props }, ref) => /* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2126
|
+
var StatusTag = React35.forwardRef(
|
|
2127
|
+
({ className, status, children, ...props }, ref) => /* @__PURE__ */ jsxs25("span", { ref, className: cn(tagVariants({ variant: "default" }), className), ...props, children: [
|
|
2128
|
+
/* @__PURE__ */ jsx36("span", { className: statusDotVariants({ status }), "aria-hidden": "true" }),
|
|
2009
2129
|
children
|
|
2010
2130
|
] })
|
|
2011
2131
|
);
|
|
2012
2132
|
StatusTag.displayName = "StatusTag";
|
|
2013
2133
|
|
|
2014
2134
|
// src/components/Question Types/FileUpload.tsx
|
|
2015
|
-
import { Fragment as Fragment5, jsx as
|
|
2016
|
-
var FileUploadZone =
|
|
2135
|
+
import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2136
|
+
var FileUploadZone = React36.forwardRef(
|
|
2017
2137
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2018
|
-
const [over, setOver] =
|
|
2019
|
-
return /* @__PURE__ */
|
|
2138
|
+
const [over, setOver] = React36.useState(false);
|
|
2139
|
+
return /* @__PURE__ */ jsxs26(
|
|
2020
2140
|
"label",
|
|
2021
2141
|
{
|
|
2022
2142
|
className: cn(
|
|
@@ -2036,12 +2156,12 @@ var FileUploadZone = React35.forwardRef(
|
|
|
2036
2156
|
onFiles?.(Array.from(event.dataTransfer.files));
|
|
2037
2157
|
},
|
|
2038
2158
|
children: [
|
|
2039
|
-
/* @__PURE__ */
|
|
2040
|
-
/* @__PURE__ */
|
|
2041
|
-
/* @__PURE__ */
|
|
2042
|
-
hint && /* @__PURE__ */
|
|
2159
|
+
/* @__PURE__ */ jsx37("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__ */ jsx37(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2160
|
+
/* @__PURE__ */ jsxs26("span", { className: "flex flex-col gap-1", children: [
|
|
2161
|
+
/* @__PURE__ */ jsx37("span", { className: "text-body-small text-surface-foreground", children: title }),
|
|
2162
|
+
hint && /* @__PURE__ */ jsx37("span", { className: "text-ui-caption text-secondary-muted-foreground", children: hint })
|
|
2043
2163
|
] }),
|
|
2044
|
-
/* @__PURE__ */
|
|
2164
|
+
/* @__PURE__ */ jsx37(
|
|
2045
2165
|
"input",
|
|
2046
2166
|
{
|
|
2047
2167
|
ref,
|
|
@@ -2057,49 +2177,49 @@ var FileUploadZone = React35.forwardRef(
|
|
|
2057
2177
|
}
|
|
2058
2178
|
);
|
|
2059
2179
|
FileUploadZone.displayName = "FileUploadZone";
|
|
2060
|
-
var FileUploadItem =
|
|
2180
|
+
var FileUploadItem = React36.forwardRef(
|
|
2061
2181
|
({ className, name, size, status = "uploading", progress = 0, timeLeft, icon, onRemove, removeLabel, ...props }, ref) => {
|
|
2062
2182
|
const uploading = status === "uploading";
|
|
2063
|
-
return /* @__PURE__ */
|
|
2183
|
+
return /* @__PURE__ */ jsxs26(
|
|
2064
2184
|
"div",
|
|
2065
2185
|
{
|
|
2066
2186
|
ref,
|
|
2067
2187
|
className: cn("flex w-full flex-col justify-center gap-2 overflow-hidden rounded-sm border border-border p-2", className),
|
|
2068
2188
|
...props,
|
|
2069
2189
|
children: [
|
|
2070
|
-
/* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
status === "complete" && /* @__PURE__ */
|
|
2077
|
-
status === "error" && /* @__PURE__ */
|
|
2190
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2", children: [
|
|
2191
|
+
/* @__PURE__ */ jsx37("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__ */ jsx37(FileText, { size: 24, "aria-hidden": true }) }),
|
|
2192
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
2193
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2194
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2195
|
+
/* @__PURE__ */ jsx37("p", { className: "truncate text-ui-label text-surface-foreground", children: name }),
|
|
2196
|
+
status === "complete" && /* @__PURE__ */ jsx37(Tag, { variant: "success", children: "Complete" }),
|
|
2197
|
+
status === "error" && /* @__PURE__ */ jsx37(Tag, { variant: "destructive", children: "Error" })
|
|
2078
2198
|
] }),
|
|
2079
|
-
onRemove && /* @__PURE__ */
|
|
2199
|
+
onRemove && /* @__PURE__ */ jsx37(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx37(X5, { size: 16, "aria-hidden": true }) })
|
|
2080
2200
|
] }),
|
|
2081
|
-
/* @__PURE__ */
|
|
2082
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between text-ui-caption text-secondary-muted-foreground", children: [
|
|
2202
|
+
/* @__PURE__ */ jsxs26("span", { className: "flex items-center gap-2", children: [
|
|
2083
2203
|
size,
|
|
2084
|
-
uploading && timeLeft && /* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2204
|
+
uploading && timeLeft && /* @__PURE__ */ jsxs26(Fragment5, { children: [
|
|
2205
|
+
/* @__PURE__ */ jsx37("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2086
2206
|
timeLeft
|
|
2087
2207
|
] })
|
|
2088
2208
|
] }),
|
|
2089
|
-
uploading && /* @__PURE__ */
|
|
2209
|
+
uploading && /* @__PURE__ */ jsxs26("span", { className: "text-body-xxs font-normal", children: [
|
|
2090
2210
|
Math.round(progress),
|
|
2091
2211
|
"%"
|
|
2092
2212
|
] })
|
|
2093
2213
|
] })
|
|
2094
2214
|
] })
|
|
2095
2215
|
] }),
|
|
2096
|
-
uploading && /* @__PURE__ */
|
|
2216
|
+
uploading && /* @__PURE__ */ jsx37(
|
|
2097
2217
|
ProgressPrimitive.Root,
|
|
2098
2218
|
{
|
|
2099
2219
|
value: progress,
|
|
2100
2220
|
"aria-label": `Uploading ${name}`,
|
|
2101
2221
|
className: "h-0.75 w-full overflow-hidden rounded-sm bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5",
|
|
2102
|
-
children: /* @__PURE__ */
|
|
2222
|
+
children: /* @__PURE__ */ jsx37(ProgressPrimitive.Indicator, { className: "h-full bg-accent transition-[width]", style: { width: `${progress}%` } })
|
|
2103
2223
|
}
|
|
2104
2224
|
)
|
|
2105
2225
|
]
|
|
@@ -2110,31 +2230,31 @@ var FileUploadItem = React35.forwardRef(
|
|
|
2110
2230
|
FileUploadItem.displayName = "FileUploadItem";
|
|
2111
2231
|
|
|
2112
2232
|
// src/components/Question Types/Media.tsx
|
|
2113
|
-
import * as
|
|
2233
|
+
import * as React37 from "react";
|
|
2114
2234
|
import { CornersOut, DotsThree, Image as ImageIcon, Pause, Play, SpeakerSimpleHigh, SpeakerSimpleX, Trash as Trash2 } from "@phosphor-icons/react";
|
|
2115
2235
|
import { Slider as SliderPrimitive2, ToggleGroup as ToggleGroupPrimitive2 } from "radix-ui";
|
|
2116
|
-
import { jsx as
|
|
2236
|
+
import { jsx as jsx38, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2117
2237
|
function MediaInfo({ name, details, onRemove, removeLabel, large, className, ...props }) {
|
|
2118
|
-
return /* @__PURE__ */
|
|
2119
|
-
/* @__PURE__ */
|
|
2120
|
-
/* @__PURE__ */
|
|
2121
|
-
details && /* @__PURE__ */
|
|
2122
|
-
index > 0 && /* @__PURE__ */
|
|
2238
|
+
return /* @__PURE__ */ jsxs27("div", { className: cn("flex items-center justify-between border-t border-border bg-surface px-6 py-4", className), ...props, children: [
|
|
2239
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
2240
|
+
/* @__PURE__ */ jsx38("p", { className: cn("truncate text-surface-foreground", large ? "text-body-section" : "text-ui-label"), children: name }),
|
|
2241
|
+
details && /* @__PURE__ */ jsx38("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__ */ jsxs27(React37.Fragment, { children: [
|
|
2242
|
+
index > 0 && /* @__PURE__ */ jsx38("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2123
2243
|
part
|
|
2124
2244
|
] }, part)) })
|
|
2125
2245
|
] }),
|
|
2126
|
-
onRemove && /* @__PURE__ */
|
|
2246
|
+
onRemove && /* @__PURE__ */ jsx38(Button, { type: "button", variant: "destructive", size: "icon", "aria-label": removeLabel ?? `Remove ${name}`, onClick: onRemove, children: /* @__PURE__ */ jsx38(Trash2, { size: 16, "aria-hidden": true }) })
|
|
2127
2247
|
] });
|
|
2128
2248
|
}
|
|
2129
|
-
var ImagePreview =
|
|
2130
|
-
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */
|
|
2131
|
-
/* @__PURE__ */
|
|
2132
|
-
/* @__PURE__ */
|
|
2249
|
+
var ImagePreview = React37.forwardRef(
|
|
2250
|
+
({ className, children, name, details, onRemove, ...props }, ref) => /* @__PURE__ */ jsxs27("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border", className), ...props, children: [
|
|
2251
|
+
/* @__PURE__ */ jsx38("div", { className: "flex h-84 w-full items-center justify-center bg-accent-soft [&>img]:size-full [&>img]:object-contain", children }),
|
|
2252
|
+
/* @__PURE__ */ jsx38(MediaInfo, { name, details, onRemove, large: true })
|
|
2133
2253
|
] })
|
|
2134
2254
|
);
|
|
2135
2255
|
ImagePreview.displayName = "ImagePreview";
|
|
2136
|
-
var ImageThumbnails =
|
|
2137
|
-
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */
|
|
2256
|
+
var ImageThumbnails = React37.forwardRef(
|
|
2257
|
+
({ className, max, images, value, onValueChange, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
2138
2258
|
ToggleGroupPrimitive2.Root,
|
|
2139
2259
|
{
|
|
2140
2260
|
ref,
|
|
@@ -2146,17 +2266,17 @@ var ImageThumbnails = React36.forwardRef(
|
|
|
2146
2266
|
children: Array.from({ length: max }, (_, index) => {
|
|
2147
2267
|
const image = images[index];
|
|
2148
2268
|
if (!image) {
|
|
2149
|
-
return /* @__PURE__ */
|
|
2269
|
+
return /* @__PURE__ */ jsx38(
|
|
2150
2270
|
"span",
|
|
2151
2271
|
{
|
|
2152
2272
|
"aria-hidden": "true",
|
|
2153
2273
|
className: "flex h-20 min-w-0 flex-1 items-center justify-center rounded-sm border border-dashed border-border text-accent-foreground",
|
|
2154
|
-
children: /* @__PURE__ */
|
|
2274
|
+
children: /* @__PURE__ */ jsx38(ImageIcon, { size: 24 })
|
|
2155
2275
|
},
|
|
2156
2276
|
`empty-${index}`
|
|
2157
2277
|
);
|
|
2158
2278
|
}
|
|
2159
|
-
return /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ jsx38(
|
|
2160
2280
|
ToggleGroupPrimitive2.Item,
|
|
2161
2281
|
{
|
|
2162
2282
|
value: image.id,
|
|
@@ -2166,7 +2286,7 @@ var ImageThumbnails = React36.forwardRef(
|
|
|
2166
2286
|
"hover:bg-accent-soft hover:bg-none",
|
|
2167
2287
|
"data-[state=on]:border-accent-foreground data-[state=on]:bg-accent-soft data-[state=on]:bg-none data-[state=on]:text-accent-foreground"
|
|
2168
2288
|
),
|
|
2169
|
-
children: image.src ? /* @__PURE__ */
|
|
2289
|
+
children: image.src ? /* @__PURE__ */ jsx38("img", { src: image.src, alt: "", className: "size-full object-cover" }) : /* @__PURE__ */ jsx38(ImageIcon, { size: 24, "aria-hidden": true })
|
|
2170
2290
|
},
|
|
2171
2291
|
image.id
|
|
2172
2292
|
);
|
|
@@ -2179,13 +2299,13 @@ var formatTime = (seconds) => {
|
|
|
2179
2299
|
const total = Math.max(0, Math.floor(Number.isFinite(seconds) ? seconds : 0));
|
|
2180
2300
|
return `${Math.floor(total / 60)}:${String(total % 60).padStart(2, "0")}`;
|
|
2181
2301
|
};
|
|
2182
|
-
var VideoPlayer =
|
|
2302
|
+
var VideoPlayer = React37.forwardRef(
|
|
2183
2303
|
({ className, src, name, details, onRemove, onMore, initialTime = 0, initialDuration = 0, ...props }, ref) => {
|
|
2184
|
-
const video =
|
|
2185
|
-
const [playing, setPlaying] =
|
|
2186
|
-
const [time, setTime] =
|
|
2187
|
-
const [duration, setDuration] =
|
|
2188
|
-
const [volume, setVolume] =
|
|
2304
|
+
const video = React37.useRef(null);
|
|
2305
|
+
const [playing, setPlaying] = React37.useState(false);
|
|
2306
|
+
const [time, setTime] = React37.useState(initialTime);
|
|
2307
|
+
const [duration, setDuration] = React37.useState(initialDuration);
|
|
2308
|
+
const [volume, setVolume] = React37.useState(1);
|
|
2189
2309
|
const muted = volume === 0;
|
|
2190
2310
|
const toggle2 = () => {
|
|
2191
2311
|
const el = video.current;
|
|
@@ -2193,9 +2313,9 @@ var VideoPlayer = React36.forwardRef(
|
|
|
2193
2313
|
if (el.paused) void el.play();
|
|
2194
2314
|
else el.pause();
|
|
2195
2315
|
};
|
|
2196
|
-
return /* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
src && /* @__PURE__ */
|
|
2316
|
+
return /* @__PURE__ */ jsxs27("div", { ref, className: cn("flex w-full flex-col overflow-hidden rounded-lg border border-border bg-surface", className), ...props, children: [
|
|
2317
|
+
/* @__PURE__ */ jsxs27("div", { className: "relative flex h-60.5 w-full items-end bg-accent-soft", children: [
|
|
2318
|
+
src && /* @__PURE__ */ jsx38(
|
|
2199
2319
|
"video",
|
|
2200
2320
|
{
|
|
2201
2321
|
ref: video,
|
|
@@ -2208,8 +2328,8 @@ var VideoPlayer = React36.forwardRef(
|
|
|
2208
2328
|
onVolumeChange: (event) => setVolume(event.currentTarget.muted ? 0 : event.currentTarget.volume)
|
|
2209
2329
|
}
|
|
2210
2330
|
),
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
/* @__PURE__ */
|
|
2331
|
+
/* @__PURE__ */ jsxs27("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: [
|
|
2332
|
+
/* @__PURE__ */ jsxs27(
|
|
2213
2333
|
SliderPrimitive2.Root,
|
|
2214
2334
|
{
|
|
2215
2335
|
min: 0,
|
|
@@ -2223,31 +2343,31 @@ var VideoPlayer = React36.forwardRef(
|
|
|
2223
2343
|
},
|
|
2224
2344
|
className: "relative flex h-4 w-full touch-none items-center select-none",
|
|
2225
2345
|
children: [
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
2346
|
+
/* @__PURE__ */ jsx38(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx38(SliderPrimitive2.Range, { className: "absolute h-full bg-accent-foreground" }) }),
|
|
2347
|
+
/* @__PURE__ */ jsx38(SliderPrimitive2.Thumb, { "aria-label": "Seek", className: "block size-3 rounded-full border-2 border-surface bg-surface shadow-sm" })
|
|
2228
2348
|
]
|
|
2229
2349
|
}
|
|
2230
2350
|
),
|
|
2231
|
-
/* @__PURE__ */
|
|
2232
|
-
/* @__PURE__ */
|
|
2233
|
-
/* @__PURE__ */
|
|
2351
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between", children: [
|
|
2352
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-4", children: [
|
|
2353
|
+
/* @__PURE__ */ jsx38(
|
|
2234
2354
|
"button",
|
|
2235
2355
|
{
|
|
2236
2356
|
type: "button",
|
|
2237
2357
|
"aria-label": playing ? "Pause" : "Play",
|
|
2238
2358
|
onClick: toggle2,
|
|
2239
2359
|
className: "inline-flex size-10 items-center justify-center rounded-full bg-surface/12 text-surface transition-colors hover:bg-surface/20",
|
|
2240
|
-
children: playing ? /* @__PURE__ */
|
|
2360
|
+
children: playing ? /* @__PURE__ */ jsx38(Pause, { size: 16, weight: "fill", "aria-hidden": true }) : /* @__PURE__ */ jsx38(Play, { size: 16, weight: "fill", "aria-hidden": true })
|
|
2241
2361
|
}
|
|
2242
2362
|
),
|
|
2243
|
-
/* @__PURE__ */
|
|
2363
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-ui-label whitespace-nowrap text-surface/80", children: [
|
|
2244
2364
|
formatTime(time),
|
|
2245
2365
|
" / ",
|
|
2246
2366
|
formatTime(duration)
|
|
2247
2367
|
] })
|
|
2248
2368
|
] }),
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
2369
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
|
|
2370
|
+
/* @__PURE__ */ jsx38(
|
|
2251
2371
|
VolumeControl,
|
|
2252
2372
|
{
|
|
2253
2373
|
volume,
|
|
@@ -2260,41 +2380,41 @@ var VideoPlayer = React36.forwardRef(
|
|
|
2260
2380
|
}
|
|
2261
2381
|
}
|
|
2262
2382
|
),
|
|
2263
|
-
/* @__PURE__ */
|
|
2383
|
+
/* @__PURE__ */ jsx38(
|
|
2264
2384
|
"button",
|
|
2265
2385
|
{
|
|
2266
2386
|
type: "button",
|
|
2267
2387
|
"aria-label": "Full screen",
|
|
2268
2388
|
onClick: () => void video.current?.requestFullscreen?.(),
|
|
2269
2389
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2270
|
-
children: /* @__PURE__ */
|
|
2390
|
+
children: /* @__PURE__ */ jsx38(CornersOut, { size: 16, "aria-hidden": true })
|
|
2271
2391
|
}
|
|
2272
2392
|
),
|
|
2273
|
-
/* @__PURE__ */
|
|
2393
|
+
/* @__PURE__ */ jsx38(
|
|
2274
2394
|
"button",
|
|
2275
2395
|
{
|
|
2276
2396
|
type: "button",
|
|
2277
2397
|
"aria-label": "More",
|
|
2278
2398
|
onClick: onMore,
|
|
2279
2399
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2280
|
-
children: /* @__PURE__ */
|
|
2400
|
+
children: /* @__PURE__ */ jsx38(DotsThree, { size: 16, "aria-hidden": true })
|
|
2281
2401
|
}
|
|
2282
2402
|
)
|
|
2283
2403
|
] })
|
|
2284
2404
|
] })
|
|
2285
2405
|
] })
|
|
2286
2406
|
] }),
|
|
2287
|
-
name && /* @__PURE__ */
|
|
2288
|
-
/* @__PURE__ */
|
|
2407
|
+
name && /* @__PURE__ */ jsx38(MediaInfo, { name, details, onRemove }),
|
|
2408
|
+
/* @__PURE__ */ jsx38("span", { className: "sr-only", "aria-live": "polite", children: muted ? "Muted" : "" })
|
|
2289
2409
|
] });
|
|
2290
2410
|
}
|
|
2291
2411
|
);
|
|
2292
2412
|
VideoPlayer.displayName = "VideoPlayer";
|
|
2293
2413
|
function VolumeControl({ volume, onVolumeChange, className }) {
|
|
2294
|
-
const last =
|
|
2414
|
+
const last = React37.useRef(volume || 1);
|
|
2295
2415
|
if (volume > 0) last.current = volume;
|
|
2296
|
-
return /* @__PURE__ */
|
|
2297
|
-
/* @__PURE__ */
|
|
2416
|
+
return /* @__PURE__ */ jsxs27("div", { className: cn("group/volume flex items-center", className), children: [
|
|
2417
|
+
/* @__PURE__ */ jsx38("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__ */ jsxs27(
|
|
2298
2418
|
SliderPrimitive2.Root,
|
|
2299
2419
|
{
|
|
2300
2420
|
min: 0,
|
|
@@ -2304,32 +2424,32 @@ function VolumeControl({ volume, onVolumeChange, className }) {
|
|
|
2304
2424
|
onValueChange: ([next]) => next !== void 0 && onVolumeChange(next),
|
|
2305
2425
|
className: "relative flex h-4 w-14 touch-none items-center select-none",
|
|
2306
2426
|
children: [
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
/* @__PURE__ */
|
|
2427
|
+
/* @__PURE__ */ jsx38(SliderPrimitive2.Track, { className: "relative h-1 w-full grow overflow-hidden rounded-xxs bg-surface/20", children: /* @__PURE__ */ jsx38(SliderPrimitive2.Range, { className: "absolute h-full bg-surface" }) }),
|
|
2428
|
+
/* @__PURE__ */ jsx38(SliderPrimitive2.Thumb, { "aria-label": "Volume", className: "block size-3 rounded-full bg-surface shadow-sm" })
|
|
2309
2429
|
]
|
|
2310
2430
|
}
|
|
2311
2431
|
) }),
|
|
2312
|
-
/* @__PURE__ */
|
|
2432
|
+
/* @__PURE__ */ jsx38(
|
|
2313
2433
|
"button",
|
|
2314
2434
|
{
|
|
2315
2435
|
type: "button",
|
|
2316
2436
|
"aria-label": volume === 0 ? "Unmute" : "Mute",
|
|
2317
2437
|
onClick: () => onVolumeChange(volume === 0 ? last.current : 0),
|
|
2318
2438
|
className: "inline-flex size-10 items-center justify-center rounded-md text-surface transition-colors hover:bg-surface/12",
|
|
2319
|
-
children: volume === 0 ? /* @__PURE__ */
|
|
2439
|
+
children: volume === 0 ? /* @__PURE__ */ jsx38(SpeakerSimpleX, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx38(SpeakerSimpleHigh, { size: 16, "aria-hidden": true })
|
|
2320
2440
|
}
|
|
2321
2441
|
)
|
|
2322
2442
|
] });
|
|
2323
2443
|
}
|
|
2324
2444
|
|
|
2325
2445
|
// src/components/Question Types/OpenEndAnswer.tsx
|
|
2326
|
-
import * as
|
|
2327
|
-
import { jsx as
|
|
2328
|
-
var OpenEndAnswer =
|
|
2446
|
+
import * as React38 from "react";
|
|
2447
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2448
|
+
var OpenEndAnswer = React38.forwardRef(
|
|
2329
2449
|
({ value, defaultValue, onChange, maxLength = 1e3, placeholder = "Write your answer", ...props }, ref) => {
|
|
2330
|
-
const [internal, setInternal] =
|
|
2450
|
+
const [internal, setInternal] = React38.useState(String(defaultValue ?? ""));
|
|
2331
2451
|
const text = value !== void 0 ? String(value) : internal;
|
|
2332
|
-
return /* @__PURE__ */
|
|
2452
|
+
return /* @__PURE__ */ jsx39(
|
|
2333
2453
|
Textarea,
|
|
2334
2454
|
{
|
|
2335
2455
|
ref,
|
|
@@ -2349,10 +2469,10 @@ var OpenEndAnswer = React37.forwardRef(
|
|
|
2349
2469
|
OpenEndAnswer.displayName = "OpenEndAnswer";
|
|
2350
2470
|
|
|
2351
2471
|
// src/components/Question Types/QuestionCard.tsx
|
|
2352
|
-
import * as
|
|
2353
|
-
import { jsx as
|
|
2354
|
-
var QuestionCard =
|
|
2355
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
2472
|
+
import * as React39 from "react";
|
|
2473
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2474
|
+
var QuestionCard = React39.forwardRef(
|
|
2475
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx40(
|
|
2356
2476
|
"div",
|
|
2357
2477
|
{
|
|
2358
2478
|
ref,
|
|
@@ -2364,7 +2484,7 @@ var QuestionCard = React38.forwardRef(
|
|
|
2364
2484
|
QuestionCard.displayName = "QuestionCard";
|
|
2365
2485
|
|
|
2366
2486
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2367
|
-
import * as
|
|
2487
|
+
import * as React41 from "react";
|
|
2368
2488
|
import {
|
|
2369
2489
|
Clipboard,
|
|
2370
2490
|
Copy,
|
|
@@ -2375,19 +2495,21 @@ import {
|
|
|
2375
2495
|
} from "@phosphor-icons/react";
|
|
2376
2496
|
|
|
2377
2497
|
// src/components/Question Types/QuestionHeader.tsx
|
|
2378
|
-
import * as
|
|
2498
|
+
import * as React40 from "react";
|
|
2379
2499
|
import { DotsSixVertical } from "@phosphor-icons/react";
|
|
2380
|
-
import { jsx as
|
|
2500
|
+
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2381
2501
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
2382
|
-
var QuestionHeader =
|
|
2502
|
+
var QuestionHeader = React40.forwardRef(
|
|
2383
2503
|
({ className, number, title, required, error, onDismissError, editor, onTitleChange, actions, maxLength = 2e3, active, showCounter = true, ...props }, ref) => {
|
|
2504
|
+
const [draft, setDraft] = React40.useState(null);
|
|
2384
2505
|
const label = String(number).padStart(2, "0");
|
|
2385
2506
|
const showError = error !== void 0 && error !== false;
|
|
2386
2507
|
if (editor) {
|
|
2387
2508
|
const text = typeof title === "string" ? title : "";
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2509
|
+
const count = (draft ?? text).length;
|
|
2510
|
+
return /* @__PURE__ */ jsxs28("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
2511
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
|
|
2512
|
+
/* @__PURE__ */ jsxs28(
|
|
2391
2513
|
"span",
|
|
2392
2514
|
{
|
|
2393
2515
|
className: cn(
|
|
@@ -2395,43 +2517,51 @@ var QuestionHeader = React39.forwardRef(
|
|
|
2395
2517
|
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"
|
|
2396
2518
|
),
|
|
2397
2519
|
children: [
|
|
2398
|
-
/* @__PURE__ */
|
|
2520
|
+
/* @__PURE__ */ jsx41(DotsSixVertical, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover/handle:block" }),
|
|
2399
2521
|
"Question ",
|
|
2400
2522
|
number
|
|
2401
2523
|
]
|
|
2402
2524
|
}
|
|
2403
2525
|
),
|
|
2404
|
-
actions && /* @__PURE__ */
|
|
2526
|
+
actions && /* @__PURE__ */ jsx41("div", { className: "flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100", children: actions })
|
|
2405
2527
|
] }),
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
|
|
2528
|
+
/* @__PURE__ */ jsx41(
|
|
2529
|
+
InlineEdit,
|
|
2408
2530
|
{
|
|
2409
|
-
|
|
2531
|
+
variant: "question",
|
|
2532
|
+
multiline: true,
|
|
2533
|
+
selected: active,
|
|
2534
|
+
className: "-mx-3 w-auto",
|
|
2410
2535
|
"aria-label": "Question title",
|
|
2536
|
+
placeholder: "Click to write the question text",
|
|
2411
2537
|
value: text,
|
|
2412
2538
|
maxLength,
|
|
2413
|
-
|
|
2414
|
-
|
|
2539
|
+
onValueChange: onTitleChange,
|
|
2540
|
+
onDraftChange: setDraft,
|
|
2541
|
+
onEditingChange: (editing) => {
|
|
2542
|
+
if (!editing) setDraft(null);
|
|
2543
|
+
},
|
|
2544
|
+
textClassName: "text-heading-h4"
|
|
2415
2545
|
}
|
|
2416
2546
|
),
|
|
2417
|
-
showCounter && /* @__PURE__ */
|
|
2418
|
-
|
|
2547
|
+
showCounter && /* @__PURE__ */ jsxs28("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
2548
|
+
count,
|
|
2419
2549
|
"/",
|
|
2420
2550
|
maxLength,
|
|
2421
2551
|
" characters"
|
|
2422
2552
|
] })
|
|
2423
2553
|
] });
|
|
2424
2554
|
}
|
|
2425
|
-
return /* @__PURE__ */
|
|
2426
|
-
showError && /* @__PURE__ */
|
|
2427
|
-
/* @__PURE__ */
|
|
2555
|
+
return /* @__PURE__ */ jsxs28("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
2556
|
+
showError && /* @__PURE__ */ jsx41(ToastInline, { variant: "destructive", onClose: onDismissError, className: "min-h-10", children: /* @__PURE__ */ jsx41("span", { className: "text-ui-label text-destructive", children: error === true ? "This question is mandatory." : error }) }),
|
|
2557
|
+
/* @__PURE__ */ jsxs28("p", { className: eyebrow, children: [
|
|
2428
2558
|
"Question ",
|
|
2429
2559
|
label
|
|
2430
2560
|
] }),
|
|
2431
|
-
/* @__PURE__ */
|
|
2561
|
+
/* @__PURE__ */ jsxs28("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
2432
2562
|
title,
|
|
2433
|
-
required && /* @__PURE__ */
|
|
2434
|
-
required && /* @__PURE__ */
|
|
2563
|
+
required && /* @__PURE__ */ jsx41("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
2564
|
+
required && /* @__PURE__ */ jsx41("span", { className: "sr-only", children: " (required)" })
|
|
2435
2565
|
] })
|
|
2436
2566
|
] });
|
|
2437
2567
|
}
|
|
@@ -2439,8 +2569,8 @@ var QuestionHeader = React39.forwardRef(
|
|
|
2439
2569
|
QuestionHeader.displayName = "QuestionHeader";
|
|
2440
2570
|
|
|
2441
2571
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2442
|
-
import { Fragment as Fragment7, jsx as
|
|
2443
|
-
var QuestionEditorCard =
|
|
2572
|
+
import { Fragment as Fragment7, jsx as jsx42, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2573
|
+
var QuestionEditorCard = React41.forwardRef(
|
|
2444
2574
|
({
|
|
2445
2575
|
className,
|
|
2446
2576
|
number,
|
|
@@ -2461,14 +2591,14 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2461
2591
|
...props
|
|
2462
2592
|
}, ref) => {
|
|
2463
2593
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
2464
|
-
return /* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ jsxs29(
|
|
2465
2595
|
"div",
|
|
2466
2596
|
{
|
|
2467
2597
|
ref,
|
|
2468
2598
|
className: cn("group/editor flex w-full items-start gap-2", className),
|
|
2469
2599
|
...props,
|
|
2470
2600
|
children: [
|
|
2471
|
-
/* @__PURE__ */
|
|
2601
|
+
/* @__PURE__ */ jsxs29(
|
|
2472
2602
|
"div",
|
|
2473
2603
|
{
|
|
2474
2604
|
className: cn(
|
|
@@ -2476,9 +2606,9 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2476
2606
|
active ? "border-accent" : "border-border"
|
|
2477
2607
|
),
|
|
2478
2608
|
children: [
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
/* @__PURE__ */
|
|
2481
|
-
/* @__PURE__ */
|
|
2609
|
+
/* @__PURE__ */ jsxs29("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
2610
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-4", children: [
|
|
2611
|
+
/* @__PURE__ */ jsx42(
|
|
2482
2612
|
QuestionHeader,
|
|
2483
2613
|
{
|
|
2484
2614
|
editor: true,
|
|
@@ -2488,8 +2618,8 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2488
2618
|
active,
|
|
2489
2619
|
showCounter: !!active,
|
|
2490
2620
|
maxLength,
|
|
2491
|
-
actions: actions ?? /* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
2621
|
+
actions: actions ?? /* @__PURE__ */ jsxs29(Fragment7, { children: [
|
|
2622
|
+
/* @__PURE__ */ jsx42(
|
|
2493
2623
|
Button,
|
|
2494
2624
|
{
|
|
2495
2625
|
type: "button",
|
|
@@ -2497,10 +2627,10 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2497
2627
|
size: "icon-sm",
|
|
2498
2628
|
"aria-label": "Duplicate question",
|
|
2499
2629
|
onClick: onDuplicate,
|
|
2500
|
-
children: /* @__PURE__ */
|
|
2630
|
+
children: /* @__PURE__ */ jsx42(Copy, { size: 16, "aria-hidden": true })
|
|
2501
2631
|
}
|
|
2502
2632
|
),
|
|
2503
|
-
/* @__PURE__ */
|
|
2633
|
+
/* @__PURE__ */ jsx42(
|
|
2504
2634
|
Button,
|
|
2505
2635
|
{
|
|
2506
2636
|
type: "button",
|
|
@@ -2508,10 +2638,10 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2508
2638
|
size: "icon-sm",
|
|
2509
2639
|
"aria-label": "Delete question",
|
|
2510
2640
|
onClick: onDelete,
|
|
2511
|
-
children: /* @__PURE__ */
|
|
2641
|
+
children: /* @__PURE__ */ jsx42(Trash3, { size: 16, "aria-hidden": true })
|
|
2512
2642
|
}
|
|
2513
2643
|
),
|
|
2514
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsx42(
|
|
2515
2645
|
Button,
|
|
2516
2646
|
{
|
|
2517
2647
|
type: "button",
|
|
@@ -2519,7 +2649,7 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2519
2649
|
size: "icon-sm",
|
|
2520
2650
|
"aria-label": "Preview question",
|
|
2521
2651
|
onClick: onPreview,
|
|
2522
|
-
children: /* @__PURE__ */
|
|
2652
|
+
children: /* @__PURE__ */ jsx42(Eye, { size: 16, "aria-hidden": true })
|
|
2523
2653
|
}
|
|
2524
2654
|
)
|
|
2525
2655
|
] })
|
|
@@ -2527,10 +2657,10 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2527
2657
|
),
|
|
2528
2658
|
children
|
|
2529
2659
|
] }),
|
|
2530
|
-
footer && /* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
onAdd && /* @__PURE__ */
|
|
2660
|
+
footer && /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
|
|
2661
|
+
/* @__PURE__ */ jsx42("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
2662
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
2663
|
+
onAdd && /* @__PURE__ */ jsx42(
|
|
2534
2664
|
Button,
|
|
2535
2665
|
{
|
|
2536
2666
|
type: "button",
|
|
@@ -2538,10 +2668,10 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2538
2668
|
size: "icon",
|
|
2539
2669
|
"aria-label": "Add choice",
|
|
2540
2670
|
onClick: onAdd,
|
|
2541
|
-
children: /* @__PURE__ */
|
|
2671
|
+
children: /* @__PURE__ */ jsx42(Plus3, { size: 16, "aria-hidden": true })
|
|
2542
2672
|
}
|
|
2543
2673
|
),
|
|
2544
|
-
onPaste && /* @__PURE__ */
|
|
2674
|
+
onPaste && /* @__PURE__ */ jsx42(
|
|
2545
2675
|
Button,
|
|
2546
2676
|
{
|
|
2547
2677
|
type: "button",
|
|
@@ -2549,17 +2679,17 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2549
2679
|
size: "icon",
|
|
2550
2680
|
"aria-label": "Paste choices",
|
|
2551
2681
|
onClick: onPaste,
|
|
2552
|
-
children: /* @__PURE__ */
|
|
2682
|
+
children: /* @__PURE__ */ jsx42(Clipboard, { size: 16, "aria-hidden": true })
|
|
2553
2683
|
}
|
|
2554
2684
|
)
|
|
2555
2685
|
] })
|
|
2556
2686
|
] })
|
|
2557
2687
|
] }),
|
|
2558
|
-
note && /* @__PURE__ */
|
|
2688
|
+
note && /* @__PURE__ */ jsx42("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
2559
2689
|
]
|
|
2560
2690
|
}
|
|
2561
2691
|
),
|
|
2562
|
-
onAskAi && /* @__PURE__ */
|
|
2692
|
+
onAskAi && /* @__PURE__ */ jsx42(
|
|
2563
2693
|
Button,
|
|
2564
2694
|
{
|
|
2565
2695
|
type: "button",
|
|
@@ -2568,7 +2698,7 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2568
2698
|
"aria-label": "Ask AI",
|
|
2569
2699
|
onClick: onAskAi,
|
|
2570
2700
|
className: "shrink-0 opacity-0 transition-opacity group-hover/editor:opacity-100 group-focus-within/editor:opacity-100 focus-visible:opacity-100",
|
|
2571
|
-
children: /* @__PURE__ */
|
|
2701
|
+
children: /* @__PURE__ */ jsx42(Sparkle2, { size: 16, "aria-hidden": true })
|
|
2572
2702
|
}
|
|
2573
2703
|
)
|
|
2574
2704
|
]
|
|
@@ -2579,14 +2709,14 @@ var QuestionEditorCard = React40.forwardRef(
|
|
|
2579
2709
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
2580
2710
|
|
|
2581
2711
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
2582
|
-
import * as
|
|
2712
|
+
import * as React43 from "react";
|
|
2583
2713
|
import { DotsSixVertical as DotsSixVertical2, Warning as Warning2 } from "@phosphor-icons/react";
|
|
2584
2714
|
import { Slot as Slot3 } from "radix-ui";
|
|
2585
2715
|
|
|
2586
2716
|
// src/components/Question Types/QuestionTypeIcon.tsx
|
|
2587
2717
|
import "react";
|
|
2588
2718
|
import { ChatsCircle, CheckSquare, FileArrowUp, ListNumbers, RadioButton, StarHalf } from "@phosphor-icons/react";
|
|
2589
|
-
import { jsx as
|
|
2719
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
2590
2720
|
var icons = {
|
|
2591
2721
|
"select-one": RadioButton,
|
|
2592
2722
|
"select-multiple": CheckSquare,
|
|
@@ -2597,15 +2727,15 @@ var icons = {
|
|
|
2597
2727
|
};
|
|
2598
2728
|
function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
2599
2729
|
const Icon = icons[type];
|
|
2600
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ jsx43(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
2601
2731
|
}
|
|
2602
2732
|
|
|
2603
2733
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
2604
|
-
import { jsx as
|
|
2605
|
-
var QuestionNavItem =
|
|
2734
|
+
import { jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
2735
|
+
var QuestionNavItem = React43.forwardRef(
|
|
2606
2736
|
({ className, questionType = "select-one", selected, error, asChild, children, ...props }, ref) => {
|
|
2607
2737
|
const Comp = asChild ? Slot3.Root : "button";
|
|
2608
|
-
return /* @__PURE__ */
|
|
2738
|
+
return /* @__PURE__ */ jsxs30(
|
|
2609
2739
|
Comp,
|
|
2610
2740
|
{
|
|
2611
2741
|
ref,
|
|
@@ -2621,12 +2751,12 @@ var QuestionNavItem = React42.forwardRef(
|
|
|
2621
2751
|
),
|
|
2622
2752
|
...props,
|
|
2623
2753
|
children: [
|
|
2624
|
-
/* @__PURE__ */
|
|
2625
|
-
/* @__PURE__ */
|
|
2626
|
-
/* @__PURE__ */
|
|
2754
|
+
/* @__PURE__ */ jsxs30("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
2755
|
+
/* @__PURE__ */ jsx44(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block" }),
|
|
2756
|
+
/* @__PURE__ */ jsx44("span", { className: "group-hover/nav:hidden", children: error ? /* @__PURE__ */ jsx44(Warning2, { size: 16, className: "text-destructive" }) : /* @__PURE__ */ jsx44(QuestionTypeIcon, { type: questionType, size: 16 }) })
|
|
2627
2757
|
] }),
|
|
2628
|
-
/* @__PURE__ */
|
|
2629
|
-
error && /* @__PURE__ */
|
|
2758
|
+
/* @__PURE__ */ jsx44("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
2759
|
+
error && /* @__PURE__ */ jsx44("span", { className: "sr-only", children: ", has errors" })
|
|
2630
2760
|
]
|
|
2631
2761
|
}
|
|
2632
2762
|
);
|
|
@@ -2635,14 +2765,14 @@ var QuestionNavItem = React42.forwardRef(
|
|
|
2635
2765
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
2636
2766
|
|
|
2637
2767
|
// src/components/Question Types/QuestionOption.tsx
|
|
2638
|
-
import * as
|
|
2768
|
+
import * as React44 from "react";
|
|
2639
2769
|
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash4 } from "@phosphor-icons/react";
|
|
2640
|
-
import { jsx as
|
|
2770
|
+
import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2641
2771
|
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:border-input hover:bg-accent-soft hover:shadow-md has-[[data-state=checked]]:border-accent-foreground has-[[data-state=checked]]:hover:border-accent-foreground has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50";
|
|
2642
2772
|
function QuestionOption(props) {
|
|
2643
|
-
const id =
|
|
2644
|
-
return /* @__PURE__ */
|
|
2645
|
-
props.kind === "checkbox" ? /* @__PURE__ */
|
|
2773
|
+
const id = React44.useId();
|
|
2774
|
+
return /* @__PURE__ */ jsxs31("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
2775
|
+
props.kind === "checkbox" ? /* @__PURE__ */ jsx45(
|
|
2646
2776
|
Checkbox,
|
|
2647
2777
|
{
|
|
2648
2778
|
id,
|
|
@@ -2651,16 +2781,16 @@ function QuestionOption(props) {
|
|
|
2651
2781
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
2652
2782
|
disabled: props.disabled
|
|
2653
2783
|
}
|
|
2654
|
-
) : /* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2784
|
+
) : /* @__PURE__ */ jsx45(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
2785
|
+
/* @__PURE__ */ jsx45("span", { className: "min-w-0 flex-1", children: props.label })
|
|
2656
2786
|
] });
|
|
2657
2787
|
}
|
|
2658
|
-
var QuestionOtherOption =
|
|
2788
|
+
var QuestionOtherOption = React44.forwardRef(
|
|
2659
2789
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
2660
|
-
const inner =
|
|
2661
|
-
|
|
2790
|
+
const inner = React44.useRef(null);
|
|
2791
|
+
React44.useImperativeHandle(ref, () => inner.current);
|
|
2662
2792
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
2663
|
-
return /* @__PURE__ */
|
|
2793
|
+
return /* @__PURE__ */ jsxs31(
|
|
2664
2794
|
"div",
|
|
2665
2795
|
{
|
|
2666
2796
|
className: cn(
|
|
@@ -2668,7 +2798,7 @@ var QuestionOtherOption = React43.forwardRef(
|
|
|
2668
2798
|
className
|
|
2669
2799
|
),
|
|
2670
2800
|
children: [
|
|
2671
|
-
/* @__PURE__ */
|
|
2801
|
+
/* @__PURE__ */ jsx45(
|
|
2672
2802
|
"input",
|
|
2673
2803
|
{
|
|
2674
2804
|
ref: inner,
|
|
@@ -2684,7 +2814,7 @@ var QuestionOtherOption = React43.forwardRef(
|
|
|
2684
2814
|
...props
|
|
2685
2815
|
}
|
|
2686
2816
|
),
|
|
2687
|
-
/* @__PURE__ */
|
|
2817
|
+
/* @__PURE__ */ jsx45(Button, { type: "button", variant: "subtle", size: "icon-sm", "aria-label": confirmLabel, onClick: submit, children: /* @__PURE__ */ jsx45(Check4, { size: 16, "aria-hidden": true }) })
|
|
2688
2818
|
]
|
|
2689
2819
|
}
|
|
2690
2820
|
);
|
|
@@ -2692,10 +2822,10 @@ var QuestionOtherOption = React43.forwardRef(
|
|
|
2692
2822
|
);
|
|
2693
2823
|
QuestionOtherOption.displayName = "QuestionOtherOption";
|
|
2694
2824
|
function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className }) {
|
|
2695
|
-
return /* @__PURE__ */
|
|
2696
|
-
/* @__PURE__ */
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
2825
|
+
return /* @__PURE__ */ jsxs31("div", { className: cn("flex w-full items-center gap-2", className), children: [
|
|
2826
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex h-11.5 min-w-0 flex-1 items-center gap-2 rounded-md border border-border bg-surface px-4 py-2 focus-within:border-input-accent hover:border-input hover:shadow-md", children: [
|
|
2827
|
+
/* @__PURE__ */ jsx45(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" }),
|
|
2828
|
+
/* @__PURE__ */ jsx45(
|
|
2699
2829
|
"input",
|
|
2700
2830
|
{
|
|
2701
2831
|
"aria-label": "Option label",
|
|
@@ -2705,15 +2835,15 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
|
|
|
2705
2835
|
}
|
|
2706
2836
|
)
|
|
2707
2837
|
] }),
|
|
2708
|
-
/* @__PURE__ */
|
|
2709
|
-
/* @__PURE__ */
|
|
2838
|
+
/* @__PURE__ */ jsx45(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", onClick: onRemove, children: /* @__PURE__ */ jsx45(Trash4, { size: 16, "aria-hidden": true }) }),
|
|
2839
|
+
/* @__PURE__ */ jsx45(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", onClick: onAdd, children: /* @__PURE__ */ jsx45(Plus4, { size: 16, "aria-hidden": true }) })
|
|
2710
2840
|
] });
|
|
2711
2841
|
}
|
|
2712
2842
|
|
|
2713
2843
|
// src/components/Question Types/RankList.tsx
|
|
2714
|
-
import * as
|
|
2844
|
+
import * as React45 from "react";
|
|
2715
2845
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
2716
|
-
import { Fragment as Fragment8, jsx as
|
|
2846
|
+
import { Fragment as Fragment8, jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2717
2847
|
function move(list, from, to) {
|
|
2718
2848
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
2719
2849
|
const next = list.slice();
|
|
@@ -2721,13 +2851,13 @@ function move(list, from, to) {
|
|
|
2721
2851
|
next.splice(to, 0, item);
|
|
2722
2852
|
return next;
|
|
2723
2853
|
}
|
|
2724
|
-
var RankList =
|
|
2854
|
+
var RankList = React45.forwardRef(
|
|
2725
2855
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
2726
|
-
const [dragIndex, setDragIndex] =
|
|
2727
|
-
const [announcement, setAnnouncement] =
|
|
2728
|
-
const handles =
|
|
2729
|
-
const refocus =
|
|
2730
|
-
|
|
2856
|
+
const [dragIndex, setDragIndex] = React45.useState(null);
|
|
2857
|
+
const [announcement, setAnnouncement] = React45.useState("");
|
|
2858
|
+
const handles = React45.useRef(/* @__PURE__ */ new Map());
|
|
2859
|
+
const refocus = React45.useRef(null);
|
|
2860
|
+
React45.useEffect(() => {
|
|
2731
2861
|
if (refocus.current) {
|
|
2732
2862
|
handles.current.get(refocus.current)?.focus();
|
|
2733
2863
|
refocus.current = null;
|
|
@@ -2740,8 +2870,8 @@ var RankList = React44.forwardRef(
|
|
|
2740
2870
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
2741
2871
|
onItemsChange(next);
|
|
2742
2872
|
};
|
|
2743
|
-
return /* @__PURE__ */
|
|
2744
|
-
/* @__PURE__ */
|
|
2873
|
+
return /* @__PURE__ */ jsxs32(Fragment8, { children: [
|
|
2874
|
+
/* @__PURE__ */ jsx46("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs32(
|
|
2745
2875
|
"li",
|
|
2746
2876
|
{
|
|
2747
2877
|
draggable: true,
|
|
@@ -2758,7 +2888,7 @@ var RankList = React44.forwardRef(
|
|
|
2758
2888
|
dragIndex === index && "opacity-50"
|
|
2759
2889
|
),
|
|
2760
2890
|
children: [
|
|
2761
|
-
/* @__PURE__ */
|
|
2891
|
+
/* @__PURE__ */ jsx46(
|
|
2762
2892
|
"button",
|
|
2763
2893
|
{
|
|
2764
2894
|
type: "button",
|
|
@@ -2777,10 +2907,10 @@ var RankList = React44.forwardRef(
|
|
|
2777
2907
|
}
|
|
2778
2908
|
},
|
|
2779
2909
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
2780
|
-
children: /* @__PURE__ */
|
|
2910
|
+
children: /* @__PURE__ */ jsx46(DotsSixVertical4, { size: 16, "aria-hidden": true })
|
|
2781
2911
|
}
|
|
2782
2912
|
),
|
|
2783
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsx46(
|
|
2784
2914
|
"span",
|
|
2785
2915
|
{
|
|
2786
2916
|
"aria-hidden": "true",
|
|
@@ -2788,27 +2918,27 @@ var RankList = React44.forwardRef(
|
|
|
2788
2918
|
children: index + 1
|
|
2789
2919
|
}
|
|
2790
2920
|
),
|
|
2791
|
-
/* @__PURE__ */
|
|
2921
|
+
/* @__PURE__ */ jsx46("span", { className: "min-w-0 flex-1", children: item.label })
|
|
2792
2922
|
]
|
|
2793
2923
|
},
|
|
2794
2924
|
item.id
|
|
2795
2925
|
)) }),
|
|
2796
|
-
/* @__PURE__ */
|
|
2926
|
+
/* @__PURE__ */ jsx46("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
2797
2927
|
] });
|
|
2798
2928
|
}
|
|
2799
2929
|
);
|
|
2800
2930
|
RankList.displayName = "RankList";
|
|
2801
2931
|
|
|
2802
2932
|
// src/components/Question Types/RatingScale.tsx
|
|
2803
|
-
import * as
|
|
2933
|
+
import * as React46 from "react";
|
|
2804
2934
|
import { ToggleGroup as ToggleGroupPrimitive3 } from "radix-ui";
|
|
2805
|
-
import { jsx as
|
|
2806
|
-
var RatingScale =
|
|
2935
|
+
import { jsx as jsx47, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
2936
|
+
var RatingScale = React46.forwardRef(
|
|
2807
2937
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
2808
|
-
const [internal, setInternal] =
|
|
2938
|
+
const [internal, setInternal] = React46.useState(defaultValue);
|
|
2809
2939
|
const current = value !== void 0 ? value : internal;
|
|
2810
|
-
return /* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2940
|
+
return /* @__PURE__ */ jsxs33("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
2941
|
+
/* @__PURE__ */ jsx47(
|
|
2812
2942
|
ToggleGroupPrimitive3.Root,
|
|
2813
2943
|
{
|
|
2814
2944
|
ref,
|
|
@@ -2821,7 +2951,7 @@ var RatingScale = React45.forwardRef(
|
|
|
2821
2951
|
},
|
|
2822
2952
|
className: "flex gap-2",
|
|
2823
2953
|
...props,
|
|
2824
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */
|
|
2954
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsx47(
|
|
2825
2955
|
ToggleGroupPrimitive3.Item,
|
|
2826
2956
|
{
|
|
2827
2957
|
value: String(n),
|
|
@@ -2837,9 +2967,9 @@ var RatingScale = React45.forwardRef(
|
|
|
2837
2967
|
))
|
|
2838
2968
|
}
|
|
2839
2969
|
),
|
|
2840
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */
|
|
2841
|
-
/* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
2970
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ jsxs33("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
2971
|
+
/* @__PURE__ */ jsx47("span", { children: lowLabel }),
|
|
2972
|
+
/* @__PURE__ */ jsx47("span", { children: highLabel })
|
|
2843
2973
|
] })
|
|
2844
2974
|
] });
|
|
2845
2975
|
}
|
|
@@ -2847,27 +2977,27 @@ var RatingScale = React45.forwardRef(
|
|
|
2847
2977
|
RatingScale.displayName = "RatingScale";
|
|
2848
2978
|
|
|
2849
2979
|
// src/components/Data Display/Progress.tsx
|
|
2850
|
-
import * as
|
|
2980
|
+
import * as React47 from "react";
|
|
2851
2981
|
import { Progress as ProgressPrimitive2 } from "radix-ui";
|
|
2852
|
-
import { jsx as
|
|
2853
|
-
var Progress =
|
|
2982
|
+
import { jsx as jsx48, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
2983
|
+
var Progress = React47.forwardRef(
|
|
2854
2984
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
2855
2985
|
const hasHeader = label != null || valueLabel != null;
|
|
2856
2986
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
2857
2987
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
2858
|
-
return /* @__PURE__ */
|
|
2859
|
-
hasHeader && /* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */
|
|
2988
|
+
return /* @__PURE__ */ jsxs34("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
2989
|
+
hasHeader && /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
2990
|
+
/* @__PURE__ */ jsx48("span", { children: label }),
|
|
2991
|
+
/* @__PURE__ */ jsx48("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
2862
2992
|
] }),
|
|
2863
|
-
/* @__PURE__ */
|
|
2993
|
+
/* @__PURE__ */ jsx48(
|
|
2864
2994
|
ProgressPrimitive2.Root,
|
|
2865
2995
|
{
|
|
2866
2996
|
ref,
|
|
2867
2997
|
value: clamped,
|
|
2868
2998
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
2869
2999
|
...props,
|
|
2870
|
-
children: /* @__PURE__ */
|
|
3000
|
+
children: /* @__PURE__ */ jsx48(
|
|
2871
3001
|
ProgressPrimitive2.Indicator,
|
|
2872
3002
|
{
|
|
2873
3003
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -2876,9 +3006,9 @@ var Progress = React46.forwardRef(
|
|
|
2876
3006
|
)
|
|
2877
3007
|
}
|
|
2878
3008
|
),
|
|
2879
|
-
hasDetails && /* @__PURE__ */
|
|
2880
|
-
/* @__PURE__ */
|
|
2881
|
-
/* @__PURE__ */
|
|
3009
|
+
hasDetails && /* @__PURE__ */ jsxs34("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3010
|
+
/* @__PURE__ */ jsx48("span", { children: detailsStart }),
|
|
3011
|
+
/* @__PURE__ */ jsx48("span", { children: detailsEnd })
|
|
2882
3012
|
] })
|
|
2883
3013
|
] });
|
|
2884
3014
|
}
|
|
@@ -2886,11 +3016,11 @@ var Progress = React46.forwardRef(
|
|
|
2886
3016
|
Progress.displayName = "Progress";
|
|
2887
3017
|
|
|
2888
3018
|
// src/components/Data Display/Table.tsx
|
|
2889
|
-
import * as
|
|
3019
|
+
import * as React48 from "react";
|
|
2890
3020
|
import { CaretDown as CaretDown4, CaretUp } from "@phosphor-icons/react";
|
|
2891
|
-
import { jsx as
|
|
2892
|
-
var Table =
|
|
2893
|
-
({ className, containerClassName, striped, ...props }, ref) => /* @__PURE__ */
|
|
3021
|
+
import { jsx as jsx49, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3022
|
+
var Table = React48.forwardRef(
|
|
3023
|
+
({ className, containerClassName, striped, ...props }, ref) => /* @__PURE__ */ jsx49("div", { className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ jsx49(
|
|
2894
3024
|
"table",
|
|
2895
3025
|
{
|
|
2896
3026
|
ref,
|
|
@@ -2901,16 +3031,16 @@ var Table = React47.forwardRef(
|
|
|
2901
3031
|
) })
|
|
2902
3032
|
);
|
|
2903
3033
|
Table.displayName = "Table";
|
|
2904
|
-
var TableHeader =
|
|
2905
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3034
|
+
var TableHeader = React48.forwardRef(
|
|
3035
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx49("thead", { ref, className, ...props })
|
|
2906
3036
|
);
|
|
2907
3037
|
TableHeader.displayName = "TableHeader";
|
|
2908
|
-
var TableBody =
|
|
2909
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3038
|
+
var TableBody = React48.forwardRef(
|
|
3039
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx49("tbody", { ref, className, ...props })
|
|
2910
3040
|
);
|
|
2911
3041
|
TableBody.displayName = "TableBody";
|
|
2912
|
-
var TableRow =
|
|
2913
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */
|
|
3042
|
+
var TableRow = React48.forwardRef(
|
|
3043
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ jsx49(
|
|
2914
3044
|
"tr",
|
|
2915
3045
|
{
|
|
2916
3046
|
ref,
|
|
@@ -2927,10 +3057,10 @@ var TableRow = React47.forwardRef(
|
|
|
2927
3057
|
);
|
|
2928
3058
|
TableRow.displayName = "TableRow";
|
|
2929
3059
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
2930
|
-
var TableHead =
|
|
3060
|
+
var TableHead = React48.forwardRef(
|
|
2931
3061
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, children, ...props }, ref) => {
|
|
2932
|
-
const caret = sort === "asc" ? /* @__PURE__ */
|
|
2933
|
-
return /* @__PURE__ */
|
|
3062
|
+
const caret = sort === "asc" ? /* @__PURE__ */ jsx49(CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ jsx49(CaretDown4, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
3063
|
+
return /* @__PURE__ */ jsx49(
|
|
2934
3064
|
"th",
|
|
2935
3065
|
{
|
|
2936
3066
|
ref,
|
|
@@ -2943,7 +3073,7 @@ var TableHead = React47.forwardRef(
|
|
|
2943
3073
|
className
|
|
2944
3074
|
),
|
|
2945
3075
|
...props,
|
|
2946
|
-
children: sortable ? /* @__PURE__ */
|
|
3076
|
+
children: sortable ? /* @__PURE__ */ jsxs35(
|
|
2947
3077
|
"button",
|
|
2948
3078
|
{
|
|
2949
3079
|
type: "button",
|
|
@@ -2954,14 +3084,14 @@ var TableHead = React47.forwardRef(
|
|
|
2954
3084
|
caret
|
|
2955
3085
|
]
|
|
2956
3086
|
}
|
|
2957
|
-
) : checkbox ? /* @__PURE__ */
|
|
3087
|
+
) : checkbox ? /* @__PURE__ */ jsx49("div", { className: "flex items-center justify-center", children }) : children
|
|
2958
3088
|
}
|
|
2959
3089
|
);
|
|
2960
3090
|
}
|
|
2961
3091
|
);
|
|
2962
3092
|
TableHead.displayName = "TableHead";
|
|
2963
|
-
var TableCell =
|
|
2964
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */
|
|
3093
|
+
var TableCell = React48.forwardRef(
|
|
3094
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ jsx49(
|
|
2965
3095
|
"td",
|
|
2966
3096
|
{
|
|
2967
3097
|
ref,
|
|
@@ -2974,25 +3104,25 @@ var TableCell = React47.forwardRef(
|
|
|
2974
3104
|
className
|
|
2975
3105
|
),
|
|
2976
3106
|
...props,
|
|
2977
|
-
children: checkbox ? /* @__PURE__ */
|
|
3107
|
+
children: checkbox ? /* @__PURE__ */ jsx49("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ jsx49("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
2978
3108
|
}
|
|
2979
3109
|
)
|
|
2980
3110
|
);
|
|
2981
3111
|
TableCell.displayName = "TableCell";
|
|
2982
3112
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
2983
|
-
return /* @__PURE__ */
|
|
3113
|
+
return /* @__PURE__ */ jsxs35("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
2984
3114
|
avatar,
|
|
2985
|
-
/* @__PURE__ */
|
|
2986
|
-
/* @__PURE__ */
|
|
2987
|
-
secondary && /* @__PURE__ */
|
|
3115
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
3116
|
+
/* @__PURE__ */ jsx49("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
3117
|
+
secondary && /* @__PURE__ */ jsx49("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
2988
3118
|
] })
|
|
2989
3119
|
] });
|
|
2990
3120
|
}
|
|
2991
3121
|
|
|
2992
3122
|
// src/components/Data Display/StatCard.tsx
|
|
2993
|
-
import * as
|
|
3123
|
+
import * as React49 from "react";
|
|
2994
3124
|
import { cva as cva6 } from "class-variance-authority";
|
|
2995
|
-
import { jsx as
|
|
3125
|
+
import { jsx as jsx50, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
2996
3126
|
var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
2997
3127
|
variants: {
|
|
2998
3128
|
variant: {
|
|
@@ -3002,11 +3132,11 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
3002
3132
|
},
|
|
3003
3133
|
defaultVariants: { variant: "default" }
|
|
3004
3134
|
});
|
|
3005
|
-
var StatCard =
|
|
3006
|
-
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */
|
|
3007
|
-
/* @__PURE__ */
|
|
3008
|
-
/* @__PURE__ */
|
|
3009
|
-
icon && /* @__PURE__ */
|
|
3135
|
+
var StatCard = React49.forwardRef(
|
|
3136
|
+
({ className, variant, label, value, icon, ...props }, ref) => /* @__PURE__ */ jsxs36("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
3137
|
+
/* @__PURE__ */ jsx50("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
3138
|
+
/* @__PURE__ */ jsxs36("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
3139
|
+
icon && /* @__PURE__ */ jsx50("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
3010
3140
|
value
|
|
3011
3141
|
] })
|
|
3012
3142
|
] })
|
|
@@ -3014,13 +3144,13 @@ var StatCard = React48.forwardRef(
|
|
|
3014
3144
|
StatCard.displayName = "StatCard";
|
|
3015
3145
|
|
|
3016
3146
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3017
|
-
import * as
|
|
3147
|
+
import * as React51 from "react";
|
|
3018
3148
|
|
|
3019
3149
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
3020
|
-
import * as
|
|
3150
|
+
import * as React50 from "react";
|
|
3021
3151
|
import { Crown, Plus as Plus5, X as X6 } from "@phosphor-icons/react";
|
|
3022
3152
|
import { cva as cva7 } from "class-variance-authority";
|
|
3023
|
-
import { jsx as
|
|
3153
|
+
import { jsx as jsx51, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3024
3154
|
var editableTagVariants = cva7(
|
|
3025
3155
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3026
3156
|
{
|
|
@@ -3035,27 +3165,27 @@ var editableTagVariants = cva7(
|
|
|
3035
3165
|
defaultVariants: { type: "default" }
|
|
3036
3166
|
}
|
|
3037
3167
|
);
|
|
3038
|
-
var EditableTag =
|
|
3168
|
+
var EditableTag = React50.forwardRef(
|
|
3039
3169
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
3040
3170
|
const classes = cn(editableTagVariants({ type }), className);
|
|
3041
|
-
const leading = type === "add" ? /* @__PURE__ */
|
|
3171
|
+
const leading = type === "add" ? /* @__PURE__ */ jsx51(Plus5, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ jsx51(Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
3042
3172
|
if (type === "add" || type === "multiple" && onClick) {
|
|
3043
|
-
return /* @__PURE__ */
|
|
3173
|
+
return /* @__PURE__ */ jsxs37("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
3044
3174
|
leading,
|
|
3045
3175
|
children
|
|
3046
3176
|
] });
|
|
3047
3177
|
}
|
|
3048
|
-
return /* @__PURE__ */
|
|
3178
|
+
return /* @__PURE__ */ jsxs37("span", { ref, className: classes, ...props, children: [
|
|
3049
3179
|
leading,
|
|
3050
3180
|
children,
|
|
3051
|
-
onRemove && /* @__PURE__ */
|
|
3181
|
+
onRemove && /* @__PURE__ */ jsx51(
|
|
3052
3182
|
"button",
|
|
3053
3183
|
{
|
|
3054
3184
|
type: "button",
|
|
3055
3185
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
3056
3186
|
onClick: onRemove,
|
|
3057
3187
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
3058
|
-
children: /* @__PURE__ */
|
|
3188
|
+
children: /* @__PURE__ */ jsx51(X6, { size: 12, "aria-hidden": true })
|
|
3059
3189
|
}
|
|
3060
3190
|
)
|
|
3061
3191
|
] });
|
|
@@ -3064,23 +3194,23 @@ var EditableTag = React49.forwardRef(
|
|
|
3064
3194
|
EditableTag.displayName = "EditableTag";
|
|
3065
3195
|
|
|
3066
3196
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
3067
|
-
import { jsx as
|
|
3068
|
-
var ActivityStructure =
|
|
3069
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", ...props }, ref) => /* @__PURE__ */
|
|
3197
|
+
import { jsx as jsx52, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3198
|
+
var ActivityStructure = React51.forwardRef(
|
|
3199
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", ...props }, ref) => /* @__PURE__ */ jsxs38(
|
|
3070
3200
|
"section",
|
|
3071
3201
|
{
|
|
3072
3202
|
ref,
|
|
3073
3203
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-2xl border border-border bg-surface p-4", className),
|
|
3074
3204
|
...props,
|
|
3075
3205
|
children: [
|
|
3076
|
-
/* @__PURE__ */
|
|
3077
|
-
/* @__PURE__ */
|
|
3078
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */
|
|
3079
|
-
/* @__PURE__ */
|
|
3080
|
-
/* @__PURE__ */
|
|
3081
|
-
(tags?.length || onAddTag) && /* @__PURE__ */
|
|
3082
|
-
tags?.map((tag) => /* @__PURE__ */
|
|
3083
|
-
onAddTag && /* @__PURE__ */
|
|
3206
|
+
/* @__PURE__ */ jsx52("h3", { className: "text-heading-h3 text-surface-foreground", children: title }),
|
|
3207
|
+
/* @__PURE__ */ jsx52("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx52(StatCard, { ...stat }, id)) }),
|
|
3208
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-2", children: [
|
|
3209
|
+
/* @__PURE__ */ jsx52("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
3210
|
+
/* @__PURE__ */ jsx52("p", { className: "text-body-base text-surface-foreground", children: body }),
|
|
3211
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ jsxs38("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3212
|
+
tags?.map((tag) => /* @__PURE__ */ jsx52(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
3213
|
+
onAddTag && /* @__PURE__ */ jsx52(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
3084
3214
|
] })
|
|
3085
3215
|
] }, id))
|
|
3086
3216
|
]
|
|
@@ -3089,11 +3219,11 @@ var ActivityStructure = React50.forwardRef(
|
|
|
3089
3219
|
);
|
|
3090
3220
|
ActivityStructure.displayName = "ActivityStructure";
|
|
3091
3221
|
|
|
3092
|
-
// src/components/Tags & Badges/
|
|
3093
|
-
import * as
|
|
3222
|
+
// src/components/Tags & Badges/Badge.tsx
|
|
3223
|
+
import * as React52 from "react";
|
|
3094
3224
|
import { DotsSixVertical as DotsSixVertical5, RadioButton as RadioButton2 } from "@phosphor-icons/react";
|
|
3095
3225
|
import { cva as cva8 } from "class-variance-authority";
|
|
3096
|
-
import { jsx as
|
|
3226
|
+
import { jsx as jsx53, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3097
3227
|
var roleTagVariants = cva8(
|
|
3098
3228
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
3099
3229
|
{
|
|
@@ -3102,7 +3232,9 @@ var roleTagVariants = cva8(
|
|
|
3102
3232
|
primary: "bg-primary-soft px-2.5 text-primary-soft-foreground",
|
|
3103
3233
|
secondary: "bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 px-2.5 text-secondary-muted-foreground",
|
|
3104
3234
|
question: "gap-1 bg-primary-soft pl-1 pr-2.5 text-plum-500",
|
|
3105
|
-
interactable: "gap-1 pl-2.5 pr-2.5 hover:pl-1"
|
|
3235
|
+
interactable: "gap-1 pl-2.5 pr-2.5 hover:pl-1",
|
|
3236
|
+
id: "gap-1 bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 px-2.5 tabular-nums text-surface-foreground",
|
|
3237
|
+
count: "min-w-6 justify-center rounded-full bg-secondary bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 px-2 tabular-nums text-surface-foreground"
|
|
3106
3238
|
},
|
|
3107
3239
|
selected: { true: "", false: "" }
|
|
3108
3240
|
},
|
|
@@ -3117,11 +3249,11 @@ var roleTagVariants = cva8(
|
|
|
3117
3249
|
defaultVariants: { type: "primary", selected: false }
|
|
3118
3250
|
}
|
|
3119
3251
|
);
|
|
3120
|
-
var
|
|
3252
|
+
var Badge = React52.forwardRef(
|
|
3121
3253
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
3122
3254
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
3123
3255
|
if (type === "interactable") {
|
|
3124
|
-
return /* @__PURE__ */
|
|
3256
|
+
return /* @__PURE__ */ jsxs39(
|
|
3125
3257
|
"button",
|
|
3126
3258
|
{
|
|
3127
3259
|
ref,
|
|
@@ -3131,24 +3263,25 @@ var RoleTag = React51.forwardRef(
|
|
|
3131
3263
|
onClick,
|
|
3132
3264
|
...props,
|
|
3133
3265
|
children: [
|
|
3134
|
-
/* @__PURE__ */
|
|
3266
|
+
/* @__PURE__ */ jsx53(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
3135
3267
|
children
|
|
3136
3268
|
]
|
|
3137
3269
|
}
|
|
3138
3270
|
);
|
|
3139
3271
|
}
|
|
3140
|
-
return /* @__PURE__ */
|
|
3141
|
-
type === "question" && /* @__PURE__ */
|
|
3272
|
+
return /* @__PURE__ */ jsxs39("span", { ref, className: classes, ...props, children: [
|
|
3273
|
+
type === "question" && /* @__PURE__ */ jsx53(RadioButton2, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
3274
|
+
type === "id" && /* @__PURE__ */ jsx53("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
3142
3275
|
children
|
|
3143
3276
|
] });
|
|
3144
3277
|
}
|
|
3145
3278
|
);
|
|
3146
|
-
|
|
3279
|
+
Badge.displayName = "Badge";
|
|
3147
3280
|
|
|
3148
3281
|
// src/components/Utility/Pagination.tsx
|
|
3149
|
-
import * as
|
|
3282
|
+
import * as React53 from "react";
|
|
3150
3283
|
import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
|
|
3151
|
-
import { jsx as
|
|
3284
|
+
import { jsx as jsx54, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3152
3285
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
3153
3286
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
3154
3287
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -3162,10 +3295,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
3162
3295
|
});
|
|
3163
3296
|
return items;
|
|
3164
3297
|
}
|
|
3165
|
-
var Pagination =
|
|
3298
|
+
var Pagination = React53.forwardRef(
|
|
3166
3299
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
3167
3300
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
3168
|
-
const previous = /* @__PURE__ */
|
|
3301
|
+
const previous = /* @__PURE__ */ jsx54(
|
|
3169
3302
|
Button,
|
|
3170
3303
|
{
|
|
3171
3304
|
type: "button",
|
|
@@ -3174,10 +3307,10 @@ var Pagination = React52.forwardRef(
|
|
|
3174
3307
|
"aria-label": "Previous page",
|
|
3175
3308
|
disabled: page <= 1,
|
|
3176
3309
|
onClick: () => go(page - 1),
|
|
3177
|
-
children: /* @__PURE__ */
|
|
3310
|
+
children: /* @__PURE__ */ jsx54(ArrowLeft, { size: 16, "aria-hidden": true })
|
|
3178
3311
|
}
|
|
3179
3312
|
);
|
|
3180
|
-
const next = /* @__PURE__ */
|
|
3313
|
+
const next = /* @__PURE__ */ jsx54(
|
|
3181
3314
|
Button,
|
|
3182
3315
|
{
|
|
3183
3316
|
type: "button",
|
|
@@ -3186,10 +3319,10 @@ var Pagination = React52.forwardRef(
|
|
|
3186
3319
|
"aria-label": "Next page",
|
|
3187
3320
|
disabled: page >= pageCount,
|
|
3188
3321
|
onClick: () => go(page + 1),
|
|
3189
|
-
children: /* @__PURE__ */
|
|
3322
|
+
children: /* @__PURE__ */ jsx54(ArrowRight, { size: 16, "aria-hidden": true })
|
|
3190
3323
|
}
|
|
3191
3324
|
);
|
|
3192
|
-
return /* @__PURE__ */
|
|
3325
|
+
return /* @__PURE__ */ jsxs40(
|
|
3193
3326
|
"nav",
|
|
3194
3327
|
{
|
|
3195
3328
|
ref,
|
|
@@ -3198,14 +3331,14 @@ var Pagination = React52.forwardRef(
|
|
|
3198
3331
|
...props,
|
|
3199
3332
|
children: [
|
|
3200
3333
|
previous,
|
|
3201
|
-
variant === "compact" ? /* @__PURE__ */
|
|
3334
|
+
variant === "compact" ? /* @__PURE__ */ jsxs40("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
3202
3335
|
page,
|
|
3203
3336
|
"/",
|
|
3204
3337
|
pageCount
|
|
3205
|
-
] }) : /* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3208
|
-
] }) : /* @__PURE__ */
|
|
3338
|
+
] }) : /* @__PURE__ */ jsx54("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ jsx54("li", { children: item === "ellipsis" ? /* @__PURE__ */ jsxs40("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
3339
|
+
/* @__PURE__ */ jsx54(DotsThree2, { size: 16, "aria-hidden": true }),
|
|
3340
|
+
/* @__PURE__ */ jsx54("span", { className: "sr-only", children: "More pages" })
|
|
3341
|
+
] }) : /* @__PURE__ */ jsx54(
|
|
3209
3342
|
Button,
|
|
3210
3343
|
{
|
|
3211
3344
|
type: "button",
|
|
@@ -3230,6 +3363,7 @@ export {
|
|
|
3230
3363
|
ActivityStructure,
|
|
3231
3364
|
AskAiInput,
|
|
3232
3365
|
AskAiToggle,
|
|
3366
|
+
Badge,
|
|
3233
3367
|
Button,
|
|
3234
3368
|
Calendar,
|
|
3235
3369
|
ChatChoices,
|
|
@@ -3275,6 +3409,7 @@ export {
|
|
|
3275
3409
|
FormMessage,
|
|
3276
3410
|
ImagePreview,
|
|
3277
3411
|
ImageThumbnails,
|
|
3412
|
+
InlineEdit,
|
|
3278
3413
|
Input,
|
|
3279
3414
|
InputWithAction,
|
|
3280
3415
|
Label,
|
|
@@ -3297,7 +3432,6 @@ export {
|
|
|
3297
3432
|
RadioGroupItem,
|
|
3298
3433
|
RankList,
|
|
3299
3434
|
RatingScale,
|
|
3300
|
-
RoleTag,
|
|
3301
3435
|
SearchBar,
|
|
3302
3436
|
Select,
|
|
3303
3437
|
SelectContent,
|