@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.js
CHANGED
|
@@ -2963,7 +2963,7 @@ var QuestionCard = React41.forwardRef(
|
|
|
2963
2963
|
QuestionCard.displayName = "QuestionCard";
|
|
2964
2964
|
|
|
2965
2965
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
2966
|
-
import * as
|
|
2966
|
+
import * as React45 from "react";
|
|
2967
2967
|
import {
|
|
2968
2968
|
Clipboard,
|
|
2969
2969
|
Copy,
|
|
@@ -2983,6 +2983,9 @@ function keepEditingFocus(event) {
|
|
|
2983
2983
|
}
|
|
2984
2984
|
|
|
2985
2985
|
// src/components/Question Types/QuestionHeader.tsx
|
|
2986
|
+
import * as React44 from "react";
|
|
2987
|
+
|
|
2988
|
+
// src/components/Question Types/QuestionNumberTag.tsx
|
|
2986
2989
|
import * as React43 from "react";
|
|
2987
2990
|
import { DotsSixVertical } from "@phosphor-icons/react";
|
|
2988
2991
|
|
|
@@ -3007,67 +3010,77 @@ function QuestionTypeIcon({ type, size = 22.5, className, ...props }) {
|
|
|
3007
3010
|
return /* @__PURE__ */ jsx43(Icon, { size, weight: "duotone", "aria-hidden": true, className: className ?? "text-accent-foreground", ...props });
|
|
3008
3011
|
}
|
|
3009
3012
|
|
|
3010
|
-
// src/components/Question Types/
|
|
3013
|
+
// src/components/Question Types/QuestionNumberTag.tsx
|
|
3011
3014
|
import { jsx as jsx44, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3015
|
+
var QuestionNumberTag = React43.forwardRef(
|
|
3016
|
+
({ number, active, questionType, showDragHandle = true, dragHandleProps, className, ...props }, ref) => /* @__PURE__ */ jsxs31(
|
|
3017
|
+
"span",
|
|
3018
|
+
{
|
|
3019
|
+
ref,
|
|
3020
|
+
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
3021
|
+
...props,
|
|
3022
|
+
...dragHandleProps,
|
|
3023
|
+
className: cn(
|
|
3024
|
+
"group/handle inline-flex h-6 shrink-0 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
3025
|
+
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered. With a type icon the grip
|
|
3026
|
+
// takes the icon's place, so the tag keeps its padding and its width.
|
|
3027
|
+
showDragHandle && !questionType && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
3028
|
+
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",
|
|
3029
|
+
dragHandleProps && "cursor-grab touch-none select-none",
|
|
3030
|
+
dragHandleProps && showDragHandle && !questionType && "focus-visible:pl-1",
|
|
3031
|
+
className,
|
|
3032
|
+
dragHandleProps?.className
|
|
3033
|
+
),
|
|
3034
|
+
children: [
|
|
3035
|
+
questionType && /* @__PURE__ */ jsx44(
|
|
3036
|
+
QuestionTypeIcon,
|
|
3037
|
+
{
|
|
3038
|
+
type: questionType,
|
|
3039
|
+
size: 16,
|
|
3040
|
+
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3041
|
+
}
|
|
3042
|
+
),
|
|
3043
|
+
showDragHandle && /* @__PURE__ */ jsx44(
|
|
3044
|
+
DotsSixVertical,
|
|
3045
|
+
{
|
|
3046
|
+
size: 16,
|
|
3047
|
+
"aria-hidden": true,
|
|
3048
|
+
className: "hidden shrink-0 group-hover/editor:block group-data-[hovered]/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
3049
|
+
}
|
|
3050
|
+
),
|
|
3051
|
+
"Question ",
|
|
3052
|
+
number
|
|
3053
|
+
]
|
|
3054
|
+
}
|
|
3055
|
+
)
|
|
3056
|
+
);
|
|
3057
|
+
QuestionNumberTag.displayName = "QuestionNumberTag";
|
|
3058
|
+
|
|
3059
|
+
// src/components/Question Types/QuestionHeader.tsx
|
|
3060
|
+
import { jsx as jsx45, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3012
3061
|
var eyebrow = "text-ui-caption uppercase text-secondary-muted-foreground";
|
|
3013
|
-
var QuestionHeader =
|
|
3062
|
+
var QuestionHeader = React44.forwardRef(
|
|
3014
3063
|
({ 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) => {
|
|
3015
|
-
const [draft, setDraft] =
|
|
3064
|
+
const [draft, setDraft] = React44.useState(null);
|
|
3016
3065
|
const label = String(number).padStart(2, "0");
|
|
3017
3066
|
const showError = error !== void 0 && error !== false;
|
|
3018
3067
|
if (editor) {
|
|
3019
3068
|
const text = typeof title === "string" ? title : "";
|
|
3020
3069
|
const count = (draft ?? text).length;
|
|
3021
3070
|
const long = titleRecommendedMax !== void 0 && count > titleRecommendedMax;
|
|
3022
|
-
return /* @__PURE__ */
|
|
3023
|
-
/* @__PURE__ */
|
|
3024
|
-
/* @__PURE__ */
|
|
3025
|
-
/* @__PURE__ */
|
|
3026
|
-
"span",
|
|
3027
|
-
{
|
|
3028
|
-
"aria-label": dragHandleProps ? `Reorder question ${number}` : void 0,
|
|
3029
|
-
...dragHandleProps,
|
|
3030
|
-
className: cn(
|
|
3031
|
-
"group/handle inline-flex h-6 items-center gap-1 rounded-sm px-2.5 text-ui-caption",
|
|
3032
|
-
// The tag makes room for the grip on hover, and inside a QuestionEditorCard whenever the card is hovered. With a type icon the grip
|
|
3033
|
-
// takes the icon's place, so the tag keeps its padding and its width.
|
|
3034
|
-
showDragHandle && !questionType && "hover:pl-1 group-hover/editor:pl-1 group-data-[hovered]/editor:pl-1",
|
|
3035
|
-
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",
|
|
3036
|
-
dragHandleProps && "cursor-grab touch-none select-none",
|
|
3037
|
-
dragHandleProps && showDragHandle && !questionType && "focus-visible:pl-1",
|
|
3038
|
-
dragHandleProps?.className
|
|
3039
|
-
),
|
|
3040
|
-
children: [
|
|
3041
|
-
questionType && /* @__PURE__ */ jsx44(
|
|
3042
|
-
QuestionTypeIcon,
|
|
3043
|
-
{
|
|
3044
|
-
type: questionType,
|
|
3045
|
-
size: 16,
|
|
3046
|
-
className: cn("shrink-0", showDragHandle && "group-hover/editor:hidden group-data-[hovered]/editor:hidden group-hover/handle:hidden group-focus-visible/handle:hidden")
|
|
3047
|
-
}
|
|
3048
|
-
),
|
|
3049
|
-
showDragHandle && /* @__PURE__ */ jsx44(
|
|
3050
|
-
DotsSixVertical,
|
|
3051
|
-
{
|
|
3052
|
-
size: 16,
|
|
3053
|
-
"aria-hidden": true,
|
|
3054
|
-
className: "hidden shrink-0 group-hover/editor:block group-data-[hovered]/editor:block group-hover/handle:block group-focus-visible/handle:block"
|
|
3055
|
-
}
|
|
3056
|
-
),
|
|
3057
|
-
"Question ",
|
|
3058
|
-
number
|
|
3059
|
-
]
|
|
3060
|
-
}
|
|
3061
|
-
),
|
|
3071
|
+
return /* @__PURE__ */ jsxs32("div", { ref, className: cn("group/header flex w-full flex-col gap-2", className), ...props, children: [
|
|
3072
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between", children: [
|
|
3073
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-2", children: [
|
|
3074
|
+
/* @__PURE__ */ jsx45(QuestionNumberTag, { number, active, questionType, showDragHandle, dragHandleProps }),
|
|
3062
3075
|
meta
|
|
3063
3076
|
] }),
|
|
3064
|
-
actions && /* @__PURE__ */
|
|
3077
|
+
actions && /* @__PURE__ */ jsx45("div", { className: cn(
|
|
3065
3078
|
"flex items-center gap-2 opacity-0 transition-opacity group-focus-within/header:opacity-100 group-hover/header:opacity-100",
|
|
3066
3079
|
// Inside a QuestionEditorCard, hovering or focusing anywhere on the card reveals them too.
|
|
3067
3080
|
"group-focus-within/editor:opacity-100 group-hover/editor:opacity-100 group-data-[hovered]/editor:opacity-100"
|
|
3068
3081
|
), children: actions })
|
|
3069
3082
|
] }),
|
|
3070
|
-
/* @__PURE__ */
|
|
3083
|
+
/* @__PURE__ */ jsx45(
|
|
3071
3084
|
InlineEdit,
|
|
3072
3085
|
{
|
|
3073
3086
|
variant: "question",
|
|
@@ -3092,8 +3105,8 @@ var QuestionHeader = React43.forwardRef(
|
|
|
3092
3105
|
textClassName: long ? "text-body-base" : "text-heading-h4"
|
|
3093
3106
|
}
|
|
3094
3107
|
),
|
|
3095
|
-
long && titleRecommendedNote != null && /* @__PURE__ */
|
|
3096
|
-
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */
|
|
3108
|
+
long && titleRecommendedNote != null && /* @__PURE__ */ jsx45("p", { className: "text-ui-caption text-secondary-muted-foreground", children: titleRecommendedNote }),
|
|
3109
|
+
showCounter && titleMinLength === void 0 && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs32("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3097
3110
|
count,
|
|
3098
3111
|
"/",
|
|
3099
3112
|
maxLength,
|
|
@@ -3101,16 +3114,16 @@ var QuestionHeader = React43.forwardRef(
|
|
|
3101
3114
|
] })
|
|
3102
3115
|
] });
|
|
3103
3116
|
}
|
|
3104
|
-
return /* @__PURE__ */
|
|
3105
|
-
showError && /* @__PURE__ */
|
|
3106
|
-
/* @__PURE__ */
|
|
3117
|
+
return /* @__PURE__ */ jsxs32("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...props, children: [
|
|
3118
|
+
showError && /* @__PURE__ */ jsx45(ToastInline, { variant: "destructive", onClose: onDismissError, className: "min-h-10", children: /* @__PURE__ */ jsx45("span", { className: "text-ui-label text-destructive", children: error === true ? "This question is mandatory." : error }) }),
|
|
3119
|
+
/* @__PURE__ */ jsxs32("p", { className: eyebrow, children: [
|
|
3107
3120
|
"Question ",
|
|
3108
3121
|
label
|
|
3109
3122
|
] }),
|
|
3110
|
-
/* @__PURE__ */
|
|
3123
|
+
/* @__PURE__ */ jsxs32("h3", { className: "text-heading-h4 text-surface-foreground", children: [
|
|
3111
3124
|
title,
|
|
3112
|
-
required && /* @__PURE__ */
|
|
3113
|
-
required && /* @__PURE__ */
|
|
3125
|
+
required && /* @__PURE__ */ jsx45("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }),
|
|
3126
|
+
required && /* @__PURE__ */ jsx45("span", { className: "sr-only", children: " (required)" })
|
|
3114
3127
|
] })
|
|
3115
3128
|
] });
|
|
3116
3129
|
}
|
|
@@ -3118,8 +3131,8 @@ var QuestionHeader = React43.forwardRef(
|
|
|
3118
3131
|
QuestionHeader.displayName = "QuestionHeader";
|
|
3119
3132
|
|
|
3120
3133
|
// src/components/Question Types/QuestionEditorCard.tsx
|
|
3121
|
-
import { Fragment as Fragment11, jsx as
|
|
3122
|
-
var QuestionEditorCard =
|
|
3134
|
+
import { Fragment as Fragment11, jsx as jsx46, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3135
|
+
var QuestionEditorCard = React45.forwardRef(
|
|
3123
3136
|
({
|
|
3124
3137
|
className,
|
|
3125
3138
|
number,
|
|
@@ -3154,7 +3167,7 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3154
3167
|
...props
|
|
3155
3168
|
}, ref) => {
|
|
3156
3169
|
const footer = active && (countLabel != null || onAdd || onPaste);
|
|
3157
|
-
return /* @__PURE__ */
|
|
3170
|
+
return /* @__PURE__ */ jsxs33(
|
|
3158
3171
|
"div",
|
|
3159
3172
|
{
|
|
3160
3173
|
ref,
|
|
@@ -3166,7 +3179,7 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3166
3179
|
props.onMouseDown?.(event);
|
|
3167
3180
|
},
|
|
3168
3181
|
children: [
|
|
3169
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ jsxs33(
|
|
3170
3183
|
"div",
|
|
3171
3184
|
{
|
|
3172
3185
|
className: cn(
|
|
@@ -3174,9 +3187,9 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3174
3187
|
active ? "border-accent" : "border-border"
|
|
3175
3188
|
),
|
|
3176
3189
|
children: [
|
|
3177
|
-
/* @__PURE__ */
|
|
3178
|
-
/* @__PURE__ */
|
|
3179
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsxs33("div", { className: cn("flex flex-col p-6", footer ? "gap-5" : "gap-4"), children: [
|
|
3191
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-4", children: [
|
|
3192
|
+
/* @__PURE__ */ jsx46(
|
|
3180
3193
|
QuestionHeader,
|
|
3181
3194
|
{
|
|
3182
3195
|
editor: true,
|
|
@@ -3198,8 +3211,8 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3198
3211
|
onTitleMarkDismiss,
|
|
3199
3212
|
meta,
|
|
3200
3213
|
maxLength,
|
|
3201
|
-
actions: actions ?? /* @__PURE__ */
|
|
3202
|
-
/* @__PURE__ */
|
|
3214
|
+
actions: actions ?? /* @__PURE__ */ jsxs33(Fragment11, { children: [
|
|
3215
|
+
/* @__PURE__ */ jsx46(
|
|
3203
3216
|
Button,
|
|
3204
3217
|
{
|
|
3205
3218
|
type: "button",
|
|
@@ -3207,10 +3220,10 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3207
3220
|
size: "icon-sm",
|
|
3208
3221
|
"aria-label": "Duplicate question",
|
|
3209
3222
|
onClick: onDuplicate,
|
|
3210
|
-
children: /* @__PURE__ */
|
|
3223
|
+
children: /* @__PURE__ */ jsx46(Copy, { size: 16, "aria-hidden": true })
|
|
3211
3224
|
}
|
|
3212
3225
|
),
|
|
3213
|
-
/* @__PURE__ */
|
|
3226
|
+
/* @__PURE__ */ jsx46(
|
|
3214
3227
|
Button,
|
|
3215
3228
|
{
|
|
3216
3229
|
type: "button",
|
|
@@ -3218,10 +3231,10 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3218
3231
|
size: "icon-sm",
|
|
3219
3232
|
"aria-label": "Delete question",
|
|
3220
3233
|
onClick: onDelete,
|
|
3221
|
-
children: /* @__PURE__ */
|
|
3234
|
+
children: /* @__PURE__ */ jsx46(Trash4, { size: 16, "aria-hidden": true })
|
|
3222
3235
|
}
|
|
3223
3236
|
),
|
|
3224
|
-
/* @__PURE__ */
|
|
3237
|
+
/* @__PURE__ */ jsx46(
|
|
3225
3238
|
Button,
|
|
3226
3239
|
{
|
|
3227
3240
|
type: "button",
|
|
@@ -3229,7 +3242,7 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3229
3242
|
size: "icon-sm",
|
|
3230
3243
|
"aria-label": "Preview question",
|
|
3231
3244
|
onClick: onPreview,
|
|
3232
|
-
children: /* @__PURE__ */
|
|
3245
|
+
children: /* @__PURE__ */ jsx46(Eye, { size: 16, "aria-hidden": true })
|
|
3233
3246
|
}
|
|
3234
3247
|
)
|
|
3235
3248
|
] })
|
|
@@ -3237,18 +3250,18 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3237
3250
|
),
|
|
3238
3251
|
children
|
|
3239
3252
|
] }),
|
|
3240
|
-
error && /* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */
|
|
3253
|
+
error && /* @__PURE__ */ jsxs33("p", { className: "flex items-center gap-1 text-ui-caption text-destructive-foreground", children: [
|
|
3254
|
+
/* @__PURE__ */ jsx46(Warning2, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3242
3255
|
error
|
|
3243
3256
|
] }),
|
|
3244
|
-
footer && /* @__PURE__ */
|
|
3245
|
-
/* @__PURE__ */
|
|
3246
|
-
/* @__PURE__ */
|
|
3247
|
-
onAdd && /* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3257
|
+
footer && /* @__PURE__ */ jsxs33("div", { className: "flex items-center justify-between", children: [
|
|
3258
|
+
/* @__PURE__ */ jsx46("p", { className: "text-ui-caption text-secondary-muted-foreground", children: countLabel }),
|
|
3259
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
|
|
3260
|
+
onAdd && /* @__PURE__ */ jsxs33(Button, { type: "button", variant: "outline", onClick: onAdd, children: [
|
|
3261
|
+
/* @__PURE__ */ jsx46(Plus3, { size: 16, "aria-hidden": true }),
|
|
3249
3262
|
"Add choice"
|
|
3250
3263
|
] }),
|
|
3251
|
-
onPaste && /* @__PURE__ */
|
|
3264
|
+
onPaste && /* @__PURE__ */ jsx46(
|
|
3252
3265
|
Button,
|
|
3253
3266
|
{
|
|
3254
3267
|
type: "button",
|
|
@@ -3256,17 +3269,17 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3256
3269
|
size: "icon",
|
|
3257
3270
|
"aria-label": "Paste choices",
|
|
3258
3271
|
onClick: onPaste,
|
|
3259
|
-
children: /* @__PURE__ */
|
|
3272
|
+
children: /* @__PURE__ */ jsx46(Clipboard, { size: 16, "aria-hidden": true })
|
|
3260
3273
|
}
|
|
3261
3274
|
)
|
|
3262
3275
|
] })
|
|
3263
3276
|
] })
|
|
3264
3277
|
] }),
|
|
3265
|
-
note && /* @__PURE__ */
|
|
3278
|
+
note && /* @__PURE__ */ jsx46("div", { className: "border-t border-border px-2 py-2 text-body-small text-surface-foreground", children: note })
|
|
3266
3279
|
]
|
|
3267
3280
|
}
|
|
3268
3281
|
),
|
|
3269
|
-
onAskAi && /* @__PURE__ */
|
|
3282
|
+
onAskAi && /* @__PURE__ */ jsx46(
|
|
3270
3283
|
Button,
|
|
3271
3284
|
{
|
|
3272
3285
|
type: "button",
|
|
@@ -3275,7 +3288,7 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3275
3288
|
"aria-label": "Ask AI",
|
|
3276
3289
|
onClick: onAskAi,
|
|
3277
3290
|
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",
|
|
3278
|
-
children: /* @__PURE__ */
|
|
3291
|
+
children: /* @__PURE__ */ jsx46(Sparkle2, { size: 16, "aria-hidden": true })
|
|
3279
3292
|
}
|
|
3280
3293
|
)
|
|
3281
3294
|
]
|
|
@@ -3286,15 +3299,15 @@ var QuestionEditorCard = React44.forwardRef(
|
|
|
3286
3299
|
QuestionEditorCard.displayName = "QuestionEditorCard";
|
|
3287
3300
|
|
|
3288
3301
|
// src/components/Question Types/QuestionNavItem.tsx
|
|
3289
|
-
import * as
|
|
3302
|
+
import * as React46 from "react";
|
|
3290
3303
|
import { DotsSixVertical as DotsSixVertical2, Warning as Warning3, WarningCircle as WarningCircle5 } from "@phosphor-icons/react";
|
|
3291
3304
|
import { Slot as Slot3 } from "radix-ui";
|
|
3292
|
-
import { jsx as
|
|
3293
|
-
var QuestionNavItem =
|
|
3305
|
+
import { jsx as jsx47, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3306
|
+
var QuestionNavItem = React46.forwardRef(
|
|
3294
3307
|
({ className, questionType = "select-one", selected, error, warning, asChild, showDragHandle = true, hovered, children, ...props }, ref) => {
|
|
3295
3308
|
const Comp = asChild ? Slot3.Root : "button";
|
|
3296
3309
|
const warn = !error && !!warning;
|
|
3297
|
-
return /* @__PURE__ */
|
|
3310
|
+
return /* @__PURE__ */ jsxs34(
|
|
3298
3311
|
Comp,
|
|
3299
3312
|
{
|
|
3300
3313
|
ref,
|
|
@@ -3313,9 +3326,9 @@ var QuestionNavItem = React45.forwardRef(
|
|
|
3313
3326
|
),
|
|
3314
3327
|
...props,
|
|
3315
3328
|
children: [
|
|
3316
|
-
/* @__PURE__ */
|
|
3317
|
-
showDragHandle && /* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3329
|
+
/* @__PURE__ */ jsxs34("span", { "aria-hidden": "true", className: "relative flex size-4 shrink-0 items-center justify-center", children: [
|
|
3330
|
+
showDragHandle && /* @__PURE__ */ jsx47(DotsSixVertical2, { size: 16, className: "hidden group-hover/nav:block group-data-[hovered]/nav:block" }),
|
|
3331
|
+
/* @__PURE__ */ jsx47("span", { className: showDragHandle ? "group-hover/nav:hidden group-data-[hovered]/nav:hidden" : void 0, children: error ? /* @__PURE__ */ jsx47(WarningCircle5, { size: 16, className: "text-destructive-foreground" }) : warn ? /* @__PURE__ */ jsx47(Warning3, { size: 16, className: "text-warning-foreground" }) : /* @__PURE__ */ jsx47(
|
|
3319
3332
|
QuestionTypeIcon,
|
|
3320
3333
|
{
|
|
3321
3334
|
type: questionType,
|
|
@@ -3324,9 +3337,9 @@ var QuestionNavItem = React45.forwardRef(
|
|
|
3324
3337
|
}
|
|
3325
3338
|
) })
|
|
3326
3339
|
] }),
|
|
3327
|
-
/* @__PURE__ */
|
|
3328
|
-
error && /* @__PURE__ */
|
|
3329
|
-
warn && /* @__PURE__ */
|
|
3340
|
+
/* @__PURE__ */ jsx47("span", { className: "min-w-0 flex-1 truncate", children }),
|
|
3341
|
+
error && /* @__PURE__ */ jsx47("span", { className: "sr-only", children: ", has errors" }),
|
|
3342
|
+
warn && /* @__PURE__ */ jsx47("span", { className: "sr-only", children: ", has warnings" })
|
|
3330
3343
|
]
|
|
3331
3344
|
}
|
|
3332
3345
|
);
|
|
@@ -3335,14 +3348,14 @@ var QuestionNavItem = React45.forwardRef(
|
|
|
3335
3348
|
QuestionNavItem.displayName = "QuestionNavItem";
|
|
3336
3349
|
|
|
3337
3350
|
// src/components/Question Types/QuestionOption.tsx
|
|
3338
|
-
import * as
|
|
3351
|
+
import * as React47 from "react";
|
|
3339
3352
|
import { Check as Check4, DotsSixVertical as DotsSixVertical3, Plus as Plus4, Trash as Trash5, WarningCircle as WarningCircle6 } from "@phosphor-icons/react";
|
|
3340
|
-
import { Fragment as Fragment12, jsx as
|
|
3353
|
+
import { Fragment as Fragment12, jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3341
3354
|
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";
|
|
3342
3355
|
function QuestionOption(props) {
|
|
3343
|
-
const id =
|
|
3344
|
-
return /* @__PURE__ */
|
|
3345
|
-
props.kind === "checkbox" ? /* @__PURE__ */
|
|
3356
|
+
const id = React47.useId();
|
|
3357
|
+
return /* @__PURE__ */ jsxs35("label", { htmlFor: id, className: cn(optionClasses, props.className), children: [
|
|
3358
|
+
props.kind === "checkbox" ? /* @__PURE__ */ jsx48(
|
|
3346
3359
|
Checkbox,
|
|
3347
3360
|
{
|
|
3348
3361
|
id,
|
|
@@ -3351,16 +3364,16 @@ function QuestionOption(props) {
|
|
|
3351
3364
|
onCheckedChange: (next) => props.onCheckedChange?.(next === true),
|
|
3352
3365
|
disabled: props.disabled
|
|
3353
3366
|
}
|
|
3354
|
-
) : /* @__PURE__ */
|
|
3355
|
-
/* @__PURE__ */
|
|
3367
|
+
) : /* @__PURE__ */ jsx48(RadioGroupItem, { id, value: props.value, disabled: props.disabled }),
|
|
3368
|
+
/* @__PURE__ */ jsx48("span", { className: "min-w-0 flex-1", children: props.label })
|
|
3356
3369
|
] });
|
|
3357
3370
|
}
|
|
3358
|
-
var QuestionOtherOption =
|
|
3371
|
+
var QuestionOtherOption = React47.forwardRef(
|
|
3359
3372
|
({ className, onSubmit, confirmLabel = "Confirm answer", placeholder = "Type your answer", ...props }, ref) => {
|
|
3360
|
-
const inner =
|
|
3361
|
-
|
|
3373
|
+
const inner = React47.useRef(null);
|
|
3374
|
+
React47.useImperativeHandle(ref, () => inner.current);
|
|
3362
3375
|
const submit = () => onSubmit?.(inner.current?.value ?? "");
|
|
3363
|
-
return /* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ jsxs35(
|
|
3364
3377
|
"div",
|
|
3365
3378
|
{
|
|
3366
3379
|
className: cn(
|
|
@@ -3368,7 +3381,7 @@ var QuestionOtherOption = React46.forwardRef(
|
|
|
3368
3381
|
className
|
|
3369
3382
|
),
|
|
3370
3383
|
children: [
|
|
3371
|
-
/* @__PURE__ */
|
|
3384
|
+
/* @__PURE__ */ jsx48(
|
|
3372
3385
|
"input",
|
|
3373
3386
|
{
|
|
3374
3387
|
ref: inner,
|
|
@@ -3384,7 +3397,7 @@ var QuestionOtherOption = React46.forwardRef(
|
|
|
3384
3397
|
...props
|
|
3385
3398
|
}
|
|
3386
3399
|
),
|
|
3387
|
-
/* @__PURE__ */
|
|
3400
|
+
/* @__PURE__ */ jsx48(Button, { type: "button", variant: "subtle", size: "icon-sm", "aria-label": confirmLabel, onClick: submit, children: /* @__PURE__ */ jsx48(Check4, { size: 16, "aria-hidden": true }) })
|
|
3388
3401
|
]
|
|
3389
3402
|
}
|
|
3390
3403
|
);
|
|
@@ -3399,16 +3412,16 @@ function limitsText2(min, max) {
|
|
|
3399
3412
|
function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTone = "muted", minLength, maxLength, onRemove, onAdd, removeDisabled, addDisabled, className, kind, rank, dragHandleProps, lifted, locked, marks, onMarkApply, onMarkDismiss }) {
|
|
3400
3413
|
const reveal = kind !== void 0;
|
|
3401
3414
|
const guarded = minLength !== void 0 || maxLength !== void 0;
|
|
3402
|
-
const [draft, setDraft] =
|
|
3403
|
-
const [error, setError] =
|
|
3404
|
-
const helperId =
|
|
3405
|
-
const [focused, setFocused] =
|
|
3415
|
+
const [draft, setDraft] = React47.useState(null);
|
|
3416
|
+
const [error, setError] = React47.useState(null);
|
|
3417
|
+
const helperId = React47.useId();
|
|
3418
|
+
const [focused, setFocused] = React47.useState(false);
|
|
3406
3419
|
const showMarks = !!marks?.length && !focused && draft === null;
|
|
3407
|
-
const fieldRef =
|
|
3408
|
-
const [editMarks, setEditMarks] =
|
|
3409
|
-
const [scroll, setScroll] =
|
|
3420
|
+
const fieldRef = React47.useRef(null);
|
|
3421
|
+
const [editMarks, setEditMarks] = React47.useState([]);
|
|
3422
|
+
const [scroll, setScroll] = React47.useState(0);
|
|
3410
3423
|
const typed = guarded ? draft ?? label : label;
|
|
3411
|
-
const skipBlur =
|
|
3424
|
+
const skipBlur = React47.useRef(false);
|
|
3412
3425
|
const problemWith = (text) => minLength !== void 0 && text.trim().length < minLength ? `Enter at least ${minLength} ${minLength === 1 ? "character" : "characters"}.` : null;
|
|
3413
3426
|
const save = () => {
|
|
3414
3427
|
if (draft === null) return true;
|
|
@@ -3429,9 +3442,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3429
3442
|
...dragHandleProps,
|
|
3430
3443
|
className: cn("cursor-grab touch-none select-none", dragHandleProps.className)
|
|
3431
3444
|
} : { "aria-hidden": true };
|
|
3432
|
-
const grip = dragHandleProps ? /* @__PURE__ */
|
|
3433
|
-
return /* @__PURE__ */
|
|
3434
|
-
/* @__PURE__ */
|
|
3445
|
+
const grip = dragHandleProps ? /* @__PURE__ */ jsx48("span", { ...gripProps, className: cn("shrink-0", gripProps.className), children: /* @__PURE__ */ jsx48(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "text-surface-foreground" }) }) : /* @__PURE__ */ jsx48(DotsSixVertical3, { size: 20, "aria-hidden": true, className: "shrink-0 text-surface-foreground" });
|
|
3446
|
+
return /* @__PURE__ */ jsxs35("div", { className: cn("group/option flex w-full items-center gap-2", className), children: [
|
|
3447
|
+
/* @__PURE__ */ jsx48(
|
|
3435
3448
|
"div",
|
|
3436
3449
|
{
|
|
3437
3450
|
className: cn(
|
|
@@ -3441,10 +3454,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3441
3454
|
cn("border-border group-hover/option:shadow-md group-focus-within/option:shadow-md", lifted && "shadow-md")
|
|
3442
3455
|
) : "border-border hover:border-input-muted hover:shadow-md"
|
|
3443
3456
|
),
|
|
3444
|
-
children: /* @__PURE__ */
|
|
3445
|
-
(kind !== void 0 || !locked) && /* @__PURE__ */
|
|
3457
|
+
children: /* @__PURE__ */ jsxs35("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
3458
|
+
(kind !== void 0 || !locked) && /* @__PURE__ */ jsx48("div", { className: "flex h-7 shrink-0 items-center gap-2", children: kind === "rank" ? /* @__PURE__ */ jsxs35(Fragment12, { children: [
|
|
3446
3459
|
!locked && grip,
|
|
3447
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ jsx48(
|
|
3448
3461
|
"span",
|
|
3449
3462
|
{
|
|
3450
3463
|
"aria-hidden": "true",
|
|
@@ -3452,8 +3465,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3452
3465
|
children: rank
|
|
3453
3466
|
}
|
|
3454
3467
|
)
|
|
3455
|
-
] }) : reveal && locked ? /* @__PURE__ */
|
|
3456
|
-
/* @__PURE__ */
|
|
3468
|
+
] }) : reveal && locked ? /* @__PURE__ */ jsx48("span", { "aria-hidden": "true", className: "relative flex size-5 shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx48("span", { className: cn("inline-flex size-4 border-2 border-input bg-surface", kind === "radio" ? "rounded-full" : "rounded-xxs") }) }) : reveal ? /* @__PURE__ */ jsxs35("span", { ...gripProps, className: cn("relative flex size-5 shrink-0 items-center justify-center", gripProps.className), children: [
|
|
3469
|
+
/* @__PURE__ */ jsx48(
|
|
3457
3470
|
"span",
|
|
3458
3471
|
{
|
|
3459
3472
|
"aria-hidden": "true",
|
|
@@ -3464,7 +3477,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3464
3477
|
)
|
|
3465
3478
|
}
|
|
3466
3479
|
),
|
|
3467
|
-
/* @__PURE__ */
|
|
3480
|
+
/* @__PURE__ */ jsx48(
|
|
3468
3481
|
DotsSixVertical3,
|
|
3469
3482
|
{
|
|
3470
3483
|
size: 20,
|
|
@@ -3476,10 +3489,10 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3476
3489
|
}
|
|
3477
3490
|
)
|
|
3478
3491
|
] }) : locked ? null : grip }),
|
|
3479
|
-
/* @__PURE__ */
|
|
3480
|
-
/* @__PURE__ */
|
|
3481
|
-
focused && editMarks.length > 0 && /* @__PURE__ */
|
|
3482
|
-
/* @__PURE__ */
|
|
3492
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3493
|
+
/* @__PURE__ */ jsxs35("div", { className: "relative min-w-0", children: [
|
|
3494
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ jsx48(DraftMarks, { layer: "behind", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3495
|
+
/* @__PURE__ */ jsx48(
|
|
3483
3496
|
"input",
|
|
3484
3497
|
{
|
|
3485
3498
|
ref: fieldRef,
|
|
@@ -3534,24 +3547,24 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3534
3547
|
)
|
|
3535
3548
|
}
|
|
3536
3549
|
),
|
|
3537
|
-
focused && editMarks.length > 0 && /* @__PURE__ */
|
|
3538
|
-
showMarks && /* @__PURE__ */
|
|
3539
|
-
(piece, i) => piece.mark ? /* @__PURE__ */
|
|
3550
|
+
focused && editMarks.length > 0 && /* @__PURE__ */ jsx48(DraftMarks, { layer: "over", singleLine: true, text: typed, marks: editMarks, scrollLeft: scroll, className: "flex items-center whitespace-pre text-body-base" }),
|
|
3551
|
+
showMarks && /* @__PURE__ */ jsx48("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(
|
|
3552
|
+
(piece, i) => piece.mark ? /* @__PURE__ */ jsx48(MarkedText, { mark: piece.mark, text: piece.text, onApply: onMarkApply, onDismiss: onMarkDismiss }, `${piece.mark.start}:${piece.text}`) : /* @__PURE__ */ jsx48("span", { children: piece.text }, i)
|
|
3540
3553
|
) })
|
|
3541
3554
|
] }),
|
|
3542
|
-
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */
|
|
3555
|
+
guarded && draft !== null && (error || lengthOutOfRange(draft, minLength, maxLength)) && /* @__PURE__ */ jsxs35(
|
|
3543
3556
|
"p",
|
|
3544
3557
|
{
|
|
3545
3558
|
id: helperId,
|
|
3546
3559
|
role: error ? "alert" : void 0,
|
|
3547
3560
|
className: cn("flex items-start justify-between gap-2 text-ui-caption", error ? "text-destructive" : "text-secondary-muted-foreground"),
|
|
3548
3561
|
children: [
|
|
3549
|
-
/* @__PURE__ */
|
|
3550
|
-
error && /* @__PURE__ */
|
|
3562
|
+
/* @__PURE__ */ jsxs35("span", { className: "flex items-start gap-2", children: [
|
|
3563
|
+
error && /* @__PURE__ */ jsx48(WarningCircle6, { size: 16, "aria-hidden": true, className: "shrink-0" }),
|
|
3551
3564
|
limitsText2(minLength, maxLength),
|
|
3552
|
-
error && /* @__PURE__ */
|
|
3565
|
+
error && /* @__PURE__ */ jsx48("span", { className: "sr-only", children: error })
|
|
3553
3566
|
] }),
|
|
3554
|
-
/* @__PURE__ */
|
|
3567
|
+
/* @__PURE__ */ jsxs35("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
3555
3568
|
draft.length,
|
|
3556
3569
|
maxLength !== void 0 && `/${maxLength}`
|
|
3557
3570
|
] })
|
|
@@ -3562,7 +3575,7 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3562
3575
|
] })
|
|
3563
3576
|
}
|
|
3564
3577
|
),
|
|
3565
|
-
!locked && /* @__PURE__ */
|
|
3578
|
+
!locked && /* @__PURE__ */ jsxs35(
|
|
3566
3579
|
"div",
|
|
3567
3580
|
{
|
|
3568
3581
|
className: cn(
|
|
@@ -3570,8 +3583,8 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3570
3583
|
reveal && "opacity-0 transition-opacity group-hover/option:opacity-100 group-focus-within/option:opacity-100"
|
|
3571
3584
|
),
|
|
3572
3585
|
children: [
|
|
3573
|
-
/* @__PURE__ */
|
|
3574
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsx48(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": "Remove option", disabled: removeDisabled, onClick: onRemove, children: /* @__PURE__ */ jsx48(Trash5, { size: 16, "aria-hidden": true }) }),
|
|
3587
|
+
/* @__PURE__ */ jsx48(Button, { type: "button", variant: "ghost", size: "icon-sm", "aria-label": "Add option", disabled: addDisabled, onClick: onAdd, children: /* @__PURE__ */ jsx48(Plus4, { size: 16, "aria-hidden": true }) })
|
|
3575
3588
|
]
|
|
3576
3589
|
}
|
|
3577
3590
|
)
|
|
@@ -3579,9 +3592,9 @@ function QuestionOptionEditor({ label, onLabelChange, placeholder, placeholderTo
|
|
|
3579
3592
|
}
|
|
3580
3593
|
|
|
3581
3594
|
// src/components/Question Types/RankList.tsx
|
|
3582
|
-
import * as
|
|
3595
|
+
import * as React48 from "react";
|
|
3583
3596
|
import { DotsSixVertical as DotsSixVertical4 } from "@phosphor-icons/react";
|
|
3584
|
-
import { Fragment as Fragment13, jsx as
|
|
3597
|
+
import { Fragment as Fragment13, jsx as jsx49, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3585
3598
|
function move(list, from, to) {
|
|
3586
3599
|
if (from === to || to < 0 || to >= list.length) return list;
|
|
3587
3600
|
const next = list.slice();
|
|
@@ -3589,13 +3602,13 @@ function move(list, from, to) {
|
|
|
3589
3602
|
next.splice(to, 0, item);
|
|
3590
3603
|
return next;
|
|
3591
3604
|
}
|
|
3592
|
-
var RankList =
|
|
3605
|
+
var RankList = React48.forwardRef(
|
|
3593
3606
|
({ className, items, onItemsChange, ...props }, ref) => {
|
|
3594
|
-
const [dragIndex, setDragIndex] =
|
|
3595
|
-
const [announcement, setAnnouncement] =
|
|
3596
|
-
const handles =
|
|
3597
|
-
const refocus =
|
|
3598
|
-
|
|
3607
|
+
const [dragIndex, setDragIndex] = React48.useState(null);
|
|
3608
|
+
const [announcement, setAnnouncement] = React48.useState("");
|
|
3609
|
+
const handles = React48.useRef(/* @__PURE__ */ new Map());
|
|
3610
|
+
const refocus = React48.useRef(null);
|
|
3611
|
+
React48.useEffect(() => {
|
|
3599
3612
|
if (refocus.current) {
|
|
3600
3613
|
handles.current.get(refocus.current)?.focus();
|
|
3601
3614
|
refocus.current = null;
|
|
@@ -3608,8 +3621,8 @@ var RankList = React47.forwardRef(
|
|
|
3608
3621
|
setAnnouncement(`Moved to position ${to + 1} of ${items.length}`);
|
|
3609
3622
|
onItemsChange(next);
|
|
3610
3623
|
};
|
|
3611
|
-
return /* @__PURE__ */
|
|
3612
|
-
/* @__PURE__ */
|
|
3624
|
+
return /* @__PURE__ */ jsxs36(Fragment13, { children: [
|
|
3625
|
+
/* @__PURE__ */ jsx49("ol", { ref, className: cn("flex w-full max-w-150 flex-col gap-4", className), ...props, children: items.map((item, index) => /* @__PURE__ */ jsxs36(
|
|
3613
3626
|
"li",
|
|
3614
3627
|
{
|
|
3615
3628
|
draggable: true,
|
|
@@ -3626,7 +3639,7 @@ var RankList = React47.forwardRef(
|
|
|
3626
3639
|
dragIndex === index && "opacity-50"
|
|
3627
3640
|
),
|
|
3628
3641
|
children: [
|
|
3629
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsx49(
|
|
3630
3643
|
"button",
|
|
3631
3644
|
{
|
|
3632
3645
|
type: "button",
|
|
@@ -3645,10 +3658,10 @@ var RankList = React47.forwardRef(
|
|
|
3645
3658
|
}
|
|
3646
3659
|
},
|
|
3647
3660
|
className: "inline-flex shrink-0 cursor-grab rounded-xs text-surface-foreground",
|
|
3648
|
-
children: /* @__PURE__ */
|
|
3661
|
+
children: /* @__PURE__ */ jsx49(DotsSixVertical4, { size: 16, "aria-hidden": true })
|
|
3649
3662
|
}
|
|
3650
3663
|
),
|
|
3651
|
-
/* @__PURE__ */
|
|
3664
|
+
/* @__PURE__ */ jsx49(
|
|
3652
3665
|
"span",
|
|
3653
3666
|
{
|
|
3654
3667
|
"aria-hidden": "true",
|
|
@@ -3656,27 +3669,27 @@ var RankList = React47.forwardRef(
|
|
|
3656
3669
|
children: index + 1
|
|
3657
3670
|
}
|
|
3658
3671
|
),
|
|
3659
|
-
/* @__PURE__ */
|
|
3672
|
+
/* @__PURE__ */ jsx49("span", { className: "min-w-0 flex-1", children: item.label })
|
|
3660
3673
|
]
|
|
3661
3674
|
},
|
|
3662
3675
|
item.id
|
|
3663
3676
|
)) }),
|
|
3664
|
-
/* @__PURE__ */
|
|
3677
|
+
/* @__PURE__ */ jsx49("span", { role: "status", "aria-live": "polite", className: "sr-only", children: announcement })
|
|
3665
3678
|
] });
|
|
3666
3679
|
}
|
|
3667
3680
|
);
|
|
3668
3681
|
RankList.displayName = "RankList";
|
|
3669
3682
|
|
|
3670
3683
|
// src/components/Question Types/RatingScale.tsx
|
|
3671
|
-
import * as
|
|
3684
|
+
import * as React49 from "react";
|
|
3672
3685
|
import { ToggleGroup as ToggleGroupPrimitive3 } from "radix-ui";
|
|
3673
|
-
import { jsx as
|
|
3674
|
-
var RatingScale =
|
|
3686
|
+
import { jsx as jsx50, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3687
|
+
var RatingScale = React49.forwardRef(
|
|
3675
3688
|
({ className, max = 5, value, defaultValue, onValueChange, lowLabel, highLabel, ...props }, ref) => {
|
|
3676
|
-
const [internal, setInternal] =
|
|
3689
|
+
const [internal, setInternal] = React49.useState(defaultValue);
|
|
3677
3690
|
const current = value !== void 0 ? value : internal;
|
|
3678
|
-
return /* @__PURE__ */
|
|
3679
|
-
/* @__PURE__ */
|
|
3691
|
+
return /* @__PURE__ */ jsxs37("div", { className: cn("flex w-full max-w-150 flex-col gap-2", className), children: [
|
|
3692
|
+
/* @__PURE__ */ jsx50(
|
|
3680
3693
|
ToggleGroupPrimitive3.Root,
|
|
3681
3694
|
{
|
|
3682
3695
|
ref,
|
|
@@ -3689,7 +3702,7 @@ var RatingScale = React48.forwardRef(
|
|
|
3689
3702
|
},
|
|
3690
3703
|
className: "flex gap-2",
|
|
3691
3704
|
...props,
|
|
3692
|
-
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */
|
|
3705
|
+
children: Array.from({ length: max }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsx50(
|
|
3693
3706
|
ToggleGroupPrimitive3.Item,
|
|
3694
3707
|
{
|
|
3695
3708
|
value: String(n),
|
|
@@ -3705,9 +3718,9 @@ var RatingScale = React48.forwardRef(
|
|
|
3705
3718
|
))
|
|
3706
3719
|
}
|
|
3707
3720
|
),
|
|
3708
|
-
(lowLabel != null || highLabel != null) && /* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
3710
|
-
/* @__PURE__ */
|
|
3721
|
+
(lowLabel != null || highLabel != null) && /* @__PURE__ */ jsxs37("div", { className: "flex justify-between text-ui-caption text-secondary-muted-foreground", "aria-hidden": "true", children: [
|
|
3722
|
+
/* @__PURE__ */ jsx50("span", { children: lowLabel }),
|
|
3723
|
+
/* @__PURE__ */ jsx50("span", { children: highLabel })
|
|
3711
3724
|
] })
|
|
3712
3725
|
] });
|
|
3713
3726
|
}
|
|
@@ -3715,12 +3728,12 @@ var RatingScale = React48.forwardRef(
|
|
|
3715
3728
|
RatingScale.displayName = "RatingScale";
|
|
3716
3729
|
|
|
3717
3730
|
// src/components/Question Types/StimulusCard.tsx
|
|
3718
|
-
import * as
|
|
3731
|
+
import * as React50 from "react";
|
|
3719
3732
|
import { Image as ImageIcon2, ImageBroken, Trash as Trash6 } from "@phosphor-icons/react";
|
|
3720
|
-
import { jsx as
|
|
3733
|
+
import { jsx as jsx51, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3721
3734
|
var MIN_THUMBNAIL = 92;
|
|
3722
3735
|
var MAX_THUMBNAIL = 240;
|
|
3723
|
-
var StimulusCard =
|
|
3736
|
+
var StimulusCard = React50.forwardRef(
|
|
3724
3737
|
({
|
|
3725
3738
|
className,
|
|
3726
3739
|
thumbnail,
|
|
@@ -3737,14 +3750,14 @@ var StimulusCard = React49.forwardRef(
|
|
|
3737
3750
|
removeLabel = "Remove stimulus",
|
|
3738
3751
|
...props
|
|
3739
3752
|
}, ref) => {
|
|
3740
|
-
const [failedSrc, setFailedSrc] =
|
|
3753
|
+
const [failedSrc, setFailedSrc] = React50.useState();
|
|
3741
3754
|
const error = status === "error" || thumbnail !== void 0 && failedSrc === thumbnail;
|
|
3742
3755
|
const showImage = thumbnail !== void 0 && !error;
|
|
3743
|
-
const [draft, setDraft] =
|
|
3756
|
+
const [draft, setDraft] = React50.useState(null);
|
|
3744
3757
|
const count = (draft ?? caption ?? "").length;
|
|
3745
|
-
const textRef =
|
|
3746
|
-
const [thumbnailSize, setThumbnailSize] =
|
|
3747
|
-
|
|
3758
|
+
const textRef = React50.useRef(null);
|
|
3759
|
+
const [thumbnailSize, setThumbnailSize] = React50.useState(MIN_THUMBNAIL);
|
|
3760
|
+
React50.useEffect(() => {
|
|
3748
3761
|
const el = textRef.current;
|
|
3749
3762
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
3750
3763
|
const observer = new ResizeObserver(() => {
|
|
@@ -3753,7 +3766,7 @@ var StimulusCard = React49.forwardRef(
|
|
|
3753
3766
|
observer.observe(el);
|
|
3754
3767
|
return () => observer.disconnect();
|
|
3755
3768
|
}, []);
|
|
3756
|
-
return /* @__PURE__ */
|
|
3769
|
+
return /* @__PURE__ */ jsxs38(
|
|
3757
3770
|
"div",
|
|
3758
3771
|
{
|
|
3759
3772
|
ref,
|
|
@@ -3761,8 +3774,8 @@ var StimulusCard = React49.forwardRef(
|
|
|
3761
3774
|
className: cn("flex min-h-24.5 w-full items-center gap-4 rounded-md border border-border p-0.5 pr-4", className),
|
|
3762
3775
|
...props,
|
|
3763
3776
|
children: [
|
|
3764
|
-
/* @__PURE__ */
|
|
3765
|
-
/* @__PURE__ */
|
|
3777
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
3778
|
+
/* @__PURE__ */ jsx51(
|
|
3766
3779
|
"span",
|
|
3767
3780
|
{
|
|
3768
3781
|
style: { width: thumbnailSize, height: thumbnailSize },
|
|
@@ -3773,13 +3786,13 @@ var StimulusCard = React49.forwardRef(
|
|
|
3773
3786
|
),
|
|
3774
3787
|
children: showImage ? (
|
|
3775
3788
|
// Out of flow, so the image's own size never sets the thumbnail's size.
|
|
3776
|
-
/* @__PURE__ */
|
|
3777
|
-
) : error ? /* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ jsx51("img", { src: thumbnail, alt: thumbnailAlt, className: "absolute inset-0 size-full object-cover", onError: () => setFailedSrc(thumbnail) })
|
|
3790
|
+
) : error ? /* @__PURE__ */ jsx51(ImageBroken, { size: 24, "aria-hidden": true }) : icon ?? /* @__PURE__ */ jsx51(ImageIcon2, { size: 24, "aria-hidden": true })
|
|
3778
3791
|
}
|
|
3779
3792
|
),
|
|
3780
|
-
/* @__PURE__ */
|
|
3781
|
-
/* @__PURE__ */
|
|
3782
|
-
onCaptionChange ? /* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ jsxs38("div", { ref: textRef, className: "flex min-w-0 flex-1 flex-col justify-center gap-2 py-2 text-surface-foreground", children: [
|
|
3794
|
+
/* @__PURE__ */ jsx51("p", { className: "w-full text-ui-label", children: label }),
|
|
3795
|
+
onCaptionChange ? /* @__PURE__ */ jsx51(
|
|
3783
3796
|
InlineEdit,
|
|
3784
3797
|
{
|
|
3785
3798
|
variant: "question",
|
|
@@ -3796,8 +3809,8 @@ var StimulusCard = React49.forwardRef(
|
|
|
3796
3809
|
},
|
|
3797
3810
|
textClassName: "text-body-base"
|
|
3798
3811
|
}
|
|
3799
|
-
) : /* @__PURE__ */
|
|
3800
|
-
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */
|
|
3812
|
+
) : /* @__PURE__ */ jsx51("p", { className: "w-full text-body-base [word-break:break-word]", children: caption }),
|
|
3813
|
+
onCaptionChange && showCounter && maxLength !== void 0 && count > maxLength && /* @__PURE__ */ jsxs38("p", { className: "text-ui-caption text-secondary-muted-foreground", children: [
|
|
3801
3814
|
count,
|
|
3802
3815
|
"/",
|
|
3803
3816
|
maxLength,
|
|
@@ -3805,7 +3818,7 @@ var StimulusCard = React49.forwardRef(
|
|
|
3805
3818
|
] })
|
|
3806
3819
|
] })
|
|
3807
3820
|
] }),
|
|
3808
|
-
onRemove && /* @__PURE__ */
|
|
3821
|
+
onRemove && /* @__PURE__ */ jsx51(Button, { type: "button", variant: "destructive", size: "icon-sm", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx51(Trash6, { size: 16, "aria-hidden": true }) })
|
|
3809
3822
|
]
|
|
3810
3823
|
}
|
|
3811
3824
|
);
|
|
@@ -3814,27 +3827,27 @@ var StimulusCard = React49.forwardRef(
|
|
|
3814
3827
|
StimulusCard.displayName = "StimulusCard";
|
|
3815
3828
|
|
|
3816
3829
|
// src/components/Data Display/Progress.tsx
|
|
3817
|
-
import * as
|
|
3830
|
+
import * as React51 from "react";
|
|
3818
3831
|
import { Progress as ProgressPrimitive2 } from "radix-ui";
|
|
3819
|
-
import { jsx as
|
|
3820
|
-
var Progress =
|
|
3832
|
+
import { jsx as jsx52, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3833
|
+
var Progress = React51.forwardRef(
|
|
3821
3834
|
({ className, value = 0, label, valueLabel, detailsStart, detailsEnd, ...props }, ref) => {
|
|
3822
3835
|
const hasHeader = label != null || valueLabel != null;
|
|
3823
3836
|
const hasDetails = detailsStart != null || detailsEnd != null;
|
|
3824
3837
|
const clamped = Math.min(100, Math.max(0, value ?? 0));
|
|
3825
|
-
return /* @__PURE__ */
|
|
3826
|
-
hasHeader && /* @__PURE__ */
|
|
3827
|
-
/* @__PURE__ */
|
|
3828
|
-
/* @__PURE__ */
|
|
3838
|
+
return /* @__PURE__ */ jsxs39("div", { className: cn("flex w-full flex-col gap-2", className), children: [
|
|
3839
|
+
hasHeader && /* @__PURE__ */ jsxs39("div", { className: "flex items-center justify-between text-ui-label text-surface-foreground", children: [
|
|
3840
|
+
/* @__PURE__ */ jsx52("span", { children: label }),
|
|
3841
|
+
/* @__PURE__ */ jsx52("span", { children: valueLabel === true ? `${Math.round(clamped)}%` : valueLabel })
|
|
3829
3842
|
] }),
|
|
3830
|
-
/* @__PURE__ */
|
|
3843
|
+
/* @__PURE__ */ jsx52(
|
|
3831
3844
|
ProgressPrimitive2.Root,
|
|
3832
3845
|
{
|
|
3833
3846
|
ref,
|
|
3834
3847
|
value: clamped,
|
|
3835
3848
|
className: "relative h-2 w-full overflow-hidden rounded-full bg-secondary",
|
|
3836
3849
|
...props,
|
|
3837
|
-
children: /* @__PURE__ */
|
|
3850
|
+
children: /* @__PURE__ */ jsx52(
|
|
3838
3851
|
ProgressPrimitive2.Indicator,
|
|
3839
3852
|
{
|
|
3840
3853
|
className: "h-full rounded-full bg-accent transition-[width]",
|
|
@@ -3843,9 +3856,9 @@ var Progress = React50.forwardRef(
|
|
|
3843
3856
|
)
|
|
3844
3857
|
}
|
|
3845
3858
|
),
|
|
3846
|
-
hasDetails && /* @__PURE__ */
|
|
3847
|
-
/* @__PURE__ */
|
|
3848
|
-
/* @__PURE__ */
|
|
3859
|
+
hasDetails && /* @__PURE__ */ jsxs39("div", { className: "flex items-start justify-between text-ui-label leading-5 text-secondary-muted-foreground", children: [
|
|
3860
|
+
/* @__PURE__ */ jsx52("span", { children: detailsStart }),
|
|
3861
|
+
/* @__PURE__ */ jsx52("span", { children: detailsEnd })
|
|
3849
3862
|
] })
|
|
3850
3863
|
] });
|
|
3851
3864
|
}
|
|
@@ -3853,11 +3866,11 @@ var Progress = React50.forwardRef(
|
|
|
3853
3866
|
Progress.displayName = "Progress";
|
|
3854
3867
|
|
|
3855
3868
|
// src/components/Data Display/Table.tsx
|
|
3856
|
-
import * as
|
|
3869
|
+
import * as React52 from "react";
|
|
3857
3870
|
import { CaretDown as CaretDown4, CaretUp } from "@phosphor-icons/react";
|
|
3858
|
-
import { jsx as
|
|
3859
|
-
var Table =
|
|
3860
|
-
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */
|
|
3871
|
+
import { jsx as jsx53, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
3872
|
+
var Table = React52.forwardRef(
|
|
3873
|
+
({ className, containerClassName, containerRef, striped, ...props }, ref) => /* @__PURE__ */ jsx53("div", { ref: containerRef, className: cn("relative w-full overflow-auto rounded-lg border border-border bg-surface", containerClassName), children: /* @__PURE__ */ jsx53(
|
|
3861
3874
|
"table",
|
|
3862
3875
|
{
|
|
3863
3876
|
ref,
|
|
@@ -3868,20 +3881,20 @@ var Table = React51.forwardRef(
|
|
|
3868
3881
|
) })
|
|
3869
3882
|
);
|
|
3870
3883
|
Table.displayName = "Table";
|
|
3871
|
-
var TableHeader =
|
|
3872
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3884
|
+
var TableHeader = React52.forwardRef(
|
|
3885
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx53("thead", { ref, className, ...props })
|
|
3873
3886
|
);
|
|
3874
3887
|
TableHeader.displayName = "TableHeader";
|
|
3875
|
-
var TableFooter =
|
|
3876
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3888
|
+
var TableFooter = React52.forwardRef(
|
|
3889
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx53("tfoot", { ref, className: cn("border-t border-border bg-background text-ui-label", className), ...props })
|
|
3877
3890
|
);
|
|
3878
3891
|
TableFooter.displayName = "TableFooter";
|
|
3879
|
-
var TableBody =
|
|
3880
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
3892
|
+
var TableBody = React52.forwardRef(
|
|
3893
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx53("tbody", { ref, className, ...props })
|
|
3881
3894
|
);
|
|
3882
3895
|
TableBody.displayName = "TableBody";
|
|
3883
|
-
var TableRow =
|
|
3884
|
-
({ className, selected, ...props }, ref) => /* @__PURE__ */
|
|
3896
|
+
var TableRow = React52.forwardRef(
|
|
3897
|
+
({ className, selected, ...props }, ref) => /* @__PURE__ */ jsx53(
|
|
3885
3898
|
"tr",
|
|
3886
3899
|
{
|
|
3887
3900
|
ref,
|
|
@@ -3898,10 +3911,10 @@ var TableRow = React51.forwardRef(
|
|
|
3898
3911
|
);
|
|
3899
3912
|
TableRow.displayName = "TableRow";
|
|
3900
3913
|
var ariaSort = { none: "none", asc: "ascending", desc: "descending" };
|
|
3901
|
-
var TableHead =
|
|
3914
|
+
var TableHead = React52.forwardRef(
|
|
3902
3915
|
({ className, align = "left", sortable, sort = "none", onSort, checkbox, resizer, children, ...props }, ref) => {
|
|
3903
|
-
const caret = sort === "asc" ? /* @__PURE__ */
|
|
3904
|
-
return /* @__PURE__ */
|
|
3916
|
+
const caret = sort === "asc" ? /* @__PURE__ */ jsx53(CaretUp, { size: 16, "aria-hidden": true, className: "shrink-0" }) : /* @__PURE__ */ jsx53(CaretDown4, { size: 16, "aria-hidden": true, className: "shrink-0" });
|
|
3917
|
+
return /* @__PURE__ */ jsxs40(
|
|
3905
3918
|
"th",
|
|
3906
3919
|
{
|
|
3907
3920
|
ref,
|
|
@@ -3916,7 +3929,7 @@ var TableHead = React51.forwardRef(
|
|
|
3916
3929
|
),
|
|
3917
3930
|
...props,
|
|
3918
3931
|
children: [
|
|
3919
|
-
sortable ? /* @__PURE__ */
|
|
3932
|
+
sortable ? /* @__PURE__ */ jsxs40(
|
|
3920
3933
|
"button",
|
|
3921
3934
|
{
|
|
3922
3935
|
type: "button",
|
|
@@ -3927,7 +3940,7 @@ var TableHead = React51.forwardRef(
|
|
|
3927
3940
|
caret
|
|
3928
3941
|
]
|
|
3929
3942
|
}
|
|
3930
|
-
) : checkbox ? /* @__PURE__ */
|
|
3943
|
+
) : checkbox ? /* @__PURE__ */ jsx53("div", { className: "flex items-center justify-center", children }) : children,
|
|
3931
3944
|
resizer
|
|
3932
3945
|
]
|
|
3933
3946
|
}
|
|
@@ -3935,8 +3948,8 @@ var TableHead = React51.forwardRef(
|
|
|
3935
3948
|
}
|
|
3936
3949
|
);
|
|
3937
3950
|
TableHead.displayName = "TableHead";
|
|
3938
|
-
var TableCell =
|
|
3939
|
-
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */
|
|
3951
|
+
var TableCell = React52.forwardRef(
|
|
3952
|
+
({ className, align = "left", muted, checkbox, actions, children, ...props }, ref) => /* @__PURE__ */ jsx53(
|
|
3940
3953
|
"td",
|
|
3941
3954
|
{
|
|
3942
3955
|
ref,
|
|
@@ -3949,23 +3962,23 @@ var TableCell = React51.forwardRef(
|
|
|
3949
3962
|
className
|
|
3950
3963
|
),
|
|
3951
3964
|
...props,
|
|
3952
|
-
children: checkbox ? /* @__PURE__ */
|
|
3965
|
+
children: checkbox ? /* @__PURE__ */ jsx53("div", { className: "flex items-center justify-center", children }) : actions ? /* @__PURE__ */ jsx53("div", { className: "flex items-start justify-end gap-1", children }) : children
|
|
3953
3966
|
}
|
|
3954
3967
|
)
|
|
3955
3968
|
);
|
|
3956
3969
|
TableCell.displayName = "TableCell";
|
|
3957
3970
|
function TableCellTwoLines({ primary, secondary, avatar, className, ...props }) {
|
|
3958
|
-
return /* @__PURE__ */
|
|
3971
|
+
return /* @__PURE__ */ jsxs40("div", { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
3959
3972
|
avatar,
|
|
3960
|
-
/* @__PURE__ */
|
|
3961
|
-
/* @__PURE__ */
|
|
3962
|
-
secondary && /* @__PURE__ */
|
|
3973
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex flex-col gap-0.5 whitespace-nowrap", children: [
|
|
3974
|
+
/* @__PURE__ */ jsx53("span", { className: "text-ui-label text-surface-foreground", children: primary }),
|
|
3975
|
+
secondary && /* @__PURE__ */ jsx53("span", { className: "text-ui-caption text-secondary-muted-foreground", children: secondary })
|
|
3963
3976
|
] })
|
|
3964
3977
|
] });
|
|
3965
3978
|
}
|
|
3966
3979
|
|
|
3967
3980
|
// src/components/Data Display/DataTable.tsx
|
|
3968
|
-
import * as
|
|
3981
|
+
import * as React54 from "react";
|
|
3969
3982
|
import { CaretDown as CaretDown5, CaretRight as CaretRight4, PushPin, PushPinSlash, Rows, Sliders, Stack } from "@phosphor-icons/react";
|
|
3970
3983
|
import {
|
|
3971
3984
|
aggregationFn_count,
|
|
@@ -4018,9 +4031,9 @@ import {
|
|
|
4018
4031
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4019
4032
|
|
|
4020
4033
|
// src/components/Utility/Pagination.tsx
|
|
4021
|
-
import * as
|
|
4034
|
+
import * as React53 from "react";
|
|
4022
4035
|
import { ArrowLeft, ArrowRight, DotsThree as DotsThree2 } from "@phosphor-icons/react";
|
|
4023
|
-
import { jsx as
|
|
4036
|
+
import { jsx as jsx54, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4024
4037
|
function getPaginationItems(page, pageCount, siblings = 1) {
|
|
4025
4038
|
const keep = /* @__PURE__ */ new Set([1, pageCount]);
|
|
4026
4039
|
for (let p = page - siblings; p <= page + siblings; p++) if (p >= 1 && p <= pageCount) keep.add(p);
|
|
@@ -4034,10 +4047,10 @@ function getPaginationItems(page, pageCount, siblings = 1) {
|
|
|
4034
4047
|
});
|
|
4035
4048
|
return items;
|
|
4036
4049
|
}
|
|
4037
|
-
var Pagination =
|
|
4050
|
+
var Pagination = React53.forwardRef(
|
|
4038
4051
|
({ className, page, pageCount, onPageChange, variant = "full", siblings = 1, ...props }, ref) => {
|
|
4039
4052
|
const go = (next2) => onPageChange(Math.min(pageCount, Math.max(1, next2)));
|
|
4040
|
-
const previous = /* @__PURE__ */
|
|
4053
|
+
const previous = /* @__PURE__ */ jsx54(
|
|
4041
4054
|
Button,
|
|
4042
4055
|
{
|
|
4043
4056
|
type: "button",
|
|
@@ -4046,10 +4059,10 @@ var Pagination = React52.forwardRef(
|
|
|
4046
4059
|
"aria-label": "Previous page",
|
|
4047
4060
|
disabled: page <= 1,
|
|
4048
4061
|
onClick: () => go(page - 1),
|
|
4049
|
-
children: /* @__PURE__ */
|
|
4062
|
+
children: /* @__PURE__ */ jsx54(ArrowLeft, { size: 16, "aria-hidden": true })
|
|
4050
4063
|
}
|
|
4051
4064
|
);
|
|
4052
|
-
const next = /* @__PURE__ */
|
|
4065
|
+
const next = /* @__PURE__ */ jsx54(
|
|
4053
4066
|
Button,
|
|
4054
4067
|
{
|
|
4055
4068
|
type: "button",
|
|
@@ -4058,10 +4071,10 @@ var Pagination = React52.forwardRef(
|
|
|
4058
4071
|
"aria-label": "Next page",
|
|
4059
4072
|
disabled: page >= pageCount,
|
|
4060
4073
|
onClick: () => go(page + 1),
|
|
4061
|
-
children: /* @__PURE__ */
|
|
4074
|
+
children: /* @__PURE__ */ jsx54(ArrowRight, { size: 16, "aria-hidden": true })
|
|
4062
4075
|
}
|
|
4063
4076
|
);
|
|
4064
|
-
return /* @__PURE__ */
|
|
4077
|
+
return /* @__PURE__ */ jsxs41(
|
|
4065
4078
|
"nav",
|
|
4066
4079
|
{
|
|
4067
4080
|
ref,
|
|
@@ -4070,14 +4083,14 @@ var Pagination = React52.forwardRef(
|
|
|
4070
4083
|
...props,
|
|
4071
4084
|
children: [
|
|
4072
4085
|
previous,
|
|
4073
|
-
variant === "compact" ? /* @__PURE__ */
|
|
4086
|
+
variant === "compact" ? /* @__PURE__ */ jsxs41("span", { className: "text-body-small text-surface-foreground", "aria-live": "polite", children: [
|
|
4074
4087
|
page,
|
|
4075
4088
|
"/",
|
|
4076
4089
|
pageCount
|
|
4077
|
-
] }) : /* @__PURE__ */
|
|
4078
|
-
/* @__PURE__ */
|
|
4079
|
-
/* @__PURE__ */
|
|
4080
|
-
] }) : /* @__PURE__ */
|
|
4090
|
+
] }) : /* @__PURE__ */ jsx54("ul", { className: "flex items-center gap-2", children: getPaginationItems(page, pageCount, siblings).map((item, index) => /* @__PURE__ */ jsx54("li", { children: item === "ellipsis" ? /* @__PURE__ */ jsxs41("span", { className: "inline-flex size-8 items-center justify-center rounded-sm border border-border bg-surface text-surface-foreground", children: [
|
|
4091
|
+
/* @__PURE__ */ jsx54(DotsThree2, { size: 16, "aria-hidden": true }),
|
|
4092
|
+
/* @__PURE__ */ jsx54("span", { className: "sr-only", children: "More pages" })
|
|
4093
|
+
] }) : /* @__PURE__ */ jsx54(
|
|
4081
4094
|
Button,
|
|
4082
4095
|
{
|
|
4083
4096
|
type: "button",
|
|
@@ -4098,7 +4111,7 @@ var Pagination = React52.forwardRef(
|
|
|
4098
4111
|
Pagination.displayName = "Pagination";
|
|
4099
4112
|
|
|
4100
4113
|
// src/components/Data Display/DataTable.tsx
|
|
4101
|
-
import { Fragment as Fragment15, jsx as
|
|
4114
|
+
import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4102
4115
|
var features = tableFeatures({
|
|
4103
4116
|
rowSortingFeature,
|
|
4104
4117
|
rowPaginationFeature,
|
|
@@ -4153,9 +4166,9 @@ var features = tableFeatures({
|
|
|
4153
4166
|
});
|
|
4154
4167
|
var getMeta = (meta) => meta ?? {};
|
|
4155
4168
|
function useControllable(value, initial, onChange) {
|
|
4156
|
-
const [internal, setInternal] =
|
|
4169
|
+
const [internal, setInternal] = React54.useState(initial);
|
|
4157
4170
|
const current = value ?? internal;
|
|
4158
|
-
const update =
|
|
4171
|
+
const update = React54.useCallback(
|
|
4159
4172
|
(updater) => {
|
|
4160
4173
|
const next = typeof updater === "function" ? updater(current) : updater;
|
|
4161
4174
|
if (value === void 0) setInternal(next);
|
|
@@ -4194,16 +4207,16 @@ function ColumnFilter({ column }) {
|
|
|
4194
4207
|
const value = column.getFilterValue();
|
|
4195
4208
|
if (variant === "select") {
|
|
4196
4209
|
const options = [...column.getFacetedUniqueValues().entries()].sort((a, b) => String(a[0]).localeCompare(String(b[0])));
|
|
4197
|
-
return /* @__PURE__ */
|
|
4210
|
+
return /* @__PURE__ */ jsxs42(
|
|
4198
4211
|
Select,
|
|
4199
4212
|
{
|
|
4200
4213
|
value: typeof value === "string" ? value : ALL,
|
|
4201
4214
|
onValueChange: (next) => column.setFilterValue(next === ALL ? void 0 : next),
|
|
4202
4215
|
children: [
|
|
4203
|
-
/* @__PURE__ */
|
|
4204
|
-
/* @__PURE__ */
|
|
4205
|
-
/* @__PURE__ */
|
|
4206
|
-
options.map(([option, count]) => /* @__PURE__ */
|
|
4216
|
+
/* @__PURE__ */ jsx55(SelectTrigger, { "aria-label": `Filter ${label}`, className: "h-8 text-body-small", children: /* @__PURE__ */ jsx55(SelectValue, {}) }),
|
|
4217
|
+
/* @__PURE__ */ jsxs42(SelectContent, { children: [
|
|
4218
|
+
/* @__PURE__ */ jsx55(SelectItem, { value: ALL, children: "All" }),
|
|
4219
|
+
options.map(([option, count]) => /* @__PURE__ */ jsxs42(SelectItem, { value: String(option), children: [
|
|
4207
4220
|
String(option),
|
|
4208
4221
|
" (",
|
|
4209
4222
|
count,
|
|
@@ -4222,8 +4235,8 @@ function ColumnFilter({ column }) {
|
|
|
4222
4235
|
next[index] = raw === "" ? void 0 : Number(raw);
|
|
4223
4236
|
column.setFilterValue(next[0] === void 0 && next[1] === void 0 ? void 0 : next);
|
|
4224
4237
|
};
|
|
4225
|
-
return /* @__PURE__ */
|
|
4226
|
-
/* @__PURE__ */
|
|
4238
|
+
return /* @__PURE__ */ jsxs42("div", { className: "flex gap-1", children: [
|
|
4239
|
+
/* @__PURE__ */ jsx55(
|
|
4227
4240
|
Input,
|
|
4228
4241
|
{
|
|
4229
4242
|
type: "number",
|
|
@@ -4234,7 +4247,7 @@ function ColumnFilter({ column }) {
|
|
|
4234
4247
|
className: "h-8 text-body-small"
|
|
4235
4248
|
}
|
|
4236
4249
|
),
|
|
4237
|
-
/* @__PURE__ */
|
|
4250
|
+
/* @__PURE__ */ jsx55(
|
|
4238
4251
|
Input,
|
|
4239
4252
|
{
|
|
4240
4253
|
type: "number",
|
|
@@ -4247,7 +4260,7 @@ function ColumnFilter({ column }) {
|
|
|
4247
4260
|
)
|
|
4248
4261
|
] });
|
|
4249
4262
|
}
|
|
4250
|
-
return /* @__PURE__ */
|
|
4263
|
+
return /* @__PURE__ */ jsx55(
|
|
4251
4264
|
Input,
|
|
4252
4265
|
{
|
|
4253
4266
|
"aria-label": `Filter ${label}`,
|
|
@@ -4260,9 +4273,9 @@ function ColumnFilter({ column }) {
|
|
|
4260
4273
|
}
|
|
4261
4274
|
function EditableCell({ value, label, type, onCommit }) {
|
|
4262
4275
|
const initial = value == null ? "" : String(value);
|
|
4263
|
-
const [draft, setDraft] =
|
|
4264
|
-
const cancelled =
|
|
4265
|
-
return /* @__PURE__ */
|
|
4276
|
+
const [draft, setDraft] = React54.useState(null);
|
|
4277
|
+
const cancelled = React54.useRef(false);
|
|
4278
|
+
return /* @__PURE__ */ jsx55(
|
|
4266
4279
|
Input,
|
|
4267
4280
|
{
|
|
4268
4281
|
type,
|
|
@@ -4400,7 +4413,7 @@ function DataTableInner({
|
|
|
4400
4413
|
onPaginationChange
|
|
4401
4414
|
);
|
|
4402
4415
|
const [density, setDensity] = useControllable(densityProp, "default", onDensityChange);
|
|
4403
|
-
const [cellSelection, setCellSelection] =
|
|
4416
|
+
const [cellSelection, setCellSelection] = React54.useState([]);
|
|
4404
4417
|
const infinite = Boolean(onLoadMore);
|
|
4405
4418
|
const paginate = !virtualized && !infinite;
|
|
4406
4419
|
const compact = density === "compact";
|
|
@@ -4473,12 +4486,12 @@ function DataTableInner({
|
|
|
4473
4486
|
const cellDensity = compact ? "h-8 py-1.5" : void 0;
|
|
4474
4487
|
const allSelected = table.getIsAllPageRowsSelected();
|
|
4475
4488
|
const someSelected = table.getIsSomePageRowsSelected();
|
|
4476
|
-
const dragged =
|
|
4489
|
+
const dragged = React54.useRef(null);
|
|
4477
4490
|
const topRows = enableRowPinning ? table.getTopRows() : [];
|
|
4478
4491
|
const bottomRows = enableRowPinning ? table.getBottomRows() : [];
|
|
4479
4492
|
const bodyRows = enableRowPinning ? table.getCenterRows() : table.getRowModel().rows;
|
|
4480
|
-
const scrollRef =
|
|
4481
|
-
const setScrollRef =
|
|
4493
|
+
const scrollRef = React54.useRef(null);
|
|
4494
|
+
const setScrollRef = React54.useCallback(
|
|
4482
4495
|
(node) => {
|
|
4483
4496
|
scrollRef.current = node;
|
|
4484
4497
|
if (typeof containerRef === "function") containerRef(node);
|
|
@@ -4497,8 +4510,8 @@ function DataTableInner({
|
|
|
4497
4510
|
const virtualItems = virtualized ? virtualizer.getVirtualItems() : [];
|
|
4498
4511
|
const paddingTop = virtualItems.length > 0 ? virtualItems[0]?.start ?? 0 : 0;
|
|
4499
4512
|
const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems.at(-1)?.end ?? 0) : 0;
|
|
4500
|
-
const sentinelRef =
|
|
4501
|
-
|
|
4513
|
+
const sentinelRef = React54.useRef(null);
|
|
4514
|
+
React54.useEffect(() => {
|
|
4502
4515
|
const node = sentinelRef.current;
|
|
4503
4516
|
if (!node || !onLoadMore || !hasMore || loadingMore || typeof IntersectionObserver === "undefined") return;
|
|
4504
4517
|
const container = scrollRef.current;
|
|
@@ -4539,15 +4552,15 @@ function DataTableInner({
|
|
|
4539
4552
|
table.resetCellSelection(true);
|
|
4540
4553
|
}
|
|
4541
4554
|
};
|
|
4542
|
-
const skeletonRow = (rowKey) => /* @__PURE__ */
|
|
4555
|
+
const skeletonRow = (rowKey) => /* @__PURE__ */ jsx55(TableRow, { className: "hover:bg-transparent", children: Array.from({ length: columnSpan }, (_, cell) => /* @__PURE__ */ jsx55(TableCell, { checkbox: enableRowSelection && cell === 0, className: cellDensity, children: /* @__PURE__ */ jsx55("span", { "aria-hidden": true, className: "block h-4 w-3/4 animate-pulse rounded-xs bg-border" }) }, cell)) }, rowKey);
|
|
4543
4556
|
const renderRow = (row, options = {}) => {
|
|
4544
4557
|
const { pinned, pinnedIndex = 0, pinnedCount = 1, virtualIndex } = options;
|
|
4545
4558
|
const grouped = row.getIsGrouped();
|
|
4546
4559
|
const rowUnits = compact ? 8 : 10;
|
|
4547
4560
|
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;
|
|
4548
4561
|
const cells = row.getVisibleCells();
|
|
4549
|
-
return /* @__PURE__ */
|
|
4550
|
-
/* @__PURE__ */
|
|
4562
|
+
return /* @__PURE__ */ jsxs42(React54.Fragment, { children: [
|
|
4563
|
+
/* @__PURE__ */ jsxs42(
|
|
4551
4564
|
TableRow,
|
|
4552
4565
|
{
|
|
4553
4566
|
ref: virtualized && virtualIndex !== void 0 ? virtualizer.measureElement : void 0,
|
|
@@ -4557,7 +4570,7 @@ function DataTableInner({
|
|
|
4557
4570
|
onClick: onRowClick && !grouped ? () => onRowClick(row.original) : void 0,
|
|
4558
4571
|
className: cn(pinned && "z-20 bg-surface", grouped && "bg-background", onRowClick && !grouped && "cursor-pointer"),
|
|
4559
4572
|
children: [
|
|
4560
|
-
enableRowSelection && /* @__PURE__ */
|
|
4573
|
+
enableRowSelection && /* @__PURE__ */ jsx55(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx55(
|
|
4561
4574
|
Checkbox,
|
|
4562
4575
|
{
|
|
4563
4576
|
"aria-label": "Select row",
|
|
@@ -4566,7 +4579,7 @@ function DataTableInner({
|
|
|
4566
4579
|
onCheckedChange: (checked) => row.toggleSelected(Boolean(checked))
|
|
4567
4580
|
}
|
|
4568
4581
|
) }),
|
|
4569
|
-
hasExpander && /* @__PURE__ */
|
|
4582
|
+
hasExpander && /* @__PURE__ */ jsx55(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && row.getCanExpand() && /* @__PURE__ */ jsx55(
|
|
4570
4583
|
Button,
|
|
4571
4584
|
{
|
|
4572
4585
|
type: "button",
|
|
@@ -4575,10 +4588,10 @@ function DataTableInner({
|
|
|
4575
4588
|
"aria-label": row.getIsExpanded() ? "Collapse row" : "Expand row",
|
|
4576
4589
|
"aria-expanded": row.getIsExpanded(),
|
|
4577
4590
|
onClick: () => row.toggleExpanded(),
|
|
4578
|
-
children: row.getIsExpanded() ? /* @__PURE__ */
|
|
4591
|
+
children: row.getIsExpanded() ? /* @__PURE__ */ jsx55(CaretDown5, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx55(CaretRight4, { size: 16, "aria-hidden": true })
|
|
4579
4592
|
}
|
|
4580
4593
|
) }),
|
|
4581
|
-
enableRowPinning && /* @__PURE__ */
|
|
4594
|
+
enableRowPinning && /* @__PURE__ */ jsx55(TableCell, { checkbox: true, className: cellDensity, onClick: (event) => event.stopPropagation(), children: !grouped && /* @__PURE__ */ jsx55(
|
|
4582
4595
|
Button,
|
|
4583
4596
|
{
|
|
4584
4597
|
type: "button",
|
|
@@ -4587,7 +4600,7 @@ function DataTableInner({
|
|
|
4587
4600
|
"aria-label": row.getIsPinned() ? "Unpin row" : "Pin row to top",
|
|
4588
4601
|
"aria-pressed": Boolean(row.getIsPinned()),
|
|
4589
4602
|
onClick: () => row.pin(row.getIsPinned() ? false : "top"),
|
|
4590
|
-
children: row.getIsPinned() ? /* @__PURE__ */
|
|
4603
|
+
children: row.getIsPinned() ? /* @__PURE__ */ jsx55(PushPinSlash, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx55(PushPin, { size: 16, "aria-hidden": true })
|
|
4591
4604
|
}
|
|
4592
4605
|
) }),
|
|
4593
4606
|
cells.map((cell, index) => {
|
|
@@ -4600,7 +4613,7 @@ function DataTableInner({
|
|
|
4600
4613
|
const indent = index === 0 && hasExpander && row.depth > 0 ? row.depth * 4 : 0;
|
|
4601
4614
|
let content;
|
|
4602
4615
|
if (cell.getIsGrouped()) {
|
|
4603
|
-
content = /* @__PURE__ */
|
|
4616
|
+
content = /* @__PURE__ */ jsxs42(
|
|
4604
4617
|
"button",
|
|
4605
4618
|
{
|
|
4606
4619
|
type: "button",
|
|
@@ -4608,9 +4621,9 @@ function DataTableInner({
|
|
|
4608
4621
|
"aria-expanded": row.getIsExpanded(),
|
|
4609
4622
|
onClick: row.getToggleExpandedHandler(),
|
|
4610
4623
|
children: [
|
|
4611
|
-
row.getIsExpanded() ? /* @__PURE__ */
|
|
4624
|
+
row.getIsExpanded() ? /* @__PURE__ */ jsx55(CaretDown5, { size: 16, "aria-hidden": true }) : /* @__PURE__ */ jsx55(CaretRight4, { size: 16, "aria-hidden": true }),
|
|
4612
4625
|
flexRender(cell.column.columnDef.cell, cell.getContext()),
|
|
4613
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsxs42("span", { className: "text-secondary-muted-foreground", children: [
|
|
4614
4627
|
"(",
|
|
4615
4628
|
row.subRows.length,
|
|
4616
4629
|
")"
|
|
@@ -4623,7 +4636,7 @@ function DataTableInner({
|
|
|
4623
4636
|
} else if (cell.getIsPlaceholder()) {
|
|
4624
4637
|
content = null;
|
|
4625
4638
|
} else if (meta.editable) {
|
|
4626
|
-
content = /* @__PURE__ */
|
|
4639
|
+
content = /* @__PURE__ */ jsx55(
|
|
4627
4640
|
EditableCell,
|
|
4628
4641
|
{
|
|
4629
4642
|
value: cell.getValue(),
|
|
@@ -4635,7 +4648,7 @@ function DataTableInner({
|
|
|
4635
4648
|
} else {
|
|
4636
4649
|
content = flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
4637
4650
|
}
|
|
4638
|
-
return /* @__PURE__ */
|
|
4651
|
+
return /* @__PURE__ */ jsx55(
|
|
4639
4652
|
TableCell,
|
|
4640
4653
|
{
|
|
4641
4654
|
align: meta.align,
|
|
@@ -4668,7 +4681,7 @@ function DataTableInner({
|
|
|
4668
4681
|
]
|
|
4669
4682
|
}
|
|
4670
4683
|
),
|
|
4671
|
-
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */
|
|
4684
|
+
renderSubComponent && !grouped && row.getIsExpanded() && /* @__PURE__ */ jsx55(TableRow, { className: "bg-background hover:bg-background", children: /* @__PURE__ */ jsx55(TableCell, { colSpan: columnSpan, children: renderSubComponent(row.original) }) })
|
|
4672
4685
|
] }, row.id);
|
|
4673
4686
|
};
|
|
4674
4687
|
const renderHeaderCell = (header) => {
|
|
@@ -4679,7 +4692,7 @@ function DataTableInner({
|
|
|
4679
4692
|
const pin = pinning(column, sized, true);
|
|
4680
4693
|
const reorderable = enableColumnOrdering && leaf && !column.getIsPinned();
|
|
4681
4694
|
const label = labelOf(column);
|
|
4682
|
-
return /* @__PURE__ */
|
|
4695
|
+
return /* @__PURE__ */ jsx55(
|
|
4683
4696
|
TableHead,
|
|
4684
4697
|
{
|
|
4685
4698
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
@@ -4715,7 +4728,7 @@ function DataTableInner({
|
|
|
4715
4728
|
reorderable && "cursor-grab",
|
|
4716
4729
|
!leaf && "text-center"
|
|
4717
4730
|
),
|
|
4718
|
-
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */
|
|
4731
|
+
resizer: enableColumnResizing && column.getCanResize() ? /* @__PURE__ */ jsx55(
|
|
4719
4732
|
"div",
|
|
4720
4733
|
{
|
|
4721
4734
|
role: "separator",
|
|
@@ -4730,14 +4743,14 @@ function DataTableInner({
|
|
|
4730
4743
|
)
|
|
4731
4744
|
}
|
|
4732
4745
|
) : void 0,
|
|
4733
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */
|
|
4746
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ jsx55(table.FlexRender, { header })
|
|
4734
4747
|
},
|
|
4735
4748
|
header.id
|
|
4736
4749
|
);
|
|
4737
4750
|
};
|
|
4738
4751
|
const stickyLeading = cn(cellDensity, sticky && "sticky top-0 z-20 bg-surface");
|
|
4739
|
-
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */
|
|
4740
|
-
enableRowSelection && /* @__PURE__ */
|
|
4752
|
+
const leadingHeaderCells = (rowSpan) => /* @__PURE__ */ jsxs42(Fragment15, { children: [
|
|
4753
|
+
enableRowSelection && /* @__PURE__ */ jsx55(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx55(
|
|
4741
4754
|
Checkbox,
|
|
4742
4755
|
{
|
|
4743
4756
|
"aria-label": "Select all rows",
|
|
@@ -4746,15 +4759,15 @@ function DataTableInner({
|
|
|
4746
4759
|
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(Boolean(checked))
|
|
4747
4760
|
}
|
|
4748
4761
|
) }),
|
|
4749
|
-
hasExpander && /* @__PURE__ */
|
|
4750
|
-
enableRowPinning && /* @__PURE__ */
|
|
4762
|
+
hasExpander && /* @__PURE__ */ jsx55(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx55("span", { className: "sr-only", children: "Expand" }) }),
|
|
4763
|
+
enableRowPinning && /* @__PURE__ */ jsx55(TableHead, { checkbox: true, rowSpan, className: stickyLeading, children: /* @__PURE__ */ jsx55("span", { className: "sr-only", children: "Pin" }) })
|
|
4751
4764
|
] });
|
|
4752
4765
|
const rowsToRender = virtualized ? virtualItems.map((item) => ({ row: bodyRows[item.index], index: item.index })) : null;
|
|
4753
4766
|
const totalRows = topRows.length + bodyRows.length + bottomRows.length;
|
|
4754
|
-
return /* @__PURE__ */
|
|
4755
|
-
showToolbar && /* @__PURE__ */
|
|
4756
|
-
/* @__PURE__ */
|
|
4757
|
-
enableGlobalFilter && /* @__PURE__ */
|
|
4767
|
+
return /* @__PURE__ */ jsxs42("div", { className: cn("flex w-full flex-col gap-2", wrapperClassName), children: [
|
|
4768
|
+
showToolbar && /* @__PURE__ */ jsxs42("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4769
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex items-center gap-2", children: [
|
|
4770
|
+
enableGlobalFilter && /* @__PURE__ */ jsx55(
|
|
4758
4771
|
SearchBar,
|
|
4759
4772
|
{
|
|
4760
4773
|
"aria-label": "Search table",
|
|
@@ -4767,8 +4780,8 @@ function DataTableInner({
|
|
|
4767
4780
|
),
|
|
4768
4781
|
toolbar
|
|
4769
4782
|
] }),
|
|
4770
|
-
/* @__PURE__ */
|
|
4771
|
-
enableDensityToggle && /* @__PURE__ */
|
|
4783
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex items-center gap-2", children: [
|
|
4784
|
+
enableDensityToggle && /* @__PURE__ */ jsxs42(
|
|
4772
4785
|
Button,
|
|
4773
4786
|
{
|
|
4774
4787
|
type: "button",
|
|
@@ -4777,20 +4790,20 @@ function DataTableInner({
|
|
|
4777
4790
|
"aria-pressed": compact,
|
|
4778
4791
|
onClick: () => setDensity(compact ? "default" : "compact"),
|
|
4779
4792
|
children: [
|
|
4780
|
-
/* @__PURE__ */
|
|
4793
|
+
/* @__PURE__ */ jsx55(Rows, { size: 16, "aria-hidden": true }),
|
|
4781
4794
|
"Compact"
|
|
4782
4795
|
]
|
|
4783
4796
|
}
|
|
4784
4797
|
),
|
|
4785
|
-
enableGrouping && /* @__PURE__ */
|
|
4786
|
-
/* @__PURE__ */
|
|
4787
|
-
/* @__PURE__ */
|
|
4798
|
+
enableGrouping && /* @__PURE__ */ jsxs42(DropdownMenu, { children: [
|
|
4799
|
+
/* @__PURE__ */ jsx55(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs42(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4800
|
+
/* @__PURE__ */ jsx55(Stack, { size: 16, "aria-hidden": true }),
|
|
4788
4801
|
"Group by"
|
|
4789
4802
|
] }) }),
|
|
4790
|
-
/* @__PURE__ */
|
|
4791
|
-
/* @__PURE__ */
|
|
4792
|
-
/* @__PURE__ */
|
|
4793
|
-
groupableColumns.map((column) => /* @__PURE__ */
|
|
4803
|
+
/* @__PURE__ */ jsxs42(DropdownMenuContent, { align: "end", children: [
|
|
4804
|
+
/* @__PURE__ */ jsx55(DropdownMenuLabel, { children: "Group rows by" }),
|
|
4805
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {}),
|
|
4806
|
+
groupableColumns.map((column) => /* @__PURE__ */ jsx55(
|
|
4794
4807
|
DropdownMenuCheckboxItem,
|
|
4795
4808
|
{
|
|
4796
4809
|
checked: column.getIsGrouped(),
|
|
@@ -4801,15 +4814,15 @@ function DataTableInner({
|
|
|
4801
4814
|
))
|
|
4802
4815
|
] })
|
|
4803
4816
|
] }),
|
|
4804
|
-
enableColumnVisibility && /* @__PURE__ */
|
|
4805
|
-
/* @__PURE__ */
|
|
4806
|
-
/* @__PURE__ */
|
|
4817
|
+
enableColumnVisibility && /* @__PURE__ */ jsxs42(DropdownMenu, { children: [
|
|
4818
|
+
/* @__PURE__ */ jsx55(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs42(Button, { type: "button", variant: "outline", size: "sm", children: [
|
|
4819
|
+
/* @__PURE__ */ jsx55(Sliders, { size: 16, "aria-hidden": true }),
|
|
4807
4820
|
"Columns"
|
|
4808
4821
|
] }) }),
|
|
4809
|
-
/* @__PURE__ */
|
|
4810
|
-
/* @__PURE__ */
|
|
4811
|
-
/* @__PURE__ */
|
|
4812
|
-
hideableColumns.map((column) => /* @__PURE__ */
|
|
4822
|
+
/* @__PURE__ */ jsxs42(DropdownMenuContent, { align: "end", children: [
|
|
4823
|
+
/* @__PURE__ */ jsx55(DropdownMenuLabel, { children: "Toggle columns" }),
|
|
4824
|
+
/* @__PURE__ */ jsx55(DropdownMenuSeparator, {}),
|
|
4825
|
+
hideableColumns.map((column) => /* @__PURE__ */ jsx55(
|
|
4813
4826
|
DropdownMenuCheckboxItem,
|
|
4814
4827
|
{
|
|
4815
4828
|
checked: column.getIsVisible(),
|
|
@@ -4822,7 +4835,7 @@ function DataTableInner({
|
|
|
4822
4835
|
] })
|
|
4823
4836
|
] })
|
|
4824
4837
|
] }),
|
|
4825
|
-
/* @__PURE__ */
|
|
4838
|
+
/* @__PURE__ */ jsxs42(
|
|
4826
4839
|
Table,
|
|
4827
4840
|
{
|
|
4828
4841
|
ref,
|
|
@@ -4835,52 +4848,52 @@ function DataTableInner({
|
|
|
4835
4848
|
tabIndex: enableCellSelection ? 0 : void 0,
|
|
4836
4849
|
...tableProps,
|
|
4837
4850
|
children: [
|
|
4838
|
-
/* @__PURE__ */
|
|
4839
|
-
headerGroups.map((group, groupIndex) => /* @__PURE__ */
|
|
4851
|
+
/* @__PURE__ */ jsxs42(TableHeader, { children: [
|
|
4852
|
+
headerGroups.map((group, groupIndex) => /* @__PURE__ */ jsxs42(TableRow, { className: "hover:bg-transparent", children: [
|
|
4840
4853
|
groupIndex === 0 && leadingHeaderCells(headerGroups.length + (enableColumnFilters ? 1 : 0)),
|
|
4841
4854
|
group.headers.map(renderHeaderCell)
|
|
4842
4855
|
] }, group.id)),
|
|
4843
|
-
enableColumnFilters && /* @__PURE__ */
|
|
4856
|
+
enableColumnFilters && /* @__PURE__ */ jsx55(TableRow, { className: "hover:bg-transparent", children: leafColumns.map((column) => {
|
|
4844
4857
|
const pin = pinning(column, sized, true);
|
|
4845
|
-
return /* @__PURE__ */
|
|
4858
|
+
return /* @__PURE__ */ jsx55(
|
|
4846
4859
|
TableHead,
|
|
4847
4860
|
{
|
|
4848
4861
|
style: pin.style,
|
|
4849
4862
|
className: cn("h-auto py-2 font-normal", pin.className, sticky && !column.getIsPinned() && "bg-surface"),
|
|
4850
|
-
children: column.getCanFilter() ? /* @__PURE__ */
|
|
4863
|
+
children: column.getCanFilter() ? /* @__PURE__ */ jsx55(ColumnFilter, { column }) : null
|
|
4851
4864
|
},
|
|
4852
4865
|
column.id
|
|
4853
4866
|
);
|
|
4854
4867
|
}) })
|
|
4855
4868
|
] }),
|
|
4856
|
-
/* @__PURE__ */
|
|
4857
|
-
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */
|
|
4869
|
+
/* @__PURE__ */ jsxs42(TableBody, { children: [
|
|
4870
|
+
loading ? Array.from({ length: pageSize }, (_, index) => skeletonRow(`loading-${index}`)) : totalRows === 0 ? /* @__PURE__ */ jsx55(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx55(TableCell, { colSpan: columnSpan, muted: true, className: "h-24 text-center", children: emptyState ?? "No results." }) }) : /* @__PURE__ */ jsxs42(Fragment15, { children: [
|
|
4858
4871
|
topRows.map((row, index) => renderRow(row, { pinned: "top", pinnedIndex: index, pinnedCount: topRows.length })),
|
|
4859
|
-
virtualized && paddingTop > 0 && /* @__PURE__ */
|
|
4872
|
+
virtualized && paddingTop > 0 && /* @__PURE__ */ jsx55("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx55("td", { colSpan: columnSpan, style: { height: paddingTop } }) }),
|
|
4860
4873
|
rowsToRender ? rowsToRender.map(({ row, index }) => renderRow(row, { virtualIndex: index })) : bodyRows.map((row) => renderRow(row)),
|
|
4861
|
-
virtualized && paddingBottom > 0 && /* @__PURE__ */
|
|
4874
|
+
virtualized && paddingBottom > 0 && /* @__PURE__ */ jsx55("tr", { "aria-hidden": true, children: /* @__PURE__ */ jsx55("td", { colSpan: columnSpan, style: { height: paddingBottom } }) }),
|
|
4862
4875
|
bottomRows.map(
|
|
4863
4876
|
(row, index) => renderRow(row, { pinned: "bottom", pinnedIndex: index, pinnedCount: bottomRows.length })
|
|
4864
4877
|
)
|
|
4865
4878
|
] }),
|
|
4866
|
-
infinite && /* @__PURE__ */
|
|
4879
|
+
infinite && /* @__PURE__ */ jsxs42(Fragment15, { children: [
|
|
4867
4880
|
loadingMore && Array.from({ length: 3 }, (_, index) => skeletonRow(`more-${index}`)),
|
|
4868
|
-
/* @__PURE__ */
|
|
4881
|
+
/* @__PURE__ */ jsx55("tr", { ref: sentinelRef, "aria-hidden": true, children: /* @__PURE__ */ jsx55("td", { colSpan: columnSpan, className: "h-px p-0" }) })
|
|
4869
4882
|
] })
|
|
4870
4883
|
] }),
|
|
4871
|
-
showFooter && /* @__PURE__ */
|
|
4872
|
-
leadingCount > 0 && /* @__PURE__ */
|
|
4884
|
+
showFooter && /* @__PURE__ */ jsx55(TableFooter, { children: table.getFooterGroups().map((group) => /* @__PURE__ */ jsxs42(TableRow, { className: "hover:bg-transparent", children: [
|
|
4885
|
+
leadingCount > 0 && /* @__PURE__ */ jsx55(TableCell, { colSpan: leadingCount, className: cellDensity }),
|
|
4873
4886
|
group.headers.map((header) => {
|
|
4874
4887
|
const { align } = getMeta(header.column.columnDef.meta);
|
|
4875
4888
|
const pin = pinning(header.column, sized);
|
|
4876
|
-
return /* @__PURE__ */
|
|
4889
|
+
return /* @__PURE__ */ jsx55(
|
|
4877
4890
|
TableCell,
|
|
4878
4891
|
{
|
|
4879
4892
|
align,
|
|
4880
4893
|
colSpan: header.colSpan > 1 ? header.colSpan : void 0,
|
|
4881
4894
|
style: pin.style,
|
|
4882
4895
|
className: cn("text-ui-label", pin.className, cellDensity),
|
|
4883
|
-
children: header.isPlaceholder ? null : /* @__PURE__ */
|
|
4896
|
+
children: header.isPlaceholder ? null : /* @__PURE__ */ jsx55(table.FlexRender, { footer: header })
|
|
4884
4897
|
},
|
|
4885
4898
|
header.id
|
|
4886
4899
|
);
|
|
@@ -4889,9 +4902,9 @@ function DataTableInner({
|
|
|
4889
4902
|
]
|
|
4890
4903
|
}
|
|
4891
4904
|
),
|
|
4892
|
-
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */
|
|
4893
|
-
/* @__PURE__ */
|
|
4894
|
-
paginate && pageCount > 1 && /* @__PURE__ */
|
|
4905
|
+
(enableRowSelection || paginate && pageCount > 1) && /* @__PURE__ */ jsxs42("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4906
|
+
/* @__PURE__ */ jsx55("span", { className: "text-body-small text-secondary-muted-foreground", "aria-live": "polite", children: enableRowSelection ? `${selectedCount} of ${table.getCoreRowModel().rows.length} row(s) selected` : null }),
|
|
4907
|
+
paginate && pageCount > 1 && /* @__PURE__ */ jsx55(
|
|
4895
4908
|
Pagination,
|
|
4896
4909
|
{
|
|
4897
4910
|
page: pagination.pageIndex + 1,
|
|
@@ -4902,13 +4915,13 @@ function DataTableInner({
|
|
|
4902
4915
|
] })
|
|
4903
4916
|
] });
|
|
4904
4917
|
}
|
|
4905
|
-
var DataTable =
|
|
4918
|
+
var DataTable = React54.forwardRef(DataTableInner);
|
|
4906
4919
|
DataTable.displayName = "DataTable";
|
|
4907
4920
|
|
|
4908
4921
|
// src/components/Data Display/StatCard.tsx
|
|
4909
|
-
import * as
|
|
4922
|
+
import * as React55 from "react";
|
|
4910
4923
|
import { cva as cva6 } from "class-variance-authority";
|
|
4911
|
-
import { jsx as
|
|
4924
|
+
import { jsx as jsx56, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4912
4925
|
var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3", {
|
|
4913
4926
|
variants: {
|
|
4914
4927
|
variant: {
|
|
@@ -4922,26 +4935,26 @@ var statCardVariants = cva6("flex min-w-0 flex-col gap-2 rounded-md border p-3",
|
|
|
4922
4935
|
},
|
|
4923
4936
|
defaultVariants: { variant: "default" }
|
|
4924
4937
|
});
|
|
4925
|
-
var StatCard =
|
|
4926
|
-
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */
|
|
4927
|
-
/* @__PURE__ */
|
|
4928
|
-
/* @__PURE__ */
|
|
4929
|
-
icon && /* @__PURE__ */
|
|
4938
|
+
var StatCard = React55.forwardRef(
|
|
4939
|
+
({ className, variant, label, value, icon, caption, ...props }, ref) => /* @__PURE__ */ jsxs43("div", { ref, className: cn(statCardVariants({ variant }), className), ...props, children: [
|
|
4940
|
+
/* @__PURE__ */ jsx56("p", { className: "truncate text-ui-caption text-secondary-muted-foreground", children: label }),
|
|
4941
|
+
/* @__PURE__ */ jsxs43("p", { className: "flex items-center gap-2 text-body-base text-surface-foreground", children: [
|
|
4942
|
+
icon && /* @__PURE__ */ jsx56("span", { "aria-hidden": "true", className: "inline-flex size-6 shrink-0 items-center justify-center", children: icon }),
|
|
4930
4943
|
value
|
|
4931
4944
|
] }),
|
|
4932
|
-
caption && /* @__PURE__ */
|
|
4945
|
+
caption && /* @__PURE__ */ jsx56("p", { className: "text-ui-caption text-secondary-muted-foreground", children: caption })
|
|
4933
4946
|
] })
|
|
4934
4947
|
);
|
|
4935
4948
|
StatCard.displayName = "StatCard";
|
|
4936
4949
|
|
|
4937
4950
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
4938
|
-
import * as
|
|
4951
|
+
import * as React57 from "react";
|
|
4939
4952
|
|
|
4940
4953
|
// src/components/Tags & Badges/EditableTag.tsx
|
|
4941
|
-
import * as
|
|
4954
|
+
import * as React56 from "react";
|
|
4942
4955
|
import { Crown, Plus as Plus5, X as X6 } from "@phosphor-icons/react";
|
|
4943
4956
|
import { cva as cva7 } from "class-variance-authority";
|
|
4944
|
-
import { jsx as
|
|
4957
|
+
import { jsx as jsx57, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
4945
4958
|
var editableTagVariants = cva7(
|
|
4946
4959
|
"inline-flex h-6.5 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
4947
4960
|
{
|
|
@@ -4956,27 +4969,27 @@ var editableTagVariants = cva7(
|
|
|
4956
4969
|
defaultVariants: { type: "default" }
|
|
4957
4970
|
}
|
|
4958
4971
|
);
|
|
4959
|
-
var EditableTag =
|
|
4972
|
+
var EditableTag = React56.forwardRef(
|
|
4960
4973
|
({ className, type = "default", icon, onRemove, onClick, children, ...props }, ref) => {
|
|
4961
4974
|
const classes = cn(editableTagVariants({ type }), className);
|
|
4962
|
-
const leading = type === "add" ? /* @__PURE__ */
|
|
4975
|
+
const leading = type === "add" ? /* @__PURE__ */ jsx57(Plus5, { size: 12, "aria-hidden": true }) : icon !== void 0 ? icon : type === "default" ? /* @__PURE__ */ jsx57(Crown, { size: 12, weight: "fill", "aria-hidden": true }) : null;
|
|
4963
4976
|
if (type === "add" || type === "multiple" && onClick) {
|
|
4964
|
-
return /* @__PURE__ */
|
|
4977
|
+
return /* @__PURE__ */ jsxs44("button", { ref, type: "button", className: classes, onClick, ...props, children: [
|
|
4965
4978
|
leading,
|
|
4966
4979
|
children
|
|
4967
4980
|
] });
|
|
4968
4981
|
}
|
|
4969
|
-
return /* @__PURE__ */
|
|
4982
|
+
return /* @__PURE__ */ jsxs44("span", { ref, className: classes, ...props, children: [
|
|
4970
4983
|
leading,
|
|
4971
4984
|
children,
|
|
4972
|
-
onRemove && /* @__PURE__ */
|
|
4985
|
+
onRemove && /* @__PURE__ */ jsx57(
|
|
4973
4986
|
"button",
|
|
4974
4987
|
{
|
|
4975
4988
|
type: "button",
|
|
4976
4989
|
"aria-label": typeof children === "string" ? `Remove ${children}` : "Remove",
|
|
4977
4990
|
onClick: onRemove,
|
|
4978
4991
|
className: "inline-flex size-3 items-center justify-center rounded-xs",
|
|
4979
|
-
children: /* @__PURE__ */
|
|
4992
|
+
children: /* @__PURE__ */ jsx57(X6, { size: 12, "aria-hidden": true })
|
|
4980
4993
|
}
|
|
4981
4994
|
)
|
|
4982
4995
|
] });
|
|
@@ -4985,26 +4998,26 @@ var EditableTag = React55.forwardRef(
|
|
|
4985
4998
|
EditableTag.displayName = "EditableTag";
|
|
4986
4999
|
|
|
4987
5000
|
// src/components/Research-Specific/ActivityStructure.tsx
|
|
4988
|
-
import { jsx as
|
|
4989
|
-
var ActivityStructure =
|
|
4990
|
-
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */
|
|
5001
|
+
import { jsx as jsx58, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
5002
|
+
var ActivityStructure = React57.forwardRef(
|
|
5003
|
+
({ className, title = "Activity Structure", stats, sections, onRemoveTag, onAddTag, addTagLabel = "Add tag", action, children, ...props }, ref) => /* @__PURE__ */ jsxs45(
|
|
4991
5004
|
"section",
|
|
4992
5005
|
{
|
|
4993
5006
|
ref,
|
|
4994
5007
|
className: cn("flex w-full max-w-96.5 flex-col gap-4 rounded-xl bg-surface p-4", className),
|
|
4995
5008
|
...props,
|
|
4996
5009
|
children: [
|
|
4997
|
-
/* @__PURE__ */
|
|
4998
|
-
/* @__PURE__ */
|
|
5010
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5011
|
+
/* @__PURE__ */ jsx58("h3", { className: "text-body-section text-surface-foreground", children: title }),
|
|
4999
5012
|
action
|
|
5000
5013
|
] }),
|
|
5001
|
-
stats.length > 0 && /* @__PURE__ */
|
|
5002
|
-
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */
|
|
5003
|
-
/* @__PURE__ */
|
|
5004
|
-
/* @__PURE__ */
|
|
5005
|
-
(tags?.length || onAddTag) && /* @__PURE__ */
|
|
5006
|
-
tags?.map((tag) => /* @__PURE__ */
|
|
5007
|
-
onAddTag && /* @__PURE__ */
|
|
5014
|
+
stats.length > 0 && /* @__PURE__ */ jsx58("div", { className: "grid grid-cols-2 gap-3", children: stats.map(({ id, ...stat }) => /* @__PURE__ */ jsx58(StatCard, { ...stat }, id)) }),
|
|
5015
|
+
sections?.map(({ id, heading, body, tags }) => /* @__PURE__ */ jsxs45("div", { className: "flex flex-col gap-2", children: [
|
|
5016
|
+
/* @__PURE__ */ jsx58("h4", { className: "text-heading-h4 text-surface-foreground", children: heading }),
|
|
5017
|
+
/* @__PURE__ */ jsx58("div", { className: "text-body-base text-surface-foreground", children: body }),
|
|
5018
|
+
(tags?.length || onAddTag) && /* @__PURE__ */ jsxs45("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5019
|
+
tags?.map((tag) => /* @__PURE__ */ jsx58(EditableTag, { type: "editable", onRemove: onRemoveTag && (() => onRemoveTag(id, tag)), children: tag }, tag)),
|
|
5020
|
+
onAddTag && /* @__PURE__ */ jsx58(EditableTag, { type: "add", onClick: () => onAddTag(id), children: addTagLabel })
|
|
5008
5021
|
] })
|
|
5009
5022
|
] }, id)),
|
|
5010
5023
|
children
|
|
@@ -5015,10 +5028,10 @@ var ActivityStructure = React56.forwardRef(
|
|
|
5015
5028
|
ActivityStructure.displayName = "ActivityStructure";
|
|
5016
5029
|
|
|
5017
5030
|
// src/components/Tags & Badges/Badge.tsx
|
|
5018
|
-
import * as
|
|
5031
|
+
import * as React58 from "react";
|
|
5019
5032
|
import { DotsSixVertical as DotsSixVertical5, RadioButton as RadioButton3 } from "@phosphor-icons/react";
|
|
5020
5033
|
import { cva as cva8 } from "class-variance-authority";
|
|
5021
|
-
import { jsx as
|
|
5034
|
+
import { jsx as jsx59, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
5022
5035
|
var roleTagVariants = cva8(
|
|
5023
5036
|
"group inline-flex h-6 items-center whitespace-nowrap rounded-sm py-1 text-ui-caption transition-colors",
|
|
5024
5037
|
{
|
|
@@ -5044,11 +5057,11 @@ var roleTagVariants = cva8(
|
|
|
5044
5057
|
defaultVariants: { type: "primary", selected: false }
|
|
5045
5058
|
}
|
|
5046
5059
|
);
|
|
5047
|
-
var Badge =
|
|
5060
|
+
var Badge = React58.forwardRef(
|
|
5048
5061
|
({ className, type = "primary", selected = false, onClick, children, ...props }, ref) => {
|
|
5049
5062
|
const classes = cn(roleTagVariants({ type, selected: type === "interactable" ? selected : false }), className);
|
|
5050
5063
|
if (type === "interactable") {
|
|
5051
|
-
return /* @__PURE__ */
|
|
5064
|
+
return /* @__PURE__ */ jsxs46(
|
|
5052
5065
|
"button",
|
|
5053
5066
|
{
|
|
5054
5067
|
ref,
|
|
@@ -5058,15 +5071,15 @@ var Badge = React57.forwardRef(
|
|
|
5058
5071
|
onClick,
|
|
5059
5072
|
...props,
|
|
5060
5073
|
children: [
|
|
5061
|
-
/* @__PURE__ */
|
|
5074
|
+
/* @__PURE__ */ jsx59(DotsSixVertical5, { size: 16, "aria-hidden": true, className: "hidden shrink-0 group-hover:block" }),
|
|
5062
5075
|
children
|
|
5063
5076
|
]
|
|
5064
5077
|
}
|
|
5065
5078
|
);
|
|
5066
5079
|
}
|
|
5067
|
-
return /* @__PURE__ */
|
|
5068
|
-
type === "question" && /* @__PURE__ */
|
|
5069
|
-
type === "id" && /* @__PURE__ */
|
|
5080
|
+
return /* @__PURE__ */ jsxs46("span", { ref, className: classes, ...props, children: [
|
|
5081
|
+
type === "question" && /* @__PURE__ */ jsx59(RadioButton3, { size: 16, weight: "fill", "aria-hidden": true }),
|
|
5082
|
+
type === "id" && /* @__PURE__ */ jsx59("span", { className: "text-secondary-muted-foreground", children: "ID" }),
|
|
5070
5083
|
children
|
|
5071
5084
|
] });
|
|
5072
5085
|
}
|
|
@@ -5139,6 +5152,7 @@ export {
|
|
|
5139
5152
|
QuestionEditorCard,
|
|
5140
5153
|
QuestionHeader,
|
|
5141
5154
|
QuestionNavItem,
|
|
5155
|
+
QuestionNumberTag,
|
|
5142
5156
|
QuestionOption,
|
|
5143
5157
|
QuestionOptionEditor,
|
|
5144
5158
|
QuestionOtherOption,
|