@discuss-ds/ui 0.19.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +114 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +128 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -335,6 +335,22 @@ interface InlineEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
|
|
|
335
335
|
/** Use a textarea. Enter inserts a line break; Cmd/Ctrl+Enter commits. */
|
|
336
336
|
multiline?: boolean;
|
|
337
337
|
maxLength?: number;
|
|
338
|
+
/**
|
|
339
|
+
* Shortest value (in characters, ignoring surrounding spaces) that may be saved. An edit that is too short is not saved:
|
|
340
|
+
* the field stays open with an error message, and Escape still reverts.
|
|
341
|
+
*/
|
|
342
|
+
minLength?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Checks an edit before it is saved (on Enter or blur). Return a message to refuse it: the field stays open showing the
|
|
345
|
+
* message and `onValueChange` is not called. Return nothing (or `null`) to accept. Runs after `minLength`.
|
|
346
|
+
*/
|
|
347
|
+
validate?: (value: string) => string | null | undefined;
|
|
348
|
+
/**
|
|
349
|
+
* While editing, shows the allowed length under the field (from `minLength` and `maxLength`) with a live character
|
|
350
|
+
* counter. After a refused save the same line turns into the error state (error colour and icon) instead of a
|
|
351
|
+
* different message appears.
|
|
352
|
+
*/
|
|
353
|
+
showLimits?: boolean;
|
|
338
354
|
disabled?: boolean;
|
|
339
355
|
/** Called when editing starts or ends. */
|
|
340
356
|
onEditingChange?: (editing: boolean) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -335,6 +335,22 @@ interface InlineEditProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'on
|
|
|
335
335
|
/** Use a textarea. Enter inserts a line break; Cmd/Ctrl+Enter commits. */
|
|
336
336
|
multiline?: boolean;
|
|
337
337
|
maxLength?: number;
|
|
338
|
+
/**
|
|
339
|
+
* Shortest value (in characters, ignoring surrounding spaces) that may be saved. An edit that is too short is not saved:
|
|
340
|
+
* the field stays open with an error message, and Escape still reverts.
|
|
341
|
+
*/
|
|
342
|
+
minLength?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Checks an edit before it is saved (on Enter or blur). Return a message to refuse it: the field stays open showing the
|
|
345
|
+
* message and `onValueChange` is not called. Return nothing (or `null`) to accept. Runs after `minLength`.
|
|
346
|
+
*/
|
|
347
|
+
validate?: (value: string) => string | null | undefined;
|
|
348
|
+
/**
|
|
349
|
+
* While editing, shows the allowed length under the field (from `minLength` and `maxLength`) with a live character
|
|
350
|
+
* counter. After a refused save the same line turns into the error state (error colour and icon) instead of a
|
|
351
|
+
* different message appears.
|
|
352
|
+
*/
|
|
353
|
+
showLimits?: boolean;
|
|
338
354
|
disabled?: boolean;
|
|
339
355
|
/** Called when editing starts or ends. */
|
|
340
356
|
onEditingChange?: (editing: boolean) => void;
|
package/dist/index.js
CHANGED
|
@@ -1386,8 +1386,14 @@ FormMessage.displayName = "FormMessage";
|
|
|
1386
1386
|
|
|
1387
1387
|
// src/components/Forms & Data Entry/InlineEdit.tsx
|
|
1388
1388
|
import * as React24 from "react";
|
|
1389
|
-
import { PencilSimple } from "@phosphor-icons/react";
|
|
1390
|
-
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1389
|
+
import { PencilSimple, WarningCircle as WarningCircle2 } from "@phosphor-icons/react";
|
|
1390
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1391
|
+
function limitsText(min, max) {
|
|
1392
|
+
if (min !== void 0 && max !== void 0) return `${min}\u2013${max} characters`;
|
|
1393
|
+
if (min !== void 0) return `At least ${min} characters`;
|
|
1394
|
+
if (max !== void 0) return `Up to ${max} characters`;
|
|
1395
|
+
return "";
|
|
1396
|
+
}
|
|
1391
1397
|
var InlineEdit = React24.forwardRef(
|
|
1392
1398
|
({
|
|
1393
1399
|
className,
|
|
@@ -1398,6 +1404,9 @@ var InlineEdit = React24.forwardRef(
|
|
|
1398
1404
|
placeholder = "Click to edit",
|
|
1399
1405
|
multiline,
|
|
1400
1406
|
maxLength,
|
|
1407
|
+
minLength,
|
|
1408
|
+
validate,
|
|
1409
|
+
showLimits,
|
|
1401
1410
|
disabled,
|
|
1402
1411
|
onEditingChange,
|
|
1403
1412
|
onDraftChange,
|
|
@@ -1410,6 +1419,8 @@ var InlineEdit = React24.forwardRef(
|
|
|
1410
1419
|
const value = valueProp ?? internal;
|
|
1411
1420
|
const [editing, setEditing] = React24.useState(false);
|
|
1412
1421
|
const [draft, setDraft] = React24.useState(value);
|
|
1422
|
+
const [error, setError] = React24.useState(null);
|
|
1423
|
+
const errorId = React24.useId();
|
|
1413
1424
|
const fieldRef = React24.useRef(null);
|
|
1414
1425
|
const readRef = React24.useRef(null);
|
|
1415
1426
|
const cancelled = React24.useRef(false);
|
|
@@ -1423,14 +1434,29 @@ var InlineEdit = React24.forwardRef(
|
|
|
1423
1434
|
readRef.current?.focus();
|
|
1424
1435
|
}
|
|
1425
1436
|
}, [editing]);
|
|
1437
|
+
const problemWith = (text) => {
|
|
1438
|
+
if (minLength !== void 0 && text.trim().length < minLength) {
|
|
1439
|
+
return `Enter at least ${minLength} characters (${text.trim().length} now).`;
|
|
1440
|
+
}
|
|
1441
|
+
return validate?.(text) ?? null;
|
|
1442
|
+
};
|
|
1426
1443
|
const start = () => {
|
|
1427
1444
|
if (disabled) return;
|
|
1428
1445
|
setDraft(value);
|
|
1446
|
+
setError(null);
|
|
1429
1447
|
cancelled.current = false;
|
|
1430
1448
|
setEditing(true);
|
|
1431
1449
|
onEditingChange?.(true);
|
|
1432
1450
|
};
|
|
1433
1451
|
const finish = (commit, refocus) => {
|
|
1452
|
+
if (commit && draft !== value) {
|
|
1453
|
+
const problem = problemWith(draft);
|
|
1454
|
+
if (problem) {
|
|
1455
|
+
setError(problem);
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
setError(null);
|
|
1434
1460
|
restoreFocus.current = refocus;
|
|
1435
1461
|
if (commit && draft !== value) {
|
|
1436
1462
|
if (valueProp === void 0) setInternal(draft);
|
|
@@ -1443,66 +1469,99 @@ var InlineEdit = React24.forwardRef(
|
|
|
1443
1469
|
const textClasses = cn("text-ui-input-value text-surface-foreground", textClassName);
|
|
1444
1470
|
const question = variant === "question";
|
|
1445
1471
|
const fill = multiline || question;
|
|
1446
|
-
return /* @__PURE__ */ jsx25(
|
|
1447
|
-
|
|
1448
|
-
value: draft,
|
|
1449
|
-
maxLength,
|
|
1450
|
-
"aria-label": ariaLabel,
|
|
1451
|
-
...multiline ? { rows: 1 } : { type: "text" },
|
|
1452
|
-
className: cn(
|
|
1453
|
-
"w-full px-3 py-1 outline-none",
|
|
1454
|
-
multiline && "field-sizing-content resize-none",
|
|
1455
|
-
question ? "rounded-none border-0 border-b-2 border-accent-foreground bg-transparent" : cn("rounded-md focus-visible:border-input-accent", fieldSurfaceClasses("default")),
|
|
1456
|
-
textClasses
|
|
1457
|
-
),
|
|
1458
|
-
onChange: (event) => {
|
|
1459
|
-
setDraft(event.target.value);
|
|
1460
|
-
onDraftChange?.(event.target.value);
|
|
1461
|
-
},
|
|
1462
|
-
onKeyDown: (event) => {
|
|
1463
|
-
if (event.key === "Escape") {
|
|
1464
|
-
cancelled.current = true;
|
|
1465
|
-
finish(false, true);
|
|
1466
|
-
} else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || question && !event.shiftKey)) {
|
|
1467
|
-
event.preventDefault();
|
|
1468
|
-
finish(true, true);
|
|
1469
|
-
}
|
|
1470
|
-
},
|
|
1471
|
-
onBlur: () => {
|
|
1472
|
-
if (!cancelled.current) finish(true, false);
|
|
1473
|
-
}
|
|
1474
|
-
}) : /* @__PURE__ */ jsxs16(
|
|
1475
|
-
"button",
|
|
1472
|
+
return /* @__PURE__ */ jsx25(
|
|
1473
|
+
"div",
|
|
1476
1474
|
{
|
|
1477
|
-
ref
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1475
|
+
ref,
|
|
1476
|
+
className: cn(fill ? "flex w-full min-w-0" : "inline-flex min-w-0 max-w-full", editing && (error || showLimits) && "flex-col gap-1.5", className),
|
|
1477
|
+
...props,
|
|
1478
|
+
children: editing ? /* @__PURE__ */ jsxs16(Fragment4, { children: [
|
|
1479
|
+
React24.createElement(multiline ? "textarea" : "input", {
|
|
1480
|
+
ref: fieldRef,
|
|
1481
|
+
value: draft,
|
|
1482
|
+
maxLength,
|
|
1483
|
+
"aria-label": ariaLabel,
|
|
1484
|
+
"aria-invalid": error ? true : void 0,
|
|
1485
|
+
"aria-describedby": error || showLimits ? errorId : void 0,
|
|
1486
|
+
...multiline ? { rows: 1 } : { type: "text" },
|
|
1487
|
+
className: cn(
|
|
1488
|
+
"w-full px-3 py-1 outline-none",
|
|
1489
|
+
multiline && "field-sizing-content resize-none",
|
|
1490
|
+
question ? cn("rounded-none border-0 border-b-2 bg-transparent", error ? "border-destructive" : "border-accent-foreground") : cn("rounded-md", !error && "focus-visible:border-input-accent", fieldSurfaceClasses(error ? "error" : "default")),
|
|
1491
|
+
textClasses
|
|
1492
|
+
),
|
|
1493
|
+
onChange: (event) => {
|
|
1494
|
+
setDraft(event.target.value);
|
|
1495
|
+
if (error) setError(problemWith(event.target.value));
|
|
1496
|
+
onDraftChange?.(event.target.value);
|
|
1497
|
+
},
|
|
1498
|
+
onKeyDown: (event) => {
|
|
1499
|
+
if (event.key === "Escape") {
|
|
1500
|
+
cancelled.current = true;
|
|
1501
|
+
setError(null);
|
|
1502
|
+
finish(false, true);
|
|
1503
|
+
} else if (event.key === "Enter" && (!multiline || event.metaKey || event.ctrlKey || question && !event.shiftKey)) {
|
|
1504
|
+
event.preventDefault();
|
|
1505
|
+
finish(true, true);
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1508
|
+
onBlur: () => {
|
|
1509
|
+
if (!cancelled.current) finish(true, false);
|
|
1510
|
+
}
|
|
1511
|
+
}),
|
|
1512
|
+
(error || showLimits) && /* @__PURE__ */ jsxs16(
|
|
1513
|
+
"p",
|
|
1497
1514
|
{
|
|
1498
|
-
|
|
1499
|
-
"
|
|
1500
|
-
className: "
|
|
1515
|
+
id: errorId,
|
|
1516
|
+
role: error ? "alert" : void 0,
|
|
1517
|
+
className: cn("flex items-start justify-between gap-2 px-3 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
1518
|
+
children: [
|
|
1519
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex items-start gap-2", children: [
|
|
1520
|
+
error && /* @__PURE__ */ jsx25(WarningCircle2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
1521
|
+
showLimits ? limitsText(minLength, maxLength) : error,
|
|
1522
|
+
showLimits && error && /* @__PURE__ */ jsx25("span", { className: "sr-only", children: error })
|
|
1523
|
+
] }),
|
|
1524
|
+
showLimits && /* @__PURE__ */ jsxs16("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
1525
|
+
draft.length,
|
|
1526
|
+
maxLength !== void 0 && `/${maxLength}`
|
|
1527
|
+
] })
|
|
1528
|
+
]
|
|
1501
1529
|
}
|
|
1502
1530
|
)
|
|
1503
|
-
]
|
|
1531
|
+
] }) : /* @__PURE__ */ jsxs16(
|
|
1532
|
+
"button",
|
|
1533
|
+
{
|
|
1534
|
+
ref: readRef,
|
|
1535
|
+
type: "button",
|
|
1536
|
+
disabled,
|
|
1537
|
+
"aria-label": `${ariaLabel}: ${value || placeholder}. Edit`,
|
|
1538
|
+
onClick: start,
|
|
1539
|
+
className: cn(
|
|
1540
|
+
"group inline-flex min-w-0 max-w-full items-center gap-2 px-3 text-left outline-none",
|
|
1541
|
+
fill && "w-full",
|
|
1542
|
+
question ? (
|
|
1543
|
+
// Hover and focus show a 1px bottom border in the input colour; only a selected question gets the 2px accent
|
|
1544
|
+
// one. The extra 1px of bottom padding keeps the height identical so the text never jumps.
|
|
1545
|
+
selected ? "rounded-none border-b-2 border-accent-foreground py-1" : "rounded-none border-b border-transparent pb-1.25 pt-1 enabled:hover:border-input-muted enabled:focus-visible:border-input-muted"
|
|
1546
|
+
) : "rounded-md border border-transparent py-1 enabled:focus-visible:border-input-accent",
|
|
1547
|
+
"enabled:hover:bg-secondary disabled:cursor-not-allowed disabled:opacity-50",
|
|
1548
|
+
textClasses
|
|
1549
|
+
),
|
|
1550
|
+
children: [
|
|
1551
|
+
/* @__PURE__ */ jsx25("span", { className: cn("min-w-0", multiline ? "whitespace-pre-wrap" : "truncate", fill && "flex-1", !value && "text-muted-foreground"), children: value || placeholder }),
|
|
1552
|
+
!fill && /* @__PURE__ */ jsx25(
|
|
1553
|
+
PencilSimple,
|
|
1554
|
+
{
|
|
1555
|
+
size: 16,
|
|
1556
|
+
"aria-hidden": true,
|
|
1557
|
+
className: "shrink-0 text-secondary-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
|
|
1558
|
+
}
|
|
1559
|
+
)
|
|
1560
|
+
]
|
|
1561
|
+
}
|
|
1562
|
+
)
|
|
1504
1563
|
}
|
|
1505
|
-
)
|
|
1564
|
+
);
|
|
1506
1565
|
}
|
|
1507
1566
|
);
|
|
1508
1567
|
InlineEdit.displayName = "InlineEdit";
|
|
@@ -1975,7 +2034,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx33("div", { c
|
|
|
1975
2034
|
|
|
1976
2035
|
// src/components/Overlays & Feedback/Toast.tsx
|
|
1977
2036
|
import * as React33 from "react";
|
|
1978
|
-
import { CheckCircle as CheckCircle2, Info, Warning, WarningCircle as
|
|
2037
|
+
import { CheckCircle as CheckCircle2, Info, Warning, WarningCircle as WarningCircle3, X as X4 } from "@phosphor-icons/react";
|
|
1979
2038
|
import { cva as cva4 } from "class-variance-authority";
|
|
1980
2039
|
import { Toast as ToastPrimitive } from "radix-ui";
|
|
1981
2040
|
import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
@@ -2006,7 +2065,7 @@ function VariantIcon({ variant, size }) {
|
|
|
2006
2065
|
const props = { size, "aria-hidden": true, className: cn("shrink-0", iconColour[variant]) };
|
|
2007
2066
|
if (variant === "success") return /* @__PURE__ */ jsx34(CheckCircle2, { ...props });
|
|
2008
2067
|
if (variant === "warning") return /* @__PURE__ */ jsx34(Warning, { ...props });
|
|
2009
|
-
if (variant === "destructive") return /* @__PURE__ */ jsx34(
|
|
2068
|
+
if (variant === "destructive") return /* @__PURE__ */ jsx34(WarningCircle3, { ...props });
|
|
2010
2069
|
return /* @__PURE__ */ jsx34(Info, { ...props });
|
|
2011
2070
|
}
|
|
2012
2071
|
var ToastProvider = ToastPrimitive.Provider;
|
|
@@ -2077,7 +2136,7 @@ ToastInline.displayName = "ToastInline";
|
|
|
2077
2136
|
// src/components/Overlays & Feedback/Tooltip.tsx
|
|
2078
2137
|
import * as React34 from "react";
|
|
2079
2138
|
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
2080
|
-
import { Fragment as
|
|
2139
|
+
import { Fragment as Fragment5, jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2081
2140
|
var TooltipProvider = TooltipPrimitive.Provider;
|
|
2082
2141
|
var Tooltip = TooltipPrimitive.Root;
|
|
2083
2142
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
@@ -2098,7 +2157,7 @@ var TooltipContent = React34.forwardRef(
|
|
|
2098
2157
|
),
|
|
2099
2158
|
...props,
|
|
2100
2159
|
children: [
|
|
2101
|
-
detailed ? /* @__PURE__ */ jsxs24(
|
|
2160
|
+
detailed ? /* @__PURE__ */ jsxs24(Fragment5, { children: [
|
|
2102
2161
|
title != null && /* @__PURE__ */ jsx35("p", { className: "text-xs leading-4 font-semibold text-label", children: title }),
|
|
2103
2162
|
description != null && /* @__PURE__ */ jsx35("p", { className: "text-xs leading-4.5 text-plum-200", children: description }),
|
|
2104
2163
|
action != null && /* @__PURE__ */ jsx35("div", { className: "mt-1 text-ui-caption text-plum-300 underline *:underline", children: action })
|
|
@@ -2157,7 +2216,7 @@ var StatusTag = React35.forwardRef(
|
|
|
2157
2216
|
StatusTag.displayName = "StatusTag";
|
|
2158
2217
|
|
|
2159
2218
|
// src/components/Question Types/FileUpload.tsx
|
|
2160
|
-
import { Fragment as
|
|
2219
|
+
import { Fragment as Fragment6, jsx as jsx37, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2161
2220
|
var FileUploadZone = React36.forwardRef(
|
|
2162
2221
|
({ className, title = "Upload document", hint, icon, onFiles, ...props }, ref) => {
|
|
2163
2222
|
const [over, setOver] = React36.useState(false);
|
|
@@ -2224,7 +2283,7 @@ var FileUploadItem = React36.forwardRef(
|
|
|
2224
2283
|
size,
|
|
2225
2284
|
status === "complete" && /* @__PURE__ */ jsx37(Tag, { variant: "success", children: "Complete" }),
|
|
2226
2285
|
status === "error" && /* @__PURE__ */ jsx37(Tag, { variant: "destructive", children: "Error" }),
|
|
2227
|
-
uploading && timeLeft && /* @__PURE__ */ jsxs26(
|
|
2286
|
+
uploading && timeLeft && /* @__PURE__ */ jsxs26(Fragment6, { children: [
|
|
2228
2287
|
/* @__PURE__ */ jsx37("span", { "aria-hidden": "true", className: "size-0.5 rounded-full bg-secondary-muted-foreground" }),
|
|
2229
2288
|
timeLeft
|
|
2230
2289
|
] })
|
|
@@ -2624,7 +2683,7 @@ var QuestionHeader = React40.forwardRef(
|
|
|
2624
2683
|
QuestionHeader.displayName = "QuestionHeader";
|
|
2625
2684
|
|
|
2626
2685
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2627
|
-
import { Fragment as
|
|
2686
|
+
import { Fragment as Fragment8, jsx as jsx42, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2628
2687
|
var QuestionEditorCard = React41.forwardRef(
|
|
2629
2688
|
({
|
|
2630
2689
|
className,
|
|
@@ -2680,7 +2739,7 @@ var QuestionEditorCard = React41.forwardRef(
|
|
|
2680
2739
|
showDragHandle,
|
|
2681
2740
|
meta,
|
|
2682
2741
|
maxLength,
|
|
2683
|
-
actions: actions ?? /* @__PURE__ */ jsxs29(
|
|
2742
|
+
actions: actions ?? /* @__PURE__ */ jsxs29(Fragment8, { children: [
|
|
2684
2743
|
/* @__PURE__ */ jsx42(
|
|
2685
2744
|
Button,
|
|
2686
2745
|
{
|
|
@@ -2835,7 +2894,7 @@ QuestionNavItem.displayName = "QuestionNavItem";
|
|
|
2835
2894
|
// src/components/Question Types/QuestionOption.tsx
|
|
2836
2895
|
import * as React44 from "react";
|
|
2837
2896
|
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash4 } from "@phosphor-icons/react";
|
|
2838
|
-
import { Fragment as
|
|
2897
|
+
import { Fragment as Fragment9, jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2839
2898
|
var optionClasses = "flex w-full max-w-150 cursor-pointer items-center gap-2 rounded-md border border-border bg-surface px-4 py-2 text-body-base text-surface-foreground transition-colors hover:bg-accent-soft hover:shadow-md has-[[data-state=checked]]:border-accent-foreground has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50";
|
|
2840
2899
|
function QuestionOption(props) {
|
|
2841
2900
|
const id = React44.useId();
|
|
@@ -2909,7 +2968,7 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
|
|
|
2909
2968
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
2910
2969
|
),
|
|
2911
2970
|
children: [
|
|
2912
|
-
kind === "rank" ? /* @__PURE__ */ jsxs31(
|
|
2971
|
+
kind === "rank" ? /* @__PURE__ */ jsxs31(Fragment9, { children: [
|
|
2913
2972
|
!locked && grip,
|
|
2914
2973
|
/* @__PURE__ */ jsx45(
|
|
2915
2974
|
"span",
|
|
@@ -2974,7 +3033,7 @@ function QuestionOptionEditor({ label, onLabelChange, onRemove, onAdd, className
|
|
|
2974
3033
|
// src/components/Question Types/RankList.tsx
|
|
2975
3034
|
import * as React45 from "react";
|
|
2976
3035
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
2977
|
-
import { Fragment as
|
|
3036
|
+
import { Fragment as Fragment10, jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2978
3037
|
function move(list, from, to) {
|
|
2979
3038
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
2980
3039
|
const next = list.slice();
|
|
@@ -3001,7 +3060,7 @@ var RankList = React45.forwardRef(
|
|
|
3001
3060
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3002
3061
|
onItemsChange(next);
|
|
3003
3062
|
};
|
|
3004
|
-
return /* @__PURE__ */ jsxs32(
|
|
3063
|
+
return /* @__PURE__ */ jsxs32(Fragment10, { children: [
|
|
3005
3064
|
/* @__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(
|
|
3006
3065
|
"li",
|
|
3007
3066
|
{
|