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