@discuss-ds/ui 0.37.0 → 0.39.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 +377 -350
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +377 -351
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -96,6 +96,7 @@ __export(index_exports, {
|
|
|
96
96
|
QuestionEditorCard: () => QuestionEditorCard,
|
|
97
97
|
QuestionHeader: () => QuestionHeader,
|
|
98
98
|
QuestionNavItem: () => QuestionNavItem,
|
|
99
|
+
QuestionNumberTag: () => QuestionNumberTag,
|
|
99
100
|
QuestionOption: () => QuestionOption,
|
|
100
101
|
QuestionOptionEditor: () => QuestionOptionEditor,
|
|
101
102
|
QuestionOtherOption: () => QuestionOtherOption,
|
|
@@ -1830,6 +1831,7 @@ var InlineEdit = React25.forwardRef(
|
|
|
1830
1831
|
showLimits,
|
|
1831
1832
|
submitOnEnter,
|
|
1832
1833
|
disabled,
|
|
1834
|
+
editing: openRequested,
|
|
1833
1835
|
onEditingChange,
|
|
1834
1836
|
onDraftChange,
|
|
1835
1837
|
variant = "default",
|
|
@@ -1850,9 +1852,11 @@ var InlineEdit = React25.forwardRef(
|
|
|
1850
1852
|
const readRef = React25.useRef(null);
|
|
1851
1853
|
const cancelled = React25.useRef(false);
|
|
1852
1854
|
const restoreFocus = React25.useRef(false);
|
|
1855
|
+
const openedByProp = React25.useRef(false);
|
|
1853
1856
|
React25.useEffect(() => {
|
|
1854
1857
|
if (editing) {
|
|
1855
|
-
fieldRef.current?.focus();
|
|
1858
|
+
fieldRef.current?.focus(openedByProp.current ? { preventScroll: true } : void 0);
|
|
1859
|
+
openedByProp.current = false;
|
|
1856
1860
|
fieldRef.current?.select();
|
|
1857
1861
|
} else if (restoreFocus.current) {
|
|
1858
1862
|
restoreFocus.current = false;
|
|
@@ -1874,6 +1878,12 @@ var InlineEdit = React25.forwardRef(
|
|
|
1874
1878
|
setEditing(true);
|
|
1875
1879
|
onEditingChange?.(true);
|
|
1876
1880
|
};
|
|
1881
|
+
React25.useEffect(() => {
|
|
1882
|
+
if (openRequested && !editing && !disabled) {
|
|
1883
|
+
openedByProp.current = true;
|
|
1884
|
+
start();
|
|
1885
|
+
}
|
|
1886
|
+
}, [openRequested]);
|
|
1877
1887
|
const finish = (commit, refocus) => {
|
|
1878
1888
|
if (commit && draft !== value) {
|
|
1879
1889
|
const problem = problemWith(draft);
|
|
@@ -3122,7 +3132,7 @@ var QuestionCard = React41.forwardRef(
|
|
|
3122
3132
|
QuestionCard.displayName = "QuestionCard";
|
|
3123
3133
|
|
|
3124
3134
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3125
|
-
var
|
|
3135
|
+
var React45 = __toESM(require("react"), 1);
|
|
3126
3136
|
var import_react23 = require("@phosphor-icons/react");
|
|
3127
3137
|
|
|
3128
3138
|
// src/lib/keepEditingFocus.ts
|
|
@@ -3134,6 +3144,9 @@ function keepEditingFocus(event) {
|
|
|
3134
3144
|
}
|
|
3135
3145
|
|
|
3136
3146
|
// src/components/Question Types/QuestionHeader.tsx
|
|
3147
|
+
var React44 = __toESM(require("react"), 1);
|
|
3148
|
+
|
|
3149
|
+
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3137
3150
|
var React43 = __toESM(require("react"), 1);
|
|
3138
3151
|
var import_react22 = require("@phosphor-icons/react");
|
|
3139
3152
|
|
|
@@ -3158,72 +3171,83 @@ function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
|
3158
3171
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
3159
3172
|
}
|
|
3160
3173
|
|
|
3161
|
-
// src/components/Question Types/
|
|
3174
|
+
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3162
3175
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3176
|
+
var QuestionNumberTag = React43.forwardRef(
|
|
3177
|
+
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
3178
|
+
"span",
|
|
3179
|
+
{
|
|
3180
|
+
ref,
|
|
3181
|
+
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
3182
|
+
...props,
|
|
3183
|
+
...dragHandleProps,
|
|
3184
|
+
className: cn(
|
|
3185
|
+
"group/handle inline-flex h-6 shrink-0 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
3186
|
+
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered. With a type icon the grip
|
|
3187
|
+
// takes the icon's place, so the tag keeps its padding and its width.
|
|
3188
|
+
showDragHandle && !questionType && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
3189
|
+
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",
|
|
3190
|
+
dragHandleProps && "cursor-grab touch-none select-none",
|
|
3191
|
+
dragHandleProps && showDragHandle && !questionType && "focus-visible:pl-1",
|
|
3192
|
+
className,
|
|
3193
|
+
dragHandleProps?.className
|
|
3194
|
+
),
|
|
3195
|
+
children: [
|
|
3196
|
+
questionType && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3197
|
+
QuestionTypeIcon,
|
|
3198
|
+
{
|
|
3199
|
+
type: questionType,
|
|
3200
|
+
size: 16,
|
|
3201
|
+
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3202
|
+
}
|
|
3203
|
+
),
|
|
3204
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3205
|
+
import_react22.DotsSixVertical,
|
|
3206
|
+
{
|
|
3207
|
+
size: 16,
|
|
3208
|
+
"aria-hidden": true,
|
|
3209
|
+
className: "hidden shrink-0 group-hover/editor:block group-data-[hovered]/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
3210
|
+
}
|
|
3211
|
+
),
|
|
3212
|
+
"Question ",
|
|
3213
|
+
number
|
|
3214
|
+
]
|
|
3215
|
+
}
|
|
3216
|
+
)
|
|
3217
|
+
);
|
|
3218
|
+
QuestionNumberTag.displayName = "QuestionNumberTag";
|
|
3219
|
+
|
|
3220
|
+
// src/components/Question Types/QuestionHeader.tsx
|
|
3221
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3163
3222
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
3164
|
-
var QuestionHeader =
|
|
3165
|
-
({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, titleRecommendedMax, titleRecommendedNote, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, questionType, titleMarks, onTitleMarkApply, onTitleMarkDismiss, ...props }, ref) => {
|
|
3166
|
-
const [draft, setDraft] =
|
|
3223
|
+
var QuestionHeader = React44.forwardRef(
|
|
3224
|
+
({ className, number, title, required, error, onDismissError, editor, onTitleChange, titlePlaceholder = "Click to write the question text", titlePlaceholderTone, titleMinLength, titleRecommendedMax, titleRecommendedNote, actions, meta, maxLength = 2e3, active, showCounter = true, dragHandleProps, showDragHandle = true, questionType, titleMarks, onTitleMarkApply, onTitleMarkDismiss, titleEditing, ...props }, ref) => {
|
|
3225
|
+
const [draft, setDraft] = React44.useState(null);
|
|
3167
3226
|
const label = String(number).padStart(2, "0");
|
|
3168
3227
|
const showError = error !== void 0 && error !== false;
|
|
3169
3228
|
if (editor) {
|
|
3170
3229
|
const text = typeof title === "string" ? title : "";
|
|
3171
3230
|
const count = (draft ?? text).length;
|
|
3172
3231
|
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
3173
|
-
return /* @__PURE__ */ (0,
|
|
3174
|
-
/* @__PURE__ */ (0,
|
|
3175
|
-
/* @__PURE__ */ (0,
|
|
3176
|
-
/* @__PURE__ */ (0,
|
|
3177
|
-
"span",
|
|
3178
|
-
{
|
|
3179
|
-
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
3180
|
-
...dragHandleProps,
|
|
3181
|
-
className: cn(
|
|
3182
|
-
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
3183
|
-
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered. With a type icon the grip
|
|
3184
|
-
// takes the icon's place, so the tag keeps its padding and its width.
|
|
3185
|
-
showDragHandle && !questionType && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
3186
|
-
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",
|
|
3187
|
-
dragHandleProps && "cursor-grab touch-none select-none",
|
|
3188
|
-
dragHandleProps && showDragHandle && !questionType && "focus-visible:pl-1",
|
|
3189
|
-
dragHandleProps?.className
|
|
3190
|
-
),
|
|
3191
|
-
children: [
|
|
3192
|
-
questionType && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3193
|
-
QuestionTypeIcon,
|
|
3194
|
-
{
|
|
3195
|
-
type: questionType,
|
|
3196
|
-
size: 16,
|
|
3197
|
-
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3198
|
-
}
|
|
3199
|
-
),
|
|
3200
|
-
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3201
|
-
import_react22.DotsSixVertical,
|
|
3202
|
-
{
|
|
3203
|
-
size: 16,
|
|
3204
|
-
"aria-hidden": true,
|
|
3205
|
-
className: "hidden shrink-0 group-hover/editor:block group-data-[hovered]/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
3206
|
-
}
|
|
3207
|
-
),
|
|
3208
|
-
"Question ",
|
|
3209
|
-
number
|
|
3210
|
-
]
|
|
3211
|
-
}
|
|
3212
|
-
),
|
|
3232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
3233
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3234
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3235
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(QuestionNumberTag, { number, active, questionType, showDragHandle, dragHandleProps }),
|
|
3213
3236
|
meta
|
|
3214
3237
|
] }),
|
|
3215
|
-
actions && /* @__PURE__ */ (0,
|
|
3238
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: cn(
|
|
3216
3239
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
3217
3240
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
3218
3241
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
3219
3242
|
), children: actions })
|
|
3220
3243
|
] }),
|
|
3221
|
-
/* @__PURE__ */ (0,
|
|
3244
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3222
3245
|
InlineEdit,
|
|
3223
3246
|
{
|
|
3224
3247
|
variant: "question",
|
|
3225
3248
|
multiline: true,
|
|
3226
3249
|
selected: active,
|
|
3250
|
+
editing: titleEditing,
|
|
3227
3251
|
className: "-mx-3 w-auto",
|
|
3228
3252
|
"aria-label": "Question title",
|
|
3229
3253
|
placeholder: titlePlaceholder,
|
|
@@ -3243,8 +3267,8 @@ var QuestionHeader = React43.forwardRef(
|
|
|
3243
3267
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
3244
3268
|
}
|
|
3245
3269
|
),
|
|
3246
|
-
long && titleRecommendedNote != null && /* @__PURE__ */ (0,
|
|
3247
|
-
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0,
|
|
3270
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
3271
|
+
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3248
3272
|
count,
|
|
3249
3273
|
"/",
|
|
3250
3274
|
maxLength,
|
|
@@ -3252,16 +3276,16 @@ var QuestionHeader = React43.forwardRef(
|
|
|
3252
3276
|
] })
|
|
3253
3277
|
] });
|
|
3254
3278
|
}
|
|
3255
|
-
return /* @__PURE__ */ (0,
|
|
3256
|
-
showError && /* @__PURE__ */ (0,
|
|
3257
|
-
/* @__PURE__ */ (0,
|
|
3279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3280
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ToastInline, { variant: "destructive", onClose: onDismissError, className: "min-h-10", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "text-ui-label text-destructive", children: error === true ? "This question is mandatory." : error }) }),
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: eyebrow, children: [
|
|
3258
3282
|
"Question ",
|
|
3259
3283
|
label
|
|
3260
3284
|
] }),
|
|
3261
|
-
/* @__PURE__ */ (0,
|
|
3285
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
3262
3286
|
title,
|
|
3263
|
-
required && /* @__PURE__ */ (0,
|
|
3264
|
-
required && /* @__PURE__ */ (0,
|
|
3287
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
3288
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "sr-only", children: " (required)" })
|
|
3265
3289
|
] })
|
|
3266
3290
|
] });
|
|
3267
3291
|
}
|
|
@@ -3269,8 +3293,8 @@ var QuestionHeader = React43.forwardRef(
|
|
|
3269
3293
|
QuestionHeader.displayName = "QuestionHeader";
|
|
3270
3294
|
|
|
3271
3295
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3272
|
-
var
|
|
3273
|
-
var QuestionEditorCard =
|
|
3296
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3297
|
+
var QuestionEditorCard = React45.forwardRef(
|
|
3274
3298
|
({
|
|
3275
3299
|
className,
|
|
3276
3300
|
number,
|
|
@@ -3301,11 +3325,12 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3301
3325
|
titleMarks,
|
|
3302
3326
|
onTitleMarkApply,
|
|
3303
3327
|
onTitleMarkDismiss,
|
|
3328
|
+
titleEditing,
|
|
3304
3329
|
children,
|
|
3305
3330
|
...props
|
|
3306
3331
|
}, ref) => {
|
|
3307
3332
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
3308
|
-
return /* @__PURE__ */ (0,
|
|
3333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3309
3334
|
"div",
|
|
3310
3335
|
{
|
|
3311
3336
|
ref,
|
|
@@ -3317,7 +3342,7 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3317
3342
|
props.onMouseDown?.(event);
|
|
3318
3343
|
},
|
|
3319
3344
|
children: [
|
|
3320
|
-
/* @__PURE__ */ (0,
|
|
3345
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3321
3346
|
"div",
|
|
3322
3347
|
{
|
|
3323
3348
|
className: cn(
|
|
@@ -3325,9 +3350,9 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3325
3350
|
active ? "border-accent" : "border-border"
|
|
3326
3351
|
),
|
|
3327
3352
|
children: [
|
|
3328
|
-
/* @__PURE__ */ (0,
|
|
3329
|
-
/* @__PURE__ */ (0,
|
|
3330
|
-
/* @__PURE__ */ (0,
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
3354
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3331
3356
|
QuestionHeader,
|
|
3332
3357
|
{
|
|
3333
3358
|
editor: true,
|
|
@@ -3347,10 +3372,11 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3347
3372
|
titleMarks,
|
|
3348
3373
|
onTitleMarkApply,
|
|
3349
3374
|
onTitleMarkDismiss,
|
|
3375
|
+
titleEditing,
|
|
3350
3376
|
meta,
|
|
3351
3377
|
maxLength,
|
|
3352
|
-
actions: actions ?? /* @__PURE__ */ (0,
|
|
3353
|
-
/* @__PURE__ */ (0,
|
|
3378
|
+
actions: actions ?? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
3379
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3354
3380
|
Button,
|
|
3355
3381
|
{
|
|
3356
3382
|
type: "button",
|
|
@@ -3358,10 +3384,10 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3358
3384
|
size: "icon-sm",
|
|
3359
3385
|
"aria-label": "Duplicate question",
|
|
3360
3386
|
onClick: onDuplicate,
|
|
3361
|
-
children: /* @__PURE__ */ (0,
|
|
3387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react23.Copy, { size: 16, "aria-hidden": true })
|
|
3362
3388
|
}
|
|
3363
3389
|
),
|
|
3364
|
-
/* @__PURE__ */ (0,
|
|
3390
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3365
3391
|
Button,
|
|
3366
3392
|
{
|
|
3367
3393
|
type: "button",
|
|
@@ -3369,10 +3395,10 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3369
3395
|
size: "icon-sm",
|
|
3370
3396
|
"aria-label": "Delete question",
|
|
3371
3397
|
onClick: onDelete,
|
|
3372
|
-
children: /* @__PURE__ */ (0,
|
|
3398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react23.Trash, { size: 16, "aria-hidden": true })
|
|
3373
3399
|
}
|
|
3374
3400
|
),
|
|
3375
|
-
/* @__PURE__ */ (0,
|
|
3401
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3376
3402
|
Button,
|
|
3377
3403
|
{
|
|
3378
3404
|
type: "button",
|
|
@@ -3380,7 +3406,7 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3380
3406
|
size: "icon-sm",
|
|
3381
3407
|
"aria-label": "Preview question",
|
|
3382
3408
|
onClick: onPreview,
|
|
3383
|
-
children: /* @__PURE__ */ (0,
|
|
3409
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react23.Eye, { size: 16, "aria-hidden": true })
|
|
3384
3410
|
}
|
|
3385
3411
|
)
|
|
3386
3412
|
] })
|
|
@@ -3388,18 +3414,18 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3388
3414
|
),
|
|
3389
3415
|
children
|
|
3390
3416
|
] }),
|
|
3391
|
-
error && /* @__PURE__ */ (0,
|
|
3392
|
-
/* @__PURE__ */ (0,
|
|
3417
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3418
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react23.Warning, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3393
3419
|
error
|
|
3394
3420
|
] }),
|
|
3395
|
-
footer && /* @__PURE__ */ (0,
|
|
3396
|
-
/* @__PURE__ */ (0,
|
|
3397
|
-
/* @__PURE__ */ (0,
|
|
3398
|
-
onAdd && /* @__PURE__ */ (0,
|
|
3399
|
-
/* @__PURE__ */ (0,
|
|
3421
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
3422
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3423
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3424
|
+
onAdd && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3425
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react23.Plus, { size: 16, "aria-hidden": true }),
|
|
3400
3426
|
"Add choice"
|
|
3401
3427
|
] }),
|
|
3402
|
-
onPaste && /* @__PURE__ */ (0,
|
|
3428
|
+
onPaste && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3403
3429
|
Button,
|
|
3404
3430
|
{
|
|
3405
3431
|
type: "button",
|
|
@@ -3407,17 +3433,17 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3407
3433
|
size: "icon",
|
|
3408
3434
|
"aria-label": "Paste choices",
|
|
3409
3435
|
onClick: onPaste,
|
|
3410
|
-
children: /* @__PURE__ */ (0,
|
|
3436
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react23.Clipboard, { size: 16, "aria-hidden": true })
|
|
3411
3437
|
}
|
|
3412
3438
|
)
|
|
3413
3439
|
] })
|
|
3414
3440
|
] })
|
|
3415
3441
|
] }),
|
|
3416
|
-
note && /* @__PURE__ */ (0,
|
|
3442
|
+
note && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
3417
3443
|
]
|
|
3418
3444
|
}
|
|
3419
3445
|
),
|
|
3420
|
-
onAskAi && /* @__PURE__ */ (0,
|
|
3446
|
+
onAskAi && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3421
3447
|
Button,
|
|
3422
3448
|
{
|
|
3423
3449
|
type: "button",
|
|
@@ -3426,7 +3452,7 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3426
3452
|
"aria-label": "Ask AI",
|
|
3427
3453
|
onClick: onAskAi,
|
|
3428
3454
|
className: "shrink-0 opacity-0 transition-opacity group-hover/editor:opacity-100 group-focus-within/editor:opacity-100 group-data-[hovered]/editor:opacity-100 focus-visible:opacity-100",
|
|
3429
|
-
children: /* @__PURE__ */ (0,
|
|
3455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react23.Sparkle, { size: 16, "aria-hidden": true })
|
|
3430
3456
|
}
|
|
3431
3457
|
)
|
|
3432
3458
|
]
|
|
@@ -3437,15 +3463,15 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3437
3463
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
3438
3464
|
|
|
3439
3465
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
3440
|
-
var
|
|
3466
|
+
var React46 = __toESM(require("react"), 1);
|
|
3441
3467
|
var import_react24 = require("@phosphor-icons/react");
|
|
3442
3468
|
var import_radix_ui22 = require("radix-ui");
|
|
3443
|
-
var
|
|
3444
|
-
var QuestionNavItem =
|
|
3469
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3470
|
+
var QuestionNavItem = React46.forwardRef(
|
|
3445
3471
|
({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3446
3472
|
const Comp = asChild ? import_radix_ui22.Slot.Root : "button";
|
|
3447
3473
|
const warn = !error && !!warning;
|
|
3448
|
-
return /* @__PURE__ */ (0,
|
|
3474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3449
3475
|
Comp,
|
|
3450
3476
|
{
|
|
3451
3477
|
ref,
|
|
@@ -3464,9 +3490,9 @@ var QuestionNavItem = React45.forwardRef(
|
|
|
3464
3490
|
),
|
|
3465
3491
|
...props,
|
|
3466
3492
|
children: [
|
|
3467
|
-
/* @__PURE__ */ (0,
|
|
3468
|
-
showDragHandle && /* @__PURE__ */ (0,
|
|
3469
|
-
/* @__PURE__ */ (0,
|
|
3493
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3494
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react24.DotsSixVertical, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react24.WarningCircle, { size: 16, className: "text-destructive-foreground" }) : warn ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react24.Warning, { size: 16, className: "text-warning-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3470
3496
|
QuestionTypeIcon,
|
|
3471
3497
|
{
|
|
3472
3498
|
type: questionType,
|
|
@@ -3475,9 +3501,9 @@ var QuestionNavItem = React45.forwardRef(
|
|
|
3475
3501
|
}
|
|
3476
3502
|
) })
|
|
3477
3503
|
] }),
|
|
3478
|
-
/* @__PURE__ */ (0,
|
|
3479
|
-
error && /* @__PURE__ */ (0,
|
|
3480
|
-
warn && /* @__PURE__ */ (0,
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3505
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sr-only", children: ", has errors" }),
|
|
3506
|
+
warn && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sr-only", children: ", has warnings" })
|
|
3481
3507
|
]
|
|
3482
3508
|
}
|
|
3483
3509
|
);
|
|
@@ -3486,14 +3512,14 @@ var QuestionNavItem = React45.forwardRef(
|
|
|
3486
3512
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
3487
3513
|
|
|
3488
3514
|
// src/components/Question Types/QuestionOption.tsx
|
|
3489
|
-
var
|
|
3515
|
+
var React47 = __toESM(require("react"), 1);
|
|
3490
3516
|
var import_react25 = require("@phosphor-icons/react");
|
|
3491
|
-
var
|
|
3517
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3492
3518
|
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";
|
|
3493
3519
|
function QuestionOption(props) {
|
|
3494
|
-
const id =
|
|
3495
|
-
return /* @__PURE__ */ (0,
|
|
3496
|
-
props.kind === "checkbox" ? /* @__PURE__ */ (0,
|
|
3520
|
+
const id = React47.useId();
|
|
3521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3522
|
+
props.kind === "checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3497
3523
|
Checkbox,
|
|
3498
3524
|
{
|
|
3499
3525
|
id,
|
|
@@ -3502,16 +3528,16 @@ function QuestionOption(props) {
|
|
|
3502
3528
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
3503
3529
|
disabled: props.disabled
|
|
3504
3530
|
}
|
|
3505
|
-
) : /* @__PURE__ */ (0,
|
|
3506
|
-
/* @__PURE__ */ (0,
|
|
3531
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3532
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3507
3533
|
] });
|
|
3508
3534
|
}
|
|
3509
|
-
var QuestionOtherOption =
|
|
3535
|
+
var QuestionOtherOption = React47.forwardRef(
|
|
3510
3536
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3511
|
-
const inner =
|
|
3512
|
-
|
|
3537
|
+
const inner = React47.useRef(null);
|
|
3538
|
+
React47.useImperativeHandle(ref, () => inner.current);
|
|
3513
3539
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3514
|
-
return /* @__PURE__ */ (0,
|
|
3540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3515
3541
|
"div",
|
|
3516
3542
|
{
|
|
3517
3543
|
className: cn(
|
|
@@ -3519,7 +3545,7 @@ var QuestionOtherOption = React46.forwardRef(
|
|
|
3519
3545
|
className
|
|
3520
3546
|
),
|
|
3521
3547
|
children: [
|
|
3522
|
-
/* @__PURE__ */ (0,
|
|
3548
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3523
3549
|
"input",
|
|
3524
3550
|
{
|
|
3525
3551
|
ref: inner,
|
|
@@ -3535,7 +3561,7 @@ var QuestionOtherOption = React46.forwardRef(
|
|
|
3535
3561
|
...props
|
|
3536
3562
|
}
|
|
3537
3563
|
),
|
|
3538
|
-
/* @__PURE__ */ (0,
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button, { type: "button", variant: "subtle", size: "icon-sm", "aria-label": confirmLabel, onClick: submit, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.Check, { size: 16, "aria-hidden": true }) })
|
|
3539
3565
|
]
|
|
3540
3566
|
}
|
|
3541
3567
|
);
|
|
@@ -3550,16 +3576,16 @@ function limitsText2(min, max) {
|
|
|
3550
3576
|
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3551
3577
|
const reveal = kind !== void 0;
|
|
3552
3578
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3553
|
-
const [draft, setDraft] =
|
|
3554
|
-
const [error, setError] =
|
|
3555
|
-
const helperId =
|
|
3556
|
-
const [focused, setFocused] =
|
|
3579
|
+
const [draft, setDraft] = React47.useState(null);
|
|
3580
|
+
const [error, setError] = React47.useState(null);
|
|
3581
|
+
const helperId = React47.useId();
|
|
3582
|
+
const [focused, setFocused] = React47.useState(false);
|
|
3557
3583
|
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3558
|
-
const fieldRef =
|
|
3559
|
-
const [editMarks, setEditMarks] =
|
|
3560
|
-
const [scroll, setScroll] =
|
|
3584
|
+
const fieldRef = React47.useRef(null);
|
|
3585
|
+
const [editMarks, setEditMarks] = React47.useState([]);
|
|
3586
|
+
const [scroll, setScroll] = React47.useState(0);
|
|
3561
3587
|
const typed = guarded ? draft ?? label : label;
|
|
3562
|
-
const skipBlur =
|
|
3588
|
+
const skipBlur = React47.useRef(false);
|
|
3563
3589
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3564
3590
|
const save = () => {
|
|
3565
3591
|
if (draft === null) return true;
|
|
@@ -3580,9 +3606,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3580
3606
|
...dragHandleProps,
|
|
3581
3607
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3582
3608
|
} : { "aria-hidden": true };
|
|
3583
|
-
const grip = dragHandleProps ? /* @__PURE__ */ (0,
|
|
3584
|
-
return /* @__PURE__ */ (0,
|
|
3585
|
-
/* @__PURE__ */ (0,
|
|
3609
|
+
const grip = dragHandleProps ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.DotsSixVertical, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.DotsSixVertical, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
|
|
3610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3611
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3586
3612
|
"div",
|
|
3587
3613
|
{
|
|
3588
3614
|
className: cn(
|
|
@@ -3592,10 +3618,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3592
3618
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3593
3619
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3594
3620
|
),
|
|
3595
|
-
children: /* @__PURE__ */ (0,
|
|
3596
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */ (0,
|
|
3621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3622
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3597
3623
|
!locked && grip,
|
|
3598
|
-
/* @__PURE__ */ (0,
|
|
3624
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3599
3625
|
"span",
|
|
3600
3626
|
{
|
|
3601
3627
|
"aria-hidden": "true",
|
|
@@ -3603,8 +3629,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3603
3629
|
children: rank
|
|
3604
3630
|
}
|
|
3605
3631
|
)
|
|
3606
|
-
] }) : reveal && locked ? /* @__PURE__ */ (0,
|
|
3607
|
-
/* @__PURE__ */ (0,
|
|
3632
|
+
] }) : reveal && locked ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
|
|
3633
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3608
3634
|
"span",
|
|
3609
3635
|
{
|
|
3610
3636
|
"aria-hidden": "true",
|
|
@@ -3615,7 +3641,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3615
3641
|
)
|
|
3616
3642
|
}
|
|
3617
3643
|
),
|
|
3618
|
-
/* @__PURE__ */ (0,
|
|
3644
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3619
3645
|
import_react25.DotsSixVertical,
|
|
3620
3646
|
{
|
|
3621
3647
|
size: 20,
|
|
@@ -3627,10 +3653,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3627
3653
|
}
|
|
3628
3654
|
)
|
|
3629
3655
|
] }) : locked ? null : grip }),
|
|
3630
|
-
/* @__PURE__ */ (0,
|
|
3631
|
-
/* @__PURE__ */ (0,
|
|
3632
|
-
focused && editMarks.length > 0 && /* @__PURE__ */ (0,
|
|
3633
|
-
/* @__PURE__ */ (0,
|
|
3656
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "relative min-w-0", children: [
|
|
3658
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DraftMarks, { layer: "behind", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3659
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3634
3660
|
"input",
|
|
3635
3661
|
{
|
|
3636
3662
|
ref: fieldRef,
|
|
@@ -3685,24 +3711,24 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3685
3711
|
)
|
|
3686
3712
|
}
|
|
3687
3713
|
),
|
|
3688
|
-
focused && editMarks.length > 0 && /* @__PURE__ */ (0,
|
|
3689
|
-
showMarks && /* @__PURE__ */ (0,
|
|
3690
|
-
(piece, i) => piece.mark ? /* @__PURE__ */ (0,
|
|
3714
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(DraftMarks, { layer: "over", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3715
|
+
showMarks && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 flex items-center overflow-hidden whitespace-pre text-body-base text-surface-foreground [&_[data-mark]]:pointer-events-auto", children: splitMarks(label, marks).map(
|
|
3716
|
+
(piece, i) => piece.mark ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: piece.text }, i)
|
|
3691
3717
|
) })
|
|
3692
3718
|
] }),
|
|
3693
|
-
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ (0,
|
|
3719
|
+
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3694
3720
|
"p",
|
|
3695
3721
|
{
|
|
3696
3722
|
id: helperId,
|
|
3697
3723
|
role: error ? "alert" : void 0,
|
|
3698
3724
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3699
3725
|
children: [
|
|
3700
|
-
/* @__PURE__ */ (0,
|
|
3701
|
-
error && /* @__PURE__ */ (0,
|
|
3726
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex items-start gap-2", children: [
|
|
3727
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.WarningCircle, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3702
3728
|
limitsText2(minLength, maxLength),
|
|
3703
|
-
error && /* @__PURE__ */ (0,
|
|
3729
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "sr-only", children: error })
|
|
3704
3730
|
] }),
|
|
3705
|
-
/* @__PURE__ */ (0,
|
|
3731
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3706
3732
|
draft.length,
|
|
3707
3733
|
maxLength !== void 0 && `/${maxLength}`
|
|
3708
3734
|
] })
|
|
@@ -3713,7 +3739,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3713
3739
|
] })
|
|
3714
3740
|
}
|
|
3715
3741
|
),
|
|
3716
|
-
!locked && /* @__PURE__ */ (0,
|
|
3742
|
+
!locked && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
3717
3743
|
"div",
|
|
3718
3744
|
{
|
|
3719
3745
|
className: cn(
|
|
@@ -3721,8 +3747,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3721
3747
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3722
3748
|
),
|
|
3723
3749
|
children: [
|
|
3724
|
-
/* @__PURE__ */ (0,
|
|
3725
|
-
/* @__PURE__ */ (0,
|
|
3750
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", disabled: removeDisabled, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.Trash, { size: 16, "aria-hidden": true }) }),
|
|
3751
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", disabled: addDisabled, onClick: onAdd, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react25.Plus, { size: 16, "aria-hidden": true }) })
|
|
3726
3752
|
]
|
|
3727
3753
|
}
|
|
3728
3754
|
)
|
|
@@ -3730,9 +3756,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3730
3756
|
}
|
|
3731
3757
|
|
|
3732
3758
|
// src/components/Question Types/RankList.tsx
|
|
3733
|
-
var
|
|
3759
|
+
var React48 = __toESM(require("react"), 1);
|
|
3734
3760
|
var import_react26 = require("@phosphor-icons/react");
|
|
3735
|
-
var
|
|
3761
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3736
3762
|
function move(list, from, to) {
|
|
3737
3763
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3738
3764
|
const next = list.slice();
|
|
@@ -3740,13 +3766,13 @@ function move(list, from, to) {
|
|
|
3740
3766
|
next.splice(to, 0, item);
|
|
3741
3767
|
return next;
|
|
3742
3768
|
}
|
|
3743
|
-
var RankList =
|
|
3769
|
+
var RankList = React48.forwardRef(
|
|
3744
3770
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3745
|
-
const [dragIndex, setDragIndex] =
|
|
3746
|
-
const [announcement, setAnnouncement] =
|
|
3747
|
-
const handles =
|
|
3748
|
-
const refocus =
|
|
3749
|
-
|
|
3771
|
+
const [dragIndex, setDragIndex] = React48.useState(null);
|
|
3772
|
+
const [announcement, setAnnouncement] = React48.useState("");
|
|
3773
|
+
const handles = React48.useRef(/* @__PURE__ */ new Map());
|
|
3774
|
+
const refocus = React48.useRef(null);
|
|
3775
|
+
React48.useEffect(() => {
|
|
3750
3776
|
if (refocus.current) {
|
|
3751
3777
|
handles.current.get(refocus.current)?.focus();
|
|
3752
3778
|
refocus.current = null;
|
|
@@ -3759,8 +3785,8 @@ var RankList = React47.forwardRef(
|
|
|
3759
3785
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3760
3786
|
onItemsChange(next);
|
|
3761
3787
|
};
|
|
3762
|
-
return /* @__PURE__ */ (0,
|
|
3763
|
-
/* @__PURE__ */ (0,
|
|
3788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
3789
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
3764
3790
|
"li",
|
|
3765
3791
|
{
|
|
3766
3792
|
draggable: true,
|
|
@@ -3777,7 +3803,7 @@ var RankList = React47.forwardRef(
|
|
|
3777
3803
|
dragIndex === index && "opacity-50"
|
|
3778
3804
|
),
|
|
3779
3805
|
children: [
|
|
3780
|
-
/* @__PURE__ */ (0,
|
|
3806
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3781
3807
|
"button",
|
|
3782
3808
|
{
|
|
3783
3809
|
type: "button",
|
|
@@ -3796,10 +3822,10 @@ var RankList = React47.forwardRef(
|
|
|
3796
3822
|
}
|
|
3797
3823
|
},
|
|
3798
3824
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3799
|
-
children: /* @__PURE__ */ (0,
|
|
3825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react26.DotsSixVertical, { size: 16, "aria-hidden": true })
|
|
3800
3826
|
}
|
|
3801
3827
|
),
|
|
3802
|
-
/* @__PURE__ */ (0,
|
|
3828
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3803
3829
|
"span",
|
|
3804
3830
|
{
|
|
3805
3831
|
"aria-hidden": "true",
|
|
@@ -3807,27 +3833,27 @@ var RankList = React47.forwardRef(
|
|
|
3807
3833
|
children: index + 1
|
|
3808
3834
|
}
|
|
3809
3835
|
),
|
|
3810
|
-
/* @__PURE__ */ (0,
|
|
3836
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3811
3837
|
]
|
|
3812
3838
|
},
|
|
3813
3839
|
item.id
|
|
3814
3840
|
)) }),
|
|
3815
|
-
/* @__PURE__ */ (0,
|
|
3841
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3816
3842
|
] });
|
|
3817
3843
|
}
|
|
3818
3844
|
);
|
|
3819
3845
|
RankList.displayName = "RankList";
|
|
3820
3846
|
|
|
3821
3847
|
// src/components/Question Types/RatingScale.tsx
|
|
3822
|
-
var
|
|
3848
|
+
var React49 = __toESM(require("react"), 1);
|
|
3823
3849
|
var import_radix_ui23 = require("radix-ui");
|
|
3824
|
-
var
|
|
3825
|
-
var RatingScale =
|
|
3850
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3851
|
+
var RatingScale = React49.forwardRef(
|
|
3826
3852
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3827
|
-
const [internal, setInternal] =
|
|
3853
|
+
const [internal, setInternal] = React49.useState(defaultValue);
|
|
3828
3854
|
const current = value !== void 0 ? value : internal;
|
|
3829
|
-
return /* @__PURE__ */ (0,
|
|
3830
|
-
/* @__PURE__ */ (0,
|
|
3855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3856
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3831
3857
|
import_radix_ui23.ToggleGroup.Root,
|
|
3832
3858
|
{
|
|
3833
3859
|
ref,
|
|
@@ -3840,7 +3866,7 @@ var RatingScale = React48.forwardRef(
|
|
|
3840
3866
|
},
|
|
3841
3867
|
className: "flex gap-2",
|
|
3842
3868
|
...props,
|
|
3843
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ (0,
|
|
3869
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
3844
3870
|
import_radix_ui23.ToggleGroup.Item,
|
|
3845
3871
|
{
|
|
3846
3872
|
value: String(n),
|
|
@@ -3856,9 +3882,9 @@ var RatingScale = React48.forwardRef(
|
|
|
3856
3882
|
))
|
|
3857
3883
|
}
|
|
3858
3884
|
),
|
|
3859
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */ (0,
|
|
3860
|
-
/* @__PURE__ */ (0,
|
|
3861
|
-
/* @__PURE__ */ (0,
|
|
3885
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3886
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: lowLabel }),
|
|
3887
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { children: highLabel })
|
|
3862
3888
|
] })
|
|
3863
3889
|
] });
|
|
3864
3890
|
}
|
|
@@ -3866,15 +3892,15 @@ var RatingScale = React48.forwardRef(
|
|
|
3866
3892
|
RatingScale.displayName = "RatingScale";
|
|
3867
3893
|
|
|
3868
3894
|
// src/components/Question Types/StimulusCard.tsx
|
|
3869
|
-
var
|
|
3895
|
+
var React50 = __toESM(require("react"), 1);
|
|
3870
3896
|
var import_react27 = require("@phosphor-icons/react");
|
|
3871
|
-
var
|
|
3897
|
+
var import_jsx_runtime51 = (
|
|
3872
3898
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3873
3899
|
require("react/jsx-runtime")
|
|
3874
3900
|
);
|
|
3875
3901
|
var MIN_THUMBNAIL = 92;
|
|
3876
3902
|
var MAX_THUMBNAIL = 240;
|
|
3877
|
-
var StimulusCard =
|
|
3903
|
+
var StimulusCard = React50.forwardRef(
|
|
3878
3904
|
({
|
|
3879
3905
|
className,
|
|
3880
3906
|
thumbnail,
|
|
@@ -3891,14 +3917,14 @@ var StimulusCard = React49.forwardRef(
|
|
|
3891
3917
|
removeLabel = "Remove stimulus",
|
|
3892
3918
|
...props
|
|
3893
3919
|
}, ref) => {
|
|
3894
|
-
const [failedSrc, setFailedSrc] =
|
|
3920
|
+
const [failedSrc, setFailedSrc] = React50.useState();
|
|
3895
3921
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3896
3922
|
const showImage = thumbnail !== void 0 && !error;
|
|
3897
|
-
const [draft, setDraft] =
|
|
3923
|
+
const [draft, setDraft] = React50.useState(null);
|
|
3898
3924
|
const count = (draft ?? caption ?? "").length;
|
|
3899
|
-
const textRef =
|
|
3900
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3901
|
-
|
|
3925
|
+
const textRef = React50.useRef(null);
|
|
3926
|
+
const [thumbnailSize, setThumbnailSize] = React50.useState(MIN_THUMBNAIL);
|
|
3927
|
+
React50.useEffect(() => {
|
|
3902
3928
|
const el = textRef.current;
|
|
3903
3929
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3904
3930
|
const observer = new ResizeObserver(() => {
|
|
@@ -3907,7 +3933,7 @@ var StimulusCard = React49.forwardRef(
|
|
|
3907
3933
|
observer.observe(el);
|
|
3908
3934
|
return () => observer.disconnect();
|
|
3909
3935
|
}, []);
|
|
3910
|
-
return /* @__PURE__ */ (0,
|
|
3936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
3911
3937
|
"div",
|
|
3912
3938
|
{
|
|
3913
3939
|
ref,
|
|
@@ -3915,8 +3941,8 @@ var StimulusCard = React49.forwardRef(
|
|
|
3915
3941
|
className: cn("flex min-h-24.5 w-full items-center gap-4 rounded-md border border-border p-0.5 pr-4", className),
|
|
3916
3942
|
...props,
|
|
3917
3943
|
children: [
|
|
3918
|
-
/* @__PURE__ */ (0,
|
|
3919
|
-
/* @__PURE__ */ (0,
|
|
3944
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3920
3946
|
"span",
|
|
3921
3947
|
{
|
|
3922
3948
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3925,12 +3951,12 @@ var StimulusCard = React49.forwardRef(
|
|
|
3925
3951
|
error ? "border-destructive-soft-border bg-destructive-soft bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-destructive" : "border-border bg-background bg-linear-to-r from-overlay-dark-5 to-overlay-dark-5 text-surface-foreground",
|
|
3926
3952
|
showImage && "bg-none"
|
|
3927
3953
|
),
|
|
3928
|
-
children: showImage ? /* @__PURE__ */ (0,
|
|
3954
|
+
children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react27.ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react27.Image, { size: 24, "aria-hidden": true })
|
|
3929
3955
|
}
|
|
3930
3956
|
),
|
|
3931
|
-
/* @__PURE__ */ (0,
|
|
3932
|
-
/* @__PURE__ */ (0,
|
|
3933
|
-
onCaptionChange ? /* @__PURE__ */ (0,
|
|
3957
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
3958
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "w-full text-ui-label", children: label }),
|
|
3959
|
+
onCaptionChange ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3934
3960
|
InlineEdit,
|
|
3935
3961
|
{
|
|
3936
3962
|
variant: "question",
|
|
@@ -3947,8 +3973,8 @@ var StimulusCard = React49.forwardRef(
|
|
|
3947
3973
|
},
|
|
3948
3974
|
textClassName: "text-body-base"
|
|
3949
3975
|
}
|
|
3950
|
-
) : /* @__PURE__ */ (0,
|
|
3951
|
-
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0,
|
|
3976
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
3977
|
+
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3952
3978
|
count,
|
|
3953
3979
|
"/",
|
|
3954
3980
|
maxLength,
|
|
@@ -3956,7 +3982,7 @@ var StimulusCard = React49.forwardRef(
|
|
|
3956
3982
|
] })
|
|
3957
3983
|
] })
|
|
3958
3984
|
] }),
|
|
3959
|
-
onRemove && /* @__PURE__ */ (0,
|
|
3985
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react27.Trash, { size: 16, "aria-hidden": true }) })
|
|
3960
3986
|
]
|
|
3961
3987
|
}
|
|
3962
3988
|
);
|
|
@@ -3965,27 +3991,27 @@ var StimulusCard = React49.forwardRef(
|
|
|
3965
3991
|
StimulusCard.displayName = "StimulusCard";
|
|
3966
3992
|
|
|
3967
3993
|
// src/components/Data Display/Progress.tsx
|
|
3968
|
-
var
|
|
3994
|
+
var React51 = __toESM(require("react"), 1);
|
|
3969
3995
|
var import_radix_ui24 = require("radix-ui");
|
|
3970
|
-
var
|
|
3971
|
-
var Progress =
|
|
3996
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3997
|
+
var Progress = React51.forwardRef(
|
|
3972
3998
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3973
3999
|
const hasHeader = label != null || valueLabel != null;
|
|
3974
4000
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3975
4001
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3976
|
-
return /* @__PURE__ */ (0,
|
|
3977
|
-
hasHeader && /* @__PURE__ */ (0,
|
|
3978
|
-
/* @__PURE__ */ (0,
|
|
3979
|
-
/* @__PURE__ */ (0,
|
|
4002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
4003
|
+
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
4004
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: label }),
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3980
4006
|
] }),
|
|
3981
|
-
/* @__PURE__ */ (0,
|
|
4007
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3982
4008
|
import_radix_ui24.Progress.Root,
|
|
3983
4009
|
{
|
|
3984
4010
|
ref,
|
|
3985
4011
|
value: clamped,
|
|
3986
4012
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3987
4013
|
...props,
|
|
3988
|
-
children: /* @__PURE__ */ (0,
|
|
4014
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3989
4015
|
import_radix_ui24.Progress.Indicator,
|
|
3990
4016
|
{
|
|
3991
4017
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3994,9 +4020,9 @@ var Progress = React50.forwardRef(
|
|
|
3994
4020
|
)
|
|
3995
4021
|
}
|
|
3996
4022
|
),
|
|
3997
|
-
hasDetails && /* @__PURE__ */ (0,
|
|
3998
|
-
/* @__PURE__ */ (0,
|
|
3999
|
-
/* @__PURE__ */ (0,
|
|
4023
|
+
hasDetails && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
4024
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: detailsStart }),
|
|
4025
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: detailsEnd })
|
|
4000
4026
|
] })
|
|
4001
4027
|
] });
|
|
4002
4028
|
}
|
|
@@ -4004,11 +4030,11 @@ var Progress = React50.forwardRef(
|
|
|
4004
4030
|
Progress.displayName = "Progress";
|
|
4005
4031
|
|
|
4006
4032
|
// src/components/Data Display/Table.tsx
|
|
4007
|
-
var
|
|
4033
|
+
var React52 = __toESM(require("react"), 1);
|
|
4008
4034
|
var import_react28 = require("@phosphor-icons/react");
|
|
4009
|
-
var
|
|
4010
|
-
var Table =
|
|
4011
|
-
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4035
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4036
|
+
var Table = React52.forwardRef(
|
|
4037
|
+
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { ref: containerRef, className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4012
4038
|
"table",
|
|
4013
4039
|
{
|
|
4014
4040
|
ref,
|
|
@@ -4019,20 +4045,20 @@ var Table = React51.forwardRef(
|
|
|
4019
4045
|
) })
|
|
4020
4046
|
);
|
|
4021
4047
|
Table.displayName = "Table";
|
|
4022
|
-
var TableHeader =
|
|
4023
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4048
|
+
var TableHeader = React52.forwardRef(
|
|
4049
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("thead", { ref, className, ...props })
|
|
4024
4050
|
);
|
|
4025
4051
|
TableHeader.displayName = "TableHeader";
|
|
4026
|
-
var TableFooter =
|
|
4027
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4052
|
+
var TableFooter = React52.forwardRef(
|
|
4053
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("tfoot", { ref, className: cn("border-t border-border bg-background text-ui-label", className), ...props })
|
|
4028
4054
|
);
|
|
4029
4055
|
TableFooter.displayName = "TableFooter";
|
|
4030
|
-
var TableBody =
|
|
4031
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4056
|
+
var TableBody = React52.forwardRef(
|
|
4057
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("tbody", { ref, className, ...props })
|
|
4032
4058
|
);
|
|
4033
4059
|
TableBody.displayName = "TableBody";
|
|
4034
|
-
var TableRow =
|
|
4035
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4060
|
+
var TableRow = React52.forwardRef(
|
|
4061
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4036
4062
|
"tr",
|
|
4037
4063
|
{
|
|
4038
4064
|
ref,
|
|
@@ -4049,10 +4075,10 @@ var TableRow = React51.forwardRef(
|
|
|
4049
4075
|
);
|
|
4050
4076
|
TableRow.displayName = "TableRow";
|
|
4051
4077
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
4052
|
-
var TableHead =
|
|
4078
|
+
var TableHead = React52.forwardRef(
|
|
4053
4079
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, resizer, children, ...props }, ref) => {
|
|
4054
|
-
const caret = sort === "asc" ? /* @__PURE__ */ (0,
|
|
4055
|
-
return /* @__PURE__ */ (0,
|
|
4080
|
+
const caret = sort === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react28.CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react28.CaretDown, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
4081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4056
4082
|
"th",
|
|
4057
4083
|
{
|
|
4058
4084
|
ref,
|
|
@@ -4067,7 +4093,7 @@ var TableHead = React51.forwardRef(
|
|
|
4067
4093
|
),
|
|
4068
4094
|
...props,
|
|
4069
4095
|
children: [
|
|
4070
|
-
sortable ? /* @__PURE__ */ (0,
|
|
4096
|
+
sortable ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4071
4097
|
"button",
|
|
4072
4098
|
{
|
|
4073
4099
|
type: "button",
|
|
@@ -4078,7 +4104,7 @@ var TableHead = React51.forwardRef(
|
|
|
4078
4104
|
caret
|
|
4079
4105
|
]
|
|
4080
4106
|
}
|
|
4081
|
-
) : checkbox ? /* @__PURE__ */ (0,
|
|
4107
|
+
) : checkbox ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex items-center justify-center", children }) : children,
|
|
4082
4108
|
resizer
|
|
4083
4109
|
]
|
|
4084
4110
|
}
|
|
@@ -4086,8 +4112,8 @@ var TableHead = React51.forwardRef(
|
|
|
4086
4112
|
}
|
|
4087
4113
|
);
|
|
4088
4114
|
TableHead.displayName = "TableHead";
|
|
4089
|
-
var TableCell =
|
|
4090
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
4115
|
+
var TableCell = React52.forwardRef(
|
|
4116
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
4091
4117
|
"td",
|
|
4092
4118
|
{
|
|
4093
4119
|
ref,
|
|
@@ -4100,31 +4126,31 @@ var TableCell = React51.forwardRef(
|
|
|
4100
4126
|
className
|
|
4101
4127
|
),
|
|
4102
4128
|
...props,
|
|
4103
|
-
children: checkbox ? /* @__PURE__ */ (0,
|
|
4129
|
+
children: checkbox ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
4104
4130
|
}
|
|
4105
4131
|
)
|
|
4106
4132
|
);
|
|
4107
4133
|
TableCell.displayName = "TableCell";
|
|
4108
4134
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
4109
|
-
return /* @__PURE__ */ (0,
|
|
4135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
4110
4136
|
avatar,
|
|
4111
|
-
/* @__PURE__ */ (0,
|
|
4112
|
-
/* @__PURE__ */ (0,
|
|
4113
|
-
secondary && /* @__PURE__ */ (0,
|
|
4137
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
4138
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
4139
|
+
secondary && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
4114
4140
|
] })
|
|
4115
4141
|
] });
|
|
4116
4142
|
}
|
|
4117
4143
|
|
|
4118
4144
|
// src/components/Data Display/DataTable.tsx
|
|
4119
|
-
var
|
|
4145
|
+
var React54 = __toESM(require("react"), 1);
|
|
4120
4146
|
var import_react30 = require("@phosphor-icons/react");
|
|
4121
4147
|
var import_react_table = require("@tanstack/react-table");
|
|
4122
4148
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
4123
4149
|
|
|
4124
4150
|
// src/components/Utility/Pagination.tsx
|
|
4125
|
-
var
|
|
4151
|
+
var React53 = __toESM(require("react"), 1);
|
|
4126
4152
|
var import_react29 = require("@phosphor-icons/react");
|
|
4127
|
-
var
|
|
4153
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4128
4154
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
4129
4155
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
4130
4156
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -4138,10 +4164,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
4138
4164
|
});
|
|
4139
4165
|
return items;
|
|
4140
4166
|
}
|
|
4141
|
-
var Pagination =
|
|
4167
|
+
var Pagination = React53.forwardRef(
|
|
4142
4168
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
4143
4169
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
4144
|
-
const previous = /* @__PURE__ */ (0,
|
|
4170
|
+
const previous = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4145
4171
|
Button,
|
|
4146
4172
|
{
|
|
4147
4173
|
type: "button",
|
|
@@ -4150,10 +4176,10 @@ var Pagination = React52.forwardRef(
|
|
|
4150
4176
|
"aria-label": "Previous page",
|
|
4151
4177
|
disabled: page <= 1,
|
|
4152
4178
|
onClick: () => go(page - 1),
|
|
4153
|
-
children: /* @__PURE__ */ (0,
|
|
4179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react29.ArrowLeft, { size: 16, "aria-hidden": true })
|
|
4154
4180
|
}
|
|
4155
4181
|
);
|
|
4156
|
-
const next = /* @__PURE__ */ (0,
|
|
4182
|
+
const next = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4157
4183
|
Button,
|
|
4158
4184
|
{
|
|
4159
4185
|
type: "button",
|
|
@@ -4162,10 +4188,10 @@ var Pagination = React52.forwardRef(
|
|
|
4162
4188
|
"aria-label": "Next page",
|
|
4163
4189
|
disabled: page >= pageCount,
|
|
4164
4190
|
onClick: () => go(page + 1),
|
|
4165
|
-
children: /* @__PURE__ */ (0,
|
|
4191
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react29.ArrowRight, { size: 16, "aria-hidden": true })
|
|
4166
4192
|
}
|
|
4167
4193
|
);
|
|
4168
|
-
return /* @__PURE__ */ (0,
|
|
4194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
4169
4195
|
"nav",
|
|
4170
4196
|
{
|
|
4171
4197
|
ref,
|
|
@@ -4174,14 +4200,14 @@ var Pagination = React52.forwardRef(
|
|
|
4174
4200
|
...props,
|
|
4175
4201
|
children: [
|
|
4176
4202
|
previous,
|
|
4177
|
-
variant === "compact" ? /* @__PURE__ */ (0,
|
|
4203
|
+
variant === "compact" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
4178
4204
|
page,
|
|
4179
4205
|
"/",
|
|
4180
4206
|
pageCount
|
|
4181
|
-
] }) : /* @__PURE__ */ (0,
|
|
4182
|
-
/* @__PURE__ */ (0,
|
|
4183
|
-
/* @__PURE__ */ (0,
|
|
4184
|
-
] }) : /* @__PURE__ */ (0,
|
|
4207
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("li", { children: item === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react29.DotsThree, { size: 16, "aria-hidden": true }),
|
|
4209
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "sr-only", children: "More pages" })
|
|
4210
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4185
4211
|
Button,
|
|
4186
4212
|
{
|
|
4187
4213
|
type: "button",
|
|
@@ -4202,7 +4228,7 @@ var Pagination = React52.forwardRef(
|
|
|
4202
4228
|
Pagination.displayName = "Pagination";
|
|
4203
4229
|
|
|
4204
4230
|
// src/components/Data Display/DataTable.tsx
|
|
4205
|
-
var
|
|
4231
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4206
4232
|
var features = (0, import_react_table.tableFeatures)({
|
|
4207
4233
|
rowSortingFeature: import_react_table.rowSortingFeature,
|
|
4208
4234
|
rowPaginationFeature: import_react_table.rowPaginationFeature,
|
|
@@ -4257,9 +4283,9 @@ var features = (0, import_react_table.tableFeatures)({
|
|
|
4257
4283
|
});
|
|
4258
4284
|
var getMeta = (meta) => meta ?? {};
|
|
4259
4285
|
function useControllable(value, initial, onChange) {
|
|
4260
|
-
const [internal, setInternal] =
|
|
4286
|
+
const [internal, setInternal] = React54.useState(initial);
|
|
4261
4287
|
const current = value ?? internal;
|
|
4262
|
-
const update =
|
|
4288
|
+
const update = React54.useCallback(
|
|
4263
4289
|
(updater) => {
|
|
4264
4290
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
4265
4291
|
if (value === void 0) setInternal(next);
|
|
@@ -4298,16 +4324,16 @@ function ColumnFilter({ column }) {
|
|
|
4298
4324
|
const value = column.getFilterValue();
|
|
4299
4325
|
if (variant === "select") {
|
|
4300
4326
|
const options = [...column.getFacetedUniqueValues().entries()].sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
4301
|
-
return /* @__PURE__ */ (0,
|
|
4327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4302
4328
|
Select,
|
|
4303
4329
|
{
|
|
4304
4330
|
value: typeof value === "string" ? value : ALL,
|
|
4305
4331
|
onValueChange: (next) => column.setFilterValue(next === ALL ? void 0 : next),
|
|
4306
4332
|
children: [
|
|
4307
|
-
/* @__PURE__ */ (0,
|
|
4308
|
-
/* @__PURE__ */ (0,
|
|
4309
|
-
/* @__PURE__ */ (0,
|
|
4310
|
-
options.map(([option, count]) => /* @__PURE__ */ (0,
|
|
4333
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectTrigger, { "aria-label": `Filter ${label}`, className: "h-8 text-body-small", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectValue, {}) }),
|
|
4334
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(SelectContent, { children: [
|
|
4335
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(SelectItem, { value: ALL, children: "All" }),
|
|
4336
|
+
options.map(([option, count]) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(SelectItem, { value: String(option), children: [
|
|
4311
4337
|
String(option),
|
|
4312
4338
|
" (",
|
|
4313
4339
|
count,
|
|
@@ -4326,8 +4352,8 @@ function ColumnFilter({ column }) {
|
|
|
4326
4352
|
next[index] = raw === "" ? void 0 : Number(raw);
|
|
4327
4353
|
column.setFilterValue(next[0] === void 0 && next[1] === void 0 ? void 0 : next);
|
|
4328
4354
|
};
|
|
4329
|
-
return /* @__PURE__ */ (0,
|
|
4330
|
-
/* @__PURE__ */ (0,
|
|
4355
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex gap-1", children: [
|
|
4356
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4331
4357
|
Input,
|
|
4332
4358
|
{
|
|
4333
4359
|
type: "number",
|
|
@@ -4338,7 +4364,7 @@ function ColumnFilter({ column }) {
|
|
|
4338
4364
|
className: "h-8 text-body-small"
|
|
4339
4365
|
}
|
|
4340
4366
|
),
|
|
4341
|
-
/* @__PURE__ */ (0,
|
|
4367
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4342
4368
|
Input,
|
|
4343
4369
|
{
|
|
4344
4370
|
type: "number",
|
|
@@ -4351,7 +4377,7 @@ function ColumnFilter({ column }) {
|
|
|
4351
4377
|
)
|
|
4352
4378
|
] });
|
|
4353
4379
|
}
|
|
4354
|
-
return /* @__PURE__ */ (0,
|
|
4380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4355
4381
|
Input,
|
|
4356
4382
|
{
|
|
4357
4383
|
"aria-label": `Filter ${label}`,
|
|
@@ -4364,9 +4390,9 @@ function ColumnFilter({ column }) {
|
|
|
4364
4390
|
}
|
|
4365
4391
|
function EditableCell({ value, label, type, onCommit }) {
|
|
4366
4392
|
const initial = value == null ? "" : String(value);
|
|
4367
|
-
const [draft, setDraft] =
|
|
4368
|
-
const cancelled =
|
|
4369
|
-
return /* @__PURE__ */ (0,
|
|
4393
|
+
const [draft, setDraft] = React54.useState(null);
|
|
4394
|
+
const cancelled = React54.useRef(false);
|
|
4395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4370
4396
|
Input,
|
|
4371
4397
|
{
|
|
4372
4398
|
type,
|
|
@@ -4504,7 +4530,7 @@ function DataTableInner({
|
|
|
4504
4530
|
onPaginationChange
|
|
4505
4531
|
);
|
|
4506
4532
|
const [density, setDensity] = useControllable(densityProp, "default", onDensityChange);
|
|
4507
|
-
const [cellSelection, setCellSelection] =
|
|
4533
|
+
const [cellSelection, setCellSelection] = React54.useState([]);
|
|
4508
4534
|
const infinite = Boolean(onLoadMore);
|
|
4509
4535
|
const paginate = !virtualized && !infinite;
|
|
4510
4536
|
const compact = density === "compact";
|
|
@@ -4577,12 +4603,12 @@ function DataTableInner({
|
|
|
4577
4603
|
const cellDensity = compact ? "h-8 py-1.5" : void 0;
|
|
4578
4604
|
const allSelected = table.getIsAllPageRowsSelected();
|
|
4579
4605
|
const someSelected = table.getIsSomePageRowsSelected();
|
|
4580
|
-
const dragged =
|
|
4606
|
+
const dragged = React54.useRef(null);
|
|
4581
4607
|
const topRows = enableRowPinning ? table.getTopRows() : [];
|
|
4582
4608
|
const bottomRows = enableRowPinning ? table.getBottomRows() : [];
|
|
4583
4609
|
const bodyRows = enableRowPinning ? table.getCenterRows() : table.getRowModel().rows;
|
|
4584
|
-
const scrollRef =
|
|
4585
|
-
const setScrollRef =
|
|
4610
|
+
const scrollRef = React54.useRef(null);
|
|
4611
|
+
const setScrollRef = React54.useCallback(
|
|
4586
4612
|
(node) => {
|
|
4587
4613
|
scrollRef.current = node;
|
|
4588
4614
|
if (typeof containerRef === "function") containerRef(node);
|
|
@@ -4601,8 +4627,8 @@ function DataTableInner({
|
|
|
4601
4627
|
const virtualItems = virtualized ? virtualizer.getVirtualItems() : [];
|
|
4602
4628
|
const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
|
|
4603
4629
|
const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems.at(-1)?.end ?? 0) : 0;
|
|
4604
|
-
const sentinelRef =
|
|
4605
|
-
|
|
4630
|
+
const sentinelRef = React54.useRef(null);
|
|
4631
|
+
React54.useEffect(() => {
|
|
4606
4632
|
const node = sentinelRef.current;
|
|
4607
4633
|
if (!node || !onLoadMore || !hasMore || loadingMore || typeof IntersectionObserver === "undefined") return;
|
|
4608
4634
|
const container = scrollRef.current;
|
|
@@ -4643,15 +4669,15 @@ function DataTableInner({
|
|
|
4643
4669
|
table.resetCellSelection(true);
|
|
4644
4670
|
}
|
|
4645
4671
|
};
|
|
4646
|
-
const skeletonRow = (rowKey) => /* @__PURE__ */ (0,
|
|
4672
|
+
const skeletonRow = (rowKey) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableRow, { className: "hover:bg-transparent", children: Array.from({ length: columnSpan }, (_, cell) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableCell, { checkbox: enableRowSelection && cell === 0, className: cellDensity, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { "aria-hidden": true, className: "block h-4 w-3/4 animate-pulse rounded-xs bg-border" }) }, cell)) }, rowKey);
|
|
4647
4673
|
const renderRow = (row, options = {}) => {
|
|
4648
4674
|
const { pinned, pinnedIndex = 0, pinnedCount = 1, virtualIndex } = options;
|
|
4649
4675
|
const grouped = row.getIsGrouped();
|
|
4650
4676
|
const rowUnits = compact ? 8 : 10;
|
|
4651
4677
|
const pinStyle = pinned ? pinned === "top" ? { position: "sticky", top: `calc(var(--spacing) * ${rowUnits * (pinnedIndex + 1)})` } : { position: "sticky", bottom: `calc(var(--spacing) * ${rowUnits * (pinnedCount - 1 - pinnedIndex)})` } : void 0;
|
|
4652
4678
|
const cells = row.getVisibleCells();
|
|
4653
|
-
return /* @__PURE__ */ (0,
|
|
4654
|
-
/* @__PURE__ */ (0,
|
|
4679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(React54.Fragment, { children: [
|
|
4680
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4655
4681
|
TableRow,
|
|
4656
4682
|
{
|
|
4657
4683
|
ref: virtualized && virtualIndex !== void 0 ? virtualizer.measureElement : void 0,
|
|
@@ -4661,7 +4687,7 @@ function DataTableInner({
|
|
|
4661
4687
|
onClick: onRowClick && !grouped ? () => onRowClick(row.original) : void 0,
|
|
4662
4688
|
className: cn(pinned && "z-20 bg-surface", grouped && "bg-background", onRowClick && !grouped && "cursor-pointer"),
|
|
4663
4689
|
children: [
|
|
4664
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
4690
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4665
4691
|
Checkbox,
|
|
4666
4692
|
{
|
|
4667
4693
|
"aria-label": "Select row",
|
|
@@ -4670,7 +4696,7 @@ function DataTableInner({
|
|
|
4670
4696
|
onCheckedChange: (checked) => row.toggleSelected(Boolean(checked))
|
|
4671
4697
|
}
|
|
4672
4698
|
) }),
|
|
4673
|
-
hasExpander && /* @__PURE__ */ (0,
|
|
4699
|
+
hasExpander && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && row.getCanExpand() && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4674
4700
|
Button,
|
|
4675
4701
|
{
|
|
4676
4702
|
type: "button",
|
|
@@ -4679,10 +4705,10 @@ function DataTableInner({
|
|
|
4679
4705
|
"aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
|
|
4680
4706
|
"aria-expanded": row.getIsExpanded(),
|
|
4681
4707
|
onClick: () => row.toggleExpanded(),
|
|
4682
|
-
children: row.getIsExpanded() ? /* @__PURE__ */ (0,
|
|
4708
|
+
children: row.getIsExpanded() ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.CaretDown, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.CaretRight, { size: 16, "aria-hidden": true })
|
|
4683
4709
|
}
|
|
4684
4710
|
) }),
|
|
4685
|
-
enableRowPinning && /* @__PURE__ */ (0,
|
|
4711
|
+
enableRowPinning && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4686
4712
|
Button,
|
|
4687
4713
|
{
|
|
4688
4714
|
type: "button",
|
|
@@ -4691,7 +4717,7 @@ function DataTableInner({
|
|
|
4691
4717
|
"aria-label": row.getIsPinned() ? "Unpin row" : "Pin row to top",
|
|
4692
4718
|
"aria-pressed": Boolean(row.getIsPinned()),
|
|
4693
4719
|
onClick: () => row.pin(row.getIsPinned() ? false : "top"),
|
|
4694
|
-
children: row.getIsPinned() ? /* @__PURE__ */ (0,
|
|
4720
|
+
children: row.getIsPinned() ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.PushPinSlash, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.PushPin, { size: 16, "aria-hidden": true })
|
|
4695
4721
|
}
|
|
4696
4722
|
) }),
|
|
4697
4723
|
cells.map((cell, index) => {
|
|
@@ -4704,7 +4730,7 @@ function DataTableInner({
|
|
|
4704
4730
|
const indent = index === 0 && hasExpander && row.depth > 0 ? row.depth * 4 : 0;
|
|
4705
4731
|
let content;
|
|
4706
4732
|
if (cell.getIsGrouped()) {
|
|
4707
|
-
content = /* @__PURE__ */ (0,
|
|
4733
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4708
4734
|
"button",
|
|
4709
4735
|
{
|
|
4710
4736
|
type: "button",
|
|
@@ -4712,9 +4738,9 @@ function DataTableInner({
|
|
|
4712
4738
|
"aria-expanded": row.getIsExpanded(),
|
|
4713
4739
|
onClick: row.getToggleExpandedHandler(),
|
|
4714
4740
|
children: [
|
|
4715
|
-
row.getIsExpanded() ? /* @__PURE__ */ (0,
|
|
4741
|
+
row.getIsExpanded() ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.CaretDown, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.CaretRight, { size: 16, "aria-hidden": true }),
|
|
4716
4742
|
(0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()),
|
|
4717
|
-
/* @__PURE__ */ (0,
|
|
4743
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-secondary-muted-foreground", children: [
|
|
4718
4744
|
"(",
|
|
4719
4745
|
row.subRows.length,
|
|
4720
4746
|
")"
|
|
@@ -4727,7 +4753,7 @@ function DataTableInner({
|
|
|
4727
4753
|
} else if (cell.getIsPlaceholder()) {
|
|
4728
4754
|
content = null;
|
|
4729
4755
|
} else if (meta.editable) {
|
|
4730
|
-
content = /* @__PURE__ */ (0,
|
|
4756
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4731
4757
|
EditableCell,
|
|
4732
4758
|
{
|
|
4733
4759
|
value: cell.getValue(),
|
|
@@ -4739,7 +4765,7 @@ function DataTableInner({
|
|
|
4739
4765
|
} else {
|
|
4740
4766
|
content = (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
4741
4767
|
}
|
|
4742
|
-
return /* @__PURE__ */ (0,
|
|
4768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4743
4769
|
TableCell,
|
|
4744
4770
|
{
|
|
4745
4771
|
align: meta.align,
|
|
@@ -4772,7 +4798,7 @@ function DataTableInner({
|
|
|
4772
4798
|
]
|
|
4773
4799
|
}
|
|
4774
4800
|
),
|
|
4775
|
-
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ (0,
|
|
4801
|
+
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableRow, { className: "bg-background hover:bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableCell, { colSpan: columnSpan, children: renderSubComponent(row.original) }) })
|
|
4776
4802
|
] }, row.id);
|
|
4777
4803
|
};
|
|
4778
4804
|
const renderHeaderCell = (header) => {
|
|
@@ -4783,7 +4809,7 @@ function DataTableInner({
|
|
|
4783
4809
|
const pin = pinning(column, sized, true);
|
|
4784
4810
|
const reorderable = enableColumnOrdering && leaf && !column.getIsPinned();
|
|
4785
4811
|
const label = labelOf(column);
|
|
4786
|
-
return /* @__PURE__ */ (0,
|
|
4812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4787
4813
|
TableHead,
|
|
4788
4814
|
{
|
|
4789
4815
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
@@ -4819,7 +4845,7 @@ function DataTableInner({
|
|
|
4819
4845
|
reorderable && "cursor-grab",
|
|
4820
4846
|
!leaf && "text-center"
|
|
4821
4847
|
),
|
|
4822
|
-
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ (0,
|
|
4848
|
+
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4823
4849
|
"div",
|
|
4824
4850
|
{
|
|
4825
4851
|
role: "separator",
|
|
@@ -4834,14 +4860,14 @@ function DataTableInner({
|
|
|
4834
4860
|
)
|
|
4835
4861
|
}
|
|
4836
4862
|
) : void 0,
|
|
4837
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */ (0,
|
|
4863
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(table.FlexRender, { header })
|
|
4838
4864
|
},
|
|
4839
4865
|
header.id
|
|
4840
4866
|
);
|
|
4841
4867
|
};
|
|
4842
4868
|
const stickyLeading = cn(cellDensity, sticky && "sticky top-0 z-20 bg-surface");
|
|
4843
|
-
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ (0,
|
|
4844
|
-
enableRowSelection && /* @__PURE__ */ (0,
|
|
4869
|
+
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
4870
|
+
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4845
4871
|
Checkbox,
|
|
4846
4872
|
{
|
|
4847
4873
|
"aria-label": "Select all rows",
|
|
@@ -4850,15 +4876,15 @@ function DataTableInner({
|
|
|
4850
4876
|
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(Boolean(checked))
|
|
4851
4877
|
}
|
|
4852
4878
|
) }),
|
|
4853
|
-
hasExpander && /* @__PURE__ */ (0,
|
|
4854
|
-
enableRowPinning && /* @__PURE__ */ (0,
|
|
4879
|
+
hasExpander && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sr-only", children: "Expand" }) }),
|
|
4880
|
+
enableRowPinning && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "sr-only", children: "Pin" }) })
|
|
4855
4881
|
] });
|
|
4856
4882
|
const rowsToRender = virtualized ? virtualItems.map((item) => ({ row: bodyRows[item.index], index: item.index })) : null;
|
|
4857
4883
|
const totalRows = topRows.length + bodyRows.length + bottomRows.length;
|
|
4858
|
-
return /* @__PURE__ */ (0,
|
|
4859
|
-
showToolbar && /* @__PURE__ */ (0,
|
|
4860
|
-
/* @__PURE__ */ (0,
|
|
4861
|
-
enableGlobalFilter && /* @__PURE__ */ (0,
|
|
4884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: cn("flex w-full flex-col gap-2", wrapperClassName), children: [
|
|
4885
|
+
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4886
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4887
|
+
enableGlobalFilter && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4862
4888
|
SearchBar,
|
|
4863
4889
|
{
|
|
4864
4890
|
"aria-label": "Search table",
|
|
@@ -4871,8 +4897,8 @@ function DataTableInner({
|
|
|
4871
4897
|
),
|
|
4872
4898
|
toolbar
|
|
4873
4899
|
] }),
|
|
4874
|
-
/* @__PURE__ */ (0,
|
|
4875
|
-
enableDensityToggle && /* @__PURE__ */ (0,
|
|
4900
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4901
|
+
enableDensityToggle && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4876
4902
|
Button,
|
|
4877
4903
|
{
|
|
4878
4904
|
type: "button",
|
|
@@ -4881,20 +4907,20 @@ function DataTableInner({
|
|
|
4881
4907
|
"aria-pressed": compact,
|
|
4882
4908
|
onClick: () => setDensity(compact ? "default" : "compact"),
|
|
4883
4909
|
children: [
|
|
4884
|
-
/* @__PURE__ */ (0,
|
|
4910
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.Rows, { size: 16, "aria-hidden": true }),
|
|
4885
4911
|
"Compact"
|
|
4886
4912
|
]
|
|
4887
4913
|
}
|
|
4888
4914
|
),
|
|
4889
|
-
enableGrouping && /* @__PURE__ */ (0,
|
|
4890
|
-
/* @__PURE__ */ (0,
|
|
4891
|
-
/* @__PURE__ */ (0,
|
|
4915
|
+
enableGrouping && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(DropdownMenu, { children: [
|
|
4916
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4917
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.Stack, { size: 16, "aria-hidden": true }),
|
|
4892
4918
|
"Group by"
|
|
4893
4919
|
] }) }),
|
|
4894
|
-
/* @__PURE__ */ (0,
|
|
4895
|
-
/* @__PURE__ */ (0,
|
|
4896
|
-
/* @__PURE__ */ (0,
|
|
4897
|
-
groupableColumns.map((column) => /* @__PURE__ */ (0,
|
|
4920
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
4921
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuLabel, { children: "Group rows by" }),
|
|
4922
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuSeparator, {}),
|
|
4923
|
+
groupableColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4898
4924
|
DropdownMenuCheckboxItem,
|
|
4899
4925
|
{
|
|
4900
4926
|
checked: column.getIsGrouped(),
|
|
@@ -4905,15 +4931,15 @@ function DataTableInner({
|
|
|
4905
4931
|
))
|
|
4906
4932
|
] })
|
|
4907
4933
|
] }),
|
|
4908
|
-
enableColumnVisibility && /* @__PURE__ */ (0,
|
|
4909
|
-
/* @__PURE__ */ (0,
|
|
4910
|
-
/* @__PURE__ */ (0,
|
|
4934
|
+
enableColumnVisibility && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(DropdownMenu, { children: [
|
|
4935
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4936
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react30.Sliders, { size: 16, "aria-hidden": true }),
|
|
4911
4937
|
"Columns"
|
|
4912
4938
|
] }) }),
|
|
4913
|
-
/* @__PURE__ */ (0,
|
|
4914
|
-
/* @__PURE__ */ (0,
|
|
4915
|
-
/* @__PURE__ */ (0,
|
|
4916
|
-
hideableColumns.map((column) => /* @__PURE__ */ (0,
|
|
4939
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
4940
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
4941
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DropdownMenuSeparator, {}),
|
|
4942
|
+
hideableColumns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4917
4943
|
DropdownMenuCheckboxItem,
|
|
4918
4944
|
{
|
|
4919
4945
|
checked: column.getIsVisible(),
|
|
@@ -4926,7 +4952,7 @@ function DataTableInner({
|
|
|
4926
4952
|
] })
|
|
4927
4953
|
] })
|
|
4928
4954
|
] }),
|
|
4929
|
-
/* @__PURE__ */ (0,
|
|
4955
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
4930
4956
|
Table,
|
|
4931
4957
|
{
|
|
4932
4958
|
ref,
|
|
@@ -4939,52 +4965,52 @@ function DataTableInner({
|
|
|
4939
4965
|
tabIndex: enableCellSelection ? 0 : void 0,
|
|
4940
4966
|
...tableProps,
|
|
4941
4967
|
children: [
|
|
4942
|
-
/* @__PURE__ */ (0,
|
|
4943
|
-
headerGroups.map((group, groupIndex) => /* @__PURE__ */ (0,
|
|
4968
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(TableHeader, { children: [
|
|
4969
|
+
headerGroups.map((group, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(TableRow, { className: "hover:bg-transparent", children: [
|
|
4944
4970
|
groupIndex === 0 && leadingHeaderCells(headerGroups.length + (enableColumnFilters ? 1 : 0)),
|
|
4945
4971
|
group.headers.map(renderHeaderCell)
|
|
4946
4972
|
] }, group.id)),
|
|
4947
|
-
enableColumnFilters && /* @__PURE__ */ (0,
|
|
4973
|
+
enableColumnFilters && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableRow, { className: "hover:bg-transparent", children: leafColumns.map((column) => {
|
|
4948
4974
|
const pin = pinning(column, sized, true);
|
|
4949
|
-
return /* @__PURE__ */ (0,
|
|
4975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4950
4976
|
TableHead,
|
|
4951
4977
|
{
|
|
4952
4978
|
style: pin.style,
|
|
4953
4979
|
className: cn("h-auto py-2 font-normal", pin.className, sticky && !column.getIsPinned() && "bg-surface"),
|
|
4954
|
-
children: column.getCanFilter() ? /* @__PURE__ */ (0,
|
|
4980
|
+
children: column.getCanFilter() ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ColumnFilter, { column }) : null
|
|
4955
4981
|
},
|
|
4956
4982
|
column.id
|
|
4957
4983
|
);
|
|
4958
4984
|
}) })
|
|
4959
4985
|
] }),
|
|
4960
|
-
/* @__PURE__ */ (0,
|
|
4961
|
-
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ (0,
|
|
4986
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(TableBody, { children: [
|
|
4987
|
+
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableCell, { colSpan: columnSpan, muted: true, className: "h-24 text-center", children: emptyState ?? "No results." }) }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
4962
4988
|
topRows.map((row, index) => renderRow(row, { pinned: "top", pinnedIndex: index, pinnedCount: topRows.length })),
|
|
4963
|
-
virtualized && paddingTop > 0 && /* @__PURE__ */ (0,
|
|
4989
|
+
virtualized && paddingTop > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { colSpan: columnSpan, style: { height: paddingTop } }) }),
|
|
4964
4990
|
rowsToRender ? rowsToRender.map(({ row, index }) => renderRow(row, { virtualIndex: index })) : bodyRows.map((row) => renderRow(row)),
|
|
4965
|
-
virtualized && paddingBottom > 0 && /* @__PURE__ */ (0,
|
|
4991
|
+
virtualized && paddingBottom > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { colSpan: columnSpan, style: { height: paddingBottom } }) }),
|
|
4966
4992
|
bottomRows.map(
|
|
4967
4993
|
(row, index) => renderRow(row, { pinned: "bottom", pinnedIndex: index, pinnedCount: bottomRows.length })
|
|
4968
4994
|
)
|
|
4969
4995
|
] }),
|
|
4970
|
-
infinite && /* @__PURE__ */ (0,
|
|
4996
|
+
infinite && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
4971
4997
|
loadingMore && Array.from({ length: 3 }, (_, index) => skeletonRow(`more-${index}`)),
|
|
4972
|
-
/* @__PURE__ */ (0,
|
|
4998
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("tr", { ref: sentinelRef, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("td", { colSpan: columnSpan, className: "h-px p-0" }) })
|
|
4973
4999
|
] })
|
|
4974
5000
|
] }),
|
|
4975
|
-
showFooter && /* @__PURE__ */ (0,
|
|
4976
|
-
leadingCount > 0 && /* @__PURE__ */ (0,
|
|
5001
|
+
showFooter && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableFooter, { children: table.getFooterGroups().map((group) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(TableRow, { className: "hover:bg-transparent", children: [
|
|
5002
|
+
leadingCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TableCell, { colSpan: leadingCount, className: cellDensity }),
|
|
4977
5003
|
group.headers.map((header) => {
|
|
4978
5004
|
const { align } = getMeta(header.column.columnDef.meta);
|
|
4979
5005
|
const pin = pinning(header.column, sized);
|
|
4980
|
-
return /* @__PURE__ */ (0,
|
|
5006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4981
5007
|
TableCell,
|
|
4982
5008
|
{
|
|
4983
5009
|
align,
|
|
4984
5010
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
4985
5011
|
style: pin.style,
|
|
4986
5012
|
className: cn("text-ui-label", pin.className, cellDensity),
|
|
4987
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */ (0,
|
|
5013
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(table.FlexRender, { footer: header })
|
|
4988
5014
|
},
|
|
4989
5015
|
header.id
|
|
4990
5016
|
);
|
|
@@ -4993,9 +5019,9 @@ function DataTableInner({
|
|
|
4993
5019
|
]
|
|
4994
5020
|
}
|
|
4995
5021
|
),
|
|
4996
|
-
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ (0,
|
|
4997
|
-
/* @__PURE__ */ (0,
|
|
4998
|
-
paginate && pageCount > 1 && /* @__PURE__ */ (0,
|
|
5022
|
+
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5023
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-body-small text-secondary-muted-foreground", "aria-live": "polite", children: enableRowSelection ? `${selectedCount} of ${table.getCoreRowModel().rows.length} row(s) selected` : null }),
|
|
5024
|
+
paginate && pageCount > 1 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4999
5025
|
Pagination,
|
|
5000
5026
|
{
|
|
5001
5027
|
page: pagination.pageIndex + 1,
|
|
@@ -5006,13 +5032,13 @@ function DataTableInner({
|
|
|
5006
5032
|
] })
|
|
5007
5033
|
] });
|
|
5008
5034
|
}
|
|
5009
|
-
var DataTable =
|
|
5035
|
+
var DataTable = React54.forwardRef(DataTableInner);
|
|
5010
5036
|
DataTable.displayName = "DataTable";
|
|
5011
5037
|
|
|
5012
5038
|
// src/components/Data Display/StatCard.tsx
|
|
5013
|
-
var
|
|
5039
|
+
var React55 = __toESM(require("react"), 1);
|
|
5014
5040
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
5015
|
-
var
|
|
5041
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5016
5042
|
var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
5017
5043
|
variants: {
|
|
5018
5044
|
variant: {
|
|
@@ -5026,26 +5052,26 @@ var statCardVariants = (0, import_class_variance_authority6.cva)("flex min-w-0 f
|
|
|
5026
5052
|
},
|
|
5027
5053
|
defaultVariants: { variant: "default" }
|
|
5028
5054
|
});
|
|
5029
|
-
var StatCard =
|
|
5030
|
-
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5031
|
-
/* @__PURE__ */ (0,
|
|
5032
|
-
/* @__PURE__ */ (0,
|
|
5033
|
-
icon && /* @__PURE__ */ (0,
|
|
5055
|
+
var StatCard = React55.forwardRef(
|
|
5056
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
5057
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
5058
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
5059
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
5034
5060
|
value
|
|
5035
5061
|
] }),
|
|
5036
|
-
caption && /* @__PURE__ */ (0,
|
|
5062
|
+
caption && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
5037
5063
|
] })
|
|
5038
5064
|
);
|
|
5039
5065
|
StatCard.displayName = "StatCard";
|
|
5040
5066
|
|
|
5041
5067
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
5042
|
-
var
|
|
5068
|
+
var React57 = __toESM(require("react"), 1);
|
|
5043
5069
|
|
|
5044
5070
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
5045
|
-
var
|
|
5071
|
+
var React56 = __toESM(require("react"), 1);
|
|
5046
5072
|
var import_react31 = require("@phosphor-icons/react");
|
|
5047
5073
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
5048
|
-
var
|
|
5074
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5049
5075
|
var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
5050
5076
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5051
5077
|
{
|
|
@@ -5060,27 +5086,27 @@ var editableTagVariants = (0, import_class_variance_authority7.cva)(
|
|
|
5060
5086
|
defaultVariants: { type: "default" }
|
|
5061
5087
|
}
|
|
5062
5088
|
);
|
|
5063
|
-
var EditableTag =
|
|
5089
|
+
var EditableTag = React56.forwardRef(
|
|
5064
5090
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
5065
5091
|
const classes = cn(editableTagVariants({ type }), className);
|
|
5066
|
-
const leading = type === "add" ? /* @__PURE__ */ (0,
|
|
5092
|
+
const leading = type === "add" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react31.Plus, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react31.Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
5067
5093
|
if (type === "add" || type === "multiple" && onClick) {
|
|
5068
|
-
return /* @__PURE__ */ (0,
|
|
5094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
5069
5095
|
leading,
|
|
5070
5096
|
children
|
|
5071
5097
|
] });
|
|
5072
5098
|
}
|
|
5073
|
-
return /* @__PURE__ */ (0,
|
|
5099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
5074
5100
|
leading,
|
|
5075
5101
|
children,
|
|
5076
|
-
onRemove && /* @__PURE__ */ (0,
|
|
5102
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5077
5103
|
"button",
|
|
5078
5104
|
{
|
|
5079
5105
|
type: "button",
|
|
5080
5106
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
5081
5107
|
onClick: onRemove,
|
|
5082
5108
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
5083
|
-
children: /* @__PURE__ */ (0,
|
|
5109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react31.X, { size: 12, "aria-hidden": true })
|
|
5084
5110
|
}
|
|
5085
5111
|
)
|
|
5086
5112
|
] });
|
|
@@ -5089,26 +5115,26 @@ var EditableTag = React55.forwardRef(
|
|
|
5089
5115
|
EditableTag.displayName = "EditableTag";
|
|
5090
5116
|
|
|
5091
5117
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
5092
|
-
var
|
|
5093
|
-
var ActivityStructure =
|
|
5094
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
5118
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5119
|
+
var ActivityStructure = React57.forwardRef(
|
|
5120
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
5095
5121
|
"section",
|
|
5096
5122
|
{
|
|
5097
5123
|
ref,
|
|
5098
5124
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
5099
5125
|
...props,
|
|
5100
5126
|
children: [
|
|
5101
|
-
/* @__PURE__ */ (0,
|
|
5102
|
-
/* @__PURE__ */ (0,
|
|
5127
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5128
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
5103
5129
|
action
|
|
5104
5130
|
] }),
|
|
5105
|
-
stats.length > 0 && /* @__PURE__ */ (0,
|
|
5106
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0,
|
|
5107
|
-
/* @__PURE__ */ (0,
|
|
5108
|
-
/* @__PURE__ */ (0,
|
|
5109
|
-
(tags?.length || onAddTag) && /* @__PURE__ */ (0,
|
|
5110
|
-
tags?.map((tag) => /* @__PURE__ */ (0,
|
|
5111
|
-
onAddTag && /* @__PURE__ */ (0,
|
|
5131
|
+
stats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(StatCard, { ...stat }, id)) }),
|
|
5132
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5133
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
5134
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
5135
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5136
|
+
tags?.map((tag) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
5137
|
+
onAddTag && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
5112
5138
|
] })
|
|
5113
5139
|
] }, id)),
|
|
5114
5140
|
children
|
|
@@ -5119,10 +5145,10 @@ var ActivityStructure = React56.forwardRef(
|
|
|
5119
5145
|
ActivityStructure.displayName = "ActivityStructure";
|
|
5120
5146
|
|
|
5121
5147
|
// src/components/Tags & Badges/Badge.tsx
|
|
5122
|
-
var
|
|
5148
|
+
var React58 = __toESM(require("react"), 1);
|
|
5123
5149
|
var import_react32 = require("@phosphor-icons/react");
|
|
5124
5150
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
5125
|
-
var
|
|
5151
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5126
5152
|
var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
5127
5153
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5128
5154
|
{
|
|
@@ -5148,11 +5174,11 @@ var roleTagVariants = (0, import_class_variance_authority8.cva)(
|
|
|
5148
5174
|
defaultVariants: { type: "primary", selected: false }
|
|
5149
5175
|
}
|
|
5150
5176
|
);
|
|
5151
|
-
var Badge =
|
|
5177
|
+
var Badge = React58.forwardRef(
|
|
5152
5178
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
5153
5179
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
5154
5180
|
if (type === "interactable") {
|
|
5155
|
-
return /* @__PURE__ */ (0,
|
|
5181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
5156
5182
|
"button",
|
|
5157
5183
|
{
|
|
5158
5184
|
ref,
|
|
@@ -5162,15 +5188,15 @@ var Badge = React57.forwardRef(
|
|
|
5162
5188
|
onClick,
|
|
5163
5189
|
...props,
|
|
5164
5190
|
children: [
|
|
5165
|
-
/* @__PURE__ */ (0,
|
|
5191
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react32.DotsSixVertical, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
5166
5192
|
children
|
|
5167
5193
|
]
|
|
5168
5194
|
}
|
|
5169
5195
|
);
|
|
5170
5196
|
}
|
|
5171
|
-
return /* @__PURE__ */ (0,
|
|
5172
|
-
type === "question" && /* @__PURE__ */ (0,
|
|
5173
|
-
type === "id" && /* @__PURE__ */ (0,
|
|
5197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { ref, className: classes, ...props, children: [
|
|
5198
|
+
type === "question" && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react32.RadioButton, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
5199
|
+
type === "id" && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
5174
5200
|
children
|
|
5175
5201
|
] });
|
|
5176
5202
|
}
|
|
@@ -5244,6 +5270,7 @@ Badge.displayName = "Badge";
|
|
|
5244
5270
|
QuestionEditorCard,
|
|
5245
5271
|
QuestionHeader,
|
|
5246
5272
|
QuestionNavItem,
|
|
5273
|
+
QuestionNumberTag,
|
|
5247
5274
|
QuestionOption,
|
|
5248
5275
|
QuestionOptionEditor,
|
|
5249
5276
|
QuestionOtherOption,
|