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